:root {
  /* Page chrome — Airbnb-inspired airy white palette */
  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-card: #ffffff;
  --bg-soft: #f7f7f7;           /* hover fills, very subtle elevation */
  --bg-muted: #fafafa;          /* page background tints */
  --fg: #222222;                /* Airbnb primary text */
  --fg-dim: #717171;            /* Airbnb secondary text */
  --muted: #b0b0b0;             /* tertiary */
  --accent: #ff385c;            /* Airbnb Rausch */
  --accent-hover: #e00b41;
  --accent-glow: rgba(255, 56, 92, 0.18);
  --accent-soft: #fff1f3;       /* very pale pink for tinted backgrounds */

  /* Team colors — split for readability across light bg vs dark pitch */
  --home-color: #c08020;        /* warm amber, readable on white */
  --home-color-vivid: #fde047;  /* bright yellow, pops on green pitch */
  --away-color: #ff385c;        /* Airbnb Rausch — completes the look on light bg */
  --away-color-vivid: #fb7185;  /* bright rose, pops on green pitch */

  /* Pitch (green is universal across both themes) */
  --pitch-base: #2e7a3a;
  --pitch-stripe-a: #318642;
  --pitch-stripe-b: #266830;
  --pitch-surround: #1f5028;
  --pitch-line: #ffffff;
  --pitch-spot: #ffffff;
  --flag-pole: #fef9c3;
  --flag-cloth: #ff385c;        /* corner flag now matches accent */

  /* Tooltip stays dark — it floats over both white page AND dark pitch */
  --tooltip-bg: rgba(34, 34, 34, 0.96);
  --tooltip-fg: #ffffff;

  --border: #ebebeb;            /* Airbnb's standard border */
  --border-soft: #f7f7f7;

  --radius: 10px;
  --radius-lg: 14px;
  --shadow-card: 0 6px 16px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-card-hover: 0 8px 28px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.06);
  --shadow-pitch: 0 12px 36px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
  --transition: 0.18s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", "Circular", "SF Pro Display", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "ss01", "cv11";
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.005em;
}

/* ─── Hero header ─────────────────────────────────────────────── */

.hero {
  border-bottom: 1px solid var(--border);
  padding: 2.25rem 1.5rem 1.5rem;
  background: linear-gradient(180deg, var(--accent-soft), transparent 80%);
}

.hero-inner {
  max-width: 1300px;
  margin: 0 auto;
}

.kicker {
  margin: 0 0 0.45rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.kicker .icon-soccer {
  width: 1.05em;
  height: 1.05em;
  color: var(--accent);
}

h1 {
  font-size: clamp(1.5rem, 2.4vw + 0.6rem, 2.15rem);
  margin: 0 0 0.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.12;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
}

h1 .trophy {
  flex-shrink: 0;
  width: 1em;
  height: 1em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

h1 .trophy svg {
  width: 100%;
  height: 100%;
  color: var(--accent);
}

/* Flag SVG (used in titles + stats card) */
.flag-svg {
  display: inline-block;
  width: 1.25em;
  height: 0.83em;
  vertical-align: -0.08em;
  border-radius: 2px;
  box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.18), 0 1px 2px rgba(0, 0, 0, 0.06);
  overflow: hidden;
  flex-shrink: 0;
}

/* H1 title structure: trophy + team[flag, name] + vs + team[flag, name] + score */
.title-team {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.title-team .flag-svg {
  width: 1.4em;
  height: 0.93em;
}

.title-team-name {
  font-weight: 700;
}

.title-vs {
  color: var(--fg-dim);
  font-weight: 500;
  font-size: 0.78em;
  padding: 0 0.15em;
}

.title-score {
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 0.78em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.18em 0.5em;
  border-radius: 8px;
  margin-left: 0.3em;
  font-weight: 700;
}

.subtitle {
  margin: 0 0 1rem;
  color: var(--fg-dim);
  font-size: 0.9rem;
}

.picker-grid {
  display: grid;
  grid-template-columns: minmax(280px, 2fr) minmax(180px, 1fr) minmax(140px, 1fr);
  gap: 0.6rem;
}

.picker-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.picker-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}

.picker-grid select {
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.picker-grid select:hover,
.picker-grid select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
  outline: none;
}

#error-banner {
  display: none;
  background: #fee2e2;
  color: #991b1b;
  border-bottom: 1px solid #fca5a5;
  padding: 0.75rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}

.tab-kbd {
  display: inline-block;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--muted);
  background: var(--border-soft);
  padding: 0.05rem 0.32rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: 0.06em;
  transition: background var(--transition), color var(--transition);
}

