/* ============================================================
   F1 24/25/26 LIVE DASHBOARD — CSS v3.0 "BROADCAST"
   RESTYLE: passaggio dallo stile "neon/cyberpunk" (viola, glow diffusi,
   angoli arrotondati) a uno stile ispirato alla grafica ufficiale delle
   trasmissioni F1 in TV: fondo quasi-nero, rosso F1 e bianco ad alto
   contrasto, bordi netti (angoli quasi vivi), badge scuderia squadrati
   pieni, timing tower con righe a contrasto alternato leggero.
   Il colore ORO scelto per My Team (vedi profilo) NON influenza questa
   palette generale — resta un dettaglio solo sulla riga/auto del giocatore.
   ============================================================ */

/* ── GOOGLE FONTS ────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@400;500;600;700;800;900&family=Barlow:wght@400;500;600;700&family=Share+Tech+Mono&family=Bebas+Neue&family=Oswald:wght@400;500;600;700&display=swap');

/* ── CSS VARIABLES ─────────────────────────────────────────── */
:root {
  --bg:           #08090b;
  --bg2:          #0e1013;
  --bg3:          #15171c;
  --border:       #24272e;
  --border2:      #34383f;
  --accent:       #e10600;          /* F1 rosso ufficiale, colore di comando */
  --accent2:      #1e9bff;          /* blu tecnico broadcast, al posto del ciano neon */
  --accent3:      #ffcc00;          /* ambra broadcast per record/fastest */
  --red-f1:       #e10600;
  --text:         #f5f6f8;
  --text2:        #9a9ea8;
  --text3:        #5c6068;
  --green:        #0fbf5a;
  /* Il fucsia del giro/settore più veloce è un colore SEPARATO dagli accenti
     generici dell'interfaccia — è una convenzione F1 riconoscibile (sia nel
     gioco che nelle grafiche TV ufficiali il "purple sector"/giro record è
     sempre magenta/fucsia, mai lo stesso colore usato per altri accenti).
     Prima --purple veniva usata per ENTRAMBI gli scopi, e quando è stata
     cambiata in blu per il restyling, il fucsia del record è sparito per
     errore insieme al viola neon generico. Ora sono due variabili distinte:
     --purple resta il blu tecnico per bordi/accenti generici dell'interfaccia,
     --fastest è il vero fucsia, usato SOLO per record/giro veloce.
  */
  --purple:       #1e9bff;          /* accento tecnico generico (bordi, box) — blu broadcast */
  --fastest:      #c800ff;          /* fucsia F1 per giro/settore più veloce, sempre distinto dagli accenti generici */
  --red:          #e10600;
  --orange:       #ff8700;
  --topbar-h:     50px;
  --panel-l:      290px;
  --panel-r:      220px;
  --card-radius:  2px;              /* bordi netti, non più arrotondati come nel tema precedente */
  --font-display: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-data:    'Barlow', sans-serif;
  --font-mono:    'Share Tech Mono', 'Courier New', monospace;
  --font-title:   'Oswald', 'Barlow Condensed', sans-serif;  /* stile più elegante/moderno per titoli e loghi */
}

/* ── RESET & BASE ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-data);
  font-size: 13px;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ═══════════════════ LOADING SCREEN ═══════════════════════════ */
#loading-screen {
  position: fixed; inset: 0;
  background: #050506;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  overflow: hidden;
}
#loading-screen::after {
  content: '';
  position: absolute; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, transparent 0%, rgba(225,6,0,0.5) 40%, rgba(255,0,100,0.9) 50%, rgba(225,6,0,0.5) 60%, transparent 100%);
  box-shadow: 0 0 20px 4px rgba(225,6,0,0.4);
  animation: scanLine 3.5s linear infinite;
  pointer-events: none;
}
@keyframes scanLine {
  0%   { top: -4px; opacity: 0; }
  5%   { opacity: 1; }
  95%  { opacity: 1; }
  100% { top: 100%; opacity: 0; }
}
.loader-inner {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; z-index: 1;
}
/* FIX-LOGO: era un'immagine, ora è testo — stesso stile che il vecchio
   "fallback testuale" già aveva (font grande, rosso F1, glow leggero),
   ora usato SEMPRE (non solo come ripiego se l'immagine non caricava). */
.loader-logo-text {
  font-family: var(--font-display); font-size: 96px; font-weight: 900;
  font-style: italic; color: var(--red-f1); letter-spacing: -2px;
  text-shadow: 0 0 20px rgba(225,6,0,0.55);
  margin-bottom: 24px;
}
.loader-logo-text span { color: #fff; }
.loader-text {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  letter-spacing: 12px; color: #444; margin-top: -8px;
}
.loader-bar { position: relative; width: 480px; height: 3px; background: #1a0000; border-radius: 2px; overflow: visible; }
.loader-fill {
  height: 100%; border-radius: 2px;
  background: linear-gradient(90deg, #7a0000 0%, var(--red-f1) 45%, #ff4422 50%, var(--red-f1) 55%, #7a0000 100%);
  box-shadow: 0 0 8px 2px rgba(225,6,0,0.8);
  animation: loadPulse 2s cubic-bezier(0.4,0,0.2,1) infinite;
}
@keyframes loadPulse {
  0%   { width: 0%;   margin-left: 0;    opacity: 1; }
  40%  { width: 75%;  margin-left: 5%;   opacity: 1; }
  60%  { width: 75%;  margin-left: 20%;  opacity: 1; }
  95%  { width: 0%;   margin-left: 100%; opacity: 0; }
  100% { width: 0%;   margin-left: 0;    opacity: 0; }
}
.loader-status {
  font-family: var(--font-mono); font-size: 14px; color: #5a0000;
  letter-spacing: 2px; animation: statusBlink 1.6s step-end infinite;
}
@keyframes statusBlink { 0%,100% { color: #8a1010; } 50% { color: #cc2200; } }


/* ═══════════════════ FASTEST LAP BANNER ═══════════════════════ */
/* Unica animazione mantenuta — stile F1 TV autentico */
#fastest-lap-banner {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-200%);
  visibility: hidden;
  z-index: 8500;
  display: flex;
  align-items: stretch;
  border-radius: 2px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(200,0,255,0.5), 0 0 0 1px rgba(200,0,255,0.3);
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.6s;
  min-height: 46px;
  pointer-events: none;
}
#fastest-lap-banner.visible {
  transform: translateX(-50%) translateY(0);
  visibility: visible;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}

.flb-strip {
  background: var(--fastest);
  display: flex; align-items: center; gap: 8px;
  padding: 0 20px;
  font-family: var(--font-display); font-size: 11px; font-weight: 800;
  letter-spacing: 3px; color: #fff; white-space: nowrap;
  position: relative; overflow: hidden;
}
.flb-strip::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,0.15) 50%, transparent 60%);
  animation: flbShimmer 2s ease-in-out infinite;
}
@keyframes flbShimmer { 0% { transform: translateX(-100%); } 100% { transform: translateX(200%); } }
.flb-icon { font-size: 18px; }

.flb-details {
  background: #160822;
  display: flex; align-items: center; gap: 0;
  max-width: 0; overflow: hidden;
  transition: max-width 0.55s cubic-bezier(0.22, 1, 0.36, 1) 0.15s;
  border-left: 2px solid var(--fastest);
}
#fastest-lap-banner.visible .flb-details { max-width: 440px; }

.flb-team-swatch {
  width: 6px; height: 100%; flex-shrink: 0;
  transition: background 0.3s ease 0.4s;
}
.flb-driver-name {
  font-family: var(--font-display); font-size: 16px; font-weight: 800;
  color: var(--text); padding: 0 12px 0 14px; white-space: nowrap;
  opacity: 0; transform: translateX(-12px);
  transition: opacity 0.3s ease 0.45s, transform 0.35s ease 0.45s;
}
.flb-team-name {
  font-family: var(--font-data); font-size: 11px; font-weight: 600;
  color: var(--fastest); padding-right: 14px; white-space: nowrap;
  opacity: 0; transform: translateX(-8px);
  transition: opacity 0.3s ease 0.5s, transform 0.3s ease 0.5s;
}
.flb-lap-time {
  font-family: var(--font-mono); font-size: 20px; font-weight: 700;
  color: var(--fastest); padding: 0 18px;
  background: rgba(200,0,255,0.15); height: 100%;
  display: flex; align-items: center; white-space: nowrap;
  border-left: 1px solid rgba(200,0,255,0.3);
  opacity: 0; transition: opacity 0.3s ease 0.55s;
  text-shadow: 0 0 12px rgba(200,0,255,0.7);
}
#fastest-lap-banner.visible .flb-driver-name,
#fastest-lap-banner.visible .flb-team-name,
#fastest-lap-banner.visible .flb-lap-time {
  opacity: 1; transform: translateX(0);
}

