/* Football AI — styles. Phone-first, light + dark (prefers-color-scheme), no build step.
   Team colors arrive as inline custom properties (--c primary, --f text-on-primary, --c2 alt). */

:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef1f4;
  --text: #10151c;
  --text-2: #3d4653;
  --muted: #5c6574;
  --border: #dde2e8;
  --accent: #0b6b3a;
  --accent-ink: #ffffff;
  --link: #0a58a8;
  --good: #0a7d32;
  --bad: #b8302a;
  --warn-bg: #fff3dc;
  --warn-ink: #6e4400;
  --info-bg: #e9f2ff;
  --time-bg: #f1eaff;
  --focus: #2a78d6;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --ref: #898781;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 21, 28, .06), 0 2px 8px rgba(16, 21, 28, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d1015;
    --surface: #161a21;
    --surface-2: #1d222b;
    --text: #eef1f5;
    --text-2: #c6cdd7;
    --muted: #9aa3b1;
    --border: #2c323c;
    --accent: #2fbf71;
    --accent-ink: #06200f;
    --link: #7db9ff;
    --good: #3ccf7a;
    --bad: #ff7d73;
    --warn-bg: #3a2a0d;
    --warn-ink: #ffd590;
    --info-bg: #142640;
    --time-bg: #261b3c;
    --grid: #2c2c2a;
    --axis: #383835;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d1015;
  --surface: #161a21;
  --surface-2: #1d222b;
  --text: #eef1f5;
  --text-2: #c6cdd7;
  --muted: #9aa3b1;
  --border: #2c323c;
  --accent: #2fbf71;
  --accent-ink: #06200f;
  --link: #7db9ff;
  --good: #3ccf7a;
  --bad: #ff7d73;
  --warn-bg: #3a2a0d;
  --warn-ink: #ffd590;
  --info-bg: #142640;
  --time-bg: #261b3c;
  --grid: #2c2c2a;
  --axis: #383835;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

/* ---------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
}
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.15rem; margin-top: 1.4em; }
h3 { font-size: 1rem; }
p { margin: 0 0 .6em; }
code { font-size: .9em; background: var(--surface-2); padding: 0 .3em; border-radius: 4px; }
button, select, input { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
main:focus, h1:focus { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos, .good-text { color: var(--good); }
.neg { color: var(--bad); }
.label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; }
.big { font-size: 1.6rem; font-weight: 700; }
.only-phone, .only-phone-inline { display: none; }

/* ---------------------------------------------------------------- top bar */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1180px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; font-size: 1.05rem; color: var(--text); text-decoration: none; }
.brand-icon { font-size: 1.3rem; }
.topnav { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
.topnav a { padding: 6px 10px; border-radius: 8px; color: var(--text-2); text-decoration: none; font-weight: 500; }
.topnav a:hover { background: var(--surface-2); }
.topnav a[aria-current="page"] { color: var(--accent); background: var(--surface-2); font-weight: 700; }
.chip { font-size: .78rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.chip.updating { color: var(--link); }
.chip.warn { color: var(--warn-ink); background: var(--warn-bg); padding: 2px 8px; border-radius: 999px; white-space: normal; }

/* segmented controls (links with aria-current) */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--surface-2); gap: 2px; flex-wrap: wrap; }
.seg a { padding: 4px 12px; border-radius: 999px; text-decoration: none; color: var(--text-2); font-weight: 600; font-size: .88rem; white-space: nowrap; }
.seg a[aria-current="true"] { background: var(--accent); color: var(--accent-ink); }
.seg a:hover:not([aria-current="true"]) { background: var(--surface); }
.seg.small a { padding: 3px 10px; font-size: .82rem; }

