/* =========================================================
   NBL Tracker - dark-first sports-app theme
   ========================================================= */
:root {
  color-scheme: dark;
  --page: #07090d;
  --page-2: #0c1017;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-solid: #11151c;
  --raised: rgba(255, 255, 255, 0.06);
  --ink: #f4f6fa;
  --ink-2: #aeb6c4;
  --muted: #6f7888;
  --grid: rgba(255, 255, 255, 0.07);
  --axis: rgba(255, 255, 255, 0.14);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --glow: rgba(255, 107, 44, 0.22);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 12px 32px rgba(0, 0, 0, 0.35);
  --accent: #ff6b2c;
  --accent-2: #ffa24a;
  --accent-ink: #1a0a02;
  --grad: linear-gradient(135deg, #ffa24a 0%, #ff6b2c 55%, #ff4d4d 100%);
  --series-1: #4c9aff;
  --series-2: #ff7a3d;
  --series-3: #2ec990;
  --hot: #ff5c5c;
  --cold: #4c9aff;
  --neutral: #2a2f38;
  --court: rgba(255, 255, 255, 0.18);
  --ok: #2ec990;
  --radius: 18px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Barlow Condensed", "Inter", system-ui, sans-serif;
  --court-lines: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 320' fill='none' stroke='white' stroke-opacity='.07' stroke-width='2'%3E%3Crect x='1' y='1' width='598' height='318'/%3E%3Cline x1='300' y1='0' x2='300' y2='320'/%3E%3Ccircle cx='300' cy='160' r='48'/%3E%3Crect x='1' y='100' width='116' height='120'/%3E%3Crect x='483' y='100' width='116' height='120'/%3E%3Cpath d='M1 22h34a150 150 0 0 1 0 276H1M599 22h-34a150 150 0 0 0 0 276h34'/%3E%3C/svg%3E");
}
:root[data-theme="light"] {
  color-scheme: light;
  --page: #f3f2ee;
  --page-2: #ebe9e3;
  --surface: #ffffff;
  --surface-solid: #ffffff;
  --raised: #f7f6f2;
  --ink: #0d1117;
  --ink-2: #4a5160;
  --muted: #8a909c;
  --grid: rgba(13, 17, 23, 0.07);
  --axis: rgba(13, 17, 23, 0.16);
  --border: rgba(13, 17, 23, 0.08);
  --border-strong: rgba(13, 17, 23, 0.14);
  --glow: rgba(255, 107, 44, 0.16);
  --shadow: 0 1px 2px rgba(13, 17, 23, 0.04), 0 8px 24px rgba(13, 17, 23, 0.06);
  --accent: #f0561a;
  --accent-ink: #ffffff;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --hot: #e34948;
  --cold: #2a78d6;
  --neutral: #ebe9e3;
  --court: rgba(13, 17, 23, 0.2);
  --ok: #0f8a4d;
  --court-lines: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 600 320' fill='none' stroke='black' stroke-opacity='.06' stroke-width='2'%3E%3Crect x='1' y='1' width='598' height='318'/%3E%3Cline x1='300' y1='0' x2='300' y2='320'/%3E%3Ccircle cx='300' cy='160' r='48'/%3E%3Crect x='1' y='100' width='116' height='120'/%3E%3Crect x='483' y='100' width='116' height='120'/%3E%3Cpath d='M1 22h34a150 150 0 0 1 0 276H1M599 22h-34a150 150 0 0 0 0 276h34'/%3E%3C/svg%3E");
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
body {
  margin: 0; min-height: 100vh;
  color: var(--ink);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(900px 500px at 12% -120px, var(--glow), transparent 70%),
    radial-gradient(700px 420px at 100% 0, rgba(76, 154, 255, 0.10), transparent 70%),
    var(--page);
  background-attachment: fixed;
}
a { color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
button, input, select { font: inherit; color: inherit; }
select, input {
  color: var(--ink); background: var(--raised);
  border: 1px solid var(--border); border-radius: 10px; padding: 7px 11px; min-height: 38px;
}
select option { background: var(--surface-solid); color: var(--ink); }
select:focus-visible, input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=number] { width: 76px; }
input[type=checkbox] { min-height: 0; accent-color: var(--accent); }
button.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; min-height: 0; font-weight: 500; }
.hidden { display: none !important; }

#progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--grad); z-index: 50; opacity: 0; transition: width .3s, opacity .3s; box-shadow: 0 0 12px var(--accent); }
#progress.on { opacity: 1; width: 70%; transition: width 4s cubic-bezier(.1,.6,.3,1); }

/* ---------- header ---------- */
header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--page) 72%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--border);
}
.bar { max-width: 1280px; margin: 0 auto; padding: 0 28px; display: flex; align-items: center; gap: 20px; height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand svg { width: 30px; height: 30px; filter: drop-shadow(0 0 10px var(--glow)); }
.brand span { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: .02em; text-transform: uppercase; }
.brand b { font-weight: 800; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; margin-left: 2px; }
.spacer { flex: 1; }
.season { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--border); background: var(--raised);
  color: var(--ink-2); display: grid; place-items: center; cursor: pointer; flex: none; padding: 0;
}
.icon-btn:hover { color: var(--ink); border-color: var(--border-strong); }
.icon-btn svg { width: 18px; height: 18px; }
nav#tabs { display: flex; gap: 2px; }
nav#tabs button, #bottom-nav button {
  border: 0; background: none; color: var(--ink-2); white-space: nowrap; cursor: pointer;
  display: flex; align-items: center; gap: 7px; font-weight: 500;
}
nav#tabs button { padding: 8px 13px; border-radius: 10px; position: relative; }
nav#tabs button svg { width: 16px; height: 16px; opacity: .75; }
nav#tabs button:hover { color: var(--ink); background: var(--raised); }
nav#tabs button.active { color: var(--ink); background: var(--raised); }
nav#tabs button.active svg { color: var(--accent); opacity: 1; }
nav#tabs button.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -15px; height: 2px; border-radius: 2px; background: var(--grad); box-shadow: 0 0 10px var(--accent); }
#bottom-nav { display: none; }

