:root {
  color-scheme: light;
  --felt: #1f5c3f;
  --felt-deep: #163f2c;
  --felt-ink: #f4efe1;
  --felt-muted: #b9cdbf;
  --page: #f5f1e6;
  --surface: #fffdf7;
  --ink: #1b1a17;
  --ink-2: #55524a;
  --muted: #8a867b;
  --line: #e4ddca;
  --line-strong: #cfc6ad;
  --red: #b3261e;
  --gold: #b8860b;
  --gold-soft: #f3e3b3;
  --accent: #2a78d6;
  --other: #c9c3b2;
  --good: #0f7a3a;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 6px 20px rgba(40, 30, 10, .06);
  --radius: 14px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --felt: #173f2c; --felt-deep: #0f2a1e; --felt-ink: #efe9d8; --felt-muted: #9fb7a7;
    --page: #12120f; --surface: #1c1b18; --ink: #f0ece0; --ink-2: #c4bfb0; --muted: #8f8a7d;
    --line: #2d2b26; --line-strong: #3d3a33; --red: #e46a62; --gold: #e0b44a; --gold-soft: #3a3020;
    --accent: #4b97ee; --other: #4a473f; --good: #46c072;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --felt: #173f2c; --felt-deep: #0f2a1e; --felt-ink: #efe9d8; --felt-muted: #9fb7a7;
  --page: #12120f; --surface: #1c1b18; --ink: #f0ece0; --ink-2: #c4bfb0; --muted: #8f8a7d;
  --line: #2d2b26; --line-strong: #3d3a33; --red: #e46a62; --gold: #e0b44a; --gold-soft: #3a3020;
  --accent: #4b97ee; --other: #4a473f; --good: #46c072;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 16px; }
body { margin: 0; background: var(--page); color: var(--ink); font: 15px/1.5 var(--sans); }
h1, h2, h3 { margin: 0; }
h2 { font: 800 28px/1.15 var(--serif); letter-spacing: -.01em; }
h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.muted { color: var(--muted); font-weight: 400; font-size: 13px; }
.sub { color: var(--ink-2); margin: 4px 0 0; }

/* ---------- felt header ---------- */
.felt {
  background:
    radial-gradient(ellipse at 30% 0%, rgba(255,255,255,.08), transparent 60%),
    repeating-linear-gradient(45deg, rgba(0,0,0,.03) 0 2px, transparent 2px 4px),
    var(--felt);
  color: var(--felt-ink);
  padding: 0 16px 28px;
  border-bottom: 6px solid var(--felt-deep);
}
.top { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; flex-wrap: wrap; }
.brand { color: var(--felt-ink); text-decoration: none; font: 800 20px var(--serif); letter-spacing: .04em; }
.pip { color: var(--felt-ink); opacity: .8; }
.links { display: flex; gap: 4px; flex-wrap: wrap; }
.links a { color: var(--felt-muted); text-decoration: none; font-size: 14px; font-weight: 500; padding: 6px 10px; border-radius: 8px; }
.links a:hover { color: var(--felt-ink); background: rgba(255,255,255,.08); }

.hero { max-width: 1180px; margin: 12px auto 0; display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: 12px; color: var(--felt-muted); margin: 0 0 8px; }
h1 { font: 800 clamp(40px, 6vw, 68px)/1 var(--serif); letter-spacing: -.02em; }
h1 em { font-style: italic; color: #f2c96b; }
.lede { font-size: 17px; color: var(--felt-ink); opacity: .9; max-width: 34em; margin: 16px 0 0; }

.champ-card {
  background: #fbf7ea; color: #1b1a17; border-radius: 16px; padding: 22px 24px;
  box-shadow: 0 12px 30px rgba(0,0,0,.3); position: relative; transform: rotate(1.5deg);
  border: 1px solid #e6dcc0;
}
.champ-card::before, .champ-card::after { position: absolute; font: 700 18px var(--serif); color: #b3261e; }
.champ-card::before { content: "♥"; top: 10px; left: 14px; }
.champ-card::after { content: "♥"; bottom: 10px; right: 14px; transform: rotate(180deg); }
.champ-card .label { text-transform: uppercase; letter-spacing: .14em; font-size: 11px; color: #7a6a3a; font-weight: 700; text-align: center; }
.champ-card .name { font: 800 44px/1.05 var(--serif); text-align: center; margin: 6px 0 2px; }
.champ-card .pct { text-align: center; font-size: 15px; color: #55524a; }
.champ-card .pct b { color: #1b1a17; font-size: 22px; }
.champ-card .runner { margin-top: 14px; border-top: 1px dashed #d8cca8; padding-top: 12px; font-size: 13px; color: #55524a; text-align: center; }
.trophy { display: block; margin: 0 auto 4px; width: 40px; height: 40px; color: #b8860b; }

.tiles { max-width: 1180px; margin: 28px auto 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.tile { background: rgba(0,0,0,.16); border: 1px solid rgba(255,255,255,.08); border-radius: 12px; padding: 14px 16px; }
.tile .v { font: 800 30px/1 var(--serif); }
.tile .k { font-size: 12px; color: var(--felt-muted); margin-top: 6px; }

/* ---------- blocks ---------- */
main { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.block { padding: 48px 0 8px; }
.block-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 14px; box-shadow: var(--shadow); min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.panel-head h3 { margin-bottom: 8px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.foot { color: var(--muted); font-size: 12.5px; margin: 10px 0 0; }
.foot.top { margin: -2px 0 8px; }

.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2); padding: 6px 12px; border-radius: 999px; font: 600 13px var(--sans); cursor: pointer; }
.pill:hover { border-color: var(--felt); color: var(--ink); }
.pill[aria-selected="true"] { background: var(--felt); border-color: var(--felt); color: #f4efe1; }
.pill .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--gold); margin-left: 6px; vertical-align: middle; }

select { font: 500 13px var(--sans); padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); }

/* ---------- standings table ---------- */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table.standings { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.standings th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 6px 6px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.standings td { padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.standings th.n, .standings td.n { text-align: right; }
.standings tr:last-child td { border-bottom: 0; }
.standings tr.dq td { color: var(--muted); }
.standings tr.champ td { background: var(--gold-soft); }
.standings tr.champ td:first-child { border-radius: 8px 0 0 8px; }
.standings tr.champ td:last-child { border-radius: 0 8px 8px 0; }
.rank { color: var(--muted); width: 26px; }
.who { font-weight: 600; color: var(--ink); }
tr.dq .who { color: var(--ink-2); }
.badge { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; padding: 1px 6px; border-radius: 6px; margin-left: 6px; vertical-align: 1px; }
.badge.gold { background: var(--gold); color: #fff; }
.badge.nq { border: 1px solid var(--line-strong); color: var(--muted); font-weight: 600; }
.pctcell b { font-weight: 700; color: var(--ink); }
tr.dq .pctcell b { color: var(--ink-2); font-weight: 600; }

.att { position: relative; width: 64px; height: 8px; border-radius: 4px; background: var(--line); display: inline-block; vertical-align: middle; }
.att i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--felt); }
tr.dq .att i { background: var(--other); }
.att .mark, .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--red); left: 66.6%; }
.legend-inline { font-size: 12px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.legend-inline .tick { position: relative; display: inline-block; height: 12px; left: 0; top: 0; }
.att-pct { font-size: 12px; color: var(--muted); margin-left: 6px; display: inline-block; width: 34px; }

/* ---------- race chart ---------- */
.race svg { width: 100%; height: auto; display: block; overflow: visible; }
.race .grid line { stroke: var(--line); }
.race .axis text { fill: var(--muted); font: 11px var(--sans); font-variant-numeric: tabular-nums; }
.race .line { fill: none; stroke: var(--other); stroke-width: 1.5; }
.race .line.on { stroke: var(--accent); stroke-width: 2.5; }
.race .pt { fill: var(--other); stroke: var(--surface); stroke-width: 2; }
.race .pt.on { fill: var(--accent); }
.race .hit { fill: transparent; cursor: pointer; }
.race .lbl { font: 600 12px var(--sans); fill: var(--ink); }
.race .lbl.dim { fill: var(--muted); font-weight: 500; font-size: 11px; }
.race .thresh { stroke: var(--muted); stroke-dasharray: 3 4; }
.empty { color: var(--muted); padding: 40px 12px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 10px; }

.tooltip { position: fixed; z-index: 10; pointer-events: none; background: var(--ink); color: var(--page); font-size: 12.5px; padding: 7px 10px; border-radius: 8px; box-shadow: var(--shadow); max-width: 240px; }
.tooltip b { display: block; }

/* ---------- sessions & podium ---------- */
.sessions { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.sessions li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; align-items: start; }
.date-chip { background: var(--page); border: 1px solid var(--line); border-radius: 10px; text-align: center; padding: 4px 0; line-height: 1.1; }
.date-chip .m { font-size: 10.5px; text-transform: uppercase; color: var(--red); font-weight: 700; letter-spacing: .06em; }
.date-chip .d { font: 800 20px var(--serif); }
.sess-main { font-size: 13.5px; }
.sess-main .where { font-weight: 600; }
.sess-main .what { color: var(--ink-2); }
.sess-main .note { color: var(--muted); font-size: 12.5px; }

.podium { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.podium li { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 10px; background: var(--page); }
.podium .place { font: 800 16px var(--serif); color: var(--muted); }
.podium li:first-child .place { color: var(--gold); }
.podium .nm { font-weight: 600; font-size: 14px; }
.podium .dt { font-size: 12px; color: var(--muted); }
.podium .sc { font: 800 22px var(--serif); font-variant-numeric: tabular-nums; }
.podium .sc small { font: 500 11px var(--sans); color: var(--muted); }

/* ---------- hall of fame ---------- */
.champions { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }
.hof { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 12px 14px; text-align: center; box-shadow: var(--shadow); position: relative; }
.hof .yr { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.hof .nm { font: 800 22px/1.1 var(--serif); margin: 8px 0 4px; }
.hof .pc { font-size: 13px; color: var(--ink-2); }
.hof .no { font-size: 11px; color: var(--muted); margin-top: 6px; }
.hof.latest { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-soft), var(--shadow); }
.hof .suit { position: absolute; top: 8px; left: 10px; font-size: 14px; color: var(--red); }
.hof .suit.b { color: var(--ink); }

/* ---------- moments ---------- */
.moments { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.moment { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--felt); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.moment .t { font: 800 18px var(--serif); }
.moment .d { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.moment p { margin: 0; font-size: 14px; color: var(--ink-2); }

/* ---------- rules / cards ---------- */
.cards { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.pcard { aspect-ratio: 5 / 7; background: #fffdf6; color: #1b1a17; border: 1px solid #ddd3b8; border-radius: 8px; padding: 5px 6px; display: flex; flex-direction: column; justify-content: space-between; position: relative; cursor: default; }
.pcard .c { font: 700 13px var(--serif); }
.pcard .p { font: 800 20px var(--serif); text-align: right; }
.pcard .p small { font: 500 9px var(--sans); color: #8a867b; }
.pcard.act { border-color: #b3261e; box-shadow: inset 0 0 0 1px #b3261e; }
.pcard.act::after { content: "★"; position: absolute; top: 4px; right: 6px; font-size: 11px; color: #b3261e; }
.rules { margin: 0; padding-left: 18px; display: grid; gap: 10px; color: var(--ink-2); }
.rules li::marker { color: var(--red); content: "♦  "; }
.powers { margin-top: 14px; display: grid; gap: 6px; font-size: 13.5px; }
.powers div { display: grid; grid-template-columns: 70px 1fr; gap: 8px; }
.powers b { color: var(--red); }

/* ---------- dispatches ---------- */
.dispatches { display: grid; gap: 10px; }
.dispatch { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: grid; grid-template-columns: 110px 1fr; gap: 16px; }
.dispatch .dt { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.dispatch .s { font-weight: 700; }
.dispatch p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; }
.dispatch .so { font-style: italic; color: var(--muted); font-size: 13px; margin-top: 6px; }
.btn { font: 600 14px var(--sans); background: var(--felt); color: #f4efe1; border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 48px 16px 40px; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero, .grid-2 { grid-template-columns: 1fr; }
  .grid-3, .moments { grid-template-columns: 1fr 1fr; }
  .champions { grid-template-columns: repeat(3, 1fr); }
  .tiles { grid-template-columns: repeat(3, 1fr); }
  .champ-card { transform: none; max-width: 420px; }
}
@media (max-width: 620px) {
  .grid-3, .moments { grid-template-columns: 1fr; }
  .champions { grid-template-columns: repeat(2, 1fr); }
  .tiles { grid-template-columns: repeat(2, 1fr); }
  .cards { grid-template-columns: repeat(5, 1fr); }
  .dispatch { grid-template-columns: 1fr; gap: 2px; }
  .links { display: none; }
  .att { width: 56px; }
}
