/* ═══════════════════════════════════════════════════════════════
   LETTER HEROES – Dyslexia-Friendly Stylesheet
   ═══════════════════════════════════════════════════════════════
   Design rationale (research-backed):
   • Lexend Deca: reduces visual noise, improves reading speed
   • Cream background (#fffdf0): less glare than pure white
   • Deep navy text: high contrast but less harsh than pure black
   • Extra letter-spacing & line-height: reduces crowding effects
   • Large touch targets (≥72px): good for kids & tablets
   • Avoid pure italics for main content (hard to read for dyslexics)
═══════════════════════════════════════════════════════════════ */

/* ─── CSS Variables ──────────────────────────────────────────────── */
:root {
    --bg:          #fffdf0;   /* warm cream */
    --text:        #1a1a2e;   /* deep navy */
    --text-light:  #5a5a7a;
    --card:        #ffffff;
    --border:      #e8e4d4;

    --mode-1:      #ff6b6b;   /* Letter Detective – coral */
    --mode-2:      #0bbcd4;   /* Sound Match – teal */
    --mode-3:      #ffd166;   /* Flip Finder – gold */
    --mode-4:      #a29bfe;   /* Spelling Stars – lavender */

    --success:     #16a34a;
    --success-bg:  #e6fff8;
    --error:       #ef476f;
    --error-bg:    #ffe0e8;
    --locked:      #c5c5d5;

    --radius-sm:   10px;
    --radius-md:   18px;
    --radius-lg:   28px;
    --radius-xl:   50px;

    --shadow:      0 4px 20px rgba(26, 26, 46, 0.10);
    --shadow-lg:   0 8px 32px rgba(26, 26, 46, 0.15);
}

/* ─── Reset & Base ───────────────────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    font-family: 'Lexend Deca', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    /* Extra spacing is research-backed for dyslexic readers */
    letter-spacing: 0.04em;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
}

/* ─── Screen System ──────────────────────────────────────────────── */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    width: 100%;
    padding: 24px 16px 40px;
    animation: fadeIn 0.25s ease;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── HOME SCREEN ────────────────────────────────────────────────── */
.home-header {
    text-align: center;
    margin-bottom: 32px;
    padding-top: 16px;
}

.home-header h1 {
    font-size: clamp(2.2rem, 6vw, 3rem);
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
    margin-bottom: 6px;
}

.home-tagline {
    font-size: 1.05rem;
    color: var(--text-light);
    margin-bottom: 14px;
}

.total-stars-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 8px 20px;
    font-size: 1.1rem;
    font-weight: 700;
    box-shadow: var(--shadow);
}

.star-icon { font-size: 1.3em; }
.star-label { font-weight: 400; color: var(--text-light); font-size: 0.9rem; }

/* Mode cards grid */
.mode-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    width: 100%;
    max-width: 680px;
    margin-bottom: 32px;
}

.mode-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 24px 16px 20px;
    text-align: center;
    cursor: pointer;
    border: 3px solid var(--border);
    box-shadow: var(--shadow);
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    /* Color accent via CSS variable set by JS */
    border-top: 6px solid var(--mode-color, var(--text));
    user-select: none;
}

.mode-card:hover,
.mode-card:focus-visible {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--mode-color, var(--text));
    outline: none;
}

.mode-card:active {
    transform: translateY(0);
}

.mode-card .mode-icon {
    font-size: 2.8rem;
    margin-bottom: 10px;
    display: block;
}

.mode-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
}

.mode-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    line-height: 1.4;
    margin-bottom: 12px;
}

/* Star progress dots on mode card */
.mode-stars {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2px;
}

.star-dot {
    font-size: 0.7rem;
    color: #d0ccc0;
    transition: color 0.2s;
}

.star-dot.earned {
    color: #ffd166;
}

