/* ===== PIN Lock Screen ===== */
.pin-screen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #5b4bb5 0%, #7c6dd8 50%, #9b8ec4 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}
.pin-screen.hidden { display: none; }
.pin-container {
    text-align: center;
    padding: 2rem;
    max-width: 320px;
    width: 100%;
}
.pin-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    animation: pinBounce 2s ease infinite;
}
@keyframes pinBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}
.pin-title {
    font-family: 'Lexend', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    margin-bottom: 0.25rem;
}
.pin-subtitle {
    font-family: 'Lexend', sans-serif;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.7);
    margin-bottom: 1.5rem;
}
.pin-dots {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}
.pin-dot {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2.5px solid rgba(255,255,255,0.5);
    background: transparent;
    transition: all 0.2s;
}
.pin-dot.filled {
    background: #fff;
    border-color: #fff;
    transform: scale(1.15);
}
.pin-dot.correct {
    background: #55efc4;
    border-color: #55efc4;
}
.pin-dot.wrong {
    background: #ff6b6b;
    border-color: #ff6b6b;
}
.pin-dots.shake {
    animation: pinShake 0.4s ease;
}
@keyframes pinShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-8px); }
    80% { transform: translateX(8px); }
}
.pin-error {
    font-family: 'Lexend', sans-serif;
    font-size: 0.8rem;
    color: #ff6b6b;
    margin-bottom: 0.5rem;
    min-height: 1.2em;
}
.pin-error.hidden { visibility: hidden; }
.pin-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
    max-width: 260px;
    margin: 1rem auto 0;
}
.pin-key {
    font-family: 'Lexend', sans-serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #fff;
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 50%;
    width: 64px;
    height: 64px;
    margin: 0 auto;
    cursor: pointer;
    transition: all 0.15s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.pin-key:hover { background: rgba(255,255,255,0.25); }
.pin-key:active {
    background: rgba(255,255,255,0.35);
    transform: scale(0.93);
}
.pin-key-empty {
    visibility: hidden;
    pointer-events: none;
}
.pin-key-delete {
    font-size: 1.2rem;
    color: rgba(255,255,255,0.7);
}

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

:root {
    /* Warm cream/beige palette — easier on dyslexic readers (reduces visual stress) */
    --bg: #fdf6e3;
    --bg-light: #f5eedc;
    --surface: #fff8ee;
    --surface-hover: #f0e6d2;
    --text: #2c2416;
    --text-muted: #7a6e5d;
    --accent: #5b4bb5;
    --accent-glow: rgba(91, 75, 181, 0.2);
    --success: #2a9d8f;
    --success-glow: rgba(42, 157, 143, 0.2);
    --error: #d94f4f;
    --error-glow: rgba(217, 79, 79, 0.2);
    --warning: #e6a817;
    --radius: 12px;
    --radius-sm: 8px;
    --font: 'Lexend', sans-serif;
    --letter-size: 56px;
    --transition: 0.2s ease;
}

html {
    font-size: 18px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    letter-spacing: 0.02em;
    -webkit-font-smoothing: antialiased;
}

/* ===== App Shell ===== */
.app {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== Header ===== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.logo-accent {
    color: var(--accent);
}

.stats {
    display: flex;
    gap: 1.5rem;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ===== Screens ===== */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.screen {
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1;
}

.screen.active {
    display: flex;
}

.screen-title {
    font-size: 1.3rem;
    font-weight: 600;
    text-align: center;
    color: var(--text);
}

/* ===== Category Grid ===== */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.category-card {
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.category-card:hover,
.category-card:focus-visible {
    border-color: var(--card-color, var(--accent));
    background: var(--surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.category-icon {
    font-size: 2rem;
}

.category-name {
    font-size: 1.1rem;
    font-weight: 600;
}

.category-count {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ===== Game Top Bar ===== */
.game-top {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.category-label {
    font-weight: 600;
    font-size: 1rem;
}

.word-counter {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ===== Hint Area ===== */
.hint-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--surface);
    border-radius: var(--radius);
}

.hint-text {
    font-size: 0.95rem;
    color: var(--text-muted);
    text-align: center;
    min-height: 1.6em;
    letter-spacing: 0.03em;
}

.hint-text .syllable {
    display: inline-block;
    background: rgba(91, 75, 181, 0.15);
    border: 1px solid rgba(91, 75, 181, 0.3);
    padding: 0.15rem 0.5rem;
    border-radius: 6px;
    margin: 0.1rem 0.15rem;
    font-weight: 500;
    color: var(--text);
    letter-spacing: 0.06em;
}

/* ===== Drop Zone ===== */
.drop-zone {
    background: var(--bg-light);
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: var(--radius);
    min-height: 100px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    position: relative;
}

.drop-zone.drag-over {
    border-color: var(--accent);
    background: rgba(91, 75, 181, 0.08);
}

.drop-zone.correct {
    border-color: var(--success);
    background: rgba(42, 157, 143, 0.08);
}

.drop-zone.incorrect {
    border-color: var(--error);
    background: rgba(217, 79, 79, 0.08);
}

.drop-placeholder {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.drop-slots {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

/* ===== Letter Tiles ===== */
.letter-tile {
    width: var(--letter-size);
    height: var(--letter-size);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: grab;
    user-select: none;
    transition: all var(--transition);
    text-transform: lowercase;
    letter-spacing: 0.05em;
    position: relative;
}

.letter-tile:active {
    cursor: grabbing;
}

/* Tiles in the bank */
.letter-bank .letter-tile {
    background: var(--surface);
    border: 2px solid rgba(0, 0, 0, 0.1);
    color: var(--text);
}

.letter-bank .letter-tile:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
}

.letter-bank .letter-tile.used {
    opacity: 0.25;
    pointer-events: none;
    transform: scale(0.9);
}

/* Tiles in the drop zone */
.drop-slots .letter-tile {
    background: var(--accent);
    border: 2px solid transparent;
    color: white;
    animation: tilePlace 0.2s ease;
}

.drop-slots .letter-tile:hover {
    background: #4a3ba5;
    transform: translateY(-2px);
}

/* Empty slot placeholder */
.drop-slot-empty {
    width: var(--letter-size);
    height: var(--letter-size);
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Correct/Incorrect tile states */
.letter-tile.correct {
    background: var(--success) !important;
    border-color: var(--success) !important;
}

.letter-tile.incorrect {
    background: var(--error) !important;
    border-color: var(--error) !important;
    animation: shake 0.4s ease;
}

@keyframes tilePlace {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ===== Letter Bank ===== */
.letter-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 1rem;
}

/* ===== Buttons ===== */
.btn {
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: 0.03em;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #4a3ba5;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-check {
    background: var(--accent);
    color: white;
    flex: 1;
    justify-content: center;
    font-size: 1rem;
    padding: 0.85rem;
}

.btn-check:hover {
    background: #4a3ba5;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-clear {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.btn-clear:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-danger {
    background: #d63031;
    color: #fff;
}

.btn-danger:hover {
    background: #e74c3c;
}

.settings-reset-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-top: 0.5rem;
}

.btn-back {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-back:hover {
    color: var(--text);
}

.btn-hear {
    background: var(--surface-hover);
    color: var(--accent);
    border: 1px solid rgba(91, 75, 181, 0.3);
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
}

.btn-hear:hover {
    background: rgba(91, 75, 181, 0.1);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-hear:active {
    transform: scale(0.95);
}

.btn-hint {
    background: rgba(91, 75, 181, 0.12);
    color: var(--accent);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.6rem 1.5rem;
    border: 2px solid rgba(91, 75, 181, 0.3);
}

.btn-hint:hover {
    color: var(--accent);
    background: rgba(91, 75, 181, 0.15);
    border-color: rgba(91, 75, 181, 0.35);
}

.btn-next {
    background: var(--success);
    color: #ffffff;
    font-weight: 600;
    flex: 1;
    justify-content: center;
    font-size: 1rem;
    padding: 0.85rem;
}

.btn-next:hover {
    box-shadow: 0 4px 16px var(--success-glow);
}

.actions {
    display: flex;
    gap: 0.75rem;
}

/* ===== Feedback ===== */
.feedback {
    text-align: center;
    padding: 1rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.03em;
    animation: fadeIn 0.3s ease;
}

.feedback.success {
    background: rgba(42, 157, 143, 0.1);
    color: var(--success);
    border: 1px solid rgba(42, 157, 143, 0.2);
}

.feedback.error {
    background: rgba(217, 79, 79, 0.1);
    color: var(--error);
    border: 1px solid rgba(217, 79, 79, 0.2);
}

.feedback-main {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.feedback-tip {
    font-weight: 400;
    font-size: 0.95rem;
    color: #8b6914;
    line-height: 1.5;
    padding-top: 0.4rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 0.2rem;
}

.feedback.error .feedback-tip {
    color: #8b6914;
}

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

.hidden {
    display: none !important;
}

/* ===== Result Screen ===== */
.result-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: center;
    margin-top: 2rem;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.result-stats {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}

.result-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.result-stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.result-stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.result-actions {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
}

/* ===== Mode Tabs ===== */
.mode-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--surface);
    border-radius: var(--radius);
    padding: 0.25rem;
    align-self: center;
}

.mode-tab {
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.6rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    transition: all var(--transition);
    letter-spacing: 0.03em;
}

.mode-tab.active {
    background: var(--accent);
    color: white;
}

.mode-tab:hover:not(.active) {
    color: var(--text);
    background: var(--surface-hover);
}

/* ===== Review Banner ===== */
.review-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(91, 75, 181, 0.15), rgba(42, 157, 143, 0.1));
    border: 1px solid rgba(91, 75, 181, 0.25);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    animation: fadeIn 0.3s ease;
}

.review-banner-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.review-banner-icon {
    font-size: 1.5rem;
}

.review-banner-text {
    font-size: 0.9rem;
    color: var(--text);
}

.review-banner-text strong {
    color: var(--accent);
    font-size: 1.1rem;
}

.btn-review {
    background: var(--accent);
    color: white;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.55rem 1.25rem;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.btn-review:hover {
    background: #4a3ba5;
    box-shadow: 0 4px 16px var(--accent-glow);
}

/* ===== Flashcard ===== */
.flashcard-container {
    perspective: 1000px;
    display: flex;
    justify-content: center;
    flex: 1;
    min-height: 300px;
    align-items: center;
}

.flashcard {
    width: 100%;
    max-width: 500px;
    min-height: 320px;
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.flashcard.flipped {
    transform: rotateY(180deg);
}

.flashcard-front,
.flashcard-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2rem;
}

.flashcard-front {
    background: linear-gradient(145deg, var(--surface), var(--surface-hover));
    border: 2px solid rgba(0, 0, 0, 0.08);
}

.flashcard-back {
    background: linear-gradient(145deg, #ede4d4, #e8dcc8);
    border: 2px solid rgba(91, 75, 181, 0.25);
    transform: rotateY(180deg);
}

.flashcard-hear {
    border: none !important;
    padding: 0.5rem !important;
}

.flashcard-word {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
    line-height: 1.3;
    color: var(--text);
}

.flashcard-hint {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 350px;
    line-height: 1.5;
}

.flashcard-tap {
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.4);
    margin-top: 0.5rem;
}

.flashcard-syllables {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.flashcard-syllables .syllable {
    display: inline-block;
    background: rgba(91, 75, 181, 0.2);
    border: 1px solid rgba(91, 75, 181, 0.4);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
    letter-spacing: 0.06em;
}

.flashcard-spelling {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: var(--success);
    text-align: center;
}

/* ===== Flash Spell-Along ===== */
.flash-spell-along {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 0;
}

.flash-spell-along.hidden {
    display: none;
}

.flash-spell-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.flash-spell-letters {
    display: flex;
    gap: 0.35rem;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 2.8rem;
}

.flash-spell-slot {
    width: 2.4rem;
    height: 2.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    font-family: var(--font);
    text-transform: lowercase;
    border-radius: var(--radius-sm);
    border: 2px solid rgba(0, 0, 0, 0.12);
    background: var(--surface);
    color: var(--text-muted);
    transition: all 0.25s ease;
}

.flash-spell-slot.current {
    border-color: var(--accent);
    background: rgba(91, 75, 181, 0.08);
    box-shadow: 0 0 0 3px rgba(91, 75, 181, 0.15);
}

.flash-spell-slot.correct {
    border-color: var(--success);
    background: rgba(42, 157, 143, 0.12);
    color: var(--success);
    font-weight: 700;
}

.flash-spell-slot.incorrect {
    border-color: var(--error);
    background: rgba(217, 79, 79, 0.1);
    color: var(--error);
}

.flash-spell-slot.filled {
    color: var(--text);
}

.flash-spell-input-row {
    display: flex;
    justify-content: center;
}

.flash-spell-input {
    width: 3rem;
    height: 3rem;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: var(--font);
    text-align: center;
    text-transform: lowercase;
    border: 2px solid var(--accent);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    outline: none;
    caret-color: var(--accent);
}

.flash-spell-input:focus {
    box-shadow: 0 0 0 3px rgba(91, 75, 181, 0.2);
}

.flash-spell-result {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    animation: fadeIn 0.3s ease;
}

.flash-spell-result.success {
    color: var(--success);
    background: rgba(42, 157, 143, 0.1);
}

.flash-spell-result.retry {
    color: var(--error);
    background: rgba(217, 79, 79, 0.08);
}

/* ===== Flash Rating ===== */
.flash-rating {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.flash-rating.visible {
    opacity: 1;
    pointer-events: auto;
}

.flash-rating-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.flash-rating-buttons {
    display: flex;
    gap: 0.75rem;
}

.btn-rating {
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.75rem 2rem;
    border: 2px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-rating-hard {
    background: rgba(217, 79, 79, 0.15);
    color: var(--error);
    border-color: rgba(217, 79, 79, 0.3);
}

.btn-rating-hard:hover {
    background: rgba(217, 79, 79, 0.25);
    box-shadow: 0 4px 16px var(--error-glow);
}

.btn-rating-ok {
    background: rgba(230, 168, 23, 0.15);
    color: var(--warning);
    border-color: rgba(230, 168, 23, 0.3);
}

.btn-rating-ok:hover {
    background: rgba(230, 168, 23, 0.25);
    box-shadow: 0 4px 16px rgba(230, 168, 23, 0.3);
}

.btn-rating-easy {
    background: rgba(42, 157, 143, 0.15);
    color: var(--success);
    border-color: rgba(42, 157, 143, 0.3);
}

.btn-rating-easy:hover {
    background: rgba(42, 157, 143, 0.25);
    box-shadow: 0 4px 16px var(--success-glow);
}

/* ===== Category Card Review Badge ===== */
.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.7rem;
    color: var(--accent);
    background: rgba(91, 75, 181, 0.15);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    margin-top: 0.25rem;
    width: fit-content;
}

/* ===== Lesson Screen ===== */
.lesson-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.lesson-section.hidden {
    display: none !important;
}

/* Rule Card */
.lesson-rule-card {
    background: linear-gradient(135deg, rgba(91, 75, 181, 0.12), rgba(42, 157, 143, 0.08));
    border: 1px solid rgba(91, 75, 181, 0.2);
    border-radius: var(--radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.lesson-rule-heading {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    font-weight: 600;
}

.lesson-rule-text {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--text);
    letter-spacing: 0.03em;
}

/* Examples */
.lesson-examples {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.lesson-example {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
}

.example-wrong {
    color: var(--error);
    text-decoration: line-through;
    font-weight: 500;
    font-size: 0.95rem;
    opacity: 0.7;
    min-width: 90px;
}

.example-arrow {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.example-right {
    color: var(--success);
    font-weight: 700;
    font-size: 1.05rem;
    min-width: 100px;
}

.example-why {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-left: auto;
}

/* Lesson Start Button */
.lesson-start-btn {
    align-self: center;
    padding: 0.85rem 3rem;
    font-size: 1rem;
    margin-top: 0.5rem;
}

/* Lesson Actions */
.lesson-actions {
    display: flex;
    gap: 0.75rem;
}

/* Unit Headers in Lesson List */
.unit-header {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0.75rem 0 0.25rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    margin-top: 0.5rem;
}

.unit-header:first-child {
    margin-top: 0;
}

/* Lesson Card (in category grid) */
.lesson-card {
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 1rem;
    text-align: left;
}

.lesson-card:hover,
.lesson-card:focus-visible {
    border-color: var(--lesson-color, var(--accent));
    background: var(--surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.lesson-card-icon {
    font-size: 1.8rem;
    flex-shrink: 0;
}

.lesson-card-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.lesson-card-title {
    font-size: 1rem;
    font-weight: 600;
}

.lesson-card-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.lesson-card-progress {
    flex-shrink: 0;
}

.lesson-progress-ring {
    width: 40px;
    height: 40px;
}

.lesson-progress-bg {
    fill: none;
    stroke: rgba(0, 0, 0, 0.06);
    stroke-width: 3;
}

.lesson-progress-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 3;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
    transform: rotate(-90deg);
    transform-origin: center;
}

.lesson-check {
    color: var(--success);
    font-size: 1.3rem;
}

/* ===== Header Right ===== */
.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-settings {
    background: var(--surface);
    color: var(--text-muted);
    border: 1px solid rgba(0, 0, 0, 0.08);
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-settings:hover {
    color: var(--text);
    background: var(--surface-hover);
    border-color: rgba(0, 0, 0, 0.12);
}

/* ===== Settings Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-light);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.modal-close {
    padding: 0.35rem !important;
}

.modal-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-section-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 600;
}

.settings-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

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

.settings-input-row {
    display: flex;
    gap: 0.5rem;
}

.settings-input {
    flex: 1;
    font-family: var(--font);
    font-size: 0.9rem;
    padding: 0.6rem 0.85rem;
    background: var(--surface);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

/* Voice picker */
.voice-option-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.voice-pick {
    background: var(--surface);
    border: 2px solid rgba(0, 0, 0, 0.1);
    color: var(--text);
    font-size: 0.8rem;
    padding: 0.45rem 0.8rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
}
.voice-pick:hover {
    border-color: var(--primary);
}
.voice-pick.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 600;
}
select.settings-input {
    appearance: auto;
    cursor: pointer;
    min-width: 0;
}

.settings-input:focus {
    border-color: var(--accent);
}

.settings-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
}

.settings-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-height: 1.2em;
}

.settings-hint.success {
    color: var(--success);
}

.settings-hint.error {
    color: var(--error);
}

.btn-sm {
    font-size: 0.8rem;
    padding: 0.5rem 1rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
}

.profile-stat-card {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.profile-stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
}

.profile-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ai-analysis {
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 0.85rem;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
}

/* ===== AI Feedback Bubble ===== */
.ai-feedback {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, rgba(91, 75, 181, 0.08), rgba(42, 157, 143, 0.05));
    border: 1px solid rgba(91, 75, 181, 0.15);
    border-radius: var(--radius);
    animation: fadeIn 0.4s ease;
}

.ai-feedback-avatar {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.ai-feedback-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    letter-spacing: 0.02em;
}

.ai-feedback.loading .ai-feedback-text::after {
    content: "";
    display: inline-block;
    width: 4px;
    height: 1em;
    background: var(--accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 0.8s infinite;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* ===== AI Session Insight ===== */
.ai-insight {
    background: linear-gradient(135deg, rgba(91, 75, 181, 0.1), rgba(42, 157, 143, 0.06));
    border: 1px solid rgba(91, 75, 181, 0.2);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: left;
    width: 100%;
    animation: fadeIn 0.5s ease;
}

.ai-insight-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.ai-insight-icon {
    font-size: 1.1rem;
}

.ai-insight-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 600;
}

.ai-insight-text {
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text);
    letter-spacing: 0.02em;
}

.ai-insight.loading .ai-insight-text::after {
    content: "";
    display: inline-block;
    width: 4px;
    height: 1em;
    background: var(--accent);
    margin-left: 2px;
    vertical-align: text-bottom;
    animation: blink 0.8s infinite;
}

/* ===== AI Recommendation ===== */
.ai-recommendation {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, rgba(230, 168, 23, 0.08), rgba(91, 75, 181, 0.06));
    border: 1px solid rgba(230, 168, 23, 0.15);
    border-radius: var(--radius);
    animation: fadeIn 0.4s ease;
}

.ai-recommendation-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    line-height: 1.4;
}

.ai-recommendation-text {
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text);
    letter-spacing: 0.02em;
}

/* ===== Touch / Mobile ===== */
@media (max-width: 600px) {
    html { font-size: 16px; }

    :root {
        --letter-size: 54px;
    }

    .header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .result-card {
        padding: 1.5rem;
    }

    .flashcard-word {
        font-size: 1.8rem;
    }

    .flash-rating-buttons {
        flex-direction: row;
        gap: 0.5rem;
    }

    .btn-rating {
        padding: 0.65rem 1.25rem;
        font-size: 0.85rem;
    }

    .review-banner {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .lesson-example {
        flex-wrap: wrap;
    }

    .example-why {
        margin-left: 0;
        width: 100%;
        margin-top: 0.25rem;
    }

    .mode-tabs {
        align-self: stretch;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        flex-wrap: nowrap;
    }

    .mode-tabs::-webkit-scrollbar {
        display: none;
    }

    .mode-tab {
        flex: 0 0 auto;
        text-align: center;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }

    .header-right {
        gap: 0.75rem;
    }

    .profile-stats {
        grid-template-columns: 1fr;
    }

    .modal {
        max-height: 90vh;
    }
}

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

/* ===== Drag Ghost ===== */
.drag-ghost {
    position: fixed;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.9;
    transform: scale(1.1) rotate(3deg);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--surface);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* ===== Daily Challenge Card ===== */
.daily-challenge {
    background: linear-gradient(135deg, rgba(230, 168, 23, 0.1), rgba(91, 75, 181, 0.08));
    border: 1px solid rgba(230, 168, 23, 0.2);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    animation: fadeIn 0.3s ease;
}

.daily-challenge-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.daily-challenge-icon {
    font-size: 1.3rem;
}

.daily-challenge-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--warning);
    font-weight: 600;
}

.daily-challenge-word {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--text);
}

.daily-challenge-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.daily-challenge-done {
    color: var(--success);
    font-weight: 600;
    font-size: 0.9rem;
}

/* ===== Sentence Display ===== */
.sentence-display {
    background: linear-gradient(135deg, rgba(42, 157, 143, 0.08), rgba(91, 75, 181, 0.05));
    border: 1px solid rgba(42, 157, 143, 0.15);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    animation: fadeIn 0.4s ease;
}

.sentence-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--success);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.sentence-text {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text);
    font-style: italic;
    letter-spacing: 0.02em;
}

/* ===== Badge Notification Popup ===== */
.badge-popup {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(-120%);
    background: linear-gradient(135deg, #f0e6f6, #e8dff0);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    z-index: 200;
    box-shadow: 0 8px 32px rgba(91, 75, 181, 0.25);
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge-popup.show {
    transform: translateX(-50%) translateY(0);
}

.badge-popup-icon {
    font-size: 2rem;
}

.badge-popup-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.badge-popup-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 600;
}

.badge-popup-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
}

/* ===== Badge Gallery ===== */
.badge-gallery-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.badge-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
}

.badge-card {
    background: var(--surface);
    border: 2px solid rgba(0, 0, 0, 0.06);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
    transition: all var(--transition);
}

.badge-card.unlocked {
    border-color: rgba(91, 75, 181, 0.3);
    background: linear-gradient(145deg, rgba(91, 75, 181, 0.1), var(--surface));
}

.badge-card.locked {
    opacity: 0.4;
    filter: grayscale(0.8);
}

.badge-card-icon {
    font-size: 2rem;
}

.badge-card-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text);
}

.badge-card-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* ===== Scramble Mode ===== */
.scramble-jumble {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius);
    min-height: 80px;
    align-items: center;
}

