:root {
  --chalk: #F1F3EF;
  --surface: #FAFBF8;
  --ink: #18243A;
  --ink-2: #536079;
  --ink-3: #7D879A;
  --line: #D5DBE0;
  --line-2: #E5E9EC;
  --paint: #2B5592;
  --paint-ink: #FFFFFF;
  --ball: #D3631C;
  --rail: #DCE1E6;
  --focus: #2B5592;
  --shadow: 0 1px 0 rgba(24, 36, 58, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chalk: #0F1828;
    --surface: #142035;
    --ink: #E8ECF2;
    --ink-2: #A3AEC1;
    --ink-3: #7A869B;
    --line: #2A3750;
    --line-2: #1F2B42;
    --paint: #7EA6E6;
    --paint-ink: #0F1828;
    --ball: #F08A47;
    --rail: #2A3750;
    --focus: #9DBCF0;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --chalk: #0F1828; --surface: #142035; --ink: #E8ECF2; --ink-2: #A3AEC1; --ink-3: #7A869B;
  --line: #2A3750; --line-2: #1F2B42; --paint: #7EA6E6; --paint-ink: #0F1828; --ball: #F08A47;
  --rail: #2A3750; --focus: #9DBCF0; --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--chalk);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  font-variation-settings: "wdth" 100;
  font-size: 16px;
  line-height: 1.5;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 16px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 720px) { .wrap { padding: 0 32px; } }

/* ---- masthead ---- */
.masthead { border-bottom: 1px solid var(--line); background: var(--chalk); }
.masthead-inner { display: flex; align-items: baseline; gap: 12px 28px; flex-wrap: wrap; padding-top: 28px; padding-bottom: 14px; }
.wordmark {
  font-size: clamp(44px, 9vw, 76px);
  line-height: .9;
  font-weight: 850;
  font-variation-settings: "wdth" 125;
  letter-spacing: -.03em;
  text-decoration: none;
  color: var(--ink);
}
.tagline { margin: 0; color: var(--ink-2); max-width: 34ch; font-size: 15px; line-height: 1.4; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  text-decoration: none;
  padding: 10px 14px 12px;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink-2);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  margin-bottom: -1px;
}
.tabs a:first-child { padding-left: 0; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--paint); }

main.wrap { padding-top: 36px; padding-bottom: 64px; }
.loading { color: var(--ink-2); }
.view[hidden] { display: none; }

/* ---- games: day header ---- */
.day-head { display: flex; align-items: center; gap: 12px; }
.day-title-wrap { flex: 1; min-width: 0; }
.day-title {
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.02;
  font-weight: 780;
  font-variation-settings: "wdth" 75;
  letter-spacing: -.01em;
}
.day-kicker { margin: 4px 0 0; color: var(--ink-2); font-size: 15px; }
.day-step {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  display: grid; place-items: center;
}
.day-step svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.day-step:hover:not(:disabled) { border-color: var(--ink-3); }
.day-step:disabled { opacity: .35; cursor: default; }
.day-head .day-step:first-child { order: 0; }
.day-summary { margin: 18px 0 8px; max-width: 70ch; font-size: 17px; color: var(--ink); }

/* ---- games: the tug of war ---- */
.games { list-style: none; margin: 16px 0 0; padding: 0; border-top: 1px solid var(--line); }
.game {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.4fr) 1fr;
  grid-template-areas:
    "away rail home"
    "meta meta meta";
  align-items: center;
  column-gap: 20px;
  padding: 18px 0 16px;
  border-bottom: 1px solid var(--line);
}
.side { display: flex; align-items: center; gap: 14px; min-width: 0; }
.side.away { grid-area: away; }
.side.home { grid-area: home; flex-direction: row-reverse; text-align: right; }
.pct {
  font-size: clamp(40px, 6.2vw, 64px);
  line-height: .85;
  font-variation-settings: "wdth" 62;
  font-weight: 300;
  color: var(--ink-3);
  letter-spacing: -.02em;
  min-width: 2.2ch;
}
.pct small { font-size: .42em; font-weight: 500; margin-left: 1px; vertical-align: .9em; letter-spacing: 0; }
.fav .pct { font-weight: 800; color: var(--ink); }
.team { min-width: 0; }
.team-name { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 17px; line-height: 1.2; }
.side.home .team-name { justify-content: flex-end; }
.team-sub { color: var(--ink-2); font-size: 13.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip { width: 10px; height: 10px; border-radius: 2px; flex: none; box-shadow: 0 0 0 1px rgba(127, 135, 154, .35) inset; }
.won .team-name::after { content: ""; }
.score { font-weight: 800; font-variation-settings: "wdth" 75; font-size: 22px; line-height: 1; margin-top: 4px; }
.lost .score { font-weight: 400; color: var(--ink-2); }

.rail { grid-area: rail; position: relative; height: 34px; }
.rail-track { position: absolute; left: 0; right: 0; top: 15px; height: 4px; border-radius: 2px; background: var(--rail); }
.rail-fill { position: absolute; top: 14px; height: 6px; border-radius: 3px; background: var(--ink); }
.rail-fill.left { left: 0; }
.rail-fill.right { right: 0; }
.rail-split { position: absolute; top: 5px; width: 2px; height: 24px; margin-left: -1px; background: var(--ink); border-radius: 1px; }
.rail-mid { position: absolute; left: 50%; top: 10px; width: 1px; height: 14px; background: var(--ink-3); opacity: .5; }

.meta { grid-area: meta; display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 18px; margin-top: 8px; font-size: 14px; color: var(--ink-2); text-align: center; }
.meta strong { color: var(--ink); font-weight: 650; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; color: var(--ink); }
.tag::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--paint); }
.tag.even::before, .tag.upset::before { background: var(--ball); }
.empty { padding: 32px 0; color: var(--ink-2); border-bottom: 1px solid var(--line); }

