/* Slipstream — view-specific styles in the F1 visual language. */

/* ---- Home hero ---- */
.hero {
  position: relative; height: 330px; margin-bottom: 16px;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--line);
  background: linear-gradient(to bottom, #14151d 0%, #0b0b0f 78%);
}
/* F1 square-grid motif, fading toward the bottom */
.hero::before {
  content: ""; position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 30px 30px;
  -webkit-mask-image: radial-gradient(125% 95% at 50% 0%, #000 0%, transparent 72%);
  mask-image: radial-gradient(125% 95% at 50% 0%, #000 0%, transparent 72%);
}
/* Red accent slash, top-right */
.hero::after {
  content: ""; position: absolute; top: 0; right: 0; width: 90px; height: 6px;
  background: var(--accent); clip-path: polygon(18% 0, 100% 0, 100% 100%, 0 100%);
}
.hero-stage { position: absolute; inset: 0; }
.three-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  color: var(--text-mute); font-size: 13px;
}
.hero-overlay {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 20px;
  background: linear-gradient(to top, rgba(11, 11, 15, 0.96) 10%, rgba(11, 11, 15, 0));
  pointer-events: none;
}
.wordmark { font-size: 40px; font-weight: 900; letter-spacing: 0.01em; text-transform: uppercase; line-height: 0.95; }
.tagline {
  color: var(--text-dim); margin-top: 7px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase;
  padding-left: 13px; position: relative;
}
.tagline::before {
  content: ""; position: absolute; left: 0; top: 2px; bottom: 2px; width: 4px;
  background: var(--accent); clip-path: polygon(40% 0, 100% 0, 60% 100%, 0 100%);
}

/* ---- Home quick stats (broadcast number blocks) ---- */
.home-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat-card {
  position: relative; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 15px 10px 13px; text-align: center; overflow: hidden;
}
.stat-card::before { content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); }
.stat-num { font-size: 26px; font-weight: 900; color: var(--text); line-height: 1; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 10px; color: var(--text-mute); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700; margin-top: 7px; }

