/* ==========================================================
   Language Lab — stylesheet
   Vectra Node design system. Inter + JetBrains Mono.
   Glass surfaces, 2px/9999px radii, #EA580C accent.
   ========================================================== */

:root {
    --bg: #FAFAFA;
    --surface: #F5F5F5;
    --surface-raised: #FFFFFF;
    --border: #D4D4D4;
    --border-light: #E5E5E5;

    --text: #171717;
    --text-secondary: #525252;
    --text-muted: #737373;

    --serbian: #7B2D3B;
    --serbian-light: #F3E8EB;
    --serbian-mid: #A8505F;
    --spanish: #7D6118;
    --spanish-light: #F2ECDA;
    --spanish-mid: #B08E2E;

    --success: #2D6A3F;
    --success-light: #E5F0E8;
    --error: #A63030;
    --error-light: #F5E3E3;
    --focus: #EA580C;

    --font-display: 'Inter', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 40px;
    --space-2xl: 64px;

    --radius: 6px;
    --radius-lg: 10px;

    --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.08), 0 2px 8px rgba(0,0,0,0.04);
}

/* === Reset === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    font-size: 1rem;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
}

/* === Focus === */
:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible) {
    outline: none;
}

/* === Top bar === */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-xl);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
}

.nav-tabs {
    display: flex;
    gap: 2px;
}

.nav-tab {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.45rem 0.9rem;
    border: 1px solid transparent;
    background: none;
    border-radius: 9999px;
    cursor: pointer;
    color: var(--text-muted);
    transition: color 150ms, background 150ms, border-color 150ms;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.nav-tab:hover {
    color: var(--text);
    background: var(--surface-raised);
    border-color: var(--border-light);
}
.nav-tab.active {
    color: var(--text);
    background: var(--surface-raised);
    border-color: var(--border-light);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* Nav dropdowns (hover-triggered) */
.nav-dropdown {
    position: relative;
    display: inline-flex;
}
.nav-dropdown-trigger::after {
    content: '';
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 3.5px solid transparent;
    border-right: 3.5px solid transparent;
    border-top: 4px solid currentColor;
    margin-left: 5px;
    opacity: 0.45;
    vertical-align: middle;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 130px;
    z-index: 150;
    padding: var(--space-xs);
    padding-top: calc(var(--space-xs) + 4px);
    flex-direction: column;
}
.nav-dropdown-menu.open {
    display: flex;
}
.nav-dropdown-item {
    display: block;
    width: 100%;
    padding: 8px 14px;
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    border-radius: var(--radius);
    transition: background 150ms, color 150ms;
    white-space: nowrap;
}
.nav-dropdown-item:hover {
    background: var(--bg);
    color: var(--text);
}
.nav-dropdown-item.active {
    color: var(--text);
    font-weight: 600;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.streak {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}
.streak-icon {
    width: 18px;
    height: 18px;
    color: var(--error);
}
.streak-flame { font-size: 1rem; }

.today-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* === Topbar dropdowns === */
.topbar-dropdown {
    position: relative;
}
.dropdown-panel {
    display: none;
    position: absolute;
    right: -8px;
    top: calc(100% + 8px);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    z-index: 200;
    padding: var(--space-xs);
}
.dropdown-panel.open {
    display: block;
}
.dropdown-panel-qr {
    min-width: 260px;
    padding: var(--space-md);
    text-align: center;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.45rem var(--space-md);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    color: var(--text);
    transition: background 150ms;
}
.dropdown-item:hover {
    background: var(--bg);
}
.dropdown-item svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--text-muted);
}
.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-xs) 0;
}
.dropdown-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: var(--space-xs) var(--space-md);
}
.dropdown-lang-switch {
    display: flex;
    gap: 4px;
    padding: var(--space-xs) var(--space-md);
}
.dropdown-lang-switch .btn {
    flex: 1;
}
.dropdown-qr-title {
    font-family: var(--font-display);
    font-size: 1rem;
    margin-bottom: var(--space-xs);
}
.dropdown-qr-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}
.dropdown-qr-code {
    margin: 0 auto;
}
.dropdown-qr-code svg {
    width: 160px;
    height: 160px;
}
.dropdown-qr-expiry {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-sm);
}
.dropdown-schedule-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-md);
}
.dropdown-schedule-row .input {
    width: 90px;
    font-size: 0.875rem;
    padding: 0.3rem 0.5rem;
}
.dropdown-schedule-status {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: var(--space-xs) var(--space-md);
}

/* === Content === */
.content {
    max-width: 860px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

.view { display: none; }
.view.active { display: block; }

/* === Dashboard === */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.lang-card {
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-sm);
}

.lang-card[data-lang="serbian"] {
    border-left: 3px solid var(--serbian);
}
.lang-card[data-lang="spanish"] {
    border-left: 3px solid var(--spanish);
}

.lang-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
}

.lang-card-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.lang-card-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 3px;
}

.level-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.3rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.level-badge.serbian {
    background: var(--serbian-light);
    color: var(--serbian);
}
.level-badge.spanish {
    background: var(--spanish-light);
    color: var(--spanish);
}

/* Skill bars */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm) var(--space-xl);
    margin-bottom: var(--space-lg);
}

.skill-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.skill-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    width: 90px;
    text-transform: capitalize;
}

.skill-bar {
    flex: 1;
    height: 5px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}
[data-lang="serbian"] .skill-fill { background: var(--serbian-mid); }
[data-lang="spanish"] .skill-fill { background: var(--spanish-mid); }

.skill-pct {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    width: 32px;
    text-align: right;
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.skill-trend {
    font-size: 0.7rem;
    width: 16px;
    color: var(--text-muted);
}

.lang-card-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

/* === Buttons === */
.btn {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 1.1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 150ms, box-shadow 150ms, color 150ms;
    background: var(--surface);
    color: var(--text-secondary);
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    touch-action: manipulation;
    box-shadow: var(--shadow-xs);
}
.btn:hover {
    background: var(--border-light);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--text);
    color: var(--surface-raised);
    border-radius: 9999px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.18), 0 1px 3px rgba(0,0,0,0.08);
}
.btn-primary:hover {
    background: #3d3d3d;
    box-shadow: 0 4px 14px rgba(0,0,0,0.22), 0 2px 4px rgba(0,0,0,0.08);
}

