:root {
    --primary-blue: #008cce;
    --text-black: #000000;
    --text-grey: #666666;
    --bg-white: #ffffff;
    --primary-green: #669933;
    --primary-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;
}

#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: 140px;
    height: auto;
}

.game-button {
    background-color: var(--primary-blue);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 140, 206, 0.3);
    width: 210px;
}

.practice-button {
    background-color: var(--primary-yellow);
    box-shadow: 0 4px 15px rgba(251, 176, 59, 0.3);
}

.buttons-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 10px;
    margin-bottom: 20px;
}

.instructions-spacer {
    height: 12px;
}

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

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

.instructions-container {
    text-align: center;
    width: 100%;
    padding: 0 25px; /* Side margins/padding protection for mobile screens */
}

.instruction-block {
    display: flex;
    flex-direction: column;
    gap: 8px; /* Separate Game Time and Practice instructions */
}

.instruction-body {
    font-family: var(--font-opensans);
    color: var(--text-grey);
    font-size: 0.95rem;
}

.legend-text {
    font-family: var(--font-opensans);
    color: var(--text-grey);
    font-size: 0.82rem;
    font-style: italic;
    line-height: 1.4;
    padding: 0 10px;
}

/* 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: 30px;
    text-align: center;
    width: 100%;
    background-color: transparent;
    z-index: 100;
    pointer-events: none;
}

.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;
}
.hidden-screen {
    opacity: 0;
    pointer-events: none;
    display: none !important;
}

#practice-screen, #game-time-screen {
    justify-content: flex-start;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.top-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    padding: 20px 20px 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 20;
    background-color: var(--bg-white);
}

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

.sound-switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sound-switch-label {
    font-family: var(--font-opensans);
    font-size: 0.9rem;
    color: var(--text-grey);
    font-weight: 700;
}

/* Toggle Switch (Minimalist) */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    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(16px);
}
.slider.round {
    border-radius: 24px;
}
.slider.round:before {
    border-radius: 50%;
}

/* Game Area Layout */
.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 400px;
    margin-top: 84px; /* 60px top-bar + 24px vertical space */
    padding: 0 20px 90px 20px; /* 90px bottom padding keeps it completely clear of the footer */
    box-sizing: border-box;
}

.image-container {
    position: relative;
    width: 95%; /* 95% of mobile screen width */
    max-width: 320px;
    border-radius: 10px;
    overflow: hidden;
    margin: 0 auto 24px auto; /* Centered horizontally with 2.5% margins on each side naturally, and 24px space below image */
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    height: auto;
}

.image-container img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    margin: 0;
    padding: 0;
}

.feedback-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-family: var(--font-opensans);
    font-size: 2rem;
    font-weight: 700;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}
.feedback-overlay.correct {
    background-color: rgba(102, 153, 51, 0.75);
    opacity: 1;
}
.feedback-overlay.incorrect {
    background-color: rgba(255, 0, 0, 0.65);
    opacity: 1;
}

/* Practice Buttons */
.practice-buttons {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 5px;
    margin-bottom: 24px; /* 24px vertical space below buttons */
}

.answer-btn {
    width: 100%;
    padding: 8px; /* reduced to prevent footer overlaps */
    border-radius: 8px;
    border: none;
    color: white;
    font-family: var(--font-opensans);
    font-size: 1rem; /* reduced slightly */
    font-weight: 700;
    cursor: pointer;
}

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

.exit-btn {
    background-color: var(--text-grey);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    font-family: var(--font-opensans);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 10px;
}

/* Game Time Text Input */
.sentence-container {
    width: 100%;
    text-align: center;
    margin-bottom: 20px;
    font-family: var(--font-opensans);
    font-size: 1.2rem;
    color: var(--text-black);
}

#game-input {
    border: none;
    border-bottom: 2px solid var(--text-grey);
    outline: none;
    text-align: center;
    font-family: var(--font-opensans);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-blue);
    width: 60px;
    padding-bottom: 2px;
    background: transparent;
}
#game-input:focus {
    border-bottom-color: var(--primary-blue);
}

/* Results Screen */
.text-black { color: var(--text-black) !important; }
.text-grey { color: var(--text-grey) !important; }
.mb-4 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mt-2 { margin-top: 10px; }
.mt-4 { margin-top: 20px; }

.results-mode-text {
    font-family: var(--font-opensans);
    font-size: 1.2rem;
    color: var(--primary-green);
    margin-bottom: 15px;
}

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

.score-number {
    font-family: var(--font-outfit);
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 20px;
}

/* Pulse animation helper for final results middle group */
.pulse-group {
    animation: pulse-animation 2s infinite ease-in-out;
}

.whatsapp-text {
    font-family: var(--font-opensans);
    color: var(--text-grey);
    font-size: 0.95rem;
    text-align: center;
    padding: 0 20px;
    margin-bottom: 20px;
}

.results-buttons {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 250px;
    align-items: center;
}

.result-btn {
    width: 100%;
    padding: 15px;
    border-radius: 50px;
    border: none;
    color: white;
    font-family: var(--font-opensans);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
}

/* Review Mistakes Screen */
.review-title {
    font-family: var(--font-opensans);
    color: var(--text-black);
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.mistakes-container {
    width: 90%;
    max-width: 400px;
    max-height: 60vh;
    overflow-y: auto;
    background: #f9f9f9;
    border-radius: 10px;
    padding: 15px;
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.05);
}

.mistake-item {
    font-family: var(--font-opensans);
    font-size: 1rem;
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
    text-align: left;
}
.mistake-item:last-child {
    border-bottom: none;
}

.mistake-num {
    font-weight: bold;
    color: var(--text-grey);
}

.mistake-wrong {
    color: rgba(255, 0, 0, 0.8);
    font-weight: 700;
}

.mistake-correct {
    color: var(--primary-green);
    font-weight: 700;
}

.font-bold {
    font-weight: 700;
}

.examples-container {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
}

.example-item {
    font-family: var(--font-opensans);
    font-size: 0.9rem;
}

.correct-example {
    color: var(--primary-green);
    font-weight: 700;
}

.incorrect-example {
    color: #cc0000;
    font-weight: 700;
}

.game-time-legend-box {
    margin-bottom: 24px;
    text-align: center;
    width: 100%;
}
