/* 
   Variables y Configuración Base
   Priorizando pantallas táctiles, alto contraste y legibilidad para niños.
*/
:root {
    --primary-color: #4CAF50;
    --primary-dark: #388E3C;
    --secondary-color: #FFC107;
    --secondary-dark: #FFA000;
    --accent-color: #FF5722;
    --bg-color-home: #81C784;
    --bg-color-menu: #E8F5E9;
    --bg-color-game: #B3E5FC;
    --bg-color-reward: #FFECB3;
    --text-light: #FFFFFF;
    --text-dark: #333333;
    --button-shadow: 0 8px 0 rgba(0, 0, 0, 0.2);
    --button-active-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

/* Reset Global para App Táctil */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    /* No selection */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* No hover effect on mobile */
}

body {
    font-family: 'Comic Sans MS', 'Chalkboard SE', 'Marker Felt', 'Arial Rounded MT Bold', sans-serif;
    background-color: var(--bg-color-home);
    color: var(--text-light);
    overflow: hidden;
    /* Sin scroll para experiencia app */
    text-align: center;
    touch-action: manipulation;
    /* Evita doble tap zoom */
    width: 100vw;
    height: 100vh;
}

/* Gestión de Pantallas (SPA) */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}

.hidden {
    opacity: 0;
    pointer-events: none;
    z-index: -1;
    transform: scale(0.95);
}

.active {
    opacity: 1;
    z-index: 10;
    transform: scale(1);
}

/* Colores de fondo por pantalla */
.home-screen {
    /* El fondo base ahora está manejado por .meadow-scene */
    background-color: var(--primary-color);
}

.menu-screen {
    background-color: var(--bg-color-menu);
}

.game-screen {
    background-color: var(--bg-color-game);
    color: var(--text-dark);
}

.reward-screen {
    background: url('../assets/img/reward_bg.png') center center / cover no-repeat;
    color: var(--text-dark);
    overflow: hidden;
    justify-content: space-evenly;
    padding: 2vh 0;
}

/* Confetti container */
.reward-confetti {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    width: 12px;
    height: 12px;
    border-radius: 2px;
    animation: confettiFall linear forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg) scale(0.5);
        opacity: 0;
    }
}

/* Reward Title — outlined text, sits at top of the scene */
.reward-title {
    position: relative;
    z-index: 5;
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 900;
    color: #FFFFFF;
    -webkit-text-stroke: 2.5px #D84315;
    text-shadow:
        0 4px 8px rgba(0, 0, 0, 0.35),
        0 0 30px rgba(255, 193, 7, 0.5);
    animation: titlePulse 2s ease-in-out infinite;
    margin: 0;
}

@keyframes titlePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Center scene: dino + egg side by side */
.reward-scene {
    position: relative;
    z-index: 5;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: clamp(1rem, 3vw, 2rem);
}

/* Dino celebration image */
.reward-dino-img {
    width: clamp(100px, 20vw, 180px);
    height: auto;
    filter: drop-shadow(0 8px 15px rgba(0, 0, 0, 0.3));
    animation: dinoCelebrate 1s ease-in-out infinite;
}

@keyframes dinoCelebrate {
    0%, 100% {
        transform: translateY(0) rotate(-3deg);
    }
    50% {
        transform: translateY(-12px) rotate(3deg);
    }
}

/* Egg Zone */
.reward-egg-zone {
    position: relative;
    width: clamp(120px, 22vw, 200px);
    height: clamp(120px, 22vw, 200px);
    display: flex;
    justify-content: center;
    align-items: center;
}

.reward-egg-glow {
    position: absolute;
    width: 140%;
    height: 140%;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 215, 0, 0.45) 0%, rgba(255, 152, 0, 0.15) 50%, transparent 70%);
    animation: eggGlow 2s ease-in-out infinite alternate;
}

