body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.quiz-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    width: 90%;
    max-width: 500px;
    margin: 20px auto;
}

h1 {
    color: #333;
    margin-bottom: 20px;
}

#equation-container {
    margin-bottom: 20px;
    padding: 20px;
    background-color: #e9e9e9;
    border-radius: 5px;
}

#equation {
    font-size: 2em;
    font-weight: bold;
    margin: 0;
    color: #555;
}

.buttons-container button {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 15px 30px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 16px;
    margin: 10px 5px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s ease;
}

.buttons-container button#wrong-btn {
    background-color: #f44336;
}

.buttons-container button:hover {
    opacity: 0.9;
}

#score-container {
    margin-top: 20px;
    font-size: 1.1em;
    color: #333;
}

#score-container p {
    margin: 5px 0;
}

#feedback-container {
    margin-top: 15px;
    min-height: 20px; /* Reserve space for feedback */
}

#feedback-text {
    font-style: italic;
    font-size: 1em;
}

#game-over-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    width: 90%;
    max-width: 500px;
    margin: 20px auto;
    border: 3px solid #dc3545;
    animation: gameOverFadeIn 0.5s ease-out;
}

@keyframes gameOverFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#game-over-container h2 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #dc3545;
    font-size: 2.5em;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

#game-over-container p {
    font-size: 1.2em;
    color: #333;
    margin-bottom: 15px;
}

#game-over-container #final-score {
    font-size: 5em;
    font-weight: bold;
    color: #28a745;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
    display: block;
    margin: 20px 0;
    animation: scoreGlow 2s ease-in-out infinite alternate;
}

@keyframes scoreGlow {
    from {
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2), 0 0 20px rgba(40, 167, 69, 0.3);
    }
    to {
        text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2), 0 0 30px rgba(40, 167, 69, 0.6);
    }
}

#restart-btn {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 1.1em;
    font-weight: bold;
    margin-top: 20px;
    cursor: pointer;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

#restart-btn:hover {
    background: linear-gradient(45deg, #218838, #1c7c84);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

/* Clean User Selection Interface - Matching index.html style */
#user-selection-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    width: 90%;
    max-width: 500px;
    margin: 20px auto;
}

#user-selection-container h1 {
    font-size: 2.5em;
    margin: 0 0 30px 0;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

#user-selection-container h1 .emoji {
    font-size: 1em;
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', 'Android Emoji', 'Emoji One', 'Twemoji Mozilla', 'EmojiTwo', 'EmojiSymbols', sans-serif;
    font-feature-settings: 'liga' off;
    color: initial;
    -webkit-text-fill-color: initial;
    background: none;
}

#user-selection-container h1 .text {
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.user-buttons-container {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.user-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 20px 30px;
    text-align: center;
    font-size: 1.3em;
    font-weight: bold;
    cursor: pointer;
    border-radius: 15px;
    transition: all 0.3s ease;
    min-width: 160px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.user-btn:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
}

/* Leo's button styling */
#leo-btn.user-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

/* Sophie's button styling */
#sophie-btn.user-btn {
    background: linear-gradient(135deg, #FF6B35 0%, #e55a2b 100%);
}

/* Small text styling for grade levels */
.user-btn small {
    display: block;
    font-size: 0.8em;
    font-weight: 400;
    margin-top: 5px;
    opacity: 0.9;
}

/* Responsive design for user selection */
@media (max-width: 768px) {
    #user-selection-container {
        padding: 30px 20px;
        max-width: 95%;
    }
    
    .user-buttons-container {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .user-btn {
        width: 100%;
        max-width: 280px;
        padding: 18px 25px;
        font-size: 1.2em;
    }
    
    #user-selection-container h1 {
        font-size: 2.2em;
        margin-bottom: 25px;
    }
}

@media (max-width: 480px) {
    #user-selection-container {
        padding: 25px 15px;
        border-radius: 15px;
    }
    
    .user-btn {
        padding: 15px 20px;
        font-size: 1.1em;
        min-width: 140px;
    }
    
    #user-selection-container h1 {
        font-size: 1.9em;
    }
}

#difficulty-selection-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    text-align: center;
    width: 90%;
    max-width: 500px;
    margin: 20px auto;
}

#difficulty-selection-container h1 {
    color: #333;
    font-size: 2.5em;
    margin: 0 0 30px 0;
    background: linear-gradient(45deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
}

/* Macron Color Palette References (Conceptual - actual hex codes chosen for good visibility) */
/* Macron Red: ~#DE3430 */
/* Macron Blue: ~#0055A4 */
/* Macron Green (can vary, using a clear one): ~#009051 */