.tabs button.active .tab-kbd {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.empty-layer-msg {
  fill: rgba(255, 255, 255, 0.85);
  font-size: 2.2px;
  font-weight: 600;
  text-anchor: middle;
  font-family: inherit;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.5);
  stroke-width: 0.18px;
}

/* ─── Controls row (tabs + replay) ─────────────────────────────── */

.controls-row {
  max-width: 1300px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
  display: grid;
  gap: 0.75rem;
}

.tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tabs button {
  background: var(--bg-elev);
  color: var(--fg-dim);
  border: 1px solid var(--border);
  padding: 0.5rem 1.05rem;
  cursor: pointer;
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: all var(--transition);
}

.tabs button:hover:not(.active) {
  border-color: var(--accent);
  color: var(--accent);
}

.tabs button.active {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.replay {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: wrap;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.replay #play-btn {
  background: var(--accent);
  color: #ffffff;
  border: none;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.12s ease, box-shadow var(--transition);
  box-shadow: 0 2px 12px var(--accent-glow);
}

.replay #play-btn:hover { transform: scale(1.08); background: var(--accent-hover); }
.replay #play-btn:active { transform: scale(0.92); }

.replay #scrubber {
  flex: 1;
  min-width: 200px;
  accent-color: var(--accent);
  cursor: pointer;
}

.replay .clock {
  font-family: ui-monospace, "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 4.5ch;
  text-align: right;
}

.replay .speed-label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.replay .speed-label select {
  background: var(--bg-elev);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.25rem 0.45rem;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

/* ─── Layout: main + sidebar ───────────────────────────────────── */

main {
  max-width: 1300px;
  margin: 1.25rem auto 0;
  padding: 0 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.pitch-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

#pitch {
  width: 100%;
  height: auto;
  display: block;
  background: var(--pitch-surround);  /* matches the in-SVG surround rect during the brief pre-render moment */
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pitch);
}

.sidebar {
  flex: 0 0 260px;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  position: sticky;
  top: 1rem;
  align-self: flex-start;
}

/* ─── Card primitive ───────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.95rem 1rem;
  box-shadow: var(--shadow-card);
}

.card-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.7rem;
}

/* ─── Stats card ───────────────────────────────────────────────── */

.stats-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 0.4rem;
  align-items: center;
  padding-bottom: 0.7rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px dashed var(--border);
}

.stats-team {
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.stats-team .flag-svg {
  width: 1.4em;
  height: 0.93em;
  flex-shrink: 0;
}

.stats-team-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.stats-team-home { color: var(--home-color); }
.stats-team-home .stats-team-name { text-align: left; }
.stats-team-away { color: var(--away-color); justify-content: flex-end; }
.stats-team-away .stats-team-name { text-align: right; }

.stats-vs {
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--fg);
  padding: 0 0.4rem;
  white-space: nowrap;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1.1fr 1fr;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 0.85rem;
}

.stats-row + .stats-row { border-top: 1px solid var(--border-soft); }

.stats-num {
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-weight: 600;
  font-size: 0.95rem;
}

.stats-home { color: var(--home-color); text-align: left; }
.stats-away { color: var(--away-color); text-align: right; }

.stats-key {
  text-align: center;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ─── Legend ───────────────────────────────────────────────────── */

#legend {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  line-height: 1.3;
}

.legend-spacer { width: 22px; flex-shrink: 0; }