@media (max-width: 640px) {
  .game {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "away home"
      "rail rail"
      "meta meta";
    column-gap: 12px;
  }
  .side { flex-direction: column-reverse; align-items: flex-start; gap: 6px; }
  .side.home { flex-direction: column-reverse; align-items: flex-end; }
  .rail { margin-top: 6px; }
  .team-sub { white-space: normal; }
}

/* ---- view heads ---- */
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.view-title {
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  line-height: 1.02;
  font-weight: 780;
  font-variation-settings: "wdth" 75;
}
.view-lede { margin: 6px 0 0; color: var(--ink-2); max-width: 62ch; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 7px 18px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--chalk); }

/* ---- tables ---- */
.table-scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
@media (min-width: 720px) { .table-scroll { margin: 0; padding: 0; } }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 0 8px; height: 44px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line-2); }
thead th {
  height: auto; padding-top: 6px; padding-bottom: 10px; vertical-align: bottom;
  font-size: 13px; font-weight: 600; color: var(--ink-2); line-height: 1.2; white-space: normal;
  border-bottom: 1px solid var(--line);
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--ink); }
th[aria-sort="descending"]::after { content: " ▾"; }
th[aria-sort="ascending"]::after { content: " ▴"; }
th.l, td.l { text-align: left; }
td.team-cell { position: sticky; left: 0; background: var(--chalk); z-index: 1; padding-left: 0; }
.team-cell .team-name { font-size: 15px; font-weight: 600; }
.team-cell .city { color: var(--ink-3); font-weight: 400; }
tbody tr:hover td { background: var(--surface); }
tr.cut td { border-bottom: 1px solid var(--ink-3); }
.num-lg { font-weight: 650; }
.muted { color: var(--ink-3); }

/* probability heat cells: one hue, light to dark */
td.p { padding: 3px 3px; width: 66px; }
td.p span {
  display: block; height: 36px; line-height: 36px; border-radius: 4px; text-align: center;
  font-size: 14.5px; font-weight: 550;
  background: color-mix(in oklab, var(--paint) calc(var(--v) * 100%), transparent);
}
td.p.dark span { color: var(--paint-ink); }
td.p.zero span { color: var(--ink-3); font-weight: 400; }
th.pc { text-align: center; width: 66px; }

/* seed fingerprint */
.seeds { display: inline-flex; gap: 2px; vertical-align: middle; }
.seeds i {
  display: block; width: 11px; height: 24px; border-radius: 2px;
  background: color-mix(in oklab, var(--paint) calc(var(--v) * 100%), var(--line-2));
}
.seeds i:nth-child(6), .seeds i:nth-child(10) { margin-right: 5px; }
.seed-head { display: inline-flex; gap: 2px; font-size: 11px; color: var(--ink-3); font-weight: 500; }
.seed-head b { width: 11px; text-align: center; font-weight: 500; }
.seed-head b:nth-child(6), .seed-head b:nth-child(10) { margin-right: 5px; }
td.seed-cell, th.seed-cell { text-align: left; padding-left: 14px; padding-right: 14px; }

