:root {
  --bg: #071018;
  --surface: #0f1b26;
  --surface-2: #162635;
  --surface-3: #1d3041;
  --text: #f8fafc;
  --muted: #bdc8d3;
  --soft: #93a4b3;
  --border: #33495c;
  --border-strong: #52697b;
  --teal: #55e3d3;
  --teal-ink: #002b27;
  --coral: #ff9a87;
  --coral-ink: #321008;
  --gold: #f4d184;
  --danger: #ffb2a5;
  --success: #7de5a8;
  --shadow: 0 22px 70px rgba(0, 0, 0, .28);
  --radius: 22px;
  --radius-small: 13px;
  --max: 1240px;
  --header-height: 72px;
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  --bg: #f7f3ec;
  --surface: #ffffff;
  --surface-2: #eee8de;
  --surface-3: #e2d8ca;
  --text: #15202b;
  --muted: #465664;
  --soft: #566571;
  --border: #aa9f91;
  --border-strong: #746a60;
  --teal: #006b64;
  --teal-ink: #ffffff;
  --coral: #9e3021;
  --coral-ink: #ffffff;
  --gold: #6e4b00;
  --danger: #8d271a;
  --success: #12632f;
  --shadow: 0 20px 55px rgba(50, 38, 25, .13);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-height) + 24px); }
body {
  margin: 0;
  min-width: 280px;
  background:
    radial-gradient(circle at 80% -10%, color-mix(in srgb, var(--teal) 13%, transparent), transparent 34rem),
    radial-gradient(circle at 0 24%, color-mix(in srgb, var(--coral) 9%, transparent), transparent 34rem),
    var(--bg);
  color: var(--text);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
}
button, input, select { font: inherit; }
button, select, input { color: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }
a { color: var(--teal); text-underline-offset: .18em; text-decoration-thickness: .08em; }
a:hover { text-decoration-thickness: .14em; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.skip-link {
  position: fixed;
  z-index: 1000;
  left: 16px;
  top: 10px;
  padding: 11px 16px;
  border-radius: 9px;
  background: var(--text);
  color: var(--bg);
  transform: translateY(-180%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.top-progress { position: fixed; z-index: 110; inset: 0 0 auto; height: 3px; background: transparent; }
.top-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--teal), var(--coral)); }

.site-header {
  position: sticky;
  z-index: 100;
  top: 0;
  min-height: var(--header-height);
  padding: 10px clamp(16px, 3vw, 44px);
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 78%, transparent);
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: blur(18px);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--teal); color: var(--teal-ink); font-family: Georgia, serif; font-size: 1.35rem; }
.site-header nav { display: flex; justify-content: center; align-items: center; gap: clamp(12px, 2vw, 28px); min-width: 0; }
.site-header nav a { color: var(--muted); text-decoration: none; font-size: .9rem; font-weight: 700; white-space: nowrap; }
.site-header nav a:hover, .site-header nav a[aria-current="location"] { color: var(--text); }
.header-actions { display: flex; gap: 8px; }
.icon-button {
  min-width: 44px;
  min-height: 44px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}
.icon-button:hover { border-color: var(--teal); background: var(--surface-2); }
.menu-toggle { display: none; }

.app-status {
  position: fixed;
  z-index: 150;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  padding: 11px 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--muted);
  font-size: .88rem;
}
.app-status.ready { opacity: 0; pointer-events: none; transition: opacity .35s ease .6s; }
.toast {
  position: fixed;
  z-index: 200;
  right: 20px;
  bottom: 20px;
  max-width: min(380px, calc(100vw - 40px));
  padding: 13px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  box-shadow: var(--shadow);
  font-weight: 750;
}

