:root {
  --bg: #08080d;
  --bg-elev: #11111a;
  --bg-card: rgba(24, 24, 34, 0.65);
  --bg-card-solid: #16161e;
  --border: rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f4f4f8;
  --text-muted: #7f7f8f;
  --text-dim: #5a5a6c;
  --accent: #e8002d;
  --accent-soft: rgba(232, 0, 45, 0.12);
  --accent-glow: rgba(232, 0, 45, 0.35);
  --positive: #2dd4bf;
  --warning: #f5a524;
  --negative: #f43f5e;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow-card: 0 24px 80px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  --mono: "JetBrains Mono", "SF Mono", "Menlo", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  background:
    radial-gradient(ellipse at top left, rgba(232, 0, 45, 0.10), transparent 50%),
    radial-gradient(ellipse at top right, rgba(232, 0, 45, 0.04), transparent 50%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "ss01", "cv11";
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
  overflow-x: hidden;
}

/* CRT scanlines — static, no mix-blend (forces a full recomposite every
   frame). A plain repeating gradient at low alpha gives the same look
   without the paint cost. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 999;
}

/* Holographic radial highlight — animated via translate3d so it stays
   on the GPU and never repaints. */
body::before {
  content: "";
  position: fixed;
  top: -20%;
  left: -10%;
  width: 60vw;
  height: 60vh;
  background: radial-gradient(circle, rgba(232, 0, 45, 0.05), transparent 65%);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  animation: hud-drift 24s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}

@keyframes hud-drift {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(20vw, 30vh, 0); }
}

/* ---------- HUD intro animations ----------
   All animations stick to transform + opacity (GPU only). No filter,
   no letter-spacing, no width/height. Smooth on any decent machine. */