/* ═══════════════ POPUP SETTORE VELOCE (scorre in basso a dx) ═══════════════ */
/* Vero popup che entra ed esce (non una card sempre visibile) — posizionato
   in basso a destra dove c'era spazio libero, con testo grande e in
   grassetto perché si legga bene al volo mentre si guarda la gara. */
#fastest-sector-popup {
  position: fixed;
  bottom: 20px; right: 20px;
  transform: translateX(120%);
  visibility: hidden;
  z-index: 7900;
  display: flex; flex-direction: column;
  border-radius: 2px; overflow: hidden;
  box-shadow: 0 10px 40px rgba(200,0,255,0.55), 0 0 0 1px rgba(200,0,255,0.35);
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.5s;
  min-width: 300px;
  pointer-events: none;
}
#fastest-sector-popup.visible {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.5s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}
.fsp-strip {
  background: var(--fastest);
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  font-family: var(--font-display); font-size: 13px; font-weight: 900;
  letter-spacing: 2px; color: #fff;
}
.fsp-icon { font-size: 18px; }
.fsp-details {
  background: #17081f; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid rgba(200,0,255,0.3);
}
.fsp-team-swatch { width: 7px; align-self: stretch; border-radius: 3px; flex-shrink: 0; }
.fsp-info { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.fsp-driver-name { font-family: var(--font-display); font-size: 20px; font-weight: 900; color: var(--text); letter-spacing: 0.5px; }
.fsp-team-name   { font-family: var(--font-data); font-size: 13px; font-weight: 600; color: var(--text2); }
.fsp-time {
  font-family: var(--font-mono); font-size: 28px; font-weight: 900;
  color: var(--fastest);
  text-shadow: 0 0 14px rgba(200,0,255,0.9);
  white-space: nowrap;
}


/* ── TOP BAR ────────────────────────────────────────────────── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: #060710;
  border-bottom: 1px solid var(--border2);
  display: flex; align-items: center;
  padding: 0 12px; gap: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(0,0,0,0.8);
}
#topbar::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(225,6,0,0.6) 20%, rgba(225,6,0,0.8) 50%, rgba(225,6,0,0.6) 80%, transparent 100%);
}
.topbar-left  { display: flex; align-items: center; gap: 10px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
/* FIX-LOGO: filtro diretto al rosso F1, senza hue-rotate che vira al rosa */
.topbar-logo  {
  max-height: 48px;
}
/* FIX-LOGO: fallback testo in rosso corretto */
.topbar-logo-fallback {
  font-family: var(--font-display); font-size: 24px; font-weight: 900;
  color: var(--red-f1); letter-spacing: -1px;
}
.topbar-logo-fallback span { color: #fff; }
/* Badge discreto: mostra il formato UDP rilevato automaticamente (F1 25 / 2026 Season Pack) */
.version-badge {
  font-family: var(--font-mono); font-size: 9px; font-weight: 400;
  padding: 2px 6px; color: var(--text2);
  border: 1px solid var(--border2); border-radius: 3px;
  letter-spacing: 0.5px; white-space: nowrap;
  transition: color 0.3s, border-color 0.3s;
}
.version-badge.is-2026 { color: var(--accent2); border-color: var(--accent2); }
.topbar-divider { width: 1px; height: 24px; background: var(--border2); margin: 0 4px; }
.session-duration {
  font-family: var(--font-mono); font-size: 13px; font-weight: 700;
  color: var(--accent2); letter-spacing: 1px; white-space: nowrap;
}
.session-duration.paused { color: var(--accent3); }
.session-badge {
  font-family: var(--font-display); font-size: 10px; font-weight: 800;
  padding: 3px 8px; background: var(--accent); color: #fff;
  border-radius: 3px; letter-spacing: 1px; white-space: nowrap;
}
.track-name {
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  color: var(--text); letter-spacing: 2px;
}
/* FIX: era centrato con position:absolute rispetto a TUTTA la pagina, il
   che causava sovrapposizione col testo quando la topbar sinistra era
   piena (logo+profilo+gioco+sprint — più lunga della destra). Tornato al
   centraggio nello spazio LIBERO tra i due blocchi laterali (flex: 1): può
   sembrare leggermente decentrato se i lati sono sbilanciati, ma non si
   sovrappone mai a nulla. */
.topbar-center { flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.flag-display  {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: 2px; color: var(--text2);
  white-space: nowrap;
}
.flag-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text3); }
.flag-dot.green  { background: var(--green);   box-shadow: 0 0 10px var(--green); }
.flag-dot.yellow { background: var(--accent3); box-shadow: 0 0 10px var(--accent3); }
.flag-dot.red    { background: var(--red);     box-shadow: 0 0 10px var(--red); animation: blink 0.5s step-end infinite; }
.flag-dot.blue   { background: var(--accent2); box-shadow: 0 0 10px var(--accent2); }
.flag-dot.sc     { background: var(--orange);  box-shadow: 0 0 10px var(--orange); animation: blink 1s step-end infinite; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0} }

.topbar-right { display: flex; align-items: center; gap: 14px; flex: 0 0 auto; }
.weather-block { display: flex; align-items: center; gap: 8px; }
.weather-icon { font-size: 18px; }
.temp-group   { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.temp-label   { font-size: 9px; color: var(--text3); letter-spacing: 1px; font-family: var(--font-display); }
.temp-val     { font-family: var(--font-mono); font-size: 13px; color: var(--text); }
.lap-counter  { display: flex; align-items: center; gap: 3px; font-family: var(--font-display); }
.lap-label    { font-size: 9px; color: var(--text3); letter-spacing: 1px; margin-right: 4px; }
.lap-num      { font-size: 20px; font-weight: 900; color: var(--accent2); }
.lap-sep      { font-size: 15px; color: var(--text3); }
.lap-total    { font-size: 15px; color: var(--text2); }
.conn-indicator { display: flex; align-items: center; gap: 6px; font-size: 10px; font-family: var(--font-display); letter-spacing: 1px; }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); transition: background 0.3s, box-shadow 0.3s; }
.conn-dot.online  { background: var(--green); box-shadow: 0 0 8px var(--green); }
.conn-dot.offline { background: var(--red); }
.btn-save {
  background: transparent; border: 1px solid var(--border2); color: var(--text2);
  padding: 4px 10px; font-family: var(--font-display); font-size: 9px; font-weight: 700;
  letter-spacing: 1px; border-radius: 3px; cursor: pointer; transition: all 0.2s;
}
.btn-save:hover { border-color: var(--red-f1); color: var(--red-f1); box-shadow: 0 0 8px rgba(225,6,0,0.3); }


/* ── MAIN LAYOUT ────────────────────────────────────────────── */
#main-layout {
  position: fixed;
  top: var(--topbar-h); left: 0; right: 0; bottom: 0;
  display: grid;
  /* FIX-LAYOUT: pannello centrale ha più spazio */
  grid-template-columns: var(--panel-l) 1fr var(--panel-r);
  overflow: hidden;
}
#panel-left, #panel-right {
  height: 100%; overflow-y: auto; overflow-x: hidden;
  padding: 0; background: var(--bg2);
  display: flex; flex-direction: column; gap: 0;
}
#panel-left  { border-right: 1px solid var(--border); }
#panel-right { border-left:  1px solid var(--border); padding: 8px 6px; gap: 6px; }
#panel-center {
  height: 100%; overflow-y: auto;
  padding: 8px; display: flex; flex-direction: column; gap: 6px;
  background: var(--bg);
}
/* Scrollbars sottili */
#panel-left::-webkit-scrollbar, #panel-right::-webkit-scrollbar,
#panel-center::-webkit-scrollbar, .lap-history-scroll::-webkit-scrollbar,
.lb-body::-webkit-scrollbar, .sidebar-lb::-webkit-scrollbar { width: 4px; }
#panel-left::-webkit-scrollbar-thumb, #panel-right::-webkit-scrollbar-thumb,
#panel-center::-webkit-scrollbar-thumb, .lap-history-scroll::-webkit-scrollbar-thumb,
.lb-body::-webkit-scrollbar-thumb, .sidebar-lb::-webkit-scrollbar-thumb
  { background: var(--border2); border-radius: 2px; }


/* ── SIDEBAR LEADERBOARD — STILE F1 TV ──────────────────────── */
.sidebar-lb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 10px 6px;
  background: rgba(0,0,0,0.6);
  border-bottom: 1px solid var(--border2);
  flex-shrink: 0;
}
.sidebar-lb-title {
  font-family: var(--font-display);
  font-size: 9px; font-weight: 800;
  letter-spacing: 3px; color: var(--text3); text-transform: uppercase;
}
.sidebar-lb-session {
  font-family: var(--font-mono); font-size: 9px; color: var(--text3);
}
.sidebar-lb {
  display: flex; flex-direction: column; gap: 0;
  flex-shrink: 0; flex: 1; overflow-y: auto;
}

