:root {
    --primary-blue: #008CCE;
    --text-black: #000000;
    --text-grey: #666666;
    --bg-white: #FFFFFF;
    --primary-green: #669933;
    --primary-orange-yellow: #FBB03B;
    --font-outfit: 'Outfit', sans-serif;
    --font-opensans: 'Open Sans', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body, html {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-white);
    font-family: var(--font-outfit);
    user-select: none;
    -webkit-user-select: none;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    transition: opacity 2s ease;
    padding-bottom: 110px; /* Leave space for persistent footer */
    overflow-y: auto;
    box-sizing: border-box;
}

#splash-screen {
    z-index: 10;
    cursor: pointer;
}

#main-screen {
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.5s ease;
    justify-content: flex-start;
}

#main-screen.active {
    opacity: 1;
    pointer-events: auto;
}

/* Splash Content */
.splash-content {
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

#main-logo {
    width: 250px;
    height: auto;
    margin-bottom: 20px;
    transition: transform 0.8s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 2s ease-in-out;
    will-change: transform, opacity;
}

#tap-text {
    font-size: 1.5rem;
    color: var(--primary-blue);
    font-weight: 700;
    letter-spacing: 1px;
}

/* Main Header */
.main-header {
    text-align: center;
    transition: transform 1s ease-in-out, top 1s ease-in-out;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
}

.main-header.at-top {
    top: 60px;
    transform: translate(-50%, 0);
}

.unit-title {
    font-family: var(--font-opensans);
    color: var(--text-black);
    font-weight: 700;
    font-size: 2.2rem;
    margin-bottom: -5px;
}

.subtheme-title {
    font-family: var(--font-opensans);
    color: var(--text-grey);
    font-weight: 400;
    font-size: 1.2rem;
}

/* Main Content */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 145px; /* Pegado justo debajo del subtema */
    opacity: 0;
    transition: opacity 1.5s ease;
    width: 100%;
}

.main-content.visible {
    opacity: 1;
}

.medium-logo {
    width: 200px;
    height: auto;
}

.game-button {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    padding: 10px 40px; /* Reduced from 15px to 10px to reduce height */
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 140, 206, 0.3);
}

.content-text {
    font-family: var(--font-opensans);
    color: var(--text-black);
    font-size: 0.95rem;
    margin-top: 20px;
}

.instructions-container {
    text-align: center;
    width: 100%;
    max-width: 320px;
    margin: 18px auto 0 auto;
    padding: 0 16px;
    box-sizing: border-box;
}

.instruction-label {
    font-family: var(--font-opensans);
    color: var(--text-black);
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.instruction-body {
    font-family: var(--font-opensans);
    color: var(--text-grey);
    font-size: 0.9rem;
    line-height: 1.45;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.instruction-body strong {
    color: var(--text-black);
}

/* Animations */
.pulse {
    animation: pulse-animation 2s infinite ease-in-out;
}

@keyframes pulse-animation {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.fade-out {
    opacity: 0 !important;
}

.hidden {
    display: none !important;
}

/* Footer - Persistent */
.persistent-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    padding-bottom: 15px;
    padding-top: 10px;
    text-align: center;
    width: 100%;
    background-color: transparent;
    z-index: 100;
    pointer-events: none;
    transition: background-color 0.3s ease, border-radius 0.3s ease, box-shadow 0.3s ease;
}

.persistent-footer.scrolled {
    background-color: #FFFFFF;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.08);
    pointer-events: auto; /* Enable clicks if needed when it has background */
}

.powered-by {
    font-family: var(--font-opensans);
    color: var(--text-black);
    font-size: 0.8rem;
    margin-bottom: -5px;
    font-weight: 700;
}

.footer-brand {
    position: relative;
    display: inline-block;
}

.footer-logo {
    height: 16px;
    width: auto;
    position: absolute;
    right: 100%;
    margin-right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.footer-brand span {
    font-family: var(--font-opensans);
    font-size: 0.85rem;
    color: var(--text-grey);
    font-weight: 400;
}

/* --- GAME SCREEN --- */
#game-screen {
    z-index: 20;
    justify-content: flex-start;
    padding: 0 20px 20px 20px;
    background-color: var(--bg-white);
    transition: opacity 2.5s ease-in-out;
    opacity: 1;
}

#game-screen.fade-out {
    opacity: 0 !important;
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0; /* Pegado al margen superior de la pantalla */
    padding-top: 10px; /* Ajuste limpio al borde */
    margin-bottom: 18px;
    gap: 8px;
}

.round-counter {
    color: var(--text-grey);
    font-size: 1.1rem;
    font-weight: 700;
    white-space: nowrap;
}

/* Help Container & Circle Icon (Grey) */
.help-container {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--text-grey);
    cursor: pointer;
    user-select: none;
}

.help-label {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-opensans);
}

.help-icon-circle {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--text-grey);
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
}

/* Effects Container & Speaker Icon (Blue) */
.effects-container {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--primary-blue);
    cursor: pointer;
    user-select: none;
    transition: opacity 0.2s ease;
}

.effects-container.muted {
    opacity: 0.4;
}

