: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; /* Increased size */
    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;
    text-align: center;
    padding: 0 20px; /* Horizontal margin from borders */
}

.instruction-label {
    font-family: var(--font-opensans);
    color: var(--text-black);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
}

.instructions-container {
    text-align: center;
    width: 100%;
}

.instruction-body {
    font-family: var(--font-opensans);
    color: var(--text-grey);
    font-size: 0.95rem;
    text-align: center;
    padding: 0 20px; /* Horizontal margin from borders */
    line-height: 1.5;
}

/* 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: 20px;
    background-color: var(--bg-white);
}

.game-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0; /* Removed top white space */
    margin-bottom: 20px;
}

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

.sound-label {
    display: none;
}

.help-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-grey);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.1s ease;
}

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

.help-btn:active {
    transform: scale(0.9);
}

.help-btn svg {
    width: 24px;
    height: 24px;
}

.sound-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-blue);
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.1s ease;
}

.sound-icon-btn .btn-label-text {
    font-size: 0.95rem;
    font-weight: 700;
    font-family: var(--font-opensans);
    color: var(--primary-blue);
}

.sound-icon-btn:active {
    transform: scale(0.9);
}

.sound-svg {
    width: 24px;
    height: 24px;
}

.exit-btn-header {
    background-color: var(--text-grey);
    color: white;
    border: none;
    padding: 6px 14px;
    border-radius: 20px;
    font-family: var(--font-opensans);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background-color 0.2s, transform 0.1s;
}

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

.exit-btn-header .exit-icon {
    width: 16px;
    height: 16px;
    stroke: currentColor;
}

/* Toggle Switch Styles */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-blue);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Image Container */
.game-image-container {
    width: 100%;
    max-width: 400px;
    margin: 20px 0 10px 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 15px;
}

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

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

.game-image {
    max-width: 100%;
    max-height: 250px;
    border-radius: 10px;
}

.game-phrase-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    flex-wrap: nowrap; /* Force single row for GT1 phrase and Repeat audio button */
}

.game-image-phrase {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-black);
    margin: 0;
    white-space: nowrap; /* Keep on a single line */
}

.play-audio-btn {
    background-color: transparent;
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.9rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.play-audio-btn:hover {
    background-color: var(--primary-blue);
    color: white;
}

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

.speaker-icon {
    width: 16px;
    height: 16px;
}

/* 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); }

.exit-btn {
    background-color: var(--text-grey);
    color: white;
    border: none;
    padding: 10px 30px;
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin: 20px auto 60px auto; /* Increased margin-bottom to avoid footer */
    display: flex;
    align-items: center;
    gap: 8px;
}

.exit-icon {
    width: 18px;
    height: 18px;
    stroke: currentColor;
}

/* --- GAME OVER SCREEN --- */
#game-over-screen {
    z-index: 25;
    justify-content: flex-start;
    padding: 20px 20px 110px 20px;
    background-color: var(--bg-white);
}

.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 {
    animation: pulse-animation-light 2s infinite ease-in-out;
}

@keyframes pulse-animation-light {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    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 SCREEN --- */
#review-screen {
    z-index: 30;
    justify-content: flex-start;
    padding: 40px 20px;
    background-color: var(--bg-white);
}

.review-title {
    color: var(--text-black);
    margin-bottom: 30px;
    font-size: 1.8rem;
}

.mistakes-list {
    width: 100%;
    max-width: 400px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    flex-grow: 1;
    margin-bottom: 20px;
}

.mistake-item {
    background-color: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.mistake-number {
    font-weight: 700;
    color: var(--text-grey);
    margin-bottom: 5px;
}

.mistake-user-answer {
    color: #dc3545; /* Red */
    font-weight: 700;
    font-size: 0.95rem;
}

.mistake-correct-answer {
    color: #28a745; /* Green */
    font-weight: 700;
    font-size: 0.95rem;
}

/* --- SPEECH TO TEXT STYLES --- */
.speech-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    width: 100%;
    max-width: 320px;
    margin-top: 15px;
    margin-bottom: 20px;
}

.speech-status {
    font-family: var(--font-opensans);
    color: var(--text-grey);
    font-size: 0.9rem;
    text-align: center;
    font-weight: 700;
    min-height: 1.5rem;
    white-space: nowrap;
}

