/* ============================================================ tokens */
:root {
  color-scheme: light;
  --page: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --surface-3: #e5e9f3;
  --ink: #0d1330;
  --ink-2: #465070;
  --muted: #727b97;
  --grid: #e7eaf2;
  --axis: #c6ccdc;
  --border: rgba(20, 30, 80, 0.08);
  --brand: #3b4cff;
  --brand-ink: #2f3fe6;
  --brand-soft: rgba(59, 76, 255, 0.09);
  --pos: #2a78d6;
  --neg: #eb6834;
  --home: #2a78d6;
  --away: #eb6834;
  --draw: #9aa2ba;
  --zone-top: #2a78d6;
  --zone-mid: #7fb2ee;
  --zone-low: #a0a8bf;
  --zone-down: #dc3b3b;
  --good: #2f9e6a;
  --critical: #d65a5a;
  --r-top: #2563eb;
  --r-good: #16a34a;
  --r-ok: #84a816;
  --r-meh: #ef8a17;
  --r-bad: #dc3b3b;
  --pitch: #1f7a4a;
  --pitch-2: #1b6d42;
  --pitch-line: rgba(255, 255, 255, 0.55);
  --shadow: 0 1px 2px rgba(15, 23, 60, 0.04), 0 6px 20px rgba(15, 23, 60, 0.05);
  --shadow-hover: 0 2px 4px rgba(15, 23, 60, 0.06), 0 12px 28px rgba(15, 23, 60, 0.1);
  --radius: 18px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --side: 248px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #080b18; --surface: #10152a; --surface-2: #171d36; --surface-3: #222a4a;
    --ink: #eef1ff; --ink-2: #b4bbd6; --muted: #8790ad; --grid: #1e2543; --axis: #333c63;
    --border: rgba(160, 175, 255, 0.1); --brand: #6573ff; --brand-ink: #9aa4ff; --brand-soft: rgba(101, 115, 255, 0.14);
    --pos: #3987e5; --neg: #e0662f; --home: #3987e5; --away: #e0662f; --draw: #6b7493;
    --zone-top: #3987e5; --zone-mid: #2a5f9e; --zone-low: #59627f; --zone-down: #ef5050; --good: #3fb67f; --critical: #e06b6b;
    --pitch: #14482f; --pitch-2: #113f29; --pitch-line: rgba(255, 255, 255, 0.35);
    --shadow: none; --shadow-hover: 0 0 0 1px var(--border);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #080b18; --surface: #10152a; --surface-2: #171d36; --surface-3: #222a4a;
  --ink: #eef1ff; --ink-2: #b4bbd6; --muted: #8790ad; --grid: #1e2543; --axis: #333c63;
  --border: rgba(160, 175, 255, 0.1); --brand: #6573ff; --brand-ink: #9aa4ff; --brand-soft: rgba(101, 115, 255, 0.14);
  --pos: #3987e5; --neg: #e0662f; --home: #3987e5; --away: #e0662f; --draw: #6b7493;
  --zone-top: #3987e5; --zone-mid: #2a5f9e; --zone-low: #59627f; --zone-down: #ef5050; --good: #3fb67f; --critical: #e06b6b;
  --pitch: #14482f; --pitch-2: #113f29; --pitch-line: rgba(255, 255, 255, 0.35);
  --shadow: none; --shadow-hover: 0 0 0 1px var(--border);
}