.btn-serbian {
    background: var(--serbian-light);
    color: var(--serbian);
}
.btn-serbian:hover { background: #EBDADD; }

.btn-spanish {
    background: var(--spanish-light);
    color: var(--spanish);
}
.btn-spanish:hover { background: #E8E0C8; }

.btn-success {
    background: var(--success);
    color: white;
    box-shadow: 0 2px 8px rgba(45,106,63,0.25);
}
.btn-success:hover {
    background: #256B36;
    box-shadow: 0 4px 12px rgba(45,106,63,0.3);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    min-height: 36px;
}

.btn-retry {
    background: var(--error-light);
    color: var(--error);
}
.btn-retry:hover {
    background: #EDCECE;
}

.btn-danger-outline {
    background: var(--error-light);
    color: var(--error);
}
.btn-danger-outline:hover {
    background: #EDCECE;
}

/* === Lesson view === */
.lesson-picker {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.lang-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.45rem 1rem;
    border: none;
    border-radius: 9999px;
    background: var(--surface);
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms, box-shadow 150ms, color 150ms;
    color: var(--text-secondary);
    min-height: 44px;
    touch-action: manipulation;
    box-shadow: var(--shadow-xs);
}
.lang-chip:hover { background: var(--border-light); box-shadow: var(--shadow-sm); }
.lang-chip.active {
    background: var(--text);
    color: var(--surface-raised);
    box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.lesson-section {
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-sm);
}

.lesson-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-xs);
    line-height: 1.3;
}

.lesson-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
    display: flex;
    gap: var(--space-lg);
    flex-wrap: wrap;
}

.section-heading {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.section-content {
    font-size: 0.92rem;
    line-height: 1.65;
    margin-bottom: var(--space-md);
    max-width: 65ch;
}

/* Examples */
.example-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-sm);
}

.example-target {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 2px;
    line-height: 1.5;
}

.example-romanization {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.latin-inline {
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--focus);
    font-weight: 400;
}

.example-pronunciation {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--focus);
    margin-bottom: 4px;
}

.example-translations {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.audio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    font-size: 0.8rem;
    transition: background 0.15s, box-shadow 0.15s;
    vertical-align: middle;
    margin-left: 4px;
    touch-action: manipulation;
    box-shadow: var(--shadow-xs);
}
.audio-btn:hover {
    background: var(--border-light);
    box-shadow: var(--shadow-sm);
}

/* Dialogue */
.dialogue-situation {
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: var(--space-md);
    font-size: 0.88rem;
}

.dialogue-line {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}
.dialogue-line:last-child { border-bottom: none; }

.dialogue-speaker {
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--text-muted);
    width: 24px;
    text-align: center;
    padding-top: 2px;
    flex-shrink: 0;
}

.dialogue-text {
    flex: 1;
    min-width: 0;
}

.dialogue-target {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.5;
}

.dialogue-translation {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 1px;
}

/* Exercises */
.exercise-section {
    border-color: var(--border);
}

.exercise-instructions {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.question-block {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--border-light);
}
.question-block:last-child { border-bottom: none; }

.question-prompt {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

.options-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.option-btn {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.6rem var(--space-md);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    background: var(--surface-raised);
    font-family: var(--font-body);
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    min-height: 44px;
    touch-action: manipulation;
    box-shadow: var(--shadow-xs);
}
.option-btn:hover { background: var(--bg); border-color: var(--border); box-shadow: var(--shadow-sm); }
.option-btn.selected { border-color: var(--focus); background: rgba(234, 88, 12, 0.06); }
.option-btn.correct { border-color: var(--success); background: var(--success-light); }
.option-btn.incorrect { border-color: var(--error); background: var(--error-light); }
.option-btn.disabled { pointer-events: none; opacity: 0.7; }

.question-explanation {
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    font-size: 0.82rem;
    background: var(--bg);
    color: var(--text-secondary);
    display: none;
}
.question-explanation.visible { display: block; }

.fill-in-section { margin-top: var(--space-lg); }
.fill-in-block { padding: var(--space-md) 0; border-bottom: 1px solid var(--border-light); }
.fill-in-block:last-child { border-bottom: none; }
.fill-in-hint { font-size: 0.82rem; color: var(--text-secondary); margin: var(--space-xs) 0; }
.fill-in-row { display: flex; gap: var(--space-sm); align-items: center; margin-top: var(--space-sm); }
.fill-in-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow-xs);
    transition: border-color 0.15s, box-shadow 0.15s;
}
.fill-in-input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12); }
.fill-in-input.correct { border-color: var(--success); background: var(--success-light); }
.fill-in-input.incorrect { border-color: var(--error); background: var(--error-light); }
.fill-in-input:disabled { opacity: 0.7; }

.exercise-results {
    background: var(--bg);
    border-radius: var(--radius);
    padding: var(--space-lg);
    text-align: center;
}

.result-score {
    font-family: var(--font-display);
    font-size: 2rem;
}

.result-feedback {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: var(--space-sm);
    line-height: 1.5;
}

/* Vocabulary cards */
.vocab-picker {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.vocab-card {
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    text-align: center;
    max-width: 500px;
    margin: 0 auto var(--space-lg);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, box-shadow 0.15s;
    user-select: none;
}
.vocab-card:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
}

.vocab-word {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: var(--space-xs);
    line-height: 1.3;
}

.vocab-romanization {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.vocab-romanization-prominent {
    font-family: var(--font-mono);
    font-size: 1.05rem;
    color: var(--focus);
    margin-bottom: var(--space-sm);
    font-weight: 500;
}

.vocab-hint {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.vocab-answer {
    display: none;
    text-align: center;
}
.vocab-answer.revealed { display: block; }

.vocab-translation {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: var(--space-xs);
}

.vocab-context {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
    margin-bottom: var(--space-md);
}

.vocab-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-top: var(--space-md);
}

.vocab-counter {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-sm);
    font-variant-numeric: tabular-nums;
}

