/* Hyperbolic replay viewer. Dark by default, light on toggle. */

:root {
  color-scheme: dark;
  --bg: #0d0f12;
  --surface-1: #131518;
  --surface-2: #191c20;
  --surface-3: #22262b;
  --hairline: #262a30;
  --hairline-strong: #343a41;
  --text-primary: #eef0f2;
  --text-secondary: #b4b9c0;
  --text-muted: #80868f;

  --agent: #8b7ff0;
  --agent-soft: rgba(139, 127, 240, 0.16);
  --baseline: #8a8f98;
  --baseline-soft: rgba(138, 143, 152, 0.16);
  --band: #2bb8a6;
  --band-fill: rgba(43, 184, 166, 0.13);
  --band-edge: rgba(43, 184, 166, 0.45);
  --warm: #f07a6a;
  --cool: #4c8dff;
  --clamp: #fab219;
  --fallback: #e5484d;
  --good: #34c77b;
  --bad: #f07a6a;

  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 40px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --radius-sm: 10px;
  --gutter: 16px;
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f4f1;
  --surface-1: #fcfcfb;
  --surface-2: #f3f3f0;
  --surface-3: #e9e9e5;
  --hairline: #e4e4df;
  --hairline-strong: #d3d3cc;
  --text-primary: #111214;
  --text-secondary: #4d5057;
  --text-muted: #6f737a;

  --agent: #6250d6;
  --agent-soft: rgba(98, 80, 214, 0.12);
  --baseline: #8a8f98;
  --baseline-soft: rgba(138, 143, 152, 0.16);
  --band: #12927f;
  --band-fill: rgba(18, 146, 127, 0.11);
  --band-edge: rgba(18, 146, 127, 0.45);
  --warm: #e0563f;
  --cool: #2a78d6;
  --clamp: #c98500;
  --fallback: #d03b3b;
  --good: #0b8a4a;
  --bad: #c8432f;
  --shadow: 0 1px 2px rgba(17, 18, 20, 0.04), 0 10px 30px rgba(17, 18, 20, 0.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; }
a { color: var(--text-primary); text-underline-offset: 3px; text-decoration-color: var(--hairline-strong); }
a:hover { text-decoration-color: var(--agent); }
code, pre { font-family: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Consolas, monospace; }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }
/* The hidden attribute must win over component display rules such as .sample-banner's flex. */
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: 1160px; margin: 0 auto; padding: 0 var(--gutter); }
section { margin-top: 28px; }

/* Top bar ---------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--hairline);
}
.topbar .wrap { display: flex; align-items: center; gap: 12px; height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 600; font-size: 17px; letter-spacing: -0.01em; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; }
.dataset-pill { margin-left: auto; padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); background: var(--surface-2); border: 1px solid var(--hairline); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60vw; }
.icon-btn {
  flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--hairline); background: var(--surface-2);
  display: grid; place-items: center; cursor: pointer; color: var(--text-secondary);
}
.icon-btn:hover { color: var(--text-primary); border-color: var(--hairline-strong); }
.icon-btn svg { width: 17px; height: 17px; }

/* Sample banner ---------------------------------------------------------------- */
.sample-banner {
  margin-top: 16px; display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid color-mix(in srgb, var(--clamp) 45%, var(--hairline)); background: color-mix(in srgb, var(--clamp) 8%, var(--surface-1));
  border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; color: var(--text-secondary);
}
.sample-banner strong { color: var(--text-primary); }
.sample-banner .tag { flex: none; }
.sample-banner .short { display: none; }

.tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase; border: 1px solid var(--hairline-strong); color: var(--text-secondary); white-space: nowrap;
}
.tag.sample { color: var(--clamp); border-color: color-mix(in srgb, var(--clamp) 55%, transparent); }
.tag.ok { color: var(--band); border-color: color-mix(in srgb, var(--band) 50%, transparent); }
.tag.clamped { color: var(--clamp); border-color: color-mix(in srgb, var(--clamp) 55%, transparent); }
.tag.fallback { color: var(--fallback); border-color: color-mix(in srgb, var(--fallback) 55%, transparent); }