.mic-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--primary-blue);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0, 140, 206, 0.3);
    transition: transform 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.mic-button:active {
    transform: scale(0.95);
}

.mic-icon {
    font-size: 1.8rem;
}

/* Listening active state */
.mic-button.listening {
    background-color: #dc3545; /* Red warning */
    animation: mic-pulse-animation 1.5s infinite ease-in-out;
    box-shadow: 0 4px 20px rgba(220, 53, 69, 0.5);
}

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

.dictation-result-wrapper {
    width: 100%;
    text-align: center;
    background-color: #f9f9f9;
    border-radius: 12px;
    padding: 10px;
    border: 1px solid #eeeeee;
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-label {
    font-size: 0.85rem;
    color: var(--text-grey);
    font-weight: 700;
    margin-bottom: 5px;
}

.dictated-text-box {
    font-family: var(--font-opensans);
    color: var(--text-black);
    font-size: 1.1rem;
    font-weight: 700;
    min-height: 1.5rem;
    word-break: break-word;
}

.next-btn {
    width: 100%;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.1s;
    text-align: center;
}

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

/* --- FEEDBACK OVERLAYS --- */
.image-wrapper {
    position: relative;
    width: 100%;
    max-width: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 10px;
    overflow: hidden;
}

.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5;
    transition: opacity 0.2s ease;
}

.feedback-overlay span {
    color: white;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
    font-family: var(--font-outfit);
}

.feedback-correct {
    background-color: rgba(102, 153, 51, 0.85); /* Translucent Green */
}

.feedback-incorrect {
    background-color: rgba(220, 53, 69, 0.85); /* Translucent Red */
}

/* --- MODAL FOR REVIEW MISTAKES --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.modal-content {
    background-color: white;
    padding: 24px;
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    max-height: 80%;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2rem;
    font-weight: bold;
    color: var(--text-grey);
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: var(--text-black);
}

.modal-title {
    margin-top: 0;
    margin-bottom: 20px;
    font-family: var(--font-outfit);
    color: var(--primary-blue);
    font-size: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}

.mistakes-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mistake-item {
    background-color: #fcf8f2;
    border-left: 4px solid var(--primary-orange-yellow);
    padding: 12px;
    border-radius: 8px;
    font-family: var(--font-opensans);
}

.mistake-round {
    font-weight: 700;
    color: var(--text-grey);
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.mistake-correct {
    color: var(--primary-green);
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.mistake-user {
    color: var(--text-black);
    font-size: 0.95rem;
}

/* --- GAME TIME 2 --- */
.gt2-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
    flex-grow: 1;
}

.gt2-answer-box {
    width: 100%;
    min-height: 50px;
    background-color: #f0f0f0;
    border: 2px dashed #ccc;
    border-radius: 10px;
    display: flex;
    flex-wrap: nowrap; /* Force single row */
    overflow-x: auto;  /* scroll if exceeds */
    gap: 6px;
    padding: 8px;
    box-sizing: border-box;
    align-items: center;
    justify-content: center;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

.gt2-answer-box::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.gt2-word-pool {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: center;
    gap: 10px;
    padding: 10px;
    box-sizing: border-box;
    margin-bottom: 10px;
}

.word-bubble {
    padding: 8px 16px;
    border-radius: 20px;
    font-family: var(--font-opensans);
    font-weight: 700;
    color: white;
    cursor: pointer;
    box-shadow: 0 3px 6px rgba(0,0,0,0.15);
    user-select: none;
    transition: transform 0.1s ease;
    text-align: center;
}

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

/* When word is in the answer box */
.gt2-answer-box .word-bubble {
    margin: 2px;
    transform: none !important; /* Remove random rotation in answer box */
}

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

/* Row alignment for audio + submit buttons */
.game-actions-row {
    display: flex;
    justify-content: center;
    gap: 15px;
    align-items: center;
    margin-top: 0;
    width: auto;
}

.header-submit-btn {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    padding: 8px 24px;
    border-radius: 20px;
    font-family: var(--font-opensans);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0, 140, 206, 0.2);
    transition: background-color 0.2s, transform 0.1s;
}

.header-submit-btn:hover {
    background-color: #007bb3;
}

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