/* Cultural note */
.cultural-note {
    background: var(--surface);
    border-left: 3px solid var(--text-muted);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: var(--space-md) var(--space-lg);
    font-size: 0.88rem;
    margin-top: var(--space-md);
    color: var(--text-secondary);
}

.homework-hint {
    background: var(--bg);
    border-radius: var(--radius);
    padding: var(--space-md) var(--space-lg);
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-top: var(--space-md);
    border-left: 3px solid var(--text-muted);
}

/* === Empty state === */
.empty-state {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}
.empty-icon {
    font-size: 2.2rem;
    margin-bottom: var(--space-sm);
    opacity: 0.7;
}

/* === Modal === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--surface-raised);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 600px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.modal-close {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    background: none;
    border: none;
    font-size: 1.1rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}
.modal-close:hover { background: var(--bg); }

/* === Toast === */
.toast {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: var(--surface-raised);
    padding: 0.65rem 1.3rem;
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    font-weight: 500;
    transition: transform 0.3s ease;
    z-index: 300;
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;
    box-shadow: var(--shadow-lg);
}
.toast.visible { transform: translateX(-50%) translateY(0); }

/* === Generation overlay === */
.gen-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 250;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}
.gen-overlay.active { display: flex; }
.gen-overlay-card {
    background: var(--bg);
    border-radius: var(--radius-xl);
    padding: var(--space-xl) var(--space-xxl);
    text-align: center;
    box-shadow: var(--shadow-lg);
    max-width: 320px;
}
.gen-overlay-card .spinner-lg { width: 36px; height: 36px; margin: 0 auto var(--space-md); }
.gen-overlay-text {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
    margin: 0;
    line-height: 1.5;
}

/* === Loading spinner === */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--text);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Mic button === */
.mic-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--surface);
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.15s, box-shadow 0.15s, color 0.15s;
    vertical-align: middle;
    margin-left: 4px;
    touch-action: manipulation;
    box-shadow: var(--shadow-xs);
}
.mic-btn:hover {
    background: var(--border-light);
    box-shadow: var(--shadow-sm);
    color: var(--text);
}
.mic-btn.recording {
    background: var(--error-light);
    color: var(--error);
    animation: mic-pulse 1s ease-in-out infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(166,48,48,0.25); }
    50% { box-shadow: 0 0 0 6px rgba(166,48,48,0); }
}

.mic-btn-lg {
    width: 56px;
    height: 56px;
}
.mic-btn-lg.recording {
    animation: mic-pulse-lg 1s ease-in-out infinite;
}
@keyframes mic-pulse-lg {
    0%, 100% { box-shadow: 0 0 0 0 rgba(166,48,48,0.25); }
    50% { box-shadow: 0 0 0 10px rgba(166,48,48,0); }
}

.mic-btn.processing,
.mic-btn-lg.processing,
.quiz-mic-btn.processing {
    opacity: 0.6;
    cursor: wait;
    animation: none;
}

/* Mic feedback / pronunciation result */
.mic-feedback {
    display: none;
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg);
    border-radius: var(--radius);
    font-size: 0.85rem;
}

.pronunciation-result {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}
.pronunciation-result.excellent { color: var(--success); }
.pronunciation-result.good { color: #2D6A7A; }
.pronunciation-result.fair { color: var(--spanish); }
.pronunciation-result.retry { color: var(--error); }

.pronunciation-score {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
}

.pronunciation-detail {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
    line-height: 1.5;
}

.pronunciation-actions {
    display: flex;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}

.ai-tip {
    display: none;
    margin-top: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--surface);
    border-left: 3px solid var(--focus);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* === Vocab list in lesson === */
.vocab-list-item {
    padding: var(--space-md) 0;
    border-bottom: 1px solid var(--border-light);
}
.vocab-list-item:last-child { border-bottom: none; }

.vocab-list-word {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex-wrap: wrap;
    margin-bottom: 2px;
}
.vocab-list-word strong {
    font-size: 1rem;
}

.vocab-list-translation {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 2px;
}

.vocab-list-example {
    margin-top: var(--space-xs);
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    flex-wrap: wrap;
}

.vocab-audio-mic {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    margin-top: var(--space-sm);
}

/* === Cyrillic Alphabet === */
.alphabet-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}

.alphabet-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-xs);
}

.alphabet-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.alphabet-mode-toggle {
    display: flex;
    justify-content: center;
    gap: var(--space-xs);
}

.alpha-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: var(--space-sm);
}

.alpha-card {
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: var(--space-md);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 44px;
    box-shadow: var(--shadow-xs);
}
.alpha-card:hover {
    border-color: var(--serbian-mid);
    box-shadow: var(--shadow-sm);
}

.alpha-latin-primary {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--focus);
    line-height: 1;
}

.alpha-cyrillic-sub {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--serbian);
    margin-bottom: var(--space-xs);
}

.alpha-word-cyr {
    font-size: 0.78rem;
    color: var(--serbian-mid);
}

.alpha-ipa {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.alpha-example {
    font-size: 0.82rem;
    margin-bottom: 1px;
}

.alpha-word {
    font-weight: 600;
}

.alpha-word-lat {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--focus);
}

.alpha-meaning {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Quiz card */
.quiz-card {
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    box-shadow: var(--shadow-sm);
    max-width: 450px;
    margin: 0 auto;
}

.quiz-prompt {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: var(--space-lg);
}

.quiz-letter {
    font-family: var(--font-display);
    font-size: 5rem;
    color: var(--serbian);
    cursor: pointer;
    margin-bottom: var(--space-lg);
    line-height: 1;
    transition: color 0.15s;
}
.quiz-letter:hover { color: var(--serbian-mid); }

.quiz-answer {
    display: none;
    margin-bottom: var(--space-lg);
}
.quiz-answer.revealed { display: block; }

.quiz-answer-lat {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--focus);
    margin-bottom: var(--space-xs);
}

