/* ==========================================================================
   ESTILOS GENERALES Y CONFIGURACIÓN (THEME: CYBER-DARK / NEON)
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #0d0614; /* Fondo oscuro místico */
    color: #ffffff;
    font-family: 'Courier New', Courier, monospace; /* Fuente retro estilo terminal/oráculo */
    display: flex;
    flex-direction: column; /* ◄ ESTO OBLIGA A QUE TODO SE APLE DE ARRIBA HACIA ABAJO */
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    gap: 20px; /* ◄ Agrega un espacio ideal de separación entre el juego y tu footer */
}

/* ==========================================================================
   CONTENEDOR DEL JUEGO Y ESTRUCTURA DE PANELES
   ========================================================================== */
.game-container {
    background-color: #170b24;
    border: 3px solid #8a2be2;
    border-radius: 16px;
    padding: 30px;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 0 25px rgba(138, 43, 226, 0.4);
    text-align: center;
    position: relative;
    transition: all 0.3s ease;
}

h1 {
    font-size: 24px;
    color: #00ffff;
    text-shadow: 0 0 10px rgba(0, 255, 255, 0.6);
    margin-bottom: 10px;
}

.subtitle {
    font-size: 13px;
    color: #d1b3ff;
    margin-bottom: 15px;
}

hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, #8a2be2, transparent);
    margin: 15px 0 25px 0;
}

/* Clases útiles */
.hidden {
    display: none !important;
}

/* ==========================================================================
   INTERFAZ PRINCIPAL DE JUEGO (TOP BAR & HUD)
   ========================================================================== */
.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.top-bar h1 {
    font-size: 18px;
    margin-bottom: 0;
}

/* Tienda y Monedas */
.shop-container {
    display: flex;
    gap: 8px;
}

.coins-badge {
    background-color: #ffd700;
    color: #110022;
    padding: 5px 10px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 12px;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    display: flex;
    align-items: center;
}

/* ==========================================================================
   EFECTO DE LA BOLA DE CRISTAL (ESTADOS DINÁMICOS)
   ========================================================================== */
.crystal-ball-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.crystal-ball {
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, #4b0082, #1a0033);
    border: 4px solid #8a2be2;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    box-shadow: 0 0 25px rgba(138, 43, 226, 0.6);
    transition: all 0.5s ease;
}

/* Animación de pulso místico en reposo */
@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 20px rgba(138, 43, 226, 0.6); }
    50% { transform: scale(1.03); box-shadow: 0 0 35px rgba(138, 43, 226, 0.9); }
    100% { transform: scale(1); box-shadow: 0 0 20px rgba(138, 43, 226, 0.6); }
}

.crystal-ball {
    animation: pulse 3s infinite ease-in-out;
}

