/* =========================================
   VARIABLES Y RESET
   ========================================= */
   :root {
    --bg-dark: #02081f;
    --board-blue: #091442;
    --card-blue: #0b227a;
    --card-hover: #1234b3;
    --gold: #ffcc00;
    --gold-glow: rgba(255, 204, 0, 0.4);
    --text-light: #ffffff;
    --disabled: #1a1f33;
    --team-1: #e91e63;
    --team-2: #2196f3;
    --team-3: #4caf50;
    --team-4: #ff9800;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* =========================================
   CONTROLES SUPERIORES (Botones del Profe)
   ========================================= */
.top-controls {
    position: absolute;
    top: 15px; right: 20px;
    display: flex; gap: 10px;
    z-index: 20;
}
.btn-top {
    background: rgba(0,0,0,0.6);
    border: 1px solid #444; color: #ccc;
    padding: 8px 15px; border-radius: 6px;
    font-family: 'Inter', sans-serif; font-size: 0.85rem; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
    display: flex; align-items: center; gap: 8px;
}
.btn-top:hover { background: var(--board-blue); color: #fff; border-color: var(--gold); }
.btn-load { cursor: pointer; }

/* =========================================
   FONDO ANIMADO Y CABECERA
   ========================================= */
.bg-animation {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, #0a194f 0%, #02081f 100%); z-index: -1;
}
.bg-animation::after {
    content: ''; position: absolute; width: 200%; height: 200%; top: -50%; left: -50%;
    background-image: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
    background-size: 50px 50px; animation: rotateBg 100s linear infinite;
}
@keyframes rotateBg { 100% { transform: rotate(360deg); } }

.game-header { text-align: center; padding: 1.5rem 0; background: rgba(0,0,0,0.3); border-bottom: 2px solid var(--gold); box-shadow: 0 4px 15px rgba(0,0,0,0.5); z-index: 10; position: relative;}
.logo { font-size: 0.9rem; color: #aaa; text-transform: uppercase; letter-spacing: 2px; }
.game-header h1 { font-family: 'Oswald', sans-serif; font-size: 2.5rem; color: var(--gold); text-shadow: 0 0 10px var(--gold-glow); margin: 5px 0; letter-spacing: 1px; }
.subtitle { font-size: 1rem; color: #ddd; }

/* =========================================
   TABLERO DE JUEGO
   ========================================= */
.board-container { flex: 1; display: flex; justify-content: center; align-items: center; padding: 2rem; position: relative;}
.game-board { display: grid; gap: 10px; width: 100%; max-width: 1400px; height: 100%; background: var(--board-blue); padding: 10px; border: 3px solid var(--gold); border-radius: 8px; box-shadow: 0 0 30px rgba(0,0,0,0.8); }

.category-header { background: var(--card-blue); color: var(--text-light); display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 600; font-size: 1.2rem; padding: 10px; border: 2px solid #1a3c9e; text-transform: uppercase; text-shadow: 1px 1px 3px rgba(0,0,0,0.8); }
.card-item { background: var(--card-blue); display: flex; align-items: center; justify-content: center; cursor: pointer; border: 2px solid #1a3c9e; border-radius: 4px; transition: all 0.2s ease; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); }
.card-item:hover { background: var(--card-hover); transform: scale(1.02); border-color: var(--gold); box-shadow: 0 0 15px var(--gold-glow), inset 0 0 20px rgba(0,0,0,0.2); }
.card-points { font-family: 'Oswald', sans-serif; font-size: 3.5rem; color: var(--gold); text-shadow: 3px 3px 0 #000, 0 0 15px var(--gold-glow); }
.card-item.disabled { background: var(--disabled); border-color: #111; cursor: not-allowed; box-shadow: none; transform: none; }
.card-item.disabled .card-points { color: #333; text-shadow: none; }

/* =========================================
   MARCADOR (SCOREBOARD)
   ========================================= */
.scoreboard { display: flex; height: 100px; background: #000; border-top: 2px solid #333; z-index: 10; position: relative; }
.team-card { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; border-right: 1px solid #222; padding: 10px; }
.team-card:last-child { border-right: none; }
.team-card h2 { font-size: 1.1rem; margin-bottom: 5px; outline: none; border-bottom: 1px dashed transparent; transition: border-color 0.2s; }
.team-card h2:focus { border-bottom: 1px dashed #fff; }

.team-1 h2 { color: var(--team-1); } .team-2 h2 { color: var(--team-2); } .team-3 h2 { color: var(--team-3); } .team-4 h2 { color: var(--team-4); }

.score-display { display: flex; align-items: center; gap: 15px; }
.score-display span { font-family: 'Oswald', sans-serif; font-size: 2.5rem; min-width: 80px; text-align: center; }
.score-btn { width: 35px; height: 35px; border-radius: 50%; border: none; background: #222; color: white; cursor: pointer; font-size: 1rem; transition: background 0.2s; }
.score-btn:hover { background: #444; }
.score-btn.minus:hover { background: #e53935; } .score-btn.plus:hover { background: #4caf50; }

/* =========================================
   MODALES (Juego y Editor)
   ========================================= */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); z-index: 1000; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.close-btn { background: none; border: none; color: #fff; font-size: 2rem; cursor: pointer; }
.close-btn:hover { color: #f44336; }

/* Modal de Pregunta */
.modal-content { background: var(--card-blue); width: 90%; max-width: 1000px; min-height: 60vh; border: 4px solid var(--gold); border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 0 50px rgba(0,0,0,1); transform: scale(0.9); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.modal-overlay.active .modal-content { transform: scale(1); }
.modal-header { background: var(--board-blue); padding: 15px 30px; font-size: 1.5rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid var(--gold); }
.gold-text { color: var(--gold); font-family: 'Oswald', sans-serif; font-size: 2rem;}
.modal-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px; text-align: center; }
.question-text { font-size: 3rem; font-weight: 600; text-shadow: 2px 2px 4px #000; margin-bottom: 20px;}
.answer-text { font-size: 2.5rem; color: var(--gold); padding-top: 30px; border-top: 1px solid rgba(255,255,255,0.2); }
.hidden { display: none !important; }
.modal-footer { padding: 20px; display: flex; justify-content: center; background: rgba(0,0,0,0.3); }

/* Botones Principales */
.btn-primary, .btn-secondary { padding: 15px 30px; font-size: 1.2rem; font-weight: 600; border: none; border-radius: 8px; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: all 0.2s; }
.btn-primary { background: var(--gold); color: #000; }
.btn-primary:hover { background: #ffd700; transform: translateY(-2px); box-shadow: 0 5px 15px var(--gold-glow); }
.btn-secondary { background: #4caf50; color: white; }
.btn-secondary:hover { background: #45a049; transform: translateY(-2px); }
.btn-export { background: #2196f3; color: white; }
.btn-export:hover { background: #1976d2; box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4); }

/* =========================================
   PANEL DEL CREADOR (EDITOR)
   ========================================= */
.editor-content { background: #1a1f33; width: 95%; max-width: 1400px; height: 90vh; border: 2px solid #444; border-radius: 12px; display: flex; flex-direction: column; box-shadow: 0 0 50px rgba(0,0,0,1); transform: scale(0.95); transition: transform 0.3s; overflow: hidden; }
.modal-overlay.active .editor-content { transform: scale(1); }
.editor-header { background: #0b1120; padding: 20px 30px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #333; }
.editor-header h2 { font-size: 1.5rem; color: var(--gold); display: flex; align-items: center; gap: 10px; }
.editor-instructions { background: #0f1629; padding: 15px 30px; font-size: 0.95rem; color: #aaa; border-bottom: 1px solid #222; }
.editor-instructions strong { color: #fff; }

.editor-grid { flex: 1; display: grid; grid-template-columns: repeat(5, 1fr); gap: 15px; padding: 20px; overflow-y: auto; background: #111522; }
.editor-col { background: #1a2035; border: 1px solid #333; border-radius: 8px; padding: 15px; display: flex; flex-direction: column; gap: 15px; }

/* Inputs del Editor */
.cat-input { width: 100%; padding: 10px; background: #0b1120; border: 1px solid var(--gold); border-radius: 4px; color: var(--gold); font-weight: bold; text-align: center; font-size: 1.1rem; outline: none; }
.q-block { background: #0f1629; padding: 10px; border-radius: 6px; border: 1px solid #222; }
.q-pts { font-family: 'Oswald', sans-serif; color: var(--gold); font-size: 1.2rem; margin-bottom: 5px; text-align: center; border-bottom: 1px solid #333; padding-bottom: 5px; }
.edit-input { width: 100%; padding: 8px; background: #050810; border: 1px solid #333; border-radius: 4px; color: #fff; font-size: 0.85rem; outline: none; margin-bottom: 5px; resize: vertical; min-height: 40px;}
.edit-input:focus { border-color: #2196f3; }
.edit-label { font-size: 0.7rem; color: #888; text-transform: uppercase; margin-bottom: 2px; display: block; }

.editor-footer { background: #0b1120; padding: 20px 30px; border-top: 1px solid #333; display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 15px; }

/* =========================================
   DISEÑO RESPONSIVO (MÓVIL / TABLET)
   ========================================= */
@media (max-width: 900px) {
    /* Permitir scroll en móviles en lugar de estar fijos */
    body { overflow-y: auto; height: auto; min-height: 100vh; }
    
    /* Controles Superiores: Los movemos al flujo normal para que no se superpongan */
    .top-controls { position: relative; top: 0; right: 0; justify-content: center; padding: 15px; background: #000; width: 100%; }
    
    /* Títulos más pequeños */
    .game-header h1 { font-size: 1.8rem; }
    .subtitle { font-size: 0.8rem; padding: 0 10px; }

    /* EL TABLERO: Permitir Swipe Horizontal */
    .board-container { padding: 1rem; display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
    .game-board { 
        min-width: 800px; /* Fuerza el tamaño para no aplastar el grid */
        height: 60vh;
        min-height: 400px;
    }
    .card-points { font-size: 2.5rem; }

    /* EL MARCADOR: 2x2 en móviles en vez de una línea */
    .scoreboard { height: auto; flex-wrap: wrap; }
    .team-card { width: 50%; flex: auto; border-bottom: 1px solid #222; border-right: 1px solid #222; }
    .team-card:nth-child(even) { border-right: none; }
    .score-display span { font-size: 2rem; min-width: 50px; }
    
    /* EL EDITOR: Apilar en una columna vertical para tipeo fácil */
    .editor-grid { grid-template-columns: 1fr; }
    .editor-content { width: 100%; height: 100%; margin: 0; border-radius: 0; border: none; }
    .editor-header h2 { font-size: 1.2rem; }
    
    /* MODALES DE JUEGO: Textos más chicos */
    .modal-content { width: 95%; min-height: 50vh; padding-bottom: 20px;}
    .modal-header { font-size: 1rem; padding: 15px; }
    .gold-text { font-size: 1.2rem; }
    .question-text { font-size: 1.5rem; }
    .answer-text { font-size: 1.2rem; }
    .btn-primary, .btn-secondary { font-size: 1rem; padding: 10px 20px; }
}
