/* ========================================================================== */
/* SIMON DICE - VERSIÓN CON MEJOR ESPACIADO EN TELÉFONOS */
/* ========================================================================== */

/* Contenedor principal del juego */
.juego-simon,
#contenedor-minijuegos-global .juego-simon {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: transparent !important;
    color: white !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: visible !important;
    touch-action: manipulation !important;
    z-index: 2147483645 !important;
    font-family: 'Fredoka', sans-serif !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Contenedor del tablero - CON DESPLAZAMIENTO HACIA ABAJO */
.juego-simon .water-lilies-board,
#contenedor-minijuegos-global .juego-simon .water-lilies-board {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: repeat(2, 1fr) !important;
    grid-gap: 25px !important; /* MÁS ESPACIO ENTRE ESFERAS */
    width: 320px !important;
    height: 420px !important;
    max-width: 90vw !important;
    max-height: 80vh !important;
    position: relative !important;
    z-index: 2147483646 !important;
    box-sizing: border-box !important;
    justify-items: center !important;
    align-items: center !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    margin-top: 35px !important; /* DESPLAZAMIENTO HACIA ABAJO */
}

/* Separar específicamente la fila de abajo */
.juego-simon .water-lilies-board .lily-pad:nth-child(3),
.juego-simon .water-lilies-board .lily-pad:nth-child(4),
#contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(3),
#contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(4) {
    margin-top: 35px !important;
}

/* Estilo de hoja de nenúfar */
.juego-simon .lily-pad,
#contenedor-minijuegos-global .juego-simon .lily-pad {
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    border: none !important;
    box-shadow: 
        0 8px 20px rgba(0, 0, 0, 0.3),
        inset 0 -4px 8px rgba(0, 0, 0, 0.2),
        inset 0 4px 12px rgba(255, 255, 255, 0.6) !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    position: relative !important;
    overflow: visible !important;
    width: 140px !important;
    height: 140px !important;
    border-radius: 50% !important;
    z-index: 2 !important;
    margin: 0 !important;
    padding: 0 !important;
    transform-origin: center center !important;
    animation: flotarAgua 8s ease-in-out infinite !important;
}

/* ========================================================================== */
/* MEDIA QUERIES OPTIMIZADAS - MÁS ESPACIO EN TELÉFONOS */
/* ========================================================================== */

/* TELÉFONOS PEQUEÑOS - MÁS ESPACIO ENTRE ESFERAS */
@media (max-width: 480px) {
    .juego-simon .water-lilies-board,
    #contenedor-minijuegos-global .juego-simon .water-lilies-board {
        grid-gap: 20px !important; /* MÁS ESPACIO HORIZONTAL Y VERTICAL */
        width: 280px !important;   /* Un poco más ancho para permitir más espacio */
        height: 380px !important;  /* Un poco más alto */
        max-width: 85vw !important;
        max-height: 70vh !important;
        margin-top: 40px !important;
    }
    
    .juego-simon .lily-pad,
    #contenedor-minijuegos-global .juego-simon .lily-pad {
        width: 110px !important;   /* Un poco más pequeñas para dar más espacio */
        height: 110px !important;
    }
    
    .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    .juego-simon .water-lilies-board .lily-pad:nth-child(4),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(4) {
        margin-top: 25px !important;
    }
    
    .juego-simon .lily-pad .lily-image {
        transform: scale(1.3) !important;
    }
}

/* TELÉFONOS MEDIANOS - MÁS ESPACIO ENTRE ESFERAS */
@media (min-width: 481px) and (max-width: 767px) {
    .juego-simon .water-lilies-board,
    #contenedor-minijuegos-global .juego-simon .water-lilies-board {
        grid-gap: 25px !important; /* MÁS ESPACIO HORIZONTAL Y VERTICAL */
        width: 320px !important;   /* Más ancho para permitir más espacio */
        height: 420px !important;  /* Más alto */
        max-width: 80vw !important;
        max-height: 70vh !important;
        margin-top: 40px !important;
    }
    
    .juego-simon .lily-pad,
    #contenedor-minijuegos-global .juego-simon .lily-pad {
        width: 125px !important;   /* Un poco más pequeñas para dar más espacio */
        height: 125px !important;
    }
    
    .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    .juego-simon .water-lilies-board .lily-pad:nth-child(4),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(4) {
        margin-top: 30px !important;
    }
    
    .juego-simon .lily-pad .lily-image {
        transform: scale(1.35) !important;
    }
}