.section-shell { width: min(calc(100% - 48px), var(--max)); margin-inline: auto; }
.hero {
  min-height: min(850px, calc(100vh - var(--header-height)));
  padding-block: clamp(64px, 10vw, 132px) 42px;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr);
  align-items: center;
  gap: 48px;
  position: relative;
}
.hero-copy { min-width: 0; }
.eyebrow, .kicker {
  color: var(--gold);
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.hero h1, .section-heading h2 { font-family: Georgia, "Times New Roman", serif; letter-spacing: -.045em; line-height: .98; margin: 16px 0 20px; }
.hero h1 { font-size: clamp(3.8rem, 8.3vw, 8.4rem); max-width: 880px; }
.hero h1 em { color: var(--coral); font-weight: 500; }
.hero-deck { max-width: 700px; color: var(--muted); font-size: clamp(1.08rem, 1.8vw, 1.38rem); }
.hero-actions, .download-links, .table-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.button {
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 850;
}
.button.primary { background: var(--teal); color: var(--teal-ink); }
.button.primary:hover { filter: brightness(1.08); }
.button.ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.button.ghost:hover { border-color: var(--teal); }
.button.small { min-height: 44px; padding-inline: 15px; }
.build-badges { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 28px; color: var(--muted); font-size: .86rem; }
.build-badges span { display: inline-flex; align-items: center; gap: 8px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--teal) 14%, transparent); }
.status-dot.ok { background: var(--success); }
.integrity-note { min-height: 1.4em; margin-top: 14px; color: var(--soft); font-size: .83rem; }
.hero-visual { min-width: 0; }
.hero-grid path { stroke: var(--border); stroke-width: 1; opacity: .55; }
.hero-line-shadow { fill: none; stroke: var(--teal); stroke-width: 17; opacity: .13; filter: url(#glow); }
.hero-line { fill: none; stroke: url(#line-gradient); stroke-width: 6; stroke-linecap: round; }
.hero-points circle { fill: var(--bg); stroke: var(--coral); stroke-width: 4; }
.hero-visual text { fill: var(--muted); font: 700 15px Inter, sans-serif; }
.score-card rect { fill: var(--surface); stroke: var(--border-strong); }
.score-card text:nth-of-type(1) { fill: var(--gold); font-size: 12px; letter-spacing: .12em; }
.score-card text:nth-of-type(2) { fill: var(--text); font: 700 42px Georgia, serif; }
.score-card text:nth-of-type(3) { fill: var(--teal); font-size: 15px; }
.hero-stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.hero-stat { min-width: 0; padding: 22px 25px; border-right: 1px solid var(--border); }
.hero-stat:last-child { border-right: 0; }
.hero-stat strong { display: block; font-size: clamp(1.45rem, 3vw, 2.25rem); line-height: 1; color: var(--text); }
.hero-stat span { display: block; margin-top: 8px; color: var(--muted); font-size: .84rem; }

.block-section { padding-block: clamp(82px, 11vw, 145px) 0; }
.section-heading { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 500px); gap: 44px; align-items: end; margin-bottom: 34px; }
.section-heading > div { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; }
.section-number { color: var(--coral); font-size: .8rem; font-weight: 900; margin-top: .45rem; }
.section-heading h2 { font-size: clamp(2.8rem, 5vw, 5.4rem); margin: 0; }
.section-heading p { color: var(--muted); font-size: 1.04rem; margin: 0; }

.panel, .panel-soft, .chart-panel, .story-card, .download-panel, .cycle-note, .loading-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.panel, .chart-panel { min-width: 0; padding: clamp(18px, 2.4vw, 29px); box-shadow: 0 12px 36px rgba(0,0,0,.08); }
.panel-soft { padding: 18px; background: var(--surface-2); }
.control-deck { display: grid; gap: 14px; margin-bottom: 20px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.score-controls { grid-template-columns: 155px 170px minmax(240px, 1fr) minmax(180px, 240px); align-items: end; }
.compact-controls { grid-template-columns: auto 150px minmax(170px, 230px) minmax(230px, 1fr); align-items: end; }
label { min-width: 0; display: grid; gap: 7px; color: var(--muted); font-size: .77rem; font-weight: 800; letter-spacing: .04em; }
select, input[type="number"], input[type="search"] {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  letter-spacing: normal;
}
select:hover, input:hover { border-color: var(--teal); }
.score-input-wrap { display: flex; align-items: center; gap: 8px; }
.score-input-wrap input { font-size: 1.4rem; font-weight: 850; }
.score-input-wrap > span { color: var(--soft); }
.range-label { min-width: 0; }
input[type="range"] { width: 100%; min-height: 46px; accent-color: var(--teal); }
.segmented { display: inline-flex; align-items: center; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.segmented button { min-height: 40px; padding: 8px 13px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 850; }
.segmented button.active, .segmented button[aria-pressed="true"] { background: var(--teal); color: var(--teal-ink); }

.story-card { padding: clamp(18px, 3vw, 32px); margin-block: 18px; background: linear-gradient(140deg, var(--surface), var(--surface-2)); }
.story-main { margin: 0; font-family: Georgia, serif; font-size: clamp(1.35rem, 2.6vw, 2.25rem); line-height: 1.18; }
.story-main strong { color: var(--coral); }
.story-sub { margin: 11px 0 0; color: var(--muted); }
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.two-column > *, .insight-grid > *, .quality-grid > * { min-width: 0; }
.panel-heading, .chart-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 18px; }
.panel-heading h3, .chart-heading h3, .download-panel h3 { margin: 3px 0 0; font-size: clamp(1.2rem, 2vw, 1.7rem); line-height: 1.15; }
.count-pill, .micro-stat { flex: 0 1 auto; max-width: 100%; overflow-wrap: anywhere; padding: 7px 10px; border-radius: 999px; background: var(--surface-3); color: var(--text); font-size: .78rem; font-weight: 850; }
.rank-list, .data-list, .quality-list { display: grid; gap: 9px; }
.rank-item, .data-item, .quality-item { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.rank-item:last-child, .data-item:last-child, .quality-item:last-child { border-bottom: 0; }
.rank-item strong, .data-item strong, .quality-item strong { display: block; overflow-wrap: anywhere; }
.rank-item small, .data-item small, .quality-item small { display: block; margin-top: 2px; color: var(--muted); overflow-wrap: anywhere; }
.rank-value, .value { white-space: nowrap; font-weight: 900; color: var(--teal); }
.value.up { color: var(--success); }
.value.down { color: var(--coral); }
.equivalence-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.equivalence-card { padding: 13px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.equivalence-card strong { display: block; font-size: 1.16rem; }
.equivalence-card span { color: var(--muted); font-size: .8rem; }
.fine-print, .comparison-note { color: var(--muted); font-size: .82rem; }
.empty-state, .loading-panel { padding: 24px; color: var(--muted); text-align: center; }
.compact-empty { padding: 12px; }

.table-shell { width: 100%; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.table-shell:focus { border-color: var(--gold); }
table { width: 100%; border-collapse: collapse; font-size: .89rem; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); color: var(--muted); font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; }
th button { min-height: 38px; padding: 4px 0; border: 0; background: transparent; color: inherit; font-weight: 900; text-transform: inherit; letter-spacing: inherit; }
th button::after { content: " ↕"; opacity: .55; }
th[aria-sort="ascending"] button::after { content: " ↑"; opacity: 1; color: var(--teal); }
th[aria-sort="descending"] button::after { content: " ↓"; opacity: 1; color: var(--teal); }
tbody tr:hover { background: color-mix(in srgb, var(--teal) 6%, transparent); }
tbody tr:last-child td { border-bottom: 0; }
.table-school { min-width: 220px; }
.table-number { font-variant-numeric: tabular-nums; white-space: nowrap; }
.confidence-badge, .method-badge, .severity-badge { display: inline-flex; align-items: center; min-height: 26px; padding: 4px 8px; border-radius: 999px; font-size: .71rem; font-weight: 900; white-space: nowrap; }
.confidence-badge.high { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.confidence-badge.medium { background: color-mix(in srgb, var(--gold) 17%, transparent); color: var(--gold); }
.method-badge.exact { background: color-mix(in srgb, var(--teal) 16%, transparent); color: var(--teal); }
.method-badge.proxy { background: color-mix(in srgb, var(--coral) 15%, transparent); color: var(--coral); }
.severity-badge.high { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger); }
.severity-badge.medium { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--gold); }
.severity-badge.review { background: var(--surface-3); color: var(--muted); }
.table-footer { min-height: 56px; display: flex; justify-content: space-between; gap: 18px; align-items: center; color: var(--muted); font-size: .83rem; }
.text-button { min-height: 44px; padding: 7px 8px; border: 0; background: transparent; color: var(--teal); text-decoration: underline; text-underline-offset: .2em; font-weight: 850; }
.text-button:hover { color: var(--text); }

.history-controls { display: grid; grid-template-columns: 1fr 1.5fr; gap: 16px; }
.school-picker { display: grid; grid-template-columns: minmax(260px, .8fr) minmax(0, 1.2fr); align-items: end; gap: 22px; }
.school-headline { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.headline-stat { min-width: 0; padding: 10px 12px; border-left: 3px solid var(--teal); }
.headline-stat strong { display: block; font-size: 1.25rem; }
.headline-stat span { color: var(--muted); font-size: .75rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-block: 18px; }
.metric-card { min-width: 0; padding: 17px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.metric-card strong { display: block; font-size: 1.42rem; overflow-wrap: anywhere; }
.metric-card span { display: block; margin-top: 4px; color: var(--muted); font-size: .78rem; }
.event-list { display: grid; gap: 10px; margin-block: 18px; }
.event-card { padding: 14px 16px; border-left: 4px solid var(--coral); border-radius: 0 12px 12px 0; background: var(--surface-2); }
.event-card strong, .event-card span { display: block; }
.event-card span { margin-top: 4px; color: var(--muted); font-size: .8rem; }
.compare-controls { display: grid; grid-template-columns: minmax(260px, 420px) auto minmax(0, 1fr); gap: 12px; align-items: end; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.chip { min-height: 38px; display: inline-flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.chip button { min-width: 28px; min-height: 28px; border: 0; border-radius: 50%; background: var(--surface-3); color: var(--text); }

.chart-panel { margin-block: 18px; overflow: hidden; }
.chart { width: 100%; max-width: 100%; min-width: 0; min-height: 270px; overflow-x: auto; overscroll-behavior-inline: contain; }
.short-chart { min-height: 210px; }
.chart svg { display: block; width: 100%; min-width: 620px; height: auto; overflow: visible; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--muted); font-size: 12px; }
.chart-line { fill: none; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.chart-line.proxy { stroke-dasharray: 8 7; }
.chart-point { stroke: var(--surface); stroke-width: 2.5; }
.chart-point.proxy { stroke-dasharray: 3 2; }
.chart-tooltip { fill: var(--surface); stroke: var(--border-strong); }
.chart-tooltip-text { fill: var(--text); font-size: 12px; }
.chart-data { min-width: 0; max-width: 100%; margin-top: 10px; border-top: 1px solid var(--border); overflow: hidden; }
.chart-data summary { min-height: 44px; display: flex; align-items: center; color: var(--teal); font-weight: 850; cursor: pointer; }
.chart-data .table-shell { max-height: 340px; }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px 14px; color: var(--muted); font-size: .78rem; }
.legend-item { display: inline-flex; align-items: center; gap: 7px; }
.legend-item i { width: 20px; height: 3px; border-radius: 2px; background: var(--teal); }
.legend-item i.dashed { height: 0; border-top: 3px dashed var(--coral); background: transparent; }

.insight-controls { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.insight-controls label { min-width: 180px; }
.insight-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.insight-wide { grid-column: span 2; }
.bar-list { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 210px) minmax(100px, 1fr) 110px; gap: 12px; align-items: center; }
.bar-row label { color: var(--text); font-size: .82rem; overflow-wrap: anywhere; }
.bar-track { height: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--teal), var(--coral)); }
.bar-value { color: var(--muted); text-align: right; font-size: .77rem; }

.quality-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.quality-wide { grid-column: span 2; }
.quality-item { align-items: start; }
.quality-item p { margin: 4px 0 0; color: var(--muted); font-size: .82rem; }
.quality-source { display: inline-block; margin-top: 5px; font-size: .76rem; overflow-wrap: anywhere; }
.download-panel { margin-top: 22px; padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 24px; }
.download-panel p { margin: 5px 0 0; color: var(--muted); }

.coverage-timeline { display: grid; grid-template-columns: repeat(13, minmax(50px, 1fr)); gap: 7px; }
.coverage-year { min-width: 0; min-height: 44px; padding: 7px 4px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--muted); font-size: .75rem; font-weight: 850; }
.coverage-year.exact { border-color: var(--teal); color: var(--teal); }
.coverage-year.threshold-only { border-color: var(--coral); color: var(--coral); }
.coverage-year.active, .coverage-year[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.coverage-detail { margin-top: 14px; }
.cycle-note { margin-top: 14px; padding: 20px; border-left: 5px solid var(--gold); }
.cycle-note p { margin: 5px 0 10px; color: var(--muted); }

.site-footer { margin-top: 130px; padding-block: 34px; border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 28px; color: var(--muted); font-size: .82rem; }
.site-footer p { margin: 4px 0 0; }
.site-footer a { color: var(--text); }
.noscript { margin: 20px; padding: 20px; border: 2px solid var(--danger); background: var(--surface); }

@media (max-width: 1120px) {
  .site-header { grid-template-columns: auto auto 1fr auto; gap: 10px; }
  .menu-toggle { display: inline-grid; grid-column: 2; }
  .site-header nav {
    position: absolute;
    top: calc(100% + 1px);
    left: 12px;
    right: 12px;
    display: none;
    padding: 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 3px;
    border: 1px solid var(--border);
    border-radius: 0 0 15px 15px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
  .site-header nav.open { display: flex; }
  .site-header nav a { min-height: 44px; display: flex; align-items: center; padding: 8px 12px; border-radius: 8px; }
  .site-header nav a:hover { background: var(--surface-2); }
  .header-actions { grid-column: 4; }
  .hero { grid-template-columns: 1fr; min-height: auto; overflow: clip; }
  .hero-visual { position: absolute; z-index: -1; right: -6vw; top: 8%; width: min(600px, 62vw); opacity: .16; }
  .section-heading { grid-template-columns: 1fr; gap: 18px; }
  .score-controls { grid-template-columns: 160px 180px 1fr; }
  .score-controls label:last-child { grid-column: 1 / -1; }
  .compact-controls { grid-template-columns: auto 150px 1fr; }
  .compact-controls label:last-child { grid-column: 1 / -1; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .coverage-timeline { grid-template-columns: repeat(9, minmax(48px, 1fr)); }
}

@media (max-width: 760px) {
  :root { --header-height: 64px; --radius: 17px; }
  .site-header { min-height: var(--header-height); padding: 8px 12px; }
  .brand > span:last-child { display: none; }
  .brand-mark { width: 42px; height: 42px; }
  .header-actions { gap: 5px; }
  .section-shell { width: min(calc(100% - 28px), var(--max)); }
  .hero { padding-top: 52px; gap: 30px; }
  .hero h1 { font-size: clamp(3.25rem, 16vw, 5.3rem); }
  .hero-visual { display: none; }
  .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stat { border-bottom: 1px solid var(--border); }
  .hero-stat:nth-child(2) { border-right: 0; }
  .hero-stat:nth-last-child(-n+2) { border-bottom: 0; }
  .block-section { padding-top: 88px; }
  .section-heading h2 { font-size: clamp(2.6rem, 12vw, 4.2rem); }
  .score-controls, .compact-controls, .history-controls, .school-picker, .compare-controls { grid-template-columns: 1fr; }
  .score-controls label:last-child, .compact-controls label:last-child { grid-column: auto; }
  .two-column, .quality-grid, .insight-grid { grid-template-columns: 1fr; }
  .panel-heading, .chart-heading { flex-wrap: wrap; }
  .insight-wide, .quality-wide { grid-column: auto; }
  .equivalence-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .school-headline { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .compare-controls .chips { grid-column: auto; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .download-panel, .site-footer { align-items: flex-start; flex-direction: column; }
  .coverage-timeline { grid-template-columns: repeat(5, minmax(48px, 1fr)); }
  .bar-row { grid-template-columns: minmax(95px, 125px) minmax(80px, 1fr); }
  .bar-value { grid-column: 2; text-align: left; }
  .table-shell { border-radius: 14px; }
  .ranking-responsive table, .ranking-responsive thead, .ranking-responsive tbody, .ranking-responsive tr, .ranking-responsive th, .ranking-responsive td { display: block; }
  .ranking-responsive thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
  .ranking-responsive tbody { display: grid; gap: 10px; padding: 10px; }
  .ranking-responsive tr { border: 1px solid var(--border); border-radius: 12px; padding: 9px; background: var(--surface-2); }
  .ranking-responsive td { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 10px; padding: 7px 5px; border-bottom: 1px solid var(--border); overflow-wrap: anywhere; }
  .ranking-responsive td:last-child { border-bottom: 0; }
  .ranking-responsive td::before { content: attr(data-label); color: var(--muted); font-size: .69rem; font-weight: 900; letter-spacing: .05em; text-transform: uppercase; }
  .ranking-responsive .table-school { min-width: 0; }
  .table-footer { align-items: flex-start; flex-direction: column; padding-top: 12px; }
}

@media (max-width: 420px) {
  .section-shell { width: min(calc(100% - 20px), var(--max)); }
  .hero-stats, .metric-grid, .equivalence-grid { grid-template-columns: 1fr; }
  .hero-stat { border-right: 0; border-bottom: 1px solid var(--border) !important; }
  .hero-stat:last-child { border-bottom: 0 !important; }
  .school-headline { grid-template-columns: 1fr; }
  .panel, .chart-panel { padding: 15px; }
  .coverage-timeline { grid-template-columns: repeat(4, minmax(46px, 1fr)); }
  .site-footer { margin-top: 90px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .site-header, .top-progress, .hero-actions, .control-deck, .compare-controls, .insight-controls, .download-links, .table-footer, .app-status, .toast { display: none !important; }
  body { background: white !important; color: #111 !important; }
  .section-shell { width: 100% !important; }
  .hero { min-height: auto !important; display: block !important; }
  .hero-visual { display: none !important; }
  .panel, .panel-soft, .chart-panel, .story-card, .download-panel, .cycle-note { box-shadow: none !important; background: white !important; border-color: #777 !important; }
  .block-section { break-inside: avoid; padding-top: 34px !important; }
  .site-footer { margin-top: 40px !important; }
  .hero h1, .section-heading h2, .metric-card strong { color: #111 !important; }
  .hero-deck, .section-heading p, .fine-print, .story-sub, .site-footer { color: #444 !important; }
}
.link-button {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--teal);
  text-align: left;
  text-decoration: underline;
  text-underline-offset: .2em;
  font-weight: 850;
  overflow-wrap: anywhere;
}
.link-button:hover { color: var(--text); }
small { color: var(--muted); }

/* Long provenance URLs must wrap inside narrow viewports. */
.fine-print a, .comparison-note a, .cycle-note a, .quality-source, .coverage-detail a {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
