/* ========================================================================== */
/* ESTILOS PARA JUEGO DE COMIDA - CON ANIMACIÓN DE ERROR ORIGINAL Y TABLERO IGUAL A LINTERNA */
/* ========================================================================== */

.juego-comida {
    position: absolute;
    bottom: 35%;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 25px;
    padding: 0 20px;
    z-index: 2147483646;
    transform: translateY(0);
    transition: transform 0.3s ease;
}

/* CONTENEDOR PRINCIPAL SIN PADDING INTERIOR */
.comida-arrastrable {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.5);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: grab;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    z-index: 2147483646;
    transform-origin: center;
    touch-action: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    overflow: hidden;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* EMOJI CENTRADO PERFECTAMENTE - SOLUCIÓN DEFINITIVA */
.emoji-comida {
    font-size: 60px !important;
    line-height: 1 !important;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8) !important;
    color: white !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
    width: auto !important;
    height: auto !important;
    display: block !important;
    text-align: center !important;
}

/* IMÁGENES SUPERPUESTAS SIN ESPACIO */
.img-comida {
    width: 70px !important;
    height: 70px !important;
    object-fit: contain !important;
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    z-index: 2 !important;
    pointer-events: none !important;
    margin: 0 !important;
}

/* OCULTAR EMOJI CUANDO HAY IMAGEN */
.comida-arrastrable:has(.img-comida) .emoji-comida {
    opacity: 0 !important;
    visibility: hidden !important;
}

.comida-arrastrable:hover {
    transform: scale(1.15) translateY(-5px);
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}

.comida-arrastrable:active {
    transform: scale(0.95);
}

/* Efecto de brillo al seleccionar */
.comida-arrastrable.seleccionada {
    animation: brilloSeleccion 0.6s ease-in-out;
    transform: scale(1.25);
    box-shadow: 
        0 0 30px rgba(255, 255, 255, 0.8),
        0 0 60px rgba(255, 255, 255, 0.5),
        inset 0 0 20px rgba(255, 255, 255, 0.3);
    border-color: #fff;
    background: rgba(255, 255, 255, 0.3);
}

@keyframes brilloSeleccion {
    0% {
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.4),
            0 0 0 rgba(255, 255, 255, 0);
    }
    50% {
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.4),
            0 0 40px rgba(255, 255, 255, 0.8),
            inset 0 0 20px rgba(255, 255, 255, 0.3);
    }
    100% {
        box-shadow: 
            0 8px 25px rgba(0, 0, 0, 0.4),
            0 0 0 rgba(255, 255, 255, 0);
    }
}

.comida-arrastrable.arrastrando {
    opacity: 0.9;
    transform: scale(1.4) rotate(8deg);
    cursor: grabbing;
    z-index: 2147483647;
    box-shadow: 
        0 15px 35px rgba(0, 0, 0, 0.5),
        0 0 50px rgba(255, 255, 255, 0.6);
    border-color: #fff;
    background: rgba(255, 255, 255, 0.35);
}


/* Animación para comida correcta */
@keyframes comidaCorrecta {
    0% { 
        transform: scale(1); 
        opacity: 1; 
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4);
    }
    50% { 
        transform: scale(1.8); 
        opacity: 0.8;
        box-shadow: 
            0 0 60px rgba(76, 175, 80, 1),
            0 0 100px rgba(76, 175, 80, 0.6);
    }
    100% { 
        transform: scale(0); 
        opacity: 0; 
    }
}

.comida-arrastrable.correcta {
    animation: comidaCorrecta 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    border-color: #4CAF50;
    background: radial-gradient(circle, rgba(76, 175, 80, 0.3), transparent);
}

/* ANIMACIÓN ORIGINAL PARA COMIDA INCORRECTA - CON MOVIMIENTO */
@keyframes comidaIncorrecta {
    0%, 100% { transform: translateX(0) rotate(0deg); }
    10% { transform: translateX(-20px) rotate(-5deg); }
    20% { transform: translateX(20px) rotate(5deg); }
    30% { transform: translateX(-15px) rotate(-3deg); }
    40% { transform: translateX(15px) rotate(3deg); }
    50% { transform: translateX(-10px) rotate(-2deg); }
    60% { transform: translateX(10px) rotate(2deg); }
    70% { transform: translateX(-5px) rotate(-1deg); }
    80% { transform: translateX(5px) rotate(1deg); }
    90% { transform: translateX(-2px) rotate(-0.5deg); }
}

.comida-arrastrable.incorrecta {
    animation: comidaIncorrecta 0.8s ease-in-out;
    background: radial-gradient(circle, rgba(244, 67, 54, 0.4), transparent);
    border-color: #f44336;
    box-shadow: 0 0 30px rgba(244, 67, 54, 0.6);
}

/* Efecto de partículas para comida correcta */
@keyframes particulasComida {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--x), var(--y)) scale(0);
        opacity: 0;
    }
}

.particula-comida {
    position: absolute;
    width: 10px;
    height: 10px;
    background: radial-gradient(circle, #4CAF50, transparent);
    border-radius: 50%;
    pointer-events: none;
    animation: particulasComida 1s ease-out forwards;
}

/* ========================================================================== */
/* TABLERO DE PUNTUACIÓN PARA EL JUEGO DE COMIDA - POSICIÓN CONSISTENTE */
/* ========================================================================== */

.contador-comida {
    position: fixed !important;
    bottom: 90px !important; /* 70px arriba de la barra de botones - MISMA POSICIÓN EN TODOS LOS DISPOSITIVOS */
    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;
}

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

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

.alimentos-entregados { 
    color: #69f0ae;
}

.alimentos-restantes { 
    color: #ff9800;
}

/* Ajustes para pantallas más pequeñas */
@media (max-width: 768px) {
    .comida-arrastrable {
        width: 90px;
        height: 90px;
        padding: 0 !important;
    }
    
    .emoji-comida {
        font-size: 45px !important;
    }
    
    .img-comida {
        width: 50px !important;
        height: 50px !important;
    }
    
    .juego-comida {
        bottom: 30%;
        gap: 20px;
    }
    
    .contador-comida {
        padding: 8px 12px !important;
        font-size: 16px;
        max-width: 400px;
        /* NO modificar bottom - posición consistente */
    }
    
    .contador-comida div {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .comida-arrastrable {
        width: 75px;
        height: 75px;
        padding: 0 !important;
    }
    
    .emoji-comida {
        font-size: 38px !important;
    }
    
    .img-comida {
        width: 40px !important;
        height: 40px !important;
    }
    
    .juego-comida {
        bottom: 25%;
        gap: 15px;
    }
    
    .contador-comida {
        padding: 6px 10px !important;
        font-size: 16px;
        max-width: 300px;
        /* NO modificar bottom - posición consistente */
    }
    
    .contador-comida div {
        font-size: 16px;
    }
}

/* ========================================================================== */
/* FORZAR POSICIÓN CON SELECTORES ESPECÍFICOS */
/* ========================================================================== */

html body .contador-comida {
    bottom: 80px !important; /* POSICIÓN FIJA EN TODOS LOS DISPOSITIVOS */
}