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

body {
    font-family: Arial, sans-serif;
    background: #f0f4f8;
    color: #2d3748;
}

/* ===== PÁGINA DE INICIO ===== */

.pagina-inicio {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1a237e, #1565c0, #0288d1);
}

.inicio-container {
    width: 100%;
    max-width: 460px;
    padding: 20px;
}

.inicio-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.inicio-icono {
    font-size: 4em;
    margin-bottom: 15px;
}

.inicio-card h1 {
    font-size: 1.8em;
    color: #1a237e;
    margin-bottom: 8px;
}

.inicio-card p {
    color: #718096;
    margin-bottom: 30px;
    font-size: 1em;
}

.form-group {
    margin-bottom: 20px;
    text-align: left;
}

.form-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #2d3748;
}

.form-group input {
    width: 100%;
    padding: 13px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1.1em;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: #1565c0;
}

.btn-empezar {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #1565c0, #0288d1);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 1.15em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.btn-empezar:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(21, 101, 192, 0.45);
}

/* ===== PÁGINA DEL MAPA ===== */

.pagina-mapa {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px;
    background: linear-gradient(135deg, #1a237e, #1565c0);
    color: white;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.cabecera h1 {
    font-size: 1.2em;
}

.usuario-info {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 0.95em;
}

.btn-salir {
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.18);
    color: white;
    text-decoration: none;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: background 0.2s;
    font-size: 0.9em;
}

.btn-salir:hover {
    background: rgba(255, 255, 255, 0.32);
}

.game-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.map-wrapper {
    flex: 1;
    position: relative;
    min-width: 0;
    background: #d6eaf8;
    overflow: hidden;
    display: flex;
    align-items: stretch;
}

.map-wrapper svg {
    display: block;
    width: 100%;
    height: 100%;
}

/* ===== PANEL QUIZ ===== */

.quiz-panel {
    width: 300px;
    flex-shrink: 0;
    background: white;
    border-left: 2px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 24px 20px;
    overflow-y: auto;
}

.quiz-idle {
    text-align: center;
    color: #a0aec0;
}

.quiz-idle-icono {
    font-size: 2.8em;
    margin-bottom: 12px;
    animation: bounce 2s ease-in-out infinite;
}

.quiz-idle p {
    line-height: 1.5;
    font-size: 0.95em;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-10px); }
}

.quiz-content h2 {
    font-size: 1em;
    color: #1a237e;
    margin-bottom: 18px;
    line-height: 1.45;
}

.opciones-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-opcion {
    padding: 11px 14px;
    background: #edf2ff;
    border: 2px solid #c3dafe;
    border-radius: 10px;
    font-size: 0.92em;
    cursor: pointer;
    transition: all 0.18s;
    text-align: left;
    color: #1a237e;
    font-weight: 500;
    line-height: 1.3;
}

.btn-opcion:hover:not(:disabled) {
    background: #1565c0;
    border-color: #1565c0;
    color: white;
    transform: translateX(4px);
}

.btn-opcion:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.feedback {
    margin-top: 16px;
    padding: 12px 14px;
    border-radius: 10px;
    font-weight: bold;
    text-align: center;
    font-size: 0.95em;
    line-height: 1.4;
    display: none;
}

.feedback.correcto {
    background: #c6f6d5;
    color: #276749;
    border: 2px solid #9ae6b4;
    display: block;
}

.feedback.incorrecto {
    background: #fed7d7;
    color: #9b2c2c;
    border: 2px solid #feb2b2;
    display: block;
}

/* ===== CONTADOR DE ESTRELLAS ===== */

.estrella-barra {
    flex-shrink: 0;
    background: linear-gradient(135deg, #f6c026, #f39c12);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 18px;
    border-top: 3px solid #e67e22;
    box-shadow: 0 -3px 12px rgba(0, 0, 0, 0.15);
}

.estrella-iconos {
    font-size: 1.5em;
    letter-spacing: 2px;
    min-width: 200px;
    text-align: right;
}

.estrella-numero {
    font-size: 2.8em;
    font-weight: 900;
    color: #7d3c01;
    text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.4);
    min-width: 55px;
    text-align: center;
}

.estrella-label {
    font-size: 0.85em;
    font-weight: bold;
    color: #7d3c01;
    letter-spacing: 3px;
    min-width: 90px;
}

@keyframes bump {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.55); }
    65%  { transform: scale(0.92); }
    100% { transform: scale(1); }
}

.bump {
    animation: bump 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100%     { transform: translateX(0); }
    20%, 60%     { transform: translateX(-7px); }
    40%, 80%     { transform: translateX(7px); }
}