/* Estados dinámicos por acierto o error */
.crystal-ball.correct {
    border-color: #00ffcc;
    box-shadow: 0 0 35px rgba(0, 255, 204, 0.8);
    background: radial-gradient(circle, #004d3d, #001f18);
    transform: scale(1.08);
}

.crystal-ball.incorrect {
    border-color: #ff0055;
    box-shadow: 0 0 35px rgba(255, 0, 85, 0.8);
    background: radial-gradient(circle, #4d001a, #1a0009);
    transform: scale(0.95);
}

/* ==========================================================================
   MÓDULO DE ESCENARIOS (CLIENT CARDS)
   ========================================================================== */
.scenario-box {
    background-color: #201133;
    border-left: 4px solid #00ffff;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 25px;
    text-align: left;
}

.scenario-box h3 {
    color: #ff00ff;
    font-size: 16px;
    margin-bottom: 8px;
}

.scenario-box p {
    font-size: 13px;
    line-height: 1.5;
    color: #ece0ff;
}

/* Pistas (Hints) */
.hint-text {
    margin-top: 10px;
    background-color: #2d134d;
    padding: 8px;
    border-radius: 4px;
    border-left: 3px solid #ffd700;
    color: #ffd700 !important;
    font-size: 12px !important;
}

/* ==========================================================================
   CONTENEDOR DE BOTONES Y OPCIONES DE RESPUESTA
   ========================================================================== */
.options-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.option-btn {
    background-color: #1a0f30;
    border: 2px solid #8a2be2;
    color: #ffffff;
    padding: 15px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    display: flex;
    align-items: center;
}

.option-btn:hover:not(:disabled) {
    background-color: #2d1654;
    border-color: #00ffff;
    box-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
}

/* Letras de teclas rápidas [A, B, C] */
.key-badge {
    background-color: #8a2be2;
    color: #ffffff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 10px;
    font-weight: bold;
}

/* Estilos de selección (Acierto o Error) */
.correct-choice {
    background-color: rgba(0, 255, 204, 0.1) !important;
    border-color: #00ffcc !important;
    color: #00ffcc !important;
    box-shadow: 0 0 12px rgba(0, 255, 204, 0.4);
}

.incorrect-choice {
    background-color: rgba(255, 0, 85, 0.1) !important;
    border-color: #ff0055 !important;
    color: #ff0055 !important;
    box-shadow: 0 0 12px rgba(255, 0, 85, 0.4);
}

/* ==========================================================================
   UTILIDADES, TIENDA Y PANEL DE PUNTUACIONES (HUD)
   ========================================================================== */
.utility-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 20px;
}

.utility-btn {
    flex: 1;
    background-color: #170b24;
    border: 1px dashed #8a2be2;
    color: #d1b3ff;
    padding: 8px 4px;
    border-radius: 6px;
    font-size: 10px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s ease;
}

.utility-btn:hover:not(:disabled) {
    background-color: #31184d;
    color: #ffffff;
    border-style: solid;
}

.utility-btn:disabled {
    border-color: #333;
    color: #555;
    cursor: not-allowed;
    opacity: 0.5;
}

/* Marcador de puntuaciones y vidas */
.score-board {
    font-size: 13px;
    color: #00ffff;
    margin: 15px 0;
}

/* Mensajes dinámicos de Feedback de respuesta */
#feedback-message {
    height: 20px;
    font-size: 13px;
    font-weight: bold;
    margin-bottom: 20px;
}

/* ==========================================================================
   DISEÑO EXCLUSIVO: BOTONES DE DIFICULTAD NEÓN Y START GAME
   ========================================================================== */
.difficulty-container {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 25px 0;
}

.diff-btn {
    flex: 1;
    background-color: #120924; /* Fondo místico integrado */
    color: #a295c9;
    padding: 12px 8px;
    font-size: 12px;
    font-family: inherit;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

/* Bordes y hovers de neón dinámicos para cada botón */
.diff-btn:nth-child(1) {
    border: 2px solid rgba(0, 255, 204, 0.2);
}
.diff-btn:nth-child(1):hover {
    border-color: #00ffcc;
    color: #00ffcc;
    box-shadow: 0 0 15px rgba(0, 255, 204, 0.4);
    background-color: rgba(0, 255, 204, 0.05);
}

.diff-btn:nth-child(2) {
    border: 2px solid rgba(255, 215, 0, 0.2);
}
.diff-btn:nth-child(2):hover {
    border-color: #ffd700;
    color: #ffd700;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
    background-color: rgba(255, 215, 0, 0.05);
}

.diff-btn:nth-child(3) {
    border: 2px solid rgba(255, 0, 85, 0.2);
}
.diff-btn:nth-child(3):hover {
    border-color: #ff0055;
    color: #ff0055;
    box-shadow: 0 0 15px rgba(255, 0, 85, 0.4);
    background-color: rgba(255, 0, 85, 0.05);
}

/* --- ESTADOS DE SELECCIÓN ACTIVA (MÁXIMO BRILLO DE NEÓN) --- */
.diff-btn.selected-easy {
    background-color: rgba(0, 255, 204, 0.15);
    border: 2px solid #00ffcc !important;
    color: #00ffcc !important;
    box-shadow: 0 0 20px rgba(0, 255, 204, 0.7) !important;
    transform: translateY(-2px);
}

.diff-btn.selected-medium {
    background-color: rgba(255, 215, 0, 0.15);
    border: 2px solid #ffd700 !important;
    color: #ffd700 !important;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.7) !important;
    transform: translateY(-2px);
}

.diff-btn.selected-hard {
    background-color: rgba(255, 0, 85, 0.15);
    border: 2px solid #ff0055 !important;
    color: #ff0055 !important;
    box-shadow: 0 0 20px rgba(255, 0, 85, 0.7) !important;
    transform: translateY(-2px);
}

/* ==========================================================================
   BOTONES DE FLUJO PRINCIPAL (START, RESTART, NEXT)
   ========================================================================== */
.action-btn {
    background-color: #00ffff;
    color: #110022;
    border: none;
    padding: 15px 30px;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 255, 255, 0.4);
    transition: all 0.3s ease;
}

