/* ==========================================================================
   RUTA SEGURA — Estilos Globales y Menús de Selección (css/main.css)
   Estética Taxi Callejero Currambero / Cyber HD Yellow & Obsidian Black
   ========================================================================== */

:root {
  --primary-yellow: #ffd000;
  --primary-yellow-hover: #ffe033;
  --taxi-yellow: #ffd000;
  --taxi-gold: #ffb700;
  --taxi-black: #08090c;
  --dark-bg: #08090c;
  --panel-bg: #12151d;
  --panel-bg-translucent: rgba(18, 21, 29, 0.90);
  --panel-border: #222938;
  --panel-border-glow: rgba(255, 208, 0, 0.4);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent-blue: #00e5ff;
  --accent-red: #ef4444;
  --accent-green: #10b981;
  --font-main: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'Courier New', monospace;
}

/* Damero ajedrezado estilo Taxi Callejero / Competición */
.taxi-checker-strip {
  height: 6px;
  width: 100%;
  background-image: repeating-linear-gradient(45deg, #08090c 0, #08090c 8px, #ffd000 8px, #ffd000 16px);
  border-radius: 4px 4px 0 0;
}

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

html, body {
  width: 100%;
  height: 100%;
  background: var(--dark-bg);
  color: var(--text-main);
  font-family: var(--font-main);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#appRoot {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: #000000;
  overflow: hidden;
}

.screen {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--dark-bg);
  z-index: 10;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

.hidden {
  display: none !important;
}

/* Rejilla retro animada de fondo */
.retro-grid {
  background-image: 
    linear-gradient(rgba(255, 208, 0, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 208, 0, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
}

/* ==========================================================================
   PANTALLA DE INICIO (INTRO ESTILO NEED FOR SPEED HD)
   ========================================================================== */
.intro-nfs-screen {
  position: relative;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: #05070a;
  overflow: hidden;
  padding: 24px;
}

.intro-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.intro-overlay-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(5, 7, 10, 0.45) 0%, rgba(5, 7, 10, 0.92) 80%);
  z-index: 2;
  pointer-events: none;
}

.intro-nfs-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 820px;
  background: rgba(11, 15, 23, 0.72);
  border: 1px solid rgba(255, 208, 0, 0.35);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 36px 32px;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75), 0 0 40px rgba(255, 208, 0, 0.15);
}

.live-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 10px #10b981;
  margin-right: 6px;
  animation: pulse-dot 1.5s infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.intro-title-nfs {
  font-size: clamp(42px, 6.5vw, 76px);
  font-weight: 900;
  letter-spacing: -2px;
  font-style: italic;
  text-transform: uppercase;
  line-height: 0.95;
  color: #ffffff;
  margin: 6px 0 6px 0;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.nfs-glow {
  background: linear-gradient(135deg, #ffd000 20%, #ff8800 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 16px rgba(255, 208, 0, 0.6));
}

.intro-subtitle-nfs {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 3px;
  color: var(--accent-blue);
  text-transform: uppercase;
  margin-bottom: 14px;
}

.intro-desc-nfs {
  font-size: clamp(13px, 1.25vw, 15px);
  color: #cbd5e1;
  line-height: 1.55;
  margin-bottom: 20px;
  max-width: 720px;
}

.intro-stats-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 18px;
}

.intro-stat-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  color: #f1f5f9;
}

.intro-action-row {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 10px;
}

.btn-nfs-start {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 14px 28px;
  border-radius: 8px;
  box-shadow: 0 0 25px rgba(255, 208, 0, 0.55);
  transition: all 0.2s ease;
}
.btn-nfs-start:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 0 35px rgba(255, 208, 0, 0.85);
}

.intro-badge {
  display: inline-block;
  background: rgba(255, 208, 0, 0.15);
  border: 1px solid var(--primary-yellow);
  color: var(--primary-yellow);
  padding: 6px 14px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 18px;
  border-radius: 4px;
}

/* ==========================================================================
   PANEL RULETA BLOQUEADA POR INFRACCIONES
   ========================================================================== */
.roulette-locked-notice {
  background: rgba(239, 68, 68, 0.10);
  border: 1.5px solid rgba(239, 68, 68, 0.45);
  border-radius: 12px;
  padding: 20px;
  margin: 16px 0;
  text-align: center;
}

.locked-icon {
  font-size: 38px;
  margin-bottom: 8px;
}

.locked-title {
  color: #ef4444;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.locked-desc {
  font-size: 13px;
  color: #e2e8f0;
  line-height: 1.5;
  margin-bottom: 12px;
}

.locked-tip {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 208, 0, 0.3);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12px;
  color: #facc15;
  text-align: left;
}