.effects-container.muted .volume-wave,
.effects-container.muted .volume-wave-outer {
    display: none !important;
}

.effects-container.muted .mute-cross {
    display: block !important;
}

.effects-label {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-opensans);
}

.speaker-icon {
    width: 18px;
    height: 18px;
    display: block;
}

/* Exit Button Top (Grey with white text and icon) */
.exit-btn-top {
    background-color: var(--text-grey);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-family: var(--font-opensans);
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: transform 0.1s, background-color 0.2s;
}

.exit-btn-top:active {
    transform: scale(0.95);
}

.exit-icon {
    width: 14px;
    height: 14px;
    display: block;
}

/* Modal Overlay & Help Card Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none !important;
}

.help-card {
    background-color: var(--bg-white);
    padding: 30px 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    text-align: center;
    border: 1px solid #eaeaea;
}

.help-close-btn {
    position: absolute;
    top: 8px;
    right: 12px;
    background: none;
    border: none;
    font-size: 1.6rem;
    color: var(--text-grey);
    cursor: pointer;
    line-height: 1;
}

.help-text {
    font-family: var(--font-opensans);
    font-size: 1.1rem;
    color: var(--text-grey);
    font-weight: 400;
    margin-top: 10px;
}

.animate-zoom {
    animation: animatezoom 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes animatezoom {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Pedagogical Hint Card (Thin Yellow Contour) */
.hint-card {
    background-color: var(--bg-white);
    border: 1.5px solid var(--primary-orange-yellow); /* Línea delgada de contorno amarillo */
    border-radius: 20px;
    padding: 24px 20px;
    width: 90%;
    max-width: 350px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-sizing: border-box;
}

.hint-icon {
    font-size: 2rem;
    line-height: 1;
}

.hint-title {
    font-family: var(--font-opensans);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-black);
}

.hint-content {
    font-family: var(--font-opensans);
    font-size: 0.95rem;
    line-height: 1.45;
    color: var(--text-black);
    text-align: left;
    width: 100%;
    background-color: #FFFDF9;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #FFF1D6;
    box-sizing: border-box;
}

.hint-content p {
    margin-bottom: 6px;
}

.hint-content p:last-child {
    margin-bottom: 0;
}

.hint-content strong {
    color: #222222;
}

.hint-btn {
    width: 100%;
    max-width: 200px;
    padding: 10px 24px;
    font-size: 1.15rem;
    margin-top: 4px;
}

/* Image Container */
.game-image-container {
    width: 100%;
    max-width: 380px;
    margin: 0 auto 16px auto;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow: hidden;
    border-radius: 10px;
}

.image-placeholder {
    width: 100%;
    height: 190px;
    border: 2px dashed #cccccc;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
}

.image-placeholder p {
    color: var(--text-grey);
    font-size: 0.95rem;
}

.game-image {
    max-width: 100%;
    max-height: 220px;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    display: block;
}

/* Feedback Overlay on Image */
.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    z-index: 5;
    pointer-events: none;
    transition: opacity 0.2s ease;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.feedback-overlay.correct {
    background-color: rgba(102, 153, 51, 0.75); /* Verde transparente */
}

.feedback-overlay.wrong {
    background-color: rgba(220, 53, 69, 0.75); /* Rojo transparente */
}

.feedback-text {
    color: #FFFFFF;
    font-family: var(--font-opensans);
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    animation: feedback-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes feedback-pop {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Dialogue (Question & Answer) */
.game-dialogue-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    width: 100%;
    max-width: 360px;
    margin-top: 0;
    margin-bottom: 22px;
    padding: 0 10px;
}

.game-question-text {
    font-family: var(--font-opensans);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-black);
    line-height: 1.4;
}

.slot-selected {
    color: var(--primary-blue);
    font-weight: 700;
}

.game-answer-text {
    font-family: var(--font-opensans);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--text-grey);
    line-height: 1.4;
}

/* Game Time 1 Interactive Inputs */
.gt1-interactive-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px; /* Amplio espaciado entre Question Words, Verb to Be y Submit */
    width: 100%;
    max-width: 330px;
    margin-top: 0;
    margin-bottom: 30px;
}

.qw-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    width: 100%;
}

.be-buttons-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px 10px;
    width: 100%;
}

.choice-btn {
    color: #FFFFFF;
    border: none;
    padding: 8px 14px;
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    transition: transform 0.12s ease, background-color 0.2s ease, box-shadow 0.12s ease;
}

.choice-btn:active {
    transform: scale(0.95);
}

.choice-btn.selected {
    background-color: #666666 !important;
    color: #FFFFFF !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    transform: scale(0.97);
}

.submit-answer-btn {
    background-color: var(--primary-blue);
    color: #FFFFFF;
    border: none;
    padding: 10px 36px;
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-size: 1.35rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(0, 140, 206, 0.35);
    width: 100%;
    max-width: 260px;
    margin-top: 0;
    transition: transform 0.1s ease, background-color 0.2s ease;
}

.submit-answer-btn:active {
    transform: scale(0.96);
}

