:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f0f0f2;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #a1a1a6;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.14);
  --accent: #e8482c;
  --accent-soft: #fff0ec;
  --accent-2: #0071e3;
  --green: #1fbf6f;
  --red: #e8482c;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.12);
  --radius: 20px;
  --radius-sm: 12px;
  --topbar-h: 60px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

[data-theme="dark"] {
  --bg: #0b0b0c;
  --surface: #171719;
  --surface-2: #1f1f22;
  --text: #f5f5f7;
  --text-2: #a1a1a6;
  --text-3: #6e6e73;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #ff5a3c;
  --accent-soft: #2b1c18;
  --accent-2: #4da3ff;
  --green: #34c98e;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
[hidden] { display: none !important; }

body.drawer-open,
body.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  height: 100%;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: radial-gradient(circle at 32% 28%, #fff 0 9%, var(--accent) 10% 38%, #c5331c 39% 100%);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 4px 12px rgba(232, 72, 44, 0.35);
  position: relative;
}
.brand-mark::after {
  content: "";
  position: absolute; inset: 0; border-radius: 10px;
  background: linear-gradient(135deg, rgba(255,255,255,0.5), transparent 40%);
}
.brand-text h1 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.02em; }
.brand-text p { margin: 0; font-size: 11px; color: var(--text-2); font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative;
  width: 38px; height: 38px; border-radius: 50%;
  border: none; background: transparent; color: var(--text);
  display: grid; place-items: center; transition: background 0.15s;
}
.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.94); }
.badge-dot {
  position: absolute; top: 7px; right: 7px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--accent); border: 1.5px solid var(--surface);
}
[data-theme="light"] .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }

/* ---------- layout ---------- */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 20px 120px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 22px;
  align-items: start;
}

/* ---------- hero ---------- */
.hero { margin-bottom: 18px; }
.hero-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.hero-title h2 {
  margin: 0; font-size: 40px; font-weight: 800; letter-spacing: -0.035em; line-height: 1.05;
}
.hero-badges { display: flex; gap: 8px; align-items: center; }
.live-pill, .week-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: 999px;
}
.live-pill { background: var(--accent-soft); color: var(--accent); }
.live-pill.stale { background: var(--surface-2); color: var(--text-2); }
.live-pill .pulse {
  width: 7px; height: 7px; border-radius: 50%; background: currentColor;
  box-shadow: 0 0 0 0 rgba(232, 72, 44, 0.4); animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 72, 44, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(232, 72, 44, 0); }
  100% { box-shadow: 0 0 0 0 rgba(232, 72, 44, 0); }
}
.week-pill { background: var(--surface); color: var(--text-2); border: 1px solid var(--line); }
.hero-sub { margin: 10px 0 4px; color: var(--text-2); font-size: 15px; }
.hero-updated { margin: 0; color: var(--text-3); font-size: 12.5px; }