.btn-primary {
  background: var(--primary-yellow);
  color: #0b0f17;
  border: none;
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 1px;
  padding: 16px 36px;
  border-radius: 6px;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(255, 208, 0, 0.4);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: var(--primary-yellow-hover);
  transform: translateY(-2px);
  box-shadow: 0 0 35px rgba(255, 208, 0, 0.6);
}

.btn-secondary {
  background: #243042;
  color: #ffffff;
  border: 1px solid var(--panel-border);
  font-weight: 700;
  font-size: 14px;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: #33445c;
}

/* ==========================================================================
   SELECTORES DE PILOTO Y PISTA
   ========================================================================== */
.flow-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 24px 36px;
}

.flow-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.flow-header h2 {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: -0.5px;
}

.flow-step {
  font-size: 12px;
  font-weight: 800;
  color: var(--primary-yellow);
  letter-spacing: 2px;
}

.flow-content {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  flex: 1;
  min-height: 0;
}

.flow-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--panel-border);
  padding-top: 16px;
  margin-top: 20px;
}

/* Lista de Vehículos */
.vehicle-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
}

.vehicle-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.vehicle-card:hover, .vehicle-card.active {
  border-color: var(--primary-yellow);
  background: #1a2433;
}

.vehicle-card.active {
  box-shadow: 0 0 15px rgba(255, 208, 0, 0.2);
}

.vehicle-card h4 {
  font-size: 16px;
  font-weight: 800;
  margin-bottom: 4px;
}

.category-badge {
  display: inline-block;
  background: #202b3a;
  color: var(--accent-blue);
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 6px;
}

.pilot-name {
  font-size: 12px;
  color: var(--text-muted);
}

.stats-mini {
  font-size: 11px;
  color: var(--primary-yellow);
  margin-top: 6px;
  display: flex;
  gap: 12px;
}

/* Área de Previsualización de Vehículo */
.preview-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}

.preview-canvas-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at center, #1e2a3a 0%, #0f1724 100%);
  position: relative;
}

.preview-info-box {
  padding: 18px 24px;
  background: #111722;
  border-top: 1px solid var(--panel-border);
}

.color-picker-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s;
}

.color-swatch:hover, .color-swatch.active {
  transform: scale(1.2);
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* Tag de Modelo Actualizado 3D Bit (Imagen 1) */
.model-updated-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--primary-yellow);
  color: #0b0f17;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
  padding: 4px 10px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Rejilla de Características Técnicas (Imagen 1) */
.specs-badges-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin-bottom: 12px;
  border-top: 1px solid var(--panel-border);
  padding-top: 10px;
}

.spec-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #0d131d;
  border: 1px solid #1e293b;
  padding: 6px 4px;
  border-radius: 4px;
}

.spec-badge span {
  font-size: 16px;
  margin-bottom: 2px;
}

.spec-badge small {
  font-size: 8px;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  line-height: 1.1;
}

/* Selector de Pistas */
.track-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  overflow-y: auto;
}