/* ---------- layout ---------- */
main { max-width: 1280px; margin: 0 auto; padding: 28px 28px 72px; }
.tab { display: none; }
.tab.active { display: block; }
.tab.active > * { animation: rise .45s cubic-bezier(.2,.7,.2,1) both; }
.tab.active > *:nth-child(2) { animation-delay: .04s; }
.tab.active > *:nth-child(3) { animation-delay: .08s; }
.tab.active > *:nth-child(4) { animation-delay: .12s; }
.tab.active > *:nth-child(n+5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .tab.active > * { animation: none; } }

h1, h2, .display { font-family: var(--display); letter-spacing: .01em; }
.page-head { margin: 8px 0 24px; }
.page-head h1 { font-size: 44px; line-height: 1; font-weight: 800; text-transform: uppercase; margin: 0 0 8px; }
.page-head p { margin: 0; color: var(--ink-2); max-width: 64ch; font-size: 15px; }

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 22px 24px; margin-bottom: 18px; min-width: 0; position: relative;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.card h2 { margin: 0 0 4px; font-size: 22px; font-weight: 700; text-transform: uppercase; line-height: 1.1; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tag {
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 3px 9px; white-space: nowrap;
}
.sub { margin: 0 0 16px; color: var(--ink-2); font-size: 13px; }
.sub.hint { margin: 12px 0 0; }
.controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 16px; color: var(--ink-2); font-size: 13px; }
.controls label { display: flex; align-items: center; gap: 8px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid2.flat { margin: 0 0 16px; }
.chart { position: relative; height: 270px; }
.chart.tall { height: 340px; }
.chart.square { height: 380px; }

/* ---------- buttons & pills ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 12px 20px; border-radius: 12px;
  font-weight: 600; text-decoration: none; border: 1px solid transparent; cursor: pointer; transition: transform .15s, box-shadow .15s;
}
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--grad); color: var(--accent-ink); box-shadow: 0 8px 24px var(--glow); }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 12px 32px var(--glow); }
.btn.ghost { border-color: var(--border-strong); color: var(--ink); background: var(--raised); }
.btn.ghost:hover { border-color: var(--accent); }
.btn.sm { padding: 8px 14px; border-radius: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--raised); font-size: 12px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2);
}
.pill svg { width: 14px; height: 14px; color: var(--accent); }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); } 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden; border-radius: 26px; border: 1px solid var(--border);
  padding: 48px 48px 44px; margin-bottom: 30px;
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; align-items: end;
  background:
    radial-gradient(600px 300px at 0% 0%, var(--glow), transparent 70%),
    linear-gradient(180deg, var(--raised), transparent);
}
.hero::before {
  content: ""; position: absolute; inset: 0; background: var(--court-lines) center / cover no-repeat;
  mask-image: linear-gradient(90deg, transparent, #000 40%); -webkit-mask-image: linear-gradient(90deg, transparent, #000 40%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero h1 { font-size: clamp(44px, 6.4vw, 84px); line-height: .92; font-weight: 800; text-transform: uppercase; margin: 18px 0 16px; }
.hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--ink-2); font-size: 16px; max-width: 46ch; margin: 0 0 26px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat {
  border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; background: color-mix(in srgb, var(--page) 55%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.stat .n { font-family: var(--display); font-size: 42px; font-weight: 700; line-height: 1; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; margin-top: 6px; }
.hero.small { display: block; padding: 36px 40px; }
.hero.small h1 { font-size: clamp(38px, 5vw, 64px); }

/* ---------- section heads & game strip ---------- */
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 14px; }
.section-head h2 { font-size: 26px; font-weight: 800; text-transform: uppercase; margin: 0; }
.section-head a { color: var(--ink-2); text-decoration: none; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.section-head a:hover { color: var(--accent); }
.section-head a svg { width: 14px; height: 14px; }
.games-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 14px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 2px 14px; margin-bottom: 18px; scrollbar-width: thin; }
.game {
  scroll-snap-align: start; border: 1px solid var(--border); border-radius: 18px; padding: 16px; background: var(--surface);
  box-shadow: var(--shadow); transition: transform .2s, border-color .2s;
}
.game:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.game .when { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; margin-bottom: 12px; display: flex; justify-content: space-between; }
.game .side { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.game .side .name { font-weight: 600; flex: 1; }
.game .side .p { font-family: var(--display); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.game .side.fav .p { color: var(--accent); }
.game .bar2 { display: flex; height: 5px; border-radius: 3px; overflow: hidden; gap: 3px; margin: 12px 0 8px; }
.game .bar2 span:first-child { background: var(--grad); border-radius: 3px; }
.game .bar2 span:last-child { background: var(--border-strong); border-radius: 3px; }
.game .tip { color: var(--ink-2); font-size: 12px; }

/* ---------- team badges ---------- */
.badge {
  display: inline-grid; place-items: center; flex: none; width: 34px; height: 34px; border-radius: 10px;
  font-family: var(--display); font-weight: 800; font-size: 13px; letter-spacing: .04em;
  background: linear-gradient(145deg, var(--raised), transparent); border: 1px solid var(--border-strong); color: var(--ink);
}
.badge.sm { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }
.team-cell { display: inline-flex; align-items: center; gap: 10px; }

/* ---------- mini ladder ---------- */
.ladder-row { display: grid; grid-template-columns: 22px 34px minmax(0, 1fr) 90px 48px; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.ladder-row:last-child { border-bottom: 0; }
.ladder-row .rank { color: var(--muted); font-family: var(--display); font-weight: 700; font-size: 16px; }
.ladder-row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ladder-row .name small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.ladder-row .track { height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.ladder-row .fill { height: 100%; border-radius: 3px; background: var(--grad); }
.ladder-row .pct { text-align: right; font-family: var(--display); font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; }

.fact { margin: 16px 0 0; padding: 14px 16px; border-radius: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%); border: 1px solid var(--border); color: var(--ink-2); font-size: 13.5px; }
.fact b { color: var(--ink); font-weight: 600; }

/* ---------- research lab ---------- */
.study-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 34px; }
.study-card {
  display: block; text-decoration: none; border: 1px solid var(--border); border-radius: 18px; padding: 18px 20px;
  background: var(--surface); box-shadow: var(--shadow); transition: transform .2s, border-color .2s;
}
.study-card:hover { transform: translateY(-2px); border-color: var(--accent); }
.study-card .n { font-family: var(--display); color: var(--accent); font-weight: 800; font-size: 14px; letter-spacing: .08em; }
.study-card h3 { font-family: var(--display); font-size: 22px; text-transform: uppercase; margin: 4px 0 8px; line-height: 1.05; }
.study-card .big { font-family: var(--display); font-size: 34px; font-weight: 700; line-height: 1; }
.study-card p { color: var(--ink-2); font-size: 13px; margin: 6px 0 0; }
.study { margin-bottom: 46px; scroll-margin-top: 90px; }
.study-head { display: flex; gap: 16px; align-items: flex-start; margin: 0 2px 16px; }
.study-num { font-family: var(--display); font-weight: 800; font-size: 44px; line-height: .9; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; flex: none; }
.study-head h2 { font-size: 34px; font-weight: 800; text-transform: uppercase; margin: 0 0 4px; line-height: 1; }
.study-head .sub { margin: 0; font-size: 14px; max-width: 80ch; }
.verdict {
  border-radius: 18px; padding: 20px 24px; margin-bottom: 18px; border: 1px solid var(--border-strong);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), var(--surface);
}
.verdict b { font-family: var(--display); font-size: 30px; text-transform: uppercase; display: block; line-height: 1.05; margin-bottom: 6px; }
.verdict span { color: var(--ink-2); }
.chart.forest { height: 560px; }
.chart.forest.long { height: 1000px; }
.findings { display: grid; gap: 12px; margin-bottom: 18px; counter-reset: f; }
.finding {
  display: grid; grid-template-columns: 44px 1fr; gap: 14px; align-items: start; padding: 16px 20px;
  border: 1px solid var(--border); border-radius: 16px; background: var(--surface);
}
.finding::before {
  counter-increment: f; content: counter(f); font-family: var(--display); font-weight: 800; font-size: 20px;
  width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--raised); color: var(--accent);
}
.finding b { display: block; font-size: 15.5px; margin-bottom: 3px; color: var(--ink); }
.finding span { color: var(--ink-2); font-size: 14px; line-height: 1.6; }
.finding .conf { display: inline-block; margin-top: 6px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); }
.finding .conf.strong { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 50%, transparent); }
.finding .conf.weak { color: var(--hot); border-color: color-mix(in srgb, var(--hot) 50%, transparent); }
.heat td { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; }
.heat th { text-align: center; }
.heat td:first-child, .heat th:first-child { text-align: left; font-weight: 600; }
.paper { border: 1px solid var(--border); border-radius: 18px; background: var(--surface); margin-top: 4px; }
.paper summary {
  cursor: pointer; padding: 16px 22px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 10px;
}
.paper summary::-webkit-details-marker { display: none; }
.paper summary::before { content: "▸"; color: var(--accent); transition: transform .2s; }
.paper[open] summary::before { transform: rotate(90deg); }
.paper .body { padding: 0 26px 24px; max-width: 78ch; color: var(--ink-2); font-size: 14.5px; line-height: 1.7; }
.paper h4 { font-family: var(--display); text-transform: uppercase; font-size: 18px; color: var(--ink); margin: 20px 0 6px; letter-spacing: .02em; }
.paper .abstract { border-left: 3px solid var(--accent); padding-left: 14px; color: var(--ink); }
.paper ol { padding-left: 20px; font-size: 13px; }
.paper code { font-size: 13px; background: var(--raised); padding: 1px 5px; border-radius: 5px; }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.tiles.tight { grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; gap: 12px; }
.tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
  padding: 16px 18px; min-width: 0; position: relative; overflow: hidden;
}
.tiles.tight .tile { box-shadow: none; background: var(--raised); }
.tile .label { color: var(--ink-2); font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.tile .value { font-family: var(--display); font-size: 38px; font-weight: 700; line-height: 1.05; margin-top: 6px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile .delta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.tile .delta.up { color: var(--ok); }
.tile .delta.down { color: var(--hot); }
.tile .spark { position: absolute; right: 12px; top: 14px; width: 72px; height: 28px; color: var(--accent); opacity: .9; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap.scroll { max-height: 460px; overflow-y: auto; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; font-size: 13px; }
th, td { padding: 10px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--grid); }
th:first-child, td:first-child, th.text, td.text { text-align: left; }
th {
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
  cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--surface-solid); z-index: 1;
}
th:hover, th.sorted { color: var(--ink); }
th.sorted::after { content: " ↓"; color: var(--accent); }
th.sorted.asc::after { content: " ↑"; }
th:first-child, td:first-child { position: sticky; left: 0; background: var(--surface-solid); z-index: 1; }
th:first-child { z-index: 2; }
td:first-child { font-weight: 600; box-shadow: inset -1px 0 0 var(--grid); }
tbody tr { transition: background .15s; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent) 7%, var(--surface-solid)); }
tbody tr.clickable { cursor: pointer; }
tbody tr:last-child td { border-bottom: 0; }
td.rank-1 { color: var(--accent); }