@keyframes eggGlow {
    0% {
        transform: scale(0.9);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Efectos Recompensa Especial (3er Huevo) */
.reward-screen.special-reward .reward-egg-glow {
    background: radial-gradient(circle, rgba(255, 255, 255, 0.8) 0%, rgba(255, 215, 0, 0.4) 40%, transparent 70%);
    animation: eggGlowSpecial 1s ease-in-out infinite alternate;
}

@keyframes eggGlowSpecial {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(2.5); opacity: 1; }
}

/* Secuencia de Eclosión */
.reward-screen.special-reward .reward-egg-img {
    animation: eggVibrate 1.5s linear forwards;
}

@keyframes eggVibrate {
    0%, 100% { transform: rotate(0) scale(1.1); }
    10%, 30%, 50%, 70%, 90% { transform: rotate(-10deg) scale(1.1); }
    20%, 40%, 60%, 80% { transform: rotate(10deg) scale(1.1); }
    95% { opacity: 1; transform: scale(1.3); }
    100% { opacity: 0; transform: scale(1.5); }
}

.reward-baby-img {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 4;
    opacity: 0;
    transform: scale(0.5);
    pointer-events: none;
}

.reward-screen.special-reward .reward-baby-img {
    animation: babyPopIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) 1.5s forwards,
               babyBounce 2s ease-in-out infinite 2s;
}

@keyframes babyPopIn {
    0% { opacity: 0; transform: scale(0.5); }
    100% { opacity: 1; transform: scale(1.1); }
}

@keyframes babyBounce {
    0%, 100% { transform: scale(1.1) translateY(0); }
    50% { transform: scale(1.15) translateY(-10px); }
}

.reward-screen.special-reward .reward-title {
    animation: rainbowText 3s linear infinite;
}

@keyframes rainbowText {
    0% { filter: hue-rotate(0deg); }
    100% { filter: hue-rotate(360deg); }
}

.reward-egg-img {
    position: relative;
    width: 100%;
    height: 100%;
    object-fit: contain;
    z-index: 3;
    animation: eggBounce 1.5s ease-in-out infinite;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.35));
}

@keyframes eggBounce {
    0%, 100% {
        transform: translateY(0) rotate(-3deg);
    }
    50% {
        transform: translateY(-8px) rotate(3deg);
    }
}

/* Subtitle — outlined for visibility */
.reward-subtitle {
    position: relative;
    z-index: 5;
    font-size: clamp(1.3rem, 3vw, 1.8rem);
    font-weight: 800;
    color: #FFFFFF;
    -webkit-text-stroke: 1.5px #5D4037;
    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
    margin: 0;
}

/* Indicador de huevos en el menú */
.menu-egg-progress {
    display: flex;
    gap: 1.5rem;
    margin: 1.5vh 0 3vh 0;
    background: rgba(255, 255, 255, 0.5);
    padding: 10px 25px;
    border-radius: 50px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.1);
}

.menu-egg-slot {
    font-size: 3rem;
    filter: grayscale(1) opacity(0.3);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform: scale(0.8);
}

.menu-egg-slot.active {
    filter: grayscale(0) opacity(1) drop-shadow(0 0 10px rgba(255, 215, 0, 0.8));
    transform: scale(1.1);
    animation: eggWiggle 2s infinite ease-in-out;
}

@keyframes eggWiggle {
    0%, 100% { transform: scale(1.1) rotate(-5deg); }
    50% { transform: scale(1.2) rotate(5deg); }
}

/* Play Again Button */
.reward-btn {
    position: relative;
    z-index: 5;
    display: inline-block;
    padding: clamp(0.8rem, 2vh, 1.2rem) clamp(2rem, 6vw, 4rem);
    font-size: clamp(1.4rem, 3vw, 2rem);
    font-weight: 800;
    font-family: inherit;
    color: white;
    background: linear-gradient(135deg, #4CAF50, #66BB6A, #43A047);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    box-shadow:
        0 6px 0 #2E7D32,
        0 10px 20px rgba(0, 0, 0, 0.2);
    transition: all 0.15s ease;
    letter-spacing: 0.5px;
}

.reward-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 0 #2E7D32,
        0 14px 25px rgba(0, 0, 0, 0.25);
}

.reward-btn:active {
    transform: translateY(4px);
    box-shadow:
        0 2px 0 #2E7D32,
        0 4px 10px rgba(0, 0, 0, 0.15);
}

/* === IMAGEN DE FONDO (HOME) === */
.home-background-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* Cubre toda la pantalla sin deformarse */
    object-position: center bottom;
    /* Ideal para enfocar la parte principal si hay recortes */
    z-index: 1;
    /* Fondo de la pantalla de inicio */
}