.shake {
    animation: shake 0.45s ease-in-out;
}

/* ===== VICTORIA ===== */

.victoria-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.78);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.4s ease;
}

.victoria-card {
    background: linear-gradient(160deg, #fffdf4, #fff9e0);
    border-radius: 24px;
    padding: 48px 60px;
    text-align: center;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    animation: scaleIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 480px;
}

.victoria-trofeo {
    font-size: 7em;
    display: block;
    animation: trofeo-swing 1.8s ease-in-out infinite alternate;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
}

@keyframes trofeo-swing {
    from { transform: translateY(0) rotate(-6deg); }
    to   { transform: translateY(-14px) rotate(6deg); }
}

.victoria-titulo {
    font-size: 2.3em;
    color: #e67e22;
    text-shadow: 2px 2px 6px rgba(230, 126, 34, 0.25);
    margin: 18px 0 10px;
    letter-spacing: 3px;
}

.victoria-texto {
    color: #666;
    font-size: 0.98em;
    margin-bottom: 22px;
    line-height: 1.55;
}

.victoria-estrellas {
    font-size: 1.9em;
    font-weight: bold;
    color: #e67e22;
    margin-bottom: 28px;
}

.victoria-btn {
    padding: 14px 32px;
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.victoria-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.45);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes scaleIn {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}

/* Tooltip del mapa */
.mapa-tooltip {
    font-weight: bold;
    font-size: 0.9em;
    background: rgba(26, 35, 126, 0.9);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mapa-tooltip::before {
    border-top-color: rgba(26, 35, 126, 0.9);
}

/* ===== RESPONSIVE MÓVIL ===== */

@media (max-width: 768px) {

    /* Cabecera más compacta */
    .cabecera {
        padding: 7px 12px;
    }
    .cabecera h1 {
        font-size: 0.95em;
    }
    .usuario-info {
        font-size: 0.82em;
        gap: 8px;
    }
    .btn-salir {
        padding: 4px 10px;
        font-size: 0.82em;
    }

    /* Layout vertical: mapa arriba, quiz abajo */
    .game-layout {
        flex-direction: column;
    }

    /* El mapa ocupa la mayoría de la pantalla */
    .map-wrapper {
        flex: 0 0 52vh;
        height: 52vh;
    }

    /* Panel quiz a ancho completo debajo del mapa */
    .quiz-panel {
        width: 100%;
        flex: 1;
        border-left: none;
        border-top: 2px solid #e2e8f0;
        padding: 10px 14px;
        justify-content: flex-start;
        overflow-y: auto;
        min-height: 0;
    }

    .quiz-idle {
        padding-top: 8px;
    }
    .quiz-idle-icono {
        font-size: 1.6em;
        animation: none;
        margin-bottom: 6px;
    }
    .quiz-idle p {
        font-size: 0.9em;
    }

    .quiz-content h2 {
        font-size: 0.9em;
        margin-bottom: 10px;
    }

    /* Botones en rejilla 2 columnas para aprovechar el ancho */
    .opciones-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .btn-opcion {
        padding: 10px 6px;
        font-size: 0.82em;
        text-align: center;
        border-radius: 8px;
    }

    .feedback {
        margin-top: 10px;
        font-size: 0.88em;
        padding: 8px 10px;
    }

    /* Barra de estrellas compacta */
    .estrella-barra {
        padding: 6px 14px;
        gap: 10px;
    }
    .estrella-iconos {
        display: none;    /* sin espacio para los iconos en móvil */
    }
    .estrella-numero {
        font-size: 2em;
        min-width: 36px;
    }
    .estrella-label {
        font-size: 0.72em;
        letter-spacing: 1px;
        min-width: 70px;
    }

    /* Overlay de victoria adaptado */
    .victoria-card {
        padding: 32px 28px;
        margin: 16px;
    }
    .victoria-trofeo {
        font-size: 5em;
    }
    .victoria-titulo {
        font-size: 1.8em;
    }
    .victoria-texto {
        font-size: 0.88em;
    }
    .victoria-estrellas {
        font-size: 1.4em;
    }
}

/* Landscape en móvil: mapa más bajo para que quede quiz visible */
@media (max-width: 900px) and (orientation: landscape) {
    .map-wrapper {
        flex: 0 0 50vh;
        height: 50vh;
    }
    .quiz-panel {
        padding: 6px 14px;
    }
    .cabecera h1 {
        font-size: 0.9em;
    }
}