/* ---------- predictions bits ---------- */
.meter { display: inline-flex; align-items: center; gap: 10px; justify-content: flex-end; width: 100%; }
.meter .track { width: 80px; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.meter .fill { display: block; height: 100%; background: var(--grad); border-radius: 3px; }
.split { display: inline-flex; height: 5px; width: 64px; border-radius: 3px; overflow: hidden; gap: 2px; vertical-align: middle; margin-left: 8px; }
.split .h { background: var(--series-1); }
.split .a { background: var(--series-2); }
.ok { color: var(--ok); }
.miss { color: var(--muted); }

/* ---------- shot chart ---------- */
.shot-layout { display: grid; grid-template-columns: minmax(0, 600px) minmax(240px, 1fr); gap: 32px; align-items: start; }
.court-wrap { border-radius: 16px; overflow: hidden; border: 1px solid var(--border); background: radial-gradient(400px 260px at 50% 0%, var(--glow), transparent 70%), var(--raised); padding: 10px; }
.shot-side .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#court { width: 100%; display: block; }
#court .line { fill: none; stroke: var(--court); stroke-width: 0.05; }
#court circle.bin { stroke: var(--page); stroke-width: 0.04; }
#court circle.bin:hover { stroke: var(--ink); }
.legend { display: flex; align-items: center; gap: 10px; color: var(--ink-2); font-size: 12px; margin: 8px 0 12px; }
.legend .ramp { height: 8px; flex: 1; border-radius: 4px; }

/* ---------- Ask ---------- */
.ask-hero { margin-bottom: 20px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  border: 1px solid var(--border-strong); border-radius: 999px; background: var(--raised); color: var(--ink-2);
  padding: 8px 14px; font-size: 13px; cursor: pointer; text-align: left; transition: border-color .15s, color .15s;
}
.chips button:hover { color: var(--ink); border-color: var(--accent); }
.ask-row { display: flex; gap: 8px; align-items: center; }
.ask-row input { flex: 1; padding: 14px 16px; font-size: 16px; min-width: 0; border-radius: 14px; background: var(--raised); border-color: var(--border-strong); }
.ask-row button {
  width: 50px; height: 50px; border: 0; border-radius: 14px; cursor: pointer; background: var(--grad); color: var(--accent-ink);
  display: grid; place-items: center; flex: none; box-shadow: 0 8px 22px var(--glow);
}
.ask-row button svg { width: 22px; height: 22px; }
.ask-row button:disabled { opacity: .45; cursor: wait; }
.composer {
  position: sticky; bottom: 16px; z-index: 10; padding: 12px; border-radius: 20px; border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--surface-solid) 85%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, .4);
}
.composer-meta { margin: 8px 4px 0; font-size: 12px; color: var(--muted); }
.turn { border-radius: 20px; }
.turn .q { font-family: var(--display); font-weight: 700; font-size: 26px; line-height: 1.15; margin: 0 0 16px; text-transform: none; }
.answer { font-size: 16px; line-height: 1.7; margin-bottom: 18px; max-width: 76ch; }
.answer.error { color: var(--ink-2); }
.work { border: 1px solid var(--border); border-radius: 14px; padding: 12px 16px; margin-bottom: 18px; background: color-mix(in srgb, var(--page) 60%, transparent); }
.work summary { cursor: pointer; color: var(--ink-2); font-size: 13px; display: flex; align-items: center; gap: 10px; list-style: none; font-weight: 500; }
.work summary::-webkit-details-marker { display: none; }
.steps { list-style: none; margin: 14px 0 2px; padding: 0; display: grid; gap: 14px; }
.step { font-size: 13px; color: var(--ink-2); border-left: 2px solid var(--border-strong); padding-left: 14px; min-width: 0; }
.step.think { font-style: italic; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.step.think.open { -webkit-line-clamp: unset; }
.step.query { border-left-color: var(--series-1); }
.step.query.failed { border-left-color: var(--hot); }
.step .head { color: var(--ink); }
.step .state { color: var(--muted); margin-left: 6px; }
.step pre { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0; padding: 10px 12px; font: 12px/1.5 ui-monospace, "Cascadia Code", Consolas, monospace; background: var(--raised); border: 1px solid var(--border); border-radius: 10px; color: var(--ink-2); }
.step table { font-size: 12px; width: auto; }
.step th, .step td { padding: 5px 9px; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--grid); border-top-color: var(--accent); animation: spin .8s linear infinite; flex: none; }
.spinner.done { animation: none; border-color: var(--ok); }
@keyframes spin { to { transform: rotate(360deg); } }
.turn .chart { margin-bottom: 18px; }
/* Ask lock screen */
.lock-card {
  max-width: 520px; margin: 6vh auto 0; text-align: center; padding: 44px 32px 36px; border-radius: 26px;
  border: 1px solid var(--border); background: radial-gradient(420px 220px at 50% 0%, var(--glow), transparent 70%), var(--surface);
  box-shadow: var(--shadow);
}
.lock-icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center; background: var(--grad); color: var(--accent-ink); box-shadow: 0 10px 30px var(--glow); }
.lock-icon svg { width: 28px; height: 28px; }
.lock-card h1 { font-size: 48px; line-height: 1; font-weight: 800; text-transform: uppercase; margin: 0 0 10px; }
.lock-card h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lock-card p { color: var(--ink-2); margin: 0 0 24px; }
.unlock-row { display: flex; gap: 8px; }
.pass-field { position: relative; flex: 1; min-width: 0; }
.unlock-row input { width: 100%; padding: 12px 48px 12px 14px; font-size: 16px; border-radius: 12px; }
.eye-btn {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.eye-btn:hover, .eye-btn[aria-pressed="true"] { color: var(--ink); }
.eye-btn svg { width: 20px; height: 20px; }
.unlock-row .btn:disabled { opacity: .6; cursor: wait; }
.lock-error { color: var(--hot) !important; margin: 14px 0 0 !important; font-size: 13px; }
.lock-card.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.profile-name { font-size: 34px !important; }

#tooltip {
  position: fixed; pointer-events: none; opacity: 0; z-index: 60;
  background: var(--surface-solid); color: var(--ink); border: 1px solid var(--border-strong); border-radius: 10px; padding: 7px 11px; font-size: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35); transition: opacity .1s;
}
footer { max-width: 1280px; margin: 0 auto; padding: 0 28px 40px; color: var(--muted); font-size: 12px; }

