:root {
    --color-fondo-principal: #87CEEB;
    --color-fondo-memoria: #98FB98;
    --color-boton: #FFB6C1;
    --color-texto: #333;
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', sans-serif;
    color: var(--color-texto);
    text-align: center;
    margin: 0;
    padding: 20px;
    display: flex;
    flex-direction: column; /* Cambiado para apilar navbar y contenido */
    align-items: center;
    min-height: 100vh;
}

body.fondo-principal { background-color: var(--color-fondo-principal); }
body.fondo-memoria { background-color: var(--color-fondo-memoria); }

/* ===============================
   NAVBAR INFANTIL
   =============================== */
.navbar-infantil {
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 25px;
    padding: 10px 20px;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 600px;
    box-sizing: border-box;
}

.btn-nav {
    text-decoration: none;
    font-size: 2.5em;
    background-color: white;
    border: 4px solid #ccc;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, background-color 0.2s;
    box-shadow: 0 4px 0 #bbb;
}

.btn-nav:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #bbb;
}

/* Estado activo del botón en el navbar */
.btn-nav.activo {
    border-color: #FF8C00;
    background-color: #FFFACD;
    transform: scale(1.1);
    box-shadow: 0 4px 0 #DAA520;
}

/* ===============================
   CONTENEDORES GLOBALES
   =============================== */
.contenedor-principal {
    background: white;
    padding: 30px;
    border-radius: 25px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    max-width: 600px;
    width: 100%;
    box-sizing: border-box;
}

h1 {
    font-size: 2.5em;
    color: #FF8C00;
    margin-bottom: 15px;
    margin-top: 0;
}

/* ===============================
   ESTILOS: ADIVINA EL SONIDO
   =============================== */
.panel-registro {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 25px;
    border: 2px dashed #ccc;
}

#nombre-nino {
    font-size: 1.2em;
    padding: 10px;
    border-radius: 10px;
    border: 2px solid #ddd;
    text-align: center;
    width: 80%;
    margin-bottom: 10px;
    font-family: inherit;
}

.puntuacion {
    font-size: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
}

.btn-accion {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    font-size: 1.2em;
    border-radius: 15px;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s;
}

.btn-accion:active { transform: scale(0.95); }
.btn-accion:disabled { background-color: #ccc; cursor: not-allowed; }

.btn-gigante {
    background-color: var(--color-boton);
    border: none;
    border-radius: 50px;
    padding: 20px 40px;
    font-size: 2em;
    font-weight: bold;
    color: white;
    cursor: pointer;
    box-shadow: 0 8px 0 #DB7093;
    transition: all 0.1s;
}

.btn-gigante:active {
    transform: translateY(8px);
    box-shadow: 0 0 0 #DB7093;
}

.grilla-opciones {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    margin-top: 30px;
    gap: 15px;
}

.tarjeta-animal {
    border: 5px solid #eee;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.2s, border-color 0.2s;
    width: 150px;
    height: 150px;
    background-size: cover;
    background-position: center;
}

.tarjeta-animal:hover { transform: scale(1.1); border-color: #32CD32; }

/* Animaciones */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}
@keyframes pop {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.error-anim { animation: shake 0.4s ease-in-out; border-color: #FF4500 !important; }
.acierto-anim { animation: pop 0.5s ease-in-out; border-color: #32CD32 !important; }

.mensaje { font-size: 2em; margin-top: 20px; font-weight: bold; min-height: 40px; }
.oculto { display: none !important; }

/* ===============================
   ESTILOS: MEMORIA
   =============================== */
.tablero-memoria {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin: 20px 0;
    perspective: 1000px;
}

.carta-memoria {
    width: 100%;
    height: 140px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    cursor: pointer;
}

.carta-memoria.volteada { transform: rotateY(180deg); }

.cara {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 15px;
    border: 4px solid #eee;
    box-sizing: border-box;
}

.cara-atras {
    background-color: #FFD700;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3em;
}

.cara-adelante {
    background-color: #fff;
    background-size: cover;
    background-position: center;
    transform: rotateY(180deg);
}