.scramble-letter {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--accent);
    color: white;
    border-radius: var(--radius-sm);
    letter-spacing: 0.05em;
    text-transform: lowercase;
    animation: tilePlace 0.3s ease;
}

.scramble-answer-area {
    display: flex;
    gap: 0.75rem;
}

.scramble-input {
    flex: 1;
    font-family: var(--font);
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.85rem 1rem;
    background: var(--bg-light);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-align: center;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    outline: none;
    transition: border-color var(--transition);
}

.scramble-input:focus {
    border-color: var(--accent);
}

.scramble-input::placeholder {
    color: var(--text-muted);
    opacity: 0.5;
    font-weight: 400;
    letter-spacing: 0.03em;
    text-transform: none;
}

/* ===== Progress Dashboard ===== */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dashboard-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-card-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    font-weight: 600;
}

.dashboard-stats-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.dashboard-stat {
    flex: 1;
    min-width: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.6rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.dashboard-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.dashboard-stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: center;
}

.dashboard-bar-chart {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.dashboard-bar-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.dashboard-bar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    min-width: 80px;
    text-align: right;
}

.dashboard-bar-track {
    flex: 1;
    height: 20px;
    background: var(--bg-light);
    border-radius: 10px;
    overflow: hidden;
}

.dashboard-bar-fill {
    height: 100%;
    border-radius: 10px;
    background: var(--accent);
    transition: width 0.5s ease;
    min-width: 2px;
}

