:root {
    /* --- PALETA DARK JUNIOR --- */
    --bg: #111827; 
    --text: #f3f4f6;
    --card-bg: #1f2937;
    
    /* COLORES DE CATEGORÍA (Neón) */
    --geo: #3b82f6;  /* Azul */
    --ent: #ec4899;  /* Rosa */
    --hist: #eab308; /* Amarillo */
    --art: #a855f7;  /* Morado */
    --sci: #22c55e;  /* Verde */
    --sport: #f97316; /* Naranja */

    /* COLORES DE ESTADO */
    --success: #22c55e;
    --error: #ef4444;
}

body {
    background-color: var(--bg); 
    color: var(--text); 
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    margin: 0; 
    min-height: 100vh;
    min-height: 100dvh; 
    display: flex; 
    justify-content: center; 
    align-items: center; /* Centrado vertical */
    background-image: radial-gradient(#374151 1px, transparent 1px);
    background-size: 20px 20px;
}

/* --- ESTRUCTURA DE PANTALLAS --- */
.screen { 
    display: none; 
    width: 95%; 
    max-width: 1000px; 
    min-height: auto; 
    flex-direction: column; 
    align-items: center; 
    padding: 30px 20px; 
    box-sizing: border-box; 
    text-align: center; 
    
    background-color: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    margin: 20px auto;
}

.screen.active { 
    display: flex; 
    animation: fadeIn 0.4s ease-out; 
}

/* --- HEADER Y LOGO --- */
.setup-header {
    display: flex; flex-direction: column; align-items: center; 
    margin-bottom: 20px; width: 100%;
}

.game-logo {
    width: 80px; height: auto;
    margin-bottom: 15px; border-radius: 12px;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.game-title { 
    font-size: clamp(2rem, 5vw, 3rem); 
    font-weight: 800;
    background: linear-gradient(to right, #38bdf8, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0; letter-spacing: -1px;
}

/* --- NUEVO: SELECTOR DE MODO --- */
.mode-selection-container {
    background: rgba(17, 24, 39, 0.6);
    padding: 15px; border-radius: 15px; width: 100%; max-width: 600px;
    margin-bottom: 20px; border: 1px solid #374151;
}
.mode-buttons { display: flex; gap: 10px; }
.btn-mode {
    flex: 1; padding: 15px; border-radius: 10px; border: 2px solid #4b5563;
    background: #111827; color: #9ca3af; font-weight: bold; cursor: pointer;
    transition: all 0.2s; font-family: inherit; font-size: 1rem;
}
.btn-mode:hover { border-color: #60a5fa; }
.btn-mode.selected {
    border-color: var(--geo); background: rgba(59, 130, 246, 0.15);
    color: white; box-shadow: 0 0 15px rgba(59, 130, 246, 0.2);
}

/* --- INSTRUCCIONES --- */
.game-instructions {
    background-color: rgba(31, 41, 55, 0.6); 
    border: 1px solid #4b5563;
    border-radius: 12px; padding: 15px; margin: 10px 0;
    width: 100%; max-width: 600px; text-align: left;
    color: #d1d5db; font-size: 0.9rem;
}
.game-instructions h3 { color: #60a5fa; margin: 0 0 5px 0; font-size: 1rem; }
.game-instructions ul { padding-left: 20px; margin: 0; }
.game-instructions li { margin-bottom: 5px; }

/* --- CONTROLES DE JUGADORES --- */
.number-control { display: flex; align-items: center; justify-content: center; gap: 20px; margin: 20px 0; font-size: 2.5rem; font-weight: bold; }
.number-control button { width: 45px; height: 45px; font-size: 1.5rem; border-radius: 10px; background: #374151; color: white; border: none; cursor: pointer; transition: transform 0.1s; }
.number-control button:active { transform: scale(0.9); }

.names-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; width: 100%; max-width: 700px; margin: 10px 0 20px 0; }
.name-input { background: #111827; border: 1px solid #4b5563; color: white; padding: 12px; font-size: 1rem; border-radius: 8px; text-align: center; width: 100%; box-sizing: border-box; }
.name-input:focus { border-color: var(--geo); outline: none; }

/* --- DASHBOARD (PUNTUACIÓN) --- */
#dash-player-name { 
    color: var(--geo); font-size: 1.8rem; margin: 10px 0 20px 0; 
    font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
}
.dashboard { 
    display: grid; grid-template-columns: repeat(6, 1fr);
    gap: 8px; background: #111827; padding: 15px; border-radius: 12px;
    width: 100%; max-width: 900px; 
    margin: 0 auto 20px auto; 
    
    /* CORRECCIÓN PRINCIPAL DE SIMETRÍA */
    box-sizing: border-box; 
    justify-content: center;
}
.progress-item { 
    background: transparent; padding: 5px; display: flex; flex-direction: column; 
    align-items: center; font-size: 0.7rem; text-align: center; border-right: 1px solid #374151; 
}
.progress-item:last-child { border-right: none; }

.dots-container { 
    display: flex; gap: 3px; margin-top: 5px; 
    justify-content: center; /* Centrar puntos */
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: #374151; border: 1px solid #4b5563; }
.dot.filled { box-shadow: 0 0 6px currentColor; border: none; }

/* --- TARJETAS DE SELECCIÓN --- */
.selection-grid { 
    display: flex; flex-wrap: wrap; justify-content: center; gap: 15px; 
    width: 100%; max-width: 900px; margin: 0 auto; 
}
.cat-card {
    width: 130px; min-height: 100px;
    padding: 15px 5px; border-radius: 12px; 
    color: #111827; font-size: 0.85rem; font-weight: 800; 
    border: none; cursor: pointer; text-transform: uppercase; 
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: transform 0.2s; box-shadow: 0 4px 0 rgba(0,0,0,0.2);
    font-family: inherit;
}
.cat-card:hover { transform: translateY(-3px); filter: brightness(1.1); }
.cat-card:active { transform: translateY(2px); box-shadow: none; }

/* --- PANTALLA PREGUNTA --- */
.question-container { 
    background: #111827; color: white; padding: 30px; 
    border-radius: 15px; width: 100%; max-width: 800px; margin: 20px 0; 
    border: 1px solid #374151; position: relative;
}
#question-text { font-size: 1.6rem; line-height: 1.4; font-weight: 600; margin: 0; }

.category-banner { 
    font-size: 1.2rem; font-weight: 800; text-transform: uppercase; 
    padding: 8px 20px; border-radius: 50px; display: inline-block;
    color: #111827; margin-bottom: 15px; box-shadow: 0 0 15px rgba(0,0,0,0.2);
}

/* --- NUEVO: OPCIONES DE RESPUESTA --- */
.options-grid {
    display: grid; grid-template-columns: 1fr; gap: 12px;
    width: 100%; margin-top: 25px;
}
.btn-option {
    background: #1f2937; color: #e5e7eb;
    border: 2px solid #374151; padding: 15px; border-radius: 12px;
    font-size: 1.1rem; font-weight: 600; cursor: pointer;
    transition: all 0.2s; text-align: center;
    position: relative; top: 0; font-family: inherit;
}
.btn-option:hover { background: #374151; border-color: #4b5563; }
.btn-option:active { top: 2px; }

/* Estados de botones de opción */
.btn-option.correct { 
    background: var(--success); color: #064e3b; border-color: var(--success); 
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.4); 
}
.btn-option.wrong { 
    background: var(--error); color: white; border-color: var(--error); opacity: 0.7; 
}
.btn-option.disabled { pointer-events: none; opacity: 0.5; }

/* --- RESPUESTA Y VALIDACIÓN --- */
#answer-reveal { 
    margin-top: 20px; width: 100%; max-width: 800px; 
    background: #1f2937; padding: 20px; border-radius: 15px; border: 1px solid #4b5563;
    animation: bounceIn 0.5s;
}
.correct-answer-text { color: var(--success); font-size: 1.8rem; margin: 10px 0; font-weight: 800; }

.btn-primary { 
    background: white; color: #111827; 
    font-size: 1.2rem; font-weight: 800; padding: 15px 40px; 
    border-radius: 50px; border: none; margin-top: 20px; cursor: pointer; 
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.2); width: 100%; max-width: 300px;
    transition: transform 0.2s;
}
.btn-primary:active { transform: scale(0.95); }

.validation-buttons { display: flex; gap: 15px; justify-content: center; margin-top: 20px; }
.btn-yes, .btn-no { 
    padding: 15px; font-size: 1rem; border-radius: 10px; border: none; flex: 1; 
    cursor: pointer; color: white; font-weight: 700; text-transform: uppercase;
}
.btn-yes { background: var(--success); color: #064e3b; } 
.btn-no { background: var(--error); }

/* --- REBOTE --- */
.rebound-container { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; margin: 20px 0; }
.btn-rebound { 
    background: var(--hist); color: #451a03; border: none; border-radius: 20px; 
    padding: 10px 20px; font-weight: 700; font-size: 0.9rem; cursor: pointer; 
    animation: pulse 2s infinite;
}
.rebound-alert { 
    background: var(--hist); color: #451a03; padding: 10px; border-radius: 8px; 
    width: 100%; font-weight: 800; margin-bottom: 15px; animation: pulse 1s infinite; 
}

/* --- FOOTER --- */
.copyright-footer { margin-top: auto; padding: 30px 10px 10px; font-size: 0.8rem; color: #6b7280; }

/* --- UTILIDADES --- */
.hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounceIn { 0% { transform: scale(0.8); opacity: 0; } 60% { transform: scale(1.05); } 100% { transform: scale(1); opacity: 1; } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.03); } 100% { transform: scale(1); } }

/* --- COLORES APLICADOS --- */
.bg-geo { background-color: var(--geo); } .dot.filled.geo { background-color: var(--geo); }
.bg-ent { background-color: var(--ent); } .dot.filled.ent { background-color: var(--ent); }
.bg-hist { background-color: var(--hist); } .dot.filled.hist { background-color: var(--hist); }
.bg-art { background-color: var(--art); } .dot.filled.art { background-color: var(--art); }
.bg-sci { background-color: var(--sci); } .dot.filled.sci { background-color: var(--sci); }
.bg-sport { background-color: var(--sport); } .dot.filled.sport { background-color: var(--sport); }

/* --- RESPONSIVE --- */
@media (min-width: 600px) {
    .options-grid { grid-template-columns: 1fr 1fr; } /* 2 columnas en PC */
}

@media (max-width: 600px) {
    .screen { padding: 20px 15px; border-radius: 0; box-shadow: none; border: none; }
    .names-grid { grid-template-columns: 1fr; }
    .selection-grid { gap: 10px; }
    .cat-card { width: 45%; } 
    
    /* --- DASHBOARD MÓVIL --- */
    .dashboard { 
        grid-template-columns: repeat(3, 1fr); 
        padding: 15px 5px; /* Reducir padding lateral para ganar espacio */
        row-gap: 20px; 
    }
    .progress-item { 
        border-right: none; /* Eliminar borde para evitar desplazamiento visual */
        width: 100%; 
        box-sizing: border-box; 
    }
    
    .game-title { font-size: 2.5rem; }
    #question-text { font-size: 1.4rem; }
}