.home-footer {
    margin-top: auto;
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.reset-btn {
    background: none;
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    color: var(--text-light);
    font-size: 0.8rem;
    padding: 6px 14px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}

.reset-btn:hover {
    opacity: 1;
    border-color: #e05050;
    color: #e05050;
}

.back-link {
    color: var(--text-light);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 8px 16px;
    border-radius: var(--radius-xl);
    border: 2px solid var(--border);
    transition: color 0.15s, border-color 0.15s;
}

.back-link:hover {
    color: var(--text);
    border-color: var(--text-light);
}

/* ─── LEVEL SELECT SCREEN ────────────────────────────────────────── */
.screen-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 680px;
    margin-bottom: 8px;
}

.back-btn {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    width: 48px;
    height: 48px;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text);
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.back-btn:hover {
    background: var(--border);
    border-color: var(--text-light);
}

.mode-icon-lg {
    font-size: 2rem;
}

.screen-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
}

.levels-desc {
    text-align: center;
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 24px;
    max-width: 480px;
}

.levels-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    width: 100%;
    max-width: 480px;
}

.level-card {
    background: var(--card);
    border: 3px solid var(--border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    display: grid;
    grid-template-columns: 48px 1fr auto;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
    box-shadow: var(--shadow);
}

.level-card:hover:not(.locked) {
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--text-light);
}

.level-card.locked {
    cursor: not-allowed;
    opacity: 0.55;
    background: #f5f5f5;
}

.level-num {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 800;
}

.level-card:not(.locked) .level-num {
    background: var(--mode-color, var(--text));
    color: white;
    border-color: transparent;
}

.level-name {
    font-size: 1rem;
    font-weight: 600;
}

.level-stars {
    display: flex;
    gap: 3px;
}