/* TABLETS PEQUEÑAS (768px - 1024px) - CON DESPLAZAMIENTO */
@media (min-width: 768px) and (max-width: 1024px) {
    .juego-simon .water-lilies-board,
    #contenedor-minijuegos-global .juego-simon .water-lilies-board {
        width: 600px !important;
        height: 700px !important;
        max-width: 85vw !important;
        max-height: 75vh !important;
        grid-gap: 50px !important; /* Buen espacio ya */
        margin-top: 40px !important;
    }
    
    .juego-simon .lily-pad,
    #contenedor-minijuegos-global .juego-simon .lily-pad {
        width: 240px !important;
        height: 240px !important;
    }
    
    .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    .juego-simon .water-lilies-board .lily-pad:nth-child(4),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(4) {
        margin-top: 70px !important;
    }
    
    .juego-simon .lily-pad .lily-image {
        transform: scale(1.7) !important;
    }
}

/* TABLETS GRANDES (1025px - 1366px) - CON DESPLAZAMIENTO */
@media (min-width: 1025px) and (max-width: 1366px) {
    .juego-simon .water-lilies-board,
    #contenedor-minijuegos-global .juego-simon .water-lilies-board {
        width: 700px !important;
        height: 800px !important;
        max-width: 80vw !important;
        max-height: 70vh !important;
        grid-gap: 60px !important;
        margin-top: 40px !important;
    }
    
    .juego-simon .lily-pad,
    #contenedor-minijuegos-global .juego-simon .lily-pad {
        width: 280px !important;
        height: 280px !important;
    }
    
    .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    .juego-simon .water-lilies-board .lily-pad:nth-child(4),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(4) {
        margin-top: 80px !important;
    }
    
    .juego-simon .lily-pad .lily-image {
        transform: scale(1.8) !important;
    }
}

/* PANTALLAS MUY GRANDES (más de 1367px) - CON DESPLAZAMIENTO */
@media (min-width: 1367px) {
    .juego-simon .water-lilies-board,
    #contenedor-minijuegos-global .juego-simon .water-lilies-board {
        width: 750px !important;
        height: 850px !important;
        max-width: 70vw !important;
        max-height: 65vh !important;
        grid-gap: 65px !important;
        margin-top: 40px !important;
    }
    
    .juego-simon .lily-pad,
    #contenedor-minijuegos-global .juego-simon .lily-pad {
        width: 300px !important;
        height: 300px !important;
    }
    
    .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    .juego-simon .water-lilies-board .lily-pad:nth-child(4),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(3),
    #contenedor-minijuegos-global .juego-simon .water-lilies-board .lily-pad:nth-child(4) {
        margin-top: 90px !important;
    }
    
    .juego-simon .lily-pad .lily-image {
        transform: scale(1.9) !important;
    }
}

/* ========================================================================== */
/* RESTANTE DEL CSS (igual que antes) */
/* ========================================================================== */

/* Diferentes tiempos de animación para cada esfera - MÁS LENTOS */
.juego-simon #lily-rose,
#contenedor-minijuegos-global .juego-simon #lily-rose {
    animation: flotarAgua 8s ease-in-out infinite !important;
    animation-delay: 0s !important;
}

.juego-simon #lily-green,
#contenedor-minijuegos-global .juego-simon #lily-green {
    animation: flotarAgua 8.5s ease-in-out infinite !important;
    animation-delay: 1s !important;
}

.juego-simon #lily-blue,
#contenedor-minijuegos-global .juego-simon #lily-blue {
    animation: flotarAgua 9s ease-in-out infinite !important;
    animation-delay: 2s !important;
}

.juego-simon #lily-yellow,
#contenedor-minijuegos-global .juego-simon #lily-yellow {
    animation: flotarAgua 8.8s ease-in-out infinite !important;
    animation-delay: 3s !important;
}

