/* ── The League Room — design tokens and shared components ─────────────
   Direction: a stadium scoreboard. Big condensed numerals (Big Shoulders Display,
   the Chicago-signage face) carry anything that is a score or a heading; Hanken
   Grotesk does the reading. Navy ink, concrete-grey pages, one flag-yellow accent.
   The live scoreboard on the landing page is the one bold moment; stat pages stay quiet. */
@font-face { font-family: 'Big Shoulders Display'; font-weight: 500; font-display: swap; src: url(../fonts/big-shoulders-display-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Big Shoulders Display'; font-weight: 700; font-display: swap; src: url(../fonts/big-shoulders-display-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Big Shoulders Display'; font-weight: 800; font-display: swap; src: url(../fonts/big-shoulders-display-latin-800-normal.woff2) format('woff2'); }
@font-face { font-family: 'Big Shoulders Display'; font-weight: 900; font-display: swap; src: url(../fonts/big-shoulders-display-latin-900-normal.woff2) format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 400; font-display: swap; src: url(../fonts/hanken-grotesk-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 500; font-display: swap; src: url(../fonts/hanken-grotesk-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 600; font-display: swap; src: url(../fonts/hanken-grotesk-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Hanken Grotesk'; font-weight: 700; font-display: swap; src: url(../fonts/hanken-grotesk-latin-700-normal.woff2) format('woff2'); }

:root {
  --bg: #E8ECEF;
  --surface-1: #FFFFFF;
  --surface-2: #F1F4F6;
  --border: rgba(15, 27, 45, 0.12);
  --border-strong: rgba(15, 27, 45, 0.28);
  --text: #0F1B2D;
  --text-mid: #3C4A5E;
  --text-muted: #566377;
  --accent: #FFCB05;
  --accent-hover: #FFD733;
  --on-accent: #0F1B2D;
  --link: #0B4F9E;
  --win: #17703F;
  --loss: #B3261E;
  --danger: #B3261E;
  --ink: #0F1B2D;               /* scoreboard / header band */
  --ink-2: #1A2B44;
  --on-ink: #EAF0F7;
  --on-ink-muted: #9FB0C6;
  --me: rgba(255, 203, 5, 0.22);
  --font-display: 'Big Shoulders Display', 'Arial Narrow', Impact, sans-serif;
  --font-body: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 6px;
  --focus: 0 0 0 3px rgba(11, 79, 158, 0.45);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B1320; --surface-1: #131E2F; --surface-2: #192740;
    --border: rgba(234, 240, 247, 0.14); --border-strong: rgba(234, 240, 247, 0.32);
    --text: #EAF0F7; --text-mid: #C2CEDD; --text-muted: #94A5BB;
    --link: #7DB4FF; --win: #5CD08F; --loss: #FF8A80; --danger: #FF8A80;
    --ink: #060C16; --ink-2: #111C2E; --me: rgba(255, 203, 5, 0.18);
    --focus: 0 0 0 3px rgba(125, 180, 255, 0.6);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.55 var(--font-body); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 3px; }
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 800; line-height: 1.05; margin: 0; letter-spacing: 0.005em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2rem); margin: 2.2rem 0 0.7rem; }
h3 { font-size: 1.25rem; font-weight: 700; margin: 1.4rem 0 0.4rem; }
p { margin: 0 0 1rem; max-width: 68ch; }
.muted { color: var(--text-muted); }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 18px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── header ───────────────────────────────────────────────────────── */
.top { background: var(--ink); color: var(--on-ink); border-bottom: 4px solid var(--accent); }
.top .wrap { display: flex; align-items: center; gap: 18px; min-height: 58px; }
.brand { font: 900 1.55rem/1.3 var(--font-display); color: var(--on-ink); padding-bottom: 2px; text-decoration: none; letter-spacing: 0.02em; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.brand:hover { text-decoration: none; color: var(--accent); }
.top nav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex: none; }
.top nav a, .top nav button { white-space: nowrap; color: var(--on-ink); font: 600 0.95rem var(--font-body); text-decoration: none; padding: 7px 10px; border-radius: var(--radius); background: none; border: 0; cursor: pointer; }
.top nav a:hover, .top nav button:hover { background: var(--ink-2); }
.top nav .cta { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.top nav .cta:hover { background: var(--accent-hover); }
.top form { margin: 0; }
.subnav { background: var(--surface-1); border-bottom: 1px solid var(--border); }
.subnav .wrap { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.subnav .wrap::-webkit-scrollbar { display: none; }
.subnav a { padding: 12px 12px 10px; color: var(--text-mid); text-decoration: none; font-weight: 600; font-size: 0.95rem; white-space: nowrap; border-bottom: 3px solid transparent; }
.subnav a:hover { color: var(--text); }
.subnav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
/* the league name sits on its own line above the quick links and is the link to the league's home page */
.subnav .league-bar { overflow: visible; padding-bottom: 0; }
.subnav .league-name { font: 800 1.15rem/1.4 var(--font-display); color: var(--text); padding: 10px 4px 2px 0; white-space: nowrap; border-bottom: 3px solid transparent; }
.subnav .league-name[aria-current="page"] { border-bottom-color: var(--accent); }
.subnav .league-name:hover { color: var(--text); text-decoration: underline; }

/* ── page chrome ──────────────────────────────────────────────────── */
.page { padding-top: 28px; padding-bottom: 56px; }   /* keep .wrap's side gutters */
.page-title { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 18px; position: relative; }
.page-title h1 { font-size: clamp(1.5rem, 4.6vw, 2rem); }
/* the "Past seasons" button at the far right of a page title: a <details>, so it needs no script */
.past-seasons { margin-left: auto; position: relative; }
.past-seasons > summary { list-style: none; cursor: pointer; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--surface-1); color: var(--text); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.past-seasons > summary::-webkit-details-marker { display: none; }
.past-seasons > summary::after { content: " ▾"; }
.past-seasons[open] > summary { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.past-seasons ul { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; margin: 0; padding: 6px; list-style: none; min-width: 9rem;
  background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.past-seasons li a { display: block; padding: 8px 12px; border-radius: 6px; color: var(--text); text-decoration: none; font-weight: 600; }
.past-seasons li a:hover { background: var(--surface-2); }
.past-seasons li a[aria-current="page"] { background: var(--ink); color: var(--on-ink); }
.page-title .sub { color: var(--text-muted); font-size: 0.98rem; }
.flash { background: var(--surface-1); border: 1px solid var(--border-strong); border-left: 6px solid var(--accent); padding: 10px 14px; margin: 16px 0 0; border-radius: var(--radius); }
.foot { padding: 22px 0 30px; color: var(--text-muted); font-size: 0.88rem; border-top: 1px solid var(--border); }
.foot .wrap { display: flex; gap: 14px 22px; flex-wrap: wrap; }
.foot a { color: var(--text-muted); }

/* ── panels, grids ────────────────────────────────────────────────── */
.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.panel > h2:first-child, .panel > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.stack > * + * { margin-top: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; }
.row.end { justify-content: flex-end; }

/* big numeral + caption (used sparingly, only where the number IS the content) */
.stat { display: flex; flex-direction: column; }
.stat .n { font: 900 2.6rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat .l { color: var(--text-muted); font-size: 0.9rem; }

/* ── tables ───────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--border); }
th:first-child, td:first-child { text-align: left; }
th.l, td.l { text-align: left; }
th { font: 600 0.82rem var(--font-body); color: var(--text-muted); background: var(--surface-2); position: sticky; top: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
tr.me td { background: var(--me); }
td.team { font-weight: 600; white-space: normal; min-width: 11rem; text-align: left; }
td.team small { display: block; color: var(--text-muted); font-weight: 400; }
td.rank, th.rank { width: 2.4rem; color: var(--text-muted); text-align: left; padding-right: 0; }
td.big { font: 800 1.25rem var(--font-display); }
.pos { color: var(--win); } .neg { color: var(--loss); }
.cut td { border-bottom: 2px dashed var(--border-strong); }   /* playoff line */
caption { text-align: left; padding: 10px 12px; font-weight: 600; color: var(--text-mid); caption-side: top; }

/* ── controls ─────────────────────────────────────────────────────── */
.btn { display: inline-block; font: 700 0.98rem var(--font-body); padding: 10px 16px; border-radius: var(--radius); border: 2px solid var(--ink); background: var(--accent); color: var(--on-accent); cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--accent-hover); }
.btn.quiet { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn.quiet:hover { background: var(--surface-2); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 0.88rem; }
label { display: block; font-weight: 600; margin: 0 0 4px; }
/* :where() keeps this at zero specificity so component styles (like the scores search box) can override it */
:where(input[type=text], input[type=password], input[type=email], input[type=search], input[type=number], select, textarea) {
  width: 100%; font: inherit; padding: 10px 12px; color: var(--text); background: var(--surface-1); border: 1px solid var(--border-strong); border-radius: var(--radius); }
input:focus, select:focus, textarea:focus { outline: none; box-shadow: var(--focus); border-color: var(--link); }
.field { margin-bottom: 14px; }
.hint { color: var(--text-muted); font-size: 0.9rem; margin-top: 4px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
form.inline { display: inline; margin: 0; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 18px; }
.tabs a, .tabs .on { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.92rem; background: var(--surface-1); }
.tabs a:hover { background: var(--surface-2); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.pill { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.8rem; font-weight: 700; background: var(--surface-2); border: 1px solid var(--border); }
.pill.win { color: var(--win); } .pill.loss { color: var(--loss); } .pill.gold { background: var(--accent); color: var(--on-accent); border-color: transparent; }

/* ── bars (win odds etc.) ─────────────────────────────────────────── */
.bar { height: 10px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 2px; min-width: 90px; position: relative; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--ink); }
.bar.gold > i { background: var(--accent); }
@media (prefers-color-scheme: dark) { .bar > i { background: #7DB4FF; } .bar.gold > i { background: var(--accent); } }
.odds { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.odds .bar { width: 90px; }

/* ── landing: the scoreboard ──────────────────────────────────────── */
.hero { background: var(--ink); color: var(--on-ink); padding: 26px 0 8px; }
.hero h1 { color: var(--on-ink); font-weight: 900; }
.hero p { color: var(--on-ink-muted); }
.hero .row { margin-bottom: 8px; }
.livescores { max-width: 1120px; margin: 0 auto; padding: 8px 18px 56px; }
.board-band { background: var(--ink); padding-bottom: 28px; }
.board-band .livescores { padding-bottom: 0; }

/* ── error + auth ─────────────────────────────────────────────────── */
.narrow { max-width: 440px; }
.code-input { font: 800 2rem var(--font-display); letter-spacing: 0.35em; text-align: center; }
.big-code { font: 900 5rem/1 var(--font-display); color: var(--accent); }

@media (max-width: 640px) {
  .top .wrap { gap: 8px; }
  .hide-sm { display: none; }
  .top nav { gap: 0; min-width: 0; }
  .top nav a, .top nav button { padding: 7px 8px; font-size: 0.9rem; }
  .acct { max-width: 6.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .brand { font-size: 1.3rem; }
  th, td { padding: 8px 9px; }
  .stat .n { font-size: 2.1rem; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ── scoreboard band: the live-scores area is always dark ─────────── */
.board-band {
  --bg: #0A1424; --surface-1: #14233A; --surface-2: #1C3050;
  --border: rgba(234, 240, 247, 0.16); --border-strong: rgba(234, 240, 247, 0.34);
  --text: #EAF0F7; --text-mid: #C2CEDD; --text-muted: #9FB0C6; --link: #8FC0FF;
  --win: #5CD08F; --loss: #FF8A80; --danger: #FF8A80;
  background: var(--ink); color: var(--text);
}
/* heat tables (seed odds, head-to-head grid) */
table.heat td { text-align: center; padding: 6px 8px; min-width: 2.6rem; }
table.heat td:first-child { text-align: left; }
table.heat th { text-align: center; }
table.heat th:first-child { text-align: left; }
table.heat td a { padding: 6px 8px; margin: -6px -8px; }

/* ── admin-editable bits: intro text, notices, site banner ───────────────────────────────────── */
.tagline { font: 600 1.15rem var(--font-body); color: var(--text-mid); margin: -8px 0 14px; }
.intro { margin: -6px 0 18px; max-width: 68ch; color: var(--text-mid); }
.intro p:last-child { margin-bottom: 0; }
.notice { margin: 14px 0 0; padding: 10px 14px; border: 1px solid var(--border-strong); border-left: 6px solid var(--accent); border-radius: var(--radius); background: var(--surface-1); font-weight: 600; }
.notice.warn { border-left-color: var(--danger); }
.site-banner { background: var(--ink-2); color: var(--on-ink); font-weight: 600; padding: 8px 0; border-bottom: 1px solid var(--border-strong); }
.site-banner .wrap { text-align: center; }
.site-banner.warn { background: var(--danger); color: #fff; }

/* ── admin screens ───────────────────────────────────────────────────────────────────────────── */
.admin-tabs { margin: 0 0 18px; }
.stack-form > * + * { margin-top: 0; }
.stack-form .panel, form.panel { margin-bottom: 18px; }
form.stack-form { display: block; }
form.stack-form > .panel { margin-bottom: 18px; }
.pages-table td, .pages-table th { vertical-align: top; }
.pages-table textarea { min-width: 220px; }
.pages-table input[type=text] { min-width: 130px; width: 100%; }
.weights { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 10px 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px 18px; }
.swatch { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.swatch .chip { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--ink); display: inline-block; }
fieldset.field { border: 0; padding: 0; margin: 0 0 14px; }
fieldset.field legend { font-weight: 700; padding: 0; margin-bottom: 6px; }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
table.kv th { width: 220px; white-space: nowrap; }
code.detail { font-size: 0.82rem; word-break: break-word; white-space: pre-wrap; }
body > .wrap { width: 100%; }          /* notice bars sit directly in the flex column; let them span the page */

/* Admin tables read as stacked cards on a phone instead of scrolling sideways. */
@media (max-width: 720px) {
  .stack-table thead { display: none; }
  .stack-table, .stack-table tbody, .stack-table tr, .stack-table td { display: block; width: 100%; }
  .stack-table tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .stack-table td { padding: 4px 0; border: 0; text-align: left; }
  .stack-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.82rem; font-weight: 700; color: var(--text-muted); }
  .stack-table td.first { font-size: 1.05rem; }
  .pages-table input[type=text], .pages-table textarea { min-width: 0; }
}

/* talking points: whose award is it */
.award-team { margin: 2px 0 1px; font-weight: 600; }
.award-team small { color: var(--text-muted); font-weight: 400; margin-left: 4px; }

/* player pictures (ESPN's image server); a picture that doesn't load stays a quiet grey circle */
.mug { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; object-position: top; background: var(--surface-2, #e3e8ef);
       vertical-align: middle; margin-right: 8px; }

/* the picture a manager set for their team: sits left of the name and owner, which wrap beside it */
.tlogo { float: left; width: 36px; height: 36px; margin: 0 10px 0 0; border-radius: 6px; object-fit: contain;
         background: var(--surface-2, #e3e8ef); }
.tlogo-none { display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
              color: var(--muted, #5b6b7f); }

/* two tables one after the other (History: jumps and falls, steals and busts) */
.table-wrap + .table-wrap { margin-top: 14px; }
/* a cell holding a list of names may wrap instead of running off the table */
.table-wrap td.wrap { white-space: normal; min-width: 14rem; }
/* History stat groups: a collapsible section whose heading is the summary */
details.stat-group { margin-top: 28px; }
details.stat-group > summary { cursor: pointer; list-style: none; }
details.stat-group > summary::-webkit-details-marker { display: none; }
details.stat-group > summary h2 { display: inline; margin: 0; }
details.stat-group > summary::after { content: " ▾"; color: var(--muted, #667); font-size: 1rem; }
details.stat-group:not([open]) > summary::after { content: " ▸"; }
.nowrap { white-space: nowrap; }
/* a date or note under a big number */
.table-wrap td.big small { display: block; font-weight: 400; }

/* league search: the box beside the league name, with a dropdown of matches */
.subnav .league-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0 18px; }
.league-search { position: relative; flex: 1 1 15rem; max-width: 28rem; margin: 6px 0 8px auto; }
.league-search input[type="search"] { width: 100%; box-sizing: border-box; padding: 9px 14px; font: inherit; font-size: 0.95rem; color: var(--text);
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 999px; }
.league-search input[type="search"]:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.search-results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 60; margin: 0; padding: 6px; list-style: none; max-height: 65vh; overflow-y: auto;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18); }
.search-results[hidden] { display: none; }
.subnav .search-results a { display: block; padding: 8px 10px; border: 0; border-radius: 8px; white-space: normal; color: var(--text); font-weight: 600; font-size: 0.95rem; }
.search-results .sr-trail { display: block; font-weight: 400; font-size: 0.8rem; color: var(--text-mid); }
.search-results li[aria-selected="true"] a, .subnav .search-results a:hover { background: var(--me); }
.search-results .sr-empty { padding: 10px; color: var(--text-mid); font-size: 0.9rem; }
.result-list { list-style: none; padding: 0; margin: 0 0 8px; }
.result-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }

/* team and player names that lead to their page: look like the text around them, with a quiet underline to show they are links */
a.tl, a.pll { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--text-mid, #667); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a.tl:hover, a.pll:hover { text-decoration-style: solid; text-decoration-color: var(--accent); }
.profile-list { list-style: none; padding: 0; margin: 0 0 8px; }