.dashboard-bar-value {
    font-size: 0.75rem;
    color: var(--text);
    font-weight: 600;
    min-width: 36px;
}

.dashboard-word-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dashboard-word-tag {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 20px;
    font-weight: 500;
}

.dashboard-word-tag.struggling {
    background: rgba(217, 79, 79, 0.15);
    color: var(--error);
    border: 1px solid rgba(217, 79, 79, 0.2);
}

.dashboard-word-tag.mastered {
    background: rgba(42, 157, 143, 0.15);
    color: var(--success);
    border: 1px solid rgba(42, 157, 143, 0.2);
}

/* ===== Custom Word List ===== */
.custom-word-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.custom-word-form .settings-input {
    flex: 1;
    min-width: 120px;
}

.custom-word-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 200px;
    overflow-y: auto;
}

.custom-word-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

.custom-word-item-text {
    font-weight: 600;
    color: var(--text);
}

.custom-word-item-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

.btn-remove-word {
    background: transparent;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: background var(--transition);
}

.btn-remove-word:hover {
    background: rgba(217, 79, 79, 0.15);
}

/* ===== PWA Install Prompt ===== */
.install-prompt {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid rgba(91, 75, 181, 0.3);
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 150;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
    max-width: 400px;
}

.install-prompt-text {
    font-size: 0.85rem;
    color: var(--text);
    flex: 1;
}