/* Game Time 2 Answer Box & Interactive Scramble */
.gt2-answer-box {
    min-height: 48px;
    width: 100%;
    max-width: 360px;
    background-color: #FAFAFA;
    border: 2px solid var(--primary-blue);
    border-radius: 16px;
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 8px;
    justify-content: center;
    align-items: center;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.gt2-placeholder {
    font-family: var(--font-opensans);
    font-size: 0.95rem;
    color: #999999;
    font-style: italic;
    pointer-events: none;
    user-select: none;
}

.gt2-interactive-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 360px;
    margin-top: 0;
    margin-bottom: 30px;
}

.gt2-words-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-height: 40px;
}

.word-chip {
    border: none;
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-weight: 700;
    font-size: 1.05rem;
    padding: 8px 16px;
    color: #FFFFFF;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.12s ease, opacity 0.15s ease, box-shadow 0.12s ease;
    user-select: none;
    -webkit-user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.word-chip:active {
    transform: scale(0.95);
}

.word-chip.in-answer {
    padding: 6px 14px;
    font-size: 0.95rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
    animation: chip-pop 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes chip-pop {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.word-chip.used-in-pool {
    display: none !important;
}

/* Options */
.game-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 300px;
    margin-top: 20px;
    margin-bottom: 30px;
}

.option-btn {
    color: white;
    border: none;
    padding: 15px 20px;
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
}

.option-btn:active {
    transform: scale(0.98);
}

.option-blue { background-color: var(--primary-blue); }
.option-yellow { background-color: var(--primary-orange-yellow); color: white; }
.option-green { background-color: var(--primary-green); }

#game-over-screen {
    z-index: 25;
    justify-content: flex-start;
    padding: 20px 20px 110px 20px;
    background-color: var(--bg-white);
    opacity: 0;
    pointer-events: none;
    transition: opacity 1.5s ease-in-out;
}

#game-over-screen.active {
    opacity: 1;
    pointer-events: auto;
}

.game-over-header {
    text-align: center;
    margin-top: 15px; /* Reduced from 40px */
    margin-bottom: 5px; /* Reduced from 20px */
}

.unit-subtitle {
    color: var(--text-black);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.unit-title-grey {
    color: var(--text-grey);
    font-size: 1.1rem;
}

.score-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px; /* Reduced from 10px */
    margin: 5px 0; /* Reduced from 20px */
    padding: 10px; /* Reduced from 20px */
}

.large-logo {
    width: 230px;
    height: auto;
    margin-top: 0px;
    margin-bottom: 5px;
}

.game-time-label {
    color: var(--primary-blue);
    font-size: 1.3rem;
    font-weight: 700;
}

.final-score-label {
    color: var(--text-grey);
    font-weight: 700;
    font-size: 1.2rem;
}

.score-result {
    color: var(--primary-blue);
    font-size: 2.5rem;
    font-weight: 700;
}

/* Pulse animation helper for score container */
.score-card.pulse {
    will-change: transform;
}

#game-over-screen.active .score-card.pulse {
    animation: pulse-animation-light 2s infinite ease-in-out;
}

@keyframes pulse-animation-light {
    0% { transform: scale(1); }
    50% { transform: scale(1.03); }
    100% { transform: scale(1); }
}

.game-over-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 320px;
    margin-top: 0px; /* Reduced from 5px */
}

.whatsapp-instruction {
    color: var(--text-grey);
    font-size: 0.95rem;
    text-align: center;
    margin-bottom: 5px; /* Reduced margin */
}

.action-btn {
    width: 100%;
    padding: 12px 20px; /* Slightly reduced padding */
    border: none;
    border-radius: 50px;
    color: white;
    font-family: var(--font-opensans);
    font-size: 1.1rem; /* Slightly reduced font size */
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    text-decoration: none; /* In case of anchor tags */
    box-sizing: border-box;
}

.btn-green { background-color: var(--primary-green); }
.btn-yellow { background-color: var(--primary-orange-yellow); }
.btn-blue { background-color: var(--primary-blue); }
.btn-grey { background-color: var(--text-grey); }

/* --- REVIEW MISTAKES MODAL & CARDS --- */
.review-card {
    background-color: var(--bg-white);
    padding: 24px 20px;
    border-radius: 20px;
    width: 90%;
    max-width: 360px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 1px solid #eaeaea;
    box-sizing: border-box;
}

.review-title {
    color: var(--text-black);
    font-family: var(--font-opensans);
    font-size: 1.35rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 15px;
}

.mistakes-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex-grow: 1;
    padding-right: 4px;
}

.mistake-item {
    background-color: #f8f9fa;
    padding: 12px 14px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    border-left: 4px solid #dc3545;
    box-sizing: border-box;
    text-align: left;
}

.mistake-round {
    font-family: var(--font-opensans);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-grey);
}

.mistake-context {
    font-family: var(--font-opensans);
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-black);
}

.mistake-comparison {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-family: var(--font-opensans);
    font-size: 0.88rem;
}

.mistake-user-answer {
    color: #dc3545;
    font-weight: 700;
}

.mistake-correct-answer {
    color: #28a745;
    font-weight: 700;
}

.no-mistakes-msg {
    text-align: center;
    padding: 25px 10px;
    font-family: var(--font-opensans);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--primary-green);
}