.quiz-answer-ipa {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.quiz-answer-example {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.quiz-actions {
    display: flex;
    justify-content: center;
    gap: var(--space-sm);
}

/* === Help box === */
.help-box {
    margin-top: var(--space-xl);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: var(--surface-raised);
    box-shadow: var(--shadow-sm);
}

.help-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    width: 100%;
    padding: var(--space-md) var(--space-lg);
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    min-height: 44px;
}
.help-toggle:hover {
    color: var(--text);
    background: var(--bg);
}
.help-icon { font-size: 1rem; }

.help-body {
    display: none;
    padding: 0 var(--space-lg) var(--space-lg);
}
.help-body.open { display: block; }

.help-input-area {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-start;
}

.help-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 0.88rem;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    resize: vertical;
    line-height: 1.5;
    background: var(--surface);
    color: var(--text);
}
.help-input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}

.help-response {
    display: none;
    margin-top: var(--space-md);
}

.help-answer {
    background: var(--surface);
    border-left: 3px solid var(--focus);
    border-radius: 0 var(--radius) var(--radius) 0;
    padding: var(--space-md) var(--space-lg);
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.65;
}

.help-loading {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: var(--space-sm) 0;
}

/* === Practice view === */
.practice-counter {
    font-size: 0.82rem;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: var(--space-sm);
    font-variant-numeric: tabular-nums;
}

.practice-card {
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
    box-shadow: var(--shadow-sm);
    max-width: 550px;
    margin: 0 auto var(--space-lg);
}

.practice-type {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}

.practice-text {
    font-family: var(--font-display);
    font-size: 1.75rem;
    margin-bottom: var(--space-sm);
    line-height: 1.3;
}

.practice-romanization {
    font-family: var(--font-mono);
    font-size: 1.15rem;
    color: var(--focus);
    font-weight: 500;
    margin-bottom: var(--space-sm);
}

.practice-translation {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.practice-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.practice-audio {
    width: 44px;
    height: 44px;
    font-size: 1rem;
}

.practice-nav {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
}

/* === Conversation Practice === */

/* Scenario picker */
.scenario-header {
    text-align: center;
    margin-bottom: var(--space-xl);
}
.scenario-header-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-xs);
}
.scenario-header-sub {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.scenario-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: var(--space-md);
}

.scenario-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    padding: var(--space-lg) var(--space-md);
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
    font-family: var(--font-body);
    min-height: 44px;
    touch-action: manipulation;
    box-shadow: var(--shadow-xs);
}
.scenario-card:hover {
    border-color: var(--border);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.scenario-emoji {
    font-size: 1.8rem;
    margin-bottom: var(--space-xs);
}
.scenario-title {
    font-family: var(--font-display);
    font-size: 1rem;
    line-height: 1.2;
}
.scenario-title-lat {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--focus);
}
.scenario-title-en {
    font-size: 0.78rem;
    color: var(--text-muted);
}
.scenario-desc {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 2px;
}
.scenario-level {
    font-size: 0.6rem;
    color: var(--text-muted);
    letter-spacing: 2px;
    margin-top: var(--space-xs);
}

/* Conversation header */
.conv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border-light);
}
.conv-header-title {
    font-family: var(--font-display);
    font-size: 1.05rem;
}

/* Chat area */
.conv-chat {
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    min-height: 200px;
    max-height: 50vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.conv-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}
.conv-message.tutor {
    align-self: flex-start;
}
.conv-message.student {
    align-self: flex-end;
}

.conv-bubble {
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.92rem;
    line-height: 1.5;
}
.conv-bubble.tutor {
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
    border-bottom-left-radius: 3px;
}
.conv-bubble.student {
    background: var(--text);
    color: var(--surface-raised);
    border-bottom-right-radius: 3px;
}

.conv-text {
    margin-bottom: 2px;
}
.conv-roman {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--focus);
    margin-top: 2px;
}
.conv-translation {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.conv-bubble.student .conv-translation {
    color: rgba(255,255,255,0.65);
}

.conv-feedback-inline {
    font-size: 0.8rem;
    color: var(--success);
    margin-top: 4px;
    padding-left: var(--space-sm);
}
.conv-corrections-inline {
    font-size: 0.8rem;
    color: var(--spanish);
    margin-top: 2px;
    padding-left: var(--space-sm);
}

/* Typing indicator */
.conv-typing {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: var(--space-md) var(--space-lg);
}
.conv-typing span {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: conv-dot 1.4s ease-in-out infinite;
}
.conv-typing span:nth-child(2) { animation-delay: 0.2s; }
.conv-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes conv-dot {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1); }
}

/* Hint bar */
.conv-hint {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.82rem;
    color: var(--text-secondary);
    background: var(--surface);
    border-left: 3px solid var(--focus);
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-top: var(--space-sm);
}

/* Input area */
.conv-input-area {
    margin-top: var(--space-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-md);
}

.conv-mic-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}
.conv-mic-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.conv-text-fallback {
    width: 100%;
    max-width: 500px;
}
.conv-text-input-row {
    display: flex;
    gap: var(--space-sm);
}
.conv-text-input {
    flex: 1;
    font-family: var(--font-body);
    font-size: 0.88rem;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-raised);
    color: var(--text);
    min-height: 44px;
}
.conv-text-input:focus {
    outline: none;
    border-color: var(--focus);
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.12);
}

/* Scorecard */
.conv-scorecard {
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-xl) var(--space-2xl);
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
    box-shadow: var(--shadow-md);
}

.scorecard-heading {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-lg);
}

.scorecard-score-ring {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto var(--space-lg);
}
.score-svg {
    width: 100%;
    height: 100%;
}
.scorecard-score-number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-size: 2.2rem;
    font-weight: 400;
}

