:root {
  color-scheme: dark;
  --bg: #0a0c0f;
  --bg-2: #0f1216;
  --glow-a: rgba(57, 135, 229, 0.16);
  --glow-b: rgba(200, 240, 70, 0.07);
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.06);
  --panel-solid: #14181d;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 42%);
  --text: #f0efec;
  --text-2: #b9b8b0;
  --text-3: #7f7e78;
  --accent: #c8f046;
  --accent-ink: #11140a;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --good: #0ca30c;
  --warn: #fab219;
  --serious: #ec835a;
  --bad: #d03b3b;
  --mid: #383835;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 18px 40px -18px rgba(0, 0, 0, 0.7);
  --r: 18px;
  --r-sm: 12px;
  --display: 'Big Shoulders Display', 'Arial Narrow', sans-serif;
  --body: 'Instrument Sans', ui-sans-serif, sans-serif;
}
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #f3f2ee;
  --bg-2: #ecebe6;
  --glow-a: rgba(42, 120, 214, 0.12);
  --glow-b: rgba(120, 160, 0, 0.08);
  --panel: rgba(255, 255, 255, 0.72);
  --panel-2: rgba(255, 255, 255, 0.95);
  --panel-solid: #ffffff;
  --line: rgba(15, 18, 22, 0.08);
  --line-2: rgba(15, 18, 22, 0.16);
  --gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 45%);
  --text: #0b0b0b;
  --text-2: #52514e;
  --text-3: #8a8983;
  --accent: #4d6b00;
  --accent-ink: #f7ffe0;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --mid: #e4e2dc;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 16px 34px -20px rgba(20, 24, 30, 0.35);
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --bg: #f3f2ee; --bg-2: #ecebe6; --glow-a: rgba(42, 120, 214, 0.12); --glow-b: rgba(120, 160, 0, 0.08);
    --panel: rgba(255, 255, 255, 0.72); --panel-2: rgba(255, 255, 255, 0.95); --panel-solid: #ffffff;
    --line: rgba(15, 18, 22, 0.08); --line-2: rgba(15, 18, 22, 0.16);
    --gloss: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0) 45%);
    --text: #0b0b0b; --text-2: #52514e; --text-3: #8a8983; --accent: #4d6b00; --accent-ink: #f7ffe0;
    --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --mid: #e4e2dc;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 16px 34px -20px rgba(20, 24, 30, 0.35);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(1200px 700px at 85% -10%, var(--glow-a), transparent 60%),
    radial-gradient(900px 600px at -10% 110%, var(--glow-b), transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 var(--body);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  display: flex;
}
.grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
h1, h2, h3 { font-family: var(--display); letter-spacing: 0.01em; margin: 0; line-height: 1.02; }
h1 { font-size: clamp(34px, 5vw, 56px); font-weight: 800; }
h2 { font-size: 26px; font-weight: 700; }
h3 { font-size: 19px; font-weight: 700; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-family: var(--display); font-weight: 700; letter-spacing: 0.01em; }

/* rail */
.rail {
  position: sticky; top: 0; height: 100vh; width: 232px; flex: none; z-index: 3; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 18px; border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), transparent);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 10px; font-family: var(--display); font-size: 25px; font-weight: 800; letter-spacing: 0.02em; }
.brand svg { width: 28px; height: 28px; color: var(--accent); }
#nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
#nav .sec { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-3); padding: 14px 12px 6px; }
#nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px; color: var(--text-2); font-weight: 500;
  transition: background 0.18s, color 0.18s;
}
#nav a:hover { background: var(--panel-2); color: var(--text); }
#nav a.on { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
#nav a.on .ico { color: var(--accent); }
#nav .ico { width: 18px; height: 18px; flex: none; }
#nav .lg { width: 18px; text-align: center; font-family: var(--display); font-weight: 800; font-size: 12px; color: var(--text-3); }
.rail-foot { margin-top: auto; font-size: 12px; color: var(--text-3); padding: 0 12px; }

