/* ==========================================================
   1. PALETA DE COLORES Y CONFIGURACIÓN BASE (Actualizado 1º Preescolar)
   ========================================================== */
   :root {
    --escala-juego: 1;
    
    /* Nuevos colores institucionales 1º Preescolar */
    --amarillo-escolar: #ecc500;   /* Tu color base principal */
    --fiusha-preescolar: #c00087;   /* Color de acento / botones / cerrar */
    --azul-preescolar: #0099c4;     /* Color secundario / títulos / headers */
    
    /* Colores complementarios de soporte */
    --verde-portada: #7bc542;
    --arena: #f9f6f0;              /* Suavizado para mejor contraste */
    --blanco: #ffffff;
    --verde-exito: #4caf50;
    --sombra-boton: rgba(0, 0, 0, 0.2);
}

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

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Quicksand', 'Quicksand Book', sans-serif;
    background: linear-gradient(135deg, var(--amarillo-escolar) 0%, var(--arena) 100%);
    background-size: 400% 400%;
    animation: gradienteFondo 15s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
}

@keyframes gradienteFondo {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Clases de Control de Visibilidad */
.pantalla { display: none !important; }
.pantalla.visible { display: flex !important; }
.hidden { display: none !important; }

/* ==========================================================
   2. CONTENEDOR DE ESCALA (Efecto cristal vivo y suave)
   ========================================================== */
.contenedor-inicio {
    position: relative;
    width: 1024px;
    height: 768px;
    transform: scale(var(--escala-juego));
    transform-origin: center center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between; 
    padding: 35px 40px 20px;
    
    /* Efecto cristal translúcido para dar profundidad */
    background: rgba(255, 255, 255, 0.45); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    
    border-radius: 45px;
    border: 8px solid rgba(255, 255, 255, 0.7);
    box-shadow: 
        0 20px 50px rgba(0, 0, 0, 0.1),
        inset 0 0 25px rgba(255, 255, 255, 0.4);
    overflow: hidden;
}

/* Escenario de juego */
#escenario-juego {
    position: relative;
    width: 1024px;
    height: 768px;
    transform: scale(var(--escala-juego));
    transform-origin: center center;
    border-radius: 40px;
    border: 10px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

/* ==========================================================
   3. ELEMENTOS VISUALES DE LA PORTADA (¡Con movimiento!)
   ========================================================== */
   .logo-titulo {
    width: 100%;
    max-width: 680px; /* Estaba en 580px, lo subimos para que el logo pueda expandirse */
    display: flex;
    justify-content: center;
    margin-top: 1px;
    filter: drop-shadow(0 8px 12px rgba(0,0,0,0.12));
}

.img-titulo {
    width: 100%;
    height: auto;
    /* 2. Ajustamos la altura máxima proporcionalmente para que no domine toda la pantalla */
    max-height: 300px; /* Estaba en 140px. Evita subirlo a 550px porque absorbería el espacio de los botones */
    object-fit: contain;
}

.grupo-central {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;           
    width: 100%;
    gap: 25px;
}

.imagen-portada {
    width: 100%;
    max-width: 360px;
    display: flex;
    justify-content: center;
    flex-shrink: 1;
    /* Animación infantil flotante */
    animation: flotarImagen 4s ease-in-out infinite;
}

.img-portada {
    width: 100%;
    height: auto;
    max-height: 260px;
    object-fit: contain;
    border-radius: 35px;
    border: 5px solid var(--blanco);
    box-shadow: 0 20px 45px rgba(0,0,0,0.15);
    display: block;
}

/* Animación sutil de vaivén para la ilustración central */
@keyframes flotarImagen {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(1deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}
/* ==========================================================
   POSICIONAMIENTO DEL LOGO CORTO DE CRUZ EN LA ESQUINA
   ========================================================== */
   .logo-cruz-esquina {
    position: absolute;
    bottom: 20px;   /* Separación del borde inferior de la tarjeta */
    right: 25px;    /* Separación del borde derecho de la tarjeta */
    width: auto;
    height: 70px;   /* Tamaño equilibrado e ideal para la esquina */
    object-fit: contain;
    z-index: 15;    /* Asegura que quede por encima de los fondos */
    pointer-events: none; /* Evita que interfiera accidentalmente con los clics si se llega a encimar */
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.15)); /* Sutil sombra para integrarse al diseño vivo */
    transition: transform 0.3s ease;
}