.action-btn:hover:not(:disabled) {
    background-color: #ffffff;
    box-shadow: 0 0 25px rgba(0, 255, 255, 0.8);
    transform: scale(1.05);
}

/* Botón Start Game deshabilitado (Pre-selección) */
.action-btn.disabled-start {
    background-color: #211a36 !important;
    color: #5d537a !important;
    border: 2px solid #3c325c !important;
    cursor: not-allowed !important;
    box-shadow: none !important;
    opacity: 0.6;
}

/* Botón oculto por defecto para flujo (Siguiente, Reiniciar) */
.hidden-btn {
    display: none;
    width: 100%;
    background-color: #ff00ff;
    color: #110022;
    border: none;
    padding: 15px;
    font-family: inherit;
    font-size: 14px;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.5);
    transition: all 0.3s ease;
    margin-top: 10px;
}

.hidden-btn:hover {
    background-color: #ffffff;
    box-shadow: 0 0 25px rgba(255, 0, 255, 0.8);
    transform: translateY(-2px);
}

/* ==========================================================================
   SISTEMA MODAL DE AYUDA GRAMATICAL (LIGHTBOX OVERLAY)
   ========================================================================== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(13, 6, 20, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background-color: #1d0f30;
    border: 3px solid #00ffff;
    border-radius: 12px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 0 30px rgba(0, 255, 255, 0.5);
}

.modal-content h3 {
    color: #00ffff;
    margin-bottom: 15px;
    font-size: 18px;
}

.modal-content p {
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 10px;
    color: #ece0ff;
}

/* ==========================================================================
   DISEÑO DEL FOOTER (CRÉDITOS Y REVISIÓN)
   ========================================================================== */
.game-footer {
    margin-top: 25px;
    padding: 15px;
    background-color: #120924;
    border: 1px dashed #8a2be2;
    border-radius: 10px;
    max-width: 550px;
    width: 100%;
    font-size: 11px;
    line-height: 1.6;
    color: #a295c9;
    box-shadow: 0 0 15px rgba(138, 43, 226, 0.15);
}

.game-footer strong {
    color: #00ffff; /* Destaca los nombres con el cian brillante */
    text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
}

.game-footer p {
    margin-bottom: 5px;
}

.game-footer p:last-child {
    margin-bottom: 0;
}

/* Estilo destacado para la firma del Ingeniero */
.game-footer .reviewer {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(138, 43, 226, 0.3);
    color: #ffd700; /* Color dorado para dar autoridad */
    font-weight: bold;
}

/* ==========================================================================
   ADAPTACIÓN PARA DISPOSITIVOS MÓVILES (RESPONSIVE DESIGN)
   ========================================================================== */
@media (max-width: 480px) {
    body {
        padding: 10px;
        gap: 15px;
    }

    /* Reducimos ligeramente el espacio interno de la caja de juego */
    .game-container {
        padding: 20px 15px;
        border-width: 2px;
    }

    /* Ajustamos el tamaño de los títulos principales */
    h1 {
        font-size: 20px;
    }

    .top-bar h1 {
        font-size: 16px;
    }

    /* Hacemos la bola de cristal un poco más pequeña para que no consuma pantalla */
    .crystal-ball {
        width: 100px;
        height: 100px;
        font-size: 40px;
    }

    /* Los botones de dificultad se apilarán verticalmente para que quepa bien el texto */
    .difficulty-container {
        flex-direction: column;
        gap: 8px;
        margin: 15px 0;
    }

    .diff-btn {
        width: 100%;
        padding: 12px;
        font-size: 13px;
    }

    /* Distribución vertical para los botones de ayuda de la tienda */
    .utility-row {
        flex-direction: column;
        gap: 8px;
    }

    .utility-btn {
        width: 100%;
        padding: 10px;
        font-size: 11px;
    }

    /* Las opciones de respuesta tendrán un texto ligeramente más legible en pantallas chicas */
    .option-btn {
        padding: 12px;
        font-size: 12px;
    }

    /* Ajustes del Footer para pantallas táctiles */
    .game-footer {
        padding: 12px;
        font-size: 10px;
    }
}