:root {
    --primary-color: #4CAF50;
    --secondary-color: #2196F3;
    --accent-color: #FFC107;
    --bg-color: #f0f9ff;
    --text-color: #333;
    --white: #ffffff;
    --correct-color: #4CAF50;
    --wrong-color: #f44336;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Comic Neue', cursive, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

#app {
    background: var(--white);
    width: 100%;
    max-width: 800px;
    min-height: 500px;
    border-radius: 30px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    padding: 30px;
    position: relative;
    overflow: hidden;
    border: 8px solid #e0f2fe;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

h1 { color: var(--secondary-color); margin-bottom: 20px; font-size: 2.5rem; }
h2 { color: var(--primary-color); margin-bottom: 15px; }

/* Buttons */
button {
    cursor: pointer;
    border: none;
    border-radius: 15px;
    font-family: inherit;
    font-weight: bold;
    transition: transform 0.2s, background-color 0.2s;
}

button:active { transform: scale(0.95); }

.btn-main {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 40px;
    font-size: 1.2rem;
    margin-top: 20px;
}

.btn-small {
    background-color: #ddd;
    padding: 8px 15px;
    font-size: 0.9rem;
    position: absolute;
    top: 20px;
    left: 20px;
}

/* Grade Selection */
.grade-selection {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    margin-top: 30px;
}

.grade-btn {
    background-color: var(--secondary-color);
    color: white;
    padding: 30px;
    font-size: 1.5rem;
}

.grade-btn:nth-child(2) { background-color: #FF9800; }
.grade-btn:nth-child(3) { background-color: #9C27B0; }
.grade-btn:nth-child(4) { background-color: #E91E63; }

/* Game Grid */
.game-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    width: 100%;
    margin-top: 20px;
}

.game-btn {
    background-color: #fff;
    border: 4px solid var(--secondary-color);
    color: var(--secondary-color);
    padding: 20px;
    font-size: 1.2rem;
}

.game-btn:hover {
    background-color: var(--secondary-color);
    color: white;
}

/* Progress Bar */
.progress-container {
    width: 100%;
    height: 15px;
    background-color: #eee;
    border-radius: 10px;
    margin: 20px 0;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    background-color: var(--accent-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* Game Elements */
#game-container {
    width: 100%;
    margin: 20px 0;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.choice-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.choice-btn {
    padding: 15px 25px;
    font-size: 1.3rem;
    background-color: #f8f9fa;
    border: 3px solid #dee2e6;
}

.choice-btn.correct { background-color: var(--correct-color); color: white; border-color: var(--correct-color); }
.choice-btn.wrong { background-color: var(--wrong-color); color: white; border-color: var(--wrong-color); }

.word-order-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.letter-box {
    width: 50px;
    height: 50px;
    border: 3px solid var(--secondary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    border-radius: 8px;
    background: white;
}

.gap-text {
    font-size: 1.5rem;
    line-height: 2;
}

.gap-input {
    border: none;
    border-bottom: 3px solid var(--secondary-color);
    width: 100px;
    text-align: center;
    font-family: inherit;
    font-size: 1.4rem;
    outline: none;
}

/* Feedback */
#feedback {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    font-weight: bold;
}

.hidden { display: none; }

.success { color: var(--correct-color); font-size: 1.5rem; }
.error { color: var(--wrong-color); font-size: 1.2rem; }

/* Responsive */
@media (max-width: 600px) {
    .grade-selection, .game-grid {
        grid-template-columns: 1fr;
    }
    h1 { font-size: 1.8rem; }
}
