/* =====================================================================
   THEME TOKENS
   Bander ships three color themes: Dark (the site's original
   look -- also the default, applied even if no theme has ever been
   chosen), Light, and Rose. A theme is selected by setting
   data-theme="dark" | "light" | "rose" on <html> (see js/app.js /
   js/ui/views/more.js); the attribute is applied as early as possible
   (inline script in index.html's <head>) to avoid a flash of the
   wrong theme. Every color used anywhere below this block should be
   one of these tokens -- a small, deliberately-curated set of
   decorative one-off colors (achievement badge tiles, status
   green/amber/red, shadow black) intentionally stay literal because
   they carry fixed meaning independent of theme.
   ===================================================================== */
:root,
:root[data-theme="dark"] {
    /* surfaces */
    --bg-page: #0b111e;
    --bg-surface: #151d2e;
    --bg-surface-alt: #1a2338;
    --bg-surface-raised: #1e293b;
    --bg-surface-deep: #111827;
    --bg-hover: #334155;

    /* text */
    --text-primary: #f3f4f6;
    --text-heading: #e5e7eb;
    --text-secondary: #9ca3af;
    --text-tertiary: #cbd5e1;
    --text-quaternary: #d1d5db;
    --text-muted: #6b7280;
    --text-on-accent: #0b111e;

    /* accent (brand blue) */
    --accent: #4da3ff;
    --accent-strong: #2563eb;
    /* accent used as TEXT colour (links, tags, breadcrumbs). On Dark the
       brand blue already clears WCAG AA (5.6:1+ on every surface). */
    --accent-text: #4da3ff;
    --accent-hover-light: #6bb4ff;
    --accent-a04: rgba(77, 163, 255, 0.04);
    --accent-a06: rgba(77, 163, 255, 0.06);
    --accent-a08: rgba(77, 163, 255, 0.08);
    --accent-a10: rgba(77, 163, 255, 0.1);
    --accent-a12: rgba(77, 163, 255, 0.12);
    --accent-a14: rgba(77, 163, 255, 0.14);
    --accent-a15: rgba(77, 163, 255, 0.15);
    --accent-a20: rgba(77, 163, 255, 0.2);
    --accent-a22: rgba(77, 163, 255, 0.22);
    --accent-a25: rgba(77, 163, 255, 0.25);
    --accent-a30: rgba(77, 163, 255, 0.3);
    --accent-a35: rgba(77, 163, 255, 0.35);
    --accent-a40: rgba(77, 163, 255, 0.4);
    --accent-a50: rgba(77, 163, 255, 0.5);
    --accent-a55: rgba(77, 163, 255, 0.55);
    --accent-a60: rgba(77, 163, 255, 0.6);
    --accent-a65: rgba(77, 163, 255, 0.65);
    --accent-strong-a08: rgba(37, 99, 235, 0.08);
    --accent-strong-a20: rgba(37, 99, 235, 0.2);
    --accent-strong-a30: rgba(37, 99, 235, 0.3);
    --accent-strong-a40: rgba(37, 99, 235, 0.4);

    /* translucent overlays / hairline borders on top of --bg-surface */
    --overlay-02: rgba(255, 255, 255, 0.02);
    --overlay-03: rgba(255, 255, 255, 0.03);
    --overlay-04: rgba(255, 255, 255, 0.04);
    --overlay-05: rgba(255, 255, 255, 0.05);
    --overlay-06: rgba(255, 255, 255, 0.06);
    --overlay-07: rgba(255, 255, 255, 0.07);
    --overlay-08: rgba(255, 255, 255, 0.08);
    --overlay-10: rgba(255, 255, 255, 0.1);
    --overlay-12: rgba(255, 255, 255, 0.12);
    --overlay-15: rgba(255, 255, 255, 0.15);
    --overlay-18: rgba(255, 255, 255, 0.18);
}

:root[data-theme="light"] {
    /* surfaces */
    --bg-page: #f4f6fa;
    --bg-surface: #ffffff;
    --bg-surface-alt: #f1f5f9;
    --bg-surface-raised: #e8edf4;
    --bg-surface-deep: #eef2f7;
    --bg-hover: #e2e8f0;

    /* text */
    --text-primary: #1f2937;
    --text-heading: #111827;
    --text-secondary: #4b5563;
    --text-tertiary: #64748b;
    --text-quaternary: #94a3b8;
    --text-muted: #6b7280;
    --text-on-accent: #0b111e;

    /* accent -- same brand blue as Dark. Fine for fills, icons and large
       shapes on white, but too faint for small text: text uses
       --accent-text below. */
    --accent: #4da3ff;
    --accent-strong: #2563eb;
    /* accent used as TEXT colour (links, tags, breadcrumbs). The brand blue
       above is only ~2.3-2.6:1 on these light surfaces -- fine for large
       shapes and fills, too faint for small text. This darker shade of the
       same blue is 4.7:1+ on every light surface (WCAG AA). */
    --accent-text: #1a66cc;
    --accent-hover-light: #6bb4ff;
    --accent-a04: rgba(77, 163, 255, 0.04);
    --accent-a06: rgba(77, 163, 255, 0.06);
    --accent-a08: rgba(77, 163, 255, 0.08);
    --accent-a10: rgba(77, 163, 255, 0.1);
    --accent-a12: rgba(77, 163, 255, 0.12);
    --accent-a14: rgba(77, 163, 255, 0.14);
    --accent-a15: rgba(77, 163, 255, 0.15);
    --accent-a20: rgba(77, 163, 255, 0.2);
    --accent-a22: rgba(77, 163, 255, 0.22);
    --accent-a25: rgba(77, 163, 255, 0.25);
    --accent-a30: rgba(77, 163, 255, 0.3);
    --accent-a35: rgba(77, 163, 255, 0.35);
    --accent-a40: rgba(77, 163, 255, 0.4);
    --accent-a50: rgba(77, 163, 255, 0.5);
    --accent-a55: rgba(77, 163, 255, 0.55);
    --accent-a60: rgba(77, 163, 255, 0.6);
    --accent-a65: rgba(77, 163, 255, 0.65);
    --accent-strong-a08: rgba(37, 99, 235, 0.08);
    --accent-strong-a20: rgba(37, 99, 235, 0.2);
    --accent-strong-a30: rgba(37, 99, 235, 0.3);
    --accent-strong-a40: rgba(37, 99, 235, 0.4);

    /* overlays flip to dark-on-light */
    --overlay-02: rgba(15, 23, 42, 0.03);
    --overlay-03: rgba(15, 23, 42, 0.04);
    --overlay-04: rgba(15, 23, 42, 0.045);
    --overlay-05: rgba(15, 23, 42, 0.06);
    --overlay-06: rgba(15, 23, 42, 0.07);
    --overlay-07: rgba(15, 23, 42, 0.08);
    --overlay-08: rgba(15, 23, 42, 0.09);
    --overlay-10: rgba(15, 23, 42, 0.11);
    --overlay-12: rgba(15, 23, 42, 0.14);
    --overlay-15: rgba(15, 23, 42, 0.18);
    --overlay-18: rgba(15, 23, 42, 0.22);
}

:root[data-theme="rose"] {
    /* surfaces -- soft blush pinks, matching the "Rose / Palette #1" swatches */
    --bg-page: #fff5f6;
    --bg-surface: #ffffff;
    --bg-surface-alt: #fdedef;
    --bg-surface-raised: #fbdee2;
    --bg-surface-deep: #f8d3d8;
    --bg-hover: #fcc6cc;

    /* text -- warm near-black instead of neutral grey, to stay on-theme */
    --text-primary: #3a1620;
    --text-heading: #2a0f16;
    --text-secondary: #8a4a56;
    --text-tertiary: #a9727c;
    --text-quaternary: #c9a3aa;
    --text-muted: #a9727c;
    --text-on-accent: #ffffff;

    /* accent -- the deep rose/burgundy from the palette (#C60726) */
    --accent: #c60726;
    --accent-strong: #a30420;
    /* accent used as TEXT colour. The rose accent dips to ~4.4:1 on the
       deepest rose surface, so text uses the stronger shade (5.9:1+ on
       every rose surface, WCAG AA). */
    --accent-text: #a30420;
    --accent-hover-light: #db2c48;
    --accent-a04: rgba(198, 7, 38, 0.04);
    --accent-a06: rgba(198, 7, 38, 0.06);
    --accent-a08: rgba(198, 7, 38, 0.08);
    --accent-a10: rgba(198, 7, 38, 0.1);
    --accent-a12: rgba(198, 7, 38, 0.12);
    --accent-a14: rgba(198, 7, 38, 0.14);
    --accent-a15: rgba(198, 7, 38, 0.15);
    --accent-a20: rgba(198, 7, 38, 0.2);
    --accent-a22: rgba(198, 7, 38, 0.22);
    --accent-a25: rgba(198, 7, 38, 0.25);
    --accent-a30: rgba(198, 7, 38, 0.3);
    --accent-a35: rgba(198, 7, 38, 0.35);
    --accent-a40: rgba(198, 7, 38, 0.4);
    --accent-a50: rgba(198, 7, 38, 0.5);
    --accent-a55: rgba(198, 7, 38, 0.55);
    --accent-a60: rgba(198, 7, 38, 0.6);
    --accent-a65: rgba(198, 7, 38, 0.65);
    --accent-strong-a08: rgba(163, 4, 32, 0.08);
    --accent-strong-a20: rgba(163, 4, 32, 0.2);
    --accent-strong-a30: rgba(163, 4, 32, 0.3);
    --accent-strong-a40: rgba(163, 4, 32, 0.4);

    /* overlays -- warm rose-tinted instead of neutral */
    --overlay-02: rgba(122, 20, 40, 0.03);
    --overlay-03: rgba(122, 20, 40, 0.04);
    --overlay-04: rgba(122, 20, 40, 0.045);
    --overlay-05: rgba(122, 20, 40, 0.06);
    --overlay-06: rgba(122, 20, 40, 0.07);
    --overlay-07: rgba(122, 20, 40, 0.08);
    --overlay-08: rgba(122, 20, 40, 0.09);
    --overlay-10: rgba(122, 20, 40, 0.11);
    --overlay-12: rgba(122, 20, 40, 0.14);
    --overlay-15: rgba(122, 20, 40, 0.18);
    --overlay-18: rgba(122, 20, 40, 0.22);
}

/* --- CORE STYLES & LAYOUT SYSTEM ---
   html/body are pinned to exactly one viewport and never scroll
   themselves — the landing page (#lp-root) and the app (#app-wrapper >
   .main-content) each own and scroll their own internal container
   instead. Without this, whichever of those two ever ends up taller
   than the viewport (e.g. the app's sidebar content, or — as here — a
   Home page that's grown past one screen) makes the page itself
   scrollable too, producing a second scrollbar right alongside the
   app's own one. */
html {
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-page);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
}

.app-container {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    transition: grid-template-columns 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- SIDEBAR PANEL STYLES --- */
.sidebar {
    background-color: var(--bg-surface-deep);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--overlay-05);
    height: 100vh;
    /* Own internal scroll, matching .main-content — since html/body no
       longer scroll (see above), a sidebar taller than the viewport
       (e.g. a very short window) needs somewhere to send its overflow
       rather than getting silently clipped off-screen. */
    overflow-y: auto;
    box-sizing: border-box;
    position: sticky;
    top: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 10;
}

.brand-title-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 35px;
}

.brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--text-primary); /* was #ffffff: invisible on Light/Rose */
}

.brand-title span {
    color: var(--accent-text);
}

.logo-svg {
    width: 32px;
    height: 32px;
}

.nav-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--overlay-03);
    color: var(--text-primary); /* was #ffffff: invisible on Light/Rose */
}

.nav-item.active {
    background: var(--accent-a10);
    color: var(--accent-text);
    font-weight: 600;
    box-shadow: inset 0 0 0 1px var(--accent-a25);
}

/* --- SIDEBAR NAV ICONS -- a quick color-coded visual aid so each
   destination is recognizable at a glance, not just by its label (the
   same idea as an app like Duolingo giving every nav item its own little
   icon). Each gets its own tint so the sidebar reads at a glance instead
   of as a wall of same-weight text; the row's own hover/active state
   (above) still carries the "where am I" signal, this is just wayfinding. --- */
.nav-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item-icon svg {
    width: 17px;
    height: 17px;
}

.nav-item-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-item-icon-home { background: rgba(77, 163, 255, 0.14); color: #4da3ff; }
.nav-item-icon-practice { background: rgba(52, 211, 153, 0.14); color: #34d399; }
.nav-item-icon-submit { background: rgba(251, 191, 36, 0.16); color: #fbbf24; }
.nav-item-icon-submissions { background: rgba(167, 139, 250, 0.16); color: #a78bfa; }
.nav-item-icon-progress { background: rgba(251, 113, 133, 0.16); color: #fb7185; }
.nav-item-icon-vocabulary { background: rgba(45, 212, 191, 0.16); color: #2dd4bf; }
.nav-item-icon-leaderboard { background: rgba(234, 179, 8, 0.16); color: #eab308; }
.nav-item-icon-more { background: var(--overlay-08); color: var(--text-tertiary); }

.profile-badge {
    background: var(--overlay-03);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--overlay-05);
    /* Sits at the top of the sidebar now, right under the brand -- this
       is the gap before the nav links below it. */
    margin-bottom: 22px;
}

.profile-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.profile-level {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* --- MAIN WORKSPACE WORK AREA --- */
.main-content {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    padding: 30px;
    box-sizing: border-box;
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 20px;
    margin-bottom: 24px;
    width: 100%;
}

.streak-container {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border: 1px solid rgba(249, 115, 22, 0.15);
}

.premium-btn {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--accent-strong-a20);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.premium-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--accent-strong-a30);
}

.workspace-card {
    background: var(--bg-surface-deep);
    border: 1px solid var(--overlay-05);
    border-radius: 16px;
    padding: 30px;
    flex-grow: 1;
    width: 100%;
    box-sizing: border-box;
}

/* --- FULL-SCREEN / COLLAPSED STATE STYLES --- */
.app-container.sidebar-collapsed {
    grid-template-columns: 0px 1fr;
}

.app-container.sidebar-collapsed #sidebar-panel {
    transform: translateX(-260px);
    opacity: 0;
    pointer-events: none;
    padding: 24px 0;
}

.sidebar-toggle-btn {
    background: var(--bg-surface-raised);
    border: 1px solid var(--overlay-15);
    color: var(--text-tertiary);
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: auto; /* Pushes the user stats to the right side */
}

.sidebar-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-text);
    border-color: var(--accent);
}

.toggle-icon {
    width: 20px;
    height: 20px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-container.sidebar-collapsed .toggle-icon {
    transform: rotate(180deg);
}

/* --- SHARED VIEW HEADER --- */
.dashboard-view h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 6px;
}

.dashboard-view .view-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0;
    margin-bottom: 28px;
}

.breadcrumb-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent-text);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 16px;
    transition: opacity 0.2s ease;
}

