:root {
  --bg: #f3f3f0;
  --card: #ffffff;
  --text: #15171c;
  --muted: #6b707a;
  --faint: #a2a6ae;
  --line: #e4e4df;
  --hover: #f7f7f4;
  --live: #d6352a;
  --win: #1f8a4c;
  --loss: #c2412f;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 1px 1px rgb(0 0 0 / 0.03);
  color-scheme: light;
}

/* Dark palette: used by "Auto" when the system is dark, and always by "Dark". */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0e1014;
    --card: #171a20;
    --text: #e9eaed;
    --muted: #8c919b;
    --faint: #5b606a;
    --line: #262a32;
    --hover: #1d2128;
    --live: #ff5b4f;
    --win: #4cc281;
    --loss: #ff7a66;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1014;
  --card: #171a20;
  --text: #e9eaed;
  --muted: #8c919b;
  --faint: #5b606a;
  --line: #262a32;
  --hover: #1d2128;
  --live: #ff5b4f;
  --win: #4cc281;
  --loss: #ff7a66;
  --shadow: none;
  color-scheme: dark;
}

/* Neon theme: always dark. "Dark city, neon signs": near-black purple, hot pink and cyan glow. */
:root[data-theme="neon"] {
  --bg: #07050f;
  --card: #100b1e;
  --text: #f4f0ff;
  --muted: #a39bc6;
  --faint: #635a85;
  --line: #2a2045;
  --hover: #1a1231;
  --live: #ff2ea6;
  --win: #3dffb8;
  --loss: #ff5c7c;
  --neon: #29e8ff;
  --shadow: 0 0 0 1px rgb(41 232 255 / 0.03), 0 10px 30px -20px rgb(255 46 166 / 0.5);
  color-scheme: dark;
}

*,
*::before,
*::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
button:disabled { opacity: 0.3; cursor: default; }
:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; border-radius: 6px; }

h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */

.bar {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.5) blur(12px);
  -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--line);
}
.bar-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 10px 16px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.leagues { display: flex; gap: 2px; }
.leagues a {
  padding: 5px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-decoration: none;
}
.leagues a:hover { color: var(--text); background: var(--hover); }
.leagues a.on { color: var(--text); background: var(--line); }

.weeks { display: flex; align-items: center; gap: 4px; }
.week { display: grid; text-align: center; min-width: 9.5em; }
#week-label { font-weight: 650; }
#week-detail { font-size: 12px; color: var(--muted); white-space: nowrap; }

.icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
}
.icon:not(:disabled):hover { background: var(--hover); }

.fav-btn {
  grid-column: 3; /* stays right even when the middle (week nav / back) is hidden */
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
}
.fav-btn:hover { background: var(--hover); }

#back {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  font-weight: 600;
}
#back:hover { background: var(--hover); }

/* ---------- layout ---------- */

main {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 16px calc(32px + env(safe-area-inset-bottom, 0px));
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 10px;
}

/* College names are longer, so use wider cards (two columns on desktop). */
[data-league="cfb"] .grid { grid-template-columns: repeat(auto-fill, minmax(min(360px, 100%), 1fr)); }

.group { margin-top: 24px; }
.group h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}
.group.in h2 { color: var(--live); }
.count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--line);
  color: var(--muted);
}
.day { font-size: 13px; font-weight: 600; margin: 14px 0 8px; }
.day:first-of-type { margin-top: 0; }