/* Shadow Items Styling (missing in original CSS view but used in JS) */
.sombras-item {
    background: white;
    border-radius: 20px;
    padding: 10px;
    width: clamp(100px, 15vw, 150px);
    height: clamp(100px, 15vw, 150px);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 6px 0 rgba(0,0,0,0.1);
    cursor: pointer;
    transition: transform 0.2s;
}

.sombras-item img {
    max-width: 80%;
    max-height: 80%;
    object-fit: contain;
}

.sombras-item.shadow img {
    filter: brightness(0);
}

.sombras-item.selected {
    border: 4px solid var(--secondary-color);
    transform: scale(1.1);
}

.sombras-item.matched {
    opacity: 0.5;
    pointer-events: none;
    border: 4px solid var(--primary-color);
}

/* Área de contenido del Home por encima de la imagen */
.home-content {
    position: relative;
    z-index: 10;
    /* Encima de todo */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    /* Lo movemos abajo o al centro dependiendo del diseño visual */
    height: 100%;
    padding-bottom: 15vh;
    /* Separación del fondo */
}

/* Tipografía */
.title {
    font-size: 5rem;
    font-size: clamp(2.5rem, 8vw, 5rem);
    text-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2), -2px -2px 0px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    padding: 0 20px;
    line-height: 1.2;
    z-index: 10;
}

.text-dark {
    color: var(--text-dark);
    text-shadow: none;
}

.reward-subtitle {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

/* Botones y Controles */
.btn-giant {
    background-color: var(--secondary-color);
    color: var(--text-dark);
    font-size: clamp(2rem, 5vw, 4rem);
    padding: 1.5rem 4rem;
    border: none;
    border-radius: 60px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 0 var(--secondary-dark), 0 20px 20px rgba(0, 0, 0, 0.4);
    /* Super sombreado que flota encima */
    transition: transform 0.1s, box-shadow 0.1s;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 2px;
    z-index: 10;
}

.btn-giant:active {
    transform: translateY(8px);
    box-shadow: 0 2px 0 var(--secondary-dark), 0 5px 10px rgba(0, 0, 0, 0.4);
}

.btn-back {
    position: absolute;
    bottom: 30px;
    left: 30px;
    background-color: var(--accent-color);
    color: white;
    font-size: 2rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 30px;
    box-shadow: 0 6px 0 #D84315;
    /* Sombra más oscura */
    cursor: pointer;
    font-family: inherit;
    font-weight: bold;
}

.btn-back:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #D84315;
}

.btn-icon {
    position: absolute;
    background: rgba(255, 255, 255, 0.4);
    border: none;
    font-size: 3rem;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-icon:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0.1);
}

.top-left {
    top: 20px;
    left: 20px;
}

.top-right {
    top: 20px;
    right: 20px;
}

/* Grid de Menú */
.cards-container {
    display: flex;
    gap: 3rem;
    justify-content: center;
    flex-wrap: wrap;
    padding: 20px;
    max-width: 1200px;
    overflow-y: auto;
    max-height: 80vh;
}

.card {
    background: white;
    color: var(--text-dark);
    border-radius: 40px;
    padding: 1.5rem;
    width: 250px;
    height: 250px;
    width: clamp(160px, 20vw, 250px);
    height: clamp(160px, 20vw, 250px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 12px 0 rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: transform 0.2s;
    border: 4px solid transparent;
}

.card:active {
    transform: translateY(8px) scale(0.95);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
}

.card:hover {
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 6rem;
    font-size: clamp(3rem, 10vw, 6rem);
    margin-bottom: 0.5rem;
}

.card-title {
    font-size: 2rem;
    font-size: clamp(1.2rem, 3vw, 2rem);
    font-weight: bold;
}

/* Área de Minijuegos */
.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex: 1;
    max-height: 70vh;
}

/* Minijuego 1: Comida */
.large-dino {
    font-size: 14rem;
    filter: drop-shadow(0 10px 5px rgba(0, 0, 0, 0.2));
    margin-bottom: 2rem;
    animation: breathing 3s infinite ease-in-out;
}

.options-container {
    display: flex;
    gap: 3rem;
    justify-content: center;
    flex-wrap: wrap;
}

.food-option {
    font-size: 7rem;
    background: white;
    border-radius: 50%;
    width: 180px;
    height: 180px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 10px 0 rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.1s, background-color 0.3s;
    border: 6px solid white;
}