/* Riga singola */
.slb-row {
  display: grid;
  grid-template-columns: 28px 5px 1fr 56px 22px 28px;
  align-items: center;
  height: 30px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: rgba(6,7,16,0.85);
  transition: background 0.1s;
  position: relative; overflow: hidden; padding: 0 4px 0 0;
}
.slb-row:hover { background: rgba(20,22,40,0.95); }
.slb-row.slb-player { background: rgba(225,6,0,0.07); }
.slb-row.slb-player::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--red-f1);
}
.slb-row.slb-pitting { opacity: 0.65; }
.slb-row.slb-retired { opacity: 0.3; }

.slb-pos {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 13px; font-weight: 800;
  color: var(--text2); border-right: 1px solid rgba(255,255,255,0.04);
  height: 100%;
}
.slb-pos.p1 { color: var(--accent3); background: rgba(255,224,0,0.08); }
.slb-pos.p2 { color: #c0c0c0; }
.slb-pos.p3 { color: #cd7f32; }
.slb-swatch { width: 4px; height: 100%; flex-shrink: 0; }
.slb-name {
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 6px; display: flex; align-items: center; gap: 3px;
}
.slb-fl-icon { color: var(--fastest); font-size: 9px; flex-shrink: 0; }
.slb-gap {
  font-family: var(--font-mono); font-size: 10px; color: var(--text2);
  white-space: nowrap; padding-right: 4px;
}
.slb-gap.leader { color: transparent; }
.slb-tyre {
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 8px; font-weight: 900;
  color: #000; flex-shrink: 0; margin: 0 2px;
}
.slb-pit {
  font-family: var(--font-display); font-size: 7px; font-weight: 900;
  color: var(--accent3); width: 22px; text-align: center; flex-shrink: 0;
}
.slb-pit-timer {
  font-family: var(--font-mono); font-size: 8px; font-weight: 700;
  color: var(--accent3); white-space: nowrap;
}

/* Pit stops panel */
.pit-stops-list { display: flex; flex-direction: column; gap: 2px; max-height: 160px; overflow-y: auto; }
.pit-stop-item {
  display: grid; grid-template-columns: 6px 1fr auto auto auto;
  gap: 5px; align-items: center; padding: 5px 4px;
  background: var(--bg); border-radius: 3px; font-size: 11px;
}
.pit-team-swatch { width: 6px; height: 22px; border-radius: 2px; flex-shrink: 0; }
.pit-driver { font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--text); }
.pit-team   { font-family: var(--font-data); font-size: 10px; color: var(--text3); display: none; }
.pit-lap    { font-family: var(--font-mono); font-size: 10px; color: var(--text3); }
.pit-dur    { font-family: var(--font-mono); font-size: 12px; font-weight: 700; color: var(--accent3); }
.no-pitstops { font-family: var(--font-mono); font-size: 10px; color: var(--text3); text-align: center; padding: 12px; }

/* Live pit timer */
#pit-timer-live {
  display: none; align-items: center; justify-content: center;
  background: rgba(255,135,0,0.15); border: 1px solid var(--orange);
  border-radius: 2px; padding: 6px 10px; margin: 4px 0;
  font-family: var(--font-display); font-size: 14px; font-weight: 800;
  color: var(--orange); letter-spacing: 2px;
  animation: pitTimerPulse 0.5s ease-in-out infinite alternate;
}
@keyframes pitTimerPulse {
  from { box-shadow: 0 0 6px rgba(255,135,0,0.3); }
  to   { box-shadow: 0 0 14px rgba(255,135,0,0.7); }
}

/* Tab sidebar */
.sidebar-tabs-wrap {
  flex-shrink: 0; padding: 6px 6px 0; background: var(--bg2);
  border-top: 1px solid var(--border);
}


/* ── CARDS ──────────────────────────────────────────────────── */
.card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--card-radius); padding: 10px; flex-shrink: 0;
}
.card-title {
  font-family: var(--font-title); font-size: 11px; font-weight: 600;
  letter-spacing: 3px; color: var(--text3); margin-bottom: 8px; text-transform: uppercase;
}
.card-title-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.card-title-row .card-title { margin-bottom: 0; }
.avg-display { font-family: var(--font-mono); font-size: 11px; color: var(--text2); }

/* Banner "miglior settore assoluto" — spostato in sidebar sinistra e
   ingrandito, impilato verticalmente (3 card una sopra l'altra invece che
   affiancate, più leggibile in colonna stretta). */
.best-sector-banner {
  border-color: var(--purple); background: linear-gradient(180deg, rgba(30,155,255,0.12), rgba(30,155,255,0.03));
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px;
  position: relative;
}

/* Popup distacco (settore/giro appena completato) — fisso in basso a destra
   dello schermo, "ad apparizione": entra con un piccolo rimbalzo/scala
   invece di comparire di colpo, resta un attimo, poi sparisce dolcemente.
   Indipendente dal resto del layout (non sposta né ridimensiona nient'altro). */