.track-card {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.track-card:hover, .track-card.active {
  border-color: var(--primary-yellow);
  background: #1a2536;
}

.track-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.track-number {
  font-size: 11px;
  font-weight: 800;
  color: var(--primary-yellow);
}

.track-difficulty {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
}

.track-difficulty.media { background: #065f46; color: #6ee7b7; }
.track-difficulty.alta { background: #9a3412; color: #fed7aa; }
.track-difficulty.experto { background: #831843; color: #fbcfe8; }

/* Banner de Compatibilidad Multiplataforma en Pantalla de Inicio */
.controls-compat-banner {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: rgba(19, 27, 38, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 10px 20px;
  border-radius: 30px;
  margin-bottom: 24px;
  flex-wrap: wrap;
  justify-content: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.compat-item {
  font-size: 12px;
  color: #e2e8f0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.compat-item b {
  color: var(--primary-yellow);
}

.compat-icon {
  font-size: 15px;
}

.compat-sep {
  color: rgba(255, 255, 255, 0.25);
  font-size: 12px;
}

/* ==========================================================================
   ADAPTACIONES RESPONSIVAS PARA TABLETAS Y TELÉFONOS (css/main.css)
   ========================================================================== */

/* 1. Tabletas y Laptops Pequeñas (<= 1024px) */
@media (max-width: 1024px) {
  .flow-container {
    padding: 16px 20px;
  }
  .flow-content {
    grid-template-columns: 320px 1fr;
    gap: 16px;
  }
  .specs-badges-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* 2. Teléfonos Móviles y Tabletas Verticales (<= 768px) */
@media (max-width: 768px) {
  #screenIntro {
    padding: 24px 16px;
    justify-content: space-between;
  }

  .intro-badge {
    font-size: 10px;
    padding: 4px 10px;
    letter-spacing: 1px;
    margin-bottom: 10px;
  }

  .intro-title {
    font-size: clamp(34px, 10vw, 48px);
    margin-bottom: 10px;
  }

  .intro-desc {
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 16px;
    max-height: 28vh;
    overflow-y: auto;
  }

  .controls-compat-banner {
    padding: 8px 14px;
    border-radius: 12px;
    gap: 8px;
    margin-bottom: 16px;
  }

  .compat-item {
    font-size: 11px;
  }

  .compat-sep {
    display: none;
  }

  /* Selector de Piloto y Pistas en Móvil: Cuadrito compacto superior + carrusel táctil sin scroll */
  .flow-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100dvh;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px)) 12px;
    overflow: hidden;
  }

  .flow-header {
    flex: 0 0 auto;
    padding-bottom: 4px;
    margin-bottom: 6px;
  }

  .flow-header h2 {
    font-size: 16px;
  }

  .flow-header .flow-step {
    font-size: 10px;
    letter-spacing: 1.5px;
  }

  .flow-header > div:last-child {
    font-size: 11px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .flow-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Cuadrito 3D de Previsualización (Siempre visible en la mitad superior) */
  .preview-panel {
    flex: 0 0 auto;
    height: 175px;
    max-height: 185px;
    min-height: 155px;
    display: flex;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
  }

  .preview-canvas-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
  }

  #previewCanvas, #trackPreviewCanvas {
    width: 100% !important;
    height: 100% !important;
    max-height: 120px;
    object-fit: contain;
  }

  .model-updated-tag {
    top: 8px;
    left: 8px;
    font-size: 8px;
    padding: 2px 6px;
  }

  .preview-info-box {
    padding: 6px 10px;
    background: #111722;
  }

  .preview-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .preview-info-box h3 {
    font-size: 14px !important;
    margin-bottom: 0 !important;
  }

  .preview-info-box p {
    display: none; /* Ahorra espacio vertical para evitar scroll en pantallas angostas */
  }

  .specs-badges-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
    margin-bottom: 2px;
    padding-top: 4px;
  }

  .spec-badge {
    padding: 2px 1px;
    font-size: 8px;
  }

  .spec-badge span {
    font-size: 11px;
  }

  .spec-badge small {
    display: none;
  }

  .color-picker-row {
    margin-top: 0;
    gap: 6px;
  }

  .color-swatch {
    width: 24px;
    height: 24px;
  }

  /* Carrusel horizontal táctil de vehículos y pistas: Todo a la vista sin correr */
  .vehicle-list, .track-list {
    display: flex;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    flex: 1;
    min-height: 0;
    padding: 4px 2px;
  }

  .vehicle-card {
    min-width: 155px;
    max-width: 175px;
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 8px 10px;
  }

  .vehicle-card h4 {
    font-size: 13px;
    margin-bottom: 2px;
  }

  .pilot-name {
    font-size: 10px;
  }

  .stats-mini {
    font-size: 9px;
    margin-top: 4px;
    gap: 8px;
  }

  .track-card {
    min-width: 150px;
    max-width: 170px;
    flex-shrink: 0;
    scroll-snap-align: start;
    padding: 8px 10px;
  }

  .track-card h4 {
    font-size: 12px;
    margin-bottom: 2px;
  }

  .track-card p {
    font-size: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .flow-footer {
    flex: 0 0 auto;
    padding-top: 8px;
    margin-top: auto;
  }

  .btn-primary, .btn-secondary {
    padding: 10px 18px;
    font-size: 12px;
    min-height: 40px;
    touch-action: manipulation;
  }
}

/* 3. Móviles en Orientación Horizontal (Landscape: altura <= 520px) */
@media (max-height: 520px) and (orientation: landscape) {
  #screenIntro {
    padding: 12px 24px;
    justify-content: center;
  }

  .intro-title {
    font-size: 32px;
    margin-bottom: 6px;
  }

  .intro-desc {
    display: none;
  }

  .controls-compat-banner {
    padding: 6px 14px;
    margin-bottom: 12px;
  }

  .flow-container {
    padding: 8px 16px;
  }

  .flow-header {
    padding-bottom: 6px;
    margin-bottom: 8px;
  }

  .flow-header h2 {
    font-size: 16px;
  }

  .flow-content {
    grid-template-columns: 240px 1fr;
    gap: 12px;
  }

  .preview-panel {
    max-height: none;
  }

  .preview-canvas-wrap {
    min-height: 120px;
  }

  .preview-info-box {
    padding: 8px 12px;
  }

  .specs-badges-grid {
    display: none;
  }

  .flow-footer {
    padding-top: 6px;
    margin-top: 6px;
  }

  .btn-primary, .btn-secondary {
    padding: 8px 18px;
    min-height: 38px;
    font-size: 12px;
  }
}