/* projected wins: range on a 0-82 scale */
.wins { display: inline-flex; align-items: center; gap: 10px; }
.range { position: relative; width: 90px; height: 14px; }
.range::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; height: 2px; background: var(--line-2); border-radius: 1px; }
.range .band { position: absolute; top: 4px; height: 6px; border-radius: 3px; background: color-mix(in oklab, var(--paint) 35%, transparent); }
.range .dot { position: absolute; top: 2px; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--paint); box-shadow: 0 0 0 2px var(--chalk); }
.range .half { position: absolute; left: 50%; top: 2px; width: 1px; height: 10px; background: var(--ink-3); opacity: .45; }

/* power ranking */
.rank { font-weight: 800; font-variation-settings: "wdth" 75; font-size: 22px; width: 40px; text-align: right; padding-left: 0; }
.move { font-size: 13px; width: 44px; text-align: left; }
.move.up { color: var(--ink); }
.move.down { color: var(--ball); }
.move.same { color: var(--ink-3); }
.netbar { position: relative; width: 150px; height: 20px; display: inline-block; vertical-align: middle; }
.netbar .axis { position: absolute; left: 50%; top: 2px; bottom: 2px; width: 1px; background: var(--ink-3); opacity: .6; }
.netbar .bar { position: absolute; top: 6px; height: 8px; border-radius: 0 4px 4px 0; background: var(--paint); }
.netbar .bar.neg { background: var(--ball); border-radius: 4px 0 0 4px; }
.netbar .whisk { position: absolute; top: 9.5px; height: 1px; background: var(--ink-2); }
.netbar .whisk::before, .netbar .whisk::after { content: ""; position: absolute; top: -3px; width: 1px; height: 7px; background: var(--ink-2); }
.netbar .whisk::before { left: 0; }
.netbar .whisk::after { right: 0; }
.net-val { display: inline-block; width: 46px; font-weight: 650; }
.spark { display: block; width: 130px; height: 30px; overflow: visible; cursor: crosshair; }
.spark path { fill: none; stroke: var(--paint); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.spark line { stroke: var(--line); stroke-width: 1; }
.spark circle { fill: var(--paint); stroke: var(--chalk); stroke-width: 2; }
.spark .hover-dot { fill: var(--ink); opacity: 0; }
.spark:hover .hover-dot { opacity: 1; }
td.spark-cell { padding-right: 0; }

/* ---- about ---- */
.about { margin-top: 64px; padding-top: 28px; border-top: 1px solid var(--line); }
.about h2 { margin: 0 0 12px; font-size: 22px; font-weight: 750; font-variation-settings: "wdth" 85; }
.about-cols { display: grid; gap: 4px 40px; }
@media (min-width: 900px) { .about-cols { grid-template-columns: repeat(3, 1fr); } }
.about p { margin: 0 0 12px; color: var(--ink-2); font-size: 15px; max-width: 60ch; }
.about a { color: var(--ink); text-decoration-color: var(--paint); text-underline-offset: 3px; }
.stamp { font-size: 13px !important; color: var(--ink-3) !important; margin-top: 12px !important; }
.note { font-size: 13.5px; color: var(--ink-2); max-width: 80ch; margin: 14px 0 0; }

/* ---- tooltip ---- */
.tip {
  position: fixed; z-index: 20; pointer-events: none;
  background: var(--ink); color: var(--chalk);
  padding: 7px 10px; border-radius: 6px; font-size: 13px; line-height: 1.35;
  max-width: 240px; font-variant-numeric: tabular-nums;
}
.tip b { font-weight: 700; }

/* the one orchestrated moment: rails draw in on load */
@media (prefers-reduced-motion: no-preference) {
  .games.animate .rail-fill { animation: grow .7s cubic-bezier(.2, .7, .2, 1) both; }
  .games.animate .rail-split { animation: fade .7s ease-out both; }
  .games.animate .game:nth-child(2) .rail-fill { animation-delay: .04s; }
  .games.animate .game:nth-child(3) .rail-fill { animation-delay: .08s; }
  .games.animate .game:nth-child(4) .rail-fill { animation-delay: .12s; }
  .games.animate .game:nth-child(5) .rail-fill { animation-delay: .16s; }
  .games.animate .game:nth-child(n+6) .rail-fill { animation-delay: .2s; }
}
@keyframes grow { from { transform: scaleX(0); } }
.rail-fill.left { transform-origin: left; }
.rail-fill.right { transform-origin: right; }
@keyframes fade { from { opacity: 0; } }

@media (forced-colors: active) {
  .rail-fill, .rail-split, .netbar .bar, .seeds i, td.p span, .range .dot { forced-color-adjust: none; }
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
thead th.sortable[data-sort="rank"], thead th.sortable[data-sort="move"], thead th.sortable[data-sort="record"] { white-space: nowrap; }