.breadcrumb-back:hover {
    opacity: 0.75;
}

/* --- CATEGORY SELECTION GRID ("Choose a Data Visualization Practice Task") --- */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.category-card {
    position: relative;
    background: radial-gradient(circle at 30% 0%, var(--accent-a08), var(--overlay-02) 60%), var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
    overflow: hidden;
}

.category-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 14px;
    padding: 1px;
    background: linear-gradient(135deg, var(--accent-a50), transparent 40%);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.category-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-a35);
    box-shadow: 0 12px 28px var(--accent-a12);
}

.category-card:hover::before {
    opacity: 1;
}

.category-card .category-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--accent-a10);
    color: var(--accent-text);
}

.category-card .category-icon svg {
    width: 28px;
    height: 28px;
}

/* --- PRACTICE SKILL SELECTOR ICONS -- each of the four IELTS skills gets
   its own tint (matching the sidebar's icon colors) so the top-level
   Practice picker reads as clearly at a glance as the sidebar does,
   instead of four identical blue badges. --- */
.category-card .category-icon.category-icon-reading { background: rgba(45, 212, 191, 0.14); color: #2dd4bf; }
.category-card .category-icon.category-icon-listening { background: rgba(167, 139, 250, 0.14); color: #a78bfa; }
.category-card .category-icon.category-icon-writing { background: rgba(77, 163, 255, 0.14); color: #4da3ff; }
.category-card .category-icon.category-icon-speaking { background: rgba(251, 113, 133, 0.14); color: #fb7185; }

.category-card.is-placeholder .category-icon.category-icon-reading,
.category-card.is-placeholder .category-icon.category-icon-listening,
.category-card.is-placeholder .category-icon.category-icon-speaking {
    background: var(--overlay-05);
    color: var(--text-muted);
}

.category-card .category-label {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
}

.category-card .category-tag {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent-text);
    background: var(--accent-a12);
    padding: 3px 10px;
    border-radius: 20px;
}

.category-card.is-placeholder .category-icon {
    background: var(--overlay-05);
    color: var(--text-muted);
}

.category-card.is-placeholder .category-tag {
    color: var(--text-secondary);
    background: var(--overlay-05);
}

/* --- PAGINATION NAV (Previous / Next) --- */
.pagination-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 20px;
    border-top: 1px solid var(--overlay-05);
}

.page-nav-btn {
    background: var(--bg-surface-raised);
    border: 1px solid var(--overlay-10);
    color: var(--text-tertiary);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.page-nav-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--accent-text);
    border-color: var(--accent);
}

.page-nav-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.page-indicator {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

/* --- TEST SELECTION GRID (Test 1 / Test 2 etc.) --- */
.task-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 12px;
}

.test-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 24px;
    transition: border-color 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.test-card:hover {
    border-color: var(--accent-a35);
}

.test-card .test-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-a10);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
}

.test-card .test-card-icon svg {
    width: 22px;
    height: 22px;
}

.test-card .test-card-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.test-card .test-card-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.test-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
    padding-top: 6px;
}

/* Some Task 1 cards now show three actions (Vocab Quiz, Practice, and
   Writing Sample) rather than the usual two. flex-basis + min-width (with
   the container's flex-wrap above) lets two buttons share a row as before,
   while a third wraps onto its own full-width row instead of squeezing
   all three and clipping their labels. */
.test-action-btn {
    flex: 1 1 110px;
    min-width: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    white-space: nowrap;
}

.test-action-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.test-action-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: white;
    box-shadow: 0 4px 12px var(--accent-strong-a20);
}

.test-action-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--accent-strong-a30);
}

.test-action-secondary {
    background: transparent;
    border-color: var(--overlay-15);
    color: var(--text-tertiary);
}

.test-action-secondary:hover {
    border-color: var(--accent);
    color: var(--accent-text);
}

/* The "Writing Sample" button that sits next to "Write Essay" on Task 2
   test cards -- a softer, filled-tint treatment so it reads as "open a
   resource" rather than competing with the primary/secondary actions. */
.test-action-tertiary {
    background: var(--accent-a10);
    border-color: var(--accent-a25);
    color: var(--accent-text);
}

.test-action-tertiary:hover {
    background: var(--accent-a15);
    border-color: var(--accent);
}

/* --- WRITING SAMPLE MODAL --- */
.writing-sample-modal-card {
    max-width: 640px;
    max-height: 85vh;
    overflow-y: auto;
}

.writing-sample-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.writing-sample-header .modal-title {
    margin: 0;
}

.writing-sample-band-tag {
    flex-shrink: 0;
    background: var(--accent-a12);
    color: var(--accent-text);
    font-weight: 700;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.writing-sample-prompt {
    margin-bottom: 18px;
    font-style: italic;
}

.writing-sample-essay {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.writing-sample-wordcount {
    margin-top: 14px;
    margin-bottom: 0;
}

/* --- QUESTION PLAYER --- */
.player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 20px;
}

.progress-bar-track {
    flex-grow: 1;
    height: 8px;
    background: var(--overlay-06);
    border-radius: 999px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-strong));
    border-radius: 999px;
    transition: width 0.3s ease;
}

.progress-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.player-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
}

.player-image-frame {
    background: var(--bg-page);
    border: 1px solid var(--overlay-06);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    max-width: 560px;
    margin: 0 auto 24px;
}

.player-image-frame img {
    max-width: 100%;
    border-radius: 8px;
    display: block;
}

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

.skill-tag {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--accent-text);
    background: var(--accent-a10);
    padding: 4px 10px;
    border-radius: 20px;
    margin-bottom: 14px;
}

.sentence-block {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--text-primary);
    margin-bottom: 24px;
}

.sentence-blank {
    display: inline-block;
    min-width: 90px;
    text-align: center;
    border-bottom: 2px solid var(--accent);
    color: var(--accent-text);
    font-weight: 700;
    padding: 0 4px;
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.option-btn {
    background: var(--bg-surface-alt);
    border: 1px solid var(--overlay-08);
    color: var(--text-heading);
    padding: 14px 16px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.option-btn:hover:not(:disabled) {
    border-color: var(--accent);
    background: var(--accent-a08);
}

.option-btn:disabled {
    cursor: default;
}

.option-btn.is-correct {
    background: rgba(34, 197, 94, 0.12);
    border-color: #22c55e;
    color: #86efac;
}

.option-btn.is-incorrect {
    background: rgba(239, 68, 68, 0.12);
    border-color: #ef4444;
    color: #fca5a5;
}

.explanation-box {
    background: var(--overlay-03);
    border: 1px solid var(--overlay-06);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 16px 18px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.explanation-box strong {
    color: var(--text-primary);
}

.player-footer {
    display: flex;
    justify-content: flex-end;
}

.primary-action-btn {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--accent-strong-a20);
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.primary-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px var(--accent-strong-a30);
}

.primary-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* --- RESULTS SCREEN --- */
.results-screen {
    text-align: center;
    padding: 40px 20px;
}

.results-score {
    font-size: 3rem;
    font-weight: 800;
    color: var(--accent-text);
    margin-bottom: 8px;
}

.results-label {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.results-actions {
    display: flex;
    flex-wrap: wrap; /* room for the "Up next" button on narrow screens */
    gap: 12px;
    justify-content: center;
}

.secondary-action-btn {
    background: transparent;
    border: 1px solid var(--overlay-15);
    color: var(--text-tertiary);
    padding: 12px 24px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-action-btn:hover {
    border-color: var(--accent);
    color: var(--accent-text);
}

/* --- MODE TOGGLE (Student / Teacher) --- */
.mode-toggle-group {
    margin-bottom: 16px;
}

.mode-toggle-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.mode-toggle {
    display: flex;
    background: var(--overlay-03);
    border: 1px solid var(--overlay-06);
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
}

.mode-toggle-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mode-toggle-btn:hover {
    color: var(--text-heading);
}

.mode-toggle-btn.active {
    background: var(--accent);
    color: var(--text-on-accent);
}

/* --- WRITING TASK VIEW --- */
.task-prompt-box {
    background: var(--accent-a06);
    border: 1px solid var(--accent-a20);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 16px 18px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-heading);
    margin-bottom: 24px;
}

.essay-textarea {
    width: 100%;
    min-height: 260px;
    background: var(--bg-page);
    border: 1px solid var(--overlay-08);
    border-radius: 10px;
    padding: 16px;
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.6;
    font-family: inherit;
    box-sizing: border-box;
    resize: vertical;
    margin-bottom: 8px;
}

.essay-textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.essay-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.submission-meta-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 180px;
}

.text-input {
    background: var(--bg-page);
    border: 1px solid var(--overlay-08);
    border-radius: 8px;
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
}

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

.text-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

.spellcheck-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--overlay-03);
    border: 1px solid var(--overlay-10);
    color: var(--text-secondary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.spellcheck-toggle-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.spellcheck-toggle-btn:hover {
    opacity: 0.85;
}

.spellcheck-toggle-btn.is-on {
    border-color: rgba(34, 197, 94, 0.3);
    color: #86efac;
    background: rgba(34, 197, 94, 0.08);
}

.spellcheck-toggle-btn.is-off {
    border-color: rgba(249, 115, 22, 0.3);
    color: #f97316;
    background: rgba(249, 115, 22, 0.08);
}

.essay-meta-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.essay-meta-row span {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* --- SUBMISSIONS LIST --- */
.submissions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.submissions-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

.submission-row {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.submission-row:hover {
    border-color: var(--accent-a35);
    transform: translateY(-2px);
}

.submission-row-title {
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.submission-row-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.submission-status {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 6px 12px;
    border-radius: 20px;
    white-space: nowrap;
}

.submission-status.status-pending {
    background: rgba(249, 115, 22, 0.1);
    color: #f97316;
}

.submission-status.status-reviewed {
    background: rgba(34, 197, 94, 0.12);
    color: #86efac;
}

/* --- ESSAY DISPLAY & TEACHER GRADING --- */
.essay-display-box {
    background: var(--bg-page);
    border: 1px solid var(--overlay-06);
    border-radius: 10px;
    padding: 20px;
    color: var(--text-heading);
    line-height: 1.7;
    margin-bottom: 20px;
}

.teacher-grading-box {
    background: var(--overlay-02);
    border: 1px solid var(--overlay-06);
    border-radius: 12px;
    padding: 20px;
}

.grading-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
    margin-top: 16px;
}

.grading-label:first-child {
    margin-top: 0;
}

.band-select {
    width: 100%;
    max-width: 200px;
    background: var(--bg-surface-alt);
    border: 1px solid var(--overlay-08);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.band-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* --- VOCABULARY SYNONYM GAME: LEVEL SELECT --- */
.vocab-level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.vocab-level-card {
    background: radial-gradient(circle at 30% 0%, var(--accent-a08), var(--overlay-02) 60%), var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.vocab-level-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-a35);
}

.vocab-level-icon {
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--accent-a10);
    color: var(--accent-text);
}

.vocab-level-icon svg {
    width: 26px;
    height: 26px;
}

.vocab-level-title {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.vocab-level-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 6px;
}

/* =====================================================================
   INTERACTION UPGRADE LAYER
   Tool -> Service polish pass. Nothing here changes copy or test content —
   it only changes how the interface responds to being touched: view
   transitions, toast notifications in place of native alerts, visible
   focus states, tactile press feedback, and a sliding mode toggle.
   ===================================================================== */

/* --- 1. VIEW TRANSITIONS ---
   Every renderShell() call replays this animation so moving between
   views (category menu -> dashboard -> quiz -> results) feels like one
   continuous flow instead of a hard content swap. */
.workspace-card.view-enter {
    animation: viewEnter 0.32s cubic-bezier(0.16, 1, 0.3, 1) both;
}

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

/* --- 2. TOAST NOTIFICATIONS ---
   Replaces native alert() popups. Stacks bottom-right, auto-dismisses,
   and can be tapped away early. */
.toast-stack {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    max-width: min(360px, calc(100vw - 48px));
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg-surface-alt);
    border: 1px solid var(--overlay-08);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 13px 16px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
    color: var(--text-heading);
    font-size: 0.88rem;
    line-height: 1.5;
    cursor: pointer;
    opacity: 0;
    transform: translateY(8px) scale(0.98);
    transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.toast.toast-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast-dot {
    flex-shrink: 0;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-top: 5px;
    background: var(--accent);
}

.toast.toast-success {
    border-left-color: #22c55e;
}

.toast.toast-success .toast-dot {
    background: #22c55e;
}

.toast.toast-error {
    border-left-color: #ef4444;
}

.toast.toast-error .toast-dot {
    background: #ef4444;
}

/* --- 3. VISIBLE FOCUS STATES ---
   Keyboard users get the same clarity mouse users get from hover. */
.nav-item:focus-visible,
.category-card:focus-visible,
.test-card:focus-visible,
.option-btn:focus-visible,
.primary-action-btn:focus-visible,
.secondary-action-btn:focus-visible,
.page-nav-btn:focus-visible,
.test-action-btn:focus-visible,
.mode-toggle-btn:focus-visible,
.premium-btn:focus-visible,
.sidebar-toggle-btn:focus-visible,
.submission-row:focus-visible,
.text-input:focus-visible,
.band-select:focus-visible,
.essay-textarea:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* --- 4. TACTILE PRESS FEEDBACK ---
   Every clickable surface compresses slightly on press, so the interface
   confirms a tap before the next screen even renders. */
.premium-btn:active,
.primary-action-btn:active:not(:disabled),
.secondary-action-btn:active,
.page-nav-btn:active:not(:disabled),
.test-action-btn:active,
.option-btn:active:not(:disabled),
.sidebar-toggle-btn:active,
.mode-toggle-btn:active {
    transform: scale(0.96);
}

.category-card:active,
.test-card:active,
.vocab-level-card:active {
    transform: translateY(-1px) scale(0.985);
}

.submission-row {
    transition: transform 0.15s ease, border-color 0.2s ease, background 0.2s ease;
}

.submission-row:active {
    transform: scale(0.99);
}

/* Ready-to-continue pulse: draws the eye to Next once an answer locks in. */
.primary-action-btn.btn-ready {
    animation: readyPulse 0.5s ease;
}

@keyframes readyPulse {
    0% {
        box-shadow: 0 4px 12px var(--accent-strong-a20);
    }
    40% {
        box-shadow: 0 4px 20px var(--accent-a55);
    }
    100% {
        box-shadow: 0 4px 12px var(--accent-strong-a20);
    }
}

/* --- 5. QUIZ MOMENT-OF-TRUTH MICRO-INTERACTIONS --- */
.sentence-blank {
    transition: color 0.2s ease, border-color 0.2s ease;
}

.blank-correct {
    animation: blankPop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: #86efac;
    border-color: #22c55e;
}

.blank-incorrect {
    color: #fca5a5;
    border-color: #ef4444;
    animation: blankShake 0.35s ease;
}

@keyframes blankPop {
    0% { transform: scale(1); }
    50% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

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

.explanation-enter {
    animation: explanationEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes explanationEnter {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.explanation-box.explanation-correct {
    border-left-color: #22c55e;
}

.explanation-box.explanation-incorrect {
    border-left-color: #ef4444;
}

/* --- 6. SLIDING MODE TOGGLE ---
   A single indicator glides between Student and Teacher instead of each
   button independently swapping its own background. */
.mode-toggle {
    position: relative;
}

.mode-toggle-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: var(--accent);
    border-radius: 7px;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 0;
}

.mode-toggle-btn {
    position: relative;
    z-index: 1;
    background: transparent;
}

.mode-toggle-btn.active {
    background: transparent;
    color: var(--text-on-accent);
}

/* --- 7. MOTION SAFETY ---
   Respect reduced-motion preferences across every animation introduced
   above; content still updates instantly, just without the flourish. */
@media (prefers-reduced-motion: reduce) {
    .workspace-card.view-enter,
    .blank-correct,
    .blank-incorrect,
    .explanation-enter,
    .primary-action-btn.btn-ready {
        animation: none;
    }

    .toast,
    .mode-toggle-indicator,
    .category-card,
    .test-card,
    .vocab-level-card,
    .submission-row,
    .premium-btn,
    .primary-action-btn,
    .secondary-action-btn,
    .page-nav-btn,
    .test-action-btn,
    .option-btn,
    .sidebar-toggle-btn,
    .mode-toggle-btn {
        transition: none;
    }
}


/* =====================================================================
   PROGRESS VIEW: SKILL RADAR
   ===================================================================== */
.progress-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(220px, 1fr);
    gap: 24px;
    align-items: stretch;
    margin-bottom: 24px;
}

.radar-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 16px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-svg {
    width: 100%;
    max-width: 520px;
    height: auto;
}

.radar-label {
    fill: var(--text-tertiary);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
}

.insights-panel {
    display: flex;
    flex-direction: column;
    gap: 12px;
    justify-content: center;
}

.insights-eyebrow {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
    text-align: right;
}

.insights-card {
    background: radial-gradient(circle at 100% 0%, var(--accent-a08), var(--overlay-02) 60%), var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 16px;
    padding: 22px;
}

.insights-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.insights-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.insights-header svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.insights-card p {
    margin: 0;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--text-tertiary);
}

.insight-highlight {
    color: #f97316;
}

.mastery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.mastery-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 18px 20px;
}

.mastery-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.mastery-check {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.mastery-bar-track {
    height: 8px;
    background: var(--overlay-06);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 8px;
}

.mastery-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.mastery-bar-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.progress-disclaimer {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 4px;
}

@media (max-width: 800px) {
    .progress-layout {
        grid-template-columns: 1fr;
    }

    .insights-eyebrow {
        text-align: left;
    }
}

/* =====================================================================
   SIDEBAR: BAND GOAL WIDGET
   ===================================================================== */
.band-goal-card {
    background: var(--overlay-03);
    border: 1px solid var(--overlay-05);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
}

.band-goal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.band-goal-check {
    width: 16px;
    height: 16px;
    color: #22c55e;
    flex-shrink: 0;
}

.band-goal-sparkline {
    width: 100%;
    height: 32px;
    display: block;
}

.band-goal-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* =====================================================================
   TEACHER DASHBOARD: STAT CARDS
   ===================================================================== */
.stat-card-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin: 20px 0 24px;
}

.stat-card {
    border-radius: 14px;
    padding: 22px 24px;
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
}

.stat-card-blue {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
}

.stat-card-teal {
    background: linear-gradient(135deg, #2dd4bf 0%, #0f766e 100%);
}

.stat-card-number {
    font-size: 2.4rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card-label {
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0.92;
}

.stat-card-breakdown {
    display: flex;
    gap: 8px;
    margin-top: 14px;
    flex-wrap: wrap;
}

.stat-chip {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--overlay-18);
}

.stat-chip-marked {
    background: rgba(34, 197, 94, 0.35);
}

.stat-chip-unmarked {
    background: rgba(251, 191, 36, 0.3);
}

/* --- Student ID chips (used inline next to names) --- */
.student-id-chip {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-text);
    background: var(--accent-a12);
    border: 1px solid var(--accent-a25);
    border-radius: 6px;
    padding: 1px 7px;
    margin-left: 4px;
    vertical-align: middle;
    letter-spacing: 0.02em;
}

.assigned-teacher-note {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 6px 0 0;
}

.assigned-teacher-note strong {
    color: var(--text-primary);
}

.student-id-note {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: -8px;
}

/* =====================================================================
   CONFIRM MODAL
   ===================================================================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.6);
    backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 20px;
}

.modal-overlay.modal-visible {
    opacity: 1;
}

.modal-card {
    background: var(--bg-surface-deep);
    border: 1px solid var(--overlay-08);
    border-radius: 16px;
    padding: 28px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
    transform: translateY(12px) scale(0.97);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.modal-visible .modal-card {
    transform: translateY(0) scale(1);
}

.modal-title {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-message {
    margin: 0 0 22px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-tertiary);
}

.modal-message strong {
    color: var(--accent-text);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

@media (prefers-reduced-motion: reduce) {
    .modal-overlay,
    .modal-card {
        transition: none;
    }
}

/* =====================================================================
   STUDENT ROSTER & PROFILE ADDITIONS
   ===================================================================== */
.stat-card-clickable {
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.32);
}

.stat-card-clickable:active {
    transform: translateY(0) scale(0.98);
}

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 6px;
}