.star-lit   { color: #ffd166; font-size: 1.1rem; }
.star-dim   { color: #ddd;    font-size: 1.1rem; }

/* ─── GAME SCREEN ────────────────────────────────────────────────── */
.game-header {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 680px;
    margin-bottom: 20px;
}

.quit-btn {
    background: none;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    width: 42px;
    height: 42px;
    font-size: 1rem;
    cursor: pointer;
    color: var(--text-light);
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quit-btn:hover {
    color: var(--error);
    border-color: var(--error);
}

.progress-track {
    flex: 1;
    height: 12px;
    background: var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--success), #4ade80);
    border-radius: var(--radius-xl);
    transition: width 0.4s ease;
}

/* Dot progress micro-rewards */
.dot-progress {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin: 4px 0 2px;
}
.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.25s ease, transform 0.25s cubic-bezier(.4,2,.6,1);
}
.progress-dot.dot-done {
    background: var(--success);
    transform: scale(1.35);
}

/* Streak display */
.streak-display {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    color: #ef476f;
    margin: 2px 0 4px;
    animation: streakPop 0.35s cubic-bezier(.4,2,.6,1);
}
@keyframes streakPop {
    0%   { transform: scale(0.7); opacity: 0; }
    100% { transform: scale(1);   opacity: 1; }
}

/* Streak milestone feedback pulse */
.feedback-display.streak-milestone {
    animation: milestonePulse 0.5s ease;
}
@keyframes milestonePulse {
    0%   { transform: scale(1);   }
    40%  { transform: scale(1.12); }
    100% { transform: scale(1);   }
}

.score-counter {
    font-size: 1.1rem;
    font-weight: 700;
    min-width: 56px;
    text-align: right;
}

/* Question display */
.question-display {
    width: 100%;
    max-width: 680px;
    text-align: center;
    margin-bottom: 16px;
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.q-instruction {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-light);
}

/* ── Big Letter (Letter Detective) */
.big-letter {
    font-size: clamp(7rem, 22vw, 10rem);
    font-weight: 800;
    line-height: 1;
    color: var(--text);
    background: var(--card);
    border: 4px solid var(--border);
    border-radius: var(--radius-lg);
    width: 160px;
    height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow);
    /* Use a clean, standard letter form for training recognition */
    font-family: 'Georgia', 'Times New Roman', serif;
    animation: letterPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes letterPop {
    from { transform: scale(0.5); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ── Big Word (Flip Finder) */
.big-word {
    font-size: clamp(3rem, 12vw, 5rem);
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--text);
    background: var(--card);
    border: 4px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 36px;
    box-shadow: var(--shadow);
    animation: letterPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ── Big Sound Button (Sound Match / Spelling Stars) */
.big-sound-btn {
    background: var(--card);
    border: 4px solid var(--text);
    border-radius: 50%;
    width: 130px;
    height: 130px;
    font-size: 2.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 6px 0 var(--text);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    color: var(--text);
    line-height: 1.2;
    animation: letterPop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.big-sound-btn span {
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.big-sound-btn:hover {
    transform: translateY(3px);
    box-shadow: 0 3px 0 var(--text);
}

.big-sound-btn:active {
    transform: translateY(6px);
    box-shadow: 0 0 0 var(--text);
}

.q-sub {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* ── Word Builder (Spelling Stars) */
.word-builder {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
}

.letter-slot {
    width: 52px;
    height: 58px;
    border-bottom: 4px solid var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
    text-transform: none;
    transition: border-color 0.15s;
}

.letter-slot.filled {
    border-bottom-color: var(--success);
    color: var(--success);
    animation: slotPop 0.2s ease;
}

@keyframes slotPop {
    0%   { transform: scale(0.8); }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}

.clear-btn {
    background: none;
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 8px 18px;
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text-light);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

.clear-btn:hover {
    border-color: var(--error);
    color: var(--error);
}

.hear-btn {
    background: var(--card);
    border: 2px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 10px 22px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.hear-btn:hover {
    transform: translateY(2px);
    box-shadow: none;
}

/* Feedback area */
.feedback-display {
    width: 100%;
    max-width: 480px;
    text-align: center;
    padding: 14px 20px;
    border-radius: var(--radius-md);
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 8px;
    animation: feedbackPop 0.3s ease;
}

@keyframes feedbackPop {
    from { transform: scale(0.85); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.correct-feedback {
    background: var(--success-bg);
    color: #047a5c;
    border: 2px solid var(--success);
}

.wrong-feedback {
    background: var(--error-bg);
    color: #9e1535;
    border: 2px solid var(--error);
}

/* Hint area */
.hint-display {
    width: 100%;
    max-width: 480px;
    background: #fff9e0;
    border: 2px solid #ffd166;
    border-radius: var(--radius-md);
    padding: 12px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #5a4800;
    margin-bottom: 12px;
    text-align: center;
    animation: fadeIn 0.3s ease;
}

/* Choices area */
.choices-display {
    width: 100%;
    max-width: 680px;
    display: grid;
    gap: 12px;
}

.choices-display.choices-4 {
    grid-template-columns: repeat(2, 1fr);
}

.choices-display.choices-2 {
    grid-template-columns: repeat(2, 1fr);
    max-width: 480px;
}

.choices-display.choices-letters {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    max-width: 480px;
}

/* Choice buttons */
.choice-btn {
    font-family: 'Lexend Deca', sans-serif;
    font-weight: 700;
    cursor: pointer;
    border: 3px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    color: var(--text);
    transition: transform 0.1s ease, box-shadow 0.1s ease, background 0.15s, border-color 0.15s;
    box-shadow: 0 4px 0 #d0ccc0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    user-select: none;
}

.choice-btn:hover:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #d0ccc0;
    border-color: var(--text-light);
}

.choice-btn:active:not(:disabled) {
    transform: translateY(4px);
    box-shadow: 0 0 0 #d0ccc0;
}

.choice-btn:disabled {
    cursor: default;
}

/* Letter choice: very large letter */
.letter-choice {
    font-size: clamp(2.5rem, 8vw, 3.5rem);
    font-weight: 800;
    /* Georgia: traditional letter forms — trains recognition of real-world text */
    font-family: 'Georgia', 'Times New Roman', serif;
    min-height: 100px;
}

/* Word choice */
.word-choice {
    font-size: clamp(1.4rem, 5vw, 2rem);
    font-weight: 700;
    letter-spacing: 0.1em;
    min-height: 90px;
}

/* Tile choice (Spelling Stars) */
.tile-choice {
    font-size: clamp(1.6rem, 5vw, 2.2rem);
    font-weight: 800;
    font-family: 'Georgia', 'Times New Roman', serif;
    min-height: 80px;
    text-transform: none;
}

.tile-choice.used {
    opacity: 0.35;
    background: #f5f5f5;
    border-style: dashed;
}

/* Answer result highlights */
.correct-choice {
    background: var(--success-bg) !important;
    border-color: var(--success) !important;
    color: #047a5c !important;
    box-shadow: 0 0 0 3px var(--success) !important;
    animation: correctBounce 0.4s ease;
}

.wrong-choice {
    background: var(--error-bg) !important;
    border-color: var(--error) !important;
    color: #9e1535 !important;
    animation: wrongShake 0.4s ease;
}

@keyframes correctBounce {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

@keyframes wrongShake {
    0%,100% { transform: translateX(0); }
    20%     { transform: translateX(-6px); }
    60%     { transform: translateX(6px); }
}

/* ─── LEVEL COMPLETE SCREEN ──────────────────────────────────────── */
#screen-complete {
    justify-content: center;
}

.complete-card {
    background: var(--card);
    border-radius: var(--radius-lg);
    padding: 40px 32px;
    text-align: center;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg);
    border: 3px solid var(--border);
}

.complete-stars {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.result-star {
    font-size: 3.5rem;
    color: #d0ccc0;
    display: inline-block;
    transition: color 0.3s, transform 0.3s;
}

.result-star.earned-star {
    color: #ffd166;
    animation: starPop 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

@keyframes starPop {
    from { transform: scale(0) rotate(-30deg); opacity: 0; }
    to   { transform: scale(1) rotate(0deg);   opacity: 1; }
}

.complete-message {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.complete-stats {
    color: var(--text-light);
    font-size: 1rem;
    margin-bottom: 28px;
}

.complete-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.btn-primary, .btn-secondary, .btn-ghost {
    font-family: 'Lexend Deca', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 16px 24px;
    border-radius: var(--radius-xl);
    border: none;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    width: 100%;
    letter-spacing: 0.04em;
}

.btn-primary {
    background: var(--text);
    color: white;
    box-shadow: 0 5px 0 #0a0a1a;
}

.btn-primary:hover {
    transform: translateY(2px);
    box-shadow: 0 3px 0 #0a0a1a;
}

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 3px solid var(--border);
    box-shadow: 0 4px 0 var(--border);
}

.btn-secondary:hover {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--border);
}

.btn-ghost {
    background: none;
    color: var(--text-light);
    border: 2px solid var(--border);
}

.btn-ghost:hover {
    border-color: var(--text-light);
    color: var(--text);
}

/* ─── CONFETTI CANVAS ────────────────────────────────────────────── */
#confetti-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
}

/* ─── UTILITY ────────────────────────────────────────────────────── */
.hidden {
    display: none !important;
}

/* ─── RESPONSIVE ─────────────────────────────────────────────────── */
@media (min-width: 520px) {
    .levels-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .complete-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .btn-primary, .btn-secondary, .btn-ghost {
        flex: 1;
        min-width: 140px;
    }
}

@media (max-width: 400px) {
    .mode-grid {
        grid-template-columns: 1fr;
    }

    .choices-display.choices-4 {
        grid-template-columns: repeat(2, 1fr);
    }

    .letter-choice {
        min-height: 80px;
    }
}

/* ═══════════════════════════════════════════════════════════════
   FALLING LETTERS (LETTER RAIN) ARCADE GAME
═══════════════════════════════════════════════════════════════ */

/* The falling game takes the full viewport - no scroll */
#screen-falling {
    padding: 0;
    justify-content: flex-start;
    background: #0d0d1a;
    color: #f0f0ff;
    overflow: hidden;
    height: 100vh;
    max-height: 100vh;
    position: relative;
}

/* ── Top stats bar ───────────────────────────────────────────── */
.fl-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 10px 14px;
    background: rgba(0,0,0,0.45);
    border-bottom: 2px solid rgba(255,255,255,0.08);
    flex-shrink: 0;
    z-index: 10;
}

.fl-stats {
    display: flex;
    gap: 20px;
    font-weight: 700;
    font-size: 1.1rem;
}

.fl-stat-item { letter-spacing: 0.04em; }

.fl-pause-btn {
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: var(--radius-sm);
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.fl-pause-btn:hover { background: rgba(255,255,255,0.25); }

/* ── Target prompt bar ───────────────────────────────────────── */
.fl-target-bar {
    width: 100%;
    text-align: center;
    padding: 6px 12px;
    background: rgba(255,255,255,0.06);
    border-bottom: 1px solid rgba(255,255,255,0.07);
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
    color: #c8c8f0;
    letter-spacing: 0.06em;
    min-height: 36px;
}

.fl-target-letter {
    display: inline-block;
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffd166;
    background: rgba(255,209,102,0.15);
    border: 2px solid rgba(255,209,102,0.4);
    border-radius: 8px;
    padding: 0 10px;
    margin-left: 6px;
    font-family: 'Georgia', serif;
    vertical-align: middle;
    line-height: 1.5;
}

/* ── Canvas ──────────────────────────────────────────────────── */
#fl-canvas {
    display: block;
    flex: 1;
    width: 100%;
    /* height set by JS */
    cursor: default;
}

/* ── On-screen keyboard ──────────────────────────────────────── */
.fl-keyboard {
    width: 100%;
    flex-shrink: 0;
    padding: 6px 4px 8px;
    background: rgba(0,0,0,0.55);
    border-top: 2px solid rgba(255,255,255,0.08);
    display: flex;
    flex-direction: column;
    gap: 5px;
    align-items: center;
    z-index: 10;
}

.fl-kb-row {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.fl-key {
    font-family: 'Lexend Deca', sans-serif;
    font-weight: 700;
    font-size: clamp(0.75rem, 3.5vw, 1rem);
    width:  clamp(28px, 8vw, 42px);
    height: clamp(36px, 9vw, 48px);
    border-radius: 7px;
    border: 2px solid rgba(255,255,255,0.18);
    background: rgba(255,255,255,0.10);
    color: #fff;
    cursor: pointer;
    transition: background 0.1s, transform 0.08s, border-color 0.1s;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    text-transform: none;
    letter-spacing: 0.04em;
}

.fl-key:hover  { background: rgba(255,255,255,0.22); }
.fl-key:active { transform: scale(0.92); }

/* Key highlight when it matches the current target */
.fl-key.fl-key-target {
    background: rgba(255,209,102,0.30);
    border-color: #ffd166;
    color: #ffd166;
    box-shadow: 0 0 10px rgba(255,209,102,0.4);
    animation: fl-key-pulse 1.2s ease-in-out infinite;
}

@keyframes fl-key-pulse {
    0%,100% { box-shadow: 0 0 8px  rgba(255,209,102,0.4); }
    50%      { box-shadow: 0 0 18px rgba(255,209,102,0.8); }
}

/* Key flash on correct hit */
.fl-key.fl-key-hit {
    background: rgba(6,214,160,0.5) !important;
    border-color: #16a34a !important;
    color: #16a34a !important;
    animation: none !important;
}

/* Key flash on wrong hit */
.fl-key.fl-key-miss {
    background: rgba(239,71,111,0.45) !important;
    border-color: #ef476f !important;
    animation: none !important;
}

/* ── Overlays (pause / game over) ────────────────────────────── */
.fl-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10,10,26,0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    animation: fadeIn 0.2s ease;
}

.fl-overlay-card {
    background: #1a1a2e;
    border: 2px solid rgba(255,255,255,0.15);
    border-radius: var(--radius-lg);
    padding: 36px 28px;
    text-align: center;
    width: min(92vw, 380px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.6);
    color: #f0f0ff;
}

.fl-overlay-card h2 {
    font-size: 2rem;
    font-weight: 800;
}

.fl-overlay-card p {
    color: #a0a0c0;
    font-size: 1rem;
}

#fl-go-stars {
    display: flex;
    justify-content: center;
    gap: 12px;
}

/* Wave select screen uses the same .levels-grid styles */
#screen-falling-select {
    background: var(--bg);
}

/* ── Special falling item badges (drawn on canvas, but referenced here for colour palette) ── */
/* These are used by the canvas renderer as fillStyle strings */
/* bomb: #ef476f  |  star: #ffd166  |  heart: #ff6b6b  |  shield: #4ecdc4 */