.shell { flex: 1; min-width: 0; position: relative; z-index: 1; }
.top {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 14px; padding: 14px 28px;
  backdrop-filter: blur(16px); background: linear-gradient(180deg, var(--bg) 20%, transparent);
}
.search { position: relative; flex: 1; max-width: 520px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 17px; height: 17px; transform: translateY(-50%); color: var(--text-3); }
.search input {
  width: 100%; padding: 11px 14px 11px 40px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
  outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.search input:focus { border-color: var(--line-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-pop { position: absolute; top: calc(100% + 8px); left: 0; right: 0; padding: 8px; border-radius: 16px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); max-height: 420px; overflow: auto; }
.search-pop a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; }
.search-pop a:hover, .search-pop a:focus { background: var(--panel-2); outline: none; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sync { font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 7px; }
.sync::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px color-mix(in srgb, var(--good) 22%, transparent); }
.icon-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; cursor: pointer; color: var(--text-2); transition: 0.18s; }
.icon-btn:hover { color: var(--text); border-color: var(--line-2); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.unlocked { color: var(--accent); }

main { padding: 6px 28px 80px; max-width: 1480px; outline: none; }

/* panels */
.panel {
  position: relative; border-radius: var(--r); background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: blur(14px); padding: 20px;
}
.panel::before { content: ''; position: absolute; inset: 0; border-radius: inherit; background: var(--gloss); pointer-events: none; }
.panel > * { position: relative; }
.panel-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-h .sub { font-size: 13px; color: var(--text-3); }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.main-side { grid-template-columns: minmax(0, 1.7fr) minmax(300px, 1fr); }
.stack { display: flex; flex-direction: column; gap: 18px; }
.row { display: flex; align-items: center; gap: 10px; }
.wrap { flex-wrap: wrap; }
.sp { justify-content: space-between; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 18px 0 24px; flex-wrap: wrap; }
.hero .kicker { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.hero p { margin: 10px 0 0; color: var(--text-2); max-width: 640px; }

/* stat tiles */
.tile { padding: 18px 20px; }
.tile .k { font-size: 12px; color: var(--text-3); letter-spacing: 0.08em; text-transform: uppercase; }
.tile .v { font-family: var(--display); font-size: 44px; font-weight: 800; line-height: 1; margin-top: 8px; }
.tile .d { font-size: 13px; color: var(--text-2); margin-top: 6px; }
.tile .v small { font-size: 20px; color: var(--text-3); font-weight: 700; margin-left: 4px; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--line-2); color: var(--text-2); background: var(--panel); white-space: nowrap; }
.chip.lg { font-family: var(--display); font-weight: 800; letter-spacing: 0.06em; }
.chip.on, button.chip[aria-pressed='true'] { background: var(--text); color: var(--bg); border-color: var(--text); }
button.chip { cursor: pointer; }
.tier { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }
.tier.lock { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.tier.strong { color: var(--text); border-color: var(--text-2); }
.tier.lean { color: var(--text-2); }
.tier.tossup { color: var(--text-3); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.status i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status.live i { background: var(--bad); animation: pulse 1.4s infinite; }
.status.hit i { background: var(--good); }
.status.miss i { background: var(--bad); }
@keyframes pulse { 50% { opacity: 0.35; } }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 9px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; font-weight: 600; font-size: 14px; transition: 0.18s; }
.btn:hover { border-color: var(--text-3); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn:focus-visible, .chip:focus-visible, a:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* team marks */
.logo { width: 34px; height: 34px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.25)); }
.logo.sm { width: 22px; height: 22px; }
.logo.lg { width: 76px; height: 76px; }
.logo.xl { width: 104px; height: 104px; }
.mono-logo { display: grid; place-items: center; border-radius: 50%; font-family: var(--display); font-weight: 800; font-size: 12px; color: #fff; }

/* game cards */
.games { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.game {
  display: block; position: relative; border-radius: var(--r); padding: 16px; background: var(--panel); border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: transform 0.2s, border-color 0.2s; overflow: hidden; animation: rise 0.45s both;
}
.game::before { content: ''; position: absolute; inset: 0; background: var(--gloss); pointer-events: none; }
.game:hover { transform: translateY(-2px); border-color: var(--line-2); }
.game .meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--text-3); margin-bottom: 12px; position: relative; }
.team-line { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 4px 0; position: relative; }
.team-line .nm { font-weight: 600; }
.team-line .nm small { display: block; color: var(--text-3); font-weight: 500; font-size: 12px; }
.team-line .sc { font-family: var(--display); font-size: 30px; font-weight: 800; }
.team-line.lost .sc, .team-line.lost .nm { color: var(--text-3); }
.team-line .pk { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: 0.08em; }
.game .foot { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; font-size: 13px; color: var(--text-2); position: relative; gap: 8px; white-space: nowrap; }
.game .foot .row { gap: 8px; }
.team-line .sc .proj { font-size: 24px; color: var(--text-3); font-weight: 700; }
.add-t.btn.sm { padding: 5px 9px; }
.add-t { position: relative; z-index: 2; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* probability bar */
.pbar { position: relative; display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; margin-top: 12px; }
.pbar span { display: block; height: 100%; }
.pbar span:first-child { border-radius: 999px 2px 2px 999px; }
.pbar span:last-child { border-radius: 2px 999px 999px 2px; }
.pbar-l { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.pbar-l b { color: var(--text); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; }
.tbl tbody tr:hover { background: var(--panel); }
.tbl-wrap { overflow-x: auto; }
th[data-sort] { cursor: pointer; }

/* lists */
.feed { display: flex; flex-direction: column; }
.feed .it { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 2px; border-bottom: 1px solid var(--line); }
.feed .it:last-child { border-bottom: 0; }
.feed .it .t { font-weight: 600; line-height: 1.35; }
.feed .it .m { font-size: 12px; color: var(--text-3); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.sent { display: inline-block; width: 8px; height: 8px; border-radius: 50%; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 6px; height: 6px; border-radius: 2px; background: var(--line-2); }
.dots i.on { background: var(--text-2); }
.thumb { width: 64px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--panel-2); }

.form { display: inline-flex; gap: 3px; }
.form b { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.form b.W { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--good) 55%, transparent); }
.form b.L { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--text-2); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--bad) 40%, transparent); }
.form b.T { background: var(--panel-2); color: var(--text-2); }

