@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --rojo: #ff2244; --rojo-dark: #6b0010;
  --azul: #2288ff; --azul-dark: #001d5e;
  --dorado: #ffd700; --dorado-dark: #b8860b;
  --verde: #22c55e;
  --font-pixel: 'Press Start 2P', monospace;
  --font-term: 'VT323', monospace;
}

html, body {
  font-family: var(--font-term); color: #fff;
  height: 100vh; width: 100vw; overflow: hidden;
  background: #05050a;
  background-image: 
    radial-gradient(circle at 0% 50%, rgba(255,34,68,0.2) 0%, transparent 60%),
    radial-gradient(circle at 100% 50%, rgba(34,136,255,0.2) 0%, transparent 60%);
  background-attachment: fixed;
}

/* BOTÓN DE REINICIO (ABAJO) */
#resetBtn {
  position: fixed; bottom: 15px; left: 50%; transform: translateX(-50%);
  z-index: 100; background: rgba(0,0,0,0.6); border: 2px solid #555;
  color: #aaa; padding: 8px 20px; border-radius: 20px;
  font-family: var(--font-pixel); font-size: 0.6rem; cursor: pointer; transition: all 0.3s;
}
#resetBtn:hover { border-color: var(--dorado); color: var(--dorado); box-shadow: 0 0 15px rgba(255,215,0,0.4); }

/* BOTONES ARCADE */
.btn-arcade {
  font-family: var(--font-pixel); font-size: clamp(0.8rem, 1.5vw, 1.2rem);
  padding: 15px 30px; color: #000; background: linear-gradient(180deg, #ffe766, var(--dorado-dark));
  border: 2px solid var(--dorado); border-radius: 8px; cursor: pointer;
  box-shadow: 0 4px 15px rgba(255,215,0,0.4); transition: all 0.1s;
}
.btn-arcade:active { transform: translateY(3px); box-shadow: 0 1px 5px rgba(255,215,0,0.4); }
.btn-arcade.red { background: linear-gradient(180deg, #ff5566, #a3001b); border-color: var(--rojo); color: #fff; }

/* MARCADOR SUPERIOR */
#scoreboard {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 30px; background: rgba(0,0,0,0.8); backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(255,215,0,0.3); height: 70px; box-sizing: border-box;
  position: relative; z-index: 50; box-shadow: 0 5px 20px rgba(0,0,0,0.8);
}
.score { display: flex; flex-direction: column; align-items: center; min-width: 120px; }
.score .label { font-family: var(--font-pixel); font-size: clamp(0.6rem, 1.2vw, 0.9rem); letter-spacing: 2px; }
.score .points { font-family: var(--font-pixel); font-size: clamp(1.2rem, 2.5vw, 2rem); text-shadow: 0 0 15px currentColor; margin-top: 5px; }
.score.rojo .points { color: var(--rojo); text-shadow: 0 0 20px var(--rojo); } 
.score.azul .points { color: var(--azul); text-shadow: 0 0 20px var(--azul); }
.round-info { text-align: center; color: var(--dorado); font-family: var(--font-pixel); }
#roundLabel { font-size: 0.9rem; text-shadow: 0 0 10px var(--dorado); } 
#multiplier { font-size: 1.6rem; color: #fff; text-shadow: 0 0 15px var(--dorado); margin-top: 5px; }

/* PANTALLAS */
.screen { display: none; height: calc(100vh - 70px); width: 100vw; padding: 20px; }
.screen.active { display: flex; flex-direction: column; justify-content: center; align-items: center; animation: fadeIn 0.4s; }
@keyframes fadeIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }

