/* General Styles */
body {
    font-family: 'Nunito', sans-serif;
    background: #89CFF0; /* Baby Blue */
    color: #333;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
}

.container {
    background: #fff;
    padding: 2rem 3rem;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    text-align: center;
    width: 90%;
    max-width: 500px;
}

h1 {
    font-family: 'Fredoka One', cursive;
    color: #FF6347; /* Tomato */
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

p {
    font-size: 1.2rem;
    color: #555;
}

/* Form Styles (index.html) */
.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: #007BFF;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.8rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 1.1rem;
    box-sizing: border-box;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007BFF;
}

.btn, .btn-start {
    font-family: 'Fredoka One', cursive;
    background: #32CD32; /* Lime Green */
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 15px;
    font-size: 1.5rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: transform 0.2s, background-color 0.2s;
    border-bottom: 5px solid #228B22; /* Forest Green */
}

.btn-start:hover, .btn:hover {
    transform: translateY(-3px);
    background-color: #38d838;
}

/* Game Styles (game.html) */
.game-container {
    min-height: 450px;
    position: relative;
}

/* Close button in game container */
.close-btn {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #ff6b6b;
    color: #fff;
    font-size: 1.6rem;
    line-height: 36px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    transition: transform 0.15s ease, background-color 0.2s ease;
}

.close-btn:hover {
    transform: translateY(-2px);
    background-color: #ff4d4d;
}

.close-btn:focus {
    outline: 3px solid rgba(255, 107, 107, 0.4);
    outline-offset: 2px;
}

#game-header {
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    font-weight: bold;
    color: #555;
    padding-bottom: 1rem;
    border-bottom: 2px solid #eee;
}

.timer-container {
    width: 100%;
    background-color: #e0e0e0;
    border-radius: 10px;
    margin: 1.5rem 0 0.5rem;
}

#timer-bar {
    height: 20px;
    width: 100%;
    background-color: #FFD700; /* Gold */
    border-radius: 10px;
    transition: width 1s linear;
}

.time-display {
    font-size: 1rem;
    color: #777;
    margin-bottom: 1.5rem;
}

#problem {
    font-family: 'Fredoka One', cursive;
    font-size: 5rem;
    margin: 2rem 0;
    color: #007BFF;
}

#answer-input {
    font-size: 3rem;
    width: 100%;
    text-align: center;
    border: none;
    border-bottom: 4px solid #ccc;
    outline: none;
    font-family: 'Nunito', sans-serif;
    padding: 0.5rem;
    box-sizing: border-box;
}

#answer-input:focus {
    border-bottom-color: #007BFF;
}

.instructions {
    font-size: 1rem;
    color: #aaa;
    margin-top: 1rem;
}

/* Game Over Screen */
#game-over {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
}

.score-display {
    font-family: 'Fredoka One', cursive;
    font-size: 5rem;
    color: #FF6347;
}

#new-highscore-message {
    font-size: 1.5rem;
    color: #32CD32;
    font-weight: bold;
}

.game-over-buttons {
    margin-top: 2rem;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

#restart-btn {
    background-color: #007BFF;
    border-bottom-color: #0056b3;
    font-family: 'Fredoka One', cursive;
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 15px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
    white-space: normal;
    word-break: break-word;
    text-align: center;
}
#restart-btn:hover {
    transform: translateY(-3px);
}

/* Ensure anchor button behaves similarly on long translations */
.game-over-buttons .btn {
    white-space: normal;
    word-break: break-word;
    text-align: center;
}

/* Let buttons grow and wrap nicely on small widths */
.game-over-buttons > * {
    flex: 1 1 220px;
    max-width: 100%;
}

/* Dutch strings are longer; nudge size down a bit */
html[lang="nl"] .game-over-buttons .btn,
html[lang="nl"] #restart-btn {
    font-size: 1.1rem;
    padding: 0.9rem 1.4rem;
}

@media (max-width: 420px) {
    .game-over-buttons > * {
        flex-basis: 100%;
    }
}

.hidden {
    display: none !important;
}

/* Animations */
.correct-animation {
    animation: correct 0.5s ease-out;
}

@keyframes correct {
    0% { transform: scale(1); background-color: white; }
    50% { transform: scale(1.1); background-color: #d4edda; } /* Light green */
    100% { transform: scale(1); background-color: white; }
}

.incorrect-animation {
    animation: incorrect 0.5s ease-in-out;
}

@keyframes incorrect {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-15px); }
    40% { transform: translateX(15px); }
    60% { transform: translateX(-15px); }
    80% { transform: translateX(15px); }
}