/* --- CONFIGURACIÓN GENERAL --- */
:root {
    --color-principal: #007BFF;
    --color-correcto: #2de854;
    --color-error: #dc3545;
    --color-texto: #f0f0f0;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--color-texto);
    background: linear-gradient(-45deg, #23a6d5, #3f51b5, #673ab7, #9c27b0);
    background-size: 400% 400%;
    animation: gradientBG 10s ease infinite;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

#spotlight-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
    z-index: 50;
}

#spotlight-overlay.active {
    opacity: 1;
}

.app-container {
    position: relative;
    z-index: 60;
    width: 100%;
    max-width: 1050px;
}

#main-header {
    text-align: center;
    padding: 20px 0;
    min-height: 70px;
}

#main-header h1 {
    margin: 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#main-footer {
    text-align: center;
    padding: 20px;
    font-size: 0.9em;
}

#question-counter {
    position: fixed;
    top: 25px;
    left: 25px;
    font-size: 1.1em;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    background-color: rgba(0,0,0,0.3);
    padding: 8px 15px;
    border-radius: 8px;
    z-index: 1000;
}

#tts-button {
    position: fixed;
    top: 25px;
    right: 25px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.quiz-card-container {
    perspective: 1500px;
}

#quiz-card {
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    min-height: 600px;
    width: 100%;
}

#quiz-card.is-flipped {
    transform: rotateY(180deg);
}

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    border-radius: 20px;
    background: linear-gradient(135deg, #0d47a1, #1976d2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    overflow: hidden;
}

.card-face--back {
    transform: rotateY(180deg);
}

#question-text {
    font-size: 1.5em;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
}

#question-image-container {
    margin-bottom: 20px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 15px;
    padding: 10px;
 /* Se cambia a 'auto' para que crezca con la imagen */
    width: auto; 
    max-width: 90%; /* Límite para que no ocupe toda la tarjeta */
    height: auto; /* Se cambia a 'auto' para que crezca con la imagen */
    /* 250px de la imagen + 10px padding top + 10px padding bottom */
    max-height: 270px; 
    display: flex;
    justify-content: center;
    align-items: center;
}

#question-image {
      /* 'auto' para mantener la proporción de la imagen */
    width: auto;
    height: 200px;  
    /* La imagen no superará el 100% del contenedor */
    max-width: 100%;
    /* Límite de altura solicitado */
    border-radius: 10px;
    display: block;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#answers-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    max-width: 800px;
    counter-reset: answer-counter;
}

.answer-btn {
    padding: 15px;
    font-size: 1em;
    border: 1px solid rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.15);
    color: var(--color-texto);
    border-radius: 10px;
    cursor: default;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.answer-btn::before {
    counter-increment: answer-counter;
    content: counter(answer-counter, upper-alpha);
    display: flex;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background-color: rgba(0, 0, 0, 0.2);
    color: white;
    font-weight: 600;
    margin-right: 15px;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.answer-c-centered {
    grid-column: 1 / -1;
    justify-self: center;
    width: 50%;
}

.answer-btn.correct {
    background: var(--color-correcto);
    border-color: var(--color-correcto);
    transform: scale(1.05);
    box-shadow: 0 0 20px var(--color-correcto);
    color: #0d47a1;
    font-weight: 600;
}

.answer-btn.correct::before {
    background-color: rgba(255, 255, 255, 0.3);
    color: #0d47a1;
}

.answer-btn.revealed {
    opacity: 0.6;
}

#timer-container {
    width: 100%;
    height: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
    position: absolute;
    top: 20px;
    left: 0;
    padding: 0 20px;
}

#timer-bar {
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, #4caf50, #ffeb3b, #f44336);
    border-radius: 5px;
    transform-origin: left;
    animation: countdown 8s linear forwards;
}

@keyframes countdown {
    from { transform: scaleX(1); }
    to { transform: scaleX(0); }
}

#explanation-text {
    font-size: 2.2em;
    text-align: center;
}

.scrolling-text-container {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
}

.scrolling-text {
    display: inline-block;
    padding-left: 100%;
    animation: scroll-left 120s linear infinite;
}

@keyframes scroll-left {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

#tts-button.active {
    background-color: var(--color-principal);
    box-shadow: 0 0 15px var(--color-principal);
}

#tts-button:hover {
    background: rgba(255, 255, 255, 0.4);
    transform: scale(1.1);
}

.hidden {
    display: none !important;
}

#start-button {
    font-size: 3em;
    font-weight: 600;
    padding: 20px 60px;
    border-radius: 20px;
    border: 3px solid white;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    text-shadow: 0 2px 5px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

#start-button:hover {
    background-color: white;
    color: #0d47a1;
    transform: scale(1.05);
}

#end-screen h2 {
    font-size: 5em;
    font-weight: 600;
    text-shadow: 0 4px 10px rgba(0,0,0,0.4);
}

/* --- REGLA CORREGIDA PARA CENTRAR EL CONTENIDO --- */
#quiz-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%;
}