.install-prompt-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-install-dismiss {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.4rem;
}

/* ===== Mobile Additions ===== */
@media (max-width: 600px) {
    .badge-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .scramble-answer-area {
        flex-direction: column;
    }

    .scramble-input {
        font-size: 1.1rem;
    }

    .daily-challenge {
        padding: 1rem;
    }

    .dashboard-stats-row {
        gap: 0.5rem;
    }

    .dashboard-stat {
        min-width: 60px;
    }

    .dashboard-stat-value {
        font-size: 1.2rem;
    }

    .badge-popup {
        left: 0.5rem;
        right: 0.5rem;
        transform: translateX(0) translateY(-120%);
    }

    .badge-popup.show {
        transform: translateX(0) translateY(0);
    }

    .install-prompt {
        left: 0.5rem;
        right: 0.5rem;
        transform: none;
        max-width: none;
    }

    .custom-word-form {
        flex-direction: column;
    }
}

/* Flash Continue Button */
.flash-continue {
    text-align: center;
    margin-top: 1rem;
}

.flash-continue .btn {
    min-width: 160px;
    font-size: 1rem;
}

/* ================================================
   READING MODE
   ================================================ */

/* Listen-First Toggle */
.read-mode-toggle {
    text-align: center;
    margin: 0.5rem 0 1rem;
}

.toggle-label {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.95rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #636e72;
    border-radius: 12px;
    transition: background 0.25s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
}

.toggle-label input {
    display: none;
}

.toggle-label input:checked + .toggle-switch {
    background: var(--accent);
}

.toggle-label input:checked + .toggle-switch::after {
    transform: translateX(20px);
}

/* Passage Container */
.passage-container {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 16px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.passage-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text);
}

.passage-text {
    font-size: 1rem;
    line-height: 1.9;
    color: var(--text-muted);
}

.passage-sentence {
    transition: all 0.3s ease;
    border-radius: 4px;
    padding: 1px 2px;
}

.passage-sentence.active {
    color: var(--accent);
    background: rgba(91, 75, 181, 0.12);
    font-weight: 600;
}

.passage-sentence.completed {
    color: var(--text-muted);
    opacity: 0.6;
}

.passage-sentence.completed-good {
    color: #2a9d8f;
    opacity: 0.7;
}

/* Focused Current Sentence */
.read-sentence-focus {
    text-align: center;
    padding: 1.5rem 1rem;
    margin-bottom: 1rem;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.read-current-sentence {
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.8;
    color: var(--text);
    letter-spacing: 0.01em;
}

/* Mic Controls */
.read-controls {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.btn-mic {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1.05rem;
    font-weight: 600;
    border: 2px solid var(--accent);
    border-radius: 50px;
    background: var(--accent);
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-mic:hover {
    background: #4a3da0;
    transform: scale(1.02);
}

.btn-mic.listening {
    border-color: #e74c3c;
    background: #e74c3c;
    color: white;
    animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.3); }
    50% { box-shadow: 0 0 0 12px rgba(231, 76, 60, 0); }
}

.mic-icon {
    font-size: 1.3rem;
}

.btn-done {
    background: #2a9d8f;
    color: #fff;
    padding: 0.6rem 1.4rem;
    border-radius: 2rem;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid #2a9d8f;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.btn-done:hover {
    background: #238b7f;
    transform: scale(1.05);
}

/* Real-time Transcript */
.read-transcript {
    text-align: center;
    padding: 0.5rem 1rem;
    margin-bottom: 0.75rem;
    min-height: 2rem;
}

.read-transcript-text {
    font-size: 1rem;
    color: var(--text-muted);
    font-style: italic;
}

.read-transcript-text.final {
    color: var(--text);
    font-style: normal;
    font-weight: 500;
}

/* Word-by-word Feedback */
.read-word-feedback {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: center;
    padding: 0.75rem 0.5rem;
    margin-bottom: 1rem;
}

.read-word {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: transform 0.2s;
}

.read-word.correct {
    background: rgba(0, 184, 148, 0.2);
    color: #2a9d8f;
    border: 1px solid rgba(0, 184, 148, 0.3);
}

.read-word.struggled {
    background: rgba(225, 112, 85, 0.2);
    color: #e17055;
    border: 1px solid rgba(225, 112, 85, 0.3);
}

.read-word.skipped {
    background: rgba(178, 190, 195, 0.15);
    color: #636e72;
    border: 1px solid rgba(178, 190, 195, 0.2);
}

/* Read Actions */
.read-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

/* Reading Result - Struggled Words */
.read-struggled {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
}

.read-struggled-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.read-struggled-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.word-chip {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    background: rgba(225, 112, 85, 0.15);
    color: #e17055;
    border: 1px solid rgba(225, 112, 85, 0.3);
}

/* Manual Fallback Input */
.read-manual {
    text-align: center;
    margin: 1rem 0;
}

.read-manual-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.read-manual-input {
    width: 100%;
    max-width: 400px;
    padding: 0.75rem 1rem;
    font-size: 1.05rem;
    font-family: inherit;
    border: 2px solid rgba(0, 0, 0, 0.15);
    border-radius: 12px;
    background: var(--surface);
    color: var(--text);
    outline: none;
    margin-bottom: 0.75rem;
}

.read-manual-input:focus {
    border-color: var(--accent);
}

/* Responsive - smaller screens */
/* Book header & chapter cards */
.category-book-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin-top: 0.5rem;
}