/* ---------- responsive ---------- */

/* ---------- game preview ---------- */
a.game { color: inherit; text-decoration: none; transition: transform .2s, border-color .2s; }
a.game:hover { transform: translateY(-2px); border-color: var(--accent); }
.game .open { color: var(--accent); font-size: 12px; font-weight: 600; margin-top: 6px; }
.pv-hero .pv-teams { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 16px 0 6px; position: relative; z-index: 1; }
.pv-team { display: flex; align-items: center; gap: 14px; }
.pv-team:last-child { flex-direction: row-reverse; text-align: right; }
.pv-team .badge { width: 56px; height: 56px; font-size: 16px; }
.pv-name { font-family: var(--display); font-size: clamp(22px, 3.4vw, 40px); font-weight: 800; text-transform: uppercase; line-height: 1; }
.pv-p { font-family: var(--display); font-size: 30px; font-weight: 700; color: var(--accent); }
.pv-vs { font-family: var(--display); font-size: clamp(24px, 3.4vw, 44px); font-weight: 800; color: var(--muted); }
.pv-hero .game { background: none; border: 0; padding: 0; box-shadow: none; position: relative; z-index: 1; }
.pv-hero .deck { position: relative; z-index: 1; }
.form-row { display: flex; gap: 6px; }
.form-pill { display: inline-flex; width: 28px; height: 28px; border-radius: 7px; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.form-pill.w { background: color-mix(in srgb, var(--ok) 22%, transparent); color: var(--ok); }
.form-pill.l { background: color-mix(in srgb, var(--hot) 22%, transparent); color: var(--hot); }

.pv-section { font-family: var(--display); text-transform: uppercase; font-size: 26px; margin: 26px 2px 12px; }
.angle-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.angle-list li { color: var(--ink-2); font-size: 14.5px; line-height: 1.55; padding-left: 14px; border-left: 2px solid var(--accent); }
.angle-list b { color: var(--ink); font-weight: 600; }

/* ---------- research articles ---------- */
.article-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.article-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; overflow: hidden;
  border: 1px solid var(--border); border-radius: 22px; padding: 26px 26px 22px; background: var(--surface); box-shadow: var(--shadow);
  transition: transform .2s, border-color .2s;
}
.article-card::after { content: ""; position: absolute; inset: 0; background: var(--court-lines) right -260px top -40px / 520px no-repeat; pointer-events: none; opacity: .6; }
.article-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.article-card .kicker { font-size: 11.5px; }
.article-card h3 { font-family: var(--display); font-size: 34px; font-weight: 800; text-transform: uppercase; line-height: .98; margin: 0; }
.article-card h3 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.article-card p { color: var(--ink-2); margin: 0; font-size: 14.5px; line-height: 1.6; }
.article-card .art-stat { display: flex; align-items: baseline; gap: 10px; margin-top: 6px; }
.article-card .art-stat b { font-family: var(--display); font-size: 40px; line-height: 1; }
.article-card .art-stat span { color: var(--ink-2); font-size: 13px; }
.article-card .read { margin-top: auto; padding-top: 8px; color: var(--accent); font-weight: 600; font-size: 14px; }
.coming ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 24px; }
.coming li { color: var(--ink-2); font-size: 14px; padding-left: 16px; position: relative; }
.coming li::before { content: ""; position: absolute; left: 0; top: .6em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.coming li b { color: var(--ink); font-weight: 600; }

.back-link { display: inline-block; margin: 4px 0 18px; color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500; }
.back-link:hover { color: var(--accent); }
.kicker { display: block; font-size: 12.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.art-hero { position: relative; padding: 42px 40px 36px; margin-bottom: 22px; border-radius: 26px; border: 1px solid var(--border); overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, var(--glow), transparent 55%), var(--surface); }
.art-hero::after { content: ""; position: absolute; inset: 0; background: var(--court-lines) right -80px center / 620px no-repeat; pointer-events: none; }
.art-hero h1 { font-family: var(--display); font-size: clamp(40px, 6vw, 68px); font-weight: 800; text-transform: uppercase; line-height: .95; margin: 12px 0 14px; max-width: 16ch; }
.art-hero h1 em { font-style: normal; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.art-hero .deck { font-size: 18px; line-height: 1.55; color: var(--ink-2); max-width: 62ch; margin: 0; }
.byline { margin-top: 18px; color: var(--muted); font-size: 13px; }
.prose { max-width: 70ch; margin: 0 auto 34px; font-size: 16.5px; line-height: 1.75; color: var(--ink-2); }
.prose p { margin: 0 0 16px; }
.prose b, .prose strong { color: var(--ink); font-weight: 600; }
.prose > p:first-child::first-letter { font-family: var(--display); font-weight: 800; float: left; font-size: 64px; line-height: .8; padding: 6px 10px 0 0; color: var(--accent); }
.prose.bridge { font-style: italic; border-left: 3px solid var(--accent); padding: 4px 0 4px 18px; margin-top: -10px; }
.prose.bridge::first-letter, .prose.outro > p:first-child::first-letter { all: unset; }
.prose.outro { border-top: 1px solid var(--border); padding-top: 26px; }
.prose.outro h2 { font-family: var(--display); text-transform: uppercase; font-size: 30px; color: var(--ink); margin: 0 0 12px; }

@media (max-width: 1100px) {
  nav#tabs button svg { display: none; }
  .hero { grid-template-columns: 1fr; gap: 28px; }
  .hero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1000px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .shot-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .pv-hero .pv-teams { flex-direction: column; align-items: stretch; gap: 8px; }
  .pv-team:last-child { flex-direction: row; text-align: left; }
  .pv-vs { font-size: 18px; }
  .article-list, .coming ul { grid-template-columns: 1fr; }
  .art-hero { padding: 28px 20px 24px; border-radius: 20px; }
  .art-hero .deck { font-size: 16px; }
  .prose { font-size: 15.5px; }
  /* app-style bottom tab bar replaces the header tabs */
  nav#tabs { display: none; }
  #bottom-nav {
    display: grid; grid-template-columns: repeat(7, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--page) 80%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid var(--border);
  }
  #bottom-nav button { flex-direction: column; gap: 3px; font-size: 10px; padding: 6px 0; border-radius: 12px; color: var(--muted); }
  #bottom-nav button svg { width: 22px; height: 22px; }
  #bottom-nav button.active { color: var(--ink); }
  #bottom-nav button.active svg { color: var(--accent); filter: drop-shadow(0 0 8px var(--glow)); }
  main { padding-bottom: 110px; }
  footer { padding-bottom: 100px; }
  .composer { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .grid2 { grid-template-columns: 1fr; }
  .chart.square { height: 320px; }
  .study-cards { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .bar { padding: 0 16px; gap: 10px; height: 58px; }
  .brand span { font-size: 21px; }
  .season span { display: none; }
  main { padding: 16px 16px 110px; }
  footer { padding: 0 16px 100px; }
  .hero { padding: 28px 20px 22px; border-radius: 22px; margin-bottom: 24px; }
  .hero h1 { font-size: 48px; margin: 14px 0 12px; }
  .hero p { font-size: 15px; margin-bottom: 20px; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px 14px; }
  .stat .n { font-size: 32px; }
  .hero.small { padding: 26px 20px; }
  .hero.small h1 { font-size: 40px; }
  .btn { padding: 11px 14px; }
  .hero-cta { flex-wrap: nowrap; }
  .hero-cta .btn { flex: 1; justify-content: center; font-size: 13.5px; }
  .page-head h1 { font-size: 36px; }
  .card { padding: 18px 16px; border-radius: 16px; }
  .card h2 { font-size: 20px; }
  .tiles { gap: 10px; }
  .tile { padding: 13px 14px; }
  .tile .value { font-size: 30px; }
  .tile .spark { width: 54px; height: 22px; }
  .chart { height: 230px; }
  .chart.tall { height: 270px; }
  .games-strip { grid-auto-columns: 78%; margin: 0 -16px 18px; padding: 2px 16px 14px; scroll-padding: 16px; }
  .ladder-row { grid-template-columns: 18px 30px minmax(0, 1fr) 44px; gap: 10px; }
  .ladder-row .track { display: none; }
  .tiles.tight .tile .spark { display: none; }
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
  .chips::-webkit-scrollbar { display: none; }
  .chips button { white-space: nowrap; }
  .composer { padding: 10px; border-radius: 18px; }
  .ask-row input { padding: 12px 14px; }
  .ask-row button { width: 46px; height: 46px; }
  .turn .q { font-size: 22px; }
  .answer { font-size: 15px; }
  th, td { padding: 9px 9px; }
  td:first-child { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .shot-side .tile .value { font-size: 22px; }
  .shot-side .tile { padding: 10px 12px; }
  .profile-name { font-size: 28px !important; }
  .study-head h2 { font-size: 28px; }
  .study-num { font-size: 36px; }
  .chart.forest { height: 480px; }
  .chart.forest.long { height: 940px; }
  .paper .body { padding: 0 18px 20px; }
  #bottom-nav button svg { width: 20px; height: 20px; }
  .lock-card { margin-top: 3vh; padding: 34px 20px 28px; border-radius: 22px; }
  .lock-card h1 { font-size: 40px; }
}