/* Hero ---------------------------------------------------------------- */
.hero { margin-top: 44px; }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 8px; }
.deltas-caption { margin-top: 22px; font-size: 12px; color: var(--text-muted); font-weight: 500; letter-spacing: .02em; }
.eyebrow { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; color: var(--text-muted); font-size: 13px; font-weight: 500; }
.eyebrow .dot { width: 3px; height: 3px; border-radius: 50%; background: var(--text-muted); }
.hero h1 {
  margin: 14px 0 0; font-family: var(--font-display); font-weight: 600; letter-spacing: -0.025em;
  font-size: clamp(30px, 5.2vw, 56px); line-height: 1.06; max-width: 22ch; text-wrap: balance;
}
.hero h1 .tone-loss { color: var(--bad); }
.hero p.lede { margin: 14px 0 0; color: var(--text-secondary); max-width: 62ch; font-size: 15.5px; }
.deltas { display: flex; flex-wrap: wrap; gap: 10px; }
.delta {
  min-width: 132px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-1); border: 1px solid var(--hairline);
}
.delta .label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.delta .value { margin-top: 2px; font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.delta .verdict { font-size: 12px; margin-top: 2px; display: flex; gap: 5px; align-items: center; color: var(--text-secondary); }
.delta .verdict svg { width: 12px; height: 12px; }
.delta .verdict.better svg { color: var(--good); }
.delta .verdict.worse svg { color: var(--bad); }

.play-hero {
  display: inline-flex; align-items: center; gap: 12px; padding: 14px 22px 14px 16px; border-radius: 999px; border: 0; cursor: pointer;
  background: var(--agent); color: #fff; font-weight: 600; font-size: 16px; box-shadow: 0 10px 30px color-mix(in srgb, var(--agent) 35%, transparent);
  transition: transform .15s ease, box-shadow .15s ease;
}
.play-hero:hover { transform: translateY(-1px); box-shadow: 0 14px 34px color-mix(in srgb, var(--agent) 45%, transparent); }
.play-hero .disc { width: 34px; height: 34px; border-radius: 50%; background: rgba(255,255,255,.18); display: grid; place-items: center; }
.play-hero svg { width: 14px; height: 14px; }

/* Cards ---------------------------------------------------------------- */
.card { background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 16px 18px 0; }
.card-title { font-family: var(--font-display); font-weight: 600; font-size: 15px; letter-spacing: -0.005em; display: flex; align-items: center; gap: 9px; }
.card-sub { font-size: 12.5px; color: var(--text-muted); }
.key { display: inline-block; width: 16px; height: 2px; border-radius: 2px; vertical-align: middle; }
.key.agent { background: var(--agent); height: 3px; }
.key.baseline { background: var(--baseline); }
.key.band { height: 10px; width: 14px; border-radius: 3px; background: var(--band-fill); border: 1px solid var(--band-edge); }

/* Stage: clock + plans ---------------------------------------------------------------- */
.stage { scroll-margin-top: 72px; }
.clock { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 4px 2px 14px; }
.clock .when { font-family: var(--font-display); font-size: 26px; font-weight: 600; letter-spacing: -0.015em; }
.clock-facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; color: var(--text-secondary); font-size: 13px; }
.clock-facts b { color: var(--text-primary); font-weight: 600; }
.occ-pill { padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-secondary); }
.occ-pill.on { background: color-mix(in srgb, var(--band) 18%, transparent); color: var(--band); }