.scorecard-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    text-align: left;
}
.scorecard-section {
    background: var(--bg);
    border-radius: var(--radius);
    padding: var(--space-md);
}
.scorecard-section-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
}
.scorecard-section p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.scorecard-list-section {
    text-align: left;
    margin-bottom: var(--space-md);
}
.scorecard-list {
    list-style: none;
    padding: 0;
}
.scorecard-list li {
    padding: var(--space-xs) 0;
    padding-left: var(--space-lg);
    position: relative;
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.scorecard-list li::before {
    position: absolute;
    left: 0;
    font-weight: 600;
}
.scorecard-list.strengths li::before { content: "+"; color: var(--success); }
.scorecard-list.improvements li::before { content: "\2192"; color: var(--spanish); }

.scorecard-vocab {
    text-align: left;
}
.scorecard-vocab-item {
    padding: var(--space-xs) 0;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border-light);
}
.scorecard-vocab-item:last-child { border-bottom: none; }
.scorecard-vocab-translation {
    color: var(--text-muted);
    font-size: 0.82rem;
}

.scorecard-encouragement {
    margin: var(--space-lg) 0;
    padding: var(--space-md) var(--space-lg);
    background: var(--success-light);
    border-radius: var(--radius);
    font-size: 0.92rem;
    color: var(--success);
    font-weight: 500;
}

.scorecard-actions {
    margin-top: var(--space-lg);
}

/* === Reduced motion === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .toast { transition: none; }
}

/* === Responsive === */
@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        gap: var(--space-xs);
        padding: var(--space-xs) var(--space-md);
    }
    .topbar-center { order: 3; width: 100%; }
    .nav-tabs {
        width: 100%;
        flex-wrap: wrap;
        gap: 0;
    }
    .nav-tab {
        white-space: nowrap;
        font-size: 0.8rem;
        padding: 0.4rem 0.7rem;
    }
    .nav-dropdown-trigger::after {
        border-left-width: 3px;
        border-right-width: 3px;
        border-top-width: 3.5px;
        margin-left: 4px;
    }
    .nav-dropdown-menu {
        left: 0;
        transform: none;
    }
    .content { padding: var(--space-lg) var(--space-md); }
    .skills-grid { grid-template-columns: 1fr; }
    .lesson-title { font-size: 1.3rem; }
    .practice-text { font-size: 1.3rem; }
    .scenario-grid { grid-template-columns: 1fr 1fr; }
    .conv-message { max-width: 90%; }
    .scorecard-sections { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .scenario-grid { grid-template-columns: 1fr; }
    .alpha-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
    .lang-card { padding: var(--space-lg); }
}


/* ==========================================================
   Landing page
   ========================================================== */

.landing-body {
    min-height: 100dvh;
}

.landing-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-xl);
    background: var(--surface-raised);
    border-bottom: 1px solid var(--border-light);
}

.landing-nav .logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text);
    text-decoration: none;
}

/* Hero */
.landing-hero {
    max-width: 640px;
    margin: 0 auto;
    padding: var(--space-2xl) var(--space-xl);
    text-align: center;
}

.landing-hero h1 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--space-lg);
    color: var(--text);
}

.landing-hero-sub {
    font-size: 1.15rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

.landing-hero-note {
    margin-top: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-lg {
    font-size: 1rem;
    padding: 0.75rem 2rem;
}

/* Features */
.landing-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-xl) var(--space-2xl);
}

.landing-feature {
    padding: var(--space-lg);
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.landing-feature h3 {
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.landing-feature p {
    font-size: 0.92rem;
    color: var(--text-secondary);
    line-height: 1.55;
}

/* Steps */
.landing-steps {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-xl) var(--space-2xl);
}

.landing-steps h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: var(--space-xl);
}

.landing-steps-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.landing-steps-list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
}

.step-num {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--text);
    color: var(--surface-raised);
    border-radius: 50%;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}

.landing-steps-list strong {
    display: block;
    font-weight: 600;
    margin-bottom: 2px;
}

.landing-steps-list p {
    color: var(--text-secondary);
    font-size: 0.92rem;
}

/* Bottom CTA */
.landing-cta {
    text-align: center;
    padding: var(--space-2xl) var(--space-xl);
    background: var(--surface);
    border-top: 1px solid var(--border-light);
}

.landing-cta h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.landing-cta p {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

/* Footer */
.landing-footer {
    text-align: center;
    padding: var(--space-lg) var(--space-xl);
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border-light);
}

/* Auth modal */
.auth-modal {
    max-width: 400px;
}

.auth-modal-body {
    text-align: center;
}

.auth-modal-body h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.92rem;
    margin-bottom: var(--space-lg);
}

.auth-input {
    display: block;
    width: 100%;
    padding: 0.65rem 0.85rem;
    font-family: var(--font-body);
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    margin-bottom: var(--space-md);
    min-height: 44px;
}

.auth-input:focus {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
    border-color: var(--focus);
}

.auth-submit {
    width: 100%;
}

.auth-message {
    padding: var(--space-md);
    border-radius: var(--radius);
    font-size: 0.92rem;
}

.auth-message-ok {
    background: var(--success-light);
    color: var(--success);
}

.auth-message-err {
    background: var(--error-light);
    color: var(--error);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Landing responsive */
@media (max-width: 768px) {
    .landing-hero h1 { font-size: 1.8rem; }
    .landing-features { grid-template-columns: 1fr; }
    .landing-hero { padding: var(--space-xl) var(--space-md); }
    .landing-features { padding: var(--space-lg) var(--space-md); }
    .landing-steps { padding: var(--space-lg) var(--space-md); }
    .landing-cta { padding: var(--space-xl) var(--space-md); }
}

/* --- Step selector (temp testing UI) --- */
.step-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    font-size: 0.85rem;
    box-shadow: var(--shadow-xs);
}
.step-selector-label {
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.25rem;
}
.step-selector-info {
    margin-left: auto;
    color: var(--text-muted);
    font-size: 0.8rem;
}
.step-btn.active {
    background: var(--focus);
    color: #fff;
    box-shadow: 0 2px 8px rgba(234,88,12,0.3);
}

/* ==========================================================
   Placement Quiz
   ========================================================== */

.quiz-prompt-banner {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    background: var(--surface-raised);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    margin-bottom: var(--space-md);
    font-size: 0.9rem;
}
.quiz-prompt-banner span { flex: 1; }