.empty { color: var(--muted); padding: 12px 0; }
.note {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.views { display: flex; padding: 2px; border-radius: 9px; background: var(--hover); border: 1px solid var(--line); }
.views a {
  padding: 4px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
}
.views a:hover { color: var(--text); }
.views a.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.1); }
.group-select {
  margin-left: auto;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px 8px;
}
.this-week {
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.this-week:hover { color: var(--text); }

.foot { margin-top: 36px; text-align: center; font-size: 12px; color: var(--faint); }

/* ---------- game card ---------- */

.game {
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
  display: grid;
  grid-template-columns: 1fr auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
a.game:hover { border-color: var(--faint); }
a.game:active { transform: scale(0.99); }
.game.in { border-color: color-mix(in srgb, var(--live) 45%, var(--line)); }

.teams { padding: 10px 12px; display: grid; gap: 6px; }
.row {
  display: grid;
  grid-template-columns: 28px 1fr auto auto; /* logo, name+record, possession, score */
  align-items: center;
  gap: 10px;
  min-height: 28px;
}
.row .tlink { grid-column: 1; display: block; }
.row .tlink picture { display: block; }
.row .who[data-team]:hover .name { text-decoration: underline; text-underline-offset: 2px; }
.row img { display: block; width: 28px; height: 28px; object-fit: contain; }
.row .who { grid-column: 2; display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank { flex: none; font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; margin-right: -3px; }
.hero-name .rank { font-size: 12px; margin-right: 5px; }
.row .rec { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row .poss { grid-column: 3; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.row .poss.rz { background: var(--live); }
.row .score {
  grid-column: 4;
  min-width: 2ch;
  text-align: right;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.row.lose .name,
.row.lose .score { color: var(--muted); font-weight: 500; }
@media (max-width: 359px) { .row .rec { display: none; } }

.meta {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 1px;
  width: 96px; /* fixed so every card's status column lines up; long text wraps */
  padding: 8px;
  border-left: 1px solid var(--line);
  text-align: center;
  overflow-wrap: anywhere;
}
.meta .state { font-size: 13px; font-weight: 650; }
.meta .sub { font-size: 12px; line-height: 1.25; color: var(--muted); }
.game.post .meta .state { color: var(--muted); }
.game.in .meta .state { color: var(--live); }

.live-dot::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  vertical-align: 2px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }
@media (prefers-reduced-motion: reduce) { .live-dot::before { animation: none; } }

.sit {
  grid-column: 1 / -1;
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}

/* ---------- favorite team ---------- */

.fav:empty { display: none; }
.fav-card {
  --tint: color-mix(in srgb, var(--team) 9%, var(--card));
  background: var(--tint);
  border: 1px solid color-mix(in srgb, var(--team) 25%, var(--line));
  border-radius: calc(var(--radius) + 4px);
  padding: 14px;
  display: grid;
  gap: 12px;
  position: relative;
  overflow: hidden;
}
.fav-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--team);
}
.fav-card > .fav-head { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.fav-card > .fav-head:hover h2 { text-decoration: underline; text-underline-offset: 3px; }
.fav-card > .fav-head img { display: block; width: 44px; height: 44px; object-fit: contain; }
.fav-card h2 { font-size: 18px; font-weight: 750; }
.fav-card .fav-head p { font-size: 13px; color: var(--muted); }
.fav-card .game { max-width: 480px; }
.fav-card .empty { padding: 4px 0; }

.sched {
  list-style: none;
  margin: 0 -14px -14px;
  padding: 2px 14px 14px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.chip {
  flex: none;
  display: grid;
  gap: 1px;
  min-width: 74px;
  padding: 6px 9px;
  border-radius: 9px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 12px;
  cursor: pointer;
  scroll-snap-align: center;
}
.chip:hover { border-color: var(--faint); }
.chip.current { border-color: var(--team); box-shadow: inset 0 0 0 1px var(--team); }
.chip .wk { font-size: 10px; font-weight: 700; color: var(--faint); }
.chip .opp { font-weight: 650; }
.chip .res { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip.W .res { color: var(--win); font-weight: 600; }
.chip.L .res { color: var(--loss); font-weight: 600; }
.chip.in .res { color: var(--live); font-weight: 600; }
.chip.bye { background: transparent; border-style: dashed; }
.chip.bye .opp { color: var(--muted); }

/* ---------- team picker ---------- */

dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: min(80vh, 720px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
}
dialog::backdrop { background: rgb(0 0 0 / 0.35); backdrop-filter: blur(2px); }
.picker-inner { padding: 16px; }
.picker-inner header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.picker-inner h2 { font-size: 16px; }
.link { color: var(--muted); font-size: 13px; font-weight: 600; }
.link:hover { color: var(--text); }
.picker-search {
  width: 100%;
  margin-bottom: 12px;
  padding: 8px 10px;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.pick-group h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 14px 0 4px;
}
.pick-group:first-child h3 { margin-top: 0; }
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px;
}
.pick {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  text-align: left;
  font-size: 14px;
}
.pick img { display: block; width: 28px; height: 28px; object-fit: contain; }
.pick:hover { background: var(--hover); }
.pick.on { background: var(--hover); font-weight: 650; box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- game detail ---------- */

.center { text-align: center; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-top: 12px;
}
.card h2 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 18px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
}
.hero.in { border-color: color-mix(in srgb, var(--live) 45%, var(--line)); }
.hero-team { display: flex; align-items: center; gap: 12px; min-width: 0; }
.hero-team.right { flex-direction: row-reverse; text-align: right; }
.hero-team img { display: block; width: 56px; height: 56px; object-fit: contain; }
.hero-name { display: grid; min-width: 0; color: inherit; text-decoration: none; }
.hero-name:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.hero-team .tlink { display: block; }
.hero-name strong { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-name span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hero-score {
  position: relative;
  margin-inline: auto 0;
  font-size: 40px;
  font-weight: 750;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.hero-team.right .hero-score { margin-inline: 0 auto; }
.hero-team.lose .hero-score,
.hero-team.lose strong { color: var(--muted); font-weight: 600; }
.hero-score .poss {
  position: absolute;
  top: 50%;
  left: -14px;
  width: 7px;
  height: 7px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--muted);
}
.hero-team.right .hero-score .poss { left: auto; right: -14px; }
.hero-mid { display: grid; justify-items: center; gap: 2px; text-align: center; max-width: 12em; }
.hero-mid .state { font-weight: 650; font-size: 14px; }
.hero.in .hero-mid .state { color: var(--live); }
.hero.post .hero-mid .state { color: var(--muted); }
.hero-mid .sub { font-size: 12px; color: var(--muted); }

.linescore { padding: 8px 14px; overflow-x: auto; }
.linescore table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.linescore th,
.linescore td { padding: 6px 4px; text-align: center; font-size: 14px; }
.linescore thead th { font-size: 11px; font-weight: 600; color: var(--muted); }
.linescore tbody th { text-align: left; font-weight: 650; white-space: nowrap; }
.linescore tbody th a { color: inherit; text-decoration: none; }
.linescore tbody th a:hover { text-decoration: underline; }
.linescore tbody th picture img { display: inline-block; vertical-align: -4px; width: 18px; height: 18px; margin-right: 6px; }
.linescore tbody tr + tr { border-top: 1px solid var(--line); }
.linescore .total { font-weight: 750; }
.linescore tr.lose td,
.linescore tr.lose th { color: var(--muted); }

.game-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 12px; }
@media (min-width: 900px) {
  .game-cols { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; }
}

.plays { list-style: none; margin: 0; padding: 0; }
.plays .period {
  font-size: 11px;
  font-weight: 700;
  color: var(--faint);
  padding: 10px 0 4px;
  border-bottom: 1px solid var(--line);
}
.plays .period:first-child { padding-top: 0; }
.play {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 9px 0;
}
.play + .play { border-top: 1px solid var(--line); }
.play img { display: block; width: 22px; height: 22px; object-fit: contain; margin-top: 1px; }
.play-top { display: flex; gap: 8px; align-items: center; font-size: 12px; }
.tag {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--line);
}
.clock { color: var(--muted); font-variant-numeric: tabular-nums; }
.play p { font-size: 13px; margin-top: 2px; }
.play-score { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.play-score .hl { color: var(--text); font-weight: 750; }

.team-stats .stat {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  padding: 7px 0 0;
  font-variant-numeric: tabular-nums;
}
.team-stats .stat .v:last-of-type { text-align: right; }
.team-stats .stat .k { font-size: 12px; color: var(--muted); text-align: center; }
.team-stats .stat .v { font-size: 14px; color: var(--muted); }
.team-stats .stat .v.lead { color: var(--text); font-weight: 700; }
.team-stats .stat.head { padding-top: 0; }
.team-stats .stat.head .v { font-size: 11px; font-weight: 700; color: var(--faint); }
.cmp {
  grid-column: 1 / -1;
  display: flex;
  gap: 2px;
  height: 4px;
  margin-top: 5px;
}
.cmp span { border-radius: 2px; background: var(--away); opacity: 0.85; flex: var(--a) 1 0; }
.cmp span + span { background: var(--home); flex: calc(1 - var(--a)) 1 0; }

.players > header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.players > header h2 { margin: 0; }
.segs { display: flex; padding: 2px; border-radius: 9px; background: var(--hover); border: 1px solid var(--line); }
.seg {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.seg img { display: block; width: 18px; height: 18px; object-fit: contain; }
.seg.on { background: var(--card); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / 0.1); }

.table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table.stats { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; margin-top: 12px; }
table.stats th,
table.stats td { padding: 6px 6px; text-align: right; white-space: nowrap; }
table.stats th:first-child { text-align: left; padding-left: 0; }
table.stats thead th { font-size: 11px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
table.stats thead th:first-child { color: var(--text); font-size: 12px; font-weight: 700; }
table.stats tbody th { font-weight: 550; }
table.stats tbody tr + tr { border-top: 1px solid var(--line); }
table.stats tfoot { border-top: 1px solid var(--faint); color: var(--muted); }

.players details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.players summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.players summary:hover { color: var(--text); }

.game-info { margin-top: 16px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- standings ---------- */

.st-cols { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .st-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
}
.st-cols .card:first-child,
#standings-view > .card:first-child { margin-top: 0; }
.st-card { padding-bottom: 8px; }
.st-card h2 { margin-bottom: 4px; }
table.st { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.st th,
table.st td { padding: 7px 5px; text-align: right; white-space: nowrap; }
table.st thead th { font-size: 11px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
table.st tbody th { text-align: left; font-weight: 600; width: 100%; padding-left: 0; }
table.st tbody tr + tr { border-top: 1px solid var(--line); }
table.st tr.cut { border-bottom: 2px solid var(--faint); }
table.st tr.fav { background: var(--hover); }
table.st tr.fav th { font-weight: 750; }
table.st .lead { width: 1.5em; padding-left: 0; padding-right: 8px; text-align: left; color: var(--muted); font-weight: 600; }
.st-team { display: flex; align-items: center; gap: 8px; min-width: 0; color: inherit; text-decoration: none; }
.st-team:hover .st-name { text-decoration: underline; text-underline-offset: 2px; }
.st-team img { display: block; width: 20px; height: 20px; object-fit: contain; }
.st-name { overflow: hidden; text-overflow: ellipsis; }
.st-suffix { font-size: 11px; font-weight: 500; color: var(--muted); }
table.st td.trend { font-size: 11px; color: var(--muted); min-width: 3em; }
.st-note { font-size: 12px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
@media (max-width: 520px) {
  table.st .opt { display: none; }
}

/* ---------- team page ---------- */

.team-hero {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  overflow: hidden;
  background: color-mix(in srgb, var(--team) 9%, var(--card));
  border: 1px solid color-mix(in srgb, var(--team) 25%, var(--line));
  border-radius: calc(var(--radius) + 4px);
}
.team-hero::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--team); }
.team-hero img { display: block; width: 56px; height: 56px; object-fit: contain; }
.team-id { flex: 1; min-width: 0; }
.team-id h1 { font-size: 20px; font-weight: 750; }
.team-id p { font-size: 13px; color: var(--muted); }
.fav-toggle {
  flex: none;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.fav-toggle:hover { color: var(--text); }
.fav-toggle.on { color: var(--text); border-color: var(--team); }

.team-cols { display: grid; gap: 0 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) {
  .team-cols { grid-template-columns: minmax(0, 6fr) minmax(0, 5fr); align-items: start; }
}

.sch { padding-bottom: 6px; }
.sch-row {
  display: grid;
  grid-template-columns: 1.6em 3.6em minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px 6px;
  margin: 0 -6px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
}
.sch-row + .sch-row { border-top: 1px solid var(--line); border-radius: 0; }
a.sch-row:hover { background: var(--hover); }
.sch-row.next { background: var(--hover); }
.sch-wk { font-size: 11px; font-weight: 700; color: var(--faint); font-variant-numeric: tabular-nums; }
.sch-date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.sch-opp { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
.sch-opp img { display: block; width: 20px; height: 20px; object-fit: contain; }
.sch-opp[data-team]:hover .sch-name { text-decoration: underline; text-underline-offset: 2px; }
.sch-at { font-size: 12px; font-weight: 500; color: var(--muted); width: 1.4em; }
.sch-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sch-row.bye .sch-opp { color: var(--muted); font-weight: 500; }
.sch-row .res { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.sch-row .res.W { color: var(--win); font-weight: 650; }
.sch-row .res.L { color: var(--loss); font-weight: 650; }
.sch-row .res.live { color: var(--live); font-weight: 650; }

.season-stats h3 {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin: 14px 0 2px;
}
.season-stats h2 + h3 { margin-top: 0; }
.season-stats dl { margin: 0; }
.season-stats dl div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 14px; }
.season-stats dl div + div { border-top: 1px solid var(--line); }
.season-stats dt { color: var(--muted); }
.season-stats dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; }

/* team page: leaders and depth chart */

.team-tabs { width: fit-content; margin-top: 12px; }

.leader { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.leader + .leader { border-top: 1px solid var(--line); }
.leader-info { display: grid; min-width: 0; }
.leader-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); }
.leader-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.leader-pos { font-size: 12px; color: var(--muted); }
/* Jersey number shows through if the headshot is missing or fails to load. */
.headshot {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--hover);
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.headshot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; }
.leader-stat { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }

.depth-cols .card:first-child { margin-top: 12px; }
.depth h2 { display: flex; align-items: baseline; gap: 8px; }
.formation { font-size: 11px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--faint); }
table.depth-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.depth-table th,
table.depth-table td { padding: 7px 8px; text-align: left; white-space: nowrap; }
table.depth-table thead th { font-size: 11px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); }
table.depth-table tbody th { width: 3.5em; padding-left: 0; font-size: 12px; font-weight: 700; color: var(--muted); }
table.depth-table tbody tr + tr { border-top: 1px solid var(--line); }
table.depth-table tbody td:nth-child(2) { font-weight: 650; }
table.depth-table tbody td:nth-child(n + 3) { color: var(--muted); }
/* On phones, each position is one wrapping line: starter, then backups separated by dots. */
@media (max-width: 520px) {
  table.depth-table thead { display: none; }
  table.depth-table tbody tr { position: relative; display: flex; flex-wrap: wrap; align-items: baseline; padding: 7px 0 7px 3.2em; }
  table.depth-table tbody th { position: absolute; left: 0; top: 7px; padding: 0; }
  table.depth-table tbody td { padding: 0; }
  table.depth-table tbody td:empty { display: none; }
  table.depth-table tbody td + td:not(:empty)::before { content: "·"; padding: 0 6px; color: var(--faint); }
}
.inj {
  display: inline-block;
  margin-left: 3px;
  padding: 0 4px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  vertical-align: 1px;
  color: var(--card);
  background: var(--faint);
}
.inj-Q { background: #c98a00; }
.inj-D, .inj-O, .inj-IR, .inj-PUP, .inj-SUSP { background: var(--loss); }

/* ---------- theme picker (footer) ---------- */

.theme-pick { display: inline-flex; align-items: center; gap: 6px; margin-top: 10px; }
.theme-pick .views a { cursor: pointer; font-size: 12px; padding: 3px 10px; }

/* ---------- neon theme effects ---------- */

[data-theme="neon"] body {
  background:
    radial-gradient(900px 520px at 8% -8%, rgb(255 46 166 / 0.16), transparent 62%),
    radial-gradient(800px 480px at 105% 12%, rgb(41 232 255 / 0.11), transparent 60%),
    radial-gradient(700px 400px at 50% 110%, rgb(123 60 255 / 0.12), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
[data-theme="neon"] :focus-visible { outline-color: var(--neon); }

/* Header: dark glass with a pink neon underline. */
[data-theme="neon"] .bar {
  background: rgb(7 5 15 / 0.72);
  border-bottom-color: rgb(255 46 166 / 0.35);
  box-shadow: 0 8px 28px -20px rgb(255 46 166 / 0.9);
}
[data-theme="neon"] .leagues a.on,
[data-theme="neon"] .views a.on,
[data-theme="neon"] .seg.on {
  color: var(--neon);
  background: rgb(41 232 255 / 0.1);
  box-shadow: inset 0 0 0 1px rgb(41 232 255 / 0.35), 0 0 14px -4px rgb(41 232 255 / 0.6);
  text-shadow: 0 0 8px rgb(41 232 255 / 0.7);
}
[data-theme="neon"] .views,
[data-theme="neon"] .segs { background: rgb(255 255 255 / 0.03); }
[data-theme="neon"] #week-label { text-shadow: 0 0 10px rgb(255 46 166 / 0.55); }

/* Section headings glow like signage. */
[data-theme="neon"] .group h2,
[data-theme="neon"] .card h2 {
  color: var(--neon);
  text-shadow: 0 0 10px rgb(41 232 255 / 0.55);
}
[data-theme="neon"] .group.in h2 { color: var(--live); text-shadow: 0 0 10px rgb(255 46 166 / 0.7); }

/* Cards: faint neon edge, brighter on hover. */
[data-theme="neon"] .game,
[data-theme="neon"] .card,
[data-theme="neon"] .hero,
[data-theme="neon"] .fav-card,
[data-theme="neon"] .team-hero { border-color: rgb(123 90 255 / 0.22); }
[data-theme="neon"] a.game:hover { border-color: rgb(41 232 255 / 0.55); box-shadow: 0 0 18px -6px rgb(41 232 255 / 0.45); }
[data-theme="neon"] .game.in,
[data-theme="neon"] .hero.in {
  border-color: rgb(255 46 166 / 0.7);
  box-shadow: 0 0 22px -6px rgb(255 46 166 / 0.65), inset 0 0 18px -12px rgb(255 46 166 / 0.6);
}
[data-theme="neon"] .live-dot::before { box-shadow: 0 0 8px currentColor; }
[data-theme="neon"] .game.in .meta .state,
[data-theme="neon"] .hero.in .hero-mid .state { text-shadow: 0 0 10px rgb(255 46 166 / 0.8); }

/* Scores light up; losing scores stay dim. */
[data-theme="neon"] .row:not(.lose) .score,
[data-theme="neon"] .hero-team:not(.lose) .hero-score,
[data-theme="neon"] .linescore tr:not(.lose) .total {
  color: #eafcff;
  text-shadow: 0 0 6px rgb(41 232 255 / 0.9), 0 0 18px rgb(41 232 255 / 0.45);
}
[data-theme="neon"] .game.in .row .score,
[data-theme="neon"] .hero.in .hero-score { color: #ffe9f7; text-shadow: 0 0 6px rgb(255 46 166 / 0.95), 0 0 18px rgb(255 46 166 / 0.5); }
[data-theme="neon"] .chip.W .res,
[data-theme="neon"] .sch-row .res.W { text-shadow: 0 0 8px rgb(61 255 184 / 0.55); }
[data-theme="neon"] .chip.L .res,
[data-theme="neon"] .sch-row .res.L { text-shadow: 0 0 8px rgb(255 92 124 / 0.5); }
[data-theme="neon"] .chip.current { border-color: var(--neon); box-shadow: 0 0 12px -2px rgb(41 232 255 / 0.6); }
[data-theme="neon"] .rank { color: #ffb8e6; }
[data-theme="neon"] table.st tr.fav,
[data-theme="neon"] .sch-row.next { background: rgb(255 46 166 / 0.08); }
[data-theme="neon"] table.st tr.cut { border-bottom-color: rgb(255 46 166 / 0.6); }
[data-theme="neon"] .cmp span { opacity: 1; box-shadow: 0 0 6px -1px var(--away); }
[data-theme="neon"] .cmp span + span { box-shadow: 0 0 6px -1px var(--home); }
[data-theme="neon"] .fav-btn,
[data-theme="neon"] .fav-toggle,
[data-theme="neon"] .group-select { background: var(--card); border-color: rgb(123 90 255 / 0.35); }
[data-theme="neon"] .fav-toggle.on { color: #ffe9f7; border-color: var(--live); box-shadow: 0 0 12px -3px rgb(255 46 166 / 0.8); }
[data-theme="neon"] dialog { border-color: rgb(41 232 255 / 0.3); box-shadow: 0 0 40px -10px rgb(41 232 255 / 0.35), 0 20px 60px rgb(0 0 0 / 0.6); }
[data-theme="neon"] .headshot { border-color: rgb(41 232 255 / 0.35); box-shadow: 0 0 10px -3px rgb(41 232 255 / 0.5); }

/* ---------- small screens ---------- */

@media (max-width: 520px) {
  .bar-inner { grid-template-columns: auto 1fr auto; }
  .hero { gap: 6px; padding: 14px 10px; }
  .hero-team { flex-direction: column; align-items: flex-start; gap: 6px; }
  .hero-team.right { flex-direction: column; align-items: flex-end; }
  .hero-team img { width: 40px; height: 40px; }
  .hero-score { font-size: 32px; margin: 0; }
  .hero-team.right .hero-score { margin: 0; }
  .hero-name strong { font-size: 15px; }
  .leagues a { padding: 5px 7px; font-size: 13px; }
  .week { min-width: 0; }
  .grid { grid-template-columns: 1fr; }
}

/* Smallest phones (320px): tighten the header so league tabs, week nav and team button fit. */
@media (max-width: 360px) {
  .bar-inner { gap: 4px; }
  .leagues a { padding: 5px 5px; }
  .icon { width: 28px; }
  .fav-btn { padding: 5px 8px; }
}