.category-book-header .category-icon {
    font-size: 1.5rem;
}

.category-book-header .category-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text);
}

.category-book-header .category-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: auto;
}

.category-card-chapter {
    min-height: auto;
    padding: 0.6rem 1rem;
}

.category-card-chapter .category-icon {
    font-size: 1rem;
}

.category-card-chapter .category-name {
    font-size: 0.9rem;
}

/* ===== Reading Sub-Mode Selector ===== */
.read-submode-selector {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 0.5rem 0 0.75rem;
}

.read-submode-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 500;
    font-family: inherit;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 50px;
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
}

.read-submode-btn:hover {
    background: rgba(0, 0, 0, 0.08);
    color: var(--text);
}

.read-submode-btn.active {
    border-color: var(--accent);
    background: var(--accent);
    color: white;
    font-weight: 600;
}

/* ===== Just Listen Mode ===== */
.just-listen-container {
    background: rgba(0, 0, 0, 0.03);
    border-radius: 16px;
    padding: 1.5rem 1.75rem;
    margin-bottom: 1rem;
    max-height: 55vh;
    overflow-y: auto;
    border: 1px solid rgba(0, 0, 0, 0.06);
    scroll-behavior: smooth;
}

.just-listen-text {
    font-size: 1.15rem;
    line-height: 2.2;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}

/* Individual word spans */
.just-listen-word {
    display: inline;
    padding: 2px 3px;
    border-radius: 4px;
    transition: background 0.15s ease, color 0.15s ease;
}

/* Currently being spoken */
.just-listen-word.word-active {
    background: var(--accent);
    color: white;
    font-weight: 600;
    border-radius: 6px;
    box-shadow: 0 0 8px rgba(91, 75, 181, 0.3);
}

/* Already spoken */
.just-listen-word.word-spoken {
    color: var(--text);
    opacity: 0.85;
}

/* Sentence groups — clickable to set start point */
.just-listen-sentence-group {
    cursor: pointer;
    border-radius: 6px;
    padding: 2px 4px;
    transition: background 0.2s ease;
    border-left: 3px solid transparent;
}

.just-listen-sentence-group:hover {
    background: rgba(91, 75, 181, 0.06);
}

.just-listen-sentence-group.start-here {
    background: rgba(91, 75, 181, 0.08);
    border-left-color: var(--accent);
}

/* Sentence break for visual spacing */
.just-listen-sentence-break {
    display: block;
    height: 0.25rem;
}

/* Just Listen Controls */
.just-listen-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.just-listen-start-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.btn-lg {
    padding: 0.85rem 2rem;
    font-size: 1.1rem;
}