.quiz-start {
    max-width: 480px;
    margin: var(--space-2xl) auto;
    text-align: center;
}
.quiz-start-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    margin-bottom: var(--space-sm);
}
.quiz-start-desc {
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
    line-height: 1.6;
}
.quiz-lang-pick {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    margin-bottom: var(--space-xl);
}
.quiz-lang-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-lg) var(--space-xl);
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: var(--font-body);
    box-shadow: var(--shadow-sm);
}
.quiz-lang-btn:hover {
    border-color: var(--border);
    box-shadow: var(--shadow-md);
}
.quiz-lang-flag {
    font-size: 2rem;
}
.quiz-lang-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.quiz-prev-result {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--surface);
    border-radius: var(--radius);
    margin-top: var(--space-sm);
    font-size: 0.85rem;
}
.quiz-prev-level {
    font-weight: 700;
    font-family: var(--font-mono);
}
.quiz-prev-detail {
    color: var(--text-muted);
    flex: 1;
}
.quiz-prev-date {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Quiz: loading */
.quiz-loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-muted);
}

/* Quiz: header + progress */
.quiz-header {
    max-width: 600px;
    margin: var(--space-lg) auto var(--space-md);
}
.quiz-meta {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-sm);
}
.quiz-phase-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}
.quiz-level-badge {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.15em 0.5em;
}
.quiz-progress {
    height: 4px;
    background: var(--border-light);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: var(--space-xs);
}
.quiz-progress-bar {
    height: 100%;
    background: var(--focus);
    border-radius: 2px;
    transition: width 0.4s ease;
}
.quiz-q-num {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Quiz: question card */
.quiz-target {
    max-width: 600px;
    margin: var(--space-md) auto;
    padding: var(--space-md) var(--space-lg);
    background: var(--surface);
    border-radius: var(--radius-lg);
    text-align: center;
    font-family: var(--font-display);
    font-size: 1.25rem;
}
.quiz-roman {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}
.quiz-prompt {
    max-width: 600px;
    margin: var(--space-sm) auto var(--space-md);
    font-size: 1.05rem;
    text-align: center;
    line-height: 1.6;
}
.quiz-options {
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.quiz-option {
    padding: var(--space-md);
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.95rem;
    font-family: var(--font-body);
    text-align: left;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    box-shadow: var(--shadow-xs);
}
.quiz-option:hover:not(:disabled) {
    border-color: var(--focus);
    background: rgba(234, 88, 12, 0.04);
    box-shadow: var(--shadow-sm);
}
.quiz-option:disabled {
    cursor: default;
    opacity: 0.85;
}
.quiz-option.selected {
    border-color: var(--focus);
    background: rgba(234, 88, 12, 0.06);
}
.quiz-option.correct {
    border-color: var(--success);
    background: var(--success-light);
}
.quiz-option.wrong {
    border-color: var(--error);
    background: var(--error-light);
}

/* Quiz: feedback */
.quiz-feedback {
    max-width: 480px;
    margin: var(--space-sm) auto 0;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    font-size: 0.85rem;
    animation: fadeIn 0.2s ease;
}
.quiz-feedback.correct {
    background: var(--success-light);
    color: var(--success);
}
.quiz-feedback.wrong {
    background: var(--error-light);
    color: var(--error);
}
.quiz-feedback-icon {
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.quiz-next-btn {
    display: block;
    margin: var(--space-md) auto 0;
}

/* Quiz: transition screen */
.quiz-transition {
    max-width: 480px;
    margin: var(--space-2xl) auto;
    text-align: center;
}
.quiz-transition-result {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-xl);
}
.quiz-transition-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}
.quiz-transition-level {
    font-family: var(--font-mono);
    font-size: 2.5rem;
    font-weight: 700;
}
.quiz-transition-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.quiz-transition-text {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}
.quiz-transition-scenario {
    font-style: italic;
    color: var(--text-muted);
    margin-bottom: var(--space-xl);
}

/* Quiz: conversation */
.quiz-chat {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-md) 0;
}
.quiz-bubble {
    max-width: 85%;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    line-height: 1.5;
}
.quiz-bubble.tutor {
    align-self: flex-start;
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-xs);
}
.quiz-bubble.student {
    align-self: flex-end;
    background: var(--focus);
    color: #fff;
}
.quiz-bubble-roman {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
}
.quiz-bubble-trans {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 2px;
    font-style: italic;
}
.quiz-bubble.typing {
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    padding: var(--space-md);
    box-shadow: var(--shadow-xs);
}
.typing-dots {
    display: flex;
    gap: 4px;
}
.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typingBounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

.quiz-corrections {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-light);
    font-size: 0.8rem;
}
.quiz-correction {
    margin-bottom: 2px;
}
.quiz-corr-orig {
    text-decoration: line-through;
    color: var(--error);
}
.quiz-corr-fix {
    font-weight: 600;
    color: var(--success);
}
.quiz-corr-note {
    color: var(--text-muted);
    font-style: italic;
}

.quiz-input-row {
    max-width: 600px;
    margin: var(--space-md) auto 0;
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}
.quiz-abandon-btn {
    width: 100%;
    opacity: 0.6;
    font-size: 0.8rem;
}
.quiz-input {
    flex: 1;
    padding: var(--space-sm) var(--space-md);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--surface-raised);
}
.quiz-input:focus {
    border-color: var(--focus);
    outline: none;
}
.quiz-send-btn {
    flex-shrink: 0;
}
.quiz-mic-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    width: 100%;
    padding: var(--space-md);
    background: var(--surface-raised);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: var(--text-secondary);
    font-size: 0.85rem;
}
.quiz-mic-btn:hover { border-color: var(--focus); }
.quiz-mic-btn.recording {
    border-color: var(--error, #C0392B);
    background: #FDF2F2;
    animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.15); }
    50% { box-shadow: 0 0 0 10px rgba(192,57,43,0); }
}
.quiz-mic-btn svg { color: var(--text); }
.quiz-mic-btn.recording svg { color: var(--error, #C0392B); }
.quiz-phone-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35em;
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    margin-top: var(--space-xs);
}
.quiz-phone-link:hover { color: var(--focus); }
.qr-modal {
    max-width: 320px;
    text-align: center;
    padding: var(--space-lg);
}
.qr-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    margin-bottom: var(--space-xs);
}
.qr-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
}
.qr-code { display: flex; justify-content: center; }
.qr-code svg { border-radius: var(--radius); }
.quiz-finish-row {
    max-width: 600px;
    margin: var(--space-lg) auto;
    text-align: center;
}