/* ============================================================ base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--ink);
  font: 14.5px/1.45 var(--font); font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; }
.ico { flex: none; vertical-align: middle; }
.muted { color: var(--muted); }
.loading, .empty { color: var(--muted); padding: 48px 0; text-align: center; }
.badge { display: inline-block; font-size: 10px; padding: 1px 5px; border-radius: 6px; background: var(--surface-3); color: var(--muted); vertical-align: middle; }

/* ============================================================ shell */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 14px; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: linear-gradient(135deg, #3b4cff, #7b4dff); box-shadow: 0 6px 16px rgba(59, 76, 255, 0.35); flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: 15px; letter-spacing: -.01em; }
.brand-text small { color: var(--muted); font-size: 11.5px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px;
  color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s;
}
.side-nav a:hover { background: var(--surface-2); color: var(--ink); }
.side-nav a.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.side-tools { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
.tool-btn {
  display: flex; align-items: center; gap: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2);
  padding: 9px 12px; border-radius: 12px; cursor: pointer; font-size: 13px; font-weight: 500;
}
.tool-btn:hover { color: var(--ink); }
.side-meta { color: var(--muted); font-size: 11.5px; margin: 8px 4px 0; }
.main { margin-left: var(--side); padding: 24px 32px 48px; max-width: calc(1320px + var(--side)); min-width: 0; }
.mobile-bar, .bottom-nav { display: none; }

@media (max-width: 1023px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 14px 16px 96px; }
  .mobile-bar {
    display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30;
    background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border); padding: 8px 16px;
  }
  .mobile-bar .brand { padding: 0; }
  .mobile-bar .brand-mark { width: 30px; height: 30px; border-radius: 9px; }
  .mobile-tools { display: flex; gap: 6px; }
  .tool-btn.icon-only { padding: 7px; }
  .tool-btn.icon-only span { display: none; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; justify-content: space-around;
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
    border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; color: var(--muted); padding: 4px 2px; min-width: 0; flex: 1; }
  .bottom-nav a span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav a.active { color: var(--brand-ink); font-weight: 600; }
}