.legend-swatch {
  width: 22px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

.legend-swatch.swatch-circle {
  border-radius: 50%;
  width: 14px;
  height: 14px;
}

.legend-swatch.swatch-line {
  height: 4px;
  align-self: center;
}

.legend-swatch.swatch-line-dashed {
  height: 0;
  border-top: 3px dashed currentColor;
  background: transparent !important;
  align-self: center;
}

.legend-label { color: var(--fg); font-size: 0.85rem; }
.legend-note { color: var(--muted); font-style: italic; font-size: 0.78rem; }

/* ─── xG Timeline ─────────────────────────────────────────────── */

.chart-row {
  max-width: 1300px;
  margin: 1rem auto 0;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 980px) {
  .chart-row { grid-template-columns: 1fr; }
}

.chart-card { padding-bottom: 0.5rem; }

.xg-advantage-host { width: 100%; min-height: 110px; }
.xg-adv-svg { width: 100%; height: 110px; display: block; }

.xg-adv-zero {
  stroke: var(--border);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.xg-adv-area { stroke: none; }
.xg-adv-home { fill: var(--home-color); opacity: 0.55; }
.xg-adv-away { fill: var(--away-color); opacity: 0.55; }

.xg-adv-line {
  fill: none;
  stroke: var(--fg);
  stroke-width: 1.4;
  stroke-linejoin: round;
}

.xg-timeline-host { width: 100%; min-height: 150px; }

.xg-svg { width: 100%; height: 150px; display: block; }

.xg-grid line {
  stroke: var(--border-soft);
  stroke-width: 1;
  shape-rendering: crispEdges;
}

.xg-axis text {
  fill: var(--muted);
  font-size: 10px;
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
}

.xg-axis-label {
  fill: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-family: inherit;
}

.xg-line {
  fill: none;
  stroke-width: 2.4;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.xg-home { stroke: var(--home-color); }
.xg-away { stroke: var(--away-color); }

.xg-goal-tick {
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.55;
}

.xg-goal-home .xg-goal-tick { stroke: var(--home-color); }
.xg-goal-away .xg-goal-tick { stroke: var(--away-color); }

.xg-goal circle {
  stroke: #ffffff;
  stroke-width: 1.2;
  cursor: pointer;
  filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.2));
}

.xg-goal-home circle { fill: var(--home-color); }
.xg-goal-away circle { fill: var(--away-color); }

.xg-cursor {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
  pointer-events: none;
}

.xg-legend {
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
}

/* The two xg-legend texts at the top-right pick up their color from inline style;
   reset stroke-related properties to avoid leakage */
.xg-legend { stroke: none; }

/* ─── Pitch primitives ─────────────────────────────────────────── */

.pitch-bg { fill: var(--pitch-base); }
.pitch-stripe-a { fill: var(--pitch-stripe-a); }
.pitch-stripe-b { fill: var(--pitch-stripe-b); }

.pitch-surround {
  fill: var(--pitch-surround);
  /* very subtle inner shadow on the pitch boundary, drawn from the surround side */
}

.pitch-line {
  stroke: var(--pitch-line);
  stroke-width: 0.18;
  fill: none;
  opacity: 0.92;
}

.pitch-boundary {
  stroke-width: 0.24;
  opacity: 1;
}

.pitch-spot { fill: var(--pitch-spot); opacity: 0.92; }

.goal-net {
  fill: rgba(255, 255, 255, 0.10);
  stroke: rgba(255, 255, 255, 0.65);
  stroke-width: 0.12;
}

.goal-net-mesh {
  stroke: rgba(255, 255, 255, 0.32);
  stroke-width: 0.05;
  pointer-events: none;
}

.corner-flag-pole {
  stroke: var(--flag-pole);
  stroke-width: 0.13;
  stroke-linecap: round;
}

.corner-flag {
  fill: var(--flag-cloth);
  stroke: var(--flag-pole);
  stroke-width: 0.05;
  stroke-linejoin: round;
}

/* ─── Shots layer ──────────────────────────────────────────────── */

.shot {
  stroke: #ffffff;
  stroke-width: 0.1;
  cursor: pointer;
  transition: opacity var(--transition), stroke-width var(--transition);
}

.shot.goal { fill: #ef4444; filter: drop-shadow(0 0 1.5px rgba(239, 68, 68, 0.8)); }
.shot.miss { fill: #cbd5e1; opacity: 0.85; }
.shot:hover { opacity: 1; stroke-width: 0.2; }

/* ─── Passes layer ─────────────────────────────────────────────── */

.pass {
  stroke-width: 0.25;
  cursor: pointer;
  transition: stroke-width var(--transition), opacity var(--transition);
}

.pass.completed { stroke: #38bdf8; opacity: 0.78; }
.pass.incomplete { stroke: #f87171; opacity: 0.6; stroke-dasharray: 0.6 0.4; }
.pass:hover { stroke-width: 0.55; opacity: 1; }

/* ─── Heatmap layer ────────────────────────────────────────────── */

.heat { stroke: none; pointer-events: none; }

/* ─── Carries layer (on green pitch, use vivid colors) ────────── */

.carry-trail {
  stroke-width: 0.2;
  opacity: 0.65;
  cursor: pointer;
  transition: stroke-width var(--transition), opacity var(--transition);
}

.carry-trail.carry-home { stroke: var(--home-color-vivid); }
.carry-trail.carry-away { stroke: var(--away-color-vivid); }
.carry-trail:hover { stroke-width: 0.5; opacity: 1; }

.carry-dot {
  stroke: #ffffff;
  stroke-width: 0.14;
  pointer-events: none;
  filter: drop-shadow(0 0 0.7px rgba(0, 0, 0, 0.7));
}

.carry-dot.carry-home { fill: var(--home-color-vivid); }
.carry-dot.carry-away { fill: var(--away-color-vivid); }

/* ─── Lineups layer ────────────────────────────────────────────── */

.lineup-player { cursor: pointer; }

.lineup-dot {
  stroke: rgba(15, 23, 42, 0.6);
  stroke-width: 0.22;
  transition: r var(--transition);
}

.lineup-dot.lineup-home { fill: var(--home-color-vivid); }
.lineup-dot.lineup-away { fill: var(--away-color-vivid); }

.lineup-player:hover .lineup-dot {
  stroke-width: 0.4;
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.55));
}

.lineup-number {
  font-size: 1.7px;
  font-weight: 700;
  fill: rgba(15, 23, 42, 0.85);
  pointer-events: none;
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
}

.lineup-name {
  font-size: 1.6px;
  font-weight: 700;
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.7);
  stroke-width: 0.22;
  pointer-events: none;
  font-family: inherit;
}

.lineup-position {
  font-size: 1.35px;
  font-weight: 600;
  fill: rgba(255, 255, 255, 0.92);
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.65);
  stroke-width: 0.18;
  pointer-events: none;
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.04em;
}

/* ─── Network layer ────────────────────────────────────────────── */

.network-edge {
  pointer-events: none;
}

.network-edge-home { stroke: var(--home-color-vivid); }
.network-edge-away { stroke: var(--away-color-vivid); }

.network-node { cursor: pointer; }

.network-dot {
  stroke: #ffffff;
  stroke-width: 0.22;
  filter: drop-shadow(0 0 0.8px rgba(0, 0, 0, 0.6));
  transition: stroke-width var(--transition);
}

.network-dot-home { fill: var(--home-color-vivid); }
.network-dot-away { fill: var(--away-color-vivid); }

.network-node:hover .network-dot { stroke-width: 0.5; }

.network-label {
  font-size: 1.4px;
  font-weight: 700;
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.75);
  stroke-width: 0.18;
  pointer-events: none;
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  text-anchor: middle;
}