.just-listen-progress {
    width: 100%;
    max-width: 400px;
    height: 6px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.just-listen-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

@media (max-width: 480px) {
    .read-current-sentence {
        font-size: 1.15rem;
    }

    .btn-mic {
        padding: 0.6rem 1.2rem;
        font-size: 0.95rem;
    }

    .passage-container {
        padding: 1rem;
        max-height: 150px;
    }

    .just-listen-container {
        padding: 1rem;
        max-height: 45vh;
    }

    .just-listen-text {
        font-size: 1.05rem;
    }

    .read-submode-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* ===== Quiz Section ===== */
.quiz-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.quiz-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.3rem;
}

.quiz-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.quiz-word-prompt {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text);
    padding: 0.8rem 1rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

.quiz-actions {
    margin-top: 0.5rem;
}

/* ===== Quiz Grade Card ===== */
.quiz-grade-card {
    text-align: center;
    padding: 1.2rem;
    background: var(--surface);
    border-radius: var(--radius);
    margin: 1rem 0;
}

.quiz-grade-heading {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.quiz-grade-display {
    font-size: 2.5rem;
    font-weight: 800;
}

.quiz-grade-display.grade-a { color: #2a9d8f; }
.quiz-grade-display.grade-b { color: #27ae60; }
.quiz-grade-display.grade-c { color: #d4a017; }
.quiz-grade-display.grade-d { color: #e17055; }
.quiz-grade-display.grade-f { color: #ff6b6b; }

.quiz-grade-detail {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-top: 0.3rem;
}

/* ===== Struggle Patterns ===== */
.struggle-patterns {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    margin: 1rem 0;
    border-left: 3px solid var(--warning);
}

.struggle-heading {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--warning);
    margin-bottom: 0.6rem;
}

.struggle-list {
    list-style: none;
    padding: 0;
}

.struggle-list li {
    padding: 0.4rem 0;
    font-size: 0.9rem;
    color: var(--text);
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.struggle-list li:last-child {
    border-bottom: none;
}

.struggle-word {
    font-weight: 600;
    color: var(--error);
}

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

/* ===== Enhanced Teach Slides ===== */
#lesson-teach-enhanced {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.teach-slide-counter {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.teach-slide {
    background: linear-gradient(135deg, var(--surface) 0%, #fff3e0 100%);
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid rgba(0,0,0,0.06);
}

.teach-slide-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 0.8rem;
}

.teach-slide-content {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--text);
}

.teach-slide-diagram {
    margin-top: 1rem;
}

.teach-slide-nav {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
}

.teach-slide-nav .btn {
    min-width: 120px;
}

/* Doubling Diagrams */
.doubling-diagram {
    text-align: center;
    padding: 1rem 0;
}

.diagram-word-build {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
}

.diagram-base {
    color: var(--text);
    background: var(--bg-light);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
}

.diagram-plus {
    color: var(--text-muted);
    font-size: 1.2rem;
}

.diagram-single-letter {
    color: var(--text-muted);
    text-decoration: line-through;
    font-size: 1.3rem;
}

.diagram-arrow-right {
    color: var(--accent);
    font-size: 1.4rem;
}

.diagram-doubled-letter {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    padding: 0.3rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 1.8rem;
    font-weight: 800;
}

.diagram-rule-label {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.8rem;
}

.diagram-vowel-badge {
    display: inline-block;
    background: var(--accent);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
    font-size: 0.9rem;
}

.diagram-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.diagram-example-word {
    background: var(--bg-light);
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 1rem;
    color: var(--text);
    font-weight: 500;
}

.doubled-highlight {
    color: #e74c3c;
    font-weight: 800;
}

/* FLOSS Acronym Diagram */
.floss-acronym-diagram {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.floss-letter {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--floss-color);
}

.floss-char {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--floss-color);
    min-width: 2rem;
    text-align: center;
}

.floss-means {
    font-size: 0.95rem;
    color: var(--text);
}

/* ===== Spelling Bee ===== */
.bee-announcer {
    background: linear-gradient(135deg, #fff8e1 0%, #ffe0b2 100%);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1rem;
    border: 1px solid rgba(0,0,0,0.06);
}

.bee-prompt {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.bee-definition {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.bee-sentence {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-style: italic;
}

.bee-replay-controls {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bee-replay-controls .btn-hear {
    font-size: 0.85rem;
    padding: 0.5rem 0.8rem;
}

.bee-input-area {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.bee-text-input {
    flex: 1;
    font-family: var(--font);
    font-size: 1.4rem;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.15em;
    padding: 0.8rem 1rem;
    border: 2px solid rgba(0,0,0,0.1);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    outline: none;
    transition: border-color var(--transition);
}

.bee-text-input:focus {
    border-color: var(--accent);
}

.bee-input-area .btn-check {
    font-size: 1.1rem;
    padding: 0.8rem 1.5rem;
}

.bee-feedback {
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.bee-correct {
    background: var(--success-glow);
    color: var(--success);
    border: 1px solid var(--success);
}

.bee-incorrect {
    background: var(--error-glow);
    color: var(--error);
    border: 1px solid var(--error);
}

.bee-feedback-icon {
    font-size: 1.3rem;
    margin-right: 0.3rem;
}

.bee-spelled-out {
    display: block;
    margin-top: 0.4rem;
    font-size: 1.2rem;
    letter-spacing: 0.2em;
    color: var(--text);
    font-weight: 700;
}

/* Spelling Bee Results */
.bee-word-review {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin: 1rem 0;
    max-height: 300px;
    overflow-y: auto;
}

.bee-review-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
}

.bee-review-correct {
    background: rgba(42, 157, 143, 0.08);
}

.bee-review-wrong {
    background: rgba(217, 79, 79, 0.08);
}

.bee-review-icon {
    font-size: 1.1rem;
}

.bee-review-word {
    font-weight: 700;
    color: var(--text);
}

.bee-review-typed {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: auto;
}

/* ===== Word Review (after reading) ===== */
.review-card {
    background: linear-gradient(135deg, var(--surface) 0%, #fef3e2 100%);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    border: 1px solid rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    align-items: center;
}

.review-word-display {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0.05em;
}

.review-what-heard {
    font-size: 0.9rem;
    color: var(--error);
    background: var(--error-glow);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-weight: 500;
}

.review-syllables {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.review-syllable-chip {
    background: var(--accent);
    color: white;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 600;
}

.review-syllable-dot {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-weight: 700;
}

.review-hint {
    font-size: 1.05rem;
    color: var(--text);
    line-height: 1.6;
}

.review-sentence {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.6;
}

.review-listen-btns {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.review-listen-btns .btn-hear {
    font-size: 0.85rem;
    padding: 0.5rem 0.8rem;
}

.review-nav {
    display: flex;
    gap: 0.8rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.review-nav .btn {
    min-width: 140px;
}

/* ===== Phoneme-Grapheme Game ===== */

.phoneme-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.phoneme-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.phoneme-score-display {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
}

.phoneme-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--surface);
    border-radius: var(--radius);
    text-align: center;
}

.phoneme-prompt-text {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

.phoneme-play-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.phoneme-play-btn:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 24px var(--accent-glow);
}

.phoneme-play-btn:active {
    transform: scale(0.96);
}

.phoneme-question {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.phoneme-choices {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
}

.phoneme-choice-card {
    background: var(--surface);
    border: 3px solid transparent;
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    cursor: pointer;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 700;
    font-family: var(--font);
    letter-spacing: 0.06em;
    transition: all var(--transition);
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phoneme-choice-card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.phoneme-choice-card.correct {
    border-color: var(--success);
    background: var(--success-glow);
    color: var(--success);
}

.phoneme-choice-card.incorrect {
    border-color: var(--error);
    background: var(--error-glow);
    color: var(--error);
    opacity: 0.6;
}

.phoneme-choice-card.revealed {
    border-color: var(--success);
    background: var(--success-glow);
    color: var(--success);
}

.phoneme-choice-card.disabled {
    pointer-events: none;
}

.phoneme-feedback {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.phoneme-feedback-icon {
    font-size: 2.5rem;
}

.phoneme-feedback-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.phoneme-feedback-examples {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.phoneme-feedback-examples strong {
    color: var(--accent);
}

/* Phoneme category selection cards */
.phoneme-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.phoneme-cat-card {
    background: var(--surface);
    border: 2px solid transparent;
    border-radius: var(--radius);
    padding: 1.5rem;
    cursor: pointer;
    text-align: center;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: var(--font);
    font-size: 1rem;
}

.phoneme-cat-card:hover {
    border-color: var(--accent);
    background: var(--surface-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.phoneme-cat-icon {
    font-size: 2rem;
}

.phoneme-cat-name {
    font-weight: 600;
    font-size: 1.1rem;
}

.phoneme-cat-count {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ===== Morpheme Builder ===== */

.morpheme-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-light);
    border-radius: 4px;
    overflow: hidden;
}

.morpheme-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.4s ease;
    width: 0%;
}

.morpheme-score-display {
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    color: var(--accent);
}

.morpheme-clue {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
}

.morpheme-clue-label {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.morpheme-clue-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    font-style: italic;
}

.morpheme-build-zone {
    min-height: 80px;
    border: 3px dashed var(--text-muted);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 1rem;
    transition: all var(--transition);
    background: var(--surface);
}

.morpheme-build-zone.has-parts {
    border-color: var(--accent);
    border-style: solid;
}

.morpheme-build-placeholder {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.morpheme-built-word {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent);
    letter-spacing: 0.04em;
    padding: 0.5rem;
}

.morpheme-parts {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    justify-content: center;
    padding: 0.5rem;
}

.morpheme-chip {
    padding: 0.7rem 1.2rem;
    border-radius: 24px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font);
    cursor: pointer;
    border: 2px solid transparent;
    transition: all var(--transition);
    user-select: none;
    position: relative;
}

.morpheme-chip:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.morpheme-chip:active {
    transform: scale(0.95);
}

.morpheme-chip.prefix {
    background: #dbeafe;
    color: #1e40af;
    border-color: #93c5fd;
}

.morpheme-chip.root {
    background: #fef3c7;
    color: #92400e;
    border-color: #fcd34d;
}

.morpheme-chip.suffix {
    background: #dcfce7;
    color: #166534;
    border-color: #86efac;
}

.morpheme-chip.distractor {
    background: var(--bg-light);
    color: var(--text-muted);
    border-color: #d1d5db;
}

.morpheme-chip.used {
    opacity: 0.35;
    pointer-events: none;
    transform: scale(0.9);
}

.morpheme-chip.in-zone {
    cursor: pointer;
    animation: morpheme-snap 0.3s ease;
}

@keyframes morpheme-snap {
    0% { transform: scale(0.7); opacity: 0.5; }
    60% { transform: scale(1.08); }
    100% { transform: scale(1); opacity: 1; }
}

.morpheme-chip-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.7;
    margin-top: 0.15rem;
}

.morpheme-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.morpheme-feedback {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8rem;
}

.morpheme-feedback-icon {
    font-size: 2.5rem;
}

.morpheme-feedback-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.morpheme-meaning-breakdown {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    font-size: 1rem;
    color: var(--text);
}

.morpheme-meaning-part {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
}

.morpheme-meaning-part.prefix-part {
    background: #dbeafe;
    color: #1e40af;
}

.morpheme-meaning-part.root-part {
    background: #fef3c7;
    color: #92400e;
}

.morpheme-meaning-part.suffix-part {
    background: #dcfce7;
    color: #166534;
}

.morpheme-meaning-word {
    font-weight: 700;
    font-size: 1.05rem;
}

.morpheme-meaning-def {
    font-size: 0.75rem;
    opacity: 0.8;
}

.morpheme-meaning-plus {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-muted);
}

.morpheme-meaning-equals {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

.morpheme-meaning-result {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent);
}

/* Morpheme legend */
.morpheme-legend {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.morpheme-legend-item {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.morpheme-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.morpheme-legend-dot.prefix-dot { background: #3b82f6; }
.morpheme-legend-dot.root-dot { background: #d97706; }
.morpheme-legend-dot.suffix-dot { background: #22c55e; }

/* ===== Speed Drill ===== */

.speed-level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
}

.speed-level-best {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
}

/* Timer in top bar */
.speed-timer {
    margin-left: auto;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    min-width: 5ch;
    text-align: right;
}

/* Progress indicator */
.speed-progress {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

/* Giant word display area */
.speed-word-display {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-height: 200px;
    padding: 2rem;
}

.speed-word {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--text);
    text-align: center;
    letter-spacing: 0.06em;
    animation: speedPulse 2s ease-in-out infinite;
}

.speed-word-enter {
    animation: speedWordIn 0.3s ease-out, speedPulse 2s ease-in-out 0.3s infinite;
}

@keyframes speedPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.03); }
}

@keyframes speedWordIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(12px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Speed drill buttons */
.speed-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0;
}

.speed-btn-know {
    background: var(--success);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    padding: 1.2rem 2rem;
    border-radius: var(--radius);
    justify-content: center;
    letter-spacing: 0.03em;
}

.speed-btn-know:hover {
    box-shadow: 0 6px 20px var(--success-glow);
    transform: translateY(-1px);
}

.speed-btn-help {
    background: var(--surface);
    color: var(--text-muted);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.85rem 2rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius);
    justify-content: center;
}

.speed-btn-help:hover {
    background: var(--surface-hover);
    color: var(--text);
}

/* Personal best display */
.speed-personal-best {
    text-align: center;
}

.speed-pb {
    font-size: 0.9rem;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    background: var(--bg-light);
    border-radius: var(--radius-sm);
}

.speed-pb-new {
    color: var(--success);
    font-weight: 700;
    font-size: 1.1rem;
    background: rgba(42, 157, 143, 0.1);
    border: 1px solid rgba(42, 157, 143, 0.2);
    animation: fadeIn 0.3s ease;
}

/* Helped words on results screen */
.speed-helped-words {
    width: 100%;
    text-align: center;
}

.speed-helped-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.speed-helped-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.speed-helped-word {
    display: inline-block;
    background: rgba(217, 79, 79, 0.1);
    color: var(--error);
    border: 1px solid rgba(217, 79, 79, 0.2);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
}

/* Responsive: make word even larger on bigger screens */
@media (min-width: 600px) {
    .speed-word {
        font-size: 5rem;
    }
}

/* ===== Dictation Mode ===== */

.dictation-listen-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--surface);
    border-radius: var(--radius);
}

.dictation-instruction {
    font-size: 1rem;
    color: var(--text-muted);
    text-align: center;
}

.dictation-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

.dictation-btn-icon {
    font-size: 1.3rem;
}

.dictation-buttons .btn-lg {
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
}

.dictation-input-area {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dictation-text-input {
    font-family: var(--font);
    font-size: 1.15rem;
    letter-spacing: 0.05em;
    line-height: 1.7;
    padding: 1rem 1.2rem;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    resize: vertical;
    min-height: 80px;
    transition: border-color var(--transition);
}

.dictation-text-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.dictation-text-input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.dictation-input-area .btn-lg {
    padding: 0.8rem 1.5rem;
    font-size: 1.05rem;
}

/* Word-by-word feedback */
.dictation-feedback {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--radius);
}

.dictation-word-block {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 0.4rem 0.7rem;
    border-radius: var(--radius-sm);
    min-width: 50px;
    text-align: center;
}

.dictation-word-block.correct {
    background: rgba(42, 157, 143, 0.15);
    border: 1px solid rgba(42, 157, 143, 0.3);
}

.dictation-word-block.incorrect {
    background: rgba(217, 79, 79, 0.1);
    border: 1px solid rgba(217, 79, 79, 0.25);
}

.dictation-word-typed {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: 0.03em;
}

.dictation-word-block.correct .dictation-word-typed {
    color: var(--success);
}

.dictation-word-block.incorrect .dictation-word-typed {
    color: var(--error);
    text-decoration: line-through;
}

.dictation-word-correct {
    font-size: 0.8rem;
    color: var(--success);
    font-weight: 500;
}

.dictation-next {
    display: flex;
    justify-content: center;
}

/* Dictation Results */
.dictation-missed {
    margin-top: 1rem;
}

.dictation-missed-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.dictation-missed-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.dictation-missed-word {
    background: rgba(217, 79, 79, 0.1);
    color: var(--error);
    border: 1px solid rgba(217, 79, 79, 0.2);
    padding: 0.3rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ===== Streak Calendar ===== */

.btn-streak-fire {
    background: transparent;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 0.3rem 0.5rem;
    border-radius: var(--radius-sm);
    color: #e17055;
    font-weight: 700;
    transition: all var(--transition);
}

.btn-streak-fire:hover {
    background: rgba(225, 112, 85, 0.1);
    transform: scale(1.1);
}

.streak-stats {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}

.streak-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    max-width: 320px;
    margin: 0 auto;
}

.streak-day-label {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    padding: 0.3rem;
}

.streak-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border-radius: 50%;
    color: var(--text-muted);
    font-weight: 500;
}

.streak-day.empty {
    visibility: hidden;
}

.streak-day.practiced {
    background: #2a9d8f;
    color: white;
    font-weight: 700;
}

.streak-day.today {
    box-shadow: 0 0 0 2px #e9c46a;
}

.streak-day.today.practiced {
    box-shadow: 0 0 0 2px #e9c46a;
    background: #2a9d8f;
}

/* ===== Reading Comprehension ===== */
.comp-question-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem 1.5rem;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

.comp-question-text {
    font-size: 1.2rem;
    font-weight: 600;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    color: var(--text);
}

.comp-choices {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comp-choice-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-size: 1rem;
    text-align: left;
    transition: all var(--transition);
    color: var(--text);
}

.comp-choice-btn:hover:not(.disabled) {
    border-color: var(--accent);
    background: rgba(91, 75, 181, 0.05);
    transform: translateX(4px);
}

.comp-choice-btn.disabled {
    pointer-events: none;
    opacity: 0.7;
}

.comp-choice-btn.correct {
    border-color: var(--success);
    background: rgba(42, 157, 143, 0.12);
    opacity: 1;
}

.comp-choice-btn.incorrect {
    border-color: var(--error);
    background: rgba(217, 79, 79, 0.1);
    opacity: 1;
}

.comp-choice-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.comp-choice-btn.correct .comp-choice-label {
    background: var(--success);
}

.comp-choice-btn.incorrect .comp-choice-label {
    background: var(--error);
}

.comp-choice-text {
    flex: 1;
}

.comp-feedback {
    margin-top: 1.25rem;
    padding: 1rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 1rem;
    animation: fadeIn 0.3s ease;
}

.comp-feedback.correct {
    background: rgba(42, 157, 143, 0.12);
    color: var(--success);
}

.comp-feedback.incorrect {
    background: rgba(217, 79, 79, 0.08);
    color: var(--error);
}

.comp-next-btn {
    margin-top: 1rem;
}

/* Comprehension results */
.comp-review-heading {
    font-size: 1rem;
    font-weight: 600;
    margin: 1.25rem 0 0.75rem;
    color: var(--text-muted);
}

.comp-review-item {
    background: var(--bg);
    border-radius: var(--radius-sm);
    padding: 1rem;
    margin-bottom: 0.75rem;
    text-align: left;
}

.comp-review-q {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.comp-review-wrong {
    color: var(--error);
    font-size: 0.9rem;
    text-decoration: line-through;
    opacity: 0.7;
}

.comp-review-right {
    color: var(--success);
    font-weight: 600;
    font-size: 0.9rem;
}

.comp-review-perfect {
    padding: 1.5rem;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--success);
}

/* ===== Enhanced Lesson Teach Slides ===== */

/* Progress dots */
.teach-slide-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    padding: 0.5rem 0;
}

.teach-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.12);
    transition: all 0.2s ease;
}

.teach-dot.active {
    background: var(--accent);
    transform: scale(1.3);
}

.teach-dot.completed {
    background: var(--success);
}

.teach-dot.interactive {
    border: 2px solid #e17055;
    background: transparent;
}

.teach-dot.interactive.active {
    background: #e17055;
}

.teach-dot.interactive.completed {
    background: #e17055;
}

/* Replay button */
.btn-teach-replay {
    font-size: 0.85rem !important;
    padding: 0.5rem 1rem !important;
    min-width: auto !important;
}

/* Disabled next button */
.teach-slide-nav .btn.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* ===== Interactive Slide: Listen & Choose ===== */
.teach-listen-choose {
    margin-top: 1.25rem;
}

.teach-listen-btn {
    margin-bottom: 1rem;
    font-size: 1.1rem !important;
}

.teach-choices {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.teach-choice-btn {
    display: block;
    width: 100%;
    padding: 0.9rem 1.2rem;
    background: var(--bg);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
    letter-spacing: 0.04em;
}

.teach-choice-btn:hover:not(.disabled) {
    border-color: var(--accent);
    background: rgba(91, 75, 181, 0.05);
    transform: translateX(4px);
}

.teach-choice-btn.disabled { pointer-events: none; opacity: 0.7; }
.teach-choice-btn.correct { border-color: var(--success); background: rgba(42, 157, 143, 0.12); opacity: 1; }
.teach-choice-btn.incorrect { border-color: var(--error); background: rgba(217, 79, 79, 0.1); opacity: 1; }

/* ===== Interactive Slide: Tap the Pattern ===== */
.teach-tap-word {
    display: flex;
    justify-content: center;
    gap: 0;
    font-size: 2.2rem;
    font-weight: 700;
    margin: 1rem 0;
}

.teach-tap-segment {
    cursor: pointer;
    padding: 0.3rem 0.4rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    border: 2px solid transparent;
}

.teach-tap-segment:hover {
    background: rgba(91, 75, 181, 0.08);
    border-color: rgba(91, 75, 181, 0.2);
}

.teach-tap-segment.highlighted {
    background: rgba(42, 157, 143, 0.2);
    border-color: var(--success);
    color: var(--success);
}

.teach-tap-segment.wrong-tap {
    background: rgba(217, 79, 79, 0.1);
    animation: shake 0.4s ease;
}

.teach-tap-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

/* ===== Interactive Slide: Fill the Gap ===== */
.teach-fill-gap {
    margin-top: 1rem;
    text-align: center;
}

.teach-gap-word {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

.teach-gap-blank {
    display: inline-block;
    border-bottom: 3px solid var(--accent);
    min-width: 2.5rem;
    color: var(--accent);
    font-weight: 800;
    transition: all 0.3s ease;
}

.teach-gap-blank.filled {
    border-bottom-color: var(--success);
    color: var(--success);
}

.teach-gap-options {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.teach-gap-btn {
    padding: 0.7rem 1.5rem;
    background: var(--bg);
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
}

.teach-gap-btn:hover:not(.disabled) {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.teach-gap-btn.disabled { pointer-events: none; opacity: 0.6; }
.teach-gap-btn.correct { border-color: var(--success); background: rgba(42, 157, 143, 0.12); opacity: 1; color: var(--success); }
.teach-gap-btn.incorrect { border-color: var(--error); background: rgba(217, 79, 79, 0.1); opacity: 1; text-decoration: line-through; }

/* ===== Interactive Slide: Sort It ===== */
.teach-sort-container {
    margin-top: 1rem;
}

.teach-sort-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.teach-sort-column {
    background: var(--bg);
    border: 2px dashed rgba(0, 0, 0, 0.1);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    min-height: 100px;
    cursor: pointer;
    transition: all var(--transition);
}

.teach-sort-column:hover {
    border-color: var(--accent);
    background: rgba(91, 75, 181, 0.03);
}

.teach-sort-header {
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 0.5rem;
    text-align: center;
}

.teach-sort-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
}

.teach-sort-word {
    padding: 0.5rem 1rem;
    background: var(--surface);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 20px;
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    color: var(--text);
}

.teach-sort-word:hover:not(.sorted) {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.teach-sort-word.selected {
    border-color: var(--accent);
    background: rgba(91, 75, 181, 0.1);
    box-shadow: 0 0 0 2px rgba(91, 75, 181, 0.3);
}

.teach-sort-word.sorted {
    pointer-events: none;
}

.teach-sort-word.sorted.correct {
    border-color: var(--success);
    background: rgba(42, 157, 143, 0.1);
}

.teach-sort-word.wrong-sort {
    animation: shake 0.4s ease;
    border-color: var(--error);
}

/* ===== New Diagram Types ===== */

/* Highlight Word */
.highlight-word-diagram {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 0.5rem;
}

.hw-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.hw-word {
    font-size: 1.4rem;
    font-weight: 700;
}

.hw-mark {
    background: rgba(231, 76, 60, 0.15);
    color: var(--hw-color, #e74c3c);
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    font-weight: 800;
}

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

/* Prefix Breakdown */
.prefix-breakdown-diagram, .suffix-transform-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    font-size: 1.4rem;
    font-weight: 700;
    padding: 1rem 0;
}

.pbd-prefix, .std-suffix {
    color: #3498db;
    background: rgba(52, 152, 219, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.pbd-base, .std-base {
    color: var(--text);
    background: var(--bg-light);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.pbd-plus, .std-plus { color: var(--text-muted); font-size: 1.2rem; }
.pbd-arrow, .std-arrow { color: var(--accent); font-size: 1.4rem; }

.pbd-result, .std-result {
    color: var(--success);
    background: rgba(42, 157, 143, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
}

.pbd-meaning, .std-note {
    width: 100%;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Comparison Table */
.comparison-table-diagram {
    margin-top: 0.5rem;
}

.ct-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.6rem;
    border-radius: 6px;
}

.ct-row span {
    text-align: center;
    font-size: 1rem;
}

.ct-header {
    background: rgba(91, 75, 181, 0.1);
    font-weight: 700;
    color: var(--accent);
}

.ct-header span {
    font-size: 1.1rem;
}

.ct-row:not(.ct-header) {
    background: var(--bg);
}

.ct-note {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    font-weight: 500;
}

/* Sound Map */
.sound-map-diagram {
    text-align: center;
    padding: 0.5rem 0;
}

.sm-pattern {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.sm-branches {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.sm-branch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg);
    border-radius: 6px;
}

.sm-sound {
    font-weight: 700;
    color: #e17055;
    min-width: 3rem;
}

.sm-examples {
    color: var(--text);
    font-size: 0.95rem;
}

/* Root Tree */
.root-tree-diagram {
    text-align: center;
    padding: 0.5rem 0;
}

.rt-root {
    margin-bottom: 0.75rem;
}

.rt-root-word {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
}

.rt-meaning {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}

.rt-branches {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.rt-branch {
    background: var(--bg);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* Vowel Team */
.vowel-team-diagram {
    text-align: center;
    padding: 0.5rem 0;
}

.vt-team {
    margin-bottom: 0.75rem;
}

.vt-letters {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent);
    background: rgba(91, 75, 181, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
}

.vt-sound {
    display: block;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.3rem;
}

.vt-examples {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.vt-word {
    background: var(--bg);
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: 500;
}

.vt-mark {
    background: rgba(91, 75, 181, 0.15);
    color: var(--accent);
    font-weight: 800;
    padding: 0.05rem 0.2rem;
    border-radius: 3px;
}

/* Mobile: sort columns stack */
@media (max-width: 480px) {
    .teach-sort-columns {
        grid-template-columns: 1fr;
    }
    .teach-tap-word {
        font-size: 1.8rem;
    }
    .teach-gap-word {
        font-size: 1.6rem;
    }
}

/* ===== UX Fixes ===== */

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