/* ============================================================ page */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin: 4px 0 18px; }
.page-head h1 { margin: 0; font-size: 28px; letter-spacing: -.02em; font-weight: 800; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.back:hover { color: var(--brand-ink); }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; min-width: 0;
}
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card h2 { margin: 0; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; letter-spacing: -.01em; }
.card .h-ico { color: var(--brand-ink); }
.card .sub { margin: 3px 0 0; color: var(--muted); font-size: 12.5px; }
.more-link { display: inline-flex; align-items: center; gap: 4px; color: var(--brand-ink); font-weight: 600; font-size: 13px; margin-top: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid-2 > .card, .grid-2 > .stack-col > .card:last-child { margin-bottom: 0; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.grid-main > .card, .grid-main > .stack-col > .card:last-child { margin-bottom: 0; }
.stack-col { display: flex; flex-direction: column; min-width: 0; }
@media (max-width: 1100px) { .grid-2, .grid-main { grid-template-columns: minmax(0, 1fr); } }

/* ============================================================ hero */
.hero {
  position: relative; overflow: hidden; border-radius: 22px; padding: 26px 28px; margin-bottom: 18px; color: #fff;
  background: linear-gradient(120deg, var(--hero-a, #1b2bd8) 0%, var(--hero-b, #0b1250) 100%);
  display: flex; align-items: center; gap: 24px; flex-wrap: wrap;
}
.hero::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(600px 240px at 90% -10%, rgba(255,255,255,.18), transparent 60%),
              linear-gradient(180deg, rgba(0,0,0,0) 40%, rgba(0,0,0,.22));
}
.hero > * { position: relative; z-index: 1; }
.hero h1 { margin: 4px 0 6px; font-size: 32px; letter-spacing: -.02em; font-weight: 800; line-height: 1.1; }
.hero p { margin: 0; opacity: .85; }
.hero-main { flex: 1; min-width: 220px; }
.hero-kicker { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; opacity: .85; text-transform: uppercase; letter-spacing: .05em; color: #fff; }
.hero-kicker a { display: inline-flex; align-items: center; gap: 6px; color: inherit; }
.hero-league { --hero-a: #3b4cff; --hero-b: #170f63; }
.progress { height: 6px; background: rgba(255,255,255,.2); border-radius: 99px; margin-top: 14px; max-width: 420px; overflow: hidden; }
.progress span { display: block; height: 100%; background: #fff; border-radius: 99px; }
.hero-leader a { display: flex; align-items: center; gap: 14px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); padding: 14px 18px; border-radius: 16px; }
.hero-leader span { display: flex; flex-direction: column; line-height: 1.2; }
.hero-leader small { opacity: .75; font-size: 12px; }
.hero-leader b { font-size: 18px; }
.hero-leader em { font-style: normal; opacity: .85; font-size: 13px; }
.hero-logo { background: rgba(255,255,255,.95); border-radius: 22px; padding: 12px; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.hero-facts, .hp-facts { display: flex; gap: 22px; flex-wrap: wrap; margin: 6px 0 12px; }
.hero-facts span, .hp-facts span { display: flex; flex-direction: column; font-size: 12px; opacity: .9; }
.hero-facts b { font-size: 20px; }
.hp-facts small { opacity: .75; }
.hp-facts b { font-size: 15px; }
.hero .form > * { box-shadow: 0 0 0 2px rgba(255,255,255,.25); }
.hp-photo .photo { border: 4px solid rgba(255,255,255,.9); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.hp-rating { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; opacity: .95; }
.hero-match { justify-content: space-between; --hero-a: #1d2b78; --hero-b: #0a0f33; }
.hm-team { display: flex; flex-direction: column; align-items: center; gap: 10px; flex: 1; min-width: 110px; font-weight: 700; font-size: 17px; text-align: center; color: #fff; }
.hm-team .logo { background: rgba(255,255,255,.95); border-radius: 18px; padding: 8px; width: 88px; height: 88px; }
.hm-center { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.hm-score { font-size: 54px; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.hm-score i { font-style: normal; opacity: .5; margin: 0 10px; }
.hm-score small { font-size: 22px; font-weight: 700; letter-spacing: 0; }
.hm-ht, .hm-xg { font-size: 13px; opacity: .85; }
.hm-xg { background: rgba(255,255,255,.14); padding: 3px 10px; border-radius: 99px; font-weight: 600; }
@media (max-width: 640px) {
  .hero { padding: 20px; gap: 16px; }
  .hero h1 { font-size: 24px; }
  .hm-score { font-size: 40px; }
  .hm-team { min-width: 80px; font-size: 14px; }
  .hm-team .logo { width: 60px; height: 60px; }
  .hero-match { flex-wrap: nowrap; }
  .hm-center .hero-kicker { font-size: 10.5px; }
}

/* ============================================================ kpis */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.kpi-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand-ink); flex: none; }
.kpi-red .kpi-ico { background: rgba(220, 59, 59, .1); color: var(--critical); }
.kpi-v { font-size: 22px; font-weight: 800; letter-spacing: -.02em; line-height: 1.1; }
.kpi-l { color: var(--ink-2); font-size: 12.5px; font-weight: 500; }
.kpi-s { color: var(--muted); font-size: 11.5px; }
@media (max-width: 640px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi { padding: 12px; } .kpi-ico { width: 34px; height: 34px; } .kpi-v { font-size: 19px; } }

/* ============================================================ controls */
.controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  border: 0; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 13px;
  padding: 7px 14px; border-radius: 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.tabs-row { margin-bottom: 16px; overflow-x: auto; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--ink-2); font-weight: 600; font-size: 13px; padding: 7px 13px; border-radius: 99px; cursor: pointer;
}
.chip:hover { color: var(--ink); border-color: var(--axis); }
.chip.on { background: var(--brand); color: #fff; border-color: transparent; }
.field { display: inline-flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 500; }
.field.grow { flex: 1; min-width: 180px; }
.field input, .field select {
  font: 14px var(--font); color: var(--ink); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 8px 10px; min-width: 0;
}
.field input[type=number] { width: 100px; }
.search { position: relative; display: flex; }
.search .ico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { width: 100%; padding-left: 34px; }
.btn { border: 1px solid var(--border); background: var(--surface-2); color: var(--ink); font-weight: 600; font-size: 13px; padding: 9px 18px; border-radius: 99px; cursor: pointer; }
.more { display: block; margin: 14px auto 0; }

/* ============================================================ tables */
.table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data th, .data td { padding: 9px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
.data.compact th, .data.compact td { padding: 7px 6px; }
.data th { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.data th.sortable { cursor: pointer; user-select: none; }
.data th.sortable:hover { color: var(--ink); }
.data th.sorted { color: var(--brand-ink); }
.data th.sorted::after { content: " ↓"; }
.data th.sorted.asc::after { content: " ↑"; }
.data .l { text-align: left; }
.data td.strong { font-weight: 700; }
.data tbody tr:hover { background: var(--surface-2); }
.data tr.hl { background: var(--brand-soft); }
.data td.zone { padding-left: 12px; position: relative; font-weight: 600; }
.data tr.group-row td { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); padding-top: 7px; padding-bottom: 7px; }
.data td.zone::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 2px; background: var(--zc); }
.data tr:last-child td { border-bottom: 0; }
.sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.data tbody tr:hover .sticky-col { background: var(--surface-2); }
.data tr.hl .sticky-col { background: color-mix(in srgb, var(--brand) 9%, var(--surface)); }
.delta-pos::before { content: "▲ "; font-size: 9px; color: var(--pos); }
.delta-neg::before { content: "▼ "; font-size: 9px; color: var(--neg); }
@media (max-width: 640px) { .hide-sm { display: none; } .card { padding: 14px; } .table-wrap { margin: 0 -14px; padding: 0 14px; } }

.team-cell { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; }
.team-cell:hover span { color: var(--brand-ink); }
.team-cell.is-hl span { color: var(--brand-ink); }
.logo { object-fit: contain; flex: none; }
.logo-ph { display: inline-block; border-radius: 50%; background: var(--surface-3); }
.photo { border-radius: 50%; object-fit: cover; background: var(--surface-3); flex: none; }
.photo-ph { display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.player-cell { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.pc-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.pc-name { font-weight: 600; }
.player-cell:hover .pc-name { color: var(--brand-ink); }
.pc-text small { color: var(--muted); font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; }

.form { display: inline-flex; gap: 3px; }
.form > * { width: 21px; height: 21px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; color: #fff; }
.form .W { background: var(--good); } .form .D { background: var(--draw); } .form .L { background: var(--critical); }

.rating {
  display: inline-grid; place-items: center; min-width: 34px; height: 22px; padding: 0 6px; border-radius: 6px;
  font-size: 12px; font-weight: 700; color: #fff; background: var(--surface-3);
}
.rating.r-none { color: var(--muted); }
.rating.r-top { background: var(--r-top); } .rating.r-good { background: var(--r-good); } .rating.r-ok { background: var(--r-ok); }
.rating.r-meh { background: var(--r-meh); } .rating.r-bad { background: var(--r-bad); }
.rating.big { min-width: 64px; height: 44px; font-size: 22px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.rank-badge { display: inline-flex; align-items: baseline; gap: 1px; font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--surface-2); }
.rank-badge small { color: var(--muted); font-weight: 500; font-size: 10.5px; }
.rank-badge.top { background: rgba(22, 163, 74, .12); color: var(--good); }
.rank-badge.low { background: rgba(220, 59, 59, .1); color: var(--critical); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.legend.center { justify-content: center; margin: -6px 0 18px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; border-radius: 3px; background: var(--c); display: inline-block; }
.legend i.c-pos, .legend i.c-a, .legend i.c-home, .legend i.s-home { background: var(--home); }
.legend i.c-neg, .legend i.c-b, .legend i.c-away, .legend i.s-away { background: var(--away); }
.legend i.s-draw { background: var(--draw); }
.legend i.lg-goal { background: var(--good); border-radius: 50%; }
.legend i.lg-save { background: var(--pos); border-radius: 50%; }
.legend i.lg-miss { background: transparent; border: 2px solid var(--muted); border-radius: 50%; }

/* ============================================================ charts */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart.scroll-x { overflow-x: auto; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.chart text.sub { font-size: 10px; }
.chart .lbl { fill: var(--ink-2); font-size: 11px; font-weight: 600; }
.chart .lbl.strong { fill: var(--ink); font-weight: 800; }
.chart .val { fill: var(--ink); font-size: 11px; font-weight: 600; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axisline { stroke: var(--axis); stroke-width: 1; }
.chart .refline { stroke: var(--axis); stroke-width: 1.2; stroke-dasharray: 4 4; }
.chart .hit { fill: transparent; }
.chart g:hover .bar-pos, .chart g:hover path { opacity: .85; }
.chart .dot { fill: var(--brand-ink); stroke: var(--surface); stroke-width: 2; }
.chart .bar-pos { fill: var(--pos); }
.chart .bar-neg { fill: var(--neg); }
.chart .bar-hl { fill: var(--brand); }
.chart .bar-r-top { fill: var(--r-top); } .chart .bar-r-good { fill: var(--r-good); } .chart .bar-r-ok { fill: var(--r-ok); }
.chart .bar-r-meh { fill: var(--r-meh); } .chart .bar-r-bad { fill: var(--r-bad); } .chart .bar-r-none { fill: var(--surface-3); }
.chart .quad { fill: var(--muted); font-size: 11px; opacity: .85; }
.chart .line { fill: none; stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.s-a, .chart .line.s-home { stroke: var(--home); }
.chart .line.s-b, .chart .line.s-away { stroke: var(--away); }
.chart .pt { stroke: var(--surface); stroke-width: 2; }
.chart .pt.s-a { fill: var(--home); } .chart .pt.s-b { fill: var(--away); }
.chart .race-goal { stroke: var(--surface); stroke-width: 2; }
.chart .race-goal.s-home { fill: var(--home); } .chart .race-goal.s-away { fill: var(--away); }

/* rank bars */
.rank-bars { display: flex; flex-direction: column; gap: 2px; }
.rb-row { display: grid; grid-template-columns: 20px minmax(0, 1.6fr) minmax(40px, 1fr) 54px; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 10px; }
.rb-row:hover { background: var(--surface-2); }
.rb-row.hl { background: var(--brand-soft); }
.rb-i { color: var(--muted); font-size: 12px; font-weight: 600; text-align: center; }
.rb-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rb-name { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; font-weight: 600; font-size: 13px; overflow: hidden; }
.rb-name small { color: var(--muted); font-weight: 500; font-size: 11px; display: inline-flex; gap: 4px; align-items: center; }
.rb-name, .rb-name small { white-space: nowrap; text-overflow: ellipsis; }
.rb-track { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.rb-fill { display: block; height: 100%; background: var(--pos); border-radius: 99px; }
.rb-fill.neg { background: var(--neg); }
.rb-row:first-child .rb-fill { background: var(--brand); }
.rb-v { text-align: right; font-weight: 700; font-size: 13px; }
.boards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.boards .card { margin-bottom: 0; }
@media (max-width: 640px) { .boards { grid-template-columns: minmax(0, 1fr); } }

/* compare rows (match stats) */
.cmp { padding: 7px 0; }
.cmp-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 13px; margin-bottom: 5px; }
.cmp-top span { color: var(--ink-2); text-align: center; flex: 1; }
.cmp-top b { min-width: 60px; font-weight: 600; color: var(--ink-2); }
.cmp-top b:last-child { text-align: right; }
.cmp-top b.win { color: var(--ink); font-weight: 800; }
.cmp-bars { display: flex; gap: 4px; height: 7px; }
.cmp-bars span { display: block; height: 100%; border-radius: 99px; background: var(--surface-3); }
.cmp-h { margin-left: auto; } .cmp-h.win { background: var(--home); }
.cmp-a.win { background: var(--away); }
.cmp-bars { justify-content: center; }
.stat-groups { columns: 2 380px; column-gap: 18px; }
.stat-groups .card { break-inside: avoid; display: inline-block; width: 100%; }

/* percentile */
.pctl { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-width: 120px; }
.pctl-track { flex: 1; height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.pctl-fill { display: block; height: 100%; border-radius: 99px; }
.pctl b { width: 26px; text-align: right; font-size: 12px; }
.p-top { background: var(--good); } .p-good { background: #7cc644; } .p-mid { background: #f2b33d; } .p-low { background: var(--critical); }
.pctl-cell { width: 40%; }

/* stack bar */
.stack { display: flex; height: 30px; border-radius: 10px; overflow: hidden; gap: 2px; }
.stack span { display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700; }
.stack .s-home { background: var(--home); } .stack .s-draw { background: var(--draw); } .stack .s-away { background: var(--away); }

/* ============================================================ match cards */
.mc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.mc-grid.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.mcard {
  display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px; background: var(--surface-2);
  border: 1px solid transparent; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.mc-grid.wide .mcard { background: var(--surface); border-color: var(--border); box-shadow: var(--shadow); }
.mcard:hover { border-color: var(--axis); transform: translateY(-1px); box-shadow: var(--shadow-hover); }
.mcard.is-off { opacity: .7; }
.mc-xg.off { color: var(--critical); font-weight: 600; }
.mc-stage { color: var(--brand-ink); font-weight: 600; }
.mcard.hl { border-color: color-mix(in srgb, var(--brand) 40%, transparent); }
.mcard.res-W { box-shadow: inset 3px 0 0 var(--good); background: color-mix(in srgb, var(--good) 7%, var(--surface-2)); }
.mcard.res-D { box-shadow: inset 3px 0 0 var(--draw); }
.mcard.res-L { box-shadow: inset 3px 0 0 var(--critical); background: color-mix(in srgb, var(--critical) 7%, var(--surface-2)); }
.mc-meta { display: flex; gap: 8px; font-size: 11.5px; color: var(--muted); font-weight: 500; }
.mc-team { display: flex; align-items: center; gap: 9px; font-weight: 500; color: var(--ink-2); }
.mc-team span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mc-team b { font-size: 17px; font-weight: 800; min-width: 18px; text-align: right; color: var(--ink-2); }
.mc-team.win, .mc-team.win b { color: var(--ink); font-weight: 700; }
.mc-xg { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.mc-xg .track { flex: 1; display: flex; gap: 2px; height: 5px; }
.mc-xg .h { background: var(--home); border-radius: 3px 0 0 3px; }
.mc-xg .a { background: var(--away); border-radius: 0 3px 3px 0; }

.round-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.rchip { min-width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); font-weight: 600; font-size: 13px; color: var(--muted); }
.rchip.done { color: var(--ink); }
.rchip:hover { border-color: var(--axis); }
.rchip.on { background: var(--brand); color: #fff; border-color: transparent; }

/* ============================================================ overview */
.mini-leaders { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.ml-card { background: var(--surface-2); border-radius: 14px; padding: 14px; }
.ml-card h3 { margin: 0 0 10px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; display: flex; align-items: center; gap: 6px; }
.ml-row { display: flex; align-items: center; gap: 10px; padding: 5px 4px; border-radius: 10px; }
.ml-row:hover { background: var(--surface-3); }
.ml-i { width: 14px; font-size: 12px; color: var(--muted); font-weight: 600; }
.ml-n { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.ml-n span { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ml-n small { color: var(--muted); font-size: 11px; display: inline-flex; align-items: center; gap: 4px; }
.ml-row b { font-size: 15px; font-weight: 800; }
.ml-row.first { padding: 8px 4px; }
.ml-row.first b { font-size: 22px; color: var(--brand-ink); }

.totw {
  background: repeating-linear-gradient(0deg, var(--pitch) 0 40px, var(--pitch-2) 40px 80px);
  border-radius: 14px; padding: 18px 8px; display: flex; flex-direction: column; gap: 14px; position: relative;
}
.totw-row { display: flex; justify-content: space-evenly; gap: 4px; }
.totw-p { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 82px; text-align: center; color: #fff; }
.totw-ph { position: relative; }
.totw-ph .photo { border: 2px solid rgba(255,255,255,.85); background: #fff; }
.totw-r { position: absolute; right: -14px; top: -6px; min-width: 30px; height: 19px; font-size: 11px; }
.totw-n { font-size: 11.5px; font-weight: 600; line-height: 1.15; text-shadow: 0 1px 2px rgba(0,0,0,.4); max-width: 82px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.totw-t .logo { background: #fff; border-radius: 50%; padding: 1px; }

/* ============================================================ teams */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.team-card {
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 10px; padding: 18px; border-radius: 18px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s;
}
.team-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 5px; background: linear-gradient(90deg, var(--hero-a), var(--hero-b)); }
.team-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-hover); }
.team-card.hl { border-color: color-mix(in srgb, var(--brand) 45%, transparent); }
.tc-top { display: flex; justify-content: space-between; align-items: flex-start; }
.tc-pos { font-size: 28px; font-weight: 800; color: var(--surface-3); line-height: 1; }
.tc-name { font-weight: 700; font-size: 16px; }
.tc-stats { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.tc-stats span { display: flex; flex-direction: column; }
.tc-stats b { font-size: 15px; color: var(--ink); }
.top-players { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tp-card { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.tp-card:hover { box-shadow: var(--shadow-hover); }
.tp-card span { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.tp-card small { color: var(--muted); font-size: 11.5px; display: inline-flex; gap: 4px; align-items: center; }
.tp-card b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-card em { font-style: normal; font-size: 20px; font-weight: 800; color: var(--brand-ink); }

/* ============================================================ match detail */
.lineup-pitch { display: flex; flex-direction: column; gap: 8px; }
.lp-field {
  position: relative; aspect-ratio: 105 / 64; border-radius: 14px; overflow: hidden;
  background: repeating-linear-gradient(90deg, var(--pitch) 0 9.09%, var(--pitch-2) 9.09% 18.18%);
}
.lp-mid { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2px solid var(--pitch-line); }
.lp-circle { position: absolute; left: 50%; top: 50%; width: 17%; aspect-ratio: 1; border: 2px solid var(--pitch-line); border-radius: 50%; transform: translate(-50%, -50%); }
.lp-box { position: absolute; top: 20%; bottom: 20%; width: 15.7%; border: 2px solid var(--pitch-line); }
.lp-box.l { left: 0; border-left: 0; } .lp-box.r { right: 0; border-right: 0; }
.lp { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 2px; width: 84px; text-align: center; z-index: 1; }
.lp-ph { position: relative; }
.lp-ph .photo { border: 2px solid #fff; background: #fff; }
.lp.home .lp-ph .photo { border-color: var(--home); }
.lp.away .lp-ph .photo { border-color: var(--away); }
.lp-r { position: absolute; right: -16px; top: -6px; min-width: 28px; height: 17px; font-size: 10.5px; }
.lp-n { color: #fff; font-size: 11px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 84px; }
.lp-forms { display: flex; justify-content: space-between; font-weight: 700; font-size: 13px; color: var(--ink-2); }
.lp-forms span { display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 700px) {
  .lp { width: 54px; } .lp-ph .photo { width: 24px !important; height: 24px !important; } .lp-n { font-size: 9px; max-width: 54px; }
  .lp-r { right: -12px; min-width: 24px; height: 15px; font-size: 9.5px; padding: 0 3px; }
}
.lu-col { display: flex; flex-direction: column; gap: 2px; }
.lu-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 15px; }
.lu-head .muted { margin-left: auto; font-weight: 600; }
.lu-row { display: flex; align-items: center; gap: 10px; padding: 6px 6px; border-radius: 10px; }
.lu-row:hover { background: var(--surface-2); }
.lu-row.unused { opacity: .55; }
.lu-shirt { width: 22px; text-align: center; font-weight: 700; color: var(--muted); font-size: 12px; }
.lu-name { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.lu-name span { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lu-name small { color: var(--muted); font-size: 11px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.lu-sub { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin: 12px 6px 4px; }
.ev { display: inline-flex; align-items: center; font-size: 10.5px; font-weight: 600; }
.ev-goal { color: var(--good); } .ev-og { color: var(--critical); } .ev-ast { color: var(--pos); }
.ev-yc, .ev-rc { width: 8px; height: 11px; border-radius: 2px; }
.ev-yc { background: #f5c518; } .ev-rc { background: var(--critical); }
.ev-in { color: var(--good); } .ev-out { color: var(--critical); }

.pitch-wrap svg { max-width: 420px; margin: 0 auto; }
.pitch { fill: var(--pitch); }
.pl { fill: none; stroke: var(--pitch-line); stroke-width: 1.5; }
.pl-dot { fill: var(--pitch-line); }
.shot { stroke-width: 2; fill-opacity: .9; cursor: default; }
.shot.goal { fill: var(--good); stroke: #fff; }
.shot.save { fill: var(--pos); stroke: #fff; fill-opacity: .85; }
.shot.miss, .shot.blocked { fill: rgba(255,255,255,.12); stroke: rgba(255,255,255,.8); }
.shot:hover { stroke-width: 3; }
.shot-sum { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 13px; }
.shot-sum span { color: var(--muted); }
.shot-sum span::before { content: "· "; }

.timeline { display: flex; flex-direction: column; gap: 4px; max-width: 760px; margin: 0 auto; }
.tl-item { display: grid; grid-template-columns: 48px 30px minmax(0, 1fr); align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; width: 70%; }
.tl-item.h { align-self: flex-start; background: color-mix(in srgb, var(--home) 7%, transparent); }
.tl-item.a { align-self: flex-end; background: color-mix(in srgb, var(--away) 7%, transparent); }
.tl-min { font-weight: 800; color: var(--muted); font-size: 13px; }
.tl-ic { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; background: var(--surface-3); font-size: 10px; font-weight: 800; }
.tl-ic.goal { background: rgba(22, 163, 74, .14); color: var(--good); }
.tl-ic.sub { color: var(--ink-2); }
.tl-ic.card { width: 14px; height: 19px; border-radius: 3px; margin: 0 6px; }
.tl-ic.card.yellow { background: #f5c518; } .tl-ic.card.red, .tl-ic.card.yellowRed { background: var(--critical); }
.tl-txt { display: flex; flex-direction: column; line-height: 1.3; }
.tl-txt small { color: var(--muted); font-size: 12px; }
.tl-txt em { font-style: normal; font-weight: 800; font-size: 13px; }
.tl-txt .in { color: var(--good); } .tl-txt .out { color: var(--critical); }
.tl-period { align-self: center; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: 4px 14px; border-radius: 99px; margin: 8px 0; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 640px) { .tl-item { width: 100%; } }

.pv-form { display: flex; flex-direction: column; gap: 14px; }
.pv-form > div { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pv-form .form { margin-left: auto; }

/* ============================================================ player */
.profile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.profile-grid .card { margin-bottom: 0; background: var(--surface-2); box-shadow: none; border: 0; }
.profile-grid .card .table-wrap { margin: 0; padding: 0; }
.profile-grid .data tbody tr:hover { background: var(--surface-3); }
@media (max-width: 640px) { .profile-grid { grid-template-columns: minmax(0, 1fr); } .pctl { min-width: 90px; } }
.log-match { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.log-match span:last-child { display: inline-flex; align-items: center; gap: 6px; }
.res { width: 22px; height: 22px; border-radius: 6px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; }
.res.res-W { background: var(--good); } .res.res-D { background: var(--draw); } .res.res-L { background: var(--critical); }

/* ============================================================ tooltip */
.tip {
  position: fixed; z-index: 60; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 12px; padding: 9px 12px; font-size: 12.5px;
  box-shadow: 0 10px 30px rgba(0,0,0,.18); max-width: 280px;
}
.tip b { display: block; margin-bottom: 4px; }
.tip .row { display: flex; justify-content: space-between; gap: 16px; color: var(--ink-2); }
.tip .row span:last-child { color: var(--ink); font-weight: 600; }
.card h2 .bt { display: flex; flex-direction: column; gap: 1px; }
.card h2 .bt small { font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.chip-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px 2px; }
.tc-form { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.tc-form > span:first-child { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.tc-form .form { gap: 5px; }
.tc-form .form > * { width: 26px; height: 26px; border-radius: 50%; font-size: 11.5px; box-shadow: inset 0 -2px 0 rgba(0,0,0,.15); }
.tc-form .form > :last-child { outline: 2px solid var(--axis); outline-offset: 2px; }