@keyframes hud-reveal {
  0%   { opacity: 0; transform: translate3d(0, 14px, 0); }
  100% { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes hud-clip-reveal {
  0%   { clip-path: inset(0 100% 0 0); }
  100% { clip-path: inset(0 0 0 0); }
}

@keyframes hud-pop-in {
  0%   { opacity: 0; transform: translate3d(0, 16px, 0) scale(0.985); }
  100% { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

/* Use clip-path (GPU) instead of width (layout) for the typewriter — same
   visual result, none of the reflow cost. */
.eyebrow {
  display: inline-block;
  white-space: nowrap;
  will-change: clip-path;
  animation: hud-clip-reveal 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}

.page-title {
  will-change: transform, opacity;
  animation: hud-reveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.18s both;
}

.page-subtitle {
  will-change: transform, opacity;
  animation: hud-reveal 0.6s cubic-bezier(0.22, 1, 0.36, 1) 0.36s both;
}

.stat-tile,
.card.race-card {
  will-change: transform, opacity;
  animation: hud-pop-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Tighter stagger — 60ms between cards instead of 100ms — feels more
   like a single continuous reveal rather than discrete pop-ins. */
.stat-tiles .stat-tile:nth-child(1) { animation-delay: 0.40s; }
.stat-tiles .stat-tile:nth-child(2) { animation-delay: 0.46s; }
.stat-tiles .stat-tile:nth-child(3) { animation-delay: 0.52s; }
.stat-tiles .stat-tile:nth-child(4) { animation-delay: 0.58s; }
.stat-tiles .stat-tile:nth-child(5) { animation-delay: 0.64s; }

.card.section-row {
  will-change: transform, opacity;
  animation: hud-pop-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.55s both;
}

/* Strip will-change once animations are done so we don't keep promoting
   layers forever (drains battery, hurts other interactions). */
.eyebrow,
.page-title,
.page-subtitle,
.stat-tile,
.card.race-card,
.card.section-row {
  animation-fill-mode: both;
}

a {
  color: var(--text);
  text-decoration: none;
  transition: color 0.15s ease, opacity 0.15s ease;
}
a:hover {
  color: var(--accent);
}

/* ---------- header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 48px;
  padding: 18px 56px 18px 32px;
  background: rgba(8, 8, 13, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #ff3b56, var(--accent));
  box-shadow:
    0 0 16px var(--accent-glow),
    inset 0 -2px 6px rgba(0, 0, 0, 0.4);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-line-1 {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text);
}

.brand-line-2 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-top: 2px;
}

.primary-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  background: rgba(20, 20, 28, 0.5);
  padding: 6px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.primary-nav a {
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.primary-nav a.is-active {
  color: var(--text);
  background: var(--bg-card-solid);
  box-shadow: inset 0 0 0 1px var(--border-strong), 0 2px 12px rgba(0, 0, 0, 0.4);
}

.primary-nav a:hover {
  color: var(--text);
}

/* ---------- F1 starting lights side rail ---------- */
.f1-lights {
  position: fixed;
  top: 50%;
  right: 16px;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 7px;
  border-radius: 999px;
  background: rgba(8, 8, 13, 0.5);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px);
  z-index: 5;
  pointer-events: none;
}

.f1-light {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.f1-light.active {
  background: var(--accent);
  box-shadow:
    0 0 10px var(--accent-glow),
    0 0 20px rgba(232, 0, 45, 0.4);
}

@media (max-width: 900px) {
  .f1-lights {
    display: none;
  }
}

/* ---------- main ---------- */
main {
  padding: 48px 80px 80px 56px;
  max-width: 1500px;
  margin: 0 auto;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 18px;
}

.page-title {
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.02;
  margin-bottom: 6px;
}

.page-title .accent-soft {
  color: var(--text-dim);
  font-weight: 400;
}

.page-subtitle {
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.04em;
  margin-bottom: 36px;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.toolbar select,
.toolbar input {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-family: var(--mono);
  font-size: 12px;
  min-width: 140px;
  letter-spacing: 0.04em;
}

.toolbar select:focus,
.toolbar input:focus {
  outline: none;
  border-color: var(--accent);
}

.toolbar label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ---------- big stat tiles ---------- */
.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
}

.stat-tile::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto auto;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle at 100% 0%, rgba(232, 0, 45, 0.05), transparent 60%);
  pointer-events: none;
}

/* HUD corner brackets — Marvel/Iron Man-style L-marks on stat tiles + cards. */
.stat-tile::after,
.card::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 14px;
  height: 14px;
  border-top: 1px solid rgba(232, 0, 45, 0.55);
  border-right: 1px solid rgba(232, 0, 45, 0.55);
  pointer-events: none;
  z-index: 2;
}

.stat-tile .corner-bl,
.card .corner-bl {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 14px;
  height: 14px;
  border-bottom: 1px solid rgba(232, 0, 45, 0.55);
  border-left: 1px solid rgba(232, 0, 45, 0.55);
  pointer-events: none;
  z-index: 2;
}

.stat-tile .label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 8px;
  display: block;
  font-weight: 600;
}

.stat-tile .value {
  font-family: var(--mono);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}

.stat-tile .value .unit {
  font-size: 14px;
  color: var(--text-muted);
  margin-left: 8px;
  font-weight: 500;
}

.stat-tile .sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 10px;
  letter-spacing: 0.04em;
}

/* ---------- cards / grids ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

/* subtle red ambient glow in the top-left corner of every card */
.card::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto auto;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle at 0% 0%, rgba(232, 0, 45, 0.08), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.card > * {
  position: relative;
  z-index: 1;
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 16px;
}