/* Opcional: Un pequeño efecto dinámico por si se redimensiona la pantalla */
.contenedor-inicio:hover .logo-cruz-esquina {
    transform: scale(1.03);
}

/* ==========================================================
   4. ESTILOS DE BOTONES INTERACTIVOS (Efecto Pop)
   ========================================================== */
.botones-inicio {
    display: flex;
    gap: 30px;
    z-index: 10;
    margin-bottom: 15px;
}

button {
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-size: 1.6rem;
    padding: 20px 50px;
    border: none;
    border-radius: 60px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s ease;
}

/* Botón principal: Fiusha con relieve 3D */
.btn-principal {
    background-color: var(--fiusha-preescolar);
    color: var(--blanco);
    box-shadow: 0 10px 0 #8c0062, 0 15px 30px rgba(192, 0, 135, 0.35);
}

/* Botón secundario: Azul con relieve 3D */
.btn-secundario {
    background-color: var(--azul-preescolar);
    color: var(--blanco);
    box-shadow: 0 10px 0 #006b8a, 0 15px 30px rgba(0, 153, 196, 0.35);
}

/* Efecto divertido al pasar el cursor (Agrandado interactivo) */
button:hover {
    transform: translateY(-4px) scale(1.04);
}

.btn-principal:hover {
    box-shadow: 0 12px 0 #8c0062, 0 20px 35px rgba(192, 0, 135, 0.45);
}

.btn-secundario:hover {
    box-shadow: 0 12px 0 #006b8a, 0 20px 35px rgba(0, 153, 196, 0.45);
}

/* Efecto de hundimiento elástico al presionar */
button:active {
    transform: translateY(8px) scale(0.98);
}
.btn-principal:active { box-shadow: 0 2px 0 #8c0062, 0 5px 10px rgba(0,0,0,0.2); }
.btn-secundario:active { box-shadow: 0 2px 0 #006b8a, 0 5px 10px rgba(0,0,0,0.2); }

.footer {
    width: 100%;
    text-align: center;
    font-size: 0.95rem;
    color: var(--azul-preescolar);
    font-weight: 800;
    opacity: 0.8;
    padding: 15px 0 0 0;
    border-top: 2px solid rgba(0, 153, 196, 0.15);
}

/* ==========================================================
   5. SISTEMA DE DIÁLOGOS Y VENTANAS MODALES
   ========================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5); /* Un poco más suave */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-contenido {
    background: var(--blanco);
    padding: 45px 35px;
    border-radius: 40px;
    width: 90%;
    max-width: 600px;
    text-align: center;
    border: 8px solid var(--azul-preescolar);
    box-shadow: 0 20px 50px rgba(0,0,0,0.2);
    position: relative;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-contenido h2 {
    color: var(--azul-preescolar);
    font-size: 2.2rem;
    margin-bottom: 25px;
    font-weight: 900;
}

.modal-contenido p {
    color: #333;
    font-size: 1.35rem;
    margin-bottom: 20px;
    font-weight: 700;
}

.modal-contenido ol {
    text-align: left;
    margin: 20px auto 30px auto;
    max-width: 85%;
    color: #444;
    font-size: 1.25rem;
    line-height: 1.7;
}

.modal-contenido li {
    margin-bottom: 12px;
}

.cerrar-modal {
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 2.5rem;
    color: var(--fiusha-preescolar);
    cursor: pointer;
    font-weight: 800;
    transition: transform 0.2s;
}

.cerrar-modal:hover {
    transform: scale(1.2);
}

@keyframes popIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* ==========================================================
   6. MAQUETACIÓN Y DINÁMICA DE ELEMENTOS - NIVEL 1
   ========================================================== */
.nivel1-contenedor {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 25px;
}

.nivel1-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.95);
    padding: 18px 35px;
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    z-index: 100;
    border: 3px solid rgba(0, 153, 196, 0.15);
}

.temporizador, .puntaje {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--azul-preescolar);
    font-family: 'Montserrat', sans-serif;
}