/* Quiz: result screen */
.quiz-result {
    max-width: 420px;
    margin: var(--space-xl) auto;
    text-align: center;
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
}
.quiz-result-header {
    margin-bottom: var(--space-lg);
}
.quiz-result-flag {
    font-size: 2rem;
}
.quiz-result-title {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-top: var(--space-xs);
}
.quiz-result-level-ring {
    position: relative;
    width: 140px;
    height: 140px;
    margin: var(--space-lg) auto;
}
.quiz-ring-svg {
    width: 100%;
    height: 100%;
}
.quiz-ring-svg circle:last-child {
    stroke: var(--focus);
}
.quiz-ring-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.quiz-ring-cefr {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.6rem;
}
.quiz-ring-int {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.quiz-result-desc {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}
.quiz-result-breakdown {
    display: flex;
    justify-content: center;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}
.quiz-breakdown-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.quiz-breakdown-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}
.quiz-breakdown-value {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.3rem;
}
.quiz-result-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    align-items: center;
}

/* Section stepper */
.quiz-stepper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}
.quiz-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    opacity: 0.4;
    transition: opacity 0.2s;
}
.quiz-step.active {
    opacity: 1;
}
.quiz-step.done {
    opacity: 0.7;
}
.quiz-step-icon {
    font-size: 1.2rem;
}
.quiz-step-name {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    white-space: nowrap;
}
.quiz-step.active .quiz-step-name {
    color: var(--accent);
    font-weight: 600;
}
.quiz-step.done .quiz-step-name {
    text-decoration: line-through;
}
.quiz-step-line {
    width: 20px;
    height: 2px;
    background: var(--border);
    margin: 0 4px;
    align-self: center;
    margin-bottom: 14px;
}
.quiz-header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.quiz-skip-btn {
    font-size: 0.75rem;
    opacity: 0.6;
    padding: 2px 8px;
}

/* Writing section */
.quiz-writing {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}
.quiz-writing-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}
.quiz-writing-input {
    width: 100%;
    min-height: 120px;
    padding: var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    background: var(--bg-card);
    color: var(--text);
    resize: vertical;
}
.quiz-writing-input:focus {
    outline: none;
    border-color: var(--accent);
}
.quiz-writing-feedback {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    animation: fadeIn 0.3s ease;
}
.quiz-writing-score {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}
.quiz-writing-cefr {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--accent);
}
.quiz-writing-pts {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.quiz-writing-fb-text {
    font-size: 0.9rem;
    line-height: 1.5;
}

/* Listening section */
.quiz-listening {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    margin-bottom: var(--space-md);
}
.quiz-audio-player {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    border-radius: 28px;
    width: 100%;
    max-width: 360px;
}
.quiz-audio-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    background: var(--focus);
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 1.1rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}
.quiz-audio-btn:hover { opacity: 0.85; }
.quiz-audio-btn:disabled { opacity: 0.5; cursor: default; }
#quiz-audio-restart {
    background: var(--surface);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    width: 34px;
    height: 34px;
    font-size: 1.1rem;
}
#quiz-audio-restart:hover { background: var(--border-light); }
.quiz-audio-progress {
    flex: 1;
    height: 6px;
    background: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
}
.quiz-audio-bar {
    height: 100%;
    width: 0%;
    background: var(--focus);
    border-radius: 3px;
    transition: width 0.15s linear;
}
.quiz-listen-icon { font-size: 1.1rem; line-height: 1; }
.quiz-listening-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Section transition */
.quiz-transition-next {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    justify-content: center;
    margin: var(--space-md) 0;
}
.quiz-transition-icon {
    font-size: 2rem;
}
.quiz-transition-next h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
}

/* Breakdown with icons */
.quiz-breakdown-icon {
    font-size: 1rem;
    margin-right: 4px;
}
.quiz-prev-sections {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin-top: 4px;
}
.quiz-prev-section {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg);
    padding: 1px 6px;
    border-radius: var(--radius-sm);
}

/* Quiz finish row */
.quiz-finish-row {
    text-align: center;
    padding: var(--space-md);
}

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

/* =============================================================
   Language picker (onboarding)
   ============================================================= */

.lang-picker-prompt {
    text-align: center;
    padding: var(--space-xl) 0;
}
.lang-picker-prompt h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
}
.lang-picker-prompt p {
    color: var(--muted);
    margin-bottom: var(--space-lg);
}

.lang-catalog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-sm);
    max-width: 700px;
    margin: 0 auto;
}
.lang-catalog-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xxs);
    padding: var(--space-md) var(--space-sm);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.lang-catalog-card:hover {
    border-color: var(--focus);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}
.lang-catalog-flag {
    font-size: 2rem;
}
.lang-catalog-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.lang-catalog-native {
    color: var(--muted);
    font-size: 0.8rem;
}

/* Onboarding progress indicator */
.onboarding-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--space-lg);
}
.onboarding-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.3s;
}
.onboarding-dot.active {
    background: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent);
}
.onboarding-dot.done {
    background: var(--success, #4caf50);
}
.onboarding-line {
    width: 40px;
    height: 2px;
    background: var(--border);
}
.onboarding-step2 {
    text-align: center;
    padding: var(--space-xl) 0;
    animation: fadeIn 0.3s ease;
}
.onboarding-step2 h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: var(--space-xs);
}
.onboarding-step2 p {
    color: var(--muted);
    margin-bottom: var(--space-lg);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}
.onboarding-check {
    font-size: 3rem;
    margin-bottom: var(--space-sm);
}
.onboarding-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
}

/* Dashboard add-language card */
.lang-card-add {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 2px dashed var(--border);
    background: transparent;
}

/* =============================================================
   Settings view
   ============================================================= */

