/**
 * Guess The Trailer - Tema Cinemático Moderno
 * Estética de cine contemporáneo: Dark Obsidian, Glassmorphism y Acentos Dorados Proyector
 */

:root {
  --bg-main: #07090e;
  --bg-card: rgba(18, 24, 38, 0.78);
  --bg-card-hover: rgba(28, 36, 56, 0.9);
  
  --gold-accent: #f59e0b;
  --gold-light: #fbbf24;
  --gold-glow: rgba(245, 158, 11, 0.35);
  
  --emerald-correct: #10b981;
  --emerald-glow: rgba(16, 185, 129, 0.5);
  
  --crimson-wrong: #ef4444;
  --crimson-glow: rgba(239, 68, 68, 0.5);
  
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  
  --border-glass: rgba(255, 255, 255, 0.12);
  --border-gold: rgba(245, 158, 11, 0.4);
  
  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-full: 9999px;
  
  --font-display: 'Outfit', 'Inter', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
  background-color: var(--bg-main);
  color: var(--text-main);
  font-family: var(--font-body);
  overflow-x: hidden;
  min-height: 100vh;
  user-select: none;
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Capas de Interfaz (Z-Index Hierarchy)
   ========================================================================== */
.ui-layer {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1.5rem 2rem;
  pointer-events: none; /* Los clics pasan al fondo salvo en elementos interactivos */
}

.interactive {
  pointer-events: auto;
}

/* ==========================================================================
   Pantallas de Flujo (Welcome, Game, Results)
   ========================================================================== */
.view-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background-color: rgba(7, 9, 14, 0.94);
  backdrop-filter: blur(24px);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: auto;
}

.view-screen.active {
  display: flex;
  opacity: 1;
}

/* Pantalla de Inicio (Intro) */
.intro-card {
  max-width: 620px;
  width: 100%;
  background: linear-gradient(135deg, rgba(22, 29, 44, 0.85) 0%, rgba(13, 17, 26, 0.95) 100%);
  border: 1px solid var(--border-glass);
  border-radius: 24px;
  padding: 3rem 2.5rem;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7), 0 0 40px rgba(245, 158, 11, 0.1);
  animation: modalPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.intro-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1rem;
  border-radius: var(--radius-full);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--gold-light);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

.intro-title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  background: linear-gradient(180deg, #ffffff 30%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 1rem;
}

.intro-desc {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.features-pills {
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 2.5rem;
}

.pill-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  font-size: 0.9rem;
  color: #e2e8f0;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  width: 100%;
  max-width: 340px;
  padding: 1.1rem 2rem;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #050608;
  border: none;
  border-radius: var(--radius-full);
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 25px -5px var(--gold-glow);
  transition: all 0.25s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 30px -5px rgba(245, 158, 11, 0.5);
  filter: brightness(1.08);
}

.btn-primary:active {
  transform: translateY(1px);
}

/* ==========================================================================
   Barra Superior de Control (HUD)
   ========================================================================== */
.hud-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding-right: 7.5rem;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 800;
  color: #f8fafc;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hud-brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--gold-accent);
  box-shadow: 0 0 10px var(--gold-accent);
}

/* Rondas y progreso */
.hud-progress-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.round-tracker-text {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.round-indicators-dots {
  display: flex;
  gap: 0.45rem;
}

.round-dot {
  width: 28px;
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.round-dot.current {
  background: var(--gold-accent);
  box-shadow: 0 0 10px var(--gold-glow);
  width: 36px;
}

.round-dot.correct {
  background: var(--emerald-correct);
  box-shadow: 0 0 8px var(--emerald-glow);
}

.round-dot.wrong {
  background: var(--crimson-wrong);
  box-shadow: 0 0 8px var(--crimson-glow);
}

/* Marcador y botones de control */
.hud-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.score-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-full);
  background: rgba(18, 24, 38, 0.75);
  border: 1px solid var(--border-glass);
  font-weight: 600;
  font-size: 0.9rem;
  color: #f1f5f9;
  backdrop-filter: blur(10px);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(18, 24, 38, 0.75);
  border: 1px solid var(--border-glass);
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(10px);
}

