:root {
  --bg: #070d1a;
  --bg2: #0c1529;
  --card: #111c34;
  --card2: #16233f;
  --line: #22325a;
  --text: #e8eefc;
  --muted: #8d9cc0;
  --ice: #6fd3ff;
  --ice2: #3a8dff;
  --red: #ff5a6e;
  --gold: #ffc94d;
  --silver: #c9d3e6;
  --bronze: #e19a62;
  --green: #4fe0a4;
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { color-scheme: dark; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #18305e 0%, transparent 60%),
              radial-gradient(900px 500px at -10% 10%, #0f2a4a 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--ice); }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* ---------- hero ---------- */
.hero { padding: 34px 0 22px; border-bottom: 1px solid rgba(255,255,255,.06); position: relative; z-index: 5; }
.brand { display: flex; gap: 18px; align-items: center; }
.puck {
  width: 58px; height: 58px; flex: none; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #3b4560, #0b0f19 70%);
  box-shadow: 0 0 0 3px rgba(111,211,255,.25), 0 10px 30px rgba(58,141,255,.35), inset 0 -6px 0 rgba(0,0,0,.4);
}
.eyebrow { margin: 0; color: var(--ice); text-transform: uppercase; letter-spacing: .14em; font-size: 11px; font-weight: 700; }
h1 { margin: 2px 0 2px; font-size: clamp(26px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.sub { margin: 0; color: var(--muted); }

.controls { margin-top: 24px; display: grid; grid-template-columns: minmax(240px, 1.3fr) auto auto; gap: 16px; align-items: end; }
@media (max-width: 860px) { .controls { grid-template-columns: 1fr; } }
label, .label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; margin-bottom: 6px; }

.combo { position: relative; }
.combo-box { position: relative; }
.combo input {
  width: 100%; padding: 11px 38px 11px 14px; font: inherit; font-size: 15px; font-weight: 600;
  color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; outline: none;
}
.combo input:focus { border-color: var(--ice2); box-shadow: 0 0 0 3px rgba(58,141,255,.25); }
.chev { position: absolute; right: 12px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.combo-list {
  position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px); max-height: 360px; overflow: auto;
  margin: 0; padding: 6px; list-style: none; background: var(--card2); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: 0 20px 50px rgba(0,0,0,.5);
}
.combo-list li { padding: 8px 10px; border-radius: 8px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.combo-list li small { color: var(--muted); white-space: nowrap; }
.combo-list li.active, .combo-list li:hover { background: rgba(58,141,255,.18); }
.combo-list li.all { border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; margin-bottom: 4px; }

.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button {
  font: inherit; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 8px 14px; border-radius: 8px; cursor: pointer;
}
.seg button[aria-checked="true"] { color: #04101f; background: linear-gradient(135deg, var(--ice), var(--ice2)); }
.range-row { display: flex; align-items: center; gap: 8px; }
.range-row select {
  font: inherit; font-weight: 600; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; padding: 9px 10px;
}
.dash { color: var(--muted); }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 24px 0 12px; }
@media (max-width: 760px) { .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.card {
  background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden;
}
.card::after { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--ice), transparent); opacity: .6; }
.card .k { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.card .v { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.card .s { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos { color: var(--green); } .neg { color: var(--red); }

.awards { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.award { font-size: 12px; padding: 5px 10px; border-radius: 999px; background: rgba(255,201,77,.1); border: 1px solid rgba(255,201,77,.35); color: #ffe3a3; }

/* ---------- tabs / panels ---------- */
.tabs { display: flex; gap: 4px; margin: 18px 0 0; border-bottom: 1px solid var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs button {
  font: inherit; font-weight: 600; font-size: 15px; color: var(--muted); background: none; border: 0;
  padding: 12px 16px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--ice); }
.panel { padding: 16px 0 8px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 12px; }
.search {
  font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; min-width: 240px; outline: none;
}
.search:focus { border-color: var(--ice2); }
.check { display: inline-flex; align-items: center; gap: 6px; margin: 0; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); cursor: pointer; }
.hint { color: var(--muted); font-size: 12px; margin-left: auto; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); max-height: 75vh; }
table.stats { width: 100%; border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.stats th, .stats td { padding: 9px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid rgba(255,255,255,.05); }
.stats th {
  position: sticky; top: 0; z-index: 2; background: #0f1a31; color: var(--muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .08em; font-weight: 700; cursor: pointer; user-select: none;
}
.stats th:hover { color: var(--text); }
.stats th.sorted { color: var(--ice); }
.stats th.sorted::after { content: " ▾"; }
.stats th.sorted.asc::after { content: " ▴"; }
.stats .l { text-align: left; }
.stats td.key { font-weight: 800; color: var(--text); }
.stats tbody tr.row { cursor: pointer; }
.stats tbody tr.row:hover td { background: rgba(58,141,255,.08); }
.stats tbody tr.open td { background: rgba(58,141,255,.12); }
.stats .rank { color: var(--muted); width: 36px; font-family: var(--mono); font-size: 12px; }
.stats .r1 .rank { color: var(--gold); } .stats .r2 .rank { color: var(--silver); } .stats .r3 .rank { color: var(--bronze); }
.stats .name { font-weight: 600; text-align: left; }
.stats .name small { color: var(--muted); font-weight: 500; margin-left: 6px; }
.stats tfoot td { position: sticky; bottom: 0; background: #0f1a31; font-weight: 700; border-top: 1px solid var(--line); }
.stats .muted { color: var(--muted); }
.stats .empty { text-align: center; color: var(--muted); padding: 30px; }
.stats td.more { text-align: center; padding: 14px; }
.more button {
  font: inherit; font-weight: 600; color: var(--ice); background: rgba(58,141,255,.12); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 18px; cursor: pointer;
}
.more button:hover { background: rgba(58,141,255,.22); }
.bar { display: inline-block; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--ice2), var(--ice)); vertical-align: middle; margin-right: 8px; opacity: .8; }

.detail td { background: #0b1427 !important; padding: 0 !important; }
.detail .inner { padding: 10px 14px 14px 46px; }
.detail table { width: auto; min-width: 60%; border-collapse: collapse; font-size: 13px; }
.detail th { position: static; background: none; cursor: default; padding: 6px 10px; }
.detail td { padding: 5px 10px; border-bottom: 1px solid rgba(255,255,255,.04); }
.tag { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .06em; padding: 2px 6px; border-radius: 5px; background: rgba(111,211,255,.12); color: var(--ice); }
.tag.po { background: rgba(255,90,110,.14); color: #ff9aa7; }

/* ---------- charts ---------- */
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 900px) { .chart-grid { grid-template-columns: 1fr; } }
.chart-card { margin: 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.chart-card figcaption { font-weight: 700; margin-bottom: 8px; }
.cbox { position: relative; height: 280px; }
.cbox.tall { height: 380px; }

.foot { color: var(--muted); font-size: 12px; padding: 30px 20px 40px; }

/* glossary */
.glossary { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.gloss-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.gloss-card h3 { margin: 0 0 10px; font-size: 15px; letter-spacing: .02em; }
.gloss-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
.gloss-card dt { font-weight: 700; color: var(--ice); font-variant-numeric: tabular-nums; }
.gloss-card dd { margin: 0; color: var(--muted); line-height: 1.4; }
.hint a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* player profiles */
[hidden] { display: none !important; }
.combo-list li.group { cursor: default; padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ice); background: none !important; }
.combo-list li.player span::before { content: "?? "; opacity: .7; }
.player-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 8px 0 16px; }
.back { background: var(--card); border: 1px solid var(--line); color: var(--text); font: inherit; font-weight: 600; padding: 8px 14px; border-radius: 10px; cursor: pointer; }
.back:hover { border-color: var(--ice2); }
.block-title { font-size: 16px; margin: 26px 0 10px; }
#playerView .chart-card { margin-top: 18px; }
.id-note { background: rgba(255,201,77,.07); border: 1px solid rgba(255,201,77,.3); border-radius: var(--radius); padding: 12px 16px; font-size: 14px; }
.id-note p { margin: 0 0 10px; color: var(--muted); }
.id-note b { color: var(--text); }
.id-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; text-transform: none; letter-spacing: normal; font-weight: 500; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; cursor: pointer; }
.chip small { color: var(--muted); }
.chip:has(input:not(:checked)) { opacity: .55; }
.empty-note { color: var(--muted); padding: 20px 0; }
.tlink, .plink { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--muted); }
.tlink:hover, .plink:hover { color: var(--ice); border-color: var(--ice); }
.tag.lg-S { background: rgba(255,201,77,.14); color: var(--gold); }
.profile-link { display: inline-block; margin-top: 10px; color: var(--ice); font-weight: 600; font-size: 13px; text-decoration: none; }
.profile-link:hover { text-decoration: underline; }
.similar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; margin: 10px 0 0; font-size: 14px; }
.similar .sim { display: inline-flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 4px 6px 4px 12px; }
.similar small { color: var(--muted); }
.similar button { background: rgba(58,141,255,.18); color: var(--ice); border: 0; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.similar button:hover { background: rgba(58,141,255,.32); }

/* player team toggles */
.team-toggle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 18px; }
.team-toggle .label { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.tchip { --tc: var(--ice2); display: inline-flex; align-items: center; gap: 8px; background: var(--card); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px 6px 12px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: border-color .15s, background .15s, color .15s; }
.tchip i { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--tc); background: transparent; }
.tchip small { color: var(--muted); font-weight: 500; }
.tchip em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--muted); background: rgba(255,255,255,.06); border-radius: 999px; padding: 2px 8px; opacity: 0; transition: opacity .15s; }
.tchip:hover em, .tchip:focus-visible em { opacity: 1; }
.tchip em:hover { color: var(--text); background: rgba(255,255,255,.14); }
.tchip.on { color: var(--text); border-color: var(--tc); background: color-mix(in srgb, var(--tc) 14%, var(--card)); }
.tchip.on i { background: var(--tc); }
.tchip:not(.on) span { text-decoration: line-through; text-decoration-color: rgba(141,156,192,.5); }
.tchip.all { color: var(--ice); padding: 6px 12px; border-style: dashed; }
#pCharts .chart-grid { margin-bottom: 8px; }
.tchip { text-align: left; } .tchip span { white-space: nowrap; }