.food-option:active {
    transform: translateY(6px);
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.15);
}

/* Minijuego 2: Puzzle */
.puzzle-area {
    width: 90vw;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

.puzzle-board {
    display: grid;
    /* Configurado dinámicamente por JS */
    gap: 12px;
    background: rgba(255, 255, 255, 0.3);
    padding: 25px;
    border-radius: 30px;
    box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.puzzle-slot {
    width: 140px;
    height: 140px;
    background: rgba(255, 255, 255, 0.2);
    border: 3px dashed rgba(255, 255, 255, 0.6);
    border-radius: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
}

.puzzle-tray {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    min-height: 180px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 30px;
    width: 95%;
    max-width: 1100px;
    overflow-x: auto;
}

.puzzle-piece {
    width: 140px;
    height: 140px;
    background-color: #fff;
    background-size: 0;
    /* JS lo pondrá al tamaño correcto */
    background-repeat: no-repeat;
    border: 3px solid white;
    border-radius: 15px;
    cursor: grab;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
    touch-action: none;
    transition: transform 0.1s, box-shadow 0.1s;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 50;
}

.puzzle-piece:active {
    cursor: grabbing;
}

.piece-placed {
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.1);
    transform: none !important;
    animation: popIn 0.3s;
}

/* Minijuego 3: Fósiles */
.excavation-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.excavation-site {
    position: relative;
    width: 80vw;
    height: 55vh;
    background: #5d4037;
    /* Color tierra profunda */
    border: 10px solid #8d6e63;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

#sand-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: url('../assets/img/hoja.png'), crosshair;
    /* Fallback si no hay icono de pala */
    touch-action: none;
}

.fossil {
    position: absolute;
    font-size: 5rem;
    pointer-events: none;
    z-index: 5;
    filter: sepia(0.5) brightness(0.8);
    transition: transform 0.5s ease;
}

.fossil-found {
    filter: none;
    animation: foundPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.game-instructions {
    background: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 1.5rem;
    font-weight: bold;
    color: #5d4037;
    margin-top: 10px;
}

@keyframes foundPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.5) rotate(15deg);
    }

    100% {
        transform: scale(1.2);
    }
}

/* Minijuego 4: Memoria */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, clamp(100px, 15vw, 150px));
    grid-template-rows: repeat(2, clamp(130px, 20vw, 200px));
    gap: 15px;
    perspective: 1000px;
    padding: 20px;
}

.memory-card {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

/* Estado girado: se aplica tanto a flipped como a matched */
.memory-card.flipped,
.memory-card.matched {
    transform: rotateY(180deg) !important;
}

/* Forzamos visibilidad de las caras según el estado */
.memory-card.flipped .card-back,
.memory-card.matched .card-back {
    visibility: hidden;
    opacity: 0;
}

.memory-card.flipped .card-front,
.memory-card.matched .card-front {
    visibility: visible;
    opacity: 1;
    z-index: 10;
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
    border: 4px solid white;
    transition: opacity 0.3s;
}

.card-back {
    background: linear-gradient(135deg, #4CAF50 0%, #388E3C 100%);
    font-size: 5rem;
    color: white;
    z-index: 2;
}

.card-front {
    background: white;
    transform: rotateY(180deg);
    z-index: 1;
    visibility: hidden;
    opacity: 0;
}

.card-front img {
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.memory-card.matched {
    opacity: 1;
    pointer-events: none;
    box-shadow: 0 0 25px rgba(76, 175, 80, 0.6);
}

/* Recompensa */
.star-burst {
    font-size: 10rem;
    animation: spin 6s linear infinite;
    margin-bottom: 2rem;
}

.reward-egg {
    font-size: 12rem;
    margin-top: 2rem;
    animation: wiggle 2s infinite;
    filter: drop-shadow(0 20px 10px rgba(0, 0, 0, 0.1));
}

/* Clases de Utilidad */
.mt-4 {
    margin-top: 4rem;
}

.pulse-error {
    animation: shakeError 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

.correct-answer {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-dark) !important;
    transform: scale(1.1);
}

/* Animaciones Clave (Alta performance) */
@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-25px);
    }
}