.btn-icon:hover {
  background: rgba(30, 41, 59, 0.9);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.05);
}

/* ==========================================================================
   Panel Inferior de Opciones (Bottom Gameplay Panel)
   ========================================================================== */
.bottom-gameplay-container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding-bottom: 0.5rem;
}

/* Pregunta / Encabezado */
.question-prompt-card {
  text-align: center;
  background: rgba(15, 20, 32, 0.65);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-full);
  padding: 0.85rem 2rem;
  width: fit-content;
  margin: 0 auto;
}

.question-prompt-card h2 {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 2.5vw, 1.45rem);
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.01em;
}

/* Rejilla de 4 Opciones */
.options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  width: 100%;
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.options-grid.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
}

@media (max-width: 768px) {
  .options-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

/* Botón de Opción Cinematográfico */
.option-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.2rem;
  padding: 1.15rem 1.5rem;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  color: #f1f5f9;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  outline: none;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.option-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
  pointer-events: none;
}

.option-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-width: 36px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--gold-light);
  font-size: 0.95rem;
  font-weight: 700;
  transition: all 0.25s ease;
}

.option-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

/* Estados de Interacción */
.option-btn:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5), 0 0 20px rgba(245, 158, 11, 0.15);
}

.option-btn:hover:not(:disabled) .option-badge {
  background: var(--gold-accent);
  color: #050608;
  border-color: var(--gold-accent);
}

/* Estado 1: Seleccionada / En Suspenso (Naranja Ámbar Pulsante) */
.option-btn.is-selected {
  background: rgba(245, 158, 11, 0.2) !important;
  border-color: var(--gold-accent) !important;
  box-shadow: 0 0 30px var(--gold-glow) !important;
  animation: suspensePulse 1s infinite alternate;
}

.option-btn.is-selected .option-badge {
  background: var(--gold-accent) !important;
  color: #050608 !important;
}

@keyframes suspensePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
  }
  100% {
    transform: scale(1.02);
    box-shadow: 0 0 35px rgba(245, 158, 11, 0.6);
  }
}

/* Estado 2: Acierto / Correcta (Verde Esmeralda) */
.option-btn.is-correct {
  background: rgba(16, 185, 129, 0.25) !important;
  border-color: var(--emerald-correct) !important;
  box-shadow: 0 0 35px var(--emerald-glow) !important;
  animation: correctBounce 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.option-btn.is-correct .option-badge {
  background: var(--emerald-correct) !important;
  color: #ffffff !important;
  border-color: var(--emerald-correct) !important;
}

@keyframes correctBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.04); }
  100% { transform: scale(1); }
}

/* Estado 3: Error / Incorrecta (Rojo Carmesí) */
.option-btn.is-wrong {
  background: rgba(239, 68, 68, 0.22) !important;
  border-color: var(--crimson-wrong) !important;
  box-shadow: 0 0 30px var(--crimson-glow) !important;
  animation: shakeWrong 0.4s ease-in-out;
}

.option-btn.is-wrong .option-badge {
  background: var(--crimson-wrong) !important;
  color: #ffffff !important;
  border-color: var(--crimson-wrong) !important;
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  75% { transform: translateX(8px); }
}

/* Estado 4: Atenuada / Descartada */
.option-btn.is-dimmed {
  opacity: 0.38;
  filter: grayscale(40%);
  pointer-events: none;
}

/* ==========================================================================
   Ficha de Revelación (Reveal Card)
   ========================================================================== */
