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

.practice-button {
    background-color: #fbb03b;
    color: white;
    border: none;
    padding: 10px 40px;
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(251, 176, 59, 0.3);
}

.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%;
    max-width: 320px;
    margin: 20px auto 0 auto;
}

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

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

/* --- Practice Screen Styles --- */
#practice-screen {
    justify-content: flex-start;
    padding-top: 20px;
    padding-bottom: 110px;
    background-color: var(--bg-white);
    overflow-y: auto;
}


.practice-game-container {
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.image-container {
    position: relative;
    width: 200px;
    height: 200px;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

#practice-image, #game-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: var(--bg-white); /* Ensures a clean background if image aspect ratio varies */
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: rgba(0,0,0,0.5); /* Default */
    transition: opacity 0.3s ease;
}

.overlay.correct {
    background-color: rgba(40, 167, 69, 0.7);
}

.overlay.incorrect {
    background-color: rgba(252, 16, 0, 0.7);
}

#practice-result-text, #game-result-text {
    font-family: var(--font-outfit);
    font-size: 2.5rem;
    font-weight: 700 !important;
    color: #ffffff !important;
    text-transform: lowercase;
    letter-spacing: 2px;
    text-shadow: 2px 2px 5px rgba(0,0,0,0.5);
}

.practice-section {
    width: 100%;
    min-height: 50px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.prompt-text {
    font-family: var(--font-opensans);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-black);
    text-align: center;
    width: 100%;
}

.answer-line-container {
    width: 100%;
    padding-bottom: 5px;
    border-bottom: 3px solid var(--primary-blue);
    min-height: 60px;
    display: flex;
    align-items: flex-end;
}

.answer-line {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 40px;
    align-items: center;
}

.word-pill {
    background-color: var(--primary-blue);
    color: white;
    padding: 10px 15px;
    border-radius: 8px;
    font-family: var(--font-opensans);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
    box-shadow: 0 3px 6px rgba(0, 140, 206, 0.3);
    transition: transform 0.1s ease;
}

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

.word-pill.hidden-pill {
    visibility: hidden;
    pointer-events: none;
}

.word-pill.pill-question {
    background-color: var(--primary-blue);
    box-shadow: 0 3px 6px rgba(0, 140, 206, 0.3);
}

.word-pill.pill-affirmative {
    background-color: #689f38;
    box-shadow: 0 3px 6px rgba(104, 159, 56, 0.3);
}

.word-pill.pill-negative {
    background-color: #d32f2f;
    box-shadow: 0 3px 6px rgba(211, 47, 47, 0.3);
}

/* --- Game Screen Styles --- */
#game-screen {
    justify-content: flex-start;
    padding-top: 20px;
    padding-bottom: 110px;
    background-color: var(--bg-white);
    overflow-y: auto;
}


.game-play-container {
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.game-prompt-container {
    width: 100%;
    min-height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.game-input-container {
    width: 100%;
}

#game-input {
    width: 100%;
    padding: 15px 20px;
    border-radius: 30px;
    border: 2px solid #ccc;
    font-family: var(--font-opensans);
    font-size: 1.2rem;
    color: var(--text-black);
    text-align: center;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#game-input:focus {
    border-color: var(--primary-blue);
    box-shadow: 0 0 10px rgba(0, 140, 206, 0.2);
}

/* --- New UI Elements (Rounds, Sound Toggle, Exit Button) --- */
.top-bar {
    width: 90%;
    max-width: 600px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

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

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

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

/* Minimalist Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.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: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

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

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

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

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

/* Exit Button */
.exit-btn {
    background-color: #666666;
    color: #ffffff;
    border: none;
    border-radius: 50px;
    padding: 8px 30px;
    font-family: var(--font-opensans);
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 20px;
    margin-bottom: 20px; /* Safe padding handles bottom distance */
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease, background-color 0.2s ease;
}

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

/* --- Score Screen Styles --- */
#score-screen {
    justify-content: flex-start;
    padding-top: 40px;
    padding-bottom: 110px;
    background-color: var(--bg-white);
    overflow-y: auto;
}

.score-header {
    text-align: center;
    margin-bottom: 15px;
}

.score-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 90%;
    max-width: 600px;
    gap: 10px;
}

.score-logo {
    width: 110px;
    height: auto;
    margin-bottom: 10px;
}

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

.score-display {
    font-family: var(--font-opensans);
    font-size: 4.5rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin: -5px 0;
}

.screenshot-instruction {
    font-family: var(--font-opensans);
    font-size: 1rem;
    color: var(--text-grey);
    max-width: 300px;
    line-height: 1.3;
    margin-bottom: 5px;
}

.min-score-text {
    font-family: var(--font-opensans);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-black);
    margin-bottom: 10px;
}