.sector-delta-popup {
  position: fixed; bottom: 24px; right: 24px; left: auto; top: auto;
  transform: translateY(20px) scale(0.85);
  opacity: 0; z-index: 9000;
  background: #140322; border: 2px solid var(--purple);
  border-radius: 3px; padding: 16px 24px;
  box-shadow: 0 10px 34px rgba(30,155,255,0.55);
  min-width: 260px;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.35s ease;
  pointer-events: none;
}
.sector-delta-popup.hidden { display: none; }
.sector-delta-popup.visible {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.sdp-label {
  font-family: var(--font-display); font-size: 16px; font-weight: 800;
  letter-spacing: 2px; color: var(--text2); text-align: center; margin-bottom: 10px;
}
.sdp-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.sdp-row + .sdp-row { margin-top: 6px; }
.sdp-tag {
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  color: var(--text3); letter-spacing: 1px;
}
.sdp-value {
  font-family: var(--font-mono); font-size: 24px; font-weight: 800;
}
.sdp-value.faster { color: var(--green); text-shadow: 0 0 8px rgba(0,230,57,0.6); }
.sdp-value.slower { color: var(--red); text-shadow: 0 0 8px rgba(255,40,40,0.5); }
.bsb-label {
  font-family: var(--font-title); font-size: 12px; font-weight: 600;
  letter-spacing: 2px; color: var(--purple); text-align: center; text-transform: uppercase;
}
.bsb-cards { display: flex; flex-direction: column; gap: 5px; }
.bsb-card {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; padding: 7px 6px; border-radius: 2px;
  background: rgba(0,0,0,0.35); border: 1px solid rgba(30,155,255,0.35);
  transition: box-shadow 0.3s;
}
.bsb-card-sec {
  font-family: var(--font-display); font-size: 11px; font-weight: 800;
  letter-spacing: 2px; color: var(--text3);
}
.bsb-card-time {
  font-family: var(--font-mono); font-size: 22px; font-weight: 700;
  color: var(--purple); text-shadow: 0 0 12px rgba(30,155,255,0.8);
  line-height: 1.2;
}
.bsb-card-name {
  font-family: var(--font-display); font-size: 16px; font-weight: 800;
  color: var(--text); letter-spacing: 0.5px;
}
.bsb-card-team {
  font-family: var(--font-data); font-size: 11px; color: var(--text2);
  min-height: 13px;
}

/* Overlay Flashback / Pausa (punto 7) */
.rewind-overlay {
  position: fixed; top: 0; left: 0; right: 0; z-index: 500;
  display: flex; justify-content: center; padding-top: 10px;
  pointer-events: none;
}
.rewind-overlay.hidden { display: none; }
.rewind-badge {
  font-family: var(--font-display); font-size: 13px; font-weight: 800;
  letter-spacing: 2px; padding: 8px 20px; border-radius: 2px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  animation: rewindPulse 1s ease-in-out infinite;
}
.rw-flashback { background: var(--purple); color: #fff; }
.rw-pause     { background: var(--accent3); color: #000; }

/* Overlay stato pista: Bandiera Gialla/Rossa, SC, VSC — sempre in alto al
   centro, sotto l'eventuale banner flashback/pausa, senza toccare il resto
   della UI (non azzera né sposta nessun'altra card). */
.track-status-overlay {
  position: fixed; top: calc(var(--topbar-h) - 10px); left: 0; right: 0; z-index: 490;
  display: flex; justify-content: center; padding-top: 10px;
  pointer-events: none;
}
.track-status-overlay.hidden { display: none; }
.track-status-badge {
  font-family: var(--font-display); font-size: 13px; font-weight: 800;
  letter-spacing: 2px; padding: 8px 22px; border-radius: 2px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.track-status-badge.ts-yellow { background: var(--accent3); color: #000; animation: tsFlash 0.8s step-end infinite; }
.track-status-badge.ts-red    { background: var(--red); color: #fff; animation: tsFlash 0.8s step-end infinite; }
.track-status-badge.ts-sc     { background: var(--orange); color: #000; }
.track-status-badge.ts-vsc    { background: var(--accent2); color: #000; }
@keyframes tsFlash { 0%,100% { opacity: 1; } 50% { opacity: 0.75; } }

/* Overlay "sessione non attiva" — quando il PC da gioco non e' collegato in
   questo momento e stiamo guardando l'ultima sessione salvata. */
.stale-data-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 9500;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 90px; pointer-events: none;
}
.stale-data-overlay.hidden { display: none; }
.stale-data-badge {
  font-family: var(--font-display); font-weight: 800; font-size: 15px;
  letter-spacing: 2px; text-align: center; color: #fff;
  background: rgba(80,20,0,0.92); border: 1px solid var(--orange);
  padding: 12px 26px; border-radius: 2px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.6);
}
.stale-data-time {
  font-family: var(--font-mono); font-size: 11px; font-weight: 400;
  letter-spacing: 0.5px; color: #ffcc99;
}

/* Badge profilo in topbar */
.profile-badge {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  color: var(--accent2); background: transparent; border: 1px solid var(--border2);
  border-radius: 2px; padding: 4px 10px; cursor: pointer; letter-spacing: 0.5px;
  transition: border-color 0.2s, color 0.2s;
}
.profile-badge:hover { border-color: var(--accent2); }

.sprint-toggle {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  color: var(--text3); background: transparent; border: 1px solid var(--border2);
  border-radius: 2px; padding: 4px 10px; cursor: pointer; letter-spacing: 0.5px;
  transition: all 0.2s;
}
.sprint-toggle.active {
  color: #000; background: var(--accent3); border-color: var(--accent3);
}

.edit-points-btn {
  width: 100%; font-family: var(--font-display); font-size: 10px; font-weight: 700;
  background: transparent; border: 1px solid var(--border2); color: var(--text2);
  border-radius: 2px; padding: 6px; cursor: pointer; margin-bottom: 8px;
  letter-spacing: 0.5px; transition: border-color 0.2s, color 0.2s;
}
.edit-points-btn:hover { border-color: var(--accent2); color: var(--accent2); }

.points-modal-box { width: 460px; }
.points-edit-list { display: flex; flex-direction: column; gap: 4px; max-height: 180px; overflow-y: auto; }
.points-edit-row {
  display: grid; grid-template-columns: 22px 1fr 70px; gap: 8px; align-items: center;
  padding: 4px 6px; background: var(--bg); border-radius: 2px;
}
.points-edit-swatch { width: 4px; height: 18px; border-radius: 2px; }
.points-edit-name { font-family: var(--font-display); font-size: 12px; font-weight: 700; color: var(--text); }
.points-edit-input {
  width: 100%; font-family: var(--font-mono); font-size: 13px; text-align: right;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 2px;
  padding: 4px 8px; color: var(--text);
}
.points-modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.points-modal-actions .profile-new-btn { flex: 1; }
.points-modal-actions .profile-modal-close { flex: 1; }

/* Finestra scelta profilo */
.profile-modal {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.75);
}
.profile-modal.hidden { display: none; }
.profile-modal-box {
  width: 420px; max-width: 90vw; background: var(--bg2);
  border: 1px solid var(--border2); border-radius: 3px;
  padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.profile-modal-title {
  font-family: var(--font-display); font-size: 15px; font-weight: 800;
  color: var(--text); letter-spacing: 1px; margin-bottom: 6px;
}
.profile-modal-sub {
  font-family: var(--font-data); font-size: 11px; color: var(--text3);
  margin-bottom: 16px;
}
.profile-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; max-height: 240px; overflow-y: auto; }
.profile-item {
  font-family: var(--font-display); font-size: 13px; font-weight: 700;
  color: var(--text); background: var(--bg); border: 1px solid var(--border2);
  border-radius: 2px; padding: 10px 14px; cursor: pointer; text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.profile-item:hover { border-color: var(--accent2); background: var(--bg3); }
.profile-item.active { border-color: var(--green); color: var(--green); }
.profile-new-row { display: flex; gap: 8px; margin-bottom: 14px; }
.profile-new-input {
  flex: 1; font-family: var(--font-data); font-size: 12px;
  background: var(--bg); border: 1px solid var(--border2); border-radius: 2px;
  padding: 8px 10px; color: var(--text);
}
.profile-new-btn {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  background: var(--accent2); color: #000; border: none; border-radius: 2px;
  padding: 8px 14px; cursor: pointer; white-space: nowrap;
}
.profile-modal-close {
  width: 100%; font-family: var(--font-display); font-size: 11px;
  background: transparent; border: 1px solid var(--border2); color: var(--text3);
  border-radius: 2px; padding: 8px; cursor: pointer;
}
@keyframes rewindPulse {
  0%,100% { opacity: 1; transform: scale(1); }
  50%     { opacity: 0.85; transform: scale(1.03); }
}



/* ── TABS ───────────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 2px; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--card-radius); padding: 3px;
}
.tab-btn {
  flex: 1; background: transparent; border: none;
  color: var(--text3); font-family: var(--font-display);
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  padding: 5px 4px; border-radius: 2px; cursor: pointer; transition: all 0.15s;
}
.tab-btn:hover  { color: var(--text2); background: var(--border); }
/* FIX-LOGO: accent button usa rosso F1, non rosa */
.tab-btn.active { color: #fff; background: var(--red-f1); box-shadow: 0 0 10px rgba(225,6,0,0.4); }
.tab-panel { display: none; flex-direction: column; gap: 0; padding: 4px 6px 6px; }
.tab-panel.active { display: flex; }


/* ── LEADERBOARD (Tab GARA) ─────────────────────────────────── */
.lb-header-row {
  display: grid;
  grid-template-columns: 24px 1fr 22px 68px 58px 28px;
  gap: 2px; padding: 4px 6px;
  background: var(--bg); border-radius: 2px; margin-bottom: 2px; flex-shrink: 0;
}
.lb-tyres-header { grid-template-columns: 24px 1fr 52px 36px 44px; }
.lbh {
  font-family: var(--font-display); font-size: 8px; font-weight: 800;
  color: var(--text3); letter-spacing: 1px; text-align: center; white-space: nowrap;
}
.lbh-name { text-align: left; }
/* FIX-LAYOUT: altezza massima aumentata per vedere più piloti */
.lb-body { display: flex; flex-direction: column; gap: 2px; flex: 1; max-height: 640px; overflow-y: auto; }
.lb-row {
  display: grid;
  grid-template-columns: 24px 1fr 22px 68px 58px 28px;
  gap: 2px; padding: 5px 6px;
  background: var(--bg); border-radius: 3px;
  border-left: 3px solid transparent;
  transition: background 0.15s; align-items: center;
  position: relative;
}
.lb-fl-badge {
  position: absolute; left: 24px; top: 50%; transform: translateY(-50%);
  font-size: 11px; color: var(--fastest); pointer-events: none;
  text-shadow: 0 0 6px rgba(200,0,255,0.8);
}
.lb-row:hover   { background: var(--bg2); }
.lb-row.is-player { background: rgba(225,6,0,0.07); border-left-color: var(--red-f1); }
.lb-row.in-pits { opacity: 0.75; }
.lb-row.retired  { opacity: 0.35; }
.lb-row.lb-fastest-lap {
  border-left-color: var(--fastest) !important;
  box-shadow: inset 0 0 0 1px rgba(200,0,255,0.5), 0 0 10px rgba(200,0,255,0.4);
  animation: lbFastestLapPulse 1.6s ease-in-out infinite;
}
@keyframes lbFastestLapPulse {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(200,0,255,0.35), 0 0 6px rgba(200,0,255,0.25); }
  50%      { box-shadow: inset 0 0 0 1px rgba(200,0,255,0.9),  0 0 16px rgba(200,0,255,0.65); }
}

/* Box "giro più veloce" ESTERNO alla classifica — prima era un'iconcina
   incollata dentro ogni riga pilota, ora è un elemento a sé, sempre fucsia,
   con il vero tempo del giro (non solo un simbolo). */
.fastest-lap-box {
  display: flex; align-items: center; gap: 8px;
  background: rgba(200,0,255,0.1); border: 1px solid var(--fastest);
  border-radius: 2px; padding: 6px 10px; margin-bottom: 6px;
}
.fastest-lap-box.hidden { display: none; }
.flbx-icon  { font-size: 14px; color: var(--fastest); }
.flbx-label {
  font-family: var(--font-display); font-size: 9px; font-weight: 800;
  letter-spacing: 1.5px; color: var(--fastest);
}
.flbx-name {
  font-family: var(--font-data); font-size: 11px; font-weight: 700;
  color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.flbx-time {
  font-family: var(--font-mono); font-size: 14px; font-weight: 800;
  color: var(--fastest); text-shadow: 0 0 8px rgba(200,0,255,0.6);
}
#tab-tyres .lb-row,
#tab-tyres .lb-header-row { grid-template-columns: 20px 1fr 30px 28px 48px 30px 24px; column-gap: 5px; }
.lb-pos { font-family: var(--font-display); font-size: 15px; font-weight: 700; color: var(--text2); text-align: center; }
.lb-pos.p1 { color: var(--accent3); }
.lb-pos.p2 { color: #c0c0c0; }
.lb-pos.p3 { color: #cd7f32; }
.lb-name {
  font-family: var(--font-display); font-size: 15px; font-weight: 700;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 4px;
}
.lb-fl-icon { color: var(--fastest); font-size: 11px; flex-shrink: 0; }
.lb-tyre {
  text-align: center; font-family: var(--font-display); font-size: 8px; font-weight: 800;
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #000; margin: 0 auto;
}
.lb-gap, .lb-interval { font-family: var(--font-mono); font-size: 13px; color: var(--text2); text-align: right; white-space: nowrap; overflow: hidden; }
.lb-gap.leader { color: var(--text3); }
.lb-pits { font-family: var(--font-display); font-size: 9px; color: var(--text3); text-align: center; }
.lb-pits.in-pit { color: var(--accent3); font-weight: 700; }
.lb-compound { display: flex; align-items: center; justify-content: center; }
.lb-age   { font-family: var(--font-mono); font-size: 13px; color: var(--text2); text-align: center; }
.lb-wear  { font-family: var(--font-mono); font-size: 10px; color: var(--text3); text-align: center; }
.lb-stint { font-family: var(--font-mono); font-size: 9px; color: var(--text3); text-align: center; }
.lb-livepts { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--green); text-align: center; }


/* ── WORLD CHAMPIONSHIP ─────────────────────────────────────── */
.world-section-title { font-family: var(--font-display); font-size: 9px; font-weight: 800; letter-spacing: 3px; color: var(--text3); padding: 4px 6px; }
.world-list { display: flex; flex-direction: column; gap: 1px; }
.world-row  { display: grid; grid-template-columns: 20px 1fr auto 34px; gap: 4px; padding: 5px 6px; background: var(--bg); border-radius: 3px; align-items: center; }
.world-empty-note {
  font-family: var(--font-data); font-size: 10px; color: var(--text3);
  text-align: center; padding: 16px 10px; line-height: 1.5;
}
.world-pos  { font-family: var(--font-display); font-size: 10px; font-weight: 700; color: var(--text3); text-align: center; }
.world-name { font-family: var(--font-data); font-size: 12px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.world-pts  { font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: var(--accent2); text-align: right; }
.world-lastpts {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--green); margin-right: 4px; white-space: nowrap;
}
.world-livepts {
  font-family: var(--font-mono); font-size: 10px; font-weight: 700;
  color: var(--purple); margin-right: 4px; white-space: nowrap;
  text-shadow: 0 0 6px rgba(30,155,255,0.5);
}
.world-row { position: relative; will-change: transform; }
.world-badges { display: flex; align-items: center; gap: 4px; white-space: nowrap; }


/* ── CENTER: TELEMETRY ──────────────────────────────────────── */
.telem-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 8px; }
.telem-driver-info { display: flex; align-items: center; gap: 10px; }
.telem-pos {
  font-family: var(--font-display); font-size: 58px; font-weight: 900;
  color: var(--red-f1); line-height: 1; min-width: 48px; text-align: center;
  font-style: italic; transform: skewX(-6deg);
  text-shadow: 3px 3px 0 rgba(0,0,0,0.55), 0 0 22px rgba(225,6,0,0.5);
  letter-spacing: -1px;
}
.telem-name-group { display: flex; flex-direction: column; }
.telem-driver-name-row { display: flex; align-items: baseline; gap: 8px; }
.telem-driver-name {
  font-family: var(--font-display); font-size: 27px; font-weight: 900;
  color: var(--text); letter-spacing: 0.5px; font-style: italic;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.45), 0 0 20px var(--driver-glow, rgba(0,210,255,0.3));
  position: relative; display: inline-block; padding-bottom: 3px;
}
.telem-driver-name::after {
  content: ''; position: absolute; left: 0; bottom: -2px; height: 3px; width: 48%;
  background: linear-gradient(90deg, var(--driver-accent, var(--red-f1)), transparent);
  border-radius: 2px;
}
.telem-car-number {
  font-family: var(--font-mono); font-size: 15px; font-weight: 800;
  color: var(--bg); background: var(--accent2); padding: 3px 10px;
  border-radius: 2px; letter-spacing: 0.5px;
}
.telem-team-name { display: flex; align-items: center; gap: 5px; font-family: var(--font-data); font-size: 12px; color: var(--text2); }
.telem-team-dot  { width: 8px; height: 8px; border-radius: 50%; background: var(--text3); flex-shrink: 0; }
.telem-gaps { display: flex; gap: 12px; }
.telem-gap-block { text-align: right; }
.tgap-label { font-family: var(--font-display); font-size: 8px; color: var(--text3); letter-spacing: 1px; }
.tgap-val   { font-family: var(--font-mono); font-size: 15px; font-weight: 700; color: var(--accent2); }

.telem-main-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 10px; padding: 8px 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.gear-box  { font-family: var(--font-display); font-size: 52px; font-weight: 900; color: var(--accent3); text-shadow: 0 0 20px rgba(255,224,0,0.5); min-width: 58px; text-align: center; line-height: 1; }
.speed-group { display: flex; align-items: baseline; gap: 4px; flex: 0 0 auto; }
.speed-num   { font-family: var(--font-display); font-size: 64px; font-weight: 800; color: var(--text); line-height: 1; }
.speed-unit  { font-family: var(--font-data); font-size: 12px; color: var(--text3); }
.rpm-section { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.rpm-val     { font-family: var(--font-mono); font-size: 12px; color: var(--text2); text-align: right; }
.rpm-unit    { font-size: 10px; color: var(--text3); }
.rpm-bar-outer { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.rpm-bar-fill  { height: 100%; width: 0%; background: linear-gradient(90deg, #00e639, #ffe000, var(--red-f1)); transition: width 0.08s linear; border-radius: 3px; }
.rpm-leds      { display: flex; gap: 3px; justify-content: flex-end; }
.rpm-led       { width: 8px; height: 8px; border-radius: 1px; background: var(--border2); transition: background 0.08s; }
.rpm-led.lit-green  { background: #00e639; box-shadow: 0 0 4px #00e639; }
.rpm-led.lit-yellow { background: #ffe000; box-shadow: 0 0 4px #ffe000; }
.rpm-led.lit-red    { background: var(--red-f1); box-shadow: 0 0 4px var(--red-f1); }

.telem-inputs-row  { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 8px; }
.input-col         { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; }
.ers-col           { flex: 2.5; }
.input-label-top   { font-family: var(--font-display); font-size: 8px; font-weight: 700; color: var(--text3); letter-spacing: 1px; display: flex; align-items: center; gap: 4px; }
/* Barre pedale "slash": spesse, con taglio diagonale (skew) invece di un
   rettangolo dritto — richiesto per uno stile più aggressivo/motorsport,
   ispirato ai cursori a barra inclinata usati in alcune grafiche di gara.
   Il contenitore esterno resta verticale (altezza = 100% del pedale
   possibile), il riempimento interno mantiene la stessa logica di prima
   (height% = intensità pedale), cambia solo la forma visiva. */
.pedal-bar-outer {
  width: 100%; height: 52px; background: var(--border);
  border-radius: 0; overflow: hidden; display: flex; flex-direction: column;
  justify-content: flex-end; position: relative;
  border: 2px solid var(--border2);
}
.pedal-bar-fill {
  width: 100%; height: 0%; transition: height 0.08s linear;
  border-radius: 0;
  /* Effetto "a segmenti" tipo VU-meter da broadcast racing: bande orizzontali
     scure separano il riempimento in tacche, invece di un gradiente continuo
     — ispirato alle barre laterali pressione gas/freno delle grafiche TV F1. */
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0,0,0,0.35) 0px, rgba(0,0,0,0.35) 2px,
    transparent 2px, transparent 7px
  );
}
.pedal-bar-fill.throttle {
  background-color: #1ee65a;
  background-image:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.35) 0px, rgba(0,0,0,0.35) 2px, transparent 2px, transparent 7px),
    linear-gradient(180deg, #4dff8a, #0a6e26);
  box-shadow: inset 0 2px 6px rgba(255,255,255,0.25), 0 0 14px rgba(30,230,90,0.5);
}
.pedal-bar-fill.brake {
  background-color: #ff2a3d;
  background-image:
    repeating-linear-gradient(0deg, rgba(0,0,0,0.35) 0px, rgba(0,0,0,0.35) 2px, transparent 2px, transparent 7px),
    linear-gradient(180deg, #ff5a68, #8a0018);
  box-shadow: inset 0 2px 6px rgba(255,255,255,0.2), 0 0 14px rgba(255,42,61,0.5);
}
/* Il testo del valore percentuale sotto la barra resta dritto (non skewato),
   altrimenti sarebbe difficile da leggere al volo. */
.input-col .input-val { transform: none; }

/* ── ERS "BATTERIA" — sostituisce la vecchia barra sottile: percentuale
   scritta DENTRO la barra, colore giallo energia, badge deploy a fianco
   invece che sotto. ────────────────────────────────────────────────── */
.ers-battery {
  position: relative; width: 100%; height: 30px;
  background: var(--border); border: 2px solid var(--border2); border-radius: 4px;
  overflow: hidden; display: flex; align-items: center;
}
.ers-battery-fill {
  position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: linear-gradient(90deg, #c89000, #ffcc00, #ffe45c);
  box-shadow: 0 0 12px rgba(255,204,0,0.5);
  transition: width 0.15s linear;
}
.ers-battery-fill.ers-deploying { filter: brightness(1.35); box-shadow: 0 0 18px rgba(255,204,0,0.85); }
.ers-battery-pct {
  position: relative; z-index: 2; margin: 0 auto;
  font-family: var(--font-mono); font-size: 14px; font-weight: 800;
  color: #000; text-shadow: 0 0 4px rgba(255,255,255,0.4);
  mix-blend-mode: difference; filter: invert(1);
}
/* Piccola "tacca" a destra della batteria, stile connettore, puramente
   decorativo (richiama l'aspetto di un'icona batteria reale). */
.ers-battery-cap {
  position: absolute; right: -5px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 12px; background: var(--border2); border-radius: 0 2px 2px 0;
}
.ers-deploy-row { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 3px; }
.ers-deploy-badge {
  font-family: var(--font-display); font-size: 9px; font-weight: 800;
  letter-spacing: 0.5px; color: var(--accent3);
}
.ers-deploy-badge.mode-overtake { color: var(--accent3); text-shadow: 0 0 6px rgba(255,204,0,0.6); }
.ers-boost-icon {
  font-size: 11px; color: var(--accent3);
  animation: ersBoltPulse 0.5s ease-in-out infinite;
  filter: drop-shadow(0 0 3px rgba(255,204,0,0.9));
}
@keyframes ersBoltPulse { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.3); } }
.input-val { font-family: var(--font-mono); font-size: 9px; color: var(--text3); }

/* ── STRAIGHT MODE / DRS BLOCK ──────────────────────────────── */
.drs-block {
  font-family: var(--font-display); font-size: 9px; font-weight: 700;
  letter-spacing: 1px; text-align: center; padding: 6px 8px;
  border-radius: 2px; background: var(--border); color: var(--text3);
  line-height: 1.4; border: 1px solid var(--border2); transition: all 0.2s; flex-shrink: 0;
}
.drs-block.drs-on {
  background: rgba(0,230,57,0.18); border-color: var(--green); color: var(--green);
  box-shadow: 0 0 14px rgba(0,230,57,0.5), inset 0 0 8px rgba(0,230,57,0.1);
  animation: drsPulse 1s ease-in-out infinite;
}
@keyframes drsPulse {
  0%,100% { box-shadow: 0 0 14px rgba(0,230,57,0.5); }
  50%     { box-shadow: 0 0 24px rgba(0,230,57,0.9), 0 0 40px rgba(0,230,57,0.3); }
}
.drs-block #drs-state { font-size: 12px; display: block; }
/* Nuovo: "OVERTAKE PRONTA" — visibile SOLO su F1 26, quando la Overtake
   Mode è disponibile ma non ancora attivata (F1 24/25 non hanno questa
   meccanica distinta, resta sempre nascosto per quei giochi). */
.overtake-avail {
  display: block; margin-top: 3px; font-size: 8px; font-weight: 800;
  letter-spacing: 0.5px; color: var(--accent3);
}
.overtake-avail.hidden { display: none; }

/* ── PIT LIMITER ────────────────────────────────────────────── */
.pit-limiter-bar {
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,100,255,0.15); border: 1px solid #0064ff;
  border-radius: 2px; padding: 5px 10px; margin: 4px 0;
  animation: pitLimiterBlink 0.5s step-end infinite;
}
@keyframes pitLimiterBlink {
  0%,100% { background: rgba(0,100,255,0.18); border-color: #0064ff; }
  50%     { background: rgba(255,224,0,0.18); border-color: var(--accent3); }
}
.pit-limiter-label { font-family: var(--font-display); font-size: 10px; font-weight: 700; letter-spacing: 2px; color: var(--accent2); }

.telem-bottom-row { display: flex; align-items: center; gap: 16px; padding-top: 8px; border-top: 1px solid var(--border); }
.tyre-badge-block { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.tyre-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--text3); display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 11px; font-weight: 900; color: #000; }
.tyre-compound-name { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--text); }
/* FIX: numero giri gomma ingrandito su richiesta (prima 11px, poco leggibile) */
.tyre-age-laps      { font-family: var(--font-mono); font-size: 20px; font-weight: 800; color: var(--text); }

/* ── CARBURANTE — anello circolare compatto invece della barra lunga:
   occupa meno spazio orizzontale, il numero di giri rimanenti sta al
   centro dell'anello stesso. ───────────────────────────────────────── */
.fuel-block { display: flex; flex-direction: column; align-items: center; gap: 2px; margin-left: auto; }
.fuel-ring-wrap { position: relative; width: 56px; height: 56px; }
.fuel-ring-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.fuel-ring-bg  { fill: none; stroke: var(--border); stroke-width: 5; }
.fuel-ring-fill {
  fill: none; stroke: url(#fuelGradFallback); stroke: #ffcc00; stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 169.6; /* 2*pi*27 */
  stroke-dashoffset: 42.4; /* aggiornato via JS in base al %  */
  transition: stroke-dashoffset 0.5s ease, stroke 0.3s ease;
}
.fuel-ring-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
}
.fuel-ring-val  { font-family: var(--font-mono); font-size: 15px; font-weight: 800; color: var(--text); line-height: 1; }
.fuel-ring-unit { font-family: var(--font-display); font-size: 7px; color: var(--text3); letter-spacing: 1px; margin-top: 1px; }
.fuel-label     { font-family: var(--font-display); font-size: 8px; color: var(--text3); letter-spacing: 1px; }

/* ── STRATEGY ───────────────────────────────────────────────── */
.strategy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.strat-block { background: var(--bg); border: 1px solid var(--border); border-radius: 2px; padding: 6px 8px; display: flex; flex-direction: column; gap: 2px; }
.strat-label { font-family: var(--font-display); font-size: 7px; font-weight: 700; letter-spacing: 1px; color: var(--text3); }
.strat-val   { font-family: var(--font-mono); font-size: 14px; font-weight: 700; color: var(--accent2); }

/* ── CENTER: SECTORS ────────────────────────────────────────── */
.sectors-row  { display: flex; gap: 4px; margin-bottom: 8px; }
/* Micro-settori (punto 8): 12 blocchetti (4 per settore) sotto ai tempi
   settore, colorati in base a se stai migliorando/peggiorando rispetto al
   tuo giro personale migliore, tratto per tratto. */
.microsectors-row { display: flex; gap: 10px; margin-bottom: 10px; }
.microsectors-row.hidden { display: none; }
.ms-group { flex: 1; display: flex; gap: 3px; }
.ms-block { flex: 1; height: 20px; border-radius: 3px; background: var(--border2); transition: background 0.2s; border: 1px solid rgba(0,0,0,0.3); position: relative; }
.ms-block.ms-purple { background: var(--fastest);  box-shadow: 0 0 8px rgba(200,0,255,0.8); z-index: 9100; }
.ms-block.ms-green  { background: var(--green);   box-shadow: 0 0 8px rgba(0,230,57,0.6); }
.ms-block.ms-yellow { background: var(--accent3); box-shadow: 0 0 8px rgba(255,224,0,0.6); }
.ms-block.ms-none   { background: var(--border2); opacity: 0.4; }
.sector-block {
  flex: 1; background: var(--bg); border: 1px solid var(--border);
  border-radius: 2px; padding: 8px 6px; text-align: center;
  transition: border-color 0.3s, background 0.3s;
}
.sector-block.sector-purple { border-color: var(--fastest); background: rgba(200,0,255,0.08); }
.sector-block.sector-green  { border-color: var(--green);  background: rgba(0,230,57,0.06); }
.sector-block.sector-yellow { border-color: var(--accent3); background: rgba(255,224,0,0.06); }
.sec-label { font-family: var(--font-display); font-size: 9px; font-weight: 700; color: var(--text3); letter-spacing: 2px; margin-bottom: 4px; }
/* FIX-FONT: tempi settore con Barlow Condensed — 0 e 8 inequivocabili */
.sec-time  { font-family: var(--font-mono); font-size: 27px; font-weight: 700; color: var(--text); transition: color 0.2s; }
.sector-purple .sec-time {
  color: var(--fastest);
  animation: sectorPurpleBlink 0.7s step-end 6;
}
@keyframes sectorPurpleBlink {
  0%,100% { color: var(--fastest); text-shadow: 0 0 8px rgba(200,0,255,0.7); }
  50%     { color: rgba(200,0,255,0.25); text-shadow: none; }
}
.sector-green .sec-time  { color: var(--green); }
.sector-yellow .sec-time { color: var(--accent3); }

.best-times-row { display: flex; gap: 4px; }
.bt-block { flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 2px; padding: 7px 4px; text-align: center; }
.bt-label { font-family: var(--font-display); font-size: 7px; color: var(--text3); letter-spacing: 1px; margin-bottom: 4px; }
.bt-val   { font-family: var(--font-mono); font-size: 28px; font-weight: 700; color: var(--text); transition: color 0.3s; }
.bt-val.purple { color: var(--fastest); }
.bt-val.live   { color: var(--accent2); }
.bt-val.flash-new-best { animation: newBestFlash 2.5s ease-out; }
@keyframes newBestFlash {
  0%   { color: var(--green); text-shadow: 0 0 16px rgba(0,230,57,0.9); }
  70%  { color: var(--green); text-shadow: 0 0 16px rgba(0,230,57,0.9); }
  100% { color: var(--fastest); text-shadow: none; }
}
.bt-val.flash-new-best-purple { animation: newBestFlashPurple 2.5s ease-out; }
@keyframes newBestFlashPurple {
  0%   { color: var(--fastest); text-shadow: 0 0 20px rgba(200,0,255,1); }
  70%  { color: var(--fastest); text-shadow: 0 0 20px rgba(200,0,255,1); }
  100% { color: var(--fastest); text-shadow: none; }
}

/* ── LAP HISTORY ────────────────────────────────────────────── */
.lh-header {
  display: grid; grid-template-columns: 28px 1fr 1fr 1fr 1fr;
  gap: 2px; padding: 4px; background: var(--bg); border-radius: 3px; margin-bottom: 2px;
}
.lh-header span { font-family: var(--font-display); font-size: 8px; font-weight: 800; color: var(--text3); text-align: center; }
.lh-header span:nth-child(2) { text-align: left; }
/* FIX-LAYOUT: storico giri più alto — vede più giri senza scroll */
.lap-history-scroll { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; }
.lh-row { display: grid; grid-template-columns: 40px 1fr 1fr 1fr 1fr; gap: 6px; padding: 7px 8px; background: var(--bg); border-radius: 2px; }
/* FIX-FONT: Share Tech Mono per i tempi — cifre mono chiare */
.lh-row span { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: var(--text2); text-align: center; white-space: nowrap; }
.lh-row span:nth-child(2) { text-align: left; }
.lh-row.lap-invalid span { color: var(--text3); text-decoration: line-through; }
.lh-row .sector-purple { color: var(--fastest) !important; }
.lh-row .sector-green  { color: var(--green)  !important; }

/* ── RIGHT PANEL: TYRES ─────────────────────────────────────── */
.tyres-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tyre-corner { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tc-label    { font-family: var(--font-display); font-size: 9px; font-weight: 700; color: var(--text3); letter-spacing: 1px; }
.tc-visual   { position: relative; width: 54px; height: 54px; display: flex; align-items: center; justify-content: center; }
.tyre-svg    { width: 54px; height: 54px; transform: rotate(-90deg); }
.tyre-ring-bg   { fill: none; stroke: var(--border2); stroke-width: 5; }
.tyre-ring-wear { fill: none; stroke: var(--accent2); stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 0.5s ease, stroke 0.5s ease; }
.tc-wear-pct { position: absolute; font-family: var(--font-mono); font-size: 10px; font-weight: 700; color: var(--text); }
.tc-temp-row { display: flex; gap: 3px; align-items: center; font-family: var(--font-mono); font-size: 9px; }
.tc-temp     { color: var(--text3); }
.tc-temp.main { color: var(--text); font-size: 11px; font-weight: 700; }
.tc-psi      { color: var(--text3); font-size: 9px; }
.tyre-wear-bars { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.twb-row     { display: grid; grid-template-columns: 24px 1fr 32px; gap: 5px; align-items: center; }
.twb-engine-row { margin-top: 2px; padding-top: 4px; border-top: 1px solid var(--border); }
.twb-lbl     { font-family: var(--font-display); font-size: 8px; color: var(--text3); }
.twb-track   { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.twb-fill    { height: 100%; width: 0%; border-radius: 3px; transition: width 0.4s ease, background 0.3s; background: var(--green); }
.twb-fill.warn   { background: var(--accent3); }
.twb-fill.danger { background: var(--red); }
.twb-pct     { font-family: var(--font-mono); font-size: 9px; color: var(--text2); text-align: right; }

/* ── RIGHT PANEL: DAMAGE ────────────────────────────────────── */
.damage-grid { display: flex; flex-direction: column; gap: 4px; }
.dmg-row     { display: grid; grid-template-columns: 72px 1fr 32px; gap: 6px; align-items: center; }

/* Card Distacchi (dal leader / dall'avanti) — sostituisce la vecchia riga
   pressione gomme, dato utile e sempre aggiornato dal vivo. */
.gap-card { display: flex; flex-direction: column; gap: 8px; }
.gap-row  { display: flex; align-items: center; justify-content: space-between; }
.gap-label { font-family: var(--font-display); font-size: 10px; font-weight: 700; letter-spacing: 1px; color: var(--text3); }
.gap-val   { font-family: var(--font-mono); font-size: 18px; font-weight: 700; color: var(--accent2); text-shadow: 0 0 8px rgba(0,200,255,0.4); }
.gap-val.front { color: var(--accent3); text-shadow: 0 0 8px rgba(255,224,0,0.35); }
.gap-val.points { color: var(--green); text-shadow: 0 0 8px rgba(0,230,57,0.4); }
.dmg-label   { font-family: var(--font-data); font-size: 10px; color: var(--text3); white-space: nowrap; }
.dmg-track   { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.dmg-bar     { height: 100%; width: 0%; background: var(--green); border-radius: 3px; transition: width 0.5s ease, background 0.3s; }
.dmg-pct     { font-family: var(--font-mono); font-size: 9px; color: var(--text2); text-align: right; }

/* ── EVENTS FEED / RACE CONTROL ─────────────────────────────── */
.events-card { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 180px; }
.events-card .card-title {
  font-size: 11px; letter-spacing: 4px; color: var(--accent2);
  padding-bottom: 6px; border-bottom: 1px solid var(--border2); margin-bottom: 6px;
}
.events-feed {
  flex: 1 1 auto; max-height: 260px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 3px;
}
.event-feed-item {
  font-family: var(--font-mono); font-size: 11px; color: var(--text);
  padding: 6px 8px; background: var(--bg); border-radius: 2px;
  border-left: 3px solid var(--red-f1); line-height: 1.5;
  word-break: break-word;
}
.event-feed-item.evt-fastest    { border-left-color: var(--fastest);  color: var(--fastest); background: rgba(200,0,255,0.06); font-weight: 700; }
.event-feed-item.evt-penalty    { border-left-color: var(--orange);  color: #ffb347; }
.event-feed-item.evt-retirement { border-left-color: var(--red);     color: #ff6680; }
.event-feed-item.evt-safety     { border-left-color: var(--accent3); color: var(--accent3); }
.event-feed-item.evt-winner     { border-left-color: var(--accent3); color: var(--accent3); background: rgba(255,224,0,0.06); font-weight: 700; }
.event-feed-item.evt-info       { border-left-color: var(--accent2); color: var(--text); }
.event-time { color: var(--text3); margin-right: 8px; font-size: 10px; }

/* ── TYRE COLORS ────────────────────────────────────────────── */
.tyre-soft   { background: #ff3333; color: #fff; }
.tyre-medium { background: #ffff00; color: #000; }
.tyre-hard   { background: #e8e8e8; color: #000; }
.tyre-inter  { background: #39b54a; color: #fff; }
.tyre-wet    { background: #0067ff; color: #fff; }

/* ── WEAR STATES ────────────────────────────────────────────── */
.wear-ok      { stroke: var(--accent2) !important; }
.wear-caution { stroke: var(--accent3) !important; }
.wear-danger  { stroke: var(--red)     !important; }

/* ── SCROLLBARS ─────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border2) transparent; }

/* ── SIDEBAR LEADERBOARD IMPROVEMENTS — F1 TV style ────────── */
.sidebar-lb-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px 5px;
  background: linear-gradient(90deg, rgba(225,6,0,0.15), transparent);
  border-bottom: 1px solid rgba(225,6,0,0.3);
  flex-shrink: 0;
}
.sidebar-lb-title {
  font-family: var(--font-display);
  font-size: 8px; font-weight: 900;
  letter-spacing: 4px; color: var(--red-f1); text-transform: uppercase;
}

/* Sidebar position numbers with team color strips */
.slb-swatch { width: 5px; height: 100%; flex-shrink: 0; }
.slb-name {
  font-family: var(--font-display); font-size: 12px; font-weight: 800;
  color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  padding: 0 5px; display: flex; align-items: center; gap: 3px;
}
.slb-pos {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 12px; font-weight: 800;
  color: var(--text2); border-right: 1px solid rgba(255,255,255,0.04);
  height: 100%;
}

/* Pit stop items with better spacing */
.pit-stop-item {
  display: grid; grid-template-columns: 6px 1fr auto auto;
  gap: 6px; align-items: center; padding: 5px 6px;
  background: var(--bg); border-radius: 3px;
  border-left: 1px solid var(--border2);
}

/* Right panel flex to keep race control visible */
#panel-right { gap: 5px; }
.tyres-card  { flex-shrink: 0; }
.damage-card { flex-shrink: 0; }
.pitstops-card { flex-shrink: 0; max-height: 180px; }
.events-card { flex: 1 1 0; min-height: 160px; display: flex; flex-direction: column; }

/* ── TYRE BADGE — F1 TV style ───────────────────────────────── */
/* Larger, more visible tyre compound circles */
.slb-tyre {
  width: 20px !important; height: 20px !important;
  border-radius: 50% !important;
  font-size: 9px !important; font-weight: 900 !important;
  box-shadow: 0 0 4px rgba(0,0,0,0.5);
  border: 1px solid rgba(255,255,255,0.15);
}
/* F1 TV compound colors — solid vivid rings */
.tyre-soft   { background: #E8002D !important; color: #fff !important; }
.tyre-medium { background: #FFF200 !important; color: #000 !important; }
.tyre-hard   { background: #F0F0F0 !important; color: #000 !important; }
.tyre-inter  { background: #39B54A !important; color: #fff !important; }
.tyre-wet    { background: #0067FF !important; color: #fff !important; }

/* Player tyre dot — bigger and matching F1 TV */
.tyre-dot {
  width: 32px !important; height: 32px !important;
  font-size: 14px !important; font-weight: 900 !important;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 0 8px rgba(0,0,0,0.5);
}

/* ============================================================
   SCHERMATA SELEZIONE GIOCO — ricostruita in CSS/SVG puro dalle 4 immagini
   di riferimento fornite (sfondo pista da broadcast F1, diagonali rosse
   negli angoli, pattern a scacchi, linea centrale luminosa). Due schermate:
   selezione (tre card) e conferma (titolo enorme a schermo intero).
   ============================================================ */
.game-select-screen {
  position: fixed; inset: 0; z-index: 10000;
  background: #050506;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.game-select-screen.hidden { display: none; }

.gss-bg { position: absolute; inset: 0; overflow: hidden; }

.gss-diagonal { position: absolute; width: 32vw; height: 32vw; min-width: 260px; min-height: 260px; opacity: 0.85; }
.gss-diagonal-tl { top: -4%; left: -4%; }
.gss-diagonal-br { bottom: -4%; right: -4%; }

.gss-checker {
  position: absolute; top: 0; bottom: 0; width: 320px; opacity: 0.9;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,0.35) 25%, transparent 25%), linear-gradient(-45deg, rgba(255,255,255,0.35) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255,255,255,0.35) 75%), linear-gradient(-45deg, transparent 75%, rgba(255,255,255,0.35) 75%);
  background-size: 40px 40px; background-position: 0 0, 0 20px, 20px -20px, -20px 0;
}
.gss-checker::after {
  content: ''; position: absolute; inset: 0;
}
.gss-checker-left  { left: 0; }
.gss-checker-left::after  { background: linear-gradient(to right, transparent 0%, #050506 92%); }
.gss-checker-right { right: 0; }
.gss-checker-right::after { background: linear-gradient(to left, transparent 0%, #050506 92%); }

/* Linea rossa luminosa orizzontale al centro, con leggero respiro (l'unica
   animazione non innescata dall'utente in questa schermata — un solo
   momento curato, non effetti sparsi). */
.gss-centerline {
  position: absolute; left: 8%; right: 8%; top: 62%; height: 2px;
  background: linear-gradient(90deg, transparent, #ff2a2a 20%, #ff6a6a 50%, #ff2a2a 80%, transparent);
  box-shadow: 0 0 24px 4px rgba(255,42,42,0.55);
  animation: gssLineBreathe 4s ease-in-out infinite;
}
@keyframes gssLineBreathe {
  0%, 100% { opacity: 0.75; }
  50%      { opacity: 1; }
}
/* Riflesso della linea sulla "pista" in basso, sfumato verso il nero */
.gss-track-glow {
  position: absolute; left: 0; right: 0; bottom: 0; height: 42%;
  background:
    radial-gradient(60% 60% at 30% 100%, rgba(255,30,30,0.20), transparent 70%),
    radial-gradient(45% 50% at 78% 100%, rgba(255,30,30,0.16), transparent 70%),
    linear-gradient(180deg, transparent, rgba(15,0,0,0.6));
}

.gss-content { position: relative; z-index: 2; width: 100%; max-width: 1100px; padding: 0 40px; transform: translateY(-8vh); }

/* --- Schermata selezione --- */
.gss-eyebrow-row {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 56px;
}
.gss-eyebrow-title {
  font-family: var(--font-title); font-size: 15px; font-weight: 600;
  letter-spacing: 4px; color: #fff; text-transform: uppercase;
}
.gss-eyebrow-sub {
  font-family: var(--font-data); font-size: 10px; font-weight: 600;
  letter-spacing: 3px; color: var(--text2); text-transform: uppercase; margin-top: 4px;
}
.gss-eyebrow-right { display: flex; align-items: center; gap: 12px; text-align: right; flex-direction: row-reverse; }
.gss-rule { display: inline-block; width: 32px; height: 2px; background: var(--red-f1); }

.gss-cards { display: flex; gap: 24px; justify-content: center; flex-wrap: wrap; }
.gss-card {
  position: relative; width: 280px; height: 170px;
  background: linear-gradient(155deg, rgba(225,6,0,0.12), rgba(0,0,0,0.4) 40%);
  border: 1.5px solid rgba(255,255,255,0.55);
  clip-path: polygon(18px 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%, 0 18px);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.gss-card:hover {
  transform: translateY(-4px);
  border-color: var(--red-f1);
  background: linear-gradient(155deg, rgba(225,6,0,0.22), rgba(0,0,0,0.4) 40%);
}
.gss-card-label {
  font-family: var(--font-display); font-size: 46px; font-weight: 800;
  font-style: italic; color: #fff; letter-spacing: -1px;
  text-shadow: 0 0 20px rgba(255,255,255,0.25);
}
.gss-card-flag {
  position: absolute; bottom: 10px; right: 10px; width: 46px; height: 30px;
  color: rgba(255,255,255,0.5);
}

/* --- Schermata selezione MODALITÀ (griglia 2 righe x 3, più compatta delle
       card gioco perché sono 6 invece di 3) --- */
.gss-mode.hidden { display: none; }
.gss-mode-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  max-width: 880px; margin: 0 auto;
}
.gss-mode-card {
  position: relative; padding: 20px 16px;
  background: linear-gradient(155deg, rgba(225,6,0,0.10), rgba(0,0,0,0.4) 40%);
  border: 1.5px solid rgba(255,255,255,0.4);
  clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
  cursor: pointer; text-align: left;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
  display: flex; flex-direction: column; gap: 6px;
}
.gss-mode-card:hover {
  transform: translateY(-3px);
  border-color: var(--red-f1);
  background: linear-gradient(155deg, rgba(225,6,0,0.2), rgba(0,0,0,0.4) 40%);
}
.gss-mode-label {
  font-family: var(--font-display); font-size: 20px; font-weight: 800;
  font-style: italic; color: #fff; letter-spacing: 0.5px;
}
.gss-mode-sub {
  font-family: var(--font-data); font-size: 10px; font-weight: 600;
  letter-spacing: 1px; color: var(--text2); text-transform: uppercase;
}
@media (max-width: 640px) {
  .gss-mode-grid { grid-template-columns: 1fr; }
}

.gss-confirm { text-align: center; }
.gss-confirm.hidden { display: none; }
.gss-confirm-eyebrow {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  font-family: var(--font-data); font-size: 12px; font-weight: 600;
  letter-spacing: 6px; color: var(--text2); margin-bottom: 28px;
}
.gss-confirm-title {
  font-family: var(--font-display); font-size: 120px; font-weight: 800;
  font-style: italic; color: #fff; letter-spacing: -2px; line-height: 1;
  text-shadow: 0 0 40px rgba(255,255,255,0.3);
  animation: gssTitleIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes gssTitleIn {
  from { opacity: 0; transform: scale(0.85) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
.gss-confirm-sub {
  font-family: var(--font-data); font-size: 13px; font-weight: 600;
  letter-spacing: 5px; color: var(--text2); margin-top: 28px; text-transform: uppercase;
}
@media (max-width: 640px) {
  .gss-confirm-title { font-size: 64px; }
  .gss-cards { flex-direction: column; align-items: center; }
  .gss-card { width: 100%; max-width: 320px; }
  .gss-eyebrow-row { flex-direction: column; gap: 16px; }
}