/* Brillo constante en las esferas */
.juego-simon .lily-pad::before {
    content: '' !important;
    position: absolute !important;
    top: 15% !important;
    left: 15% !important;
    width: 25% !important;
    height: 25% !important;
    border-radius: '50%' !important;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.9) 0%, transparent 70%) !important;
    z-index: 3 !important;
    pointer-events: none !important;
}

/* CORRECCIÓN: EFECTO DE ACTIVE - SOLO BRILLO, SIN ACHICAR */
.juego-simon .lily-pad.active,
#contenedor-minijuegos-global .juego-simon .lily-pad.active {
    filter: brightness(1.4) saturate(1.2) !important;
    box-shadow: 
        0 0 40px rgba(255, 255, 255, 0.9),
        0 8px 25px rgba(0, 0, 0, 0.4),
        inset 0 4px 15px rgba(255, 255, 255, 0.8) !important;
    animation-play-state: paused !important;
}

/* ANIMACIÓN DE FLOTACIÓN EN AGUA - MÁS LENTA Y SUAVE */
@keyframes flotarAgua {
    0% {
        transform: translateY(0px) rotate(0deg) scale(1);
    }
    25% {
        transform: translateY(-12px) rotate(1.5deg) scale(1.015);
    }
    50% {
        transform: translateY(-20px) rotate(0deg) scale(1.02);
    }
    75% {
        transform: translateY(-8px) rotate(-1.5deg) scale(1.01);
    }
    100% {
        transform: translateY(0px) rotate(0deg) scale(1);
    }
}

/* COLORES CON DEGRADADO */
.juego-simon #lily-rose,
#contenedor-minijuegos-global .juego-simon #lily-rose {
    background: linear-gradient(135deg, #ff6b9d, #ff8fab) !important;
}

.juego-simon #lily-green,
#contenedor-minijuegos-global .juego-simon #lily-green {
    background: linear-gradient(135deg, #7bc043, #8dc26f) !important;
}

.juego-simon #lily-blue,
#contenedor-minijuegos-global .juego-simon #lily-blue {
    background: linear-gradient(135deg, #4a90e2, #5faee3) !important;
}

.juego-simon #lily-yellow,
#contenedor-minijuegos-global .juego-simon #lily-yellow {
    background: linear-gradient(135deg, #f9a825, #fbc02d) !important;
}

/* IMÁGENES EN ESFERAS - CON FLOTACIÓN LENTA INDEPENDIENTE */
.juego-simon .lily-pad .lily-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    z-index: 4 !important;
    pointer-events: none !important;
    transition: all 0.3s ease !important;
    transform: scale(1.4) !important;
    transform-origin: center center !important;
    
    /* Animación de flotación INDEPENDIENTE MÁS LENTA */
    animation: flotarImagen 7s ease-in-out infinite !important;
}

/* Diferentes tiempos para las imágenes - MÁS LENTOS */
.juego-simon #lily-rose .lily-image {
    animation: flotarImagen 7s ease-in-out infinite !important;
    animation-delay: 0.5s !important;
}

.juego-simon #lily-green .lily-image {
    animation: flotarImagen 7.5s ease-in-out infinite !important;
    animation-delay: 1.5s !important;
}

.juego-simon #lily-blue .lily-image {
    animation: flotarImagen 7.8s ease-in-out infinite !important;
    animation-delay: 2.5s !important;
}

.juego-simon #lily-yellow .lily-image {
    animation: flotarImagen 7.2s ease-in-out infinite !important;
    animation-delay: 3.5s !important;
}

/* Animación independiente para las imágenes - MÁS LENTA */
@keyframes flotarImagen {
    0% {
        transform: scale(1.4) translateY(0px) rotate(0deg);
    }
    33% {
        transform: scale(1.4) translateY(-6px) rotate(0.8deg);
    }
    66% {
        transform: scale(1.4) translateY(-4px) rotate(-0.8deg);
    }
    100% {
        transform: scale(1.4) translateY(0px) rotate(0deg);
    }
}

/* CORRECCIÓN: EFECTO DE ACTIVE EN LA IMAGEN - SOLO BRILLO, SIN CAMBIAR TAMAÑO */
.juego-simon .lily-pad.active .lily-image {
    filter: brightness(1.3) saturate(1.1) !important;
    animation-play-state: paused !important;
}