.settings-section {
    max-width: 600px;
    margin: 0 auto;
}
.settings-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: var(--space-lg);
}
.settings-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
}
.settings-card-title {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    margin-bottom: var(--space-sm);
}
.settings-card-subtitle {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: var(--space-md);
    margin-bottom: var(--space-xs);
}
.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
    border-bottom: 1px solid var(--border);
}
.settings-row:last-child { border-bottom: none; }
.settings-label { color: var(--muted); font-size: 0.9rem; }
.settings-value { font-weight: 600; }
.settings-value-ok { color: var(--success, #2e7d32); }
.settings-desc {
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: var(--space-sm);
}
.settings-note {
    font-size: 0.8rem;
    color: var(--muted);
    font-style: italic;
    margin-top: var(--space-xs);
}
.settings-empty {
    color: var(--muted);
    font-size: 0.9rem;
}
.settings-lang-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}
.settings-lang-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-xs) 0;
}

.lang-search-input {
    margin-bottom: var(--space-sm);
    width: 100%;
    max-width: 280px;
}
.lang-catalog-grid-sm {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--space-xs);
}
.lang-catalog-card-sm {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: border-color 0.15s;
}
.lang-catalog-card-sm:hover:not(:disabled) { border-color: var(--focus); }
.lang-catalog-card-sm:disabled { opacity: 0.4; cursor: not-allowed; }
.lang-catalog-card-sm .lang-catalog-flag { font-size: 1.2rem; }

.api-key-form {
    display: flex;
    gap: var(--space-xs);
}
.api-key-form .input {
    flex: 1;
    padding: var(--space-xs) var(--space-sm);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    background: var(--bg);
    color: var(--fg);
}

.btn-danger {
    color: #c62828;
    border-color: #c62828;
}
.btn-danger:hover { background: #c62828; color: #fff; }

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xxs) var(--space-xs);
    background: transparent;
    box-shadow: none;
    color: var(--text-muted);
}
.btn-icon:hover {
    background: var(--surface);
    box-shadow: none;
    color: var(--text);
}

/* === Library === */

.library-toolbar {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-md);
    flex-wrap: wrap;
}

.library-search-wrap {
    position: relative;
    flex: 1;
    min-width: 180px;
}

.library-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

.library-search {
    width: 100%;
    padding: 0.55rem 0.75rem 0.55rem 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    background: var(--surface-raised);
    color: var(--text);
    transition: border-color 0.15s;
}
.library-search:focus {
    outline: none;
    border-color: var(--focus);
}

.library-select {
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    background: var(--surface-raised);
    color: var(--text);
    cursor: pointer;
}

.library-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: var(--space-md);
}

.library-tag-chip {
    padding: 0.3rem 0.7rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.library-tag-chip:hover {
    border-color: var(--focus);
    color: var(--focus);
}
.library-tag-chip.active {
    background: var(--focus);
    color: #fff;
    border-color: var(--focus);
}

.library-count {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--space-md);
    min-height: 100px;
}

.library-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--surface-raised);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.library-card:hover {
    border-color: var(--focus);
    box-shadow: var(--shadow-sm);
}

.library-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.library-card-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.level-badge-sm {
    padding: 0.15rem 0.5rem;
    font-size: 0.6875rem;
    background: var(--surface);
    color: var(--text-secondary);
}

.library-card-title {
    font-weight: 600;
    font-size: 0.9375rem;
    line-height: 1.3;
    color: var(--text);
}

.library-card-focus {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.library-card-tags {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 2px;
}

.library-card-tag {
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    font-size: 0.6875rem;
    background: var(--surface);
    color: var(--text-secondary);
}

.library-load-more {
    display: flex;
    justify-content: center;
    margin-top: var(--space-lg);
}

/* === Topic modal === */

.topic-modal {
    max-width: 440px;
}

.topic-modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-sm);
    padding-right: var(--space-xl);
}

.topic-modal-desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: var(--space-lg);
}

.topic-modal-input {
    width: 100%;
    margin-bottom: var(--space-lg);
}

.topic-modal-actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

.btn-topic {
    border-style: dashed;
}

/* Library responsive */
@media (max-width: 640px) {
    .library-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    .library-select {
        width: 100%;
    }
    .library-grid {
        grid-template-columns: 1fr;
    }
}

/* === Progress Stats === */

.progress-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    max-width: 800px;
    margin: 0 auto;
}

.progress-card {
    background: var(--card-bg, var(--bg));
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.progress-card-wide {
    grid-column: 1 / -1;
}

.progress-card-title {
    font-size: 0.9375rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin-bottom: var(--space-xs);
}

.progress-card-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.progress-empty-hint {
    font-size: 0.8125rem;
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-xl) 0;
}

.progress-card svg {
    width: 100%;
    display: block;
    margin: 0 auto;
}

.progress-card svg text {
    font-family: 'Inter', var(--font-body), sans-serif;
}

/* Character pad */
.charpad {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 0;
    flex-wrap: wrap;
}
.charpad-keys {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.charpad-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
}
.charpad-key:hover {
    background: var(--card-bg);
    border-color: var(--accent);
}
.charpad-key:active {
    transform: scale(0.92);
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Accent-lenient answer hint */
.fill-in-input.accent-warn {
    border-color: #c49020;
    background: #fdf6e3;
}
.accent-hint {
    color: #946b00;
    font-weight: 500;
}

@media (max-width: 640px) {
    .charpad-key {
        min-width: 32px;
        height: 30px;
        font-size: 0.85rem;
        padding: 0 6px;
    }
}

/* Lieflat-style animations */
.pg-fade { animation: pgFade 0.7s ease both; }
.pg-pop { transform-box: fill-box; transform-origin: center; animation: pgPop 0.5s cubic-bezier(0.2, 0.7, 0.3, 1.3) both; }
.pg-draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: pgDraw 1s cubic-bezier(0.4, 0, 0.2, 1) both; }

@keyframes pgFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pgPop { from { transform: scale(0); } to { transform: none; } }
@keyframes pgDraw { to { stroke-dashoffset: 0; } }

@media (max-width: 640px) {
    .progress-grid {
        grid-template-columns: 1fr;
    }
    .progress-card-wide {
        grid-column: 1;
    }
}
