/* =========================================================================
   BIO-ENERGY GRAND PRIX 3D | ESTILO ARCADE DIURNO & AMIGABLE (16:9)
   Interfaz luminosa de videojuego real, botones táctiles 3D y cero scroll
   ========================================================================= */

:root {
  --font-display: 'Fredoka', 'Orbitron', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-tech: 'Orbitron', 'Fredoka', sans-serif;
  --font-main: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Paleta Clara, Luminosa y Amigable */
  --bg-outer: #bfe3ff;
  --bg-sky-top: #e8f6ff;
  --bg-sky-mid: #f2fbf6;
  --bg-sky-bot: #fffbeb;

  --bg-card: #ffffff;
  --bg-soft: #f1f7fd;
  --bg-input: #f8fafc;

  --text-dark: #1e293b;
  --text-body: #334155;
  --text-muted: #64748b;

  /* Colores de Juego Vibrantes */
  --neon-cyan: #0ea5e9;
  --neon-blue: #2563eb;
  --neon-emerald: #10b981;
  --neon-amber: #f59e0b;
  --neon-orange: #f97316;
  --neon-red: #ef4444;
  --neon-purple: #8b5cf6;

  --p1-color: #0284c7;
  --p1-light: #e0f2fe;
  --p2-color: #ea580c;
  --p2-light: #ffedd5;

  --border-card: #dbeafe;
  --border-subtle: #e2e8f0;
  --shadow-card: 0 5px 0 #cbd5e1, 0 10px 22px rgba(15, 23, 42, 0.08);
}

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

html, body {
  width: 100vw;
  height: 100vh;
  overflow: hidden; /* CERO SCROLL EN TODA LA APLICACIÓN */
  background: radial-gradient(circle at 50% 30%, #dff2ff 0%, #b3dcff 100%);
  font-family: var(--font-main);
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================================
   CONTENEDOR MAESTRO 16:9 FIJO Y ESCALABLE
   ========================================================================= */
#game-viewport {
  width: 100vw;
  height: 100vh;
  max-width: 177.78vh; /* 16:9 estricto */
  max-height: 56.25vw; /* 16:9 estricto */
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 255, 255, 0.9) 0%, transparent 40%),
    radial-gradient(circle at 85% 20%, rgba(186, 230, 253, 0.45) 0%, transparent 45%),
    linear-gradient(165deg, var(--bg-sky-top) 0%, var(--bg-sky-mid) 55%, var(--bg-sky-bot) 100%);
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 55px rgba(14, 116, 144, 0.22), 0 0 0 3px #ffffff;
}

/* Canvas para efectos de partículas y confeti */
#fx-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 180;
}

/* =========================================================================
   BARRA SUPERIOR GLOBAL (HUD DE JUEGO 46px)
   ========================================================================= */
#global-header {
  height: 46px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 3px solid #bae6fd;
  box-shadow: 0 3px 12px rgba(14, 165, 233, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  z-index: 20;
}

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

.brand-atom {
  font-size: 20px;
  color: #000000;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  object-fit: contain;
  padding: 2px;
  box-shadow: 0 3px 0 #cbd5e1;
}

.brand-titles {
  display: flex;
  flex-direction: column;
}

.brand-main {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-tag-3d {
  background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
  color: #ffffff;
  font-family: var(--font-tech);
  font-size: 9px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 6px;
  box-shadow: 0 2px 0 #c2410c;
}

.brand-sub {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.4px;
  color: #0284c7;
}

.header-center-info {
  display: flex;
  align-items: center;
}

.center-badge-title {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 600;
  color: #0369a1;
  letter-spacing: 0.5px;
  background: linear-gradient(180deg, #f0f9ff 0%, #e0f2fe 100%);
  padding: 5px 16px;
  border-radius: 999px;
  border: 2px solid #bae6fd;
  box-shadow: 0 2px 0 #bae6fd;
  display: flex;
  align-items: center;
  gap: 7px;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 7px;
}

.btn-ctrl {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  box-shadow: 0 3px 0 #cbd5e1;
  color: #334155;
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 800;
  padding: 5px 11px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s, box-shadow 0.1s, background 0.15s;
}

.btn-ctrl:hover {
  background: #f0f9ff;
  border-color: #7dd3fc;
  color: #0284c7;
  transform: translateY(-1px);
}

.btn-ctrl:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #cbd5e1;
}

.btn-ctrl.active-toggle {
  background: #e0f2fe;
  border-color: #38bdf8;
  box-shadow: 0 3px 0 #38bdf8;
}

/* =========================================================================
   PANTALLAS (SWITCH)
   ========================================================================= */
.app-screen {
  flex: 1;
  min-height: 0;
  display: none;
  position: relative;
  overflow: hidden;
  padding: 10px 14px 12px;
}

.app-screen.active {
  display: flex;
  flex-direction: column;
}

/* =========================================================================
   PANTALLA 1: GARAGE & SHOWROOM 3D (3 COLUMNAS EN 16:9)
   ========================================================================= */
.paddock-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1.52fr 0.94fr 296px;
  gap: 12px;
  height: 100%;
  overflow: hidden;
}