.overall-band-note {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 4px 0 16px;
}

.overall-band-note strong {
    color: var(--accent-text);
    font-size: 1rem;
}

.profile-section-heading {
    margin-top: 32px;
    margin-bottom: 4px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* =====================================================================
   SHARE TO CHAT (icon button + essay actions row)
   ===================================================================== */
.essay-actions-row {
    display: flex;
    justify-content: flex-end;
    margin: 12px 0 20px;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.icon-btn-svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* =====================================================================
   OFFLINE SUBMISSION ATTACHMENTS
   ===================================================================== */
.essay-empty-note {
    color: var(--text-secondary);
    font-style: italic;
}

.attachment-section {
    margin: 4px 0 20px;
}

.attachment-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.attachment-thumb {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--overlay-10);
    cursor: pointer;
    flex-shrink: 0;
}

.attachment-file-icon {
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-a08);
    border: 1px solid var(--accent-a20);
    border-radius: 8px;
    color: var(--accent-text);
    flex-shrink: 0;
    font-size: 30px;
    line-height: 1;
}

.attachment-file-icon svg {
    width: 30px;
    height: 30px;
}

/* =====================================================================
   DRAG-AND-DROP UPLOAD ZONE
   Shared by: teacher offline submission, attachment replace, test
   editor image upload, and the Submit Work form.
   ===================================================================== */
.drop-zone {
    border: 2px dashed var(--accent-a35);
    border-radius: 14px;
    padding: 32px 20px;
    text-align: center;
    cursor: pointer;
    background: var(--overlay-02);
    transition: border-color 0.2s ease, background-color 0.2s ease, transform 0.15s ease;
    outline: none;
}

.drop-zone:hover,
.drop-zone:focus-visible {
    border-color: var(--accent-a60);
    background: var(--accent-a04);
}

.drop-zone.drop-zone-active {
    border-color: var(--accent);
    background: var(--accent-a10);
    transform: scale(1.02);
}

.drop-zone-compact {
    padding: 20px 16px;
}

.drop-zone-icon {
    width: 34px;
    height: 34px;
    color: var(--accent-text);
    margin-bottom: 10px;
    pointer-events: none;
}

.drop-zone-text {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    pointer-events: none;
}

.drop-zone-subtext {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 4px;
    pointer-events: none;
}

.drop-zone-browse-link {
    color: var(--accent-text);
    font-weight: 600;
    text-decoration: underline;
}

.drop-zone-hint {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin-top: 10px;
    pointer-events: none;
}

.drop-zone-status {
    color: #86efac;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 10px;
    pointer-events: none;
}

.drop-zone-status:empty {
    display: none;
}

@media (prefers-reduced-motion: reduce) {
    .drop-zone {
        transition: none;
    }
    .drop-zone.drop-zone-active {
        transform: none;
    }
}

.attachment-meta {
    flex: 1;
    min-width: 140px;
}

.attachment-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.92rem;
    word-break: break-word;
}

.attachment-size {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 2px;
}

.attachment-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.attachment-actions .secondary-action-btn {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.attachment-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.attachment-hint {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    margin-top: 8px;
}

.attachment-badge {
    font-size: 0.85rem;
    vertical-align: middle;
}

/* =====================================================================
   VOCABULARY: SPACED REPETITION UI
   ===================================================================== */
.srs-due-badge {
    display: inline-block;
    background: var(--accent-a12);
    border: 1px solid var(--accent-a25);
    color: var(--accent-text);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 999px;
    margin: 10px 0 14px;
}

.srs-due-badge.srs-due-none {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.25);
    color: #22c55e;
}

.srs-status-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
}

.srs-status-new {
    background: rgba(156, 163, 175, 0.15);
    color: var(--text-secondary);
}

.srs-status-learning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.srs-status-reviewing {
    background: var(--accent-a15);
    color: var(--accent-text);
}

.srs-status-mastered {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.srs-summary-row {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin: 18px 0 8px;
    flex-wrap: wrap;
}

.srs-summary-stat {
    text-align: center;
}

.srs-summary-stat strong {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
}

.srs-summary-stat span {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

/* =====================================================================
   TEACHER HOME DASHBOARD (Walmart-style tile grid)
   Purely visual — every tile links to an existing view or a "coming soon"
   toast. No structural/behavioral changes live here.
   ===================================================================== */
.dash-tile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 130px;
    grid-auto-flow: dense;
    gap: 16px;
    margin: 20px 0 16px;
}

.dash-tile {
    position: relative;
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    overflow: hidden;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.dash-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32);
}

.dash-tile:active {
    transform: translateY(0) scale(0.98);
}

.dash-tile-text {
    position: relative;
    z-index: 1;
}

.dash-tile-title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

.dash-tile-subtitle {
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
    opacity: 0.92;
    margin-top: 4px;
}

.dash-tile-art {
    position: absolute;
    right: -8px;
    bottom: -8px;
    width: 110px;
    height: 110px;
    opacity: 0.95;
    pointer-events: none;
}

.dash-tile-art svg {
    width: 100%;
    height: 100%;
}

/* --- Tile sizes (masonry-style spans, browser packs them via `dense`) --- */
.tile-hero {
    grid-column: span 2;
    grid-row: span 2;
}

.tile-hero .dash-tile-title {
    font-size: 1.9rem;
}

.tile-hero .dash-tile-art {
    width: 170px;
    height: 170px;
}

.tile-tall {
    grid-row: span 2;
}

.tile-wide {
    grid-column: span 2;
}

.tile-normal {
    grid-column: span 1;
    grid-row: span 1;
}

