/* ----
   - style.css
   - Versión 23.0.0 - Sin cambios en este archivo
   - Fecha de Actualización: 24 de agosto de 2025
---- */

/* ---- CONFIGURACIÓN GENERAL Y VARIABLES ---- */
:root {
    --color-primary-dark: #1a237e;
    --color-primary-light: #303f9f;
    --color-accent-cyan: #00bcd4;
    --color-accent-pink: #e91e63;
    --color-text: #ffffff;
    --color-correct: #4CAF50;
    --color-incorrect: #F44336;
    --color-unanswered: #9E9E9E;
    --color-locked: #757575;
    --font-family: 'Roboto', sans-serif;
    --pie-size: 200px;
    --pie-depth: 15px;
    --header-height: 70px; /* Altura del encabezado fijo */
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--color-primary-dark);
    background-image: url('img/simbolos-patrios-usa.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--color-text);
    margin: 0;
    padding-top: var(--header-height); 
    padding-bottom: 80px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    text-align: center;
}

/* ---- ESTRUCTURA PRINCIPAL ---- */
.main-header {
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(26, 35, 126, 0.8);
    backdrop-filter: blur(8px);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    z-index: 1000;
}

.logo {
    height: 50px;
    transition: transform 0.3s ease;
}
.logo:hover {
    transform: scale(1.1);
}

.stats-container {
    display: flex;
    gap: 20px;
    font-size: 1.1em;
    font-weight: 700;
}

#game-container {
    flex-grow: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    background-color: rgba(26, 35, 126, 0.7);
    border-radius: 20px;
    padding: 30px;
    border: 2px solid var(--color-accent-cyan);
    backdrop-filter: blur(10px);
}

.screen.active {
    display: flex;
    animation: fadeIn 0.5s ease;
}


/* ---- ELEMENTOS COMUNES ---- */
.main-title {
    font-size: 3em;
    font-weight: 900;
    margin: 10px 0;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
}

.screen-title {
    font-size: 2.5em;
    color: var(--color-accent-cyan);
    margin-bottom: 10px;
}

.subtitle, .screen-subtitle {
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 30px;
    max-width: 600px;
}

/* ---- ESTILOS DE BOTONES ---- */
.button-group, .button-group-vertical {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}
.button-group {
    flex-wrap: wrap;
    justify-content: center;
}
.button-group-vertical {
    flex-direction: column;
    width: 100%;
    max-width: 500px;
}

.btn {
    padding: 15px 25px;
    font-size: 1.2em;
    font-weight: 700;
    color: var(--color-text);
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.stage-btn {
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 20px;
}
.stage-progress-text {
    font-size: 0.8em;
    font-weight: 400;
    color: var(--color-accent-cyan);
    background-color: rgba(0,0,0,0.2);
    padding: 2px 8px;
    border-radius: 5px;
}
.unlock-criteria {
    font-size: 0.75em;
    font-style: italic;
    opacity: 0.8;
}

.answer-btn {
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    flex-direction: row; /* Asegura que los botones de respuesta sigan siendo horizontales */
}

.answer-btn .btn-identifier {
    font-weight: 900;
    opacity: 0.8;
    margin-right: 10px;
}

.answer-btn .btn-text {
    flex-grow: 1;
    white-space: normal;
}

.btn-3d {
    background-color: var(--color-primary-light);
    border-bottom: 5px solid var(--color-primary-dark);
}
.btn-3d:hover {
    transform: translateY(-3px);
    filter: brightness(1.1);
}
.btn-3d:active {
    transform: translateY(2px);
    border-bottom-width: 2px;
}

.btn-secondary {
    background: none;
    border: 2px solid var(--color-accent-cyan);
    margin-top: 20px;
}
.btn-secondary:hover {
    background-color: var(--color-accent-cyan);
    color: var(--color-primary-dark);
}

#hint-btn:disabled {
    background-color: var(--color-locked);
    border-color: #424242;
    cursor: not-allowed;
    opacity: 0.6;
}

.answer-btn.correct, .answer-btn.correct:hover {
    background-color: var(--color-correct);
    border-color: #388E3C;
    transform: scale(1.05);
}
.answer-btn.incorrect, .answer-btn.incorrect:hover {
    background-color: var(--color-incorrect);
    border-color: #D32F2F;
    animation: shake 0.5s;
}
.answer-btn[disabled] {
    cursor: not-allowed;
    filter: grayscale(50%);
}

.stage-btn[disabled] {
    background-color: var(--color-locked);
    border-bottom-color: #424242;
    cursor: not-allowed;
}
.stage-btn[disabled]:hover {
    transform: none;
}
.lock-icon {
    font-family: sans-serif;
    margin-right: 5px;
}

/* ---- PANTALLA DE BIENVENIDA ---- */
.welcome-image-container {
    position: relative;
    width: 100%;
    max-width: 500px;
    margin-bottom: 20px;
}
#welcome-image {
    width: 100%;
    border-radius: 15px;
    border: 3px solid var(--color-accent-pink);
}
.quote-overlay {
    position: absolute;
    bottom: 10px;
    left: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 15px;
    border-radius: 0 0 10px 10px;
    font-size: 1.2em;
    font-style: italic;
    animation: fadeIn 1.5s ease-in-out;
}


/* ---- PANTALLA DE JUEGO ---- */
.game-header {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 1.2em;
    font-weight: 700;
    margin-bottom: 15px;
}
.progress-bar-container {
    width: 100%;
    background-color: var(--color-primary-dark);
    border-radius: 10px;
    height: 30px;
    margin-bottom: 20px;
    border: 2px solid var(--color-accent-cyan);
    overflow: hidden;
}
#progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent-pink), var(--color-accent-cyan));
    transition: width 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}