.objeto-trampa {
    filter: drop-shadow(0 8px 16px rgba(192, 0, 135, 0.4)) !important;
}

.mensaje-final {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--blanco);
    padding: 45px;
    border-radius: 40px;
    border: 8px solid var(--azul-preescolar);
    box-shadow: 0 25px 55px rgba(0,0,0,0.25);
    text-align: center;
    z-index: 200;
    max-width: 550px;
    width: 85%;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mensaje-final p {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--azul-preescolar);
    line-height: 1.5;
}

/* ==========================================================
   7. MODIFICADORES GIGANTES - PAPÁ DIOS (NIVEL 1)
   ========================================================== */
.area-regalos-full {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 5;
}

.papa-dios-inferior-izq {
    position: absolute;
    bottom: -10px;
    left: -10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 80; 
    pointer-events: none;
}

.papa-dios-grande-img {
    height: 320px;
    width: auto;
    filter: drop-shadow(0 15px 30px rgba(0,0,0,0.25));
}

/* Mensaje flotante: Usa fondo amarillo institucional con letras Azules */
.mensaje-caja-mini {
    background-color: var(--amarillo-escolar);
    color: var(--azul-preescolar);
    padding: 8px 24px;
    border-radius: 20px;
    font-weight: 900;
    font-size: 1.25rem;
    margin-bottom: -15px; 
    box-shadow: 0 6px 15px rgba(0,0,0,0.18);
    border: 3.5px solid var(--azul-preescolar);
    white-space: nowrap;
    z-index: 90;
}

.regalo-flotante {
    position: absolute;
    cursor: pointer;
    user-select: none;
    z-index: 20;
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.2));
}

.regalo-flotante:hover {
    transform: scale(1.15);
}
/* ==========================================================
   NIVEL 2: ROMPECABEZAS ANA Y SANTI (CALCE PERFECTO)
   ========================================================== */

/* --- Pantalla de Selección de Personaje --- */
.nivel2-seleccion {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    background: linear-gradient(135deg, #a8e6cf 0%, #dcedc1 100%);
    box-sizing: border-box;
}

.nivel2-seleccion h2 {
    font-size: 2.5rem;
    color: var(--azul-titulo, #2b3a8c);
    margin-bottom: 40px;
    font-weight: 900;
    text-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.personajes-container {
    display: flex;
    justify-content: center;
    gap: 60px;
}

.personaje-card {
    background: var(--blanco, #ffffff);
    border: 6px solid var(--azul-titulo, #2b3a8c);
    border-radius: 40px;
    padding: 30px 25px;
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.25s;
    width: 230px;
    text-align: center;
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
    box-sizing: border-box;
}

.personaje-card:hover {
    transform: scale(1.08);
    background-color: #fffde7;
    border-color: var(--amarillo-escolar, #f5d020);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.personaje-card img {
    width: 100%;
    height: 200px;
    object-fit: contain;
    margin-bottom: 15px;
}

.personaje-card p {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--azul-titulo, #2b3a8c);
    margin: 0;
}

/* --- Contenedor Principal del Juego --- */
.nivel2-contenedor {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 25px;
    background: #fdfaf2;
    box-sizing: border-box;
}

.nivel2-area-juego {
    display: flex;
    flex: 1;
    justify-content: space-around;
    align-items: center;
    height: calc(100% - 100px);
    gap: 20px;
}

/* --- Header de Estado --- */
.nivel2-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 15px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    box-sizing: border-box;
}

.puntaje-n2,
.progreso-n2 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--azul-titulo, #2b3a8c);
}

/* --- Contenedor del Personaje y Silueta --- */
.silueta-container {
    position: relative;
    width: 380px;
    height: 550px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 35px;
    border: 4px dashed rgba(43, 58, 140, 0.15);
    box-sizing: border-box;
}

/* Regla base de la silueta completa */
.silueta-base {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 1;
    opacity: 0.9;
}

/* --- CALIBRACIÓN MANUAL PARA IMÁGENES RECORTADAS AL RAS --- */
.capa-personaje {
    position: absolute;
    object-fit: contain;
    pointer-events: none; /* Evita que las capas bloqueen clics */
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Posiciones de cada pieza para Santi*/
#destino-cabeza {
    top: 0%;
    left: 20.01%;
    width: 60%;
    z-index: 3;
}
#destino-ojos {
    top: 16.5%;
    left: 35%;
    width: 31%;
    z-index: 5;
}
#destino-oidos {
    top: 22.3%;
    left: 22.5%;
    width: 55.5%;
    z-index: 2;
}
#destino-corazon {
    top: 47.4%;
    left: 48.4%;
    width: 19.2%;
    z-index: 4;
}
#destino-manos {
    top: 59.5%;
    left: 5.5%;
    width: 89%;
    z-index: 4;
}
#destino-pies {
    top: 85%;
    left: 22%;
    width: 55%;
    z-index: 3;
}
/* --- Coordenadas Ana --- */
.personaje-ana #destino-cabeza     { top: -1%; left: 15%; width: 70%; z-index: 3; }
.personaje-ana #destino-ojos       { top: 17%; left: 33.7%; width: 32.5%; z-index: 5; }
.personaje-ana #destino-oidos      { top: 22.3%; left: 22.5%; width: 55.5%; z-index: 2; }
.personaje-ana #destino-corazon    { top: 48%; left: 47%; width: 18%; z-index: 4; }
.personaje-ana #destino-manos      { top: 60%; left: 5%; width: 90%; z-index: 4; }
.personaje-ana #destino-pies       { top: 90%; left: 25%; width: 50%; z-index: 3; }