/* --- Tile color themes --- */
.tile-blue { background: linear-gradient(135deg, #4da3ff 0%, #2563eb 100%); }
.tile-teal { background: linear-gradient(135deg, #2dd4bf 0%, #0f766e 100%); }
.tile-gold { background: linear-gradient(135deg, #fbbf24 0%, #b45309 100%); }
.tile-purple { background: linear-gradient(135deg, #a78bfa 0%, #6d28d9 100%); }
.tile-coral { background: linear-gradient(135deg, #fb7185 0%, #be123c 100%); }
.tile-cyan { background: linear-gradient(135deg, #22d3ee 0%, #0e7490 100%); }
.tile-pink { background: linear-gradient(135deg, #f472b6 0%, #be185d 100%); }
.tile-navy { background: linear-gradient(135deg, #334155 0%, #0f172a 100%); }

.dash-classic-link {
    color: var(--text-muted);
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
    width: fit-content;
}

.dash-classic-link:hover {
    color: var(--accent-text);
}

@media (max-width: 900px) {
    .dash-tile-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .tile-hero,
    .tile-wide {
        grid-column: span 2;
    }
}

@media (max-width: 520px) {
    .dash-tile-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 140px;
    }

    .tile-hero {
        grid-row: span 2;
    }

    .tile-hero,
    .tile-tall,
    .tile-wide,
    .tile-normal {
        grid-column: span 1;
    }
}

/* =====================================================================
   TEST LIBRARY (Teacher) & TEST EDITOR
   ===================================================================== */
.test-library-section {
    margin-bottom: 28px;
}

.test-library-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.test-library-section-head h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.question-editor-row {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 12px;
    padding: 16px 18px;
    margin-bottom: 14px;
}

.question-editor-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

/* =====================================================================
   PARTICIPATION PROGRESS SYSTEM
   Independent of the Daily Streak. Vanilla CSS transitions/keyframes stand
   in for Framer Motion — same visual result, no React runtime required.
   ===================================================================== */
.participation-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 16px;
    padding: 22px 26px 18px;
    margin-bottom: 24px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

.participation-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
}

.participation-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.participation-xp-tag {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.3);
    color: #fbbf24;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 999px;
}

.participation-track {
    position: relative;
    height: 56px;
    margin: 0 8px 14px;
}

.participation-track-line {
    position: absolute;
    top: 27px;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--overlay-08);
    border-radius: 999px;
}

.participation-fill {
    position: absolute;
    top: 27px;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #d97706, #fbbf24);
    border-radius: 999px;
    transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.participation-nodes {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.milestone-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: 74px;
}

.milestone-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-raised);
    border: 2px solid var(--overlay-12);
    color: var(--text-muted);
    transition: background 0.4s ease, border-color 0.4s ease, color 0.4s ease, box-shadow 0.4s ease, transform 0.3s ease;
}

.milestone-icon svg {
    width: 22px;
    height: 22px;
}

.milestone-node.unlocked .milestone-icon {
    background: linear-gradient(135deg, #fbbf24, #b45309);
    border-color: #fbbf24;
    color: #1e1206;
    box-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
}

.milestone-node.locked .milestone-icon {
    opacity: 0.55;
}

.milestone-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.2;
}

.milestone-node.unlocked .milestone-label {
    color: #fbbf24;
}

.milestone-node.just-unlocked .milestone-icon {
    animation: milestoneUnlock 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes milestoneUnlock {
    0% {
        transform: scale(0.7);
        box-shadow: 0 0 0 rgba(251, 191, 36, 0);
    }
    50% {
        transform: scale(1.25);
        box-shadow: 0 0 26px rgba(251, 191, 36, 0.8);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 14px rgba(251, 191, 36, 0.45);
    }
}

.participation-caption {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .participation-fill,
    .milestone-icon {
        transition: none;
    }
    .milestone-node.just-unlocked .milestone-icon {
        animation: none;
    }
}

@media (max-width: 640px) {
    .milestone-node {
        width: 52px;
    }
    .milestone-icon {
        width: 32px;
        height: 32px;
    }
    .milestone-icon svg {
        width: 18px;
        height: 18px;
    }
    .milestone-label {
        font-size: 0.6rem;
    }
}

/* =====================================================================
   ACCOUNT SWITCHER (Guest vs Student profiles)
   ===================================================================== */
.account-switch-card {
    max-width: 380px;
}

.account-switch-list {
    max-height: 260px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 4px 0 6px;
}

.account-switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--overlay-03);
    border: 1px solid var(--overlay-06);
    cursor: pointer;
    font-size: 0.92rem;
    color: var(--text-primary);
    transition: background 0.15s ease, border-color 0.15s ease;
}

.account-switch-row:hover {
    background: var(--accent-a08);
    border-color: var(--accent-a25);
}

.account-switch-row.is-active {
    background: var(--accent-a14);
    border-color: var(--accent);
}

.participation-owner-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin: -14px 0 18px;
}

.profile-badge {
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.profile-badge:hover {
    background: var(--accent-a06);
    border-color: var(--accent-a20);
}

/* =====================================================================
   STUDENT HOME PAGE — directly inspired by the reference template
   Deliberately light/warm, distinct from the app's dark internal screens,
   the same way a bright landing hero often differs from an app's internal
   dashboard chrome. Brand blue accent carried through for continuity.
   ===================================================================== */
.home-page-light {
    background: linear-gradient(180deg, #fdf8f4 0%, #fbf2ec 100%);
    border-radius: 20px;
    padding: 40px 40px 0;
    margin: -30px;
    overflow: hidden;
}

.home-hero {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    min-height: 420px;
}

.home-hero-eyebrow {
    color: var(--accent-strong);
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 14px;
}

.home-hero-title {
    font-size: 3rem;
    line-height: 1.15;
    font-weight: 800;
    color: #1f2937;
    margin: 0 0 20px;
    letter-spacing: -0.02em;
}

.home-hero-text {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.7;
    max-width: 420px;
    margin: 0 0 28px;
}

.home-hero-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

.home-profile-btn {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
    color: #fff;
    border: none;
    padding: 15px 28px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 8px 20px var(--accent-strong-a30);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.home-profile-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 26px var(--accent-strong-a40);
}

.home-profile-btn:active {
    transform: translateY(0) scale(0.97);
}

.home-message-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.08);
    color: var(--accent-strong);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    flex-shrink: 0;
}

.home-message-btn svg {
    width: 22px;
    height: 22px;
}

.home-message-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.12);
}

.home-hero-right {
    position: relative;
    height: 420px;
}

.home-blob {
    position: absolute;
    top: 6%;
    left: 8%;
    width: 78%;
    height: 88%;
    background: linear-gradient(135deg, #ffe2d1, #fbc9ac);
    border-radius: 60px;
    transform: rotate(10deg);
    z-index: 0;
}

.home-collage {
    position: absolute;
    inset: 0;
    z-index: 1;
}

.collage-tile {
    position: absolute;
    border-radius: 20px;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
    overflow: hidden;
    transition: transform 0.25s ease;
}

.collage-tile:hover {
    transform: scale(1.05) !important;
}

.collage-tile svg {
    width: 100%;
    height: 100%;
    display: block;
}

.tile-1 {
    width: 190px;
    height: 190px;
    top: 90px;
    left: 90px;
    transform: rotate(-6deg);
    z-index: 3;
}

.tile-2 {
    width: 110px;
    height: 110px;
    top: 10px;
    right: 60px;
    transform: rotate(9deg);
    z-index: 4;
}

.tile-3 {
    width: 100px;
    height: 100px;
    bottom: 40px;
    left: 20px;
    transform: rotate(-11deg);
    z-index: 4;
}

.tile-4 {
    width: 130px;
    height: 130px;
    top: 150px;
    right: 10px;
    transform: rotate(6deg);
    z-index: 2;
}

.tile-5 {
    width: 95px;
    height: 95px;
    bottom: 10px;
    right: 90px;
    transform: rotate(13deg);
    z-index: 5;
}

.home-stats-bar {
    position: relative;
    z-index: 2;
    background: #ffffff;
    border-radius: 20px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.12);
    margin: -50px 20px 30px;
    padding: 30px 20px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
}

.home-stat {
    text-align: center;
    border-right: 1px solid rgba(0, 0, 0, 0.07);
    padding: 0 10px;
}

.home-stat:last-child {
    border-right: none;
}

.home-stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--accent-strong);
    line-height: 1;
    margin-bottom: 6px;
}

.home-stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.home-motivational-text {
    color: var(--accent-strong);
    font-weight: 600;
    font-size: 0.95rem;
    margin: -10px 0 18px;
}

/* =====================================================================
   HOMEPAGE: RECENT SUBMISSIONS STATUS TABLE
   Lives inside the student's dark home view (.student-home-view /
   .dashboard-view), so this matches the dark-mode tokens used
   throughout the rest of the app shell.
   ===================================================================== */
.home-status-section {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    margin-top: 24px;
    padding: 20px 22px 22px;
}

.home-status-section .profile-section-heading {
    color: var(--text-primary);
    margin-top: 0;
}

.home-status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.home-status-viewall {
    color: var(--accent-text);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
}

.home-status-viewall:hover {
    text-decoration: underline;
}

.status-table-wrap {
    overflow-x: auto;
}

.status-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.status-table thead th {
    text-align: left;
    color: var(--text-secondary);
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding: 0 12px 10px;
    border-bottom: 1px solid var(--overlay-08);
    white-space: nowrap;
}

.status-table tbody td {
    padding: 12px;
    color: var(--text-quaternary);
    border-bottom: 1px solid var(--overlay-05);
}

.status-table-row {
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.status-table-row:hover {
    background: var(--accent-a06);
}

.status-table-row:last-child td {
    border-bottom: none;
}

.status-table-task {
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-table .submission-status {
    display: inline-block;
}

.status-table-feedback-link {
    color: var(--accent-text);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.status-table-feedback-link:hover {
    text-decoration: underline;
}

.status-table-dash {
    color: #4b5563;
}

.home-status-empty {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
}

.home-status-empty a {
    color: var(--accent-text);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.home-status-empty a:hover {
    text-decoration: underline;
}

@media (max-width: 900px) {
    .home-status-section {
        margin: 0 20px 30px;
    }
}

/* =====================================================================
   STUDENT HOME: SELF-LEARNING RECOMMENDATION PAGE
   Sits inside the standard dark .dashboard-view shell (this is now a
   workspace the student returns to daily, not a marketing hero) — the
   light .home-page-light hero above is reserved for guests only.
   ===================================================================== */
.student-home-view {
    max-width: 760px;
}

.student-home-greeting {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.today-practice-card {
    background: linear-gradient(135deg, var(--accent-a14) 0%, var(--accent-strong-a08) 100%);
    border: 1px solid var(--accent-a30);
    border-radius: 18px;
    padding: 28px 30px;
    margin-bottom: 20px;
}

.today-practice-eyebrow {
    color: var(--accent-text);
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.today-practice-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: #f9fafb;
    margin: 0 0 10px;
}

.today-practice-subtitle {
    color: var(--text-tertiary);
    line-height: 1.6;
    margin: 0 0 16px;
    max-width: 560px;
}

.today-practice-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 18px;
}

.today-practice-btn {
    background: var(--accent);
    color: var(--text-on-accent);
    border: none;
    border-radius: 10px;
    padding: 13px 26px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.15s ease, transform 0.1s ease;
}

.today-practice-btn:hover {
    background: var(--accent-hover-light);
}

.today-practice-btn:active {
    transform: scale(0.98);
}

.today-practice-done-row {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.today-practice-check {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.today-practice-check svg {
    width: 24px;
    height: 24px;
}

.today-practice-done .today-practice-title {
    font-size: 1.15rem;
    margin-bottom: 4px;
}

.today-practice-done .today-practice-subtitle {
    margin-bottom: 0;
}

.today-practice-more {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--overlay-10);
    flex-wrap: wrap;
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* --- TODAY'S PRACTICE CHECKLIST -- an explicit per-item list (vocab /
   Task 1 / Task 2 / review) rather than a single recommendation; practice
   only reads as "complete" for the day once every item is checked off. --- */
.todays-plan-header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 0;
}

.todays-plan-date {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    text-align: center;
}

/* --- TODAY'S PRACTICE GROWTH ICON -- a decorative companion to the
   checklist, not a replacement for it: the checkboxes stay the real
   record of what's done, this is just a quick "how's today looking" glance.
   One leaf per checklist item; each leaf glows bright blue the moment its
   matching item is checked off, so the plant visibly "grows" over the day
   as vocab / Task 1 / Task 2 / review get done. --- */
.todays-growth-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* --- DAY STREAK POINTS -- the big gold number, positioned right where
   the growth icon's date used to sit alone. Earn STREAK_POINTS_PER_TASK
   (js/data/constants.js) per completed task; the whole total resets to
   zero after 24 real hours of no activity (see getParticipationProfile()
   in core/storage.js). Same widget/number reappears on the Leaderboard. --- */
.streak-points-widget {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    margin-bottom: 2px;
}

.streak-points-number {
    font-size: 2.6rem;
    font-weight: 900;
    color: #fbbf24;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 14px rgba(251, 191, 36, 0.5);
}

.streak-points-caption {
    font-size: 0.72rem;
    font-weight: 700;
    color: #fbbf24;
    opacity: 0.85;
    text-transform: lowercase;
    letter-spacing: 0.01em;
}

/* Sits beside the checklist (not stacked above it) so it reads as a
   companion to the items rather than its own separate block with a gap
   before/after it. */
.todays-practice-body-row {
    display: flex;
    align-items: center;
    gap: 28px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.todays-practice-body-row .todays-checklist {
    flex: 1;
    min-width: 220px;
    margin-bottom: 0;
}

.todays-growth-icon .todays-plan-date {
    text-align: center;
}

.todays-growth-svg {
    color: var(--text-tertiary);
    overflow: visible;
}

.todays-plant-pot {
    fill: var(--surface-secondary, rgba(255, 255, 255, 0.05));
    stroke: currentColor;
    stroke-width: 2;
}

.todays-plant-stem,
.todays-leaf-branch {
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    opacity: 0.55;
}

.todays-leaf {
    fill: var(--surface-secondary, rgba(255, 255, 255, 0.08));
    stroke: currentColor;
    stroke-width: 2;
    transition: fill 0.4s ease, stroke 0.4s ease, filter 0.4s ease;
}

.todays-leaf-done {
    fill: #3b82f6;
    stroke: #60a5fa;
    filter: drop-shadow(0 0 9px rgba(59, 130, 246, 0.9)) drop-shadow(0 0 18px rgba(59, 130, 246, 0.55));
}

.todays-plan-time {
    color: var(--text-tertiary);
    font-size: 0.82rem;
    margin-bottom: 16px;
}

.todays-plan-complete-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
    font-weight: 700;
    font-size: 0.88rem;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 16px;
}

.todays-plan-complete-banner svg {
    flex-shrink: 0;
}

.todays-checklist {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.todays-checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    cursor: pointer;
}

.todays-checklist-box {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    flex-shrink: 0;
    margin-top: 1px;
    transition: transform 0.12s ease;
}

.todays-checklist-item:hover .todays-checklist-box {
    transform: scale(1.06);
}

/* The one next item to do (see getStudentNextAction in home.js) carries
   the card's only solid button. It's a plain click target: the whole row
   already handles the click, so the button needs no handler of its own. */
/* Idle nudge (ui/nudge.js): after 7 seconds with no click or key press,
   the next-step button gets a soft blue pulse. Fixed brand blue in every
   theme. One pulse per 1.6s -- far below the 3-flashes-a-second limit. */
@keyframes bander-nudge-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(77, 163, 255, 0.0), 0 4px 12px rgba(37, 99, 235, 0.25); }
    50%      { box-shadow: 0 0 0 6px rgba(77, 163, 255, 0.45), 0 0 22px 4px rgba(77, 163, 255, 0.55); }
}

.nudge-glow {
    animation: bander-nudge-pulse 1.6s ease-in-out infinite;
    position: relative;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .nudge-glow {
        animation: none;
        box-shadow: 0 0 0 4px rgba(77, 163, 255, 0.6);
    }
}

/* Shown in a results screen's button row once today's plan is finished. */
.up-next-done {
    flex-basis: 100%;
    margin: 4px 0 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.todays-start-btn {
    margin-left: auto;
    align-self: center;
    flex-shrink: 0;
    padding: 7px 18px;
    font-size: 0.85rem;
}

.todays-checklist-check {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.15);
    border: 2px solid #22c55e;
    color: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.todays-checklist-check svg {
    width: 18px;
    height: 18px;
}

.todays-checklist-body {
    flex: 1;
    min-width: 0;
    padding-top: 4px;
}

.todays-checklist-label {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.todays-checklist-item.is-done .todays-checklist-label {
    color: var(--text-secondary);
    text-decoration: line-through;
}

.todays-checklist-sublabel {
    color: var(--text-tertiary);
    font-size: 0.82rem;
    margin-top: 3px;
    line-height: 1.4;
}

.todays-plan-calendar-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
}

.progress-snapshot-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 8px;
}

.progress-snapshot-tile {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 18px 16px;
    text-align: center;
}

.progress-snapshot-icon {
    font-size: 1.3rem;
    margin-bottom: 6px;
}

.progress-snapshot-value {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
}

.progress-snapshot-label {
    color: var(--text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    margin-top: 4px;
}

.study-reminder-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 16px 20px;
    margin-top: 14px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.study-reminder-text {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 0;
}

.study-reminder-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.study-reminder-title {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.92rem;
}

.study-reminder-subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 3px;
    line-height: 1.5;
}

.study-reminder-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.day-picker {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.day-picker-chip {
    background: var(--overlay-05);
    border: 1px solid var(--overlay-12);
    color: var(--text-tertiary);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.day-picker-chip:hover {
    border-color: var(--accent-a50);
}

.day-picker-chip-active {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--text-on-accent);
}

.study-reminder-modal-card {
    max-width: 460px;
}

.skill-profile-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.skill-profile-col {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 16px;
}

.skill-profile-col-head {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-quaternary);
    margin-bottom: 10px;
}

.skill-profile-chip {
    display: inline-block;
    background: var(--overlay-05);
    border: 1px solid var(--overlay-08);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.82rem;
    color: var(--text-heading);
    margin: 0 6px 6px 0;
}

.skill-profile-empty-text {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-style: italic;
    margin: 0;
}

.skill-profile-empty {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 20px;
    color: var(--text-secondary);
}

.skill-profile-source-note {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin: 10px 2px 0;
}

.recent-improvement-card,
.next-milestone-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 18px 20px;
    margin-top: 24px;
}

.recent-improvement-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.recent-improvement-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.recent-improvement-card p {
    margin: 0;
    color: var(--text-quaternary);
    line-height: 1.6;
}

.next-milestone-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.next-milestone-text {
    color: var(--text-secondary);
    font-size: 0.82rem;
    margin: 10px 0 0;
}

.home-exploration-row {
    margin-top: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--overlay-07);
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    align-items: center;
}

.home-exploration-label {
    font-weight: 600;
}

.home-exploration-row a {
    color: var(--accent-text);
    cursor: pointer;
    text-decoration: none;
}

.home-exploration-row a:hover {
    text-decoration: underline;
}

.home-hero-signin-note {
    color: var(--text-secondary);
    font-size: 0.88rem;
    margin-top: -14px;
}

.home-hero-signin-note a {
    color: var(--accent-strong);
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}

.home-hero-signin-note a:hover {
    text-decoration: underline;
}

@media (max-width: 700px) {
    .progress-snapshot-row,
    .skill-profile-grid {
        grid-template-columns: 1fr;
    }

    .study-reminder-card {
        flex-direction: column;
        align-items: stretch;
    }

    .study-reminder-actions {
        justify-content: flex-end;
    }
}

/* =====================================================================
   SUBMIT WORK: CELEBRATORY CONFIRMATION SCREEN
   ===================================================================== */
.submission-confirmation-view {
    max-width: 520px;
    margin: 20px auto;
    text-align: center;
}

.confirmation-check {
    width: 76px;
    height: 76px;
    margin: 0 auto 20px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.12);
    color: #22c55e;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: confirmation-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirmation-check svg {
    width: 40px;
    height: 40px;
}

@keyframes confirmation-pop {
    0% { transform: scale(0.4); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.confirmation-title {
    margin-bottom: 8px;
}

.confirmation-subtitle {
    max-width: 440px;
    margin-left: auto;
    margin-right: auto;
}

.tip-of-the-day-card {
    background: var(--accent-a08);
    border: 1px solid var(--accent-a22);
    border-radius: 14px;
    padding: 20px 24px;
    margin: 24px 0;
    text-align: left;
}

.tip-of-the-day-label {
    font-weight: 700;
    color: var(--accent-text);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 8px;
}

.tip-of-the-day-text {
    color: var(--text-heading);
    line-height: 1.6;
    margin: 0;
}

@media (prefers-reduced-motion: reduce) {
    .confirmation-check {
        animation: none;
    }
}

@media (max-width: 900px) {
    .home-hero {
        grid-template-columns: 1fr;
        min-height: unset;
        text-align: center;
    }
    .home-hero-text {
        margin-left: auto;
        margin-right: auto;
    }
    .home-hero-actions {
        justify-content: center;
    }
    .home-hero-right {
        height: 320px;
    }
    .home-stats-bar {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        margin: 20px 20px 30px;
    }
    .home-stat {
        border-right: none;
        border-bottom: 1px solid rgba(0, 0, 0, 0.07);
        padding-bottom: 16px;
    }
}

/* =====================================================================
   MESSAGE THREAD (student <-> teacher)
   ===================================================================== */
.message-modal-card {
    max-width: 440px;
}

.message-thread {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 4px;
}

.message-bubble {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.88rem;
    line-height: 1.5;
}

.message-bubble.from-student {
    align-self: flex-end;
    background: linear-gradient(135deg, var(--accent), var(--accent-strong));
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message-bubble.from-teacher {
    align-self: flex-start;
    background: var(--bg-surface-raised);
    color: var(--text-heading);
    border-bottom-left-radius: 4px;
}

.message-bubble-time {
    font-size: 0.68rem;
    opacity: 0.7;
    margin-top: 4px;
}

/* =====================================================================
   TASK SELECTOR (Task 1 / Task 2)
   ===================================================================== */
.task-selector-grid {
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    max-width: 700px;
}

.task-selector-card {
    padding: 36px 26px;
}

.task-selector-card .category-icon {
    width: 56px;
    height: 56px;
}

.task-selector-card .category-label {
    font-size: 1.3rem;
}

.task-selector-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.5;
    margin: 0;
}

/* =====================================================================
   DETAILED RESULTS SCREEN
   ===================================================================== */
.results-stat-row {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin: 16px 0 28px;
    flex-wrap: wrap;
}

.results-stat {
    text-align: center;
}

.results-stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-primary);
}

.results-stat-label {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.skill-bar-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.skill-bar-row {
    display: grid;
    grid-template-columns: 160px 1fr 50px;
    align-items: center;
    gap: 12px;
}

.skill-bar-label {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 600;
}

.skill-bar-track {
    height: 8px;
    background: var(--overlay-06);
    border-radius: 999px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.skill-bar-value {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: right;
}

.results-strengths-weaknesses {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    margin: 8px 0 20px;
}

.sw-strength {
    color: #22c55e;
    font-weight: 600;
}

.sw-weakness {
    color: #f97316;
    font-weight: 600;
}

.recommendation-box {
    background: var(--accent-a08);
    border: 1px solid var(--accent-a20);
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 0.88rem;
    color: var(--text-tertiary);
    margin-bottom: 20px;
}

.recommendation-box strong {
    color: var(--accent-text);
}

.mistakes-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.mistake-card {
    background: var(--bg-surface);
    border: 1px solid rgba(239, 68, 68, 0.15);
    border-left: 3px solid #ef4444;
    border-radius: 10px;
    padding: 14px 16px;
    text-align: left;
}

.mistake-sentence {
    font-size: 0.92rem;
    color: var(--text-heading);
    margin-bottom: 6px;
}

.mistake-wrong {
    color: #f87171;
    text-decoration: line-through;
    margin: 0 2px;
}

.mistake-correct {
    font-size: 0.85rem;
    color: #22c55e;
    margin-bottom: 6px;
}

.mistake-explanation {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.results-band-disclaimer {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin: 10px 0 20px;
}

/* =====================================================================
   PROGRESSION EXTENSIONS: goals, achievements, personal bests, mastery
   ===================================================================== */
.goals-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.goal-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 12px;
    padding: 16px 18px;
}

.goal-card-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-tertiary);
    margin-bottom: 10px;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.achievement-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    padding: 14px 8px;
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 12px;
}

.achievement-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-raised);
    color: var(--text-muted);
}

.achievement-icon svg {
    width: 24px;
    height: 24px;
}

.achievement-badge.unlocked .achievement-icon {
    background: linear-gradient(135deg, #fbbf24, #b45309);
    color: #1e1206;
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.4);
}

.achievement-badge.locked {
    opacity: 0.5;
}

.achievement-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-tertiary);
    line-height: 1.2;
}

