:root {
    --bg-color: #FFD700; /* Gold */
    --text-color: #4A2511; /* Brown */
    --container-bg: #FFF8E1; /* Light yellow */
    --container-border: #4A2511;
    --scoreboard-bg: #FFE082;
    --button-bg: #FFA000; /* Orange */
    --button-text: #4A2511;
    --button-hover-bg: #FFC107; /* Amber */
    --input-bg: #fff;
    --input-border: #4A2511;
    --message-incorrect-color: #BF360C;
    --message-correct-color: #2E7D32;
    --body-bg-image: none;
}

/* --- THEMES --- */

body.theme-inverted {
    --bg-color: #211208;
    --text-color: #FFD700;
    --container-bg: #4A2511;
    --container-border: #FFD700;
    --scoreboard-bg: #2d1607;
    --button-bg: #FFC107;
    --button-text: #4A2511;
    --button-hover-bg: #FFD700;
    --input-bg: #2d1607;
    --input-border: #FFD700;
    --message-incorrect-color: #ff8a80;
    --message-correct-color: #b9f6ca;
}

body.theme-spring {
    --bg-color: #d4e157; /* Lime Green */
    --text-color: #3e2723; /* Dark Brown */
    --container-bg: #fffde7; /* Cream */
    --container-border: #7cb342; /* Light Green */
    --scoreboard-bg: #f0f4c3; /* Light Lime */
    --button-bg: #ff8a65; /* Light Coral */
    --button-text: #3e2723;
    --button-hover-bg: #ffab91; /* Lighter Coral */
    --input-bg: #fff;
    --input-border: #7cb342;
    --body-bg-image: url('/spring-bg.png');
}

body.theme-halloween {
    --bg-color: #212121; /* Dark Grey */
    --text-color: #ff9800; /* Orange */
    --container-bg: #424242; /* Grey */
    --container-border: #ff9800;
    --scoreboard-bg: #313131;
    --button-bg: #f57c00; /* Darker Orange */
    --button-text: #fff;
    --button-hover-bg: #ff9800;
    --input-bg: #616161;
    --input-border: #ff9800;
    --body-bg-image: url('/halloween-bg.png');
}

body.theme-winter {
    --bg-color: #e3f2fd; /* Light Blue */
    --text-color: #0d47a1; /* Dark Blue */
    --container-bg: #ffffff;
    --container-border: #42a5f5; /* Blue */
    --scoreboard-bg: #bbdefb; /* Lighter Blue */
    --button-bg: #90caf9; /* Soft Blue */
    --button-text: #0d47a1;
    --button-hover-bg: #bbdefb;
    --input-bg: #fff;
    --input-border: #42a5f5;
    --body-bg-image: url('/winter-bg.png');
}

body {
    font-family: 'Patrick Hand', cursive;
    background-color: var(--bg-color);
    background-image: var(--body-bg-image);
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    margin: 0;
    text-align: center;
    transition: background-color 0.5s ease;
}

#game-container {
    position: relative;
    background-color: var(--container-bg);
    color: var(--text-color);
    padding: 2rem 3rem;
    border-radius: 15px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.2);
    border: 5px solid var(--container-border);
    width: 90%;
    max-width: 600px;
    transition: background-color 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}

header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

#bee-logo {
    width: 60px;
    height: 60px;
}

h1 {
    font-size: 3rem;
    margin: 0;
}

h2 {
    font-size: 2rem;
}

#score-board {
    display: flex;
    justify-content: space-around;
    font-size: 1.5rem;
    background-color: var(--scoreboard-bg);
    padding: 0.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    transition: background-color 0.5s ease;
}

#score-board p {
    margin: 0;
}

#start-screen {
    padding: 2rem 0;
}

#start-screen p {
    font-size: 1.5rem;
    margin: 0.5rem 0 1.5rem 0;
}

#difficulty-selection h2 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.difficulty-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

#game-area button, .theme-btn, .lang-btn, #close-theme-modal, #close-lang-modal {
    font-family: 'Patrick Hand', cursive;
    font-size: 1.5rem;
    padding: 0.75rem 1.5rem;
    border: 3px solid var(--button-text);
    border-radius: 10px;
    background-color: var(--button-bg);
    color: var(--button-text);
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s, border-color 0.3s;
    user-select: none;
}

#game-area button:hover, .theme-btn:hover, .lang-btn:hover, #close-theme-modal:hover, #close-lang-modal:hover {
    background-color: var(--button-hover-bg);
}

