:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --ink: #12182b;
  --muted: #646a7a;
  --line: #e3e1da;
  --accent: #b3122e;
  --accent-soft: #f7e3e6;
  --bar: #1f3a68;
  --bar-track: #e8ebf2;
  --win: #e5f2e8;
  --radius: 10px;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --text: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1320;
    --surface: #171c2c;
    --ink: #eceef4;
    --muted: #9aa1b3;
    --line: #2a3045;
    --accent: #ff5c74;
    --accent-soft: #3a1e27;
    --bar: #7ea2e6;
    --bar-track: #252c42;
    --win: #1d3428;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 var(--text); }
a { color: inherit; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; line-height: 1.1; }
h1 { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 800; margin: 0.2em 0 0.3em; }
h2 { font-size: 1.35rem; font-weight: 700; margin: 2rem 0 0.8rem; }
h3 { font-size: 1.1rem; font-weight: 700; margin: 1.6rem 0 0.6rem; }
code, pre { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 0.85em; }
[hidden] { display: none !important; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 0.8rem max(16px, calc((100% - 1100px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.6rem; text-decoration: none; font-family: var(--display); font-weight: 800; }
.brand small { display: block; font: 500 0.7rem var(--text); color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.mark { background: var(--accent); color: #fff; border-radius: 7px; padding: 0.35rem 0.45rem; font-size: 0.8rem; letter-spacing: 0.05em; }
.site-header nav { display: flex; gap: 0.2rem; flex-wrap: wrap; }
.site-header nav a { text-decoration: none; padding: 0.4rem 0.7rem; border-radius: 6px; color: var(--muted); font-weight: 500; }
.site-header nav a.on, .site-header nav a:hover { color: var(--ink); background: var(--bg); }

main { max-width: 1100px; margin: 0 auto; padding: 0 16px 3rem; }
.hero { padding: 2.5rem 0 1.5rem; }
.hero.small { padding: 2rem 0 1rem; }
.hero.small h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
.eyebrow { color: var(--accent); font-weight: 600; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; margin: 0; }
.eyebrow a { text-decoration: none; }
.lede { color: var(--muted); font-size: 1.08rem; max-width: 46rem; margin: 0; }

.controls {
  display: flex; flex-wrap: wrap; gap: 0.8rem 1rem; align-items: end;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 0.9rem 1rem; margin-bottom: 1rem;
}
.controls label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.controls .grow { flex: 1 1 200px; }
select, input[type=search] {
  font: 400 0.95rem var(--text); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 7px; padding: 0.45rem 0.6rem; min-height: 2.3rem; width: 100%;
}
.pill { display: inline-block; padding: 0.45rem 0.6rem; border-radius: 7px; background: var(--bg); color: var(--ink); font: 500 0.95rem var(--text); text-transform: none; letter-spacing: 0; }

.tabs { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 3px; }
.tabs a { text-decoration: none; padding: 0.4rem 0.9rem; border-radius: 6px; font-weight: 600; color: var(--muted); }
.tabs a.on { background: var(--accent); color: #fff; }
.compare-tabs, main > .tabs { margin-bottom: 1rem; }

.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.55rem 0.8rem; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
thead th { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; background: var(--surface); position: sticky; top: 0; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody tr:hover { background: var(--bg); }
tfoot td { font-weight: 600; border-top: 2px solid var(--line); border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank { font-family: var(--display); font-weight: 700; color: var(--muted); width: 3.5rem; }
.board tbody tr:nth-child(-n+3) .rank { color: var(--accent); }
.school { text-decoration: none; }
.score-col { width: 38%; white-space: nowrap; }
.score { display: inline-block; width: 3rem; text-align: right; font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { display: inline-block; vertical-align: middle; width: calc(100% - 3.6rem); height: 8px; border-radius: 4px; background: var(--bar-track); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--bar); border-radius: 4px; }
.banner { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 6px; padding: 0.6rem 0.9rem; margin: 0 0 1rem; max-width: 46rem; }
.basis { display: inline-block; font: 600 0.72rem var(--text); letter-spacing: 0.03em; padding: 0.15rem 0.5rem; border-radius: 999px; background: var(--bar-track); color: var(--ink); white-space: nowrap; }
.basis-in-season { background: var(--win); }
.basis-last-season { color: var(--muted); }
abbr.est { text-decoration: none; border-bottom: 1px dotted var(--muted); font: 600 0.72em var(--text); color: var(--muted); cursor: help; }
.school { display: inline-flex; align-items: center; gap: 0.6rem; }
.school-right { justify-content: flex-end; }
.badge { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%;
  font-family: var(--display); font-weight: 800; line-height: 1; letter-spacing: -0.02em; user-select: none; }
.badge-sm { width: 1.9rem; height: 1.9rem; font-size: 0.82rem; }
.badge-sm.len-3 { font-size: 0.66rem; }
.badge-sm.len-4, .badge-sm.len-5 { font-size: 0.54rem; }
.badge-lg { width: 3.6rem; height: 3.6rem; font-size: 1.45rem; }
.badge-lg.len-3 { font-size: 1.15rem; }
.badge-lg.len-4, .badge-lg.len-5 { font-size: 0.92rem; }
h1.with-badge { display: flex; align-items: center; gap: 0.9rem; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0 0 1rem; }
.share-label { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-right: 0.2rem; }
.share a, .share button { font: 500 0.82rem var(--text); color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 0.3rem 0.75rem; text-decoration: none; cursor: pointer; }
.share a:hover, .share button:hover { border-color: var(--accent); color: var(--accent); }
.share .share-native { background: var(--accent); border-color: var(--accent); color: #fff; }
/* rank change, season state */
.chg { font: 700 0.78rem var(--text); white-space: nowrap; }
.chg-up { color: #1a7f3c; }
.chg-down { color: var(--accent); }
.chg-same, .chg-new { color: var(--muted); font-weight: 500; }
@media (prefers-color-scheme: dark) { .chg-up { color: #5fd38a; } }
.state { display: inline-block; vertical-align: middle; margin-left: 0.4rem; font: 700 0.68rem var(--text); letter-spacing: 0.08em;
  text-transform: uppercase; padding: 0.15rem 0.5rem; border-radius: 999px; cursor: help; }
.state-projected { background: var(--accent-soft); color: var(--accent); border: 1px dashed var(--accent); }
.state-live { background: var(--win); color: var(--ink); }

/* biggest movers */
.movers { margin: 0 0 1.2rem; }
.movers h2 { margin: 0 0 0.6rem; }
.movers-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 0.8rem; }
.movers-col { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 0.9rem; }
.movers-col h3 { margin: 0 0 0.4rem; font: 700 0.72rem var(--text); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.movers-col ol { list-style: none; margin: 0; padding: 0; }
.movers-col li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; }
.movers-col li + li { border-top: 1px solid var(--line); }

/* best-of lists */
.best-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.best-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.best-card h2 { margin: 0 0 0.3rem; font-size: 1.1rem; }
.best-card p { margin: 0 0 0.5rem; }
.best-list { list-style: none; margin: 0 0 0.6rem; padding: 0; counter-reset: best; }
.best-list li { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.3rem 0; counter-increment: best; }
.best-list li::before { content: counter(best); width: 1.4rem; font: 700 0.85rem var(--display); color: var(--muted); }
.best-list li .school { flex: 1; }
.more { font-weight: 600; text-decoration: none; color: var(--accent); }

/* trend chart */
.trend-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem; }
.trend { width: 100%; height: auto; display: block; }
.trend .grid { stroke: var(--line); stroke-width: 1; }
.trend .axis { fill: var(--muted); font: 11px var(--text); }
.trend .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.trend .dot { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }

/* sortable tables, filters */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover, th.sortable:focus { color: var(--ink); outline: none; }
th.sortable::after { content: " ↕"; opacity: 0.35; }
th.sortable[aria-sort="ascending"]::after { content: " ▲"; opacity: 0.8; }
th.sortable[aria-sort="descending"]::after { content: " ▼"; opacity: 0.8; }
.clear-filters { align-self: center; font-size: 0.85rem; font-weight: 600; color: var(--accent); text-decoration: none; }
.no-match { padding: 1rem; color: var(--muted); margin: 0; }

.school-head { padding: 2rem 0 0.5rem; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; margin-top: 1rem; }
.stat { display: flex; flex-direction: column; text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem 1rem; }
.stat.on { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.stat-label { font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.stat-value { font-family: var(--display); font-size: 2rem; font-weight: 800; }
.stat-sub { color: var(--muted); font-size: 0.85rem; }

ul.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }
ul.chips li { background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 0.25rem 0.7rem; font-size: 0.88rem; }
.button { display: inline-block; margin-top: 1.5rem; background: var(--ink); color: var(--bg); text-decoration: none; padding: 0.6rem 1rem; border-radius: 8px; font-weight: 600; }
.button:hover { color: var(--bg); opacity: 0.9; }

.sport-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
.sport-columns h2 { margin-top: 0.5rem; }
.sport-list { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sport-list li + li { border-top: 1px solid var(--line); }
.sport-list a { display: grid; grid-template-columns: 1fr auto 3rem; gap: 0.6rem; align-items: center; padding: 0.55rem 0.9rem; text-decoration: none; }
.weight { text-align: right; font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }

.sources { margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.7rem 1rem; }
.sources summary { cursor: pointer; font-weight: 600; }
.sources ul { margin: 0.6rem 0 0; padding-left: 1.2rem; }

.compare .overall th, .compare .overall td { background: var(--bg); }
.compare td.win { background: var(--win); }
.compare tbody th { font-weight: 500; }

.prose { max-width: 46rem; padding-top: 2rem; }
.prose p, .prose li { font-size: 1.02rem; }
.formula { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 6px; padding: 0.8rem 1rem; overflow-x: auto; font-size: 0.9rem; line-height: 1.5; }
.weights td:first-child { white-space: nowrap; }

.empty { padding: 4rem 0; text-align: center; }
.site-footer { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px 3rem; color: var(--muted); font-size: 0.85rem; border-top: 1px solid var(--line); }

@media (max-width: 640px) {
  .badge-lg { width: 2.8rem; height: 2.8rem; font-size: 1.1rem; }
  .share.has-native a, .share.has-native .share-copy { display: none; }
  .hide-sm { display: none; }
  th, td { padding: 0.5rem 0.55rem; }
  .score-col { width: 45%; }
  .controls { padding: 0.8rem; }
  .tabs { width: 100%; }
  .tabs a { flex: 1; text-align: center; padding: 0.4rem 0.4rem; }
}