.personal-bests-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.personal-best-row {
    display: flex;
    justify-content: space-between;
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.88rem;
    color: var(--text-heading);
}

.personal-best-score {
    color: #22c55e;
    font-weight: 700;
}

.mastery-grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
}

.mastery-skill-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 12px;
    padding: 16px 18px;
}

.mastery-skill-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 8px;
}

.mastery-skill-pct {
    font-weight: 800;
}

.mastery-skill-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 6px;
}

/* =====================================================================
   AVATAR, PROFILE HEADER, BAND GOAL, ACTIVITY CALENDAR, LOCKED VOCAB TIER
   ===================================================================== */
.avatar-circle {
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    flex-shrink: 0;
}

.profile-badge-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.profile-header-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.band-goal-sparkline {
    width: 100%;
    height: 32px;
    display: block;
}

/* Activity calendar (GitHub-style) */
.activity-calendar-wrap {
    margin-bottom: 8px;
}

.activity-calendar {
    display: flex;
    gap: 3px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.activity-week {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.activity-cell {
    width: 11px;
    height: 11px;
    border-radius: 2px;
    background: var(--overlay-05);
}

.activity-cell.activity-low {
    background: var(--accent-a35);
}

.activity-cell.activity-mid {
    background: var(--accent-a65);
}

.activity-cell.activity-high {
    background: var(--accent);
}

.activity-calendar-caption {
    font-size: 0.78rem;
    color: var(--text-secondary);
    margin: 8px 0 20px;
}

/* Locked vocabulary tier */
.vocab-level-card.is-locked {
    opacity: 0.6;
}

.vocab-level-card.is-locked .vocab-level-icon {
    filter: grayscale(1);
}

/* --- LANGUAGE SWITCHER (top bar) --- */
.lang-switcher {
    position: relative;
}

.lang-switcher-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--overlay-04);
    border: 1px solid var(--overlay-08);
    color: var(--text-tertiary);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.lang-switcher-trigger:hover {
    border-color: var(--accent-a40);
    color: var(--text-primary); /* was #ffffff: invisible on Light/Rose */
}

.lang-switcher-flag {
    font-size: 1rem;
    line-height: 1;
}

.lang-switcher-chevron {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.lang-switcher.is-open .lang-switcher-chevron {
    transform: rotate(180deg);
}

.lang-switcher-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    background: var(--bg-surface);
    border: 1px solid var(--overlay-08);
    border-radius: 12px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 30;
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
}

.lang-switcher.is-open .lang-switcher-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.lang-switcher-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    padding: 9px 10px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.lang-switcher-option:hover {
    background: var(--accent-a10);
    color: var(--text-primary); /* was #ffffff: invisible on Light/Rose */
}

.lang-switcher-option.is-active-lang {
    background: var(--accent-a14);
    color: var(--accent-text);
    font-weight: 700;
}

@media (max-width: 800px) {
    .lang-switcher-trigger span:not(.lang-switcher-flag) {
        display: none;
    }

    .lang-switcher-trigger {
        padding: 8px 10px;
    }

    .lang-switcher-chevron {
        display: none;
    }
}

/* =====================================================================
   MORE / SETTINGS VIEW -- color theme picker
   ===================================================================== */
.more-section {
    margin-bottom: 36px;
}

.more-section-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 6px;
}

.more-section-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 20px;
    max-width: 620px;
    line-height: 1.5;
}

.theme-picker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.theme-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 22px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.theme-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-a35);
}

.theme-card-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.theme-swatch-row {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.theme-swatch {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--overlay-10);
    flex-shrink: 0;
}

.theme-card-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.theme-card-check {
    width: 18px;
    height: 18px;
    color: var(--accent-text);
    flex-shrink: 0;
}

.theme-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* =====================================================================
   ONBOARDING CHOOSER -- the first thing a not-signed-in visitor sees
   once the landing page slides away (see app.js's initial-render boot
   logic), and the sign-in/sign-up modal it and the account switchers
   share.
   ===================================================================== */
.onboarding-view {
    max-width: 720px;
}

.onboarding-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 8px;
}

.onboarding-card {
    background: radial-gradient(circle at 30% 0%, var(--accent-a08), var(--overlay-02) 60%), var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 32px 26px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.onboarding-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-a35);
}