/* ---------------------------------------------------------------- controls */
.controls { background: var(--surface-2); border-bottom: 1px solid var(--border); }
.controls-inner { max-width: 1180px; margin: 0 auto; padding: 8px 16px; }
.ctl-toggle { display: none; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; font-size: .88rem; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctl-body { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.ctl { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; }
.ctl > span { color: var(--muted); }
.ctl select { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; max-width: 15rem; }
.info-link { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; text-decoration: none; font-size: 1.05rem; }
.info-link:hover { background: var(--surface); }

/* ---------------------------------------------------------------- layout */
main { max-width: 1180px; margin: 0 auto; padding: 16px 16px 32px; min-height: 60vh; }
.page-head { margin-bottom: 12px; }
.head-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; }
.head-row h1 { margin: 0; }
.lede { color: var(--text-2); margin: .4em 0 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); margin: 12px 0; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.two-col { display: grid; gap: 16px; }
@media (min-width: 900px) { .two-col { grid-template-columns: 1fr 1fr; } }
.cta-row { margin-top: 16px; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 10px; padding: 9px 16px; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.crumbs { font-size: .85rem; margin-bottom: 8px; color: var(--muted); }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); vertical-align: middle; }
.tag.good { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.tag.warn { background: var(--warn-bg); color: var(--warn-ink); border-color: transparent; }
.notice { border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; background: var(--info-bg); }
.notice.warn { background: var(--warn-bg); color: var(--warn-ink); }
.notice.time { background: var(--time-bg); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 40px 0; justify-content: center; }
.spinner { width: 18px; height: 18px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; flex: none; }
.spinner.sm { width: 12px; height: 12px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-card { max-width: 520px; margin: 40px auto; }

/* ---------------------------------------------------------------- tables */
/* position:relative makes the wrapper the containing block of absolutely positioned .sr-only text
   inside tables, so it is clipped too (otherwise it widens the page on phones) */
.table-wrap { position: relative; width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.matrix-wrap, .model-cards, .math-block, .week-strip { position: relative; }
table.data { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
table.data thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: var(--surface-2); font-weight: 700; }
table.data tbody tr:last-child > * { border-bottom: 0; }
table.data th.num, table.data td.num { text-align: right; }
table.data tr.sel > * { background: color-mix(in srgb, var(--accent) 8%, transparent); }
table.data tr.hl > * { background: color-mix(in srgb, var(--s4) 12%, transparent); }
table.data tr.ref-row > * { color: var(--muted); background: var(--surface-2); }
table.compact th, table.compact td { padding: 6px 8px; }
table.data caption:not(.sr-only) { text-align: left; font-weight: 700; padding: 8px 10px; }
.sub { display: block; font-size: .74rem; color: var(--muted); font-weight: 400; }
.unc { color: var(--muted); font-size: .8em; }

/* rankings */
.rankings tr.rk-row > td:first-child { box-shadow: inset 5px 0 0 var(--c); }
.rankings .rank { font-weight: 800; width: 3em; }
.rankings .crank { color: var(--muted); }
.rankings .tcol { min-width: 9rem; }
.rankings .phone-sub { display: none; }
.delta { font-size: .78rem; font-weight: 700; white-space: nowrap; }
.delta.up { color: var(--good); }
.delta.down { color: var(--bad); }
.delta.same, .delta.none { color: var(--muted); }
.rk-detail td { background: var(--surface-2); }
dl.mini { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px 14px; margin: 0 0 6px; }
dl.mini dt { font-size: .72rem; color: var(--muted); text-transform: uppercase; }
dl.mini dd { margin: 0; font-weight: 600; }
.expand { background: none; border: 1px solid var(--border); border-radius: 8px; width: 32px; height: 32px; cursor: pointer; }
.expand[aria-expanded="true"] span { display: inline-block; transform: rotate(180deg); }

/* team badges (no logos — spec §13.2) */
.badge { display: inline-grid; place-items: center; flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--c); color: var(--f); font-size: .66rem; font-weight: 800; letter-spacing: .02em; line-height: 1; box-shadow: inset 0 0 0 1px rgba(127, 127, 127, .25); }
.badge.long { font-size: .54rem; letter-spacing: 0; }
.badge.sm { width: 1.8rem; height: 1.8rem; font-size: .6rem; }
.badge.sm.long { font-size: .48rem; }
.badge.lg { width: 4rem; height: 4rem; font-size: 1.15rem; box-shadow: 0 0 0 3px var(--f); }
.badge.lg.long { font-size: .92rem; }
.badge.xl { width: 4.2rem; height: 4.2rem; font-size: 1.2rem; box-shadow: 0 0 0 3px currentColor; }
.team { display: inline-flex; align-items: center; gap: .45em; color: inherit; text-decoration: none; min-width: 0; }
a.team:hover .tname { text-decoration: underline; }
.tname { overflow-wrap: break-word; }
.at { color: var(--muted); margin: 0 .25em; }
.game-abbr { display: inline-flex; align-items: center; white-space: nowrap; font-weight: 600; }
.game-abbr .team { gap: .3em; }

/* ---------------------------------------------------------------- best bets */
.bets-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin: 0 0 16px; box-shadow: var(--shadow); }
.bets-panel > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
.bets-panel > summary::-webkit-details-marker { display: none; }
.bets-panel > summary::after { content: "▾"; margin-left: auto; color: var(--muted); transition: transform .2s; }
.bets-panel[open] > summary::after { transform: rotate(180deg); }
.bp-body { padding: 0 16px 12px; }
.bp-count { font-weight: 500; font-size: .85rem; }
.bet-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.bet-card { background: var(--surface); border: 1px solid var(--border); border-left: 6px solid var(--c); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.bet-card header { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.bet-teams { display: flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.bet-pick { margin: 8px 0; font-size: 1.05rem; }
.bet-stats { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 0 0 8px; font-size: .86rem; }
.bet-stats div { display: contents; }
.bet-stats dt { color: var(--muted); }
.bet-stats dd { margin: 0; }
.bet-when { font-size: .78rem; margin: 0 0 6px; }
.caution { font-size: .8rem; background: var(--warn-bg); color: var(--warn-ink); padding: 4px 8px; border-radius: 8px; margin: 0; }
.result { font-weight: 800; font-size: .82rem; padding: 1px 8px; border-radius: 999px; }
.result.rW { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.result.rL { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.result.rP { background: var(--surface-2); color: var(--muted); }
.record-line { font-size: 1rem; }
.disclaimer { font-size: .8rem; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; margin-top: 16px; }
.more { font-weight: 600; }

/* ---------------------------------------------------------------- team page */
.team-band { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 16px; background: var(--c); color: var(--f); border-radius: var(--radius); padding: 18px 20px 24px; box-shadow: inset 0 -10px 0 var(--c2), var(--shadow); overflow: hidden; }
.team-band::after { content: ""; position: absolute; right: -40px; top: 0; bottom: 0; width: 90px; background: var(--c2); transform: skewX(-18deg); opacity: .9; }
.team-band h1 { margin: 0; font-size: 1.6rem; }
.team-band .badge.lg { --c: var(--c); }
.tb-main { flex: 1 1 220px; min-width: 0; position: relative; z-index: 1; }
.tb-main p { margin: 2px 0; }
.tb-sub { opacity: .9; }
.tb-rec { font-size: 1.1rem; }
.tb-rank { display: flex; gap: 12px; flex-wrap: wrap; font-weight: 600; }
.tb-side { position: relative; z-index: 1; margin-right: 56px; }
.tb-side .label { color: inherit; opacity: .85; }
.tb-rating { font-size: 1.05rem; }
.tb-spark .sub { color: inherit; opacity: .85; }
.strip-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.week-strip { list-style: none; display: flex; flex-wrap: wrap; gap: 3px; margin: 0; padding: 0; }
.week-strip li { width: 22px; height: 22px; display: grid; place-items: center; font-size: .7rem; font-weight: 700; border-radius: 5px; }
.team-tools { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin: 12px 0; }
.team-tools .card { margin: 0; }
.proj { display: flex; flex-direction: column; gap: 2px; }
.schedule .wk { font-weight: 700; color: var(--muted); width: 2.5em; }
.schedule tr.bye td { color: var(--muted); font-style: italic; background: var(--surface-2); }
.schedule tr.remaining td { background: color-mix(in srgb, var(--surface-2) 45%, transparent); }
.site { display: inline-block; width: 1.6em; color: var(--muted); font-size: .8rem; }
.res { font-weight: 800; }
.res.rW { color: var(--good); }
.res.rL { color: var(--bad); }
.res.rT { color: var(--muted); }
.ok { color: var(--good); font-weight: 800; }
.bad { color: var(--bad); font-weight: 800; }
.live { color: #fff; background: var(--bad); font-weight: 800; font-size: .75rem; padding: 1px 6px; border-radius: 4px; }

/* combobox */
.combo { position: relative; display: flex; flex-direction: column; gap: 4px; }
.combo label { font-weight: 700; }
.combo input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.combo-list { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; list-style: none; margin: 4px 0 0; padding: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); max-height: 320px; overflow-y: auto; }
.combo-list li { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.combo-list li[aria-selected="true"], .combo-list li:hover { background: var(--surface-2); }
.picker { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); align-items: end; }
.link-list { list-style: none; padding: 0; display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.link-list a { display: flex; align-items: center; gap: 6px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); }

/* ---------------------------------------------------------------- matchup */
.mu-split { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; border-radius: var(--radius); overflow: hidden; background: linear-gradient(90deg, var(--ca) 0 50%, var(--cb) 50% 100%); box-shadow: var(--shadow); }
.mu-side { padding: 20px 16px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.mu-side.a { color: var(--fa); }
.mu-side.b { color: var(--fb); }
.mu-side p { margin: 0; font-size: .88rem; }
.mu-name { margin: 0; font-size: 1.3rem; font-weight: 800; overflow-wrap: break-word; }
.mu-name a { color: inherit; text-decoration: none; }
.mu-name a:hover { text-decoration: underline; }
.mu-side .badge.xl { box-shadow: 0 0 0 3px currentColor; }
.mu-vs { font-weight: 900; font-size: 1rem; background: var(--surface); color: var(--text); border-radius: 50%; width: 42px; height: 42px; display: grid; place-items: center; box-shadow: var(--shadow); }
.site-seg { margin: 12px 0 0; }
.headline { text-align: center; }
.hl-score { font-size: 2.4rem; font-weight: 600; display: flex; justify-content: center; align-items: baseline; gap: 12px; margin: 0; flex-wrap: wrap; }
.hl-score strong { font-size: 3rem; font-weight: 800; }
.hl-score .dash { color: var(--muted); }
.hl-sub { font-size: 1.05rem; color: var(--text-2); }
.wpbar { display: flex; gap: 2px; height: 32px; border-radius: 10px; overflow: hidden; background: var(--surface); margin: 10px 0; }
.wpbar span { display: flex; align-items: center; padding: 0 10px; background: var(--c); color: var(--f); font-weight: 700; font-size: .85rem; white-space: nowrap; overflow: hidden; min-width: 0; }
.wpbar .seg-b { justify-content: flex-end; }
.sim-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.top-scores { margin: 0; padding-left: 1.4em; }
.top-scores li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-bottom: 1px dashed var(--border); }
.top-scores .score { font-weight: 700; font-variant-numeric: tabular-nums; }
.sim-stats p { display: flex; flex-direction: column; }
.model-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.mcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); }
.mcard.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.mcard.disabled { opacity: .55; }
.mcard h3 { display: flex; justify-content: space-between; align-items: center; margin: 0 0 6px; }
.mcard p { margin: 2px 0; }
.mc-score { font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.info { text-decoration: none; }

/* ---------------------------------------------------------------- this week */
.week-nav { display: flex; justify-content: space-between; margin-top: 10px; gap: 8px; }
.week-nav a { font-weight: 600; text-decoration: none; }
.game-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.game-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.gc-row { display: flex; align-items: center; gap: 8px; }
.gc-row a, .gc-row > span:not(.badge):not(.gc-score):not(.site-tag) { color: var(--text); text-decoration: none; font-weight: 600; overflow-wrap: break-word; }
.gc-row a:hover { text-decoration: underline; }
.gc-row.won a, .gc-row.won > span { font-weight: 800; }
.gc-score { margin-left: auto; font-weight: 800; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.site-tag { font-size: .7rem; color: var(--muted); }
.gc-info { border-top: 1px solid var(--border); padding-top: 6px; font-size: .86rem; }
.gc-info p { margin: 2px 0; }
.gc-info .label { display: inline-block; width: 4.4em; }
.final { font-weight: 700; }
details.fold > summary { cursor: pointer; list-style: none; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary h2, details.fold > summary h3 { display: inline; margin: 0; }
details.fold > summary::before { content: "▸ "; color: var(--muted); }
details.fold[open] > summary::before { content: "▾ "; }

/* ---------------------------------------------------------------- models */
.key { display: inline-block; width: 16px; height: 4px; border-radius: 2px; background: var(--k); margin-right: 6px; vertical-align: middle; }
.key.dash { background: repeating-linear-gradient(90deg, var(--k) 0 5px, transparent 5px 8px); }
.key.ref-diag { background: repeating-linear-gradient(90deg, var(--muted) 0 3px, transparent 3px 6px); }
.legend { list-style: none; padding: 0; margin: 0 0 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .82rem; color: var(--text-2); }
dl.metrics { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); margin: 0; }
dl.metrics dt { font-weight: 800; }
dl.metrics dd { margin: 0; color: var(--text-2); font-size: .9rem; }
.model-links { list-style: none; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.model-link { display: flex; flex-direction: column; gap: 4px; text-decoration: none; color: var(--text); margin: 0; height: 100%; }
.model-link:hover { border-color: var(--accent); }
.ml-name { font-weight: 800; }
.prose { max-width: 820px; }
.prose p, .prose li { color: var(--text); }
.prose .note { border-left: 4px solid var(--accent); background: var(--surface-2); padding: 8px 12px; border-radius: 0 8px 8px 0; margin: 10px 0; }
.math-block { overflow-x: auto; overflow-y: hidden; padding: 4px 0; }
.math-steps { margin: 8px 0; }
.md-table { border-collapse: collapse; width: 100%; background: var(--surface); }
.md-table th, .md-table td { border-bottom: 1px solid var(--border); padding: 6px 8px; text-align: left; vertical-align: top; }
.md-table th { background: var(--surface-2); font-size: .8rem; }
.movers { padding-left: 1.4em; }
.movers li { padding: 3px 0; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .axis { stroke: var(--axis); stroke-width: 1; }
.chart .ref-line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .tick { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart path[fill]:hover, .chart circle:hover { opacity: .8; }
.spark { display: block; }

/* ---------------------------------------------------------------- data health */
.health-line { font-size: 1.02rem; padding: 10px 14px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); }
.health-line.good { border-left: 6px solid var(--good); }
.health-line.warn { border-left: 6px solid #eda100; }
.tiles { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); margin: 10px 0; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; display: flex; flex-direction: column; }
.tile strong { font-size: 1.3rem; }
.issues { padding-left: 1.2em; }
.issues li { margin: 4px 0; }
.legend.cells li { align-items: center; display: inline-flex; gap: 6px; }
.cell { text-align: center; font-weight: 700; }
span.cell { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; font-size: .72rem; }
.c-finalok { background: color-mix(in srgb, var(--good) 18%, transparent); color: var(--good); }
.c-final { background: color-mix(in srgb, var(--good) 8%, transparent); color: var(--good); outline: 1px dashed var(--good); outline-offset: -2px; }
.c-scheduled { color: var(--muted); background: var(--surface-2); }
.c-live { background: color-mix(in srgb, var(--s1) 22%, transparent); color: var(--link); }
.c-BYEok { background: var(--surface-2); color: var(--text-2); box-shadow: inset 0 0 0 1px var(--border); }
.c-BYEq { background: var(--warn-bg); color: var(--warn-ink); }
.c-postponed, .c-canceled { background: var(--warn-bg); color: var(--warn-ink); }
.c-OVERDUE, .c-DISPUTED, .c-MISSING { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }
.matrix-wrap { max-height: 70vh; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.matrix { border-collapse: separate; border-spacing: 2px; font-size: .74rem; }
table.matrix th { position: sticky; top: 0; background: var(--surface); z-index: 1; font-weight: 700; color: var(--muted); padding: 4px; }
table.matrix tbody th { position: sticky; left: 0; top: auto; z-index: 2; text-align: left; white-space: nowrap; color: var(--text); font-weight: 600; }
table.matrix td.cell { width: 24px; min-width: 24px; height: 22px; border-radius: 4px; }
.phases .bar-cell { width: 40%; min-width: 80px; }
.hbar { display: block; height: 10px; border-radius: 0 4px 4px 0; background: var(--s1); min-width: 2px; }

/* ---------------------------------------------------------------- setup */
.setup { min-height: 60vh; display: grid; place-items: center; }
.setup-card { max-width: 560px; text-align: center; }
.setup-icon { font-size: 3rem; margin: 0; }
.progress { height: 12px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin: 16px 0 8px; }
.progress span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .6s ease; }
.progress span.indeterminate { width: 35%; animation: indet 1.4s ease-in-out infinite; }
@keyframes indet { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }

/* ---------------------------------------------------------------- footer / toast / tab bar */
.site-footer { border-top: 1px solid var(--border); background: var(--surface); margin-top: 24px; }
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 16px 16px 24px; font-size: .82rem; color: var(--muted); }
.footer-inner p { margin: 0 0 6px; }
.footer-inner .disclaimer { border: 0; padding: 0; margin: 0 0 6px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--text); color: var(--bg); padding: 8px 16px; border-radius: 999px; font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.tabbar { display: none; }

/* ---------------------------------------------------------------- phones */
@media (max-width: 760px) {
  body { font-size: 15px; padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .topnav { display: none; }
  .topbar-inner { gap: 8px 10px; padding: 8px 16px; }
  .brand { flex: 1; }
  .chip { order: 3; width: 100%; white-space: normal; }
  .ctl-toggle { display: block; }
  .ctl-body { display: none; padding-top: 10px; }
  .controls.open .ctl-body { display: flex; }
  .ctl { width: 100%; justify-content: space-between; }
  .ctl select { max-width: 70%; flex: 1; }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; font-size: .72rem; font-weight: 600; color: var(--text-2); text-decoration: none; }
  .tabbar a span { font-size: 1.15rem; }
  .tabbar a[aria-current="page"] { color: var(--accent); }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  h1 { font-size: 1.25rem; }
  .hl-score { font-size: 1.8rem; }
  .hl-score strong { font-size: 2.2rem; }
  .mu-side { padding: 14px 8px; }
  .mu-name { font-size: 1.05rem; }
  .badge.xl { width: 3.2rem; height: 3.2rem; font-size: .95rem; }
  .model-cards { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .model-cards .mcard { flex: 0 0 72%; scroll-snap-align: start; }
  .tb-side { margin-right: 40px; }
}
@media (max-width: 640px) {
  .hide-phone { display: none; }
  .only-phone { display: table-cell; }
  .only-phone-inline { display: inline; }
  table.data th, table.data td { padding: 7px 4px; }
  table.data thead th { letter-spacing: 0; }
  .expand { width: 28px; height: 28px; }
  .rankings .phone-sub { display: block; font-size: .72rem; color: var(--muted); margin-left: calc(1.8rem + .45em); white-space: nowrap; }
  .rankings .tcol { min-width: 0; }
  .rankings .tcol .team { max-width: 100%; }
  .rankings .dcol { padding-left: 2px; padding-right: 2px; }
  .xcol { width: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media (forced-colors: active) {
  .badge { border: 1px solid CanvasText; }
  .seg a[aria-current="true"] { outline: 2px solid Highlight; }
}