/* ---- Home big nav cards (angular, with chevron) ---- */
.home-actions { display: flex; flex-direction: column; gap: 10px; }
.big-btn {
  position: relative; display: block; padding: 17px 44px 17px 18px;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform 0.12s ease, border-color 0.15s, background 0.15s;
}
.big-btn::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent);
  opacity: 0; transition: opacity 0.15s;
}
.big-btn::after {
  content: "\203A"; position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1;
}
.big-btn:active { transform: scale(0.99); border-color: var(--accent); background: var(--bg-elev-2); }
.big-btn:active::before { opacity: 1; }
.big-btn-title { font-weight: 800; font-size: 16px; letter-spacing: 0.02em; text-transform: uppercase; }
.big-btn-sub { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; font-weight: 600; }
/* featured primary action (Start a Race) — accent-filled so the core verb leads the screen */
.big-btn-feature { background: linear-gradient(135deg, var(--accent) 0%, var(--accent-soft, var(--accent)) 100%); border-color: transparent; }
.big-btn-feature::before { opacity: 1; background: rgba(255, 255, 255, 0.55); }
.big-btn-feature::after { color: #fff; }
.big-btn-feature .big-btn-title { color: #fff; }
.big-btn-feature .big-btn-sub { color: rgba(255, 255, 255, 0.85); }
.big-btn-feature:active { border-color: transparent; }

/* ---- Misc ---- */
.dev-note {
  margin-top: 16px; font-size: 11px; color: var(--text-mute); line-height: 1.6;
  letter-spacing: 0.02em; border-top: 1px solid var(--line-soft); padding-top: 12px;
}

/* ---- Garage: team tile with livery badge ---- */
.team-tile { padding: 10px; align-items: center; gap: 12px; }
.team-tile .tile-main { padding: 0; }
.livery-badge {
  width: 50px; height: 50px; flex: 0 0 auto; position: relative; overflow: hidden;
  border-radius: var(--radius-sm); border: 1px solid rgba(255, 255, 255, 0.08);
}
.livery-badge-stripe { position: absolute; left: 0; right: 0; bottom: 0; height: 9px; }
.livery-badge-em { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 9px; }

/* ---- Livery editor (3D car customizer) ---- */
.livery-editor { padding-bottom: 88px; }
.car-stage {
  position: sticky; top: calc(var(--header-h) + var(--safe-top)); z-index: 50;
  height: 172px; margin-bottom: 16px; overflow: hidden;
  border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: radial-gradient(120% 100% at 50% 0%, #1a1d28 0%, #0a0b0f 72%);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

/* Livery customise tabs + the grouped "Manage" rows */
.cust-panel { animation: cust-fade 0.18s ease; }
.cust-hint { margin: 12px 0 10px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-mute); }
@keyframes cust-fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cust-panel { animation: none; } }
.manage-list { display: flex; flex-direction: column; gap: 8px; }
.staff-entry-emblem { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 5px; object-fit: contain; background: var(--bg); }

/* ---- Tracks ---- */
.track-tile { padding: 10px; align-items: center; gap: 12px; }
.track-tile .tile-main { padding: 0; }
.plan-thumb { width: 54px; height: 54px; flex: 0 0 auto; background: var(--bg-elev-2); border-radius: var(--radius-sm); }
.plan-thumb-road { fill: none; stroke: var(--text-dim); stroke-linejoin: round; stroke-linecap: round; }

.template-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.template-chip {
  padding: 10px 14px; cursor: pointer; font-weight: 700; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-elev-2); color: var(--text);
}
.template-chip:active { transform: scale(0.96); border-color: var(--accent); }

.track-editor { padding-bottom: 88px; }
.track-stage {
  position: relative; height: 240px; margin-bottom: 16px; overflow: hidden;
  border-radius: var(--radius-lg); border: 1px solid var(--line);
  background: radial-gradient(120% 100% at 50% 0%, #16181f 0%, #0a0b0f 75%);
}
.plan-wrap { display: flex; justify-content: center; margin-bottom: 8px; }
.plan-svg {
  width: 100%; max-width: 420px; aspect-ratio: 1; display: block; touch-action: none;
  background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius);
}
.plan-road { fill: none; stroke: #2b2e38; stroke-linejoin: round; stroke-linecap: round; }
.plan-center { fill: none; stroke: var(--text-mute); stroke-width: 0.5; stroke-dasharray: 2 2; }
.plan-pt { fill: #fff; stroke: var(--bg); stroke-width: 0.6; cursor: grab; }
.plan-pt.is-sel { fill: var(--accent-soft); }
.plan-sf { fill: var(--accent); }
.plan-hint { font-size: 11px; color: var(--text-mute); text-align: center; margin-bottom: 16px; letter-spacing: 0.02em; }

/* ---- Track editor v2: zoom, constraints, gravel ---- */
.plan-stage { position: relative; width: 100%; max-width: 420px; }
.plan-svg { cursor: grab; }
.plan-svg.is-panning { cursor: grabbing; }
.plan-zoom { position: absolute; top: 8px; right: 8px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.plan-zoom button {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--line);
  background: rgba(11, 11, 15, 0.72); color: var(--text); font-weight: 700; font-size: 15px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.plan-zoom button:hover { background: rgba(11, 11, 15, 0.92); border-color: var(--text-mute); }
.plan-pt.is-tight { fill: #f5a623; stroke: #e10600; stroke-width: 0.9; animation: tight-pulse 0.9s infinite; }
@keyframes tight-pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 1; } }
.plan-bank-hint { stroke: #6fd0ff; stroke-width: 0.5; stroke-linecap: round; fill: none; }
.plan-gravel { fill: #c2b280; opacity: 0.5; stroke: none; }
.plan-gravel-preview { fill: #c2b280; opacity: 0.32; stroke: #e0b13a; stroke-width: 0.9; stroke-dasharray: 2 1.5; }
.node-header { font-size: 11px; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 2px; }
.gravel-list { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.gravel-item { display: flex; align-items: center; gap: 8px; padding: 7px 10px; font-size: 12px; color: var(--text-dim); background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.gravel-item .gi-swatch { width: 12px; height: 12px; border-radius: 3px; background: #c2b280; flex: none; }
.gravel-item .gi-label { flex: 1; }
.gravel-item button { margin-left: auto; background: none; border: none; color: var(--text-mute); cursor: pointer; font-size: 14px; }
.gravel-item button:hover { color: var(--accent-soft); }
.gravel-add-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.tight-warn { font-size: 11px; color: #f5a623; text-align: center; margin-bottom: 8px; min-height: 14px; }

/* ---- Race broadcast ---- */
/* Break out of the 760px content column: fill the whole area between the header and the nav bar,
   at any resolution, so the broadcast scales to the display (header + nav stay visible). */
.race-screen {
  position: fixed; z-index: 1;
  top: calc(var(--header-h) + var(--safe-top) + 8px);
  bottom: calc(var(--nav-h) + var(--safe-bot) + 8px);
  left: 10px; right: 10px;
  overflow: hidden; border-radius: var(--radius); border: 1px solid var(--line);
  background: radial-gradient(120% 100% at 50% 0%, #16181f 0%, #0a0b0f 78%);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.5);
}
/* While a race plays, it takes over the whole screen in BOTH orientations — hide the app header + bottom
   nav (the .race-screen only exists during playback, not the setup form) and stretch the broadcast edge to
   edge (minus the device safe-areas). */
body:has(.race-screen) .app-header,
body:has(.race-screen) .app-nav { display: none; }
body:has(.race-screen) .race-screen {
  top: var(--safe-top); bottom: var(--safe-bot); left: 0; right: 0;
  border-radius: 0; border-width: 0;
}
.race-stage { position: absolute; inset: 0; }
.race-flag {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); display: none;
  padding: 6px 18px; font-size: 12px; font-weight: 800; letter-spacing: 0.1em; color: #0a0b0f;
  background: #f5c518; border-radius: 100px; z-index: 6;
}
.race-screen.is-yellow .race-flag { display: block; animation: flag-pulse 0.9s ease-in-out infinite; }
.race-screen.is-yellow { box-shadow: inset 0 0 0 3px rgba(245, 197, 24, 0.6); }
@keyframes flag-pulse { 0%, 100% { opacity: 0.78; } 50% { opacity: 1; } }
/* The HUD overlays fill the (now fullscreen in both orientations) race screen at 1:1 — each overlay stays
   anchored to its own corner/edge. (A previous landscape-only 1.6x scale blew the overlays up so they
   overlapped once the race went fullscreen — removed.) */
.race-hud { position: absolute; inset: 0; pointer-events: none; }
.race-hud > * { pointer-events: auto; }
.race-top { position: absolute; top: 10px; left: 0; right: 0; display: flex; justify-content: center; }
.race-lap {
  background: rgba(11, 11, 15, 0.7); border: 1px solid var(--line); border-radius: 100px; padding: 5px 16px;
  font-weight: 800; letter-spacing: 0.08em; font-size: 12px; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.race-weather {
  position: absolute; top: 12px; left: 12px; padding: 5px 12px; z-index: 2;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #fff;
  background: rgba(11, 11, 15, 0.7); border: 1px solid var(--line); border-radius: 100px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.timing-tower { position: absolute; top: 46px; left: 10px; display: flex; flex-direction: column; gap: 2px; width: 132px; max-height: calc(100% - 96px); overflow: hidden; }
.tt-row { display: flex; align-items: center; gap: 5px; padding: 3px 5px; font-size: 11px; border-radius: 4px; background: rgba(11, 11, 15, 0.6); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.tt-row.is-player { background: rgba(225, 6, 0, 0.3); }
.tt-row.is-dnf { opacity: 0.5; }
.tt-pos { width: 14px; text-align: center; font-weight: 800; color: var(--text-dim); }
.tt-bar { width: 4px; height: 14px; border-radius: 1px; flex: 0 0 auto; }
.tt-name { flex: 1; min-width: 0; font-weight: 700; letter-spacing: 0.04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tt-gap { font-size: 10px; color: var(--text-dim); flex: 0 0 auto; white-space: nowrap; }
/* constructor badge beside the abbreviation (timing tower + results) */
.tt-logo { flex: 0 0 auto; display: block; border-radius: 4px; }
.tt-logo.has-em { object-fit: cover; background: #0e1014; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12); }
.tt-logo.gen { object-fit: fill; }
.timing-tower .tt-logo { width: 16px; height: 16px; }
.results-row .tt-logo { width: 20px; height: 20px; border-radius: 5px; }
.race-ticker { position: absolute; top: 46px; right: 10px; width: 146px; display: flex; flex-direction: column; gap: 4px; }
.ticker-line { background: rgba(11, 11, 15, 0.62); border-left: 2px solid var(--accent); border-radius: 3px; padding: 4px 7px; font-size: 10.5px; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
/* live track minimap (in place of the event ticker) */
.race-minimap { position: absolute; top: 46px; right: 10px; width: 128px; height: 128px; padding: 9px; box-sizing: border-box; background: transparent; border: 0; }
.race-minimap-svg { width: 100%; height: 100%; display: block; overflow: visible; }
.mm-road { fill: none; stroke: rgba(255, 255, 255, 0.45); stroke-linejoin: round; stroke-linecap: round; }
.mm-sf { fill: #fff; }
.mm-dot { stroke: rgba(0, 0, 0, 0.55); }
/* ---- Broadcast transport bar: a glass panel with a scrubbable timeline (top) + button row (bottom) ---- */
.race-controls {
  position: absolute; bottom: 10px; left: 10px; right: 10px;
  display: flex; flex-direction: column; gap: 8px; padding: 9px 11px 11px;
  background: rgba(11, 11, 15, 0.6); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1px solid var(--line); border-radius: 13px;
  transition: opacity 0.45s ease, transform 0.45s ease;
}
/* faded out after 5s of no activity WHILE PLAYING — stays put when paused or scrubbing (see race.js showControls) */
.race-controls.is-idle { opacity: 0; transform: translateY(8px); pointer-events: none; }

/* scrubber row: elapsed · draggable track · total (the race clock, in mm:ss) */
.scrub-row { display: flex; align-items: center; gap: 9px; }
.scrub-time { font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-dim); flex: 0 0 auto; min-width: 30px; }
.scrub-time-tot { text-align: right; color: var(--text-mute); }
.scrub-track { position: relative; flex: 1; height: 28px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.scrub-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); }
.scrub-fill { position: absolute; left: 0; top: 50%; transform: translateY(-50%); height: 5px; width: 0; border-radius: 3px; background: var(--accent); pointer-events: none; }
.scrub-handle { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 5px rgba(0, 0, 0, 0.55); transform: translate(-50%, -50%); pointer-events: none; transition: transform 0.12s ease; }
.scrub-track:hover .scrub-handle, .scrub-track.is-scrubbing .scrub-handle { transform: translate(-50%, -50%) scale(1.3); }
.scrub-track.is-scrubbing::before, .scrub-track.is-scrubbing .scrub-fill { height: 6px; }

/* button row */
.race-btnrow { display: flex; align-items: center; gap: 8px; }
.race-btnrow-spacer { flex: 1; }
.race-ctrl {
  height: 42px; min-width: 44px; flex: 0 0 auto; padding: 0 12px;
  border-radius: 9px; border: 1px solid transparent; background: rgba(255, 255, 255, 0.07);
  color: var(--text); font-size: 15px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, filter 0.15s;
}
.race-ctrl:active { transform: scale(0.92); }
.race-ctrl-play { min-width: 54px; background: var(--accent); border-color: var(--accent); color: #fff; font-size: 17px; }
.race-ctrl-play:active { filter: brightness(1.12); }
.race-ctrl-speed { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.race-ctrl-exit { color: var(--text-dim); margin-left: 2px; }

/* Audio mixer popover (replaces the mute button): separate Cars / Voice sliders */
.race-mixer { position: relative; flex: 0 0 auto; }
.race-mixer-panel {
  position: absolute; bottom: calc(100% + 8px); left: 0; width: 196px; z-index: 8;
  display: none; flex-direction: column; gap: 10px; padding: 11px 12px;
  background: rgba(11, 11, 15, 0.92); border: 1px solid var(--line); border-radius: 10px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--shadow-2);
}
.race-mixer.open .race-mixer-panel { display: flex; }
.mix-row { display: flex; align-items: center; gap: 8px; }
.mix-ico { font-size: 13px; width: 18px; flex: 0 0 auto; text-align: center; }
.mix-lbl { font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-dim); width: 38px; flex: 0 0 auto; }
.mix-range { flex: 1; min-width: 0; height: 4px; accent-color: var(--accent); cursor: pointer; }
.mix-val { font-size: 10px; font-variant-numeric: tabular-nums; color: var(--text); width: 32px; text-align: right; flex: 0 0 auto; }

.race-gauges {
  position: absolute; bottom: 116px; left: 50%; transform: translateX(-50%); display: none;
  align-items: stretch; gap: 0; padding: 7px 4px;
  background: rgba(11, 11, 15, 0.6); border: 1px solid var(--line); border-radius: 10px;
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); font-variant-numeric: tabular-nums;
}
.g-cell { display: flex; flex-direction: column; justify-content: center; gap: 4px; padding: 0 14px; }
.g-cell + .g-cell { border-left: 1px solid var(--line); }
.g-speed { flex-direction: row; align-items: baseline; gap: 6px; }
.g-speed b { font-size: 30px; font-weight: 900; color: #fff; line-height: 1; }
.g-speed span { font-size: 10px; color: var(--text-dim); letter-spacing: 0.12em; }
.g-rpm { min-width: 110px; }
.g-rpm-top { display: flex; align-items: baseline; gap: 5px; }
.g-rpm-top b { font-size: 18px; font-weight: 800; color: #fff; line-height: 1; }
.g-rpm-top span { font-size: 9px; color: var(--text-dim); letter-spacing: 0.12em; }
.rpm-bar { height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.rpm-fill { display: block; height: 100%; width: 0%; border-radius: 3px; background: linear-gradient(90deg, #3fd07a 0%, #e0b13a 60%, #e10600 86%); transition: width 0.06s linear; }
.rpm-fill.redline { animation: rpm-flash 0.18s steps(2) infinite; }
@keyframes rpm-flash { 0% { opacity: 1; } 100% { opacity: 0.55; } }
.g-temp { gap: 3px; }
.g-temp-row { display: flex; align-items: baseline; gap: 5px; }
.g-tlbl { width: 30px; font-size: 8.5px; font-weight: 700; color: var(--text-dim); letter-spacing: 0.08em; }
.g-temp-row b { font-size: 14px; font-weight: 800; color: #fff; line-height: 1; }
.g-tdeg { font-size: 9px; color: var(--text-dim); }

/* Team-radio flyout (F1 broadcast style) */
.radio-flyout {
  position: absolute; right: 10px; top: 48%; width: 178px; z-index: 60;
  transform: translateX(125%); opacity: 0;
  transition: transform 0.34s cubic-bezier(0.22, 0.91, 0.36, 1), opacity 0.25s ease;
  background: rgba(11, 11, 15, 0.84); border: 1px solid var(--line);
  border-left: 4px solid var(--radio-col, #e10600); border-radius: 8px; padding: 10px 12px;
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); box-shadow: var(--shadow-2);
}
.radio-flyout.is-in { transform: translateX(0); opacity: 1; }
.radio-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 7px; }
.radio-name { font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--radio-col, #fff); }
.radio-bars { display: flex; align-items: center; gap: 2px; height: 15px; }
.radio-bars i { display: block; width: 2px; height: 100%; background: var(--radio-col, #fff); opacity: 0.85; transform: scaleY(0.3); transform-origin: center; }
.radio-flyout.is-in .radio-bars i { animation: radio-wave 0.8s ease-in-out infinite; }
@keyframes radio-wave { 0%, 100% { transform: scaleY(0.25); } 50% { transform: scaleY(1); } }
.radio-text { font-size: 12px; font-weight: 700; color: #fff; line-height: 1.42; text-transform: uppercase; letter-spacing: 0.01em; }

.race-results { position: absolute; inset: 0; z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(4, 5, 8, 0.72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.race-results-card { width: 100%; max-width: 460px; max-height: 92%; overflow-y: auto; padding: 18px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.results-title { font-size: 20px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.02em; margin-bottom: 12px; }
.results-list { display: flex; flex-direction: column; gap: 3px; }
.results-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 4px; background: var(--bg-elev-2); font-size: 12.5px; }
.results-row.is-player { background: rgba(225, 6, 0, 0.22); }
.rr-pos { width: 18px; text-align: center; font-weight: 800; }
.rr-name { flex: 1; font-weight: 700; }
.rr-team { color: var(--text-dim); font-size: 11px; }
.rr-time { color: var(--text-dim); }
.results-actions { display: flex; gap: 10px; margin-top: 16px; }
.results-actions .btn { flex: 1; }

/* ---- Cockpit driver-ID lower-third (onboard only) ---- */
.cockpit-id {
  position: absolute; left: 12px; bottom: 60px; z-index: 5; display: none; align-items: stretch;
  border-radius: 7px; overflow: hidden; font-weight: 700;
  background: rgba(11, 12, 16, 0.86); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}
.cid-num { display: flex; align-items: center; justify-content: center; min-width: 42px; padding: 0 8px; font-size: 22px; font-weight: 900; color: #fff; background: var(--cid-col, #e10600); }
.cid-main { display: flex; flex-direction: column; justify-content: center; padding: 6px 14px 6px 11px; }
.cid-name { display: flex; align-items: baseline; gap: 6px; line-height: 1.05; }
.cid-first { font-size: 11px; color: var(--text-dim); font-weight: 600; }
.cid-last { font-size: 16px; font-weight: 800; color: #fff; }
.cid-team { display: flex; align-items: center; gap: 6px; margin-top: 3px; font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
.cid-team img { width: 16px; height: 11px; border-radius: 2px; object-fit: cover; }

/* ---- Position / overtake banner (slides down from the top) ---- */
.pos-banner {
  position: absolute; top: 50px; left: 50%; z-index: 6; display: flex; align-items: stretch;
  border-radius: 7px; overflow: hidden; pointer-events: none; opacity: 0;
  transform: translate(-50%, -150%);
  background: rgba(11, 12, 16, 0.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.3s;
}
.pos-banner.is-in { transform: translate(-50%, 0); opacity: 1; }
.pb-pos { display: flex; align-items: center; justify-content: center; min-width: 44px; font-size: 24px; font-weight: 900; color: #fff; background: var(--pb-col, #e10600); }
.pos-banner .tt-logo { align-self: center; margin-left: 10px; }
.pb-main { display: flex; flex-direction: column; justify-content: center; padding: 7px 14px 7px 10px; }
.pb-name { font-size: 16px; line-height: 1.05; }
.pb-first { color: var(--text-dim); font-weight: 600; font-size: 13px; }
.pb-last { color: #fff; font-weight: 800; }
.pb-team { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; margin-top: 2px; }
.pb-num { display: flex; align-items: center; justify-content: center; min-width: 46px; font-size: 26px; font-weight: 900; color: rgba(255, 255, 255, 0.85); border-left: 1px solid var(--line); padding: 0 10px; }

/* ---- Driver highlight (portrait + headline + career, slides up) ---- */
.driver-hl {
  position: absolute; left: 50%; bottom: 108px; z-index: 6; display: flex; align-items: stretch;
  border-radius: 9px; overflow: hidden; pointer-events: none; opacity: 0;
  transform: translate(-50%, 160%); border: 1px solid var(--line);
  background: rgba(11, 12, 16, 0.9); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
  transition: transform 0.42s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.3s;
}
.driver-hl.is-in { transform: translate(-50%, 0); opacity: 1; }
.hl-portrait { width: 62px; height: 62px; flex: 0 0 auto; background: #15171d; position: relative; overflow: hidden; }
.hl-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hl-portrait::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--hl-col, #e10600); }
.hl-main { display: flex; flex-direction: column; justify-content: center; padding: 8px 18px 8px 13px; min-width: 200px; }
.hl-headline { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--hl-col, #e10600); }
.hl-name { font-size: 16px; line-height: 1.1; margin-top: 1px; }
.hl-last { font-weight: 800; color: #fff; }
.hl-sub { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ---- F1-style pit-stop timer (shown by the pit-follow camera) ---- */
.pit-timer {
  position: absolute; left: 50%; bottom: 64px; z-index: 7; display: flex; align-items: stretch;
  border-radius: 9px; overflow: hidden; pointer-events: none; opacity: 0;
  transform: translate(-50%, 150%); border: 1px solid var(--line); border-left: 4px solid var(--pt-col, #e10600);
  background: rgba(11, 12, 16, 0.92); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.6);
  transition: transform 0.4s cubic-bezier(0.2, 0.9, 0.25, 1), opacity 0.3s;
}
.pit-timer.is-in { transform: translate(-50%, 0); opacity: 1; }
.pt-head { display: flex; align-items: center; gap: 9px; padding: 8px 12px; }
.pt-head .tt-logo { border-radius: 4px; }
.pt-team { display: flex; flex-direction: column; line-height: 1.1; }
.pt-name { color: #fff; font-weight: 800; font-size: 14px; }
.pt-sub { color: var(--text-dim); font-size: 9px; text-transform: uppercase; letter-spacing: 0.07em; margin-top: 2px; }
.pt-time {
  display: flex; align-items: center; justify-content: center; min-width: 100px; padding: 0 16px;
  font-size: 28px; font-weight: 900; color: #fff; background: rgba(255, 255, 255, 0.05); border-left: 1px solid var(--line);
  transition: color 0.2s, background 0.2s;
}
.pt-time.is-final { color: #1bd05a; background: rgba(27, 208, 90, 0.13); }

/* ---- Results redesign (broadcast table + winner portrait) ---- */
.r2-card { max-width: 840px; width: 96%; padding: 0; overflow: hidden auto; } /* scroll vertically on short viewports so the actions stay reachable */
.r2-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 2px solid var(--accent); }
.r2-h-title { font-size: 19px; font-weight: 900; letter-spacing: 0.02em; text-transform: uppercase; }
.r2-h-winner { font-size: 19px; font-weight: 900; color: var(--text-dim); letter-spacing: 0.06em; }
.r2-body { display: flex; }
.r2-table { flex: 1; min-width: 0; padding: 9px 12px 12px; display: flex; flex-direction: column; gap: 1px; }
.r2-row { display: flex; align-items: center; gap: 9px; padding: 5px 6px; border-radius: 4px; font-size: 13px; }
.r2-row:nth-child(odd) { background: rgba(255, 255, 255, 0.025); }
.r2-row.is-player { background: rgba(225, 6, 0, 0.18); }
.r2-pos { width: 22px; text-align: center; font-weight: 800; flex: 0 0 auto; }
.r2-flag { width: 20px; flex: 0 0 auto; display: flex; }
.r2-flag img { width: 20px; height: 14px; border-radius: 2px; object-fit: cover; }
.r2-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r2-first { color: var(--text-dim); font-weight: 600; }
.r2-last { font-weight: 800; }
.r2-flmark { color: #b14cff; }
.r2-team { width: 132px; flex: 0 0 auto; color: var(--text-dim); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.r2-time { width: 62px; flex: 0 0 auto; text-align: right; color: var(--text-dim); }
.r2-pts { width: 38px; flex: 0 0 auto; text-align: right; font-weight: 800; }
.r2-winner { width: 244px; flex: 0 0 auto; position: relative; background: #0c0d12; overflow: hidden; }
.r2-wimg { width: 100%; height: 100%; min-height: 230px; object-fit: cover; object-position: center top; display: block; }
.r2-wempty { background: linear-gradient(160deg, #1a1d28, #0a0b0f); }
.r2-wgrad { position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 11, 15, 0.96) 6%, transparent 48%), linear-gradient(to right, rgba(10, 11, 15, 0.55), transparent 32%); }
.r2-wlabel { position: absolute; left: 16px; right: 16px; bottom: 16px; }
.r2-wfirst { font-size: 15px; color: var(--text-dim); font-weight: 600; line-height: 1; }
.r2-wlast { font-size: 30px; font-weight: 900; color: #fff; line-height: 0.95; }
.r2-wteam { font-size: 11px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 5px; font-weight: 700; }
.r2-fastlap { padding: 9px 20px; font-size: 11.5px; color: #b14cff; letter-spacing: 0.06em; font-weight: 700; border-top: 1px solid var(--line); }
.r2-fastlap b { color: #fff; }
.r2-card .results-actions { padding: 12px 20px 16px; margin-top: 0; }
@media (max-width: 640px) {
  .r2-body { flex-direction: column-reverse; }
  .r2-winner { width: 100%; }
  .r2-wimg { min-height: 150px; max-height: 180px; }
  .r2-team { display: none; }
}
/* on narrow race views the centered banner would collide with the tower/minimap — drop it below them */
@media (max-width: 560px) { .pos-banner { top: 168px; } }

/* ---- Team staff (pit crew & coach) ---- */
.staff-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.staff-icon { font-size: 22px; width: 44px; height: 44px; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; background: var(--bg-elev-2); border-radius: 10px; border: 1px solid var(--line); }
.staff-head-main { flex: 1; min-width: 0; }
.staff-title { font-size: 15px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.02em; }
.staff-sub { font-size: 11.5px; color: var(--text-dim); margin-top: 1px; }
.staff-ovr-box { flex: 0 0 auto; text-align: center; padding: 4px 12px; background: var(--bg-elev-2); border-radius: 8px; border: 1px solid var(--line); }
.staff-ovr { font-size: 22px; font-weight: 900; color: var(--text); line-height: 1; }
.staff-ovr-lbl { display: block; font-size: 9px; color: var(--text-mute); letter-spacing: 0.1em; font-weight: 700; }
.staff-pts-row { font-size: 11px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.staff-pts { color: var(--text); font-weight: 700; }
.staff-pts.over { color: var(--accent); }
.staff-entry { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; background: var(--bg-elev-2); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; text-align: left; color: var(--text); transition: transform 0.12s, border-color 0.15s; }
.staff-entry:active { transform: scale(0.99); border-color: var(--accent); }
.staff-entry.is-current { border-color: var(--accent); background: rgba(225, 6, 0, 0.08); }
.staff-entry-ico { font-size: 20px; flex: 0 0 auto; }
.staff-entry-main { flex: 1; min-width: 0; font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.staff-entry-chev { font-size: 22px; color: var(--accent); font-weight: 700; flex: 0 0 auto; line-height: 1; }

/* ---- Car talent trees ---- */
.talent-summary { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 12px 14px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); }
.ts-level { text-align: center; flex: 0 0 auto; }
.ts-lvl-num { font-size: 30px; font-weight: 900; line-height: 1; color: #fff; }
.ts-lvl-lbl { font-size: 9px; letter-spacing: 0.12em; color: var(--text-mute); font-weight: 700; }
.ts-mid { flex: 1; min-width: 0; }
.ts-xp-row { font-size: 10px; color: var(--text-dim); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 5px; }
.ts-xp-row b { color: var(--text); }
.ts-xp-bar { height: 7px; background: var(--bg-elev-2); border-radius: 4px; overflow: hidden; }
.ts-xp-fill { height: 100%; background: linear-gradient(90deg, #00d2be, #2ee6c6); }
.ts-points { flex: 0 0 auto; text-align: center; padding: 6px 12px; border-radius: 8px; background: var(--bg-elev-2); border: 1px solid var(--line); color: var(--text-dim); }
.ts-points.has { background: rgba(225, 6, 0, 0.16); border-color: var(--accent); color: #fff; }
.ts-points b { display: block; font-size: 20px; font-weight: 900; line-height: 1; }
.ts-points span { font-size: 8.5px; letter-spacing: 0.1em; font-weight: 700; }
.talent-spec { display: grid; grid-template-columns: 1fr 1fr; gap: 5px 16px; margin-bottom: 4px; }
.spec-row { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.spec-label { width: 72px; flex: 0 0 auto; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.03em; font-size: 10px; }
.spec-bar { flex: 1; height: 5px; background: var(--bg-elev-2); border-radius: 3px; overflow: hidden; }
.spec-fill { height: 100%; background: var(--text-mute); }
.spec-val { width: 46px; flex: 0 0 auto; text-align: right; font-weight: 700; }
.spec-bonus { color: #2ee6c6; }
@media (max-width: 560px) { .talent-spec { grid-template-columns: 1fr; } }
.talent-branches { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 12px; -webkit-overflow-scrolling: touch; }
.tb-chip { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 100px; border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text-dim); font-weight: 700; font-size: 12px; cursor: pointer; white-space: nowrap; }
.tb-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tb-spent { display: inline-flex; align-items: center; justify-content: center; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: rgba(0, 0, 0, 0.28); font-size: 10px; font-weight: 800; }
.tb-chip.is-active .tb-spent { background: rgba(255, 255, 255, 0.25); }
.talent-tree { display: flex; flex-direction: column; gap: 10px; }
.talent-tier { display: flex; flex-direction: column; gap: 8px; }
.talent-tier.is-locked { opacity: 0.55; }
.tier-lock { font-size: 11px; color: var(--text-mute); text-align: center; padding: 4px; }
.talent-node { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.talent-node.is-on { border-color: var(--accent); background: rgba(225, 6, 0, 0.08); }
.tn-main { flex: 1; min-width: 0; }
.tn-name { font-weight: 800; font-size: 13.5px; }
.tn-rank { color: var(--text-dim); font-weight: 700; }
.tn-desc { font-size: 11px; color: var(--text-dim); margin-top: 1px; }
.tn-eff { font-size: 10.5px; color: #2ee6c6; font-weight: 700; margin-top: 3px; }
.tn-btns { display: flex; gap: 6px; flex: 0 0 auto; }
.tn-btn { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-elev-2); color: var(--text); font-size: 18px; font-weight: 800; cursor: pointer; line-height: 1; }
.tn-btn:disabled { opacity: 0.3; cursor: default; }
.tn-up:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