.onboarding-card-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: var(--accent-a10);
    color: var(--accent-text);
}

.onboarding-card-icon svg {
    width: 28px;
    height: 28px;
}

.onboarding-card-title {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.onboarding-card-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.onboarding-signin-note {
    text-align: center;
    margin-top: 26px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.onboarding-signin-note a,
.onboarding-guest-note a {
    color: var(--accent-text);
    font-weight: 600;
    cursor: pointer;
}

.onboarding-guest-note {
    text-align: center;
    margin-top: 10px;
    font-size: 0.85rem;
}

/* --- POST-SIGNUP STUDENT ONBOARDING (motivation / level / daily goal /
   placement quiz) -- reuses .onboarding-view/.onboarding-grid/.onboarding-card
   from the sign-up chooser above, plus the quiz player's own progress bar
   classes, so this flow feels like the same product rather than a bolted-on
   wizard. --- */
.onboarding-progress-row {
    margin-bottom: 24px;
}

.onboarding-card-emoji {
    font-size: 28px;
    background: none;
}

.onboarding-quiz-intro {
    text-align: center;
    padding: 30px 10px 10px;
}

.onboarding-quiz-intro-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.auth-modal-card {
    max-width: 420px;
}

.auth-role-toggle {
    display: flex;
    gap: 8px;
    margin: 4px 0 16px;
}

.auth-role-btn {
    flex: 1;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--overlay-08);
    background: var(--overlay-03);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.auth-role-btn.active {
    background: var(--accent-a14);
    border-color: var(--accent);
    color: var(--accent-text);
}

.auth-no-teachers-note {
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin: 4px 0 14px;
    line-height: 1.5;
}

.auth-switch-note {
    text-align: center;
    margin: 14px 0 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-switch-note a {
    color: var(--accent-text);
    font-weight: 600;
    cursor: pointer;
}

.logout-btn {
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.35);
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.logout-btn:hover {
    background: rgba(239, 68, 68, 0.18);
}

/* =====================================================================
   SPEAKING PRACTICE (Task 1 Interview / Task 2 Long Turn)
   The prep-timer / record / review card shown by ui/views/speaking.js's
   renderSpeakingScreen(), plus the audio playback card reused by
   buildAudioPlaybackSection() (ui/components.js) wherever a speaking
   submission is viewed or reviewed.
   ===================================================================== */
.speaking-control-card {
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 28px 24px;
    margin-top: 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.speaking-phase-label {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 0;
}

.speaking-phase-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0 0 6px;
}

.speaking-timer-display {
    font-size: 2.6rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent-text);
    letter-spacing: 0.02em;
    margin: 4px 0 10px;
}

.speaking-recording-active .speaking-timer-display {
    color: #ef4444;
}

.recording-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ef4444;
    animation: speaking-pulse 1.2s ease-in-out infinite;
}

@keyframes speaking-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.25); }
}

.speaking-min-duration-note {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.speaking-min-duration-note.is-blocking {
    color: #ef4444;
    font-weight: 600;
    max-width: 420px;
}

.speaking-review-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 12px;
}

.speaking-duration-readout {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 8px 0 0;
}

.audio-player-el {
    width: 100%;
    max-width: 360px;
}

.audio-playback-card {
    align-items: center;
}

.audio-playback-meta {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1 1 240px;
}

/* --- READING PRACTICE ---
   The passage panel is pinned to the top of .main-content's own scroll
   container (position: sticky, not the whole page) so it stays visible
   the entire time the student is working through the 8 questions listed
   below it -- the layout the user explicitly chose over a side-by-side
   split screen. The panel has its own internal scroll for long passages
   so it never has to grow taller than a comfortable chunk of the
   viewport. */
.reading-passage-panel {
    position: sticky;
    top: 0;
    z-index: 5;
    background: var(--bg-surface);
    border: 1px solid var(--overlay-08);
    border-radius: 12px;
    padding: 18px 22px;
    margin-bottom: 20px;
    max-height: 42vh;
    overflow-y: auto;
    box-shadow: 0 8px 20px -12px rgba(0, 0, 0, 0.4);
}

.reading-passage-title {
    margin: 0 0 10px;
    font-size: 1.05rem;
    color: var(--text-heading);
}

.reading-passage-text p {
    color: var(--text-primary);
    line-height: 1.7;
    font-size: 0.95rem;
    margin: 0 0 14px;
}

.reading-passage-text p:last-child {
    margin-bottom: 0;
}

.reading-questions-column {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.reading-progress-row {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Divides the 8 multiple-choice questions from the 10 True/False/Not
   Given statements within the same scrolling question column. */
.reading-section-heading {
    margin: 6px 0 -4px;
    font-size: 0.95rem;
    color: var(--text-heading);
    padding-bottom: 8px;
    border-bottom: 1px solid var(--overlay-08);
}

.mc-question-card {
    background: var(--bg-surface-alt);
    border: 1px solid var(--overlay-08);
    border-radius: 10px;
    padding: 16px 18px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mc-question-card.mc-question-unanswered-flag {
    border-color: #ef4444;
    box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.25);
}

.mc-question-text {
    color: var(--text-heading);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.5;
    margin-bottom: 14px;
}

.mc-options-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mc-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--bg-surface);
    border: 1px solid var(--overlay-08);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.92rem;
    text-align: left;
    cursor: pointer;
    width: 100%;
    box-sizing: border-box;
    transition: all 0.2s ease;
}

.mc-option:hover {
    border-color: var(--accent);
    background: var(--accent-a08);
}

.mc-option-marker {
    flex: 0 0 16px;
    width: 16px;
    height: 16px;
    margin-top: 2px;
    border-radius: 50%;
    border: 2px solid var(--overlay-15);
    box-sizing: border-box;
    position: relative;
    transition: border-color 0.2s ease;
}

.mc-option-selected {
    border-color: var(--accent);
    background: var(--accent-a10);
    color: var(--text-heading);
}

.mc-option-selected .mc-option-marker {
    border-color: var(--accent);
}

.mc-option-selected .mc-option-marker::after {
    content: "";
    position: absolute;
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
}

.mc-option-text {
    flex: 1 1 auto;
}

/* =====================================================================
   DAY STREAK LEADERBOARD
   Ranks every student registered on this device (loadStudents(), same
   roster a teacher's Student Registry uses) by current Day Streak
   Points. See js/ui/views/leaderboard.js.
   ===================================================================== */
.leaderboard-view {
    max-width: 640px;
}

.leaderboard-guest-note {
    background: var(--accent-a08);
    border: 1px solid var(--accent-a20);
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-radius: 10px;
    padding: 10px 14px;
    margin: 0 0 16px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
}

.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-surface);
    border: 1px solid var(--overlay-06);
    border-radius: 14px;
    padding: 14px 18px;
}

.leaderboard-row-me {
    border-color: var(--accent);
    background: var(--accent-a08);
}

.leaderboard-rank {
    width: 30px;
    flex-shrink: 0;
    text-align: center;
    font-weight: 800;
    font-size: 1rem;
    color: var(--text-tertiary);
}

.leaderboard-rank-gold {
    color: #eab308;
    font-size: 1.25rem;
}

.leaderboard-rank-silver {
    color: #94a3b8;
    font-size: 1.1rem;
}

.leaderboard-rank-bronze {
    color: #d97706;
    font-size: 1.1rem;
}

.leaderboard-player {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.leaderboard-name {
    font-weight: 700;
    color: var(--text-primary);
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.leaderboard-you-tag {
    display: inline-block;
    background: var(--accent);
    color: var(--text-on-accent);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 20px;
    vertical-align: middle;
    margin-left: 4px;
}

.leaderboard-points {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.leaderboard-points-value {
    font-weight: 800;
    font-size: 1.05rem;
    color: #fbbf24;
}

.leaderboard-empty {
    color: var(--text-tertiary);
    font-size: 0.9rem;
    padding: 30px 0;
    text-align: center;
}

/* =====================================================================
   ASSIGNED TEACHER + FEEDBACK ROUTING
   ===================================================================== */
/* Sits on the corner of the nav icon so it never squeezes the label. */
#nav-submissions {
    position: relative;
}

.nav-badge {
    position: absolute;
    left: 26px;
    top: 0;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    box-shadow: 0 0 0 2px var(--bg-surface);
    background: #ef4444;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.nav-badge[hidden] {
    display: none;
}

.home-assigned-teacher {
    display: inline-block;
    margin-left: 6px;
    color: var(--text-primary);
    font-weight: 700;
}

.home-assigned-teacher strong {
    color: var(--accent-text);
}

.home-assigned-teacher-missing {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
}

.home-assigned-teacher a,
.assigned-teacher-note a {
    color: var(--accent-text);
    cursor: pointer;
    text-decoration: underline;
}

.feedback-ready-card {
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.35);
    border-radius: 18px;
    padding: 20px 24px;
    margin-bottom: 20px;
}

.feedback-ready-eyebrow {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #22c55e;
    margin-bottom: 10px;
}

.feedback-ready-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--overlay-03);
    cursor: pointer;
    transition: background 0.2s ease;
}

.feedback-ready-row + .feedback-ready-row {
    margin-top: 8px;
}

.feedback-ready-row:hover {
    background: var(--overlay-06);
}

.feedback-ready-title {
    color: var(--text-primary);
    font-weight: 600;
}

.feedback-ready-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 2px;
}

.feedback-ready-action {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--accent-text);
    font-weight: 600;
    white-space: nowrap;
}

.feedback-ready-band {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 0.8rem;
}

.feedback-ready-more {
    display: inline-block;
    margin-top: 10px;
    color: var(--accent-text);
    cursor: pointer;
    font-size: 0.9rem;
}

.submission-status.status-new-feedback {
    background: rgba(239, 68, 68, 0.14);
    color: #f87171;
}

.teacher-assessment-box {
    margin-top: 20px;
    background: var(--overlay-03);
    border: 1px solid var(--overlay-06);
    border-left: 3px solid #22c55e;
    border-radius: 12px;
    padding: 18px 20px;
}

.teacher-assessment-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    flex-wrap: wrap;
}

.teacher-assessment-eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #22c55e;
}