/* Esferas con imagen - Quitar fondo de color */
.juego-simon .lily-pad.has-image,
#contenedor-minijuegos-global .juego-simon .lily-pad.has-image {
    background: transparent !important;
    box-shadow: none !important;
}

/* Esferas con imagen - Quitar pseudo-elementos */
.juego-simon .lily-pad.has-image::before,
.juego-simon .lily-pad.has-image::after,
.juego-simon .lily-pad.has-image .leaf-texture,
#contenedor-minijuegos-global .juego-simon .lily-pad.has-image::before,
#contenedor-minijuegos-global .juego-simon .lily-pad.has-image::after,
#contenedor-minijuegos-global .juego-simon .lily-pad.has-image .leaf-texture {
    display: none !important;
}

/* TABLERO DE PUNTUACIÓN PARA SIMON - MISMA POSICIÓN QUE LINTERNA */
.contador-simon {
    position: fixed !important;
    bottom: 90px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    background: rgba(190, 150, 120, 0.6) !important;
    color: white;
    padding: 8px 15px !important;
    border-radius: 14px;
    font-size: 16px;
    z-index: 2147483646 !important;
    font-family: 'Fredoka', sans-serif;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    pointer-events: auto;
    backdrop-filter: blur(5px) !important;
    width: 90%;
    max-width: 500px;
    box-sizing: border-box;
    text-align: center;
    display: none;
    justify-content: space-around;
    align-items: center;
    flex-wrap: nowrap;
}

.contador-simon.mostrar {
    display: flex !important;
}

.contador-simon div {
    margin: 0 !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
    font-weight: bold;
    white-space: nowrap;
    font-size: 14px;
}

.ronda-actual { 
    color: #4fc3f7;
}

.puntaje-actual { 
    color: #69f0ae;
}

/* ANIMACIÓN DE CONFETI MEJORADA CON 650 PARTÍCULAS */
@keyframes caerConfeti {
    0% {
        transform: translateY(0) rotate(0deg) translateX(0);
        opacity: 1;
    }
    50% {
        transform: translateY(45vh) rotate(180deg) translateX(calc(var(--mov-x, 0) * 100px));
        opacity: 0.8;
    }
    100% {
        transform: translateY(100vh) rotate(360deg) translateX(calc(var(--mov-x, 0) * 200px));
        opacity: 0;
    }
}

/* ASEGURAR QUE EL JUEGO ESTÉ POR ENCIMA DE TODO */
#contenedor-minijuegos-global .juego-simon {
    z-index: 2147483645 !important;
}

#contenedor-minijuegos-global .juego-simon * {
    pointer-events: auto !important;
}

/* CORRECCIÓN FINAL: GARANTIZAR QUE NINGUNA ESFERA SE ACHIQUE */
.juego-simon .lily-pad.active,
#contenedor-minijuegos-global .juego-simon .lily-pad.active,
.juego-simon #lily-rose.active,
.juego-simon #lily-green.active,
.juego-simon #lily-blue.active,
.juego-simon #lily-yellow.active,
#contenedor-minijuegos-global .juego-simon #lily-rose.active,
#contenedor-minijuegos-global .juego-simon #lily-green.active,
#contenedor-minijuegos-global .juego-simon #lily-blue.active,
#contenedor-minijuegos-global .juego-simon #lily-yellow.active {
    transform: none !important;
}

/* GARANTIZAR que las imágenes mantengan su tamaño durante active */
.juego-simon .lily-pad.active .lily-image,
.juego-simon #lily-rose.active .lily-image,
.juego-simon #lily-green.active .lily-image,
.juego-simon #lily-blue.active .lily-image,
.juego-simon #lily-yellow.active .lily-image,
#contenedor-minijuegos-global .juego-simon .lily-pad.active .lily-image,
#contenedor-minijuegos-global .juego-simon #lily-rose.active .lily-image,
#contenedor-minijuegos-global .juego-simon #lily-green.active .lily-image,
#contenedor-minijuegos-global .juego-simon #lily-blue.active .lily-image,
#contenedor-minijuegos-global .juego-simon #lily-yellow.active .lily-image {
    transform: scale(1.4) !important;
}

/* FORZAR POSICIÓN CON SELECTORES ESPECÍFICOS - IGUAL QUE LINTERNA */
html body .contador-simon {
    bottom: 80px !important;
}