/* ---------- segmented ---------- */
.segmented {
  position: relative;
  display: inline-flex; padding: 4px; gap: 2px;
  background: var(--surface-2); border-radius: 12px; margin: 4px 0 14px;
}
.seg {
  position: relative; z-index: 1;
  border: none; background: transparent; color: var(--text-2);
  font-size: 14px; font-weight: 600; padding: 8px 18px; border-radius: 9px;
  transition: color 0.2s;
}
.seg[aria-selected="true"] { color: var(--text); }
.seg-thumb {
  position: absolute; top: 4px; bottom: 4px; width: 88px;
  background: var(--surface); border-radius: 9px; box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- toolbar ---------- */
.toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.search-box {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 0 13px; height: 44px; color: var(--text-3);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box input {
  flex: 1; border: none; outline: none; background: transparent; color: var(--text);
  font-size: 15px;
}
.search-box input::placeholder { color: var(--text-3); }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 600; padding: 6px 14px; border-radius: 999px;
  transition: all 0.15s;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }

/* ---------- update banner ---------- */
.update-banner {
  display: flex; align-items: center; gap: 12px;
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px;
}
.update-banner-icon {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800;
}
.update-banner-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.update-banner-body strong { font-size: 14px; }
.update-banner-body span { font-size: 12.5px; color: var(--text-2); }
.link-btn { border: none; background: none; color: var(--accent); font-weight: 700; font-size: 13px; }

/* ---------- rank list ---------- */
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rank-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px; cursor: pointer; position: relative;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.rank-row:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: var(--line-strong); }
.rank-row.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.rank-row .rank-num {
  width: 34px; text-align: center; font-size: 19px; font-weight: 800; color: var(--text-2);
  font-variant-numeric: tabular-nums; flex: none;
}
.rank-row.top3 .rank-num { color: var(--accent); }
.rank-move { font-size: 11px; font-weight: 700; flex: none; text-align: center; width: 30px; }
.rank-move.up { color: var(--green); }
.rank-move.down { color: var(--red); }
.rank-move.new { color: var(--accent-2); }
.rank-move.same { color: var(--text-3); }
.rank-player { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--surface-2), var(--line-strong));
  display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-2);
  letter-spacing: 0.02em;
}
.avatar.chn { background: linear-gradient(135deg, #ffe3dd, #ffc2b8); color: #a5291a; }
.avatar.jpn { background: linear-gradient(135deg, #ffe9ee, #ffc9d6); color: #a11f41; }
.rank-player .names { min-width: 0; }
.rank-player .names .cn { font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; }
.rank-player .names .en { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-player .names .sub { font-size: 11.5px; color: var(--text-3); }
.rank-right { text-align: right; flex: none; }
.rank-right .pts { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-right .delta { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.rank-right .delta.pos { color: var(--green); }
.rank-right .delta.neg { color: var(--red); }
.fav-star {
  border: none; background: none; color: var(--text-3); font-size: 17px; padding: 4px;
  transition: color 0.15s, transform 0.15s; flex: none;
}
.fav-star.active { color: #f5b400; }
.fav-star:hover { transform: scale(1.15); }
.compare-add {
  border: none; background: var(--surface-2); color: var(--text-2);
  width: 30px; height: 30px; border-radius: 50%; font-size: 17px; font-weight: 700; flex: none;
  transition: all 0.15s;
}
.compare-add.in { background: var(--accent); color: #fff; }
.list-empty { text-align: center; color: var(--text-3); padding: 60px 0; }

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface) 50%, var(--surface-2) 75%);
  background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 8px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- detail panel ---------- */
.detail-panel {
  position: sticky; top: calc(var(--topbar-h) + 22px);
  height: calc(100vh - var(--topbar-h) - 44px);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.detail-close {
  display: none; position: absolute; z-index: 2; top: 12px; right: 12px;
  width: 34px; height: 34px; border-radius: 50%; border: none;
  background: var(--surface-2); color: var(--text-2); font-size: 14px;
}
.detail-scroll { height: 100%; width: 100%; max-width: 100%; overflow-y: auto; overflow-x: hidden; padding: 26px; scroll-behavior: smooth; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.detail-placeholder {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; color: var(--text-3); text-align: center;
}
.detail-placeholder p { margin: 0; font-size: 16px; color: var(--text-2); font-weight: 600; }
.detail-placeholder span { font-size: 13px; }
.placeholder-ball {
  width: 64px; height: 64px; border-radius: 50%; margin-bottom: 10px;
  background: radial-gradient(circle at 32% 28%, #fff 0 9%, var(--accent) 10% 40%, #c5331c 41% 100%);
  box-shadow: 0 12px 30px rgba(232, 72, 44, 0.3);
}

.player-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.player-head .avatar-lg {
  width: 66px; height: 66px; border-radius: 50%; flex: none;
  background: linear-gradient(135deg, var(--accent-soft), var(--line));
  display: grid; place-items: center; font-size: 18px; font-weight: 800; color: var(--accent);
}
.player-head .ph-names { flex: 1; min-width: 0; }
.player-head .ph-names .cn { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.15; }
.player-head .ph-names .en { font-size: 14px; color: var(--text-2); margin-top: 2px; }
.player-head .ph-names .meta { font-size: 12.5px; color: var(--text-3); margin-top: 5px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.player-head .rank-badge {
  text-align: center; flex: none; padding: 8px 14px; border-radius: 14px; background: var(--surface-2);
}
.player-head .rank-badge b { display: block; font-size: 30px; line-height: 1; letter-spacing: -0.03em; }
.player-head .rank-badge span { font-size: 11px; color: var(--text-2); font-weight: 600; }
.country-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--surface-2); padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
}
.country-tag .code { color: var(--text-2); }

.stat-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 20px; }
.stat-card { background: var(--surface-2); border-radius: 14px; padding: 12px 14px; min-width: 0; }
.stat-card .k { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.stat-card .v { font-size: 19px; font-weight: 800; margin-top: 3px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.stat-card .v.small { font-size: 15px; }

.section-title { font-size: 13px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.05em; margin: 0 0 10px; }
.breakdown-note { font-size: 12.5px; color: var(--text-2); margin: -4px 0 14px; line-height: 1.5; }
.breakdown-note .mismatch { color: var(--accent); }

.total-bar { margin-bottom: 16px; }
.total-bar .tb-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.total-bar .tb-head b { font-size: 15px; }
.total-bar .tb-head span { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tb-track { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; display: flex; }
.tb-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #ff8a6b); border-radius: 999px; transition: width 0.6s cubic-bezier(0.4,0,0.2,1); }

.breakdown-list { display: flex; flex-direction: column; gap: 8px; }
.break-item {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center;
  padding: 11px 12px; border-radius: 13px; background: var(--surface);
  border: 1px solid var(--line); position: relative;
}
.break-item.counted { border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: var(--accent-soft); }
.break-item .bi-idx { font-size: 12px; font-weight: 800; color: var(--text-3); text-align: center; }
.break-item.counted .bi-idx { color: var(--accent); }
.break-item .bi-main { min-width: 0; }
.break-item .bi-event { font-size: 13.5px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.event-link { cursor: pointer; transition: color 0.15s; }
.event-link:hover { color: var(--accent); }
.event-link .event-cue {
  display: inline-block; margin-left: 3px; color: var(--text-3); font-weight: 700;
  transition: transform 0.15s, color 0.15s;
}
.event-link:hover .event-cue { color: var(--accent); transform: translateX(2px); }
.event-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.break-item .bi-sub { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.break-item .bi-pts { text-align: right; }
.break-item .bi-pts b { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.break-item .bi-pts span { display: block; font-size: 10.5px; color: var(--text-3); }
.break-item .count-tag {
  position: absolute; top: 8px; right: 10px; font-size: 10px; font-weight: 800;
  color: var(--accent); padding: 1px 7px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.break-item .bi-pts { padding-top: 0; }
.new-tag {
  display: inline-block; vertical-align: 1px; margin-left: 4px;
  font-size: 9.5px; font-weight: 800; line-height: 1.4;
  color: #fff; background: var(--accent); padding: 1px 6px; border-radius: 999px;
}
.bi-bar { grid-column: 2 / 3; height: 4px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: -2px; }
.bi-bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }
.break-item:not(.counted) .bi-bar i { background: var(--text-3); opacity: 0.4; }

.mini-trend { margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }
.mini-trend svg { width: 100%; height: 70px; }

/* ---------- compare tray ---------- */
.compare-tray {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 60; display: flex; align-items: center; gap: 12px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line); border-radius: 20px; padding: 12px 14px; box-shadow: var(--shadow-lg);
}
.compare-slots { display: flex; align-items: center; gap: 8px; }
.compare-slot {
  min-width: 96px; padding: 8px 12px; border-radius: 12px; border: 1px dashed var(--line-strong);
  background: var(--surface-2); color: var(--text-2); text-align: left;
  display: flex; flex-direction: column; gap: 1px; transition: all 0.15s;
}
.compare-slot.filled { border-style: solid; border-color: var(--accent); background: var(--accent-soft); }
.compare-slot span { font-size: 12px; }
.compare-slot b { font-size: 14px; font-weight: 700; color: var(--text); }
.compare-slot:not(.filled) b { color: var(--text-3); }
.vs { font-size: 12px; font-weight: 800; color: var(--text-3); }
.primary-btn {
  border: none; background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  padding: 11px 18px; border-radius: 12px; transition: opacity 0.15s, transform 0.15s;
}
.primary-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.primary-btn:not(:disabled):hover { transform: translateY(-1px); }
.ghost-btn { border: none; background: none; color: var(--text-2); font-weight: 600; font-size: 13px; padding: 8px 6px; }

/* ---------- sheets & modals ---------- */
.scrim { position: fixed; inset: 0; z-index: 95; background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); }
.sheet {
  position: fixed; z-index: 120; background: var(--surface); border: 1px solid var(--line);
  border-radius: 24px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column;
  max-height: 86vh; max-width: 720px; width: calc(100% - 32px);
  top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.sheet-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--line);
}
.sheet-head h3 { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; }
.close-btn { background: var(--surface-2); }
.sheet-body { padding: 20px; overflow-y: auto; }

/* compare content */
.h2h-vs { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-bottom: 20px; }
.h2h-side { text-align: center; background: var(--surface-2); border-radius: 16px; padding: 16px 12px; }
.h2h-side .avatar { margin: 0 auto 8px; }
.h2h-side .nm { font-size: 15px; font-weight: 700; }
.h2h-side .rk { font-size: 12px; color: var(--text-2); }
.h2h-mid { text-align: center; min-width: 84px; }
.h2h-mid .big { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.h2h-mid .lbl { font-size: 11px; color: var(--text-3); }
.h2h-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.h2h-card { background: var(--surface-2); border-radius: 14px; padding: 12px; text-align: center; }
.h2h-card .k { font-size: 11px; color: var(--text-2); font-weight: 600; }
.h2h-card .v { font-size: 20px; font-weight: 800; margin-top: 2px; }
.form-strip { display: flex; gap: 4px; justify-content: center; }
.form-strip i { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-style: normal; font-size: 11px; font-weight: 800; }
.form-strip i.W { background: var(--green); color: #fff; }
.form-strip i.L { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.match-list { display: flex; flex-direction: column; gap: 8px; }
.match-item { border: 1px solid var(--line); border-radius: 13px; padding: 11px 13px; }
.match-item .mi-top { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-2); }
.match-item .mi-mid { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.match-item .mi-mid .who { font-weight: 700; font-size: 14px; }
.match-item .mi-mid .who.win::after { content: "胜"; font-size: 10px; color: var(--green); margin-left: 5px; font-weight: 800; }
.match-item .mi-mid .score { font-size: 16px; font-weight: 800; font-variant-numeric: tabular-nums; }
.match-item .mi-sub { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.empty-state { text-align: center; color: var(--text-3); padding: 34px 10px; }
.empty-state .ico { font-size: 30px; }

/* changes modal */
.change-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); }
.change-item:last-child { border-bottom: none; }
.change-item .avatar { width: 34px; height: 34px; font-size: 10px; }
.change-item .ci-main { flex: 1; min-width: 0; }
.change-item .ci-main b { font-size: 14px; }
.change-item .ci-main span { display: block; font-size: 11.5px; color: var(--text-2); }
.change-item .ci-delta { text-align: right; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }
.change-item .ci-delta.up { color: var(--green); }
.change-item .ci-delta.down { color: var(--red); }

/* event progression */
.event-sheet { max-width: 900px; width: calc(100% - 32px); max-height: 90vh; }
.event-modal-title { min-width: 0; }
.event-modal-title h3 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.event-modal-title p { margin: 3px 0 0; font-size: 12px; color: var(--text-2); }
.event-summary {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  margin-bottom: 14px; font-size: 12.5px; color: var(--text-2);
}
.event-summary .tag {
  background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font-weight: 600;
}
.event-summary .tag.accent { background: var(--accent-soft); color: var(--accent); }
.event-path {
  background: var(--surface-2); border-radius: 16px; padding: 13px; margin-bottom: 16px;
}
.event-path-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 700; color: var(--text-2); margin-bottom: 9px;
}
.path-list { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.path-step {
  flex: 0 0 auto; min-width: 136px; max-width: 190px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px;
}
.path-step.win { border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.path-step.loss { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.path-step .ps-round { font-size: 10.5px; color: var(--text-3); font-weight: 700; }
.path-step .ps-opp { font-size: 13px; font-weight: 700; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.path-step .ps-score { font-size: 12px; font-weight: 800; margin-top: 3px; color: var(--green); }
.path-step.loss .ps-score { color: var(--red); }
.path-step .ps-games { font-size: 10.5px; color: var(--text-2); margin-top: 4px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.round-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 10px; }
.round-tab {
  flex: 0 0 auto; border: 1px solid var(--line); background: var(--surface);
  color: var(--text-2); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 700;
}
.round-tab.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.bracket-round { border-top: 1px solid var(--line); padding: 12px 0 4px; }
.bracket-round:first-of-type { border-top: none; }
.bracket-round-head {
  display: flex; align-items: baseline; justify-content: space-between;
  font-size: 14px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.01em;
}
.bracket-round-head span { font-size: 11.5px; color: var(--text-2); font-weight: 600; }
.bracket-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bracket-match {
  border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; background: var(--surface);
}
.bracket-match.has-player { border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.bm-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--text-3); margin-bottom: 6px; }
.bm-row {
  display: flex; align-items: center; gap: 8px; padding: 3px 0;
  font-size: 12.5px; color: var(--text-2); min-width: 0;
}
.bm-row.win { color: var(--text); font-weight: 700; }
.bm-row.self { color: var(--accent); }
.bm-row .bm-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bm-row .bm-games { flex: 0 0 auto; font-size: 10.5px; color: var(--text-3); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.bm-row.win .bm-games { color: var(--text-2); }
.bm-row .bm-score { flex: 0 0 20px; text-align: right; font-weight: 800; font-variant-numeric: tabular-nums; }
.bm-bar { height: 3px; border-radius: 999px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
.bm-bar i { display: block; height: 100%; background: var(--accent); opacity: 0.6; }
.event-empty { text-align: center; color: var(--text-2); padding: 44px 12px; }
.event-empty .ico { font-size: 32px; margin-bottom: 8px; }

@media (min-width: 641px) {
  .path-list { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .path-step { min-width: 0; max-width: none; }
}
@media (max-width: 640px) {
  .event-sheet { width: 100%; max-width: 100%; height: 92vh; max-height: 92vh; border-radius: 20px 20px 0 0; top: auto; bottom: 0; left: 50%; transform: translateX(-50%); }
  .bracket-grid { grid-template-columns: 1fr; }
  .event-sheet .sheet-head { padding: 16px; }
  .event-sheet .sheet-body { padding: 16px; }
}

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; font-weight: 600; opacity: 0; pointer-events: none; z-index: 140;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; padding-bottom: 140px; }
  .detail-panel {
    position: fixed; top: 0; right: 0; bottom: 0; left: auto;
    width: min(460px, 94vw); height: 100vh; height: 100dvh; border-radius: 0; z-index: 105;
    transform: translateX(105%); transition: transform 0.32s cubic-bezier(0.4,0,0.2,1);
    box-shadow: var(--shadow-lg); border: none; border-left: 1px solid var(--line);
  }
  .detail-panel.open { transform: translateX(0); }
  .detail-close { display: grid; place-items: center; }
  .detail-scroll { padding-top: 56px; }
  .hero-title h2 { font-size: 30px; }
  .compare-tray { width: calc(100% - 32px); justify-content: center; }
}
@media (max-width: 480px) {
  .topbar-inner { padding: 0 14px; }
  .layout { padding: 16px 14px 150px; }
  .rank-row { padding: 10px 12px; gap: 10px; }
  .avatar { width: 38px; height: 38px; }
  .hero-title h2 { font-size: 27px; }
  .compare-slot { min-width: 82px; }
  .stat-grid { gap: 7px; }
  .detail-scroll { padding: 54px 20px 20px; }
  .stat-card { padding: 10px 8px; }
  .stat-card .v { font-size: 17px; }
  .player-head .ph-names .cn { font-size: 21px; }
  .player-head .rank-badge { padding: 7px 10px; }
}