.card h3 {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  font-weight: 600;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.cols-3 {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.grid.cols-2 {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
}

.grid.cols-stats {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* ---------- race calendar cards ---------- */
.race-card {
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
  padding: 24px;
  position: relative;
  min-height: 130px;
}
.race-card:hover {
  transform: translateY(-2px);
  border-color: rgba(232, 0, 45, 0.4);
}

.race-card .status-dot {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--positive);
  box-shadow: 0 0 10px rgba(45, 212, 191, 0.5);
}

.race-card .status-dot.empty {
  background: var(--text-dim);
  box-shadow: none;
}

.race-card .round {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
}

.race-card .name {
  font-size: 22px;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: -0.01em;
}

.race-card .win-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.race-card .win-row .driver-code {
  color: var(--text);
  font-weight: 600;
  letter-spacing: 0.04em;
}

/* ---------- tables ---------- */
.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.results-table th,
.results-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.results-table th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.results-table tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.results-table .pos-cell {
  width: 40px;
  font-weight: 600;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tag.team-RBR { background: #1e3a8a; color: #fff; }
.tag.team-MCL { background: #ff8000; color: #1a1a24; }
.tag.team-FER { background: #dc0000; color: #fff; }
.tag.team-MER { background: #00d2be; color: #1a1a24; }
.tag.team-AST { background: #006f62; color: #fff; }
.tag.team-ALP { background: #0090ff; color: #fff; }
.tag.team-WIL { background: #005aff; color: #fff; }
.tag.team-RB  { background: #6692ff; color: #1a1a24; }
.tag.team-SAU { background: #52e252; color: #1a1a24; }
.tag.team-HAA { background: #b6babd; color: #1a1a24; }

/* ---------- charts ---------- */
.chart-container {
  position: relative;
  height: 360px;
}

.chart-container.chart-tall {
  height: 460px;
}

.chart-container canvas {
  max-width: 100%;
}

/* ---------- section rows ---------- */
.section-row {
  margin-bottom: 20px;
}

.section-row:last-child {
  margin-bottom: 0;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
}

.view-toggle {
  display: inline-flex;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.view-toggle button {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.view-toggle button:hover {
  color: var(--text);
}

.view-toggle button.active {
  background: var(--accent);
  color: #fff;
}

/* ---------- driver / team cells ---------- */
.driver-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.driver-cell .flag {
  font-size: 18px;
  line-height: 1;
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.3));
}

.driver-cell .driver-name {
  font-weight: 500;
}

.team-swatch {
  display: inline-block;
  width: 4px;
  height: 14px;
  border-radius: 2px;
  vertical-align: -2px;
  margin-right: 8px;
}

.team-name {
  font-weight: 500;
}

.pts-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---------- prediction card ---------- */
.prediction-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.prediction-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.prediction-team {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.prediction-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 12px;
}

.prediction-headline {
  display: flex;
  gap: 16px;
  text-align: right;
}

.prediction-headline .metric {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.prediction-headline .metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.prediction-headline .metric-label {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
}

.prediction-summary {
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.reasoning {
  color: var(--text-muted);
  font-size: 13px;
  margin-top: -8px;
}

.muted-h3 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 6px 0 6px;
}

.scenario-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.scenario-table th,
.scenario-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.scenario-table th {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.verdict.warn {
  border-left-color: var(--warning);
  background: rgba(245, 165, 36, 0.12);
}

/* ---------- predictor ---------- */
.predictor-cols {
  grid-template-columns: 1fr 1fr;
}

.predictor-table th,
.predictor-table td {
  padding: 8px 10px;
  font-size: 13px;
}

.conf-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.conf-bar {
  display: block;
  height: 6px;
  background: var(--bg-elev);
  border-radius: 3px;
  overflow: hidden;
  flex: 1;
  min-width: 60px;
}

.conf-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff5e7a);
}

.conf-score {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
  min-width: 56px;
  text-align: right;
}

.conf-score-suffix {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 11px;
}

.metric-big {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  margin: 0;
}

.driver-pos {
  margin-left: auto;
  color: var(--text-muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  background: var(--bg-elev);
  padding: 2px 6px;
  border-radius: 3px;
}

/* ---------- driver-row click + modal ---------- */
.driver-prediction-row {
  cursor: pointer;
  transition: background 0.15s ease;
}
.driver-prediction-row:hover td {
  background: rgba(232, 0, 45, 0.06);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
  overflow-y: auto;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 720px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 20px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover {
  background: var(--accent);
  border-color: var(--accent);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.modal-header h2 {
  font-size: 22px;
  margin: 0;
}

.signal-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.signal-row {
  display: grid;
  grid-template-columns: 260px 1fr 50px;
  gap: 14px;
  align-items: center;
}

.signal-row.missing {
  opacity: 0.45;
}

.signal-label {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

.signal-sub {
  color: var(--text-muted);
  font-size: 11px;
  margin-top: 2px;
}

.signal-bar {
  height: 8px;
  background: var(--bg-elev);
  border-radius: 4px;
  overflow: hidden;
  display: block;
}

.signal-bar .fill {
  display: block;
  height: 100%;
}

.signal-score {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.reasoning-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.reasoning-list li {
  background: var(--bg-elev);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.55;
}

.reasoning-list li.muted {
  color: var(--text-muted);
}

/* ---------- track map ---------- */
.track-map-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.track-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 8px;
}

.track-name {
  margin: 0;
  font-size: 18px;
}

.track-legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 11px;
  color: var(--text-muted);
}

.track-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  vertical-align: -1px;
  margin-right: 5px;
}

.track-svg {
  width: 100%;
  height: auto;
  max-height: 560px;
  background: var(--bg-elev);
  border-radius: var(--radius-sm);
}

.track-notes {
  color: var(--text-muted);
  font-size: 13px;
  margin: 8px 0 0;
}

/* ---------- qualifying viewer ---------- */
.qual-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.qual-tabs {
  display: inline-flex;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
  align-self: flex-start;
}

.qual-tab {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 16px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
}

.qual-tab.active {
  background: var(--accent);
  color: #fff;
}

.qual-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.qual-row {
  display: grid;
  grid-template-columns: 40px 1fr 100px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-elev);
  border-radius: 6px;
  font-size: 13px;
  transition: background 0.15s ease;
}

.qual-row:hover {
  background: rgba(232, 0, 45, 0.06);
}

.qual-row.eliminated {
  opacity: 0.45;
}

.qual-pos {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: center;
  color: var(--text-muted);
}

.qual-driver {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.qual-driver .flag {
  font-size: 16px;
}

.qual-driver .driver-name {
  font-weight: 600;
}

.qual-team-pill {
  display: inline-block;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  margin-left: 10px;
}

.qual-team-name {
  color: var(--text-muted);
  font-size: 11px;
}

.qual-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  text-align: right;
}

.qual-gap-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qual-gap-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
}

.qual-gap-bar span {
  display: block;
  height: 100%;
}

.qual-gap-text {
  width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text-muted);
}

/* ---------- driver analysis modal extras ---------- */
.modal-xl {
  max-width: 1000px;
}

.track-3d-container {
  width: 100%;
  height: 360px;
  border-radius: var(--radius-sm);
  background: #0a0a0f;
  overflow: hidden;
  margin-top: 8px;
}

.track-3d-container canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  cursor: grab;
}

.track-3d-container canvas:active {
  cursor: grabbing;
}

/* ---------- modal HUD "scanning" intro ---------- */
.scan-intro {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 13, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 5;
  font-family: var(--mono);
  letter-spacing: 0.18em;
  pointer-events: none;
  border-radius: inherit;
}

.scan-intro .scan-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  box-shadow: 0 0 12px var(--accent);
  animation: scan-sweep 1.2s cubic-bezier(0.45, 0.05, 0.55, 0.95) infinite;
}

.scan-intro .scan-text {
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
}

.scan-intro .scan-progress {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

@keyframes scan-sweep {
  0%   { top: 12%; }
  100% { top: 88%; }
}

/* count-up affordance: hide raw number until JS reveals it */
.stat-tile .value.counting {
  color: var(--accent);
}

.analysis-prose p {
  margin: 0 0 12px;
  line-height: 1.65;
  font-size: 14px;
  color: var(--text);
}

.analysis-prose p.muted {
  color: var(--text-muted);
  font-size: 13px;
}

.analysis-prose strong {
  color: var(--accent);
  font-weight: 700;
}

.analysis-prose .verdict-line {
  margin-top: 16px;
  padding: 12px 14px;
  background: rgba(232, 0, 45, 0.1);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
}

.reasoning-prose {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.55;
}

/* ---------- fingerprint dimension bars ---------- */
.dimension-bar {
  display: grid;
  grid-template-columns: 180px 1fr 50px;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
}
.dimension-bar .label { font-size: 13px; color: var(--text-muted); }
.dimension-bar .track {
  height: 6px;
  background: var(--bg-elev);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}
.dimension-bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff5e7a);
  border-radius: 999px;
}
.dimension-bar .value { font-size: 13px; font-variant-numeric: tabular-nums; text-align: right; }

.verdict {
  margin-top: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  font-size: 14px;
}

.confidence-band {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.confidence-band .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--positive);
}
.confidence-band.med .dot { background: var(--warning); }
.confidence-band.low .dot { background: var(--negative); }

/* ---------- loader / errors ---------- */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 14px;
  color: var(--text-muted);
}
.spinner {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  padding: 16px 20px;
  border: 1px solid var(--negative);
  border-radius: var(--radius-sm);
  background: rgba(244, 63, 94, 0.08);
  color: var(--text);
}

/* ---------- footer ---------- */
.site-footer {
  padding: 24px 32px 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  border-top: 1px solid var(--border);
  margin-top: 80px;
}

@media (max-width: 720px) {
  main { padding: 16px; }
  .site-header { flex-direction: column; align-items: flex-start; gap: 12px; padding: 12px 16px; }
  .primary-nav { width: 100%; overflow-x: auto; }
}