@keyframes breathing {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }

    80% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes shakeError {

    10%,
    90% {
        transform: translate3d(-10px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(15px, 0, 0) scale(0.95);
        background-color: #ffebee;
    }

    30%,
    50%,
    70% {
        transform: translate3d(-15px, 0, 0) scale(0.95);
    }

    40%,
    60% {
        transform: translate3d(15px, 0, 0) scale(0.95);
    }
}

@keyframes highlightTrack {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
        filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.8));
    }

    100% {
        transform: scale(1);
        opacity: 0.7;
    }
}

@keyframes wiggle {

    0%,
    100% {
        transform: rotate(-5deg);
    }

    50% {
        transform: rotate(5deg);
    }
}

/* Minijuego 5: Huevo Sorpresa */
.egg-container {
    position: relative;
    width: 450px;
    height: 550px;
    margin: 10px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    user-select: none;
    border-radius: 50%;
    transition: transform 0.2s;
}

.egg-main {
    font-size: 30rem;
    /* ¡Lo hacemos aún más grande! */
    transition: transform 0.1s ease;
    filter: drop-shadow(0 20px 40px rgba(0, 0, 0, 0.3));
    z-index: 5;
}

.egg-container:hover .egg-main {
    transform: scale(1.05);
}

.egg-container:active .egg-main {
    transform: scale(0.9);
}

.egg-cracks {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
    font-size: 30rem;
    opacity: 0;
    transition: opacity 0.3s;
    color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

.egg-surprise {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 400px;
    height: 400px;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.egg-surprise img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    animation: popIn 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.hatching .egg-main {
    animation: egg-break 0.8s forwards;
}

@keyframes egg-break {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    20% {
        transform: scale(1.2) rotate(10deg);
    }

    40% {
        transform: scale(0.8) rotate(-10deg);
    }

    100% {
        transform: scale(0);
        opacity: 0;
        visibility: hidden;
    }
}

.wiggle-animation {
    animation: wiggle 0.3s ease-in-out;
}

/* Minijuego 6: Dino Salto */
.salto-area {
    width: 90vw;
    height: 60vh;
    background-size: auto 100%;
    /* El alto al 100%, el ancho se repite */
    background-position: 0 bottom;
    background-repeat: repeat-x;
    border: 8px solid white;
    border-radius: 40px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    animation: backgroundScroll 20s linear infinite;
}

@keyframes backgroundScroll {
    from {
        background-position: 0 bottom;
    }

    to {
        background-position: -2000px bottom;
    }

    /* Ajustable según el ancho de la imagen */
}

#salto-world {
    position: absolute;
    width: 100%;
    height: 100%;
}

.salto-dino {
    position: absolute;
    bottom: 16.5%;
    /* Bajado otros 10px aprox para ajuste fino */
    left: 10%;
    width: 210px;
    /* Más grande como sugeriste */
    /* Tamaño mayor para equilibrio visual */
    height: auto;
    z-index: 20;
    transition: bottom 0.1s;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.2));
}

.salto-dino.jumping {
    animation: jump 1.3s ease-in-out;
}

.salto-obstacle {
    position: absolute;
    bottom: 16.5%;
    right: -100px;
    width: 130px;
    /* Reducido para que sea más fácil de saltar */
    /* Tamaño más grande solicitado anteriormente fue 170px */
    height: auto;
    z-index: 15;
}

.salto-obstacle img {
    width: 100%;
    height: auto;
}

@keyframes jump {
    0% {
        bottom: 16.5%;
        left: 10%;
    }

    30% {
        bottom: 75%;
        left: 20%; /* Avanza hacia la derecha mientras sube */
    }

    60% {
        bottom: 75%;
        left: 30%; /* Sigue avanzando en el aire */
    }

    100% {
        bottom: 16.5%;
        left: 10%; /* Vuelve a su posición original */
    }
}

@keyframes moveObstacle {
    from {
        right: -100px;
    }

    to {
        right: 110%;
    }
}

/* Minijuego 7: Dino Sombras */
.sombras-area {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border-radius: 30px;
    width: 90vw;
    height: 70vh;
    justify-content: space-around;
    box-sizing: border-box;
}