#question-area {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
#question-text {
    font-size: 1.8em;
    line-height: 1.4;
    margin-bottom: 10px;
}
#speech-control {
    margin-bottom: 20px;
}
#replay-speech-btn {
    background: none;
    border: 1px solid var(--color-text);
    color: var(--color-text);
    padding: 8px 12px;
    border-radius: 5px;
    cursor: pointer;
}
#thinking-message {
    font-size: 1.5em;
    color: var(--color-accent-cyan);
    font-style: italic;
    animation: pulse 1.5s infinite;
}
#thinking-message:hover {
    cursor: pointer;
}

#feedback-area {
    margin-top: 20px;
    min-height: 80px;
}
#feedback-text {
    font-size: 1.5em;
    font-weight: bold;
}

/* ---- PANTALLA DE RESULTADOS Y GRÁFICO 3D ---- */
#results-summary {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

#chart-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin: 30px 0;
}

#chart-container {
    position: relative;
    width: var(--pie-size);
    height: var(--pie-size);
    perspective: 1000px;
}

#pie-chart {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateX(60deg) rotateZ(-20deg);
    transition: transform 0.5s;
    background-image: conic-gradient(var(--color-correct) 0% 0%, var(--color-incorrect) 0% 100%);
}

#pie-chart::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    filter: brightness(0.7);
    transform: translateZ(calc(-1 * var(--pie-depth)));
}

#score-percentage-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotateX(-60deg);
    transform-origin: center;
    color: white;
    font-weight: bold;
    font-size: 2em;
    text-shadow: 1px 1px 3px black;
    pointer-events: none;
}


#trophy {
    font-size: 6em;
    animation: trophy-bounce 1s infinite ease-in-out;
}

#detailed-results {
    width: 100%;
    text-align: left;
    max-height: 250px;
    overflow-y: auto;
    padding: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
}
.result-item {
    padding: 15px;
    border-bottom: 1px solid var(--color-primary-light);
}
.result-item:last-child {
    border-bottom: none;
}
.result-item-q { font-weight: bold; }
.result-item-a { font-style: italic; }
.result-item-a.correct { color: var(--color-correct); }
.result-item-a.incorrect { color: var(--color-incorrect); }
.result-item-a.unanswered { color: var(--color-unanswered); font-weight: bold; }
.result-item-explanation {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 5px;
}

.ad-container {
    width: 100%;
    max-width: 728px;
    margin: 20px auto;
    padding: 10px;
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    min-height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}
.ad-container small {
    margin-top: 5px;
    font-size: 0.8em;
    opacity: 0.7;
}


/* ---- MODAL ---- */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    animation: fadeIn 0.3s;
}
.modal-content {
    background-color: var(--color-primary-light);
    margin: 15% auto;
    padding: 30px;
    border: 2px solid var(--color-accent-pink);
    border-radius: 15px;
    width: 80%;
    max-width: 600px;
    position: relative;
}
.close-button {
    color: var(--color-text);
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}

/* ---- CONFETI ---- */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}
.confetti {
    position: absolute;
    width: 10px;
    height: 20px;
    background-color: var(--color-accent-cyan);
    top: -20px;
    opacity: 0;
    animation: fall 5s linear infinite;
}

@keyframes fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}


/* ---- FOOTER Y CONTROLES DE MÚSICA ---- */
.page-footer {
    padding: 15px 20px;
    background-color: rgba(26, 35, 126, 0.8);
    backdrop-filter: blur(5px);
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 998;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
#version-display {
    font-size: 0.8em;
    opacity: 0.7;
}
.footer-button {
    color: var(--color-text);
    font-size: 1.2em;
    text-decoration: none;
    font-weight: bold;
    padding: 10px 20px;
    border: 2px solid var(--color-accent-cyan);
    border-radius: 10px;
    transition: all 0.3s ease;
}
.footer-button:hover {
    background-color: var(--color-accent-cyan);
    color: var(--color-primary-dark);
}

.music-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0,0,0,0.5);
    padding: 10px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1001;
}

/* ---- ANIMACIONES ---- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse { 0% { transform: scale(1); } 50% { transform: scale(1.05); } 100% { transform: scale(1); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes trophy-bounce { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-20px) scale(1.1); } }


/* ---- RESPONSIVIDAD ---- */
@media (max-width: 768px) {
    body { padding-top: 100px; }
    .main-header { flex-direction: column; height: auto; gap: 10px; }
    .main-title { font-size: 2.2em; }
    .screen-title { font-size: 2em; }
    .btn { font-size: 1em; padding: 12px 24px; }
    #question-text { font-size: 1.5em; }
    .stats-container { font-size: 0.9em; gap: 10px; width: 100%; justify-content: space-around;}
    .logo { height: 40px; }
    .screen { padding: 20px; }
    .modal-content { width: 90%; margin: 25% auto;}
    .music-controls { bottom: 80px; }
}

@media (max-width: 480px) {
    .main-title { font-size: 1.8em; }
    .screen-title { font-size: 1.6em; }
    .subtitle, .screen-subtitle { font-size: 1em; }
    #question-text { font-size: 1.2em; }
    .game-header { font-size: 1em; }
    .screen { padding: 15px; }
    :root { --pie-size: 150px; --pie-depth: 12px; }
    #score-percentage-display { font-size: 1.5em; }
    #chart-wrapper { flex-direction: column; }
    .footer-button { font-size: 1em; padding: 8px 16px;}
    .music-controls { bottom: 75px; }
}