/* rank bars */
.rank { display: grid; grid-template-columns: minmax(130px, 1fr) 2fr 52px; gap: 12px; align-items: center; padding: 6px 0; font-size: 13px; }
.rank .bar { height: 8px; border-radius: 4px; background: var(--panel-2); position: relative; overflow: hidden; }
.rank .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
.rank .rk { text-align: right; font-family: var(--display); font-weight: 700; font-size: 16px; }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .dow { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-3); padding: 0 6px 4px; }
.cal .day { min-height: 96px; border-radius: 14px; padding: 8px; background: var(--panel); border: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 6px; transition: 0.16s; text-align: left; }
.cal .day:hover { border-color: var(--line-2); }
.cal .day.out { opacity: 0.4; }
.cal .day.today { box-shadow: inset 0 0 0 1.5px var(--accent); }
.cal .day.sel { background: var(--panel-2); border-color: var(--text-3); }
.cal .day .dn { font-family: var(--display); font-weight: 700; font-size: 18px; }
.cal .day .lgs { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-2); }
.cal .day .lgs span { display: flex; align-items: center; gap: 6px; }
.cal .day .lgs i { width: 6px; height: 6px; border-radius: 2px; }

/* tooltip */
.tip { position: fixed; z-index: 50; pointer-events: none; padding: 9px 12px; border-radius: 12px; background: var(--panel-solid); border: 1px solid var(--line-2); box-shadow: var(--shadow); font-size: 13px; max-width: 280px; }
.tip b { font-family: var(--display); font-size: 16px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 60; padding: 11px 18px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: var(--shadow); }

dialog { border: 1px solid var(--line-2); border-radius: 22px; background: var(--panel-solid); color: var(--text); padding: 24px; width: min(520px, 92vw); box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6); }
dialog::backdrop { background: rgba(5, 7, 10, 0.55); backdrop-filter: blur(4px); }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: var(--text-2); }
.field input, .field select, .field textarea { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel); outline: none; color: var(--text); }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }

/* charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { fill: var(--text-3); font-size: 11px; font-family: var(--body); }
.chart .lab { fill: var(--text-2); font-size: 12px; }
.chart .grid line { stroke: var(--line); }
.chart .axis { stroke: var(--line-2); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--text-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 2px; border-radius: 1px; width: 14px; }

.matchup { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; }
.matchup .side { display: flex; align-items: center; gap: 16px; }
.matchup .side.r { flex-direction: row-reverse; text-align: right; }
.matchup .big { font-family: var(--display); font-size: clamp(48px, 7vw, 84px); font-weight: 800; line-height: 0.9; }
.matchup .vs { text-align: center; color: var(--text-3); font-size: 13px; }
.story { font-size: 17px; line-height: 1.55; }
.why li { margin: 6px 0; color: var(--text-2); }
.empty { padding: 30px; text-align: center; color: var(--text-3); }
.skeleton { height: 120px; border-radius: var(--r); background: linear-gradient(90deg, var(--panel) 0%, var(--panel-2) 50%, var(--panel) 100%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.note { font-size: 13px; color: var(--text-2); padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--line-2); }
.player { display: flex; align-items: center; gap: 10px; }
.player img { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.qa { border-left: 2px solid var(--line-2); padding: 4px 0 4px 14px; margin: 10px 0; }
.qa .q { font-weight: 600; }
.qa .s { font-size: 13px; color: var(--accent); margin-top: 4px; }

@media (max-width: 1100px) {
  .main-side, .g3, .g4 { grid-template-columns: 1fr 1fr; }
  .main-side > :first-child { grid-column: 1 / -1; }
}
@media (max-width: 820px) {
  body { display: block; }
  .rail { position: fixed; bottom: 0; top: auto; left: 0; right: 0; height: auto; width: auto; flex-direction: row; padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); background: var(--panel-solid); }
  .brand, .rail-foot, #nav .sec { display: none; }
  #nav { flex-direction: row; overflow-x: auto; gap: 4px; width: 100%; }
  #nav a { flex-direction: column; gap: 2px; font-size: 10px; padding: 6px 10px; flex: none; }
  .top { padding: 12px 16px; }
  main { padding: 4px 16px 110px; }
  .g2, .g3, .g4, .main-side { grid-template-columns: 1fr; }
  .cal .day { min-height: 62px; padding: 6px; }
  .cal .day .lgs span b { display: none; }
  .matchup { grid-template-columns: 1fr; }
  .matchup .side.r { flex-direction: row; text-align: left; }
  .sync { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
}