.districts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.district { position: relative; padding-bottom: 14px; transition: box-shadow .3s ease; }
.district .card-head { padding-bottom: 10px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 14px; }
.tile {
  position: relative; border-radius: 14px; padding: 12px 12px 11px; border: 1px solid var(--hairline);
  background: var(--surface-2); min-width: 0; transition: background-color .25s linear;
}
.tile-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.tile-name { font-family: var(--font-display); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.occ { font-size: 11px; font-weight: 600; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.occ i { width: 7px; height: 7px; border-radius: 50%; background: var(--text-muted); opacity: .5; }
.occ.on { color: var(--text-secondary); }
.occ.on i { background: var(--band); opacity: 1; }
.tile-temp { margin-top: 6px; font-family: var(--font-display); font-weight: 600; font-size: 28px; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-temp small { font-size: 13px; color: var(--text-secondary); margin-left: 2px; font-weight: 500; }
.gauge { position: relative; height: 6px; border-radius: 6px; background: color-mix(in srgb, var(--text-muted) 22%, transparent); margin: 8px 0 4px; }
.gauge .band { position: absolute; top: 0; bottom: 0; border-radius: 6px; background: var(--band); opacity: .55; }
.gauge .mark { position: absolute; top: -4px; width: 4px; height: 14px; margin-left: -2px; border-radius: 3px; background: var(--text-primary); box-shadow: 0 0 0 2px var(--surface-1); }
.gauge-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.meters { display: grid; gap: 6px; margin-top: 10px; }
.mrow { display: grid; grid-template-columns: 50px 1fr 36px; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-secondary); }
.mrow .bar { height: 6px; border-radius: 6px; background: color-mix(in srgb, var(--text-muted) 22%, transparent); overflow: hidden; }
.mrow .bar i { display: block; height: 100%; border-radius: 6px; background: var(--text-secondary); width: 0; }
.district[data-side="agent"] .mrow .bar i { background: var(--agent); }
.mrow b { text-align: right; font-weight: 600; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.gridline { margin-top: 10px; padding-top: 9px; border-top: 1px solid color-mix(in srgb, var(--text-muted) 25%, transparent); display: flex; justify-content: space-between; align-items: baseline; font-size: 11.5px; color: var(--text-secondary); }
.gridline b { font-family: var(--font-display); font-size: 15px; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.gridline .exp { color: var(--good); }
.tile.pulse-clamp { animation: glow-clamp 1.1s ease-out 1; }
.tile.pulse-fallback, .district.pulse-fallback { animation: glow-fallback 1.1s ease-out 1; }
@keyframes glow-clamp { 0% { box-shadow: 0 0 0 0 transparent; } 20% { box-shadow: 0 0 0 3px var(--clamp), 0 0 22px 2px color-mix(in srgb, var(--clamp) 60%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes glow-fallback { 0% { box-shadow: 0 0 0 0 transparent; } 20% { box-shadow: 0 0 0 3px var(--fallback), 0 0 26px 3px color-mix(in srgb, var(--fallback) 55%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }
.plan-status .tag { padding: 2px 8px; }

.scale-legend { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.scale-legend .bar { width: 160px; height: 8px; border-radius: 6px; background: linear-gradient(90deg, var(--cool), var(--band) 35%, var(--band) 65%, var(--warm)); }

/* Race: counters, controls, charts ---------------------------------------------------------------- */
.race { display: grid; gap: 14px; }
.counters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.counter { padding: 14px 16px; }
.counter .head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.counter .name { font-size: 12.5px; color: var(--text-muted); font-weight: 500; }
.counter .gap { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.counter .gap.better { color: var(--good); }
.counter .gap.worse { color: var(--bad); }
.counter .rows { display: grid; gap: 6px; margin-top: 8px; }
.counter .row { display: grid; grid-template-columns: 58px 1fr auto; gap: 8px; align-items: center; }
.counter .who { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.counter .meter { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.counter .meter i { display: block; height: 100%; width: 0; border-radius: 6px; }
.counter .row.agent .meter i { background: var(--agent); }
.counter .row.baseline .meter i { background: var(--baseline); }
.counter .val { font-family: var(--font-display); font-weight: 600; font-size: 17px; font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; }
.counter .unit { font-size: 11px; color: var(--text-muted); font-family: var(--font-body); font-weight: 500; margin-left: 3px; }

.transport { padding: 14px 16px 12px; display: grid; gap: 12px; }
.transport-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.play-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--agent); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.play-btn svg { width: 16px; height: 16px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-2); border: 1px solid var(--hairline); border-radius: 999px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; color: var(--text-secondary); cursor: pointer; font-variant-numeric: tabular-nums; }
.seg button[aria-pressed="true"] { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.event-nav { display: inline-flex; gap: 6px; margin-left: auto; }
.chip-btn { border: 1px solid var(--hairline); background: var(--surface-2); padding: 6px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.chip-btn:hover { color: var(--text-primary); border-color: var(--hairline-strong); }
.chip-btn svg { width: 12px; height: 12px; }

.scrubber { position: relative; height: 66px; touch-action: none; cursor: pointer; outline: none; }
.scrubber .price-strip { position: absolute; left: 0; top: 0; width: 100%; height: 18px; display: block; }
.price-strip path { fill: color-mix(in srgb, var(--clamp) 30%, transparent); stroke: color-mix(in srgb, var(--clamp) 75%, transparent); stroke-width: 1; vector-effect: non-scaling-stroke; }
.scrubber .track { position: absolute; left: 0; right: 0; top: 36px; height: 6px; border-radius: 6px; background: var(--surface-3); }
.scrubber .fill { position: absolute; left: 0; top: 36px; height: 6px; border-radius: 6px; background: var(--agent); width: 0; }
.scrubber .thumb { position: absolute; top: 29px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--surface-1); border: 2px solid var(--agent); box-shadow: 0 2px 8px rgba(0,0,0,.35); }
.scrubber:focus-visible .thumb { box-shadow: 0 0 0 4px color-mix(in srgb, var(--agent) 35%, transparent); }
.scrubber .ticks { position: absolute; left: 0; right: 0; top: 0; height: 100%; pointer-events: none; }
.scrubber .tick { position: absolute; top: 45px; width: 1px; height: 4px; background: var(--hairline-strong); }
.scrubber .tick.day { height: 8px; background: var(--text-muted); }
.scrubber .day-label { position: absolute; top: 52px; font-size: 10.5px; color: var(--text-muted); transform: translateX(-50%); font-variant-numeric: tabular-nums; white-space: nowrap; }
.scrubber .ev { position: absolute; top: 23px; width: 3px; height: 8px; margin-left: -1.5px; border-radius: 2px; }
.scrubber .ev.clamped { background: var(--clamp); }
.scrubber .ev.fallback { background: var(--fallback); height: 10px; top: 22px; }
.timeline-key { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 11.5px; color: var(--text-muted); }
.timeline-key span { display: inline-flex; align-items: center; gap: 6px; }
.key.price { width: 14px; height: 8px; border-radius: 2px; background: color-mix(in srgb, var(--clamp) 30%, transparent); border-top: 1px solid var(--clamp); }
.dot { display: inline-block; width: 3px; height: 9px; border-radius: 2px; }
.dot.clamp { background: var(--clamp); }
.dot.fallback { background: var(--fallback); }

.charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.section-head { padding: 0 2px 12px; }
.section-head h2 { font-size: 20px; margin: 0; }
.howto h2 { font-size: 18px; margin: 0; }
.chart-card { padding-bottom: 8px; min-width: 0; }
.chart-card .legend { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 8px 18px 0; font-size: 12px; color: var(--text-secondary); }
.chart-card .legend span { display: inline-flex; align-items: center; gap: 6px; }
.zone-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.zone-chips button { border: 1px solid var(--hairline); background: transparent; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--text-muted); cursor: pointer; }
.zone-chips button[aria-pressed="true"] { color: var(--text-primary); border-color: var(--hairline-strong); background: var(--surface-2); }
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .grid line { stroke: var(--hairline); stroke-width: 1; shape-rendering: crispEdges; }
.chart .axis text { fill: var(--text-muted); font-size: 10.5px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }
.chart .band { fill: var(--band-fill); }
.chart .band-edge { fill: none; stroke: var(--band-edge); stroke-width: 1; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .line.agent { stroke: var(--agent); }
.chart .line.baseline { stroke: var(--baseline); stroke-width: 1.75; }
.chart .line.set { stroke-width: 1.25; opacity: .7; }
.chart .ghost { opacity: .16; }
.chart .playhead { stroke: var(--text-primary); stroke-width: 1; opacity: .5; }
.chart .crosshair { stroke: var(--text-secondary); stroke-width: 1; opacity: 0; }
.chart .end-label { font-size: 11px; font-weight: 600; font-family: var(--font-body); }
.chart .end-label.agent { fill: var(--agent); }
.chart .end-label.baseline { fill: var(--baseline); }
.chart .dot { stroke: var(--surface-1); stroke-width: 2; }
.chart .dot.agent { fill: var(--agent); }
.chart .dot.baseline { fill: var(--baseline); }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 150px; padding: 9px 11px; border-radius: 10px; font-size: 12px;
  background: var(--surface-3); border: 1px solid var(--hairline-strong); box-shadow: 0 8px 24px rgba(0,0,0,.3); opacity: 0; transition: opacity .12s;
}
.tooltip .t { color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }
.tooltip .r { display: grid; grid-template-columns: 14px auto 1fr; gap: 6px; align-items: center; }
.tooltip .r b { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.tooltip .r span { color: var(--text-secondary); }

/* Reasons ---------------------------------------------------------------- */
.reasons-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 12px 18px 18px; }
.reason-card {
  border: 1px solid var(--hairline); border-radius: 14px; padding: 12px 14px; background: var(--surface-2);
  transition: opacity .35s ease, transform .35s ease;
}
.reason-card.current { background: var(--surface-1); border-color: var(--hairline-strong); }
.reason-card.current.clamped { border-color: color-mix(in srgb, var(--clamp) 55%, var(--hairline)); }
.reason-card.current.fallback { border-color: color-mix(in srgb, var(--fallback) 55%, var(--hairline)); }
.reason-card.past { opacity: .62; }
.reason-card.enter { opacity: 0; transform: translateY(-6px); }
.reason-card .meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.reason-card .text { margin-top: 6px; font-size: 14.5px; color: var(--text-primary); }
.reason-card.past .text { font-size: 13.5px; }
.reason-card ul { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.reason-card li { font-size: 12.5px; color: var(--text-secondary); display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.reason-card li code { font-size: 11.5px; color: var(--text-primary); }

/* Scorecard ---------------------------------------------------------------- */
.score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 14px; }
.score { padding: 0 0 6px; }
.score table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin-top: 10px; table-layout: fixed; }
.score th:nth-child(2), .score td:nth-child(2), .score th:nth-child(3), .score td:nth-child(3) { width: 19%; }
.score th:nth-child(4), .score td:nth-child(4) { width: 22%; }
.score td:first-child { overflow-wrap: anywhere; }
.score th { text-align: right; font-weight: 500; color: var(--text-muted); font-size: 12px; padding: 8px 18px 8px 8px; border-bottom: 1px solid var(--hairline); }
.score th:first-child, .score td:first-child { text-align: left; padding-left: 18px; }
.score td { text-align: right; padding: 9px 18px 9px 8px; border-bottom: 1px solid var(--hairline); font-variant-numeric: tabular-nums; }
.score tr:last-child td { border-bottom: 0; }
.score td .unit { display: block; font-size: 11px; color: var(--text-muted); }
.score .chg { white-space: nowrap; font-weight: 600; }
.score .chg svg { width: 11px; height: 11px; margin-right: 4px; vertical-align: -1px; }
.score .chg .word { margin-left: 5px; font-weight: 500; }
.score { overflow: hidden; }
.score .chg.better { color: var(--good); }
.score .chg.worse { color: var(--bad); }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--hairline); border-top: 1px solid var(--hairline); margin-top: 6px; }
.facts div { background: var(--surface-1); padding: 10px 18px; }
.facts .k { font-size: 11.5px; color: var(--text-muted); }
.facts .v { font-family: var(--font-display); font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* How it works ---------------------------------------------------------------- */
.how { margin-top: 26px; }
.how-title { font-family: var(--font-display); font-weight: 600; font-size: 13px; letter-spacing: 0.02em; color: var(--text-muted); margin: 0 0 10px; }
.how-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.how-step { display: flex; gap: 10px; align-items: flex-start; min-width: 0; padding: 12px 14px; background: var(--surface-1); border: 1px solid var(--hairline); border-radius: var(--radius-sm); }
.how-num { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-display); font-weight: 600; font-size: 12px; color: #fff; background: var(--agent); }
.how-step div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.how-step strong { font-family: var(--font-display); font-weight: 600; font-size: 14px; color: var(--text-primary); }
.how-step span:not(.how-num) { font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); overflow-wrap: anywhere; }

/* Run it yourself + footer ---------------------------------------------------------------- */
.howto { padding: 18px; }
.howto p { color: var(--text-secondary); margin: 6px 0 12px; font-size: 14px; }
.howto pre { margin: 0; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--hairline); overflow-x: auto; font-size: 12.5px; line-height: 1.65; color: var(--text-primary); }
.howto pre .c { color: var(--text-muted); }
.howto .howto-foot { margin: 12px 0 0; font-size: 13px; }
.howto code { font-size: 12.5px; color: var(--text-primary); }
.note {
  margin-top: 28px; padding: 16px 18px; border-radius: var(--radius); border: 1px dashed var(--hairline-strong);
  color: var(--text-secondary); font-size: 14px;
}
.note strong { color: var(--text-primary); }
footer { margin: 36px 0 48px; color: var(--text-muted); font-size: 12.5px; display: flex; flex-direction: column; gap: 10px; }
footer .footer-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; overflow-wrap: anywhere; }
footer .credit { margin: 0; line-height: 1.6; }
footer .credit a { color: var(--text-secondary); text-decoration-color: var(--hairline-strong); }
footer .credit a:hover { color: var(--text-primary); text-decoration-color: var(--agent); }
footer .credit .sep { color: var(--text-muted); margin: 0 2px; }
.empty { padding: 28px 18px; text-align: center; color: var(--text-secondary); }

/* Responsive ---------------------------------------------------------------- */
@media (max-width: 1100px) {
  .charts { grid-template-columns: 1fr 1fr; }
  .charts .chart-card:first-child { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .how-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts { grid-template-columns: 1fr; }
  .tiles { grid-template-columns: 1fr; }
  .counters { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  body { font-size: 14.5px; }
  .brand span { display: none; }
  .hero { margin-top: 28px; }
  .hero-row { display: grid; gap: 14px; }
  .play-hero { justify-content: center; }
  .deltas { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .delta { min-width: 0; padding: 10px 10px; }
  .delta .value { font-size: 19px; }
  .score table { font-size: 13px; }
  .score th, .score td { padding-right: 12px; padding-left: 4px; }
  .score th:first-child, .score td:first-child { padding-left: 14px; }
  .score td .unit { display: none; }
  .score .chg .word { display: none; }
  .facts div { padding: 9px 14px; }
  .facts .v { font-size: 14.5px; }
  .delta .verdict svg { display: none; }
  .sample-banner .long { display: none; }
  .sample-banner .short { display: inline; }
  .plan-status .tag-label { display: none; }
  .plan-status .tag { padding: 2px 7px; }
  .districts { gap: 8px; }
  .district .card-head { padding: 12px 12px 8px; }
  .district .card-sub { display: none; }
  .tiles { padding: 0 8px; gap: 8px; }
  .tile { padding: 10px 10px 9px; }
  .tile-temp { font-size: 24px; }
  .mrow { grid-template-columns: 44px 1fr 32px; font-size: 11px; }
  .dataset-pill { font-size: 11.5px; }
  .card-head { padding: 14px 14px 0; }
  .card-title { font-size: 14px; }
  .clock .when { font-size: 21px; }
  .event-nav { margin-left: 0; }
  .counter .row { grid-template-columns: 54px 1fr auto; }
  .reasons-grid { padding: 10px 14px 14px; }
  .how { margin-top: 20px; }
  .how-step { padding: 10px 11px; gap: 8px; }
  .how-step strong { font-size: 13px; }
  .howto { padding: 14px; }
  .howto pre { font-size: 11.5px; padding: 12px; }  /* commands stay whole; the box scrolls, never the page */
  .chart-card .legend { padding: 8px 14px 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
  .glow.pulse { opacity: .75; }
}
.occ-pill.peak { background: color-mix(in srgb, var(--clamp) 20%, transparent); color: var(--clamp); }
.score-grid { align-items: start; }