/* ─── xT layer ─────────────────────────────────────────────────── */

.xt-action { cursor: pointer; transition: opacity var(--transition), stroke-width var(--transition); }
.xt-action:hover { opacity: 1 !important; stroke-width: 0.8 !important; }

/* ─── Defensive actions layer ──────────────────────────────────── */

.def-action {
  stroke: #ffffff;
  stroke-width: 0.1;
  cursor: pointer;
  transition: r var(--transition);
}
.def-action:hover { stroke-width: 0.2; }

/* ─── Set pieces layer ─────────────────────────────────────────── */

.sp-line { pointer-events: none; }

.sp-origin {
  cursor: pointer;
  transition: r var(--transition);
}
.sp-origin:hover { stroke-width: 0.2; }

/* ─── Tooltip ──────────────────────────────────────────────────── */

#tooltip {
  position: fixed;
  display: none;
  background: var(--tooltip-bg);
  color: var(--tooltip-fg);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
  line-height: 1.45;
  pointer-events: none;
  max-width: 280px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  z-index: 1000;
  white-space: pre-line;
  word-wrap: break-word;
  backdrop-filter: blur(8px);
}

/* ─── Footer ───────────────────────────────────────────────────── */

footer {
  max-width: 1300px;
  margin: 2rem auto 1.5rem;
  padding: 1rem 1.5rem 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
  border-top: 1px solid var(--border);
}

footer code, footer kbd {
  background: var(--bg-elev);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: ui-monospace, "Cascadia Code", Menlo, Consolas, monospace;
  font-size: 0.78rem;
  border: 1px solid var(--border);
}

footer a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px dotted var(--accent);
}

footer a:hover { border-bottom-style: solid; }

/* ─── Responsive ───────────────────────────────────────────────── */

@media (max-width: 980px) {
  main { flex-direction: column; }
  .sidebar { flex: 1 1 auto; position: static; width: 100%; flex-direction: row; }
  .sidebar > .card { flex: 1; }
}

@media (max-width: 640px) {
  .hero { padding: 1.25rem 1rem 1rem; }
  .controls-row, main, .chart-row, footer { padding-left: 1rem; padding-right: 1rem; }
  .sidebar { flex-direction: column; }
  .replay { gap: 0.5rem; }
  .picker-grid { grid-template-columns: 1fr; }
  .tabs button { padding: 0.4rem 0.7rem; font-size: 0.82rem; }
  .tab-kbd { display: none; }
  h1 { font-size: 1.15rem; }
  .stats-row { font-size: 0.8rem; }
  .stats-num { font-size: 0.88rem; }
}