/* INICIO */
.retro-title { font-family: var(--font-pixel); font-size: clamp(2rem, 6vw, 5rem); text-align: center; line-height: 1.3; text-shadow: 4px 4px 0 #000; }
.retro-title.gold { color: var(--dorado); text-shadow: 4px 4px 0 #000, 0 0 30px var(--dorado); }
.retro-sub { font-family: var(--font-term); font-size: clamp(1rem, 2vw, 1.5rem); color: #aaa; margin: 20px 0 40px; text-align: center; letter-spacing: 3px; }

/* SELECCIÓN DE TEMA (MENÚ) */
.temas-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px;
  width: 100%; max-width: 1000px; max-height: 60vh; overflow-y: auto; padding: 10px;
}
.tema-card {
  background: rgba(0,0,0,0.6); border: 2px solid var(--dorado); border-radius: 15px;
  padding: 20px; text-align: center; cursor: pointer; transition: all 0.3s; backdrop-filter: blur(5px);
}
.tema-card:hover:not(.disabled) { transform: translateY(-5px); box-shadow: 0 0 30px rgba(255,215,0,0.4); background: rgba(255,215,0,0.1); }
.tema-card.disabled { opacity: 0.3; cursor: not-allowed; filter: grayscale(1); border-color: #555; }
.tema-card .icon { font-size: 3rem; display: block; margin-bottom: 10px; }
.tema-card .name { font-family: var(--font-pixel); font-size: 0.8rem; }

/* ESPERA (BUZZER) */
.wait-wrap { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: space-between; align-items: center; }
.wait-badge { font-family: var(--font-pixel); font-size: clamp(1rem, 2vw, 1.5rem); color: var(--dorado); padding: 15px 30px; border: 2px dashed var(--dorado); border-radius: 15px; animation: pulseBorder 1.5s infinite alternate; background: rgba(0,0,0,0.5); }
@keyframes pulseBorder { from { box-shadow: 0 0 10px rgba(255,215,0,0.2); } to { box-shadow: 0 0 40px rgba(255,215,0,0.6); } }
.question-preview { flex-grow: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; width: 100%; margin: 20px 0; background: rgba(0,0,0,0.7); border: 3px solid var(--dorado); border-radius: 25px; padding: 30px; text-align: center; backdrop-filter: blur(10px); }
.q-label { font-family: var(--font-pixel); font-size: clamp(0.8rem, 2vw, 1.2rem); color: var(--dorado); margin-bottom: 20px; }
#questionPreviewText { font-family: var(--font-term); font-size: clamp(3rem, 7vw, 6.5rem); line-height: 1.1; font-weight: bold; color: #fff; text-shadow: 0 0 20px rgba(255,255,255,0.2); }
.wait-teams { display: flex; justify-content: space-between; width: 100%; gap: 30px; margin-bottom: 20px; }
.wait-team { flex: 1; padding: 20px; text-align: center; font-family: var(--font-pixel); font-size: clamp(0.8rem, 2vw, 1.2rem); border-radius: 15px; transition: all 0.3s; background: rgba(0,0,0,0.5); }
.wait-team.rojo { border: 2px solid var(--rojo); color: var(--rojo); } 
.wait-team.azul { border: 2px solid var(--azul); color: var(--azul); }
.wait-team.winner { box-shadow: 0 0 40px currentColor, inset 0 0 20px currentColor; transform: scale(1.05); background: rgba(255,255,255,0.1); }
.wait-team.loser { opacity: 0.2; filter: grayscale(1); }

/* TABLERO DE JUEGO */
.team-panels { display: flex; justify-content: space-between; width: 100%; max-width: 1200px; margin-bottom: 15px; gap: 20px; }
.team-panel { flex: 1; padding: 10px; border-radius: 12px; text-align: center; background: rgba(0,0,0,0.5); border: 2px solid transparent; transition: all 0.3s; }
.team-panel.rojo { border-color: rgba(255,34,68,0.3); } 
.team-panel.azul { border-color: rgba(34,136,255,0.3); }
.team-panel.active { box-shadow: 0 0 25px currentColor; transform: scale(1.02); }
.team-panel.rojo.active { color: var(--rojo); border-color: var(--rojo); } 
.team-panel.azul.active { color: var(--azul); border-color: var(--azul); }
.team-name { font-family: var(--font-pixel); font-size: 0.7rem; margin-bottom: 5px; }
.team-points { font-family: var(--font-pixel); font-size: 1.5rem; }
.team-status { font-family: var(--font-term); font-size: 1rem; opacity: 0.8; }

.board-wrapper { width: 100%; max-width: 1200px; height: 100%; display: flex; flex-direction: column; justify-content: space-between; }
.board { display: flex; flex-direction: column; width: 100%; flex-grow: 1; background: rgba(10,10,20,0.8); border: 3px solid var(--dorado); border-radius: 20px; padding: 20px; margin-bottom: 15px; overflow: hidden; backdrop-filter: blur(10px); }
.question-header { border-bottom: 2px dashed rgba(255,215,0,0.4); padding-bottom: 10px; margin-bottom: 15px; display: flex; justify-content: space-between; align-items: center; }
#questionText { font-family: var(--font-term); font-size: clamp(2rem, 4vw, 3.5rem); color: var(--dorado); font-weight: bold; }
.q-points { font-family: var(--font-pixel); font-size: 0.7rem; color: #aaa; }
.answers-list { display: flex; flex-direction: column; gap: 8px; flex-grow: 1; justify-content: space-evenly; }
.answer-row { display: flex; align-items: center; padding: 0 20px; border-radius: 10px; border: 2px solid rgba(255,255,255,0.1); background: rgba(255,255,255,0.03); transition: all 0.3s; height: 16%; min-height: 50px; }
.answer-row .num { font-family: var(--font-pixel); font-size: clamp(0.8rem, 1.5vw, 1.2rem); color: var(--dorado); margin-right: 20px; width: 30px; text-align: center; }
.answer-row .text { font-family: var(--font-term); font-size: clamp(1.5rem, 3vw, 2.5rem); flex-grow: 1; }
.answer-row .pts { font-family: var(--font-pixel); font-size: clamp(0.7rem, 1.5vw, 1rem); color: var(--dorado); }
.answer-row.hidden-answer .text { color: transparent; background: repeating-linear-gradient(90deg, rgba(255,215,0,0.1) 0 10px, transparent 10px 20px); }
.answer-row.revealed { background: rgba(34,197,94,0.15); border-color: var(--verde); box-shadow: 0 0 20px rgba(34,197,94,0.3); }
.answer-row.revealed .text { color: var(--verde); font-weight: bold; }

/* CONTROLES Y STRIKES */
.controls { display: flex; gap: 15px; width: 100%; }
#answerInput { flex: 1; font-family: var(--font-term); font-size: clamp(1.2rem, 2.5vw, 2rem); padding: 10px 20px; background: rgba(0,0,0,0.6); border: 3px solid rgba(255,215,0,0.5); color: #fff; border-radius: 10px; outline: none; }
#answerInput:focus { border-color: var(--dorado); }
.strikes { display: flex; gap: 20px; justify-content: center; margin-top: 10px; font-family: var(--font-pixel); font-size: clamp(1.5rem, 3vw, 2.5rem); color: #333; }
.strike.on { color: var(--rojo); text-shadow: 0 0 30px var(--rojo); transform: scale(1.2); }

/* OVERLAYS */
.error-overlay, .correct-overlay { position: fixed; inset: 0; z-index: 999; display: none; align-items: center; justify-content: center; pointer-events: none; }
.error-overlay.show { display: flex; background: rgba(200,0,0,0.4); animation: flash 0.4s; }
.error-x { font-family: var(--font-pixel); font-size: 35vw; color: #ff0000; text-shadow: 0 0 80px #f00; animation: shake 0.5s; }
.correct-overlay.show { display: flex; background: rgba(34,197,94,0.2); }
.correct-check { font-family: var(--font-pixel); font-size: 30vw; color: var(--verde); text-shadow: 0 0 80px var(--verde); }
@keyframes flash { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-20px) rotate(-5deg); } 75% { transform: translateX(20px) rotate(5deg); } }

/* MODALES */
.custom-modal { position: fixed; inset: 0; z-index: 1000; display: none; align-items: center; justify-content: center; background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); opacity: 0; transition: opacity 0.3s; }
.custom-modal.show { display: flex; opacity: 1; }
.modal-content { text-align: center; padding: 50px; border: 4px solid var(--dorado); border-radius: 25px; background: linear-gradient(145deg, #1a1500, #05050a); transform: scale(0.8); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); max-width: 90vw; }
.custom-modal.show .modal-content { transform: scale(1); }
.modal-content h2 { font-family: var(--font-pixel); color: var(--dorado); font-size: clamp(1.5rem, 4vw, 3rem); margin-bottom: 20px; }
.modal-content p { font-family: var(--font-term); font-size: clamp(1.2rem, 2.5vw, 2rem); margin-bottom: 30px; color: #ddd; }
.modal-content .modal-btns { display: flex; gap: 20px; justify-content: center; }
#gameOverOverlay { transition: background 1s; }
#gameOverOverlay.win-rojo { background: radial-gradient(circle, var(--rojo), var(--rojo-dark)); }
#gameOverOverlay.win-azul { background: radial-gradient(circle, var(--azul), var(--azul-dark)); }
#gameOverOverlay .modal-content { border-color: #fff; background: rgba(0,0,0,0.8); }

/* BUZZER (CELULAR) */
.buzzer-body { background: #000; height: 100vh; overflow: hidden; touch-action: manipulation; }
.buzzer-wait { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 10; background: radial-gradient(circle at center, #111, #000); }
.pulse-dot { width: 20px; height: 20px; background: var(--dorado); border-radius: 50%; margin: 30px auto 0; animation: pulseBorder 1s infinite; }
.buzzer-play { position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 20; }
.buzz-zone { flex: 1; display: flex; align-items: center; justify-content: center; transition: filter 0.1s; }
.buzz-zone:active { filter: brightness(2); }
.buzz-rojo { background: radial-gradient(circle, var(--rojo), var(--rojo-dark)); border-bottom: 4px solid #000; }
.buzz-azul { background: radial-gradient(circle, var(--azul), var(--azul-dark)); border-top: 4px solid #000; }
.zone-inner { text-align: center; color: #fff; text-shadow: 2px 2px 0 #000; }
.zone-icon { font-family: var(--font-pixel); font-size: 3rem; display: block; }
.zone-name { font-family: var(--font-pixel); font-size: 2.5rem; display: block; letter-spacing: 5px; margin-top: 10px; }
.buzzer-win, .buzzer-lose { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; }
.buzzer-win { background: var(--dorado); animation: flash 0.4s; }
.buzzer-win h1 { color: #000; }
.buzzer-lose { background: #111; }

/* =========================================
   BUZZER (CELULAR) - ENFRENTAMIENTO CARA A CARA
   ========================================= */
.buzzer-body { 
    background: #000; 
    height: 100vh; 
    width: 100vw;
    overflow: hidden; 
    touch-action: manipulation; 
}

.buzzer-wait { 
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; 
    z-index: 10; background: radial-gradient(circle at center, #111, #000); 
}
.pulse-dot { 
    width: 20px; height: 20px; background: var(--dorado); border-radius: 50%; 
    margin: 30px auto 0; animation: pulseBorder 1s infinite; 
}

.buzzer-play { 
    position: fixed; inset: 0; display: flex; flex-direction: column; z-index: 20; 
}

.buzz-zone { 
    flex: 1; 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
    cursor: pointer;
    position: relative;
    transition: all 0.1s;
}
.buzz-zone:active { filter: brightness(1.8); }

/* EFECTO ROJO (Arriba) */
.buzz-rojo { 
    background: radial-gradient(circle at 50% 100%, #ff2244 0%, #6b0010 80%);
    border-bottom: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 -50px 60px rgba(255, 34, 68, 0.6), 0 10px 30px rgba(255, 34, 68, 0.4);
}

/* EL TRUCO: ROTAMOS EL CONTENEDOR ROJO 180 GRADOS */
.buzz-rojo .zone-inner {
    transform: rotate(180deg); 
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px; /* Como está volteado, el margen lo empuja hacia la línea central */
}

/* EFECTO AZUL (Abajo) */
.buzz-azul { 
    background: radial-gradient(circle at 50% 0%, #2288ff 0%, #001d5e 80%);
    border-top: 3px solid rgba(255, 255, 255, 0.8);
    box-shadow: inset 0 50px 60px rgba(34, 136, 255, 0.6), 0 -10px 30px rgba(34, 136, 255, 0.4);
}

/* AZUL SE QUEDA NORMAL */
.buzz-azul .zone-inner {
    transform: rotate(0deg); 
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-top: 30px; /* Lo empuja hacia la línea central */
}

/* Textos e Iconos */
.zone-name { 
    font-family: var(--font-pixel); 
    font-size: clamp(2.5rem, 10vw, 4.5rem); 
    letter-spacing: 5px; 
    color: #fff;
}
.buzz-rojo .zone-name { text-shadow: 0 0 20px #ff2244; }
.buzz-azul .zone-name { text-shadow: 0 0 20px #2288ff; }

.zone-icon { 
    font-family: var(--font-pixel); 
    font-size: 2.5rem; 
    opacity: 0.8;
}
.buzz-rojo .zone-icon { color: #fff; }
.buzz-azul .zone-icon { color: #fff; }

/* Pantallas de Victoria / Derrota */
.buzzer-win, .buzzer-lose { 
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 30; 
}
.buzzer-win { background: var(--dorado); animation: flash 0.4s; }
.buzzer-win h1 { color: #000; }
.buzzer-lose { background: #111; }


/* =========================================
   EFECTO SORPRESA PARA RESPUESTAS TARDÍAS
   ========================================= */
@keyframes surprisePop {
    0% { transform: scale(1); box-shadow: 0 0 0 rgba(34,197,94,0); }
    50% { transform: scale(1.05); box-shadow: 0 0 30px var(--verde); background: rgba(34,197,94,0.4); }
    100% { transform: scale(1); box-shadow: 0 0 20px rgba(34,197,94,0.2); background: rgba(34,197,94,0.15); }
}

.answer-row.surprise-effect {
    animation: surprisePop 0.6s ease-out;
    border-color: var(--verde);
    color: var(--verde);
    font-weight: bold;
}

/* =========================================
   EFECTOS DE LA PANTALLA DE INICIO
   ========================================= */
#particlesCanvas {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    z-index: 1;
    pointer-events: none; /* Permite hacer clic en los botones a través del canvas */
}

/* Animación de Zoom y Brillo para el Título */
.zoom-in-effect {
    animation: zoomIn 1.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    transform: scale(0.8);
}

@keyframes zoomIn {
    0% { opacity: 0; transform: scale(0.8) translateY(20px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

/* Efecto de pulso constante en el título */
.zoom-in-effect .gold {
    display: inline-block;
    animation: titlePulse 2s infinite alternate;
}

@keyframes titlePulse {
    0% { text-shadow: 4px 4px 0 #000, 0 0 30px var(--dorado); transform: scale(1); }
    100% { text-shadow: 4px 4px 0 #000, 0 0 50px var(--dorado), 0 0 80px var(--dorado); transform: scale(1.03); }
}

/* Botón de inicio con animación de respiración */
#startBtn {
    animation: btnGlow 1.5s infinite alternate;
}

@keyframes btnGlow {
    from { box-shadow: 0 4px 15px rgba(255,215,0,0.4); }
    to { box-shadow: 0 4px 30px rgba(255,215,0,0.8), 0 0 20px var(--dorado); }
}