.play-again-button {
    background-color: #689f38;
    color: white;
    border: none;
    padding: 10px 40px;
    border-radius: 50px;
    font-family: var(--font-opensans);
    font-size: 1.4rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(104, 159, 56, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform 0.2s ease, background-color 0.2s ease;
    margin-bottom: 20px;
}

.play-again-button:active {
    transform: scale(0.98);
}

.play-again-button:hover {
    background-color: #558b2f;
}

.refresh-icon {
    font-size: 1.3rem;
}

.practice-completed-label {
    font-family: var(--font-opensans);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin: 15px 0;
}

/* Green styling for game/practice submit buttons */
#submit-answer-btn, #game-submit-btn {
    background-color: #689f38;
    box-shadow: 0 4px 15px rgba(104, 159, 56, 0.3);
}

#submit-answer-btn:hover, #game-submit-btn:hover {
    background-color: #558b2f;
}

/* Game mode tip style */
.game-tip-text {
    font-family: var(--font-opensans);
    font-size: 0.85rem;
    color: var(--primary-blue);
    font-style: italic;
    text-align: center;
    max-width: 320px;
    margin: 15px auto 10px auto;
}

/* Mistakes review components */
.mistakes-review-container {
    width: 100%;
    max-width: 450px;
    background: #f9f9f9;
    border-radius: 12px;
    padding: 15px;
    margin-top: 15px;
    border: 1px solid #eee;
    text-align: left;
}

.mistakes-review-container h3 {
    font-family: var(--font-opensans);
    font-size: 1.2rem;
    color: var(--text-black);
    margin-bottom: 12px;
    text-align: center;
}

.mistake-item {
    padding: 10px;
    border-bottom: 1px solid #ddd;
    font-family: var(--font-opensans);
    font-size: 0.95rem;
}

.mistake-item:last-child {
    border-bottom: none;
}

.mistake-prompt {
    font-weight: 700;
    color: var(--text-black);
    margin-bottom: 4px;
}

.mistake-user {
    color: #d32f2f;
    margin-bottom: 2px;
}

.mistake-correct {
    color: #689f38;
    font-weight: 600;
}

/* --- Vocabulary Mode Styles --- */
.vocabulary-button {
    background-color: #689f38;
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 40px;
    font-size: 1.5rem;
    font-family: var(--font-opensans);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(104, 159, 56, 0.3);
    transition: transform 0.2s, background-color 0.2s;
}

.vocabulary-button:hover {
    background-color: #558b2f;
    transform: scale(1.05);
}

#vocabulary-screen {
    justify-content: flex-start;
    padding-top: 20px;
    padding-bottom: 110px;
    background-color: var(--bg-white);
    overflow-y: auto;
}

.vocabulary-container {
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Flip Card Styles */
.flip-card {
    background-color: transparent;
    width: 280px;
    height: 280px;
    perspective: 1000px;
    cursor: pointer;
    margin-bottom: 20px;
}

.flip-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s;
    transform-style: preserve-3d;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2);
    border-radius: 16px;
}

.flip-card.flipped .flip-card-inner {
    transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: white;
    border: 3px solid var(--primary-blue);
    padding: 10px;
}

.flip-card-front img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
}

.flip-card-back {
    transform: rotateY(180deg);
    background-color: #f0f8ff;
}

#vocabulary-word {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 10px;
    text-transform: lowercase;
}

#vocabulary-pronunciation {
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text-grey);
    font-style: italic;
}

.vocabulary-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    max-width: 300px;
}

.vocab-btn {
    color: white;
    border: none;
    border-radius: 50px;
    padding: 10px 20px;
    font-size: 1.1rem;
    font-family: var(--font-outfit);
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
    transition: transform 0.2s, background-color 0.2s;
}

.vocab-btn:hover {
    transform: scale(1.05);
}

.skip-btn {
    background-color: var(--primary-blue);
}
.skip-btn:hover {
    background-color: #007bb5;
}

.learnt-btn {
    background-color: #689f38;
}
.learnt-btn:hover {
    background-color: #558b2f;
}

.pronunciation-btn {
    background-color: #fbb03b;
}
.pronunciation-btn:hover {
    background-color: #f59b14;
}

#exit-vocabulary-btn {
    margin-top: 10px;
}

/* Help Button & Inline Instructions */
.help-btn {
    background: none;
    border: 2px solid var(--text-grey);
    color: var(--text-grey);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    transition: all 0.2s;
}

.help-btn:hover {
    background-color: var(--text-grey);
    color: white;
}

.vocab-instructions {
    font-family: var(--font-opensans);
    font-size: 0.85rem;
    color: #666666;
    background: #f9f9f9;
    padding: 12px;
    border-radius: 12px;
    border: 1px dashed #ccc;
    max-width: 300px;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.vocab-instructions p {
    margin: 0;
    line-height: 1.3;
}