.difficulty-btn { /* Renamed from .difficulty-select-button */
    /* background-color: #007bff; */ /* Original Blue - will set specific colors below */
    color: white;
    border: none;
    padding: 15px 25px;
    text-align: center;
    text-decoration: none;
    display: block;
    font-size: 1.1em;
    margin: 10px auto;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.2s ease;
    width: 80%;
    box-sizing: border-box;
}

.difficulty-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9; /* General hover effect if specific bg not set */
}

/* Specific colors for difficulty buttons */
.difficulty-btn[data-difficulty="easy"] {
    background-color: #28a745; /* Green */
}
.difficulty-btn[data-difficulty="easy"]:hover {
    background-color: #218838; /* Darker Green */
}

.difficulty-btn[data-difficulty="medium"] {
    background-color: #ffc107; /* Yellow */
    color: #212529; /* Darker text for yellow bg */
}
.difficulty-btn[data-difficulty="medium"]:hover {
    background-color: #e0a800; /* Darker Yellow */
}

.difficulty-btn[data-difficulty="hard"] {
    background-color: #dc3545; /* Red */
}
.difficulty-btn[data-difficulty="hard"]:hover {
    background-color: #c82333; /* Darker Red */
}


#timer-bar-container {
    width: 100%;
    height: 20px;
    background-color: #e0e0e0;
    border-radius: 5px;
    margin-bottom: 15px;
    overflow: hidden; /* Ensures the timer bar stays within the container */
}

#timer-bar {
    height: 100%;
    width: 100%; /* Starts full */
    background-color: #4CAF50; /* Green */
    border-radius: 5px;
    transition: width 0.1s linear; /* Smooth transition for shrinking */
}

@keyframes explode {
    0% {
        transform: scale(1);
        opacity: 1;
        font-size: 4em; /* Start with the large size */
    }
    50% {
        transform: scale(1.5); /* Explode to 1.5x of the already large size */
        opacity: 0.7;
        color: #ff0000; /* Change color during explosion - e.g., to red */
    }
    100% {
        transform: scale(1.25); /* Settle at 1.25x of the large size */
        opacity: 1;
        color: #856404; /* Return to original or a prominent color */
        font-size: 4em; /* Ensure it maintains the base large font size */
    }
}

.score-explode {
    animation: explode 0.8s ease-out forwards;
    font-weight: bold;
    /* font-size will be controlled by #game-over-container #final-score and the animation */
}

/* Multi-choice option buttons for Science Challenge */
.mcq-option-btn {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 15px 20px;
    text-align: left;
    text-decoration: none;
    display: block;
    font-size: 16px;
    margin: 8px 0;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    min-height: 50px;
}

.mcq-option-btn:hover:not(:disabled) {
    background-color: #495057;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.mcq-option-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.mcq-option-btn.correct {
    background-color: #28a745;
    animation: correctPulse 0.6s ease-out;
}

.mcq-option-btn.incorrect {
    background-color: #dc3545;
    animation: incorrectShake 0.6s ease-out;
}

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

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

#question-container {
    margin-bottom: 20px;
    padding: 25px;
    background-color: #e9ecef;
    border-radius: 10px;
    border-left: 5px solid #007bff;
}

#question-text {
    font-size: 1.3em;
    font-weight: 500;
    margin: 0;
    color: #333;
    line-height: 1.4;
}

/* Vocabulary Challenge Specific Styles */
.vocab-option-btn {
    background-color: #8e44ad;
    color: white;
    border: none;
    padding: 15px 20px;
    text-align: left;
    text-decoration: none;
    display: block;
    font-size: 16px;
    margin: 8px 0;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    width: 100%;
    box-sizing: border-box;
    min-height: 60px;
    line-height: 1.3;
}

.vocab-option-btn:hover:not(:disabled) {
    background-color: #7d3c98;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.vocab-option-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.vocab-option-btn.correct {
    background-color: #28a745;
    animation: correctPulse 0.6s ease-out;
}

.vocab-option-btn.incorrect {
    background-color: #dc3545;
    animation: incorrectShake 0.6s ease-out;
}

#word-display-container {
    margin-bottom: 25px;
    padding: 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

#target-word {
    font-size: 2.5em;
    font-weight: bold;
    color: white;
    margin: 0 0 10px 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    letter-spacing: 2px;
}

#word-instruction {
    font-size: 1.1em;
    color: #f8f9fa;
    margin: 0;
    font-style: italic;
}