/* Columna 1: Parrilla 2x3 de Coches con Tarjetas Amplias 3D */
.paddock-cars-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.area-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 8px;
  margin-bottom: 6px;
  padding: 0 2px;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  color: #0369a1;
  flex-shrink: 0;
}

.tip-text {
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  background: rgba(255, 255, 255, 0.8);
  padding: 2px 9px;
  border-radius: 999px;
}

.compact-cars-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: 9px;
}

.paddock-car-card {
  background: #ffffff;
  border-radius: 15px;
  border: 2px solid #e2e8f0;
  box-shadow: 0 4px 0 #cbd5e1, 0 6px 14px rgba(15, 23, 42, 0.06);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  position: relative;
  transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s;
  overflow: visible;
  cursor: pointer;
}

.paddock-car-card:hover {
  border-color: #38bdf8;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #7dd3fc, 0 10px 18px rgba(14, 165, 233, 0.14);
}

.paddock-car-card.selected-p1 {
  border: 2.5px solid var(--p1-color);
  background: linear-gradient(180deg, #ffffff 0%, #f0f9ff 100%);
  box-shadow: 0 4px 0 #0284c7, 0 8px 18px rgba(2, 132, 199, 0.18);
}

.paddock-car-card.selected-p2 {
  border: 2.5px solid var(--p2-color);
  background: linear-gradient(180deg, #ffffff 0%, #fff7ed 100%);
  box-shadow: 0 4px 0 #ea580c, 0 8px 18px rgba(234, 88, 12, 0.18);
}

.paddock-car-card.selected-both {
  border: 2.5px solid #8b5cf6;
  background: linear-gradient(180deg, #ffffff 0%, #f5f3ff 100%);
  box-shadow: 0 4px 0 #7c3aed, 0 8px 18px rgba(139, 92, 246, 0.2);
}

.card-top-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-shrink: 0;
}

.card-title-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.car-frame-badge {
  font-size: 8px;
  font-weight: 900;
  padding: 2px 6px;
  border-radius: 6px;
  color: #ffffff;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.car-name-title {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.badge-3d-tag {
  font-family: var(--font-tech);
  font-size: 8px;
  font-weight: 900;
  color: #0284c7;
  background: #e0f2fe;
  padding: 2px 6px;
  border-radius: 6px;
  flex-shrink: 0;
}

.card-body-row {
  display: flex;
  align-items: stretch;
  gap: 9px;
  flex: 1;
  min-height: 0;
}

/* Fotograma 3D completo del coche */
.car-thumb-box {
  width: clamp(72px, 30%, 110px);
  aspect-ratio: 1;
  height: auto;
  align-self: center;
  border-radius: 11px;
  background: radial-gradient(circle at center, #334155 0%, #1e293b 100%);
  overflow: hidden;
  border: 2px solid #cbd5e1;
  flex-shrink: 0;
  position: relative;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
}

.card-3d-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.car-info-col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 4px;
  flex: 1;
  min-width: 0;
  padding: 1px 0;
}

.car-tag-subtitle {
  font-size: 10px;
  font-weight: 800;
  color: #475569;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.car-ability-pill {
  font-size: 9.5px;
  font-weight: 800;
  color: #0369a1;
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
  padding: 4px 7px;
  border-radius: 8px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.car-quick-specs {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.quick-chip {
  font-size: 9px;
  font-weight: 800;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 2px 6px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.quick-chip i {
  color: #0ea5e9;
}

.card-actions-strip {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-assign {
  flex: 1;
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 2px 0 #cbd5e1;
  color: #475569;
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  padding: 5px 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.12s;
}

.btn-assign:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.btn-assign:active {
  transform: translateY(1px);
  box-shadow: 0 1px 0 #cbd5e1;
}

.btn-assign.p1-active {
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  border-color: #0369a1;
  box-shadow: 0 2px 0 #075985;
}

.btn-assign.p2-active {
  background: linear-gradient(180deg, #fbbf24 0%, #ea580c 100%);
  color: #ffffff;
  border-color: #c2410c;
  box-shadow: 0 2px 0 #9a3412;
}

/* =========================================================================
   Columna 2: SHOWROOM HOLO-STAGE 3D (POD CENTRAL DE VIDEOJUEGO)
   ========================================================================= */
.paddock-holo-stage {
  background: #ffffff;
  border: 2px solid #bae6fd;
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 0 #bae6fd, 0 12px 24px rgba(14, 165, 233, 0.12);
}

.holo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.holo-tag {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  display: flex;
  align-items: center;
  gap: 5px;
}

.holo-status-live {
  font-family: var(--font-tech);
  font-size: 8.5px;
  font-weight: 900;
  color: #047857;
  background: #d1fae5;
  border: 1.5px solid #6ee7b7;
  padding: 2px 7px;
  border-radius: 999px;
  animation: pulseLive 1.5s infinite alternate;
}

@keyframes pulseLive {
  from { opacity: 0.75; }
  to { opacity: 1; }
}

/* Visor 3D del Showroom (con recorte anti-QR conservado) */
.holo-turntable-wrapper {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 14px;
  border: 3px solid #cbd5e1;
  background: radial-gradient(circle at 50% 55%, #334155 0%, #1e293b 65%, #0f172a 100%);
  box-shadow: inset 0 4px 16px rgba(0, 0, 0, 0.45);
}

.holo-stage-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.65));
}

.holo-pedestal-grid {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 22px;
  background: repeating-linear-gradient(90deg, rgba(56, 189, 248, 0.25) 0, rgba(56, 189, 248, 0.25) 1px, transparent 1px, transparent 18px);
  border-top: 1px solid rgba(56, 189, 248, 0.45);
}

.holo-car-meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 7px;
}

.holo-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  overflow-wrap: anywhere;
}

.holo-subtitle {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  overflow-wrap: anywhere;
}

.holo-ability-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #ecfdf5 100%);
  border: 1.5px solid #bae6fd;
  border-left: 4px solid #0ea5e9;
  padding: 6px 9px;
  border-radius: 9px;
  margin: 2px 0;
}

.holo-ab-title {
  font-family: var(--font-display);
  font-size: 10.5px;
  font-weight: 700;
  color: #0f172a;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  overflow-wrap: anywhere;
}

.holo-ab-desc {
  font-size: 9.5px;
  font-weight: 600;
  color: #475569;
  line-height: 1.25;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

/* Rejilla de especificaciones con barras de juego */
.holo-specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
}

.holo-spec-item {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  padding: 4px 7px;
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.spec-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px;
}

.spec-label {
  font-size: 7.5px;
  font-weight: 900;
  color: #64748b;
  overflow-wrap: anywhere;
}

.spec-val {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 700;
  color: #0f172a;
  overflow-wrap: anywhere;
}

.spec-bar-track {
  width: 100%;
  height: 5px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.spec-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.fill-hp { background: linear-gradient(90deg, #10b981, #34d399); }
.fill-weight { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.fill-cx { background: linear-gradient(90deg, #8b5cf6, #a78bfa); }
.fill-speed { background: linear-gradient(90deg, #0284c7, #38bdf8); }

/* =========================================================================
   Columna 3: Panel de Reglajes de Carrera
   ========================================================================= */
.paddock-config-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.panel-box {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  box-shadow: 0 5px 0 #cbd5e1, 0 10px 22px rgba(15, 23, 42, 0.08);
  border-radius: 16px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  height: 100%;
  justify-content: space-between;
  gap: 6px;
}

.panel-title {
  font-family: var(--font-display);
  font-size: 12.5px;
  font-weight: 700;
  color: #0369a1;
  letter-spacing: 0.3px;
  padding-bottom: 4px;
  border-bottom: 2px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 6px;
}

.config-row {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 7px 9px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 0;
}

.cfg-lbl {
  font-size: 8.5px;
  font-weight: 900;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.pill-group {
  display: flex;
  min-width: 0;
  background: #e2e8f0;
  padding: 3px;
  border-radius: 8px;
  gap: 3px;
}

.pill-btn {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: #475569;
  font-family: var(--font-main);
  font-size: 9.5px;
  font-weight: 800;
  padding: 6px 3px;
  line-height: 1.15;
  overflow-wrap: anywhere;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.14s;
}

.pill-btn:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.75);
}

.pill-btn.active {
  background: linear-gradient(180deg, #38bdf8 0%, #0ea5e9 100%);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 2px 0 #0284c7;
}

.cfg-select {
  width: 100%;
  min-width: 0;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #0f172a;
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: 800;
  padding: 7px 8px;
  border-radius: 8px;
  outline: none;
  cursor: pointer;
}

.cfg-select:focus {
  border-color: #0ea5e9;
}

.track-legend-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 7px 9px;
}

.legend-mini-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.legend-chip {
  font-size: 9px;
  font-weight: 700;
  padding: 4px 6px;
  border-radius: 7px;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  line-height: 1.15;
}

.leg-turbo { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }
.leg-trap  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.leg-box   { background: #e0f2fe; color: #075985; border: 1px solid #bae6fd; }
.leg-fail  { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }

.selection-summary-card {
  background: linear-gradient(135deg, #f0f9ff 0%, #ffffff 50%, #fff7ed 100%);
  border: 2px solid #bae6fd;
  border-radius: 12px;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
}

.summary-line {
  flex: 1;
  min-width: 0;
  font-size: 9.5px;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 2px;
}

.sum-badge {
  font-family: var(--font-display);
  font-size: 8.5px;
  font-weight: 700;
  color: #ffffff;
  padding: 1px 7px;
  border-radius: 999px;
}
.badge-p1 { background: var(--p1-color); }
.badge-p2 { background: var(--p2-color); }

.sum-car {
  overflow-wrap: anywhere;
  max-width: 100%;
  font-size: 9.5px;
}

@media (max-height: 700px) {
  #screen-selection {
    overflow-y: auto;
  }

  .paddock-layout {
    min-height: 640px;
    overflow: visible;
  }
}

@media (max-width: 1100px) {
  #screen-selection {
    overflow-y: auto;
  }

  .paddock-layout {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
    grid-template-rows: minmax(560px, auto) minmax(560px, auto);
    height: auto;
    overflow: visible;
  }

  .paddock-cars-area,
  .paddock-holo-stage {
    min-height: 560px;
  }

  .paddock-config-area {
    grid-column: 1 / -1;
    min-height: 560px;
  }

  .card-title-left {
    flex-wrap: wrap;
  }

  .car-name-title {
    flex-basis: 100%;
  }
}

.summary-vs-sep {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-launch-race {
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 2px solid #059669;
  cursor: pointer;
  box-shadow: 0 5px 0 #047857, 0 8px 18px rgba(16, 185, 129, 0.3);
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.btn-launch-race:hover {
  background: linear-gradient(180deg, #4ade80 0%, #10b981 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 0 #047857, 0 12px 22px rgba(16, 185, 129, 0.35);
}

.btn-launch-race:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #047857;
}

/* =========================================================================
   PANTALLA 2: PISTA DIURNA EN TIEMPO REAL Y CONSOLA (16:9 TOTAL)
   ========================================================================= */
#screen-race {
  display: none;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-height: 0;
  padding: 7px 14px 10px;
}

#screen-race.active {
  display: flex;
}

/* 1. Barra de Telemetría Superior */
.race-top-telemetry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 30px;
  flex-shrink: 0;
}

.telemetry-box {
  background: #ffffff;
  border: 2px solid #cbd5e1;
  box-shadow: 0 3px 0 #cbd5e1;
  border-radius: 10px;
  padding: 4px 12px;
  font-size: 10.5px;
  font-weight: 800;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 6px;
}

.leader-box {
  font-family: var(--font-display);
  font-size: 11px;
}

.status-box strong {
  color: var(--p1-color);
}

.btn-mini-race {
  background: #fee2e2;
  border: 1.5px solid #fca5a5;
  color: #dc2626;
  font-family: var(--font-main);
  font-size: 10px;
  font-weight: 900;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.btn-mini-race:hover {
  background: #fecaca;
}

/* =========================================================================
   2. EL CIRCUITO VISUAL DE 2 CARRILES (ESTILO CIRCUITO REAL DIURNO)
   ========================================================================= */
.visual-circuit-container {
  height: 37%;
  min-height: 150px;
  background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
  border: 3px solid #ffffff;
  border-radius: 16px;
  padding: 7px 8px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 5px 0 #86efac, 0 10px 22px rgba(22, 163, 74, 0.18);
}

/* Pianos de circuito (franjas rojas y blancas arriba y abajo) */
.visual-circuit-container::before,
.visual-circuit-container::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg, #ef4444 0 18px, #ffffff 18px 36px);
  z-index: 2;
}
.visual-circuit-container::before { top: 0; }
.visual-circuit-container::after { bottom: 0; }

.circuit-track-surface {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid #cbd5e1;
  background: linear-gradient(180deg, #475569 0%, #3b4758 50%, #475569 100%);
  box-shadow: inset 0 4px 12px rgba(15, 23, 42, 0.35);
}

.circuit-lane {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.lane-p1 {
  background: linear-gradient(180deg, rgba(56, 189, 248, 0.1) 0%, transparent 100%);
}

.lane-p2 {
  background: linear-gradient(180deg, transparent 0%, rgba(251, 146, 60, 0.1) 100%);
}

.lane-header-label {
  position: absolute;
  top: 4px;
  left: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 5;
  background: rgba(255, 255, 255, 0.92);
  padding: 2px 7px 2px 3px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.lane-tag {
  font-family: var(--font-display);
  font-size: 8px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  color: #ffffff;
}
.tag-p1 { background: var(--p1-color); }
.tag-p2 { background: var(--p2-color); }

.lane-driver-name {
  font-size: 9px;
  font-weight: 900;
  color: #0f172a;
}

.lane-divider-strip {
  height: 3px;
  background: repeating-linear-gradient(90deg, #f8fafc 0, #f8fafc 20px, transparent 20px, transparent 38px);
  width: 100%;
  opacity: 0.75;
}

.lane-tiles-track {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  position: relative;
}

.lane-tile-node {
  flex: 1;
  height: 76%;
  border-right: 1px dashed rgba(255, 255, 255, 0.22);
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 2px;
}

.tile-step-num {
  font-family: var(--font-tech);
  font-size: 8px;
  font-weight: 800;
  color: rgba(241, 245, 249, 0.7);
}

.lane-tile-node.tile-start {
  background: rgba(255, 255, 255, 0.12);
  border-left: 3px solid #34d399;
}

.lane-tile-node.tile-turbo {
  background: rgba(250, 204, 21, 0.22);
  border-top: 3px solid #facc15;
}
.lane-tile-node.tile-turbo::after {
  content: "⚡";
  font-size: 11px;
  position: absolute;
  top: 2px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.lane-tile-node.tile-trampa {
  background: rgba(248, 113, 113, 0.22);
  border-top: 3px solid #f87171;
}
.lane-tile-node.tile-trampa::after {
  content: "☠️";
  font-size: 10px;
  position: absolute;
  top: 2px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.lane-tile-node.tile-box {
  background: rgba(56, 189, 248, 0.22);
  border-top: 3px solid #38bdf8;
}
.lane-tile-node.tile-box::after {
  content: "🔧";
  font-size: 10px;
  position: absolute;
  top: 2px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.lane-tile-node.tile-finish {
  background: repeating-conic-gradient(#0f172a 0% 25%, #ffffff 0% 50%) 50% / 10px 10px;
  border-left: 3px solid #facc15;
}
.lane-tile-node.tile-finish::after {
  content: "🏆";
  font-size: 13px;
  position: absolute;
  top: 1px;
  filter: drop-shadow(0 2px 3px rgba(0,0,0,0.6));
}

/* BÓLIDO 3D ANIMADO EN PISTA (CONDUCCIÓN DINÁMICA HACIA ADELANTE) */
.animated-race-car {
  position: absolute;
  top: 52%;
  transform: translateY(-50%);
  left: 1%;
  width: 88px;
  height: 54px;
  transition: left 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 10;
  pointer-events: none;
}

.car-sprite-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: driveEngineBounce 0.3s infinite ease-in-out alternate;
}

/* Sombra dinámica de contacto bajo el bólido */
.car-ground-shadow {
  position: absolute;
  bottom: 1px;
  left: 10%;
  width: 80%;
  height: 8px;
  background: radial-gradient(ellipse at center, rgba(15, 23, 42, 0.75) 0%, rgba(15, 23, 42, 0) 75%);
  border-radius: 50%;
  animation: shadowPulse 0.3s infinite ease-in-out alternate;
  z-index: 1;
}

@keyframes shadowPulse {
  from { transform: scaleX(0.96); opacity: 0.85; }
  to { transform: scaleX(1.04); opacity: 0.65; }
}

/* Imagen del bólido 3D orientado al frente (hacia la derecha/meta) */
.car-track-drive-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: relative;
  z-index: 2;
  transform-origin: center bottom;
  filter: drop-shadow(0 4px 6px rgba(15, 23, 42, 0.75));
  transition: transform 0.2s, filter 0.2s;
}

.car-p1 .car-track-drive-img {
  filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.9)) drop-shadow(0 5px 8px rgba(15, 23, 42, 0.65));
}
.car-p2 .car-track-drive-img {
  filter: drop-shadow(0 0 6px rgba(251, 146, 60, 0.9)) drop-shadow(0 5px 8px rgba(15, 23, 42, 0.65));
}

/* Animación de suspensión activa y vibración de motor rodando hacia adelante */
@keyframes driveEngineBounce {
  0% { transform: translateY(0px) rotate(0deg); }
  35% { transform: translateY(-1.5px) rotate(0.4deg); }
  70% { transform: translateY(0.8px) rotate(-0.3deg); }
  100% { transform: translateY(-0.8px) rotate(0.2deg); }
}

/* Estelas aerodinámicas de velocidad hacia atrás */
.car-wind-streaks {
  position: absolute;
  top: 30%;
  right: -6px;
  width: 22px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.9), transparent);
  box-shadow: 0 7px 0 rgba(255, 255, 255, 0.6), 0 14px 0 rgba(255, 255, 255, 0.75);
  opacity: 0.5;
  animation: windSpeed 0.22s infinite linear;
  z-index: 3;
}

@keyframes windSpeed {
  0% { transform: translateX(0px); opacity: 0.25; }
  50% { transform: translateX(-5px); opacity: 0.7; }
  100% { transform: translateX(-10px); opacity: 0; }
}

.car-floating-tag {
  position: absolute;
  top: -15px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-display);
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1.5px solid #ffffff;
  white-space: nowrap;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.35);
  z-index: 5;
}

.car-p1 .car-floating-tag { background: var(--p1-color); color: #ffffff; }
.car-p2 .car-floating-tag { background: var(--p2-color); color: #ffffff; }

/* Inyección de Nitro al avanzar en la carrera */
.car-exhaust-flame {
  position: absolute;
  top: 55%;
  left: -16px;
  transform: translateY(-50%);
  width: 22px;
  height: 11px;
  background: radial-gradient(ellipse at right, #fff 0%, #38bdf8 35%, #0284c7 70%, transparent 100%);
  border-radius: 50% 0 0 50%;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 1;
}

.car-p2 .car-exhaust-flame {
  background: radial-gradient(ellipse at right, #fff 0%, #facc15 35%, #ea580c 70%, transparent 100%);
}

.nitro-active .car-exhaust-flame {
  opacity: 1;
  animation: flameFlicker 0.08s infinite alternate;
}

.nitro-active .car-sprite-wrapper {
  animation: nitroThrust 0.15s infinite alternate;
}

.nitro-active .car-track-drive-img {
  transform: skewX(-4deg) translateY(-2px) scale(1.04);
}

@keyframes nitroThrust {
  0% { transform: translateY(-1px) translateX(2px); }
  100% { transform: translateY(1px) translateX(-1px); }
}

@keyframes flameFlicker {
  from { transform: translateY(-50%) scaleX(0.85) scaleY(0.9); }
  to { transform: translateY(-50%) scaleX(1.4) scaleY(1.2); }
}

/* Trompo de descarrilamiento (3 fallos seguidos) */
.car-spinout {
  animation: spinTrompo 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

@keyframes spinTrompo {
  0% { transform: translateY(-50%) rotate(0deg); }
  30% { transform: translateY(-70%) rotate(240deg) scale(1.15); }
  70% { transform: translateY(-30%) rotate(540deg) scale(0.9); }
  100% { transform: translateY(-50%) rotate(720deg) scale(1); }
}

/* =========================================================================
   3. ZONA INFERIOR: SALPICADEROS Y CONSOLA DE PREGUNTAS (ENCAJE 16:9)
   ========================================================================= */
.race-bottom-dashboard {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 215px 1fr 215px;
  gap: 10px;
  overflow: hidden;
}

.driver-cockpit {
  background: #ffffff;
  border: 2px solid #e2e8f0;
  box-shadow: 0 5px 0 #cbd5e1;
  border-radius: 16px;
  padding: 9px 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}

.cockpit-left { border-top: 4px solid var(--p1-color); }
.cockpit-right { border-top: 4px solid var(--p2-color); }

.cockpit-left.cockpit-active-turn {
  border-color: var(--p1-color);
  background: linear-gradient(180deg, #f0f9ff 0%, #ffffff 100%);
  box-shadow: 0 5px 0 #7dd3fc, 0 0 18px rgba(14, 165, 233, 0.2);
}

.cockpit-right.cockpit-active-turn {
  border-color: var(--p2-color);
  background: linear-gradient(180deg, #fff7ed 0%, #ffffff 100%);
  box-shadow: 0 5px 0 #fdba74, 0 0 18px rgba(234, 88, 12, 0.2);
}

.cockpit-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Avatar 3D en el Salpicadero (con recorte anti-QR conservado) */
.driver-avatar-wrap {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  background: #1e293b;
  overflow: hidden;
  border: 2px solid #cbd5e1;
  flex-shrink: 0;
  position: relative;
}

.driver-3d-avatar-vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.36) translateY(5%);
  pointer-events: none;
}

.driver-meta {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.driver-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.driver-car-sub {
  font-size: 9.5px;
  font-weight: 700;
  color: #64748b;
}

.cockpit-gauge-row {
  display: flex;
  gap: 6px;
}

.gauge-item {
  flex: 1;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  padding: 5px 7px;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
}

.gauge-lbl {
  font-size: 8px;
  font-weight: 900;
  color: #64748b;
}

.gauge-val {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.cockpit-engine-box {
  background: #f8fafc;
  border-radius: 10px;
  padding: 6px 7px;
  border: 1.5px solid #e2e8f0;
}

.engine-box-title {
  font-size: 8.5px;
  font-weight: 900;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.engine-lights-row {
  display: flex;
  gap: 4px;
}

.engine-light-pill {
  flex: 1;
  background: #e2e8f0;
  border: 1.5px solid #cbd5e1;
  color: #64748b;
  font-size: 7.5px;
  font-weight: 900;
  text-align: center;
  padding: 4px 0;
  border-radius: 6px;
  transition: all 0.2s;
}

.engine-light-pill.light-1.active {
  background: #fbbf24;
  border-color: #d97706;
  color: #451a03;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

.engine-light-pill.light-2.active {
  background: #fb923c;
  border-color: #ea580c;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(249, 115, 22, 0.6);
}

.engine-light-pill.light-3.active {
  background: #ef4444;
  border-color: #b91c1c;
  color: #ffffff;
  box-shadow: 0 0 14px rgba(239, 68, 68, 0.7);
  animation: dangerPulse 0.4s infinite alternate;
}

@keyframes dangerPulse {
  from { opacity: 0.7; }
  to { opacity: 1; }
}

.cockpit-passive-badge {
  font-size: 9px;
  font-weight: 800;
  color: #0369a1;
  background: #e0f2fe;
  border: 1px solid #bae6fd;
  padding: 4px 7px;
  border-radius: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================================
   CONSOLA CENTRAL DE PREGUNTAS (TARJETA DE JUEGO LUMINOSA)
   ========================================================================= */
.question-terminal {
  background: #ffffff;
  border: 2px solid #bae6fd;
  box-shadow: 0 5px 0 #bae6fd, 0 10px 22px rgba(14, 165, 233, 0.12);
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.term-left-info {
  display: flex;
  align-items: center;
  gap: 6px;
}

.turn-driver-badge {
  font-family: var(--font-display);
  font-size: 9.5px;
  font-weight: 700;
  background: var(--p1-color);
  color: #ffffff;
  padding: 3px 9px;
  border-radius: 999px;
}

.term-block-badge {
  font-size: 9.5px;
  font-weight: 800;
  color: #0369a1;
  background: #e0f2fe;
  padding: 3px 8px;
  border-radius: 999px;
}

.term-diff-badge {
  font-family: var(--font-display);
  font-size: 8.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  color: #ffffff;
}
.diff-facil { background: #10b981; }
.diff-media { background: #f59e0b; }
.diff-dificil { background: #ef4444; }

.term-timer-group {
  display: flex;
  align-items: center;
  gap: 7px;
}

.timer-bar-track {
  width: 90px;
  height: 8px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #cbd5e1;
}

.timer-bar-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8);
  transition: width 1s linear;
}

.timer-digits {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #0284c7;
  width: 26px;
  text-align: right;
}

.tile-event-alert {
  background: linear-gradient(90deg, #fef3c7, #fffbeb);
  border: 1.5px solid #f59e0b;
  color: #b45309;
  font-size: 9.5px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 8px;
  margin-bottom: 5px;
}

.terminal-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
}

.terminal-q-text {
  font-family: var(--font-display);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  color: #0f172a;
  margin-bottom: 8px;
}

.terminal-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.term-opt-btn {
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  box-shadow: 0 4px 0 #cbd5e1;
  border-radius: 11px;
  padding: 7px 10px;
  color: #1e293b;
  font-family: var(--font-main);
  font-size: 11px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.12s;
}

.term-opt-btn:hover:not(:disabled) {
  background: #f0f9ff;
  border-color: #38bdf8;
  box-shadow: 0 4px 0 #38bdf8;
  color: #0369a1;
  transform: translateY(-1px);
}

.term-opt-btn:active:not(:disabled) {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #38bdf8;
}

.opt-prefix {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  background: #e2e8f0;
  color: #334155;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.term-opt-btn:hover:not(:disabled) .opt-prefix {
  background: #0ea5e9;
  color: #ffffff;
}

.term-opt-btn.correct {
  background: #d1fae5 !important;
  border-color: #10b981 !important;
  box-shadow: 0 4px 0 #059669 !important;
  color: #065f46 !important;
}
.term-opt-btn.correct .opt-prefix {
  background: #10b981;
  color: #ffffff;
}

.term-opt-btn.wrong {
  background: #fee2e2 !important;
  border-color: #ef4444 !important;
  box-shadow: 0 4px 0 #dc2626 !important;
  color: #991b1b !important;
}
.term-opt-btn.wrong .opt-prefix {
  background: #ef4444;
  color: #ffffff;
}

/* OVERLAY DE FEEDBACK PEDAGÓGICO DENTRO DE LA CONSOLA */
.terminal-feedback-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(5px);
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  z-index: 15;
  animation: fadeInFast 0.16s ease-out;
}

@keyframes fadeInFast {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.feedback-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

#fb-verdict-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
}

.fb-advance-note {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: #0369a1;
  background: #e0f2fe;
  padding: 3px 10px;
  border-radius: 999px;
}

.feedback-explanation-body {
  font-size: 11.5px;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.38;
  background: #f0f9ff;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1.5px solid #bae6fd;
  border-left: 4px solid #0ea5e9;
  overflow-y: auto;
  max-height: 92px;
}

.btn-term-advance {
  align-self: flex-end;
  background: linear-gradient(180deg, #38bdf8 0%, #0284c7 100%);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 10px;
  border: 2px solid #0369a1;
  box-shadow: 0 3px 0 #075985;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: transform 0.1s;
}

.btn-term-advance:hover {
  transform: translateY(-1px);
}

.btn-term-advance:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #075985;
}

/* =========================================================================
   PANTALLA 3: PODIO 3D Y VICTORIA (16:9 NO SCROLL)
   ========================================================================= */
.victory-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.victory-card {
  background: #ffffff;
  border: 3px solid #fbbf24;
  border-radius: 22px;
  padding: 18px 28px;
  text-align: center;
  max-width: 580px;
  box-shadow: 0 8px 0 #f59e0b, 0 20px 40px rgba(245, 158, 11, 0.22);
}

.victory-trophy-img {
  height: 54px;
  object-fit: contain;
  margin-bottom: 4px;
}

.victory-head {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 10px;
}

.victory-winner-car-3d {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 14px;
  background: #f8fafc;
  padding: 10px 14px;
  border-radius: 14px;
  border: 2px solid #e2e8f0;
}

.vic-video-stage {
  width: 116px;
  height: 82px;
  border-radius: 12px;
  overflow: hidden;
  background: #1e293b;
  border: 2.5px solid #f59e0b;
  box-shadow: 0 4px 12px rgba(245, 158, 11, 0.28);
  flex-shrink: 0;
}

.victory-3d-vid {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.36) translateY(5%);
}

.vic-meta {
  text-align: left;
}

.vic-meta h3 {
  font-family: var(--font-display);
  font-size: 14px;
  color: #0284c7;
}

.vic-meta p {
  font-size: 10.5px;
  font-weight: 700;
  color: #475569;
  margin-top: 2px;
}

.victory-stats-row {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 15px;
}

.vic-stat-box {
  background: #f0f9ff;
  border: 2px solid #bae6fd;
  padding: 7px 14px;
  border-radius: 11px;
  min-width: 100px;
}

.v-num {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: #0369a1;
  display: block;
}

.v-lbl {
  font-size: 8.5px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
}

.victory-btn-group {
  display: flex;
  justify-content: center;
  gap: 9px;
}

/* =========================================================================
   MODAL CUADERNO DE REPASO (INTERNO, LUMINOSO)
   ========================================================================= */
.custom-modal {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(5px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-window {
  background: #ffffff;
  border: 2px solid #bae6fd;
  box-shadow: 0 8px 0 #7dd3fc, 0 24px 48px rgba(15, 23, 42, 0.25);
  border-radius: 18px;
  width: 720px;
  max-height: 86%;
  display: flex;
  flex-direction: column;
  padding: 14px 18px;
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-heading {
  font-family: var(--font-display);
  font-size: 14px;
  color: #0369a1;
}

.modal-filter-bar {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.modal-scrollable-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.review-item-card {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 11px;
  border-left: 4px solid #94a3b8;
  font-size: 11px;
}
.review-item-card.ok { border-left-color: #10b981; background: #f0fdf4; }
.review-item-card.ko { border-left-color: #ef4444; background: #fef2f2; }

.review-q-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  font-size: 10px;
  color: #475569;
}

.review-q-status {
  font-weight: 900;
}
.review-q-status.status-ok { color: #059669; }
.review-q-status.status-ko { color: #dc2626; }

.review-q-title {
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.review-q-ans {
  color: #334155;
  font-size: 10.5px;
  margin-bottom: 4px;
}

.review-q-exp {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid #e2e8f0;
  padding: 5px 8px;
  border-radius: 6px;
  color: #475569;
  font-size: 10px;
}

/* AVISO DE DESCARRILAMIENTO */
.crash-popup {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: #ef4444;
  border: 3px solid #ffffff;
  border-radius: 16px;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 6px 0 #b91c1c, 0 18px 40px rgba(239, 68, 68, 0.45);
  z-index: 200;
}

.crash-alert-icon {
  font-size: 30px;
  color: #ffffff;
  animation: dangerPulse 0.3s infinite alternate;
}

.crash-text-wrap h2 {
  font-family: var(--font-display);
  font-size: 14px;
  color: #ffffff;
}

.crash-text-wrap p {
  font-size: 11px;
  font-weight: 700;
  color: #fee2e2;
}

/* OVERLAY DE CUENTA ATRÁS */
#countdown-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(240, 249, 255, 0.88);
  backdrop-filter: blur(8px);
  z-index: 250;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

#countdown-number {
  font-family: var(--font-display);
  font-size: 86px;
  font-weight: 700;
  color: #0284c7;
  text-shadow: 0 6px 0 #bae6fd, 0 12px 24px rgba(2, 132, 199, 0.25);
}

#countdown-sub {
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 1.5px;
  color: #0369a1;
  background: #ffffff;
  padding: 5px 16px;
  border-radius: 999px;
  border: 2px solid #bae6fd;
  box-shadow: 0 3px 0 #bae6fd;
}

/* =========================================================================
   OVERLAY DE ESCENA EN GRANDE (ACELERÓN / FRENAZO / RETROCESO)
   ========================================================================= */
.cutscene-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(5px);
  z-index: 210;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  cursor: pointer;
  animation: fadeInFast 0.16s ease-out;
}

.cutscene-card {
  width: 72%;
  max-width: 840px;
  background: #ffffff;
  border-radius: 20px;
  border: 3px solid #38bdf8;
  box-shadow: 0 8px 0 #0284c7, 0 24px 50px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: popCutscene 0.24s cubic-bezier(0.22, 1.28, 0.36, 1);
}

@keyframes popCutscene {
  from { opacity: 0; transform: scale(0.88); }
  to { opacity: 1; transform: scale(1); }
}

.cutscene-card.mode-boost {
  border-color: #facc15;
  box-shadow: 0 8px 0 #eab308, 0 24px 50px rgba(245, 158, 11, 0.38);
}

.cutscene-card.mode-slowdown {
  border-color: #fb923c;
  box-shadow: 0 8px 0 #ea580c, 0 24px 50px rgba(249, 115, 22, 0.35);
}

.cutscene-card.mode-reverse {
  border-color: #f87171;
  box-shadow: 0 8px 0 #dc2626, 0 24px 50px rgba(239, 68, 68, 0.4);
}

.cutscene-hud-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: #f8fafc;
  border-bottom: 2px solid #e2e8f0;
}

.cutscene-hud-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cutscene-driver-pill {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background: var(--p1-color);
  padding: 3px 10px;
  border-radius: 999px;
}

.cutscene-action-badge {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
}

.cutscene-speedo-box {
  font-family: var(--font-tech);
  font-size: 13px;
  font-weight: 900;
  color: #0369a1;
  background: #e0f2fe;
  border: 1.5px solid #bae6fd;
  padding: 4px 11px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cutscene-card.mode-boost .cutscene-speedo-box {
  color: #854d0e;
  background: #fef9c3;
  border-color: #fde047;
}

.cutscene-card.mode-slowdown .cutscene-speedo-box,
.cutscene-card.mode-reverse .cutscene-speedo-box {
  color: #991b1b;
  background: #fee2e2;
  border-color: #fca5a5;
}

.cutscene-canvas-wrap {
  width: 100%;
  aspect-ratio: 820 / 320;
  background: #dbeafe;
  position: relative;
}

#cutscene-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.cutscene-hud-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 14px;
  background: #ffffff;
  border-top: 2px solid #e2e8f0;
}

.cutscene-sub-note {
  font-family: var(--font-display);
  font-size: 11.5px;
  font-weight: 700;
  color: #0369a1;
}

.cutscene-skip-hint {
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
}