.reveal-card {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  background: rgba(15, 20, 32, 0.9);
  backdrop-filter: blur(25px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-lg);
  padding: 1rem 1.75rem;
  width: 100%;
  animation: slideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.reveal-card.active {
  display: flex;
}

.reveal-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.reveal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.reveal-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.reveal-meta {
  font-size: 0.85rem;
  color: var(--gold-light);
  font-weight: 500;
}

.reveal-trivia {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.4;
  max-width: 650px;
}

.btn-next {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.8rem 1.5rem;
  border-radius: var(--radius-full);
  background: #ffffff;
  color: #07090e;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-next:hover {
  background: var(--gold-light);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(251, 191, 36, 0.3);
}

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

/* ==========================================================================
   Pantalla de Resultados Finales (Game Over / Results)
   ========================================================================== */
.results-card {
  max-width: 680px;
  width: 100%;
  background: linear-gradient(135deg, rgba(22, 29, 44, 0.9) 0%, rgba(13, 17, 26, 0.98) 100%);
  border: 1px solid var(--border-glass);
  border-radius: 28px;
  padding: 2.75rem 2.5rem;
  text-align: center;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8);
  animation: modalPop 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.results-score-badge {
  font-family: var(--font-display);
  font-size: 3.5rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  margin-bottom: 0.5rem;
}

.results-score-badge span {
  font-size: 2rem;
  color: var(--text-subtle);
  font-weight: 600;
}

.results-rank {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gold-light);
  margin-bottom: 1.5rem;
  letter-spacing: -0.01em;
}

.results-recap-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  text-align: left;
  margin-bottom: 2rem;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 0.5rem;
}

.recap-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.95rem;
}

.recap-item.correct {
  border-left: 3px solid var(--emerald-correct);
}

.recap-item.wrong {
  border-left: 3px solid var(--crimson-wrong);
}

.recap-title {
  font-weight: 600;
  color: #e2e8f0;
}

.recap-status {
  font-size: 0.85rem;
  font-weight: 700;
}

.recap-item.correct .recap-status {
  color: var(--emerald-correct);
}

.recap-item.wrong .recap-status {
  color: var(--crimson-wrong);
}

/* ==========================================================================
   Notificación Toast de Sistema (Feedback de Fallback)
   ========================================================================== */
.game-toast {
  position: fixed;
  top: 5.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.4rem;
  background: rgba(18, 24, 38, 0.92);
  backdrop-filter: blur(20px);
  border: 1px solid var(--border-gold);
  border-radius: var(--radius-full);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px var(--gold-glow);
  color: #f8fafc;
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1), transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.game-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.game-toast .toast-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.game-toast .toast-text {
  letter-spacing: -0.01em;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================================================
   Selector de Idioma Siempre Visible (ES / EN)
   ========================================================================== */
.lang-switcher-container {
  position: fixed;
  top: 1.5rem;
  right: 2rem;
  z-index: 100;
  display: flex;
  align-items: center;
  pointer-events: auto;
}

.btn-lang-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.95rem;
  background: rgba(18, 24, 38, 0.88);
  backdrop-filter: blur(18px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-full);
  color: var(--text-muted);
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.btn-lang-toggle:hover {
  background: rgba(28, 36, 56, 0.98);
  border-color: var(--border-gold);
  color: var(--text-main);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.7), 0 0 16px var(--gold-glow);
  transform: translateY(-1px);
}

.btn-lang-toggle:active {
  transform: translateY(1px);
}

.btn-lang-toggle .lang-globe-icon {
  color: var(--gold-light);
  flex-shrink: 0;
}

.lang-pill-item {
  color: var(--text-subtle);
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.lang-pill-item.is-active {
  color: var(--gold-light);
  text-shadow: 0 0 8px var(--gold-glow);
  font-weight: 800;
}

.lang-pill-divider {
  color: rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
}

/* ==========================================================================
   Ajustes Responsivos Globales y Barra Superior
   ========================================================================== */
@media (max-width: 768px) {
  .ui-layer {
    padding: 1rem 1rem 1.5rem 1rem;
  }
  .lang-switcher-container {
    top: 1rem;
    right: 1rem;
  }
  .hud-topbar {
    padding-right: 6.5rem;
  }
  .hud-brand {
    font-size: 0.95rem;
  }
  .round-tracker-text {
    font-size: 0.75rem;
  }
  .round-dot {
    width: 20px;
    height: 5px;
  }
  .round-dot.current {
    width: 26px;
  }
  .score-badge {
    padding: 0.35rem 0.65rem;
    font-size: 0.8rem;
  }
  .btn-icon {
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 540px) {
  .hud-brand span:not(.hud-brand-dot) {
    display: none;
  }
  .hud-topbar {
    padding-right: 5.8rem;
  }
}

