body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 1rem;
    background: radial-gradient(circle at top right, #1e1b4b, var(--background));
    overflow-x: hidden;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 2rem auto;
}

.back-btn {
    background: transparent;
    border: none;
    padding: 0.3rem 0;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s;
}
.back-btn:hover { color: var(--text); }

.header-actions { display: flex; align-items: center; gap: 0.75rem; }

.reset-btn {
    background: transparent;
    border: 1px solid var(--surface-border);
    color: var(--text-muted);
    padding: 0.4rem 0.85rem;
    border-radius: var(--radius-full);
    font-family: var(--font-ui);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}
.reset-btn:hover {
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.08);
}

.score-container {
    display: flex;
    gap: 1rem;
    background: var(--surface-glass);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--surface-border);
    font-weight: 600;
    font-size: 0.9rem;
}

.new-stat { color: #3b82f6; }
.repeat-stat { color: #f59e0b; }
.done-stat { color: #10b981; }

.game-container {
    flex: 1;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    animation: fadeIn 0.4s ease forwards;
}
.screen.active { display: flex; }

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

h1 {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    text-align: center;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    text-align: center;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
    width: 100%;
}

.category-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 1rem 1.2rem;
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    text-align: left;
}
.category-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    border-color: var(--primary);
}

.category-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}
.category-name { flex: 1; min-width: 0; }
.category-progress-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
.category-progress-bar {
    width: 100%;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
}
.category-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: inherit;
    transition: width 0.4s ease;
}
.category-btn.completed {
    border-color: rgba(16, 185, 129, 0.4);
    background: rgba(16, 185, 129, 0.06);
}
.category-btn.completed .category-progress-text { color: #10b981; }
.category-btn.completed .category-progress-fill { background: #10b981; }

.question-card {
    background: var(--surface-glass);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    padding: 1.75rem 1.75rem;
    width: 100%;
    text-align: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.english-translation {
    color: var(--text-muted);
    font-size: 1rem;
    font-style: italic;
    line-height: 1.4;
    margin-bottom: 1.1rem;
}

.sentence {
    font-family: var(--font-kr);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.5;
    color: var(--text);
    word-break: keep-all;
}

.blank {
    display: inline-block;
    min-width: 2.4em;
    padding: 0 0.3em;
    border-bottom: 3px solid var(--accent);
    color: var(--accent);
    font-weight: 900;
    text-align: center;
    transition: color 0.2s, border-color 0.2s;
}
.blank.filled.correct { color: #10b981; border-bottom-color: #10b981; }
.blank.filled.wrong { color: #ef4444; border-bottom-color: #ef4444; }

/* Modal phrases like 먹어 보세요 / 만나기로 했어요 are quite long → 2 columns */
.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    width: 100%;
}

.option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 1.1rem 0.85rem;
    color: var(--text);
    font-family: var(--font-kr);
    font-size: 1.2rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    word-break: keep-all;
}
.option-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.02);
}
.option-btn:disabled { cursor: not-allowed; opacity: 0.85; }
.option-btn.correct {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
}
.option-btn.wrong {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
    opacity: 0.7;
}

.explanation {
    width: 100%;
    margin-top: 1rem;
    padding: 0 1.1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.55;
    border-left: 3px solid transparent;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity 0.3s ease, max-height 0.3s ease, padding 0.3s ease, border-color 0.3s ease;
}
.explanation.visible {
    opacity: 1;
    max-height: 320px;
    padding: 0.85rem 1.1rem;
    border-left-color: var(--primary);
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-md);
}

.next-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.85rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    margin-top: 1.25rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}
.next-btn:hover { transform: scale(1.05); background: var(--accent); }

.feedback-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 1rem 2rem;
    border-radius: var(--radius-full);
    font-weight: 800;
    font-size: 1.2rem;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 100;
}
.feedback-banner.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.feedback-banner.correct { background: #10b981; color: white; }
.feedback-banner.wrong   { background: #ef4444; color: white; }
.feedback-banner.repeat  { background: #f59e0b; color: white; }

#screen-done { padding-top: 4rem; text-align: center; }
.done-icon { font-size: 6rem; margin-bottom: 1rem; animation: bounce 2s infinite; }
@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-30px); }
    60% { transform: translateY(-15px); }
}
.primary-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: bold;
    border-radius: var(--radius-full);
    margin-top: 2rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}
.primary-btn:hover { transform: scale(1.05); background: var(--accent); }

@media (max-width: 600px) {
    .sentence { font-size: 1.55rem; }
    .option-btn { font-size: 1.05rem; padding: 0.95rem 0.5rem; }
    h1 { font-size: 2.2rem; }
    .question-card { padding: 1.25rem 1.1rem; }
    .english-translation { font-size: 0.9rem; }
}