.sombras-grid {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.sombras-item {
    width: 25%;
    max-width: 200px;
    aspect-ratio: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    border-radius: 20px;
    padding: 1.5rem;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    border: 4px solid transparent;
}

.sombras-item:hover {
    transform: scale(1.05) rotate(2deg);
}

.sombras-item.selected {
    border-color: var(--primary);
    background: #E8F5E9;
    transform: scale(1.1);
}

.sombras-item.matched {
    opacity: 0.4;
    cursor: default;
    transform: scale(0.9);
    filter: grayscale(1);
    background: #EEEEEE;
}

.sombras-item img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    pointer-events: none;
}

/* Efecto Sombra */
.sombras-item.shadow img {
    filter: brightness(0);
}

/* Animación de éxito */
.sombras-item.success-pop {
    animation: successPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes successPop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.4) rotate(10deg);
    }

    100% {
        transform: scale(0.9);
    }
}

/* Minijuego 8: Dino Rugido */
.rugido-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 40px;
    width: 90vw;
    height: 70vh;
}

.rugido-dino {
    width: 250px;
    height: 250px;
    transition: transform 0.1s;
}

.rugido-dino img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.roar-meter-container {
    width: 80%;
    height: 40px;
    background: #ddd;
    border-radius: 20px;
    position: relative;
    overflow: hidden;
    border: 4px solid white;
}

.roar-meter-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4CAF50, #FFC107, #F44336);
    transition: width 0.1s ease-out;
}

.roar-meter-label {
    position: absolute;
    width: 100%;
    text-align: center;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    color: rgba(0, 0, 0, 0.5);
    font-size: 0.9rem;
    pointer-events: none;
}

.roar-status {
    font-size: 2.5rem;
    font-weight: 900;
    color: #444;
    text-shadow: 2px 2px 0 white;
}

.roar-shake {
    animation: roarShake 0.1s infinite;
}

@keyframes roarShake {
    0% {
        transform: translate(1px, 1px) rotate(0deg);
    }

    10% {
        transform: translate(-1px, -2px) rotate(-1deg);
    }

    20% {
        transform: translate(-3px, 0px) rotate(1deg);
    }

    30% {
        transform: translate(3px, 2px) rotate(0deg);
    }

    40% {
        transform: translate(1px, -1px) rotate(1deg);
    }

    50% {
        transform: translate(-1px, 2px) rotate(-1deg);
    }

    60% {
        transform: translate(-3px, 1px) rotate(0deg);
    }

    70% {
        transform: translate(3px, 1px) rotate(-1deg);
    }

    80% {
        transform: translate(-1px, -1px) rotate(1deg);
    }

    90% {
        transform: translate(1px, 2px) rotate(0deg);
    }

    100% {
        transform: translate(1px, -2px) rotate(-1deg);
    }
}

/* Tablet Responsive Adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .title {
        margin-bottom: 2vh;
    }
    
    .game-area {
        max-height: 80vh; /* Allow more space on tablets */
    }
    
    .large-dino {
        font-size: clamp(10rem, 15vw, 16rem);
    }
    
    .card {
        width: clamp(200px, 25vw, 280px);
        height: clamp(200px, 25vw, 280px);
    }
    
    .card-icon {
        font-size: clamp(4rem, 8vw, 7rem);
    }
    
    .puzzle-area, .salto-area, .sombras-area, .rugido-area {
        width: 95vw;
        height: 75vh;
        max-height: 800px;
    }
    
    .excavation-site {
        height: 65vh;
        width: 90vw;
    }
    
    .food-option {
        width: clamp(120px, 20vw, 200px);
        height: clamp(120px, 20vw, 200px);
    }
    
    .egg-container {
        width: clamp(300px, 50vw, 550px);
        height: clamp(350px, 60vw, 650px);
    }
    
    .egg-main {
        font-size: clamp(20rem, 30vw, 40rem);
    }
}

/* Tablet Landscape */
@media (min-width: 768px) and (max-width: 1180px) and (orientation: landscape) {
    .title {
        font-size: clamp(2.5rem, 5vw, 4rem);
        margin-bottom: 2vh;
    }
    
    .game-area {
        max-height: 85vh;
    }
    
    .sombras-area {
        flex-direction: row;
        justify-content: space-evenly;
        height: 80vh;
    }
    
    .sombras-grid {
        flex-direction: column;
        width: 45%;
        height: 100%;
        justify-content: space-around;
    }

    .sombras-item {
        width: clamp(120px, 20vh, 180px);
        max-width: none;
    }
    
    .excavation-site {
        height: 70vh;
    }
}