/* Variables y reseteo básico */
:root {
    --color-primario: #ff4757;
    --color-texto: #ffffff;
    --fuente-principal: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--fuente-principal);
}

body {
    color: var(--color-texto);
    overflow: hidden; /* Evita scroll durante las animaciones */
}

/* Efecto de pantalla (verde/rojo) */
#efecto-pantalla {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 100;
    opacity: 0;
    transition: opacity 0.5s ease;
    box-shadow: inset 0 0 80px rgba(0,0,0,0);
}
.brillo-verde { opacity: 1 !important; box-shadow: inset 0 0 100px 20px rgba(46, 204, 113, 0.8) !important; }
.brillo-rojo { opacity: 1 !important; box-shadow: inset 0 0 100px 20px rgba(231, 76, 60, 0.8) !important; }

/* Fondo borroso para la pantalla inicial */
#fondo-juego {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url('../iconos/FELRC.png');
    background-size: cover;
    background-position: center;
    z-index: -1;
    transition: filter 1s ease;
}
.fondo-borroso {
    filter: blur(15px);
}

/* Pantallas y contenedores generales */
.pantalla-completa {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10;
    background-color: rgba(0, 0, 0, 0.6);
    transition: opacity 0.5s ease;
}

.oculto {
    display: none !important;
}

/* Animaciones Pantalla Inicial */
#titulo-imagen {
    max-width: 50%;
    margin-bottom: 0px;
    transition: transform 1s ease, opacity 1s ease;
}
.mover-arriba { transform: translateY(-100px); opacity: 0; }

#btn-iniciar {
    padding: 15px 40px;
    font-size: 24px;
    background-color: var(--color-primario);
    color: white;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: transform 1s ease, opacity 1s ease;
}
.mover-abajo { transform: translateY(100px); opacity: 0; }

.latido {
    animation: pulse 1.5s infinite;
}
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

/* Interfaz del juego */
#interfaz-juego {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 20px;
}

.barra-superior {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
}

#btn-volver, #btn-instrucciones, .modal button, #pantalla-fin button {
    padding: 10px 20px;
    background: rgba(255,255,255,0.2);
    color: rgb(36, 36, 36);
    text-decoration: none;
    border: 1px solid rgb(0, 0, 0);
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
}
#btn-volver:hover, #btn-instrucciones:hover { background: rgba(247, 3, 3, 0.4); }

#contenedor-corazones {
    font-size: 24px;
    letter-spacing: 5px;
}

#temporizador {
    text-align: center;
    font-size: 20px;
    margin-top: 10px;
    font-weight: bold;
    color: #f1c40f;
}

#contenedor-pregunta {
    text-align: center;
    margin: 30px 0;
    min-height: 80px;
}
#texto-pregunta {
    font-size: 28px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    background: rgba(0,0,0,0.5);
    padding: 15px;
    border-radius: 10px;
    display: inline-block;
    max-width: 90%;
}

/* Área de las puertas */
#contenedor-puertas {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-grow: 1;
    align-items: flex-end;
    padding-bottom: 50px;
    perspective: 1000px; /* Da profundidad a la animación de avanzar */
}

.opcion-puerta {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    transition: transform 0.3s ease;
}
.opcion-puerta:hover {
    transform: scale(1.05);
}

.texto-opcion {
    background-color: rgba(255, 255, 255, 0.9);
    color: #333;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
    max-width: 200px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.imagen-puerta {
    width: 500px;
    height: auto;
    transition: opacity 0.3s ease;
}

/* Animaciones de transición de puertas */
.avanzar-animacion {
    animation: avanzarFrente 1s forwards ease-in-out;
}
@keyframes avanzarFrente {
    0% { transform: scale(1) translateZ(0); opacity: 1; }
    100% { transform: scale(2) translateZ(300px); opacity: 0; }
}

.aparecer-animacion {
    animation: aparecerFrente 0.5s forwards ease-out;
}
@keyframes aparecerFrente {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Modales */
.modal {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.8);
    display: flex; justify-content: center; align-items: center;
    z-index: 50;
}
.modal-contenido {
    background: white; color: #333;
    padding: 30px; border-radius: 15px; max-width: 500px;
    text-align: center;
}
.modal-contenido h3 { margin-bottom: 15px; }
.modal-contenido ul { text-align: left; margin: 15px 0; padding-left: 20px; }
.modal-contenido button {
    background-color: var(--color-primario); border: none; color: white;
    margin-top: 15px; width: 100%;
}

/* Responsive */
@media (max-width: 768px) {
    #contenedor-puertas { gap: 20px; flex-direction: column; align-items: center; justify-content: flex-start; }
    .imagen-puerta { width: 180px; }
    #texto-pregunta { font-size: 20px; }
}

/* --- Ajustes Responsive para Celulares --- */
@media (max-width: 768px) {
    /* Hacer el título de inicio más grande y visible en móvil */
    #titulo-imagen {
        max-width: 150%;
    }

    /* Ajustar la barra superior para que los botones y corazones quepan */
    .barra-superior {
        padding: 5px;
    }

    #btn-volver, #btn-instrucciones {
        padding: 6px 10px;
        font-size: 12px;
    }

    #contenedor-corazones {
        font-size: 16px; /* Corazones más pequeños */
        letter-spacing: 2px;
    }

    #temporizador {
        font-size: 16px;
        margin-top: 5px;
    }

    /* Reducir márgenes y tamaño de la pregunta para ahorrar espacio vertical */
    #contenedor-pregunta {
        margin: 10px 0; /* Menos margen vertical */
        min-height: 50px;
    }

    #texto-pregunta { 
        font-size: 15px; /* Texto más pequeño de la pregunta */
        padding: 8px;
    }

    /* Mantener las puertas lado a lado aprovechando el ancho máximo */
    #contenedor-puertas { 
        gap: 5px; /* Casi nada de espacio entre las puertas */
        flex-direction: row; 
        padding-bottom: 10px; 
        width: 100%;
        padding-left: 5px;
        padding-right: 5px;
        align-items: flex-end;
    }

    .opcion-puerta {
        width: 50%; /* Cada puerta toma exactamente la mitad de la pantalla */
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        align-items: center;
    }

    .texto-opcion {
        font-size: 12px;
        padding: 5px;
        margin-bottom: 5px;
        width: 95%; /* Se ajusta al ancho de la puerta */
    }

    .imagen-puerta { 
        width: 100%; /* La imagen se estira para llenar todo su lado */
        max-width: 220px; /* Límite alto para que se vean enormes en móvil */
        height: auto;
    }

    /* Ajustar el modal de instrucciones para que no se salga de la pantalla */
    .modal-contenido {
        width: 95%; /* Más ancho en móvil */
        padding: 15px;
        font-size: 13px;
    }
}