/* Estados de ocultación y animación */
.pieza-destino-capa.hidden {
    display: block !important;
    opacity: 0 !important;
    transform: scale(0.92);
}

:not(.hidden).pieza-destino-capa {
    animation: reboteColocacion 0.45s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

/* --- Zonas de Drop (invisibles pero interactivas) --- */
.drop-capturador {
    position: absolute;
    z-index: 20; /* Siempre por encima de las capas de piezas */
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: background 0.2s, border 0.2s, transform 0.2s;
    box-sizing: border-box;
}

.drop-capturador:hover {
    background: rgba(245, 208, 32, 0.25);
    border: 3px dashed var(--amarillo-escolar, #f5d020);
    transform: scale(1.02);
}

/* Cuando una zona ya ha recibido su pieza, se desactiva y oculta */
.drop-capturador.completado {
    pointer-events: none !important;
    opacity: 0 !important;
    transform: scale(0.8) !important;
}

/* Posiciones de cada zona (idénticas a las de las capas) */
.zona-cabeza {
    top: 0%;
    left: 14.8%;
    width: 70.4%;
    height: 38%;
    border-radius: 50%;
}
.zona-ojos {
    top: 20.4%;
    left: 32.5%;
    width: 35.2%;
    height: 10%;
    border-radius: 10px;
}
.zona-oidos {
    top: 19.8%;
    left: 1.5%;
    width: 97%;
    height: 12%;
    border-radius: 15px;
}
.zona-corazon {
    top: 47.4%;
    left: 48.4%;
    width: 19.2%;
    height: 11%;
    border-radius: 50%;
}
.zona-manos {
    top: 58%;
    left: 0%;
    width: 100%;
    height: 15%;
    border-radius: 20px;
}
.zona-pies {
    top: 84.8%;
    left: 20.2%;
    width: 59.6%;
    height: 15%;
    border-radius: 15px;
}

/* --- Almacén Lateral de Piezas Sueltas --- */
.partes-container {
    width: 340px;
    height: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    background: rgba(255, 255, 255, 0.85);
    padding: 20px;
    border-radius: 35px;
    border: 4px solid rgba(43, 58, 140, 0.1);
    align-content: center;
    box-sizing: border-box;
}

.parte-arrastrable {
    background: var(--blanco, #ffffff);
    border: 4px solid var(--azul-titulo, #2b3a8c);
    border-radius: 22px;
    padding: 10px;
    cursor: grab;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 125px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.06);
    transition: transform 0.15s, background-color 0.15s, border-color 0.15s;
    box-sizing: border-box;
}

.parte-arrastrable:active {
    cursor: grabbing;
}

.parte-arrastrable img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    pointer-events: none;
}

.parte-arrastrable.seleccionada {
    border-color: #ff9800;
    background: #fff3e0;
    transform: scale(1.06);
    box-shadow: 0 10px 20px rgba(255, 152, 0, 0.2);
}

/* --- Mensaje de Éxito y Feedback --- */
.mensaje-final-n2 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--blanco, #ffffff);
    padding: 40px;
    border-radius: 40px;
    border: 8px solid var(--azul-titulo, #2b3a8c);
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--azul-titulo, #2b3a8c);
    z-index: 150;
    max-width: 540px;
    width: 85%;
    box-sizing: border-box;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-continuar-n2 {
    display: inline-block;
    background-color: var(--verde-exito, #4caf50);
    color: var(--blanco, #ffffff);
    border: none;
    font-family: inherit;
    font-weight: 900;
    border-radius: 25px;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    box-shadow: 0 8px 0 #2e7d32, 0 10px 20px rgba(0, 0, 0, 0.15);
    margin-top: 25px;
    font-size: 1.4rem;
    padding: 15px 40px;
}

.btn-continuar-n2:active {
    transform: translateY(4px);
    box-shadow: 0 4px 0 #2e7d32, 0 6px 10px rgba(0, 0, 0, 0.15);
}

.feedback-pop {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 14px 30px;
    border-radius: 30px;
    color: var(--blanco, #ffffff);
    font-weight: 800;
    font-size: 1.3rem;
    z-index: 200;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    animation: subirYRevelar 0.35s ease-out forwards;
}

.fb-exito {
    background-color: #4caf50;
}
.fb-error {
    background-color: #f44336;
}

/* --- Animaciones --- */
@keyframes reboteColocacion {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    60% {
        transform: scale(1.04);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes subirYRevelar {
    from {
        transform: translate(-50%, 25px);
        opacity: 0;
    }
    to {
        transform: translate(-50%, 0);
        opacity: 1;
    }
}

@keyframes popIn {
    from {
        transform: translate(-50%, -30%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/*
.drop-capturador {
    background: rgba(255, 0, 0, 0.3) !important;
    border: 3px solid red !important;
}*/
/* ==========================================================
   ESTILOS ESPECÍFICOS PARA EL NIVEL 3: TOCA Y DESCUBRE
   ========================================================== */

   .nivel3-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.instruccion-nivel3 {
    background: rgba(255, 255, 255, 0.95);
    border: 4px dashed var(--azul-preescolar);
    border-radius: 20px;
    padding: 10px 25px;
    margin-bottom: 20px;
    text-align: center;
    box-shadow: 0 6px 12px rgba(0,0,0,0.05);
    max-width: 80%;
}

.instruccion-nivel3 p {
    color: var(--azul-preescolar);
    font-size: 1.4rem;
    font-weight: 900;
    margin: 0;
}

/* Cuadrícula responsiva de 4x2 para tablets/PC que baja a 2x4 en pantallas verticales móviles */
.grid-nivel3 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    width: 90%;
    max-width: 950px;
    justify-items: center;
}

@media (max-width: 768px) {
    .grid-nivel3 {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    .instruccion-nivel3 p {
        font-size: 1.1rem;
    }
}

/* Tarjeta contenedora de la ilustración */
.tarjeta-n3 {
    position: relative;
    background: #ffffff;
    border: 6px solid #e0e0e0;
    border-radius: 25px;
    padding: 10px;
    cursor: pointer;
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    width: 100%;
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    touch-action: none; /* Evita scrolls accidentales en móviles al arrastrar o tocar */
}

.tarjeta-n3:active {
    transform: scale(0.92);
}

.wrapper-imagen-n3 {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wrapper-imagen-n3 img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    pointer-events: none; /* Evita que el navegador intente arrastrar la imagen en móviles */
}

/* Estados de feedback interactivo */
.tarjeta-n3.correcto {
    border-color: #4caf50 !important;
    background-color: #f1fbf1;
}

.tarjeta-n3.incorrecto {
    border-color: var(--rojo-primaria) !important;
    background-color: #fff5f5;
    opacity: 0.7;
}

/* Capa flotante con la estrella o equis gigante */
.feedback-visual-n3 {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    font-weight: bold;
    border-radius: 19px;
    animation: popFeedback 0.3s cubic-bezier(0.175, 0.885, 0.42, 1.4);
    pointer-events: none;
}

@keyframes popFeedback {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