.teacher-assessment-by {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.teacher-assessment-by strong {
    color: var(--text-primary);
}

.teacher-assessment-band {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    text-align: right;
    line-height: 1.1;
}

.teacher-assessment-band span {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.criteria-score-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 8px;
    margin-top: 14px;
}

.criteria-score-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    background: var(--overlay-04);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.criteria-score-item strong {
    color: var(--text-primary);
}

.teacher-assessment-feedback {
    margin-top: 14px;
    color: var(--text-tertiary);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* ============================================================
   GREEN HIGHLIGHTER (js/ui/highlighter.js)
   Same green in every theme, with dark text on top so highlighted
   words stay readable on the dark theme too.
   ============================================================ */
:root {
    --hl-green: #86efac;
    --hl-green-strong: #4ade80;
    --hl-ink: #052e16;
}

mark.hl-mark {
    background: var(--hl-green);
    color: var(--hl-ink);
    border-radius: 3px;
    padding: 0.05em 0;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

mark.hl-mark:hover {
    background: var(--hl-green-strong);
}

mark.hl-mark strong,
mark.hl-mark em {
    color: inherit;
}

[data-hl-key] ::selection,
[data-hl-key]::selection {
    background: rgba(74, 222, 128, 0.35);
}

.hl-popover {
    position: fixed;
    z-index: 3000; /* above modals (2000) so it works inside the model-answer popup */
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
}

.hl-popover[hidden] {
    display: none;
}

.hl-popover-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    border-radius: 999px;
    padding: 8px 14px;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
}

.hl-popover-btn svg {
    width: 16px;
    height: 16px;
}

.hl-popover-add {
    background: var(--hl-green-strong);
    color: var(--hl-ink);
}

.hl-popover-add:hover {
    background: var(--hl-green);
}

.hl-popover-remove {
    background: #1f2937;
    color: #f9fafb;
}

.hl-popover-remove:hover {
    background: #374151;
}

.hl-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    margin: 0 0 10px;
    font-size: 0.8rem;
    color: var(--text-secondary, #9ca3af);
}

.hl-hint-swatch {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: var(--hl-green);
    flex-shrink: 0;
}

.hl-hint-text {
    flex: 1 1 220px;
}

.hl-hint-clear {
    background: none;
    border: 1px solid var(--overlay-08, rgba(255, 255, 255, 0.08));
    border-radius: 999px;
    color: inherit;
    font: inherit;
    font-size: 0.75rem;
    padding: 4px 10px;
    cursor: pointer;
}

.hl-hint-clear:hover {
    border-color: var(--hl-green-strong);
    color: var(--hl-green-strong);
}

@media print {
    .hl-hint,
    .hl-popover {
        display: none !important;
    }
}

/* ============================================================
   WRITING II — section-by-section practice (js/ui/views/practice.js)
   Violet accent so it reads as its own mode, distinct from Writing (blue).
   ============================================================ */
:root {
    --w2: #a78bfa;
    --w2-a10: rgba(167, 139, 250, 0.10);
    --w2-a18: rgba(167, 139, 250, 0.18);
    --w2-a40: rgba(167, 139, 250, 0.40);
}

.category-card .category-icon.category-icon-writing2 { background: var(--w2-a18); color: var(--w2); }

.writing2-mode-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    margin-bottom: 10px;
    border-radius: 999px;
    background: var(--w2-a18);
    color: var(--w2);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.test-card.test-card-clickable { cursor: pointer; }
.test-card.test-card-clickable:hover { border-color: var(--w2-a40); }

/* Section picker popup */
.section-picker-card { max-width: 520px; width: calc(100% - 32px); }
.section-picker-eyebrow {
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--w2);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.section-picker-list { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.section-picker-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    text-align: left;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid var(--overlay-08, rgba(255, 255, 255, 0.08));
    background: var(--overlay-04, rgba(255, 255, 255, 0.04));
    color: inherit;
    font: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, transform 0.15s ease;
}
.section-picker-option:hover,
.section-picker-option:focus-visible {
    border-color: var(--w2);
    background: var(--w2-a10);
    outline: none;
}
.section-picker-option:active { transform: scale(0.99); }
/* Taller boxes for the longer sections, echoing the essay shape */
.section-picker-option.section-size-body,
.section-picker-option.section-size-summary { min-height: 92px; }
.section-picker-num {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--w2-a18);
    color: var(--w2);
    font-weight: 700;
    font-size: 0.9rem;
}
.section-picker-body { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.section-picker-label { font-weight: 700; font-size: 1rem; }
.section-picker-desc { font-size: 0.82rem; color: var(--text-secondary, #9ca3af); line-height: 1.4; }
.section-picker-words {
    flex-shrink: 0;
    font-size: 0.75rem;
    color: var(--text-secondary, #9ca3af);
    white-space: nowrap;
}

/* Writing page: where this section fits + tips */
.section-guide {
    display: grid;
    grid-template-columns: minmax(160px, 220px) 1fr;
    gap: 18px;
    margin: 4px 0 18px;
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--w2-a18);
    background: var(--w2-a10);
}
.section-guide-map { display: flex; flex-direction: column; gap: 6px; }
.section-guide-block {
    border: 2px dashed var(--overlay-12, rgba(255, 255, 255, 0.14));
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary, #9ca3af);
    min-height: 34px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.section-guide-block.section-size-body,
.section-guide-block.section-size-summary { min-height: 68px; }
.section-guide-block.is-current {
    border: 2px solid var(--w2);
    background: var(--w2-a18);
    color: inherit;
}
.section-guide-you { font-size: 0.7rem; font-weight: 600; color: var(--w2); }
.section-guide-tips-title { font-weight: 700; margin-bottom: 8px; line-height: 1.4; }
.section-guide-tips ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.section-guide-tips li { font-size: 0.88rem; line-height: 1.45; color: var(--text-secondary, #9ca3af); }

.essay-textarea.essay-textarea-section { min-height: 220px; }

.section-word-target {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--text-secondary, #9ca3af);
}
.section-word-target.is-in-range { color: #22c55e; font-weight: 600; }
.section-word-target.is-over { color: #f59e0b; font-weight: 600; }

/* Banner on a Writing II submission (student detail + teacher marking) */
.section-submission-note {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin: 0 0 14px;
    padding: 10px 14px;
    border-radius: 12px;
    background: var(--w2-a10);
    border: 1px solid var(--w2-a18);
    font-size: 0.85rem;
    line-height: 1.45;
}
.section-submission-note .writing2-mode-tag { margin-bottom: 0; }

@media (max-width: 640px) {
    .section-guide { grid-template-columns: 1fr; }
    .section-guide-map { flex-direction: row; }
    .section-guide-block { flex: 1; min-height: 34px; }
    .section-guide-block.section-size-body,
    .section-guide-block.section-size-summary { flex: 2; min-height: 34px; }
    .section-picker-words { display: none; }
}
:root[data-theme="light"],
:root[data-theme="rose"] {
    --w2: #7c3aed;
    --w2-a10: rgba(124, 58, 237, 0.06);
    --w2-a18: rgba(124, 58, 237, 0.12);
    --w2-a40: rgba(124, 58, 237, 0.40);
}
:root[data-theme="light"] .section-word-target.is-in-range,
:root[data-theme="rose"] .section-word-target.is-in-range { color: #15803d; }
:root[data-theme="light"] .section-word-target.is-over,
:root[data-theme="rose"] .section-word-target.is-over { color: #b45309; }
.essay-meta-row { gap: 14px; }

/* ============================================================
   TABLETS -- compact "icons only" sidebar (iPads and tablets in portrait)
   Below ~1000px the full 260px sidebar squeezes the page, so it becomes
   a narrow rail of icons. Hovering/long-pressing an icon shows its name
   (title is set from the label in i18n.js). The sidebar toggle in the top
   bar still hides it completely.
   ============================================================ */
@media (max-width: 1000px) {
    .app-container { grid-template-columns: 84px 1fr; }
    .app-container .sidebar { padding: 18px 10px; }
    .app-container .brand-title-container { justify-content: center; margin-bottom: 22px; }
    .app-container .brand-title { display: none; }
    .app-container .profile-badge { padding: 8px 0; display: flex; justify-content: center; margin-bottom: 18px; }
    .app-container .profile-badge .profile-badge-row { justify-content: center; gap: 0; }
    .app-container .profile-badge .profile-badge-row > div:not(:first-child),
    .app-container .profile-badge .profile-name,
    .app-container .profile-badge .profile-level { display: none; }
    .app-container .nav-links { align-items: center; gap: 6px; }
    .app-container .nav-item { position: relative; justify-content: center; padding: 10px; width: 52px; box-sizing: border-box; }
    .app-container .nav-item-label { display: none; }
    .app-container .nav-badge { left: 30px; top: 2px; }
    .app-container .band-goal-card { display: none; }
    /* Guest badge has no avatar -- show a person icon instead of an empty box */
    .app-container .profile-badge:not(:has(.profile-badge-row))::before { content: "👤"; font-size: 1.4rem; line-height: 1; }
    .main-content { padding-left: 20px; padding-right: 20px; }
}


.overall-band-note .overall-band-note-hint { color: var(--text-secondary); font-size: 0.8rem; }

/* ============================================================
   SKILL RADAR (js/ui/skillRadar.js)
   ============================================================ */
.skill-radar {
    --sr-avg: var(--accent, #4da3ff);
    --sr-latest: #e879f9;
    --sr-goal: #fbbf24;
    margin-bottom: 28px;
}
:root[data-theme="light"] .skill-radar,
:root[data-theme="rose"] .skill-radar { --sr-latest: #c026d3; --sr-goal: #d97706; }

.sr-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sr-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 999px; background: var(--overlay-04, rgba(255,255,255,0.04)); border: 1px solid var(--overlay-06, rgba(255,255,255,0.06)); }
.sr-tab {
    display: inline-flex; align-items: center; gap: 7px;
    border: none; background: none; color: var(--text-secondary); font: inherit; font-size: 0.85rem; font-weight: 600;
    padding: 7px 14px; border-radius: 999px; cursor: pointer; transition: background 0.2s, color 0.2s;
}
.sr-tab:hover:not(:disabled) { color: var(--text-primary); }
.sr-tab.is-active { background: var(--sr-avg); color: #fff; box-shadow: 0 4px 14px rgba(77,163,255,0.35); }
.sr-tab:disabled { opacity: 0.4; cursor: not-allowed; }
.sr-tab-count { font-size: 0.72rem; padding: 1px 7px; border-radius: 999px; background: rgba(255,255,255,0.14); }
.sr-tab:not(.is-active) .sr-tab-count { background: var(--overlay-06, rgba(255,255,255,0.08)); }

.sr-legend { display: flex; flex-wrap: wrap; gap: 6px; }
.sr-legend-btn {
    display: inline-flex; align-items: center; gap: 7px; font: inherit; font-size: 0.8rem; font-weight: 600;
    padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--text-secondary);
    background: none; border: 1px solid var(--overlay-08, rgba(255,255,255,0.1)); transition: opacity 0.2s, border-color 0.2s;
}
.sr-legend-btn:not(.is-on) { opacity: 0.45; text-decoration: line-through; }
.sr-swatch { width: 18px; height: 10px; border-radius: 3px; display: inline-block; }
.sr-swatch-avg { background: var(--sr-avg); }
.sr-swatch-latest { border: 2px dashed var(--sr-latest); height: 6px; }
.sr-swatch-goal { border: 2px dashed var(--sr-goal); border-radius: 50%; width: 12px; height: 12px; }

.sr-body { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(240px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .sr-body { grid-template-columns: 1fr; } }

.sr-chart-card {
    position: relative; background: radial-gradient(circle at 50% 45%, rgba(77,163,255,0.08), transparent 65%), var(--bg-surface);
    border: 1px solid var(--overlay-06, rgba(255,255,255,0.06)); border-radius: 18px; padding: 10px 14px 14px; overflow: hidden;
}
.sr-chart-wrap { position: relative; }
.sr-svg { width: 100%; height: auto; display: block; max-height: 520px; overflow: visible; }

/* grid */
.sr-ring { fill: var(--overlay-02, rgba(255,255,255,0.015)); stroke: var(--overlay-08, rgba(255,255,255,0.08)); stroke-width: 1; }
.sr-ring-alt { fill: var(--overlay-04, rgba(255,255,255,0.035)); }
.sr-spoke { stroke: var(--overlay-08, rgba(255,255,255,0.08)); stroke-width: 1; transition: stroke 0.2s, stroke-width 0.2s; }
.sr-spoke.is-hover { stroke: var(--sr-avg); stroke-width: 2; }
.sr-ring-label { fill: var(--text-muted, #6b7280); font-size: 11px; font-weight: 600; font-family: inherit; }

/* layers */
.sr-avg-poly { transition: opacity 0.3s; }
.sr-avg-line { fill: none; stroke: var(--sr-avg); stroke-width: 3; stroke-linejoin: round; transition: opacity 0.3s; }
.sr-latest-poly { fill: none; stroke: var(--sr-latest); stroke-width: 2.2; stroke-dasharray: 7 6; stroke-linejoin: round; opacity: 0.9; transition: opacity 0.3s; }
.sr-latest-dot { fill: var(--sr-latest); stroke: var(--bg-surface); stroke-width: 2; transition: opacity 0.3s; }
.sr-goal { fill: none; stroke: var(--sr-goal); stroke-width: 2; stroke-dasharray: 3 7; stroke-linecap: round; opacity: 0.85; animation: sr-march 18s linear infinite; transition: opacity 0.3s; }
@keyframes sr-march { to { stroke-dashoffset: -200; } }
.sr-hide-avg .sr-avg-poly, .sr-hide-avg .sr-avg-line, .sr-hide-avg .sr-dot { opacity: 0 !important; }
.sr-hide-latest .sr-latest-poly, .sr-hide-latest .sr-latest-dot { opacity: 0 !important; }
.sr-hide-goal .sr-goal { opacity: 0; }

.sr-dot {
    stroke: var(--bg-surface); stroke-width: 3; opacity: 0; transform-box: fill-box; transform-origin: center; transform: scale(0.2);
    transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.sr-is-live .sr-dot { opacity: 1; transform: scale(1); }

/* axes */
.sr-axis { cursor: pointer; outline: none; }
.sr-hit { fill: transparent; }
.sr-axis-label { fill: var(--text-tertiary, #cbd5e1); font-size: 17px; font-weight: 700; font-family: inherit; transition: fill 0.2s; }
.sr-axis.is-hover .sr-axis-label, .sr-axis:focus-visible .sr-axis-label, .sr-axis.is-selected .sr-axis-label { fill: var(--text-primary); }
.sr-axis.is-selected .sr-axis-label { fill: var(--accent-text, var(--sr-avg)); }
.sr-chip-bg { fill: var(--bg-surface); stroke: var(--chip, #64748b); stroke-width: 2; transition: stroke 0.3s; }
.sr-chip-text { fill: var(--text-primary); font-size: 14px; font-weight: 800; font-family: inherit; font-variant-numeric: tabular-nums; }
.sr-axis.is-weakest .sr-chip-bg { animation: sr-pulse 1.8s ease-in-out infinite; }
@keyframes sr-pulse { 0%, 100% { stroke-width: 2; } 50% { stroke-width: 5; stroke-opacity: 0.6; } }

/* tooltip */
.sr-tooltip {
    position: absolute; z-index: 5; min-width: 170px; pointer-events: none;
    background: rgba(15, 23, 42, 0.96); color: #f8fafc; border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px; padding: 10px 12px; box-shadow: 0 12px 30px rgba(0,0,0,0.35); font-size: 0.82rem;
    animation: sr-pop 0.15s ease-out;
}
@keyframes sr-pop { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.sr-tip-name { font-weight: 800; margin-bottom: 6px; }
.sr-tip-row { display: flex; justify-content: space-between; gap: 14px; padding: 2px 0; color: #cbd5e1; }
.sr-tip-row strong { color: #fff; font-variant-numeric: tabular-nums; }
.sr-tip-foot { margin-top: 6px; color: #94a3b8; font-size: 0.74rem; }

.sr-pos { color: #22c55e !important; }
.sr-neg { color: #f87171 !important; }
.sr-flat { color: var(--text-secondary); }

/* timeline */
.sr-timeline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 6px 2px; border-top: 1px solid var(--overlay-06, rgba(255,255,255,0.06)); }
.sr-play {
    display: inline-flex; align-items: center; gap: 7px; border: none; cursor: pointer; font: inherit; font-size: 0.82rem; font-weight: 700;
    padding: 8px 14px; border-radius: 999px; color: #fff; background: linear-gradient(135deg, var(--sr-avg), #8b5cf6);
    box-shadow: 0 6px 16px rgba(77,163,255,0.3); transition: transform 0.15s, opacity 0.2s;
}
.sr-play:hover:not(:disabled) { transform: translateY(-1px); }
.sr-play:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.sr-play svg { width: 14px; height: 14px; }
.sr-icon-pause { display: none; }
.sr-is-playing .sr-icon-play { display: none; }
.sr-is-playing .sr-icon-pause { display: inline; }
.sr-range { flex: 1 1 160px; accent-color: var(--sr-avg); cursor: pointer; }
.sr-range:disabled { opacity: 0.4; }
.sr-step-label { flex: 1 1 100%; font-size: 0.8rem; color: var(--text-secondary); min-height: 1.2em; }
.sr-step-title { display: block; color: var(--text-muted, #6b7280); font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-is-playing .sr-chart-card { box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.35); }

/* side panel */
.sr-side { display: flex; flex-direction: column; gap: 14px; }
.sr-summary, .sr-detail-card, .sr-detail-hint {
    background: radial-gradient(circle at 100% 0%, rgba(77,163,255,0.08), transparent 60%), var(--bg-surface);
    border: 1px solid var(--overlay-06, rgba(255,255,255,0.06)); border-radius: 16px; padding: 18px;
}
.sr-summary:empty { display: none; }
.sr-sum-top { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.sr-sum-ring {
    --pct: 0; width: 76px; height: 76px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center;
    background: conic-gradient(var(--ring) calc(var(--pct) * 1%), var(--overlay-06, rgba(255,255,255,0.08)) 0);
    position: relative; animation: sr-spin-in 1s cubic-bezier(0.16, 1, 0.3, 1);
}
.sr-sum-ring::before { content: ""; position: absolute; inset: 7px; border-radius: 50%; background: var(--bg-surface); }
@keyframes sr-spin-in { from { transform: rotate(-90deg) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }
.sr-sum-num { position: relative; font-size: 1.45rem; font-weight: 800; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.sr-sum-label { font-weight: 800; color: var(--text-primary); }
.sr-sum-sub { font-size: 0.8rem; color: var(--text-secondary); margin-top: 2px; }
.sr-sum-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; font-size: 0.88rem; color: var(--text-tertiary, #cbd5e1); }
.sr-sum-list li { display: flex; gap: 8px; align-items: baseline; }
.sr-sum-icon { width: 16px; text-align: center; flex-shrink: 0; font-size: 0.75rem; }
.sr-up { color: #22c55e; }
.sr-rise { color: #8b5cf6; }
.sr-focus { color: #f97316; animation: sr-blink 1.8s ease-in-out infinite; }
@keyframes sr-blink { 50% { opacity: 0.35; } }

.sr-detail-hint { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }
.sr-link { background: none; border: none; padding: 0; font: inherit; color: var(--accent-text, var(--sr-avg)); font-weight: 700; cursor: pointer; text-decoration: underline; }
.sr-detail-card { border-top: 3px solid var(--accent-band); animation: sr-pop 0.25s ease-out; }
.sr-detail-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.sr-detail-head h4 { margin: 0; font-size: 1.05rem; color: var(--text-primary); }
.sr-detail-close { background: none; border: none; color: var(--text-secondary); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.sr-detail-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.sr-detail-stats div { background: var(--overlay-04, rgba(255,255,255,0.04)); border-radius: 10px; padding: 8px; text-align: center; }
.sr-detail-stats span { display: block; font-size: 0.7rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.05em; }
.sr-detail-stats strong { font-size: 1.2rem; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.sr-tips-title { font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-secondary); margin: 12px 0 6px; }
.sr-tips { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; font-size: 0.86rem; line-height: 1.45; color: var(--text-tertiary, #cbd5e1); }

/* sparklines */
.sr-spark { width: 100%; height: auto; display: block; overflow: visible; }
.sr-spark-area { fill: var(--sr-avg); opacity: 0.12; }
.sr-spark-line { fill: none; stroke: var(--sr-avg); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: sr-draw 1.1s 0.2s ease-out forwards; vector-effect: non-scaling-stroke; }
@keyframes sr-draw { to { stroke-dashoffset: 0; } }
.sr-spark-dot { fill: var(--sr-latest); stroke: var(--bg-surface); stroke-width: 2; }
.sr-spark-empty { display: flex; align-items: center; justify-content: center; font-size: 0.75rem; color: var(--text-muted, #6b7280); border: 1px dashed var(--overlay-08, rgba(255,255,255,0.1)); border-radius: 8px; }

/* per-skill cards */
.sr-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-top: 16px; }
.sr-card {
    text-align: left; font: inherit; color: inherit; cursor: pointer;
    background: var(--bg-surface); border: 1px solid var(--overlay-06, rgba(255,255,255,0.06)); border-radius: 14px; padding: 14px;
    display: flex; flex-direction: column; gap: 8px; transition: transform 0.18s, border-color 0.18s, box-shadow 0.18s;
    animation: sr-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.sr-card:nth-child(2) { animation-delay: 60ms; } .sr-card:nth-child(3) { animation-delay: 120ms; }
.sr-card:nth-child(4) { animation-delay: 180ms; } .sr-card:nth-child(5) { animation-delay: 240ms; }
@keyframes sr-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.sr-card:hover { transform: translateY(-2px); border-color: var(--band); }
.sr-card.is-selected { border-color: var(--band); box-shadow: 0 0 0 2px var(--band) inset; }
.sr-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.sr-card-name { font-size: 0.85rem; font-weight: 700; color: var(--text-primary); }
.sr-trend { font-size: 0.72rem; font-weight: 800; white-space: nowrap; }
.sr-card-band { font-size: 1.6rem; font-weight: 800; color: var(--band); font-variant-numeric: tabular-nums; line-height: 1; }
.sr-card-band span { font-size: 0.7rem; color: var(--text-secondary); font-weight: 600; margin-left: 6px; }
.sr-card-bar { height: 6px; border-radius: 999px; background: var(--overlay-06, rgba(255,255,255,0.08)); overflow: hidden; }
.sr-card-fill { height: 100%; background: var(--band); border-radius: inherit; animation: sr-grow 0.9s cubic-bezier(0.16, 1, 0.3, 1) both; transform-origin: left; }
@keyframes sr-grow { from { transform: scaleX(0); } }
.sr-card-meta { font-size: 0.72rem; color: var(--text-muted, #6b7280); }

/* empty / ghost state */
.sr-ghost .sr-avg-poly { opacity: 0.35; animation: sr-breathe 3.2s ease-in-out infinite; transform-origin: 380px 268px; }
.sr-ghost .sr-avg-line { opacity: 0.25; stroke-dasharray: 6 8; animation: sr-breathe 3.2s ease-in-out infinite; transform-origin: 380px 268px; }
.sr-ghost .sr-dot, .sr-ghost .sr-latest-poly, .sr-ghost .sr-latest-dot, .sr-ghost .sr-chip, .sr-ghost .sr-legend, .sr-ghost .sr-side, .sr-ghost .sr-cards { display: none; }
.sr-ghost .sr-body { grid-template-columns: 1fr; }
@keyframes sr-breathe { 50% { transform: scale(0.9); } }
.sr-empty-msg {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(340px, 80%); text-align: center;
    background: var(--bg-surface); border: 1px solid var(--overlay-08, rgba(255,255,255,0.1)); border-radius: 14px; padding: 14px 16px;
    font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}

@media (prefers-reduced-motion: reduce) {
    .skill-radar *, .skill-radar *::before { animation: none !important; transition: none !important; }
    .sr-spark-line { stroke-dashoffset: 0; }
    .sr-dot { opacity: 1; transform: none; }
}
.sr-ghost .sr-svg { max-height: 380px; }

/* Writing II -- choosing several sections */
.section-picker-hint { font-size: 0.82rem; color: var(--text-secondary); }
.section-picker-check {
    flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center;
    border: 2px solid var(--overlay-12, rgba(255,255,255,0.2)); color: transparent; transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.section-picker-check svg { width: 16px; height: 16px; }
.section-picker-option.is-selected { border-color: var(--w2); background: var(--w2-a10); }
.section-picker-option.is-selected .section-picker-check { background: var(--w2); border-color: var(--w2); color: #fff; }
.section-picker-label { display: inline-flex; align-items: center; gap: 8px; }
.section-picker-label .section-picker-num, .section-write-label .section-picker-num { width: 22px; height: 22px; font-size: 0.75rem; }
.section-picker-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.section-picker-footer .modal-actions { margin: 0; gap: 10px; display: flex; }
.section-picker-footer .sr-link { color: var(--w2); }
#section-picker-start:disabled { opacity: 0.5; cursor: not-allowed; }

.section-write-block { margin-bottom: 18px; padding: 14px; border-radius: 14px; border: 1px solid var(--w2-a18); background: var(--w2-a10); }
.section-write-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 8px; color: var(--text-primary); }
.section-write-block .essay-textarea { background: var(--bg-surface); }
.section-write-block .essay-meta-row { margin-top: 6px; }
.section-total-row { justify-content: flex-end; font-weight: 700; color: var(--text-secondary); margin: -6px 0 6px; }
.section-guide-tips { display: flex; flex-direction: column; gap: 8px; }
.section-guide-tip summary { cursor: pointer; list-style: none; }
.section-guide-tip summary::-webkit-details-marker { display: none; }
.section-guide-tip summary::before { content: "▸"; color: var(--w2); margin-right: 6px; display: inline-block; transition: transform 0.15s; }
.section-guide-tip[open] summary::before { transform: rotate(90deg); }
.section-guide-tip ul { margin-top: 6px; }

/* ============================================================
   PHONES (700px wide and under, or a phone turned sideways)
   Bander works on phones: the sidebar becomes a slide-out menu opened
   from the ☰ button, the top bar shrinks to essentials, spacing is
   tightened so content gets the whole width, and every form box uses
   16px text so iPhones don't zoom in when you tap one.
   The tablet "icon rail" (max-width: 1000px, above) still applies
   between 701px and 1000px.
   ============================================================ */
.menu-icon,
.mobile-brand,
.mobile-nav-backdrop { display: none; }

@media (max-width: 700px), (max-height: 500px) and (pointer: coarse) {
    html, body { height: 100%; }

    /* ----- layout: content gets the full width ----- */
    .app-container,
    .app-container.sidebar-collapsed {
        display: block;
        min-height: 100dvh;
    }

    .main-content {
        height: 100dvh;
        padding: 0 10px calc(16px + env(safe-area-inset-bottom));
        -webkit-overflow-scrolling: touch;
    }

    .workspace-card {
        padding: 20px 16px;
        border-radius: 14px;
    }

    /* ----- slide-out menu ----- */
    .app-container .sidebar,
    .app-container.sidebar-collapsed #sidebar-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(84vw, 300px);
        height: 100dvh;
        padding: calc(20px + env(safe-area-inset-top)) 18px calc(20px + env(safe-area-inset-bottom));
        transform: translateX(-105%);
        opacity: 1;
        pointer-events: auto;
        z-index: 1500;
        box-shadow: none;
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.28s ease;
    }
    .app-container.mobile-nav-open .sidebar {
        transform: translateX(0);
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.45);
    }
    .mobile-nav-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(5, 8, 16, 0.55);
        z-index: 1400;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
    }
    .app-container.mobile-nav-open .mobile-nav-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* Inside the menu, undo the tablet icon rail: full labels again. */
    .app-container .brand-title-container { justify-content: space-between; margin-bottom: 22px; }
    .app-container .brand-title { display: block; }
    .app-container .profile-badge:not([hidden]) { display: block; padding: 14px; margin-bottom: 16px; }
    .app-container .profile-badge .profile-badge-row { justify-content: flex-start; gap: 12px; }
    .app-container .profile-badge .profile-badge-row > div:not(:first-child),
    .app-container .profile-badge .profile-name,
    .app-container .profile-badge .profile-level { display: block; }
    .app-container .profile-badge:not(:has(.profile-badge-row))::before { content: none; }
    .app-container .nav-links { align-items: stretch; gap: 4px; }
    .app-container .nav-item { width: auto; justify-content: flex-start; padding: 10px 12px; min-height: 48px; }
    .app-container .nav-item-label { display: block; }
    .app-container .nav-badge { left: 34px; top: 4px; }
    .app-container .band-goal-card:not([hidden]) { display: block; }

    /* ----- top bar ----- */
    .top-bar {
        position: sticky;
        top: 0;
        z-index: 50;
        gap: 8px;
        margin: 0 -10px 12px;
        padding: calc(10px + env(safe-area-inset-top)) 10px 10px;
        width: auto;
        background: var(--bg-page);
        border-bottom: 1px solid var(--overlay-05);
    }
    .sidebar-toggle-btn { margin-right: 0; width: 44px; height: 44px; flex-shrink: 0; }
    .sidebar-toggle-btn .toggle-icon { display: none; }
    .sidebar-toggle-btn .menu-icon { display: block; width: 22px; height: 22px; }
    .mobile-brand {
        display: block;
        margin-right: auto;
        font-size: 1.2rem;
        font-weight: 800;
        letter-spacing: -0.025em;
        color: var(--text-primary);
        cursor: pointer;
        white-space: nowrap;
    }
    .mobile-brand span { color: var(--accent-text); }
    .streak-container { padding: 8px 11px; font-size: 0.9rem; white-space: nowrap; flex-shrink: 0; }
    .streak-container [data-i18n="nav.streak"],
    .streak-container .streak-label { display: none; }
    .lang-switcher-trigger { padding: 8px 10px; min-height: 40px; }
    .lang-switcher-trigger #lang-switcher-current,
    .lang-switcher-trigger .lang-switcher-chevron { display: none; }
    /* The Premium button doesn't do anything yet; on a phone its space is
       worth more to the menu button, streak and language picker. */
    .premium-btn { display: none; }
    .lang-switcher-menu { right: 0; left: auto; }

    /* ----- type and spacing ----- */
    .dashboard-view h2 { font-size: 1.35rem; line-height: 1.25; }
    .view-subtitle { font-size: 0.92rem; }

    /* ----- forms: 16px text stops iPhones zooming in; bigger tap targets ----- */
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select,
    textarea,
    .text-input {
        font-size: 16px !important;
    }
    .primary-action-btn,
    .secondary-action-btn,
    .logout-btn { min-height: 44px; }

    /* ----- pop-ups fit the screen and scroll if they're tall ----- */
    .modal-overlay {
        padding: 12px;
        align-items: flex-start;
        overflow-y: auto;
    }
    .modal-card {
        padding: 22px 18px;
        max-width: 100%;
        margin: auto 0;
        max-height: none;
    }
    .modal-actions { flex-wrap: wrap; }

    /* ----- notifications sit across the bottom ----- */
    .toast-stack {
        left: 10px;
        right: 10px;
        bottom: calc(12px + env(safe-area-inset-bottom));
        max-width: none;
    }

    /* ----- lists: details first, status label underneath ----- */
    .submission-row { flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 14px 16px; }
    .submission-row > :first-child { flex: 1 1 100%; min-width: 0; }

    /* ----- nothing may push the page sideways ----- */
    .workspace-card,
    .dashboard-view { max-width: 100%; overflow-wrap: break-word; }
    .workspace-card img,
    .workspace-card video,
    .workspace-card canvas { max-width: 100%; height: auto; }
    .workspace-card table { display: block; overflow-x: auto; max-width: 100%; }
}