#game-area button:active, .theme-btn:active, .lang-btn:active, #close-theme-modal:active, #close-lang-modal:active {
    transform: translateY(2px);
}

#start-button {
    width: 100%;
}

#word-area {
    margin: 1.5rem 0;
}

#input-area {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

#current-difficulty-display {
    font-size: 1.2rem;
    color: var(--text-color);
    opacity: 0.8;
    margin-bottom: 1rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#end-game-options {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

#spell-input {
    flex-grow: 1;
    font-family: 'Patrick Hand', cursive;
    font-size: 1.5rem;
    padding: 0.5rem;
    border: 3px solid var(--input-border);
    border-radius: 10px;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: background-color 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}

#message {
    font-size: 1.2rem;
    min-height: 2rem;
    font-weight: bold;
    color: var(--message-incorrect-color);
    transition: color 0.5s ease;
}

#message.correct {
    color: var(--message-correct-color);
}

.hidden {
    display: none !important;
}

/* Language Switcher */
#language-switcher {
    position: absolute;
    top: 10px;
    left: 10px;
    cursor: pointer;
    z-index: 10;
}

#language-icon {
    width: 40px;
    height: 40px;
    transition: transform 0.2s ease-in-out;
}

#language-icon:hover {
    transform: scale(1.1);
}

/* Theme Switcher */
#theme-switcher {
    position: absolute;
    top: 10px;
    right: 10px;
    cursor: pointer;
    z-index: 10;
}

#theme-icon {
    width: 40px;
    height: 40px;
    transition: transform 0.2s ease-in-out;
}

#theme-icon:hover {
    transform: scale(1.1) rotate(10deg);
}

/* Modals */
#theme-modal, #language-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: 1000;
}

#theme-options, #language-options {
    background: var(--container-bg);
    border: 5px solid var(--container-border);
    padding: 2rem;
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 90%;
    max-width: 350px;
}

#theme-options h3, #language-options h3 {
    margin: 0 0 1rem 0;
    font-size: 2rem;
    text-align: center;
    color: var(--text-color);
}

#close-theme-modal, #close-lang-modal {
    margin-top: 1rem;
    background-color: #eee;
    color: #333;
    border-color: #aaa;
}
#close-theme-modal:hover, #close-lang-modal:hover {
    background-color: #ddd;
}

#question-container {
    background-color: var(--scoreboard-bg);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

#question-number {
    font-size: 1rem;
    font-weight: bold;
    opacity: 0.7;
    margin: 0 0 0.5rem 0;
    text-align: left;
}

#question-text {
    font-size: 1.5rem;
    margin: 0;
    text-align: left;
}

#options-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.option-btn {
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    font-size: 1.2rem;
}

.option-btn.correct {
    background-color: var(--message-correct-color);
    border-color: green;
    color: var(--text-color);
}

.option-btn.incorrect {
    background-color: var(--message-incorrect-color);
    border-color: darkred;
    color: var(--text-color);
}

.option-btn:disabled:not(.correct):not(.incorrect) {
    opacity: 0.6;
    cursor: not-allowed;
    background-color: var(--button-bg);
}

@media (max-width: 600px) {
    body {
        /* Ensure game is visible even with URL bars on mobile */
        min-height: 100vh; 
        height: auto;
    }

    #game-container {
        padding: 1.5rem 1rem;
        width: 95%;
        border-width: 3px;
        margin: 1rem 0;
    }

    h1 {
        font-size: 2.2rem;
    }
    
    h2 {
        font-size: 1.8rem;
    }

    #bee-logo {
        width: 50px;
        height: 50px;
    }
    
    header {
        gap: 0.5rem;
    }

    #score-board {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    #start-screen p {
        font-size: 1.2rem;
    }

    #game-area button, .theme-btn, .lang-btn, #close-theme-modal, #close-lang-modal {
        font-size: 1.2rem;
        padding: 0.6rem 1rem;
        border-width: 2px;
    }
    
    #question-text {
        font-size: 1.2rem;
    }
    
    .option-btn {
        font-size: 1.1rem;
        padding: 0.6rem 0.8rem;
    }

    #language-switcher {
        top: 5px;
        left: 5px;
    }

    #theme-switcher {
        top: 5px;
        right: 5px;
    }

    #language-icon, #theme-icon {
        width: 35px;
        height: 35px;
    }

    #theme-options, #language-options {
        padding: 1.5rem;
        gap: 0.8rem;
    }
    
    #theme-options h3, #language-options h3 {
        font-size: 1.8rem;
    }
}