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 1.5rem 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);
}

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

.screen {
    display: none;
    flex-direction: column;
    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;
}

/* ── Scenario menu cards ── */
.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    width: 100%;
}

.scenario-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--surface-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    cursor: pointer;
    text-align: left;
    color: var(--text);
    font-family: var(--font-ui);
    transition: all 0.25s ease;
    padding: 0;
    display: flex;
    flex-direction: column;
}
.scenario-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 12px 32px rgba(139, 92, 246, 0.2);
}

.scenario-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    background-position: center;
    background-size: cover;
    background-color: #1e1b4b;
}

.scenario-body {
    padding: 0.9rem 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    flex: 1;
}

.scenario-card-title {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.3;
}

.scenario-card-sub {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.scenario-card-status {
    margin-top: auto;
    padding-top: 0.5rem;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.scenario-card-status.played { color: #10b981; }
.scenario-card-status.perfect { color: #f59e0b; }

/* ── Game screen ── */
.scenario-banner {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}
.scenario-banner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.scenario-banner-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(15, 12, 41, 0.85) 0%, rgba(15, 12, 41, 0.15) 45%, rgba(15, 12, 41, 0) 70%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.25rem 1.5rem;
    color: white;
}
.scenario-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 0.15rem 0;
    font-family: var(--font-kr);
}
.scenario-subtitle {
    color: rgba(255, 255, 255, 0.82);
    font-size: 0.95rem;
    margin: 0;
}

.scenario-intro {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0 0 1.25rem 0;
    text-align: center;
    font-style: italic;
}

/* ── Dialogue area ── */
.dialogue-area {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.stage-direction {
    align-self: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
    padding: 0.25rem 0.75rem;
    max-width: 90%;
    text-align: center;
}

.bubble {
    max-width: 78%;
    padding: 0.85rem 1.1rem;
    border-radius: 1.25rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    animation: bubbleIn 0.3s ease forwards;
}
@keyframes bubbleIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.bubble-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    margin-bottom: 0.2rem;
}

.bubble-korean {
    font-family: var(--font-kr);
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1.45;
    word-break: keep-all;
}

.bubble-english {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    margin-top: 0.25rem;
    line-height: 1.4;
    font-style: italic;
}

.bubble.npc {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--surface-border);
    border-top-left-radius: 0.4rem;
    color: var(--text);
}
.bubble.npc .bubble-label { color: var(--accent); }
.bubble.npc .bubble-english { color: var(--text-muted); }

.bubble.player {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-top-right-radius: 0.4rem;
}
.bubble.player.wrong {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
}

/* ── Turn area (prompt + options OR continue) ── */
.turn-area {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.turn-prompt {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
    text-align: center;
}

.option-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--surface-border);
    border-radius: var(--radius-md);
    padding: 0.95rem 1.1rem;
    color: var(--text);
    font-family: var(--font-kr);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
    word-break: keep-all;
}
.option-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
    border-color: var(--primary);
}
.option-btn:disabled { cursor: not-allowed; }
.option-btn .opt-en {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.82rem;
    font-style: italic;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.2rem;
}
.option-btn.correct {
    background: rgba(16, 185, 129, 0.18);
    border-color: #10b981;
    color: #10b981;
}
.option-btn.wrong {
    background: rgba(239, 68, 68, 0.18);
    border-color: #ef4444;
    color: #ef4444;
    opacity: 0.85;
}

/* Feedback card */
.feedback {
    border-left: 3px solid var(--primary);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.85rem 1.1rem;
    border-radius: var(--radius-md);
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    animation: bubbleIn 0.3s ease forwards;
}
.feedback.correct { border-left-color: #10b981; }
.feedback.wrong   { border-left-color: #ef4444; }
.feedback strong { color: var(--text); }

.continue-btn {
    align-self: center;
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}
.continue-btn:hover { transform: scale(1.05); background: var(--accent); }

/* ── Done screen ── */
#screen-done { padding-top: 3rem; text-align: center; align-items: center; }
.done-icon { font-size: 5rem; margin-bottom: 0.75rem; }
#done-title {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}
#done-message {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.done-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.primary-btn, .secondary-btn {
    border: none;
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    cursor: pointer;
    font-family: var(--font-ui);
    transition: transform 0.2s, background 0.2s;
}
.primary-btn {
    background: var(--primary);
    color: white;
}
.primary-btn:hover { transform: scale(1.05); background: var(--accent); }
.secondary-btn {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--surface-border);
}
.secondary-btn:hover { background: rgba(255, 255, 255, 0.06); }

@media (max-width: 600px) {
    h1 { font-size: 2.2rem; }
    .bubble { max-width: 88%; }
    .bubble-korean { font-size: 1.05rem; }
    .option-btn { font-size: 1rem; padding: 0.85rem 0.95rem; }
    .scenario-title { font-size: 1.2rem; }
}
