/* =========================================================================
   MULTICAST DESIGN SYSTEM
   One light theme across the public site, the staff portal and the student
   player. Tokens first, then primitives, then components.
   ========================================================================= */

:root {
    /* Brand. --primary and --secondary are overwritten at runtime by the
       signed-in organisation's own colours. Every other shade is mixed from
       them, so setting one colour recolours the whole app: nothing stays
       blue behind a school that chose red. */
    --primary: #0ea5e9;
    --primary-strong: color-mix(in srgb, var(--primary) 78%, #0b1220);
    --primary-soft: color-mix(in srgb, var(--primary) 13%, #ffffff);
    --secondary: #06b6d4;
    --accent: #14b8a6;

    /* The Multicast mark itself. Fixed, so the product logo stays the
       product logo even on a page tinted with a school's own colours. */
    --brand-a: #0ea5e9;
    --brand-b: #06b6d4;

    /* Legacy aliases so older selectors keep resolving. */
    --primary-blue: var(--primary);
    --primary-cyan: var(--secondary);
    --secondary-color: var(--secondary);

    /* Neutrals */
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-sunken: #f1f5f9;
    --border: #e4e9f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-soft: #475569;
    --text-muted: #7b8794;

    /* Status */
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --success: #059669;
    --success-soft: #ecfdf5;
    --warning: #d97706;
    --warning-soft: #fffbeb;

    /* Legacy aliases */
    --bg-page: var(--bg);
    --bg-surface: var(--surface);
    --text-main: var(--text);

    /* Type */
    --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-dyslexic: 'Lexend', var(--font);

    /* Spacing scale */
    --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px;
    --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;

    /* Radii */
    --multicast-mark: url("data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><defs><linearGradient id="m" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="%230ea5e9"/><stop offset="1" stop-color="%2306b6d4"/></linearGradient></defs><rect width="64" height="64" rx="15" fill="url(%23m)"/><path d="M15 46V18h7.6l9.4 14.2L41.4 18H49v28h-7.4V30.4l-6.9 10.3h-5.4L22.4 30.4V46z" fill="%23fff"/></svg>");
    --search-glyph: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.2' y1='16.2' x2='21' y2='21'/%3E%3C/svg%3E");
    --r-sm: 8px; --r-md: 12px; --r-lg: 16px; --r-xl: 24px; --r-pill: 999px;

    /* Elevation */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 3px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
    --shadow-lg: 0 12px 20px -8px rgba(15, 23, 42, 0.12), 0 4px 8px -4px rgba(15, 23, 42, 0.06);
    --shadow-xl: 0 24px 48px -12px rgba(15, 23, 42, 0.18);

    /* Layout */
    --content-max: 1160px;
    --reading-max: 760px;
    --sidebar-w: 248px;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5 { line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; }
h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); letter-spacing: -0.035em; }
h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.05rem; }
h5 { font-size: 0.95rem; }

a { color: var(--primary-strong); }

::selection { background: var(--primary-soft); }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* =========================================================================
   AMBIENT BACKGROUND
   ========================================================================= */
.teacher-theme,
.app-shell-bg {
    background:
        radial-gradient(1000px 600px at 12% -8%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 60%),
        radial-gradient(900px 520px at 100% 0%, color-mix(in srgb, var(--secondary) 12%, transparent), transparent 55%),
        var(--bg);
    min-height: 100vh;
    position: relative;
}

.graphic-circle {
    position: fixed;
    width: 520px; height: 520px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--primary) 16%, transparent), transparent 68%);
    top: -180px; right: -160px;
    pointer-events: none; z-index: 0;
    filter: blur(6px);
}
.graphic-circle.small {
    width: 380px; height: 380px;
    top: auto; right: auto;
    bottom: -140px; left: -140px;
    background: radial-gradient(circle at 60% 40%, color-mix(in srgb, var(--secondary) 14%, transparent), transparent 68%);
}

/* =========================================================================
   WORDMARK  [M]ulticast
   ========================================================================= */
.wordmark {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    font-weight: 800;
    font-size: 1.3rem;
    letter-spacing: -0.03em;
    color: var(--text);
    text-decoration: none;
    line-height: 1;
}
/* The mark itself. The Multicast logo is drawn by the stylesheet, so it is
   always there; an institution's own logo is an image laid over it. */
.wordmark-m {
    position: relative;
    display: inline-block;
    width: 1.05em;
    height: 1.05em;
    flex-shrink: 0;
    top: 0.02em;
    background: var(--multicast-mark) center / contain no-repeat;
}
.wordmark-m img { width: 100%; height: 100%; object-fit: contain; display: block; }
.wordmark-m.has-image { background: none; }
.wordmark > span { display: block; }
/* An institution that has uploaded a logo shows its own mark alone: the
   logo stands in for the M, and "ulticast" beside it is dropped. */
.wordmark.has-org-logo > span { display: none; }
.wordmark.has-org-logo .wordmark-m { width: 2em; height: 2em; top: 0; }
.wordmark.lg { font-size: 1.7rem; }
.wordmark.sm { font-size: 1.05rem; }

/* =========================================================================
   BUTTONS
   ========================================================================= */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    padding: 10px 18px;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
                box-shadow 0.16s var(--ease), transform 0.12s var(--ease), color 0.16s var(--ease);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    white-space: nowrap;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 1px 2px rgba(15,23,42,0.08), inset 0 1px 0 rgba(255,255,255,0.16);
}
.btn-primary:hover { background: var(--primary-strong); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
    box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface-sunken); border-color: var(--border-strong); }
.btn-secondary:active { transform: translateY(1px); }

.btn-danger {
    background: var(--surface);
    border-color: color-mix(in srgb, var(--danger) 32%, var(--border));
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

.btn-ghost { background: transparent; color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--text); }

.btn-primary:disabled, .btn-secondary:disabled, .btn-danger:disabled {
    opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none;
}

.btn-lg { padding: 14px 26px; font-size: 1rem; border-radius: var(--r-md); }
.btn-sm { padding: 7px 12px; font-size: 0.82rem; }
.btn-block { width: 100%; }

.btn-text {
    background: none; border: none; font-family: inherit;
    color: var(--text-muted); font-weight: 600; font-size: 0.88rem;
    cursor: pointer; padding: 8px 12px; border-radius: var(--r-sm);
    transition: 0.16s var(--ease);
}
.btn-text:hover { background: var(--surface-sunken); color: var(--text); }

.btn-danger-text {
    background: none; border: none; color: var(--text-muted);
    font-size: 1.05rem; line-height: 1; cursor: pointer; padding: 2px 6px;
    border-radius: 4px; transition: 0.16s var(--ease);
}
.btn-danger-text:hover { color: var(--danger); background: var(--danger-soft); }

.action-group { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }

/* =========================================================================
   FORM CONTROLS
   ========================================================================= */
.input-group { margin-bottom: var(--s4); width: 100%; }
.input-group label,
.field-label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-soft);
    margin-bottom: 6px;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="url"], input[type="search"], select, textarea,
.modern-input, .modern-select {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border);
    border-radius: var(--r-sm);
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--text);
    background: var(--surface);
    outline: none;
    transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
input:focus, select:focus, textarea:focus,
.modern-input:focus, .modern-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}
input::placeholder { color: #9aa5b1; }

select, .modern-select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b8794' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 36px;
    cursor: pointer;
}

input[type="color"] {
    height: 42px; padding: 4px; cursor: pointer;
    border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface);
}

.field-hint { font-size: 0.78rem; color: var(--text-muted); margin-top: 6px; line-height: 1.5; }

/* Toggle switch */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; }
.switch input {
    position: absolute; inset: 0; z-index: 2;
    width: 100%; height: 100%; margin: 0;
    opacity: 0; cursor: pointer;
}
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + .slider { opacity: 0.45; }
.slider {
    position: absolute; inset: 0; cursor: pointer;
    background-color: var(--border-strong);
    transition: 0.22s var(--ease);
    border-radius: var(--r-pill);
}
.slider:before {
    position: absolute; content: "";
    height: 18px; width: 18px; left: 3px; bottom: 3px;
    background: #fff; border-radius: 50%;
    transition: 0.22s var(--ease);
    box-shadow: 0 1px 3px rgba(15,23,42,0.2);
}
input:checked + .slider { background-color: var(--primary); }
input:checked + .slider:before { transform: translateX(18px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }

/* Segmented control */
.segmented {
    display: inline-flex; background: var(--surface-sunken);
    border: 1px solid var(--border); border-radius: var(--r-pill); padding: 3px; gap: 2px;
}
.segmented button {
    border: none; background: transparent; font-family: inherit;
    font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
    padding: 7px 15px; border-radius: var(--r-pill); cursor: pointer;
    transition: 0.16s var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--primary-strong); box-shadow: var(--shadow-sm); }

/* =========================================================================
   SURFACES
   ========================================================================= */
.card, .settings-card, .recording-card, .ai-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}
.settings-card { padding: var(--s5); }

.section-heading {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s4);
}
.section-heading h3 { font-size: 1.15rem; }
.section-heading p { font-size: 0.86rem; color: var(--text-muted); }

.empty-state {
    text-align: center; color: var(--text-muted);
    font-size: 0.9rem; padding: var(--s7) var(--s5);
    border: 1px dashed var(--border-strong); border-radius: var(--r-md);
    background: var(--surface);
}
.empty-state p { max-width: 42ch; margin: 0 auto; }

.error-text { color: var(--danger); font-size: 0.86rem; font-weight: 600; margin-top: var(--s2); }

.badge {
    display: inline-flex; align-items: center; gap: 5px;
    font-size: 0.72rem; font-weight: 700;
    padding: 4px 9px; border-radius: var(--r-pill);
    background: var(--surface-sunken); color: var(--text-soft);
}
.badge-admin { background: var(--text); color: #fff; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-info { background: var(--primary-soft); color: var(--primary-strong); }

/* =========================================================================
   PUBLIC SITE: header, hero, sections, footer
   ========================================================================= */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
.site-header-inner {
    max-width: var(--content-max); margin: 0 auto;
    padding: var(--s3) var(--s5);
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
}
.site-nav { display: flex; align-items: center; gap: var(--s1); }
.site-nav a {
    font-size: 0.9rem; font-weight: 600; color: var(--text-soft);
    text-decoration: none; padding: 8px 12px; border-radius: var(--r-sm);
    transition: 0.16s var(--ease);
}
.site-nav a:hover { background: var(--surface-sunken); color: var(--text); }

.site-main { position: relative; z-index: 1; }
.section { max-width: var(--content-max); margin: 0 auto; padding: var(--s8) var(--s5); }
.section-narrow { max-width: var(--reading-max); }

.hero {
    display: grid; grid-template-columns: 1.05fr 0.95fr;
    gap: var(--s8); align-items: center;
    max-width: var(--content-max); margin: 0 auto;
    padding: clamp(48px, 8vw, 96px) var(--s5);
}
.hero h1 { margin-bottom: var(--s4); }
.hero h1 .grad {
    background: linear-gradient(100deg, var(--primary), var(--secondary));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-lede { font-size: 1.08rem; color: var(--text-soft); max-width: 52ch; margin-bottom: var(--s5); }

.feature-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s4);
}
.feature {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--s5);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.feature h4 { margin-bottom: 6px; }
.feature p { font-size: 0.9rem; color: var(--text-muted); }

.icon-tile {
    width: 42px; height: 42px; border-radius: var(--r-md);
    display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: var(--s3); flex-shrink: 0;
}

.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    margin-top: var(--s8);
}
.site-footer-inner {
    max-width: var(--content-max); margin: 0 auto; padding: var(--s7) var(--s5) var(--s5);
    display: grid; grid-template-columns: 1.4fr repeat(2, minmax(0, 1fr)); gap: var(--s6);
}
.site-footer h5 {
    font-size: 0.84rem; font-weight: 700;
    color: var(--text-soft); margin-bottom: var(--s3);
}
.site-footer ul { list-style: none; display: flex; flex-direction: column; gap: var(--s2); }
.site-footer a { font-size: 0.9rem; color: var(--text-soft); text-decoration: none; }
.site-footer a:hover { color: var(--primary-strong); }
.footer-bottom {
    max-width: var(--content-max); margin: 0 auto;
    padding: var(--s4) var(--s5); border-top: 1px solid var(--border);
    display: flex; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
    font-size: 0.82rem; color: var(--text-muted);
}

/* School picker */
.picker-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: var(--s6);
    box-shadow: var(--shadow-xl);
}
.combo { position: relative; }
.combo-list {
    position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); box-shadow: var(--shadow-lg);
    max-height: 260px; overflow-y: auto; padding: 6px; display: none;
}
.combo-list.open { display: block; }
.combo-option {
    display: flex; align-items: center; gap: var(--s3);
    padding: 9px 10px; border-radius: var(--r-sm); cursor: pointer;
    font-size: 0.92rem; border: none; background: none; width: 100%; text-align: left;
    font-family: inherit; color: var(--text);
}
.combo-option:hover, .combo-option.active { background: var(--primary-soft); }
.combo-option img, .combo-avatar {
    width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(140deg, var(--primary), var(--secondary));
    color: #ffffff;
}
.combo-avatar svg { width: 62%; height: 62%; display: block; }
/* A school that has uploaded its own logo shows that instead, on a plain
   tile so a dark or transparent logo still reads. */
.combo-option img, img.combo-avatar {
    background: var(--surface-sunken); object-fit: contain; padding: 3px;
}
.combo-empty { padding: var(--s4); font-size: 0.88rem; color: var(--text-muted); text-align: center; }

/* Role picker: the first thing anyone sees on the splash page. Student or
   teacher comes first, the school is asked for afterwards. */
.role-choice { display: grid; gap: var(--s3); }
.role-card {
    display: flex; align-items: center; gap: var(--s4);
    width: 100%; padding: var(--s4);
    text-align: left; font-family: inherit; color: var(--text); text-decoration: none;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); cursor: pointer;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.role-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.role-card:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.role-icon {
    width: 42px; height: 42px; border-radius: var(--r-md); flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(140deg, var(--primary), var(--secondary)); color: #ffffff;
}
.role-card strong { display: block; font-size: 1rem; letter-spacing: -0.01em; }
.role-card small { display: block; font-size: 0.84rem; color: var(--text-muted); margin-top: 3px; }
.role-go { margin-left: auto; color: var(--text-muted); flex-shrink: 0; }

.selected-org {
    display: flex; align-items: center; gap: var(--s3);
    padding: var(--s3); border: 1px solid var(--border);
    border-radius: var(--r-md); background: var(--surface-sunken); margin-bottom: var(--s4);
}
.selected-org img, .selected-org .combo-avatar { width: 40px; height: 40px; border-radius: 9px; }

/* Legal / status prose */
.prose { max-width: var(--reading-max); }
.prose h2 { margin: var(--s6) 0 var(--s3); font-size: 1.4rem; }
.prose h3 { margin: var(--s5) 0 var(--s2); font-size: 1.05rem; }
.prose p, .prose li { color: var(--text-soft); font-size: 0.95rem; margin-bottom: var(--s3); }
.prose ul, .prose ol { padding-left: var(--s5); margin-bottom: var(--s4); }

.status-row {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
    padding: var(--s4) 0; border-bottom: 1px solid var(--border);
}
.status-row:last-child { border-bottom: none; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.status-dot.degraded { background: var(--warning); }
.status-dot.down { background: var(--danger); }
.status-pill {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.82rem; font-weight: 700; color: var(--success);
    background: var(--success-soft); padding: 6px 12px; border-radius: var(--r-pill);
}

/* =========================================================================
   AUTH / SIGN-IN CARD
   ========================================================================= */
.auth-wrapper {
    display: flex; min-height: 100vh; position: relative; z-index: 1;
    align-items: center; justify-content: center; padding: var(--s5);
}
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: var(--s6);
    box-shadow: var(--shadow-xl);
}
.auth-card .wordmark { margin-bottom: var(--s5); }
.auth-card h3 { margin-bottom: 4px; }
.auth-sub { font-size: 0.9rem; color: var(--text-muted); margin-bottom: var(--s5); }

.login-card {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    z-index: 1; width: calc(100% - 40px); max-width: 420px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-xl); padding: var(--s6);
    box-shadow: var(--shadow-xl);
    display: flex; flex-direction: column;
}
.login-card .input-group { text-align: left; }

/* =========================================================================
   APP SHELL
   ========================================================================= */
.dashboard-layout { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: color-mix(in srgb, var(--surface) 76%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    padding: var(--s5) var(--s3);
    position: sticky; top: 0; height: 100vh;
}
.sidebar .wordmark { padding: 0 var(--s3) var(--s6); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
    width: 100%; display: flex; align-items: center; gap: var(--s3);
    padding: 10px var(--s3); color: var(--text-soft);
    font-family: inherit; font-weight: 600; font-size: 0.9rem;
    border-radius: var(--r-sm); text-align: left;
    background: none; border: none; cursor: pointer;
    transition: 0.16s var(--ease); position: relative;
}
.nav-item:hover { background: var(--surface-sunken); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-strong); }
.nav-item.active::before {
    content: ""; position: absolute; left: 0;
    top: 50%; transform: translateY(-50%);
    width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: var(--primary);
}
.nav-item .nav-icon { display: inline-flex; flex-shrink: 0; opacity: 0.85; }

.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: var(--s3); }

.account-chip {
    display: flex; align-items: center; gap: var(--s3);
    padding: var(--s2) var(--s3); border-radius: var(--r-md);
    width: 100%; background: none; border: none; cursor: pointer;
    font-family: inherit; text-align: left; transition: 0.16s var(--ease);
}
.account-chip:hover { background: var(--surface-sunken); }
.account-chip .avatar { width: 34px; height: 34px; font-size: 0.85rem; }
.account-chip-text { min-width: 0; }
.account-chip-text strong { display: block; font-size: 0.86rem; font-weight: 700; }
.account-chip-text span {
    display: block; font-size: 0.75rem; color: var(--text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.avatar {
    width: 40px; height: 40px; border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; color: #fff; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    object-fit: cover; overflow: hidden;
}
.avatar.lg { width: 72px; height: 72px; font-size: 1.5rem; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* Mobile top bar + hamburger */
.mobile-bar {
    display: none;
    position: sticky; top: 0; z-index: 60;
    align-items: center; justify-content: space-between; gap: var(--s3);
    padding: var(--s3) var(--s4);
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}

.hamburger {
    width: 42px; height: 42px; border: 1px solid var(--border);
    background: var(--surface); border-radius: var(--r-sm);
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 5px; cursor: pointer; padding: 0; flex-shrink: 0;
}
.hamburger span {
    display: block; width: 18px; height: 2px; border-radius: 2px;
    background: var(--text);
    transition: transform 0.28s var(--ease), opacity 0.18s var(--ease);
    transform-origin: center;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0.4); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.scrim {
    position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px); z-index: 55;
    opacity: 0; pointer-events: none; transition: opacity 0.22s var(--ease);
}
.scrim.open { opacity: 1; pointer-events: auto; }

/* =========================================================================
   WORKSPACE
   ========================================================================= */
.main-workspace {
    flex: 1; min-width: 0; flex-direction: column;
    padding: var(--s6) var(--s5) var(--s8);
    overflow-x: hidden;
}
.page-view { display: none; }
.page-view.active-page { display: flex; }

/* Everything inside a page is width-constrained so nothing stretches edge
   to edge on a wide monitor. */
.main-workspace > * { width: 100%; max-width: var(--content-max); margin-left: auto; margin-right: auto; }

.top-header {
    display: flex; justify-content: space-between; align-items: flex-end;
    gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6);
    padding-bottom: var(--s4); border-bottom: 1px solid var(--border);
}
.top-header h2 { font-size: 1.6rem; }
.breadcrumb {
    font-size: 0.82rem; color: var(--text-muted); font-weight: 600;
    display: block; margin-bottom: 4px;
}

.stack { display: flex; flex-direction: column; gap: var(--s5); }
.flex-align { display: flex; align-items: center; gap: var(--s2); }

/* =========================================================================
   SETTINGS
   A settings page is a list of labelled rows inside grouped panels, at a
   readable width. Controls sit right-aligned against their description
   rather than stacking into a full-width column.
   ========================================================================= */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--s6); align-items: start; }

.settings-nav { position: sticky; top: var(--s5); display: flex; flex-direction: column; gap: 2px; }
.settings-nav button {
    text-align: left; background: none; border: none; font-family: inherit;
    font-size: 0.88rem; font-weight: 600; color: var(--text-soft);
    padding: 9px var(--s3); border-radius: var(--r-sm); cursor: pointer;
    transition: 0.16s var(--ease);
}
.settings-nav button:hover { background: var(--surface-sunken); color: var(--text); }
.settings-nav button.active { background: var(--primary-soft); color: var(--primary-strong); }

.settings-panel { max-width: var(--reading-max); }
.settings-panel[hidden] { display: none; }

.panel {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
    overflow: hidden; margin-bottom: var(--s5);
}
.panel-head { padding: var(--s5) var(--s5) var(--s3); }
.panel-head h4 { margin-bottom: 4px; }
.panel-head p { font-size: 0.86rem; color: var(--text-muted); }
.panel-body { padding: 0 var(--s5) var(--s5); }
.panel-foot {
    padding: var(--s3) var(--s5); background: var(--surface-sunken);
    border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: var(--s2);
}

/* One setting: label + description on the left, control on the right. */
.setting-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--s5); padding: var(--s4) 0; border-bottom: 1px solid var(--border);
}
.setting-row:last-child { border-bottom: none; }
.setting-row-text { min-width: 0; flex: 1; }
.setting-row-text h5 { font-size: 0.92rem; font-weight: 700; margin-bottom: 2px; }
.setting-row-text p { font-size: 0.82rem; color: var(--text-muted); line-height: 1.5; }
.setting-row-control { flex-shrink: 0; display: flex; align-items: center; gap: var(--s3); }
.setting-row-control .modern-select, .setting-row-control select { width: 148px; }
.setting-row.stacked { flex-direction: column; align-items: stretch; gap: var(--s3); }
.setting-row.stacked .setting-row-control { width: 100%; }
.setting-row.stacked .setting-row-control .modern-select { width: 100%; }

.setting-group { margin-bottom: var(--s4); }
.setting-group > label { display: block; font-size: 0.84rem; font-weight: 700; color: var(--text-soft); margin-bottom: 6px; }

/* =========================================================================
   TOOLS
   ========================================================================= */
.tool-badge {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--r-md); flex-shrink: 0;
}
.tool-toggle-list { display: flex; flex-direction: column; }
.tool-toggle-row {
    display: flex; align-items: center; gap: var(--s3);
    padding: var(--s3) 0; border-bottom: 1px solid var(--border);
}
.tool-toggle-row:last-child { border-bottom: none; }
.tool-toggle-info { flex: 1; min-width: 0; }
.tool-toggle-info h5 { font-size: 0.9rem; font-weight: 700; margin-bottom: 1px; }
.tool-toggle-info p { font-size: 0.8rem; color: var(--text-muted); line-height: 1.45; }

/* Three-state override control: Default / On / Off. */
.tri-toggle {
    display: inline-flex; background: var(--surface-sunken);
    border: 1px solid var(--border); border-radius: var(--r-pill);
    padding: 2px; gap: 1px; flex-shrink: 0;
}
.tri-toggle button {
    border: none; background: transparent; font-family: inherit;
    font-size: 0.74rem; font-weight: 700; color: var(--text-muted);
    padding: 5px 11px; border-radius: var(--r-pill); cursor: pointer;
    transition: 0.16s var(--ease);
}
.tri-toggle button:hover { color: var(--text); }
.tri-toggle button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tri-toggle button.active[data-value="on"] { color: var(--success); }
.tri-toggle button.active[data-value="off"] { color: var(--danger); }

.collapsible-toggle {
    width: 100%; display: flex; justify-content: space-between; align-items: center;
    background: none; border: none; cursor: pointer; font-family: inherit;
    font-size: 0.88rem; font-weight: 700; color: var(--text); padding: 0;
}
.collapsible-chevron { display: inline-flex; transition: transform 0.22s var(--ease); color: var(--text-muted); }
.collapsible-chevron.open { transform: rotate(90deg); }

/* =========================================================================
   LIBRARY / LESSONS / CLASSES
   ========================================================================= */
.library-layout { display: grid; grid-template-columns: 216px minmax(0, 1fr); gap: var(--s5); align-items: start; }

.folder-sidebar {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--s4); box-shadow: var(--shadow-sm);
}
.folder-list { list-style: none; display: flex; flex-direction: column; gap: 2px; }
.folder-item {
    padding: 9px var(--s3); border-radius: var(--r-sm);
    font-size: 0.88rem; font-weight: 600; color: var(--text-soft);
    cursor: pointer; transition: 0.16s var(--ease);
    display: flex; justify-content: space-between; align-items: center; gap: var(--s2);
    border: 1px solid transparent;
}
.folder-item:hover { background: var(--surface-sunken); color: var(--text); }
.folder-item.active { background: var(--primary-soft); color: var(--primary-strong); }
.folder-item.drag-over { border: 1px dashed var(--primary); background: var(--primary-soft); }

.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s4); align-items: start; }

.lesson-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--s4);
    display: flex; flex-direction: column; gap: var(--s3);
    box-shadow: var(--shadow-sm); cursor: grab;
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    position: relative; overflow: hidden;
}
.lesson-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.lesson-card:active { cursor: grabbing; }
.lesson-card h4 { font-size: 1rem; line-height: 1.35; }
.lesson-card .card-top { display: flex; justify-content: space-between; gap: var(--s3); align-items: flex-start; }
.lesson-card .meta-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.card-actions { display: flex; gap: var(--s2); margin-top: auto; }
.card-actions > * { flex: 1; }
.stats-row {
    display: flex; gap: var(--s3); align-items: center;
    font-size: 0.78rem; font-weight: 600; color: var(--text-muted);
}

.lesson-title-edit {
    border: 1px solid transparent; background: transparent;
    font-family: inherit; font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em;
    color: var(--text); outline: none; width: 100%;
    border-radius: var(--r-sm); padding: 4px 8px; margin-left: -8px;
    transition: 0.16s var(--ease);
}
.lesson-title-edit:hover { background: var(--surface-sunken); }
.lesson-title-edit:focus { background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }

/* Class cards */
.class-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s4); }
.class-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--s4);
    box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: var(--s3);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
    position: relative; overflow: hidden;
}
.class-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.class-card::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
    background: var(--class-color, var(--primary));
}
.class-card-head { display: flex; align-items: center; gap: var(--s3); padding-top: 4px; }
.class-emblem {
    width: 46px; height: 46px; border-radius: var(--r-md); flex-shrink: 0;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1rem; color: #fff;
    background: var(--class-color, var(--primary));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.class-card-head h4 { font-size: 1.02rem; }
.class-card-head p { font-size: 0.8rem; color: var(--text-muted); }
.avatar-stack { display: flex; align-items: center; }
.avatar-stack .avatar {
    width: 26px; height: 26px; font-size: 0.66rem;
    border: 2px solid var(--surface); margin-left: -7px;
}
.avatar-stack .avatar:first-child { margin-left: 0; }
.avatar-stack .more {
    font-size: 0.74rem; color: var(--text-muted); font-weight: 700; margin-left: var(--s2);
}

/* A person in a list: enough to recognise them, and a click to open
   everything else. The detail belongs in the panel it opens, not in a row
   repeated down the page. */
.person-row {
    display: flex; align-items: center; gap: var(--s3);
    width: 100%; padding: 11px var(--s4); text-align: left;
    font-family: inherit; color: var(--text);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); cursor: pointer;
    transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.person-row:hover { border-color: var(--primary); box-shadow: var(--shadow-sm); }
.person-row:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.person-row .avatar { width: 34px; height: 34px; font-size: 0.76rem; }
.person-row-text { min-width: 0; flex: 1; }
.person-name {
    font-size: 0.94rem; font-weight: 700; line-height: 1.35;
    display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
}
.person-sub {
    display: block; font-size: 0.8rem; color: var(--text-muted);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.person-row-meta {
    font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0;
    display: none;
}
.person-row-go { color: var(--text-muted); flex-shrink: 0; }
@media (min-width: 720px) { .person-row-meta { display: block; } }

/* The actions inside a person's panel, under whatever is being edited */
.panel-actions {
    display: flex; flex-wrap: wrap; gap: var(--s2);
    margin-top: var(--s4); padding-top: var(--s4);
    border-top: 1px solid var(--border);
}

/* Search and filter above a list of people */
.list-filters {
    display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap;
    margin-bottom: var(--s4);
}
.list-search { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.list-search input {
    width: 100%; font-family: inherit; font-size: 0.92rem;
    padding: 10px 14px 10px 36px;
    border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--surface); color: var(--text);
}
.list-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent); }
.list-search::before {
    content: ""; position: absolute; left: 12px; top: 50%; width: 15px; height: 15px;
    margin-top: -7.5px; pointer-events: none; opacity: 0.5;
    background: currentColor; color: var(--text-muted);
    -webkit-mask: var(--search-glyph) center / contain no-repeat;
    mask: var(--search-glyph) center / contain no-repeat;
}
.list-filters .modern-select { width: auto; min-width: 190px; }
.list-count { font-size: 0.84rem; color: var(--text-muted); margin-left: auto; }

/* Rows (staff, students, messages) */
.inbox-container { display: flex; flex-direction: column; gap: var(--s3); }
.user-row, .message-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: var(--s4);
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--s4); flex-wrap: wrap; box-shadow: var(--shadow-sm);
}
.user-row-main { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.user-row h5 { font-size: 0.95rem; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.user-row p { font-size: 0.82rem; color: var(--text-muted); }
.message-card { align-items: flex-start; }
.message-card h5 { color: var(--primary-strong); margin-bottom: 4px; }
.message-card > div:first-child { min-width: 0; flex: 1; }
.message-context {
    font-size: 0.8rem; color: var(--text-muted); background: var(--surface-sunken);
    padding: var(--s2) var(--s3); border-radius: var(--r-sm); margin-top: var(--s2);
    display: inline-block;
}
.audit-log-row { padding: var(--s3) 0; border-bottom: 1px solid var(--border); font-size: 0.86rem; color: var(--text-soft); }
.audit-log-row:last-child { border-bottom: none; }

/* =========================================================================
   STUDIO
   ========================================================================= */
.studio-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--s5); align-items: start; }

.recording-card, .ai-card { display: flex; flex-direction: column; overflow: hidden; }
.card-header {
    padding: var(--s4) var(--s5); border-bottom: 1px solid var(--border);
    display: flex; justify-content: space-between; align-items: center;
    gap: var(--s3); flex-wrap: wrap;
}
.card-header.solid-bg { background: var(--surface-sunken); }
.toggle-label { font-size: 0.84rem; font-weight: 600; color: var(--text-soft); }

.monitor-area {
    padding: var(--s6) var(--s5); text-align: center; flex: 1;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    background: var(--surface-sunken);
}
.video-container {
    width: 100%; max-width: 640px; margin-bottom: var(--s4);
    border-radius: var(--r-md); overflow: hidden; background: #000;
    box-shadow: var(--shadow-lg); position: relative; aspect-ratio: 16 / 9;
}
.video-container video { width: 100%; height: 100%; object-fit: contain; display: block; }
.cam-pip {
    position: absolute; bottom: 10px; right: 10px; width: 132px;
    aspect-ratio: 16 / 9; border-radius: var(--r-sm);
    border: 2px solid #fff; box-shadow: var(--shadow-lg); z-index: 2; object-fit: cover;
}

.time-display {
    font-size: 3rem; font-weight: 300; font-variant-numeric: tabular-nums;
    letter-spacing: -0.02em; color: var(--text);
}
.rec-status {
    font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-top: 2px;
}
.rec-status.live { color: var(--danger); }
.rec-status.live::before {
    content: ""; display: inline-block; width: 7px; height: 7px;
    border-radius: 50%; background: var(--danger); margin-right: 7px;
    animation: pulse 1.4s infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.25; } }

.sound-wave-graphic { display: flex; gap: 4px; align-items: center; height: 56px; margin: var(--s4) 0; justify-content: center; }
.sound-wave-graphic .bar { width: 6px; background: var(--primary); opacity: 0.75; border-radius: 3px; height: 10px; transition: height 0.06s linear; }

.controls-area { padding: var(--s4); border-top: 1px solid var(--border); background: var(--surface); }

.btn-record {
    background: var(--danger); color: #fff; border: none;
    padding: 14px 34px; border-radius: var(--r-pill);
    font-family: inherit; font-weight: 700; font-size: 0.98rem; cursor: pointer;
    transition: 0.2s var(--ease); box-shadow: 0 6px 16px -6px rgba(220,38,38,0.6);
    display: inline-flex; align-items: center; gap: var(--s2);
}
.btn-record:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -8px rgba(220,38,38,0.7); }
.btn-record.active { background: var(--text); box-shadow: 0 6px 16px -6px rgba(15,23,42,0.5); }

.chapter-pill {
    background: var(--primary-soft); color: var(--primary-strong);
    font-size: 0.78rem; font-weight: 700; padding: 5px 11px;
    border-radius: var(--r-pill); display: inline-flex; align-items: center; gap: 6px;
}

/* Chapter markers along a timeline */
.timeline { position: relative; height: 34px; margin: var(--s4) 0 0; width: 100%; max-width: 640px; }
.timeline-track {
    position: absolute; top: 13px; left: 0; right: 0; height: 6px;
    background: var(--border); border-radius: var(--r-pill); overflow: hidden;
}
.timeline-fill { height: 100%; width: 0%; background: var(--primary); border-radius: var(--r-pill); transition: width 0.3s linear; }
.timeline-marker {
    position: absolute; top: 6px; width: 3px; height: 20px;
    background: var(--secondary); border-radius: 2px; transform: translateX(-1.5px);
    cursor: pointer;
}
.timeline-marker::after {
    content: attr(data-label);
    position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
    background: var(--text); color: #fff; font-size: 0.72rem; font-weight: 600;
    padding: 4px 8px; border-radius: 6px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity 0.16s var(--ease);
}
.timeline-marker:hover::after { opacity: 1; }

.ai-settings { flex: 1; overflow-y: auto; padding: var(--s5); }
.ai-results-area { padding: var(--s4) var(--s5); background: var(--surface-sunken); border-top: 1px solid var(--border); max-height: 340px; overflow-y: auto; }

.success-panel {
    padding: var(--s4); background: var(--success-soft);
    border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
    border-radius: var(--r-md);
}
.success-panel h4 { color: var(--success); margin-bottom: var(--s2); font-size: 0.95rem; }
.copy-field { display: flex; gap: var(--s2); }
.copy-field input {
    flex: 1; font-size: 0.8rem; padding: 9px 11px;
    border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface);
}

/* =========================================================================
   MODAL
   ========================================================================= */
.modal-overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: var(--s5);
    animation: fadeIn 0.16s var(--ease);
}
.modal-card {
    background: var(--surface); border-radius: var(--r-lg);
    padding: var(--s6); max-width: 460px; width: 100%;
    box-shadow: var(--shadow-xl); animation: popIn 0.22s var(--ease);
    max-height: 88vh; overflow-y: auto;
}
.modal-card h3 { margin-bottom: var(--s2); font-size: 1.2rem; }
.modal-card > p { font-size: 0.92rem; color: var(--text-soft); margin-bottom: var(--s5); }
.modal-actions { display: flex; gap: var(--s2); justify-content: flex-end; margin-top: var(--s5); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(0.97) translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

/* =========================================================================
   STUDENT PLAYER
   ========================================================================= */
.student-workspace {
    position: relative; z-index: 1; width: 100%; max-width: 1400px;
    margin: 0 auto; display: flex; gap: var(--s5); padding: var(--s5);
    align-items: flex-start; min-height: 100vh;
}

.player-container {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); overflow: hidden; flex: 1; min-width: 0;
    display: flex; flex-direction: column; box-shadow: var(--shadow-md);
}
.player-container:fullscreen { border-radius: 0; border: none; }
.player-container:fullscreen .video-stage { flex: 1; }
.player-container:fullscreen .main-video { max-height: none; height: 100%; }

/* The stage behind the video picks up the organisation's colours so
   playback still feels like their product, not a black void. */
.video-stage {
    position: relative;
    background:
        radial-gradient(700px 340px at 50% 0%, color-mix(in srgb, var(--primary) 26%, transparent), transparent 70%),
        linear-gradient(160deg, #0b1220, #131c2e);
    display: flex; align-items: center; justify-content: center;
    padding: var(--s3);
}
.main-video { width: 100%; display: block; background: #000; max-height: 62vh; object-fit: contain; border-radius: var(--r-sm); }

.sidebar-panel {
    width: 320px; flex-shrink: 0;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--s5);
    display: flex; flex-direction: column; gap: var(--s5);
    max-height: calc(100vh - 48px); overflow-y: auto; box-shadow: var(--shadow-sm);
}
.sidebar-panel h4 {
    font-size: 0.86rem; font-weight: 700;
    color: var(--text-soft); margin-bottom: var(--s3);
}

.caption-display {
    background: var(--surface-sunken); border-top: 1px solid var(--border);
    padding: var(--s4) var(--s5); min-height: 128px; max-height: 190px;
    overflow-y: auto; scroll-behavior: smooth;
}
.caption-history-item { font-size: 0.95rem; color: var(--text-muted); margin-bottom: var(--s2); line-height: 1.6; display: block; }
.caption-history-item.active { font-size: 1.2rem; font-weight: 600; color: var(--text); }
/* A line the transcript reads as somebody other than the teacher. Colour
   alone would not be enough, so it is labelled as well. */
.caption-history-item.is-other { color: var(--primary-strong); }
.caption-history-item.is-other.active { color: var(--primary-strong); }
.caption-who {
    display: inline-block; margin-right: 8px;
    font-size: 0.68em; font-weight: 700; vertical-align: 0.1em;
    color: #fff; background: var(--primary);
    padding: 1px 7px; border-radius: var(--r-pill);
}

.player-toolbar {
    display: flex; flex-wrap: wrap; gap: var(--s2);
    padding: var(--s3) var(--s4); background: var(--surface);
    border-bottom: 1px solid var(--border); align-items: center;
}
.player-toolbar .tool-toggle-btn {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--surface); border: 1px solid var(--border);
    color: var(--text-soft); font-family: inherit;
    font-size: 0.8rem; font-weight: 600; padding: 7px 11px;
    border-radius: var(--r-sm); cursor: pointer; transition: 0.16s var(--ease);
}
.player-toolbar .tool-toggle-btn:hover { background: var(--surface-sunken); color: var(--text); }
.player-toolbar .tool-toggle-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.speed-btn-group, .summary-toggle-group {
    display: inline-flex; background: var(--surface-sunken);
    border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; padding: 2px; gap: 1px;
}
.speed-btn-group button, .summary-toggle-group button {
    background: none; border: none; font-family: inherit;
    color: var(--text-muted); font-size: 0.78rem; font-weight: 700;
    padding: 6px 10px; cursor: pointer; border-radius: 6px; transition: 0.16s var(--ease);
}
.speed-btn-group button.active, .summary-toggle-group button.active { background: var(--primary); color: #fff; }


.student-action-bar {
    background: var(--surface); padding: var(--s4) var(--s5);
    display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid var(--border); flex-wrap: wrap; gap: var(--s3);
}
.btn-raise-hand {
    background: var(--danger); color: #fff; border: none;
    padding: 11px 22px; border-radius: var(--r-sm);
    font-family: inherit; font-size: 0.92rem; font-weight: 700; cursor: pointer;
    transition: 0.16s var(--ease); box-shadow: 0 4px 12px -4px rgba(220,38,38,0.5);
}
.btn-raise-hand:hover { background: #b91c1c; transform: translateY(-1px); }

.full-page-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: var(--bg);
    display: none; flex-direction: column; align-items: center; justify-content: center; padding: var(--s5);
}
.interaction-overlay {
    position: absolute; inset: 0; z-index: 10;
    background: rgba(15, 23, 42, 0.72); backdrop-filter: blur(5px);
    display: none; flex-direction: column; align-items: center; justify-content: center; padding: var(--s5);
}
.interaction-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--s6); width: 100%; max-width: 500px;
    text-align: center; display: flex; flex-direction: column; box-shadow: var(--shadow-xl);
}
.question-text { font-size: 1.25rem; font-weight: 700; margin-bottom: var(--s5); }
.options-grid { display: grid; gap: var(--s3); }
.option-btn {
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    padding: 13px var(--s4); font-family: inherit; font-size: 0.95rem; font-weight: 600;
    border-radius: var(--r-sm); cursor: pointer; transition: 0.16s var(--ease); text-align: left;
}
.option-btn:hover { background: var(--surface-sunken); border-color: var(--border-strong); }
.option-btn.correct { background: var(--success-soft); border-color: var(--success); color: var(--success); }
.option-btn.wrong { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }

.resource-link {
    display: flex; align-items: center; gap: var(--s2);
    padding: 10px var(--s3); background: var(--surface-sunken);
    color: var(--primary-strong); text-decoration: none;
    border-radius: var(--r-sm); font-size: 0.86rem; font-weight: 600;
    margin-bottom: var(--s2); border: 1px solid var(--border); transition: 0.16s var(--ease);
}
.resource-link:hover { background: var(--primary-soft); border-color: var(--primary); }

.resource-toast {
    position: fixed; right: var(--s5); bottom: var(--s5); max-width: 330px; z-index: 50;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: var(--s4); box-shadow: var(--shadow-xl);
    opacity: 0; transform: translateY(12px); transition: 0.24s var(--ease); pointer-events: none;
}
.resource-toast.show { opacity: 1; transform: none; pointer-events: auto; }
.resource-toast-title { font-size: 0.78rem; color: var(--primary-strong); font-weight: 700; margin-bottom: 5px; }
.resource-toast-name { font-size: 0.92rem; font-weight: 700; margin-bottom: var(--s3); }
.resource-toast-actions { display: flex; gap: var(--s2); }
.resource-toast-actions > * { flex: 1; font-size: 0.8rem; padding: 8px; }

.visual-schedule-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.visual-schedule-list li {
    display: flex; align-items: center; gap: var(--s3);
    padding: 9px var(--s3); border-radius: var(--r-sm);
    border: 1px solid var(--border); font-size: 0.86rem; color: var(--text-muted);
    transition: 0.16s var(--ease);
}
.visual-schedule-list li.done { color: var(--text); border-color: var(--success); background: var(--success-soft); }
.visual-schedule-list .tick { width: 17px; height: 17px; border-radius: 50%; border: 2px solid var(--border-strong); flex-shrink: 0; }
.visual-schedule-list li.done .tick { background: var(--success); border-color: var(--success); }

.access-denied-state { text-align: center; max-width: 440px; }
.access-denied-state h2 { margin-bottom: var(--s3); font-size: 1.5rem; }
.access-denied-state p { color: var(--text-muted); margin-bottom: var(--s5); }

/* Focus mode keeps the video, captions and the next-section control. The
   raise-hand button stays deliberately: losing the ability to ask for help
   is not what focus should mean. */
.focus-mode .sidebar-panel,
.focus-mode .non-essential,
.focus-mode .player-toolbar > *:not(#nextSectionBtn):not(#focusModeToggleBtn) { display: none !important; }
#nextSectionBtn { display: none; }
.focus-mode #nextSectionBtn { display: inline-flex; }

.dyslexia-mode, .dyslexia-mode * {
    font-family: var(--font-dyslexic) !important;
    letter-spacing: 0.02em; line-height: 1.75;
}

/* =========================================================================
   RESPONSIVE
   ========================================================================= */
/* =========================================================================
   LOADING
   Anything that waits says so with a turning ring, never with silence or a
   bare line of text.
   ========================================================================= */
.spinner {
    display: inline-block; width: 1em; height: 1em; flex-shrink: 0;
    border: 0.16em solid color-mix(in srgb, currentColor 25%, transparent);
    border-top-color: currentColor; border-radius: 50%;
    animation: spin 0.7s linear infinite;
    vertical-align: -0.13em;
}
.spinner.lg { width: 34px; height: 34px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-block {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: var(--s3); padding: var(--s6) var(--s4); text-align: center;
    color: var(--text-muted); font-size: 0.9rem;
}
.loading-block .spinner { color: var(--primary); }

/* A button that is waiting keeps its size and grows a ring, so the layout
   does not jump and the button cannot be pressed twice. */
.btn-primary.is-busy, .btn-secondary.is-busy, .btn-danger.is-busy, .btn-ghost.is-busy {
    position: relative; color: transparent !important; pointer-events: none;
}
.btn-primary.is-busy::after, .btn-secondary.is-busy::after,
.btn-danger.is-busy::after, .btn-ghost.is-busy::after {
    content: ""; position: absolute; top: 50%; left: 50%;
    width: 1em; height: 1em; margin: -0.5em 0 0 -0.5em;
    border: 0.15em solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.7s linear infinite;
}
.btn-secondary.is-busy::after, .btn-ghost.is-busy::after {
    border-color: color-mix(in srgb, var(--text) 22%, transparent); border-top-color: var(--text);
}

/* =========================================================================
   SERVICE BANNER
   Written straight into the database, so a notice can go up without a
   deploy. Nothing here is ever written from a browser.
   ========================================================================= */
.site-banner {
    position: relative; z-index: 30;
    display: flex; align-items: center; justify-content: center;
    gap: var(--s3); flex-wrap: wrap;
    padding: 11px var(--s5); font-size: 0.9rem; font-weight: 600;
    background: var(--primary-soft); color: var(--primary-strong);
    border-bottom: 1px solid color-mix(in srgb, var(--primary) 26%, transparent);
}
.site-banner.tone-warning {
    background: var(--warning-soft); color: var(--warning);
    border-bottom-color: color-mix(in srgb, var(--warning) 30%, transparent);
}
.site-banner.tone-danger {
    background: var(--danger-soft); color: var(--danger);
    border-bottom-color: color-mix(in srgb, var(--danger) 30%, transparent);
}
.site-banner.tone-success {
    background: var(--success-soft); color: var(--success);
    border-bottom-color: color-mix(in srgb, var(--success) 30%, transparent);
}
.site-banner a { color: inherit; font-weight: 700; }

/* Posted incidents, newest first */
.incident {
    border-left: 3px solid var(--border-strong);
    padding: 2px 0 2px var(--s4); margin-bottom: var(--s5);
}
.incident:last-child { margin-bottom: 0; }
.incident.state-investigating { border-left-color: var(--danger); }
.incident.state-identified { border-left-color: var(--warning); }
.incident.state-monitoring { border-left-color: var(--primary); }
.incident.state-resolved { border-left-color: var(--success); }
.incident-head {
    display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; margin-bottom: 5px;
}
.incident-head h5 { font-size: 0.98rem; }
.incident-when { font-size: 0.78rem; color: var(--text-muted); }
.incident p { font-size: 0.9rem; color: var(--text-soft); line-height: 1.65; }

/* =========================================================================
   STUDENT AREA
   ========================================================================= */
.student-shell {
    position: relative; z-index: 1;
    max-width: var(--content-max); margin: 0 auto; padding: var(--s5);
}
.student-tabs {
    display: inline-flex; gap: 2px; padding: 3px; margin-bottom: var(--s5);
    background: var(--surface-sunken); border: 1px solid var(--border);
    border-radius: var(--r-pill); flex-wrap: wrap;
}
.student-tabs button {
    font-family: inherit; font-size: 0.88rem; font-weight: 600; color: var(--text-muted);
    background: none; border: none; cursor: pointer;
    padding: 8px 18px; border-radius: var(--r-pill);
}
.student-tabs button.active { background: var(--surface); color: var(--primary-strong); box-shadow: var(--shadow-sm); }

.lesson-tile {
    display: flex; align-items: center; gap: var(--s4);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-md); padding: var(--s4);
    text-decoration: none; color: var(--text);
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}
.lesson-tile:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.lesson-tile-text { min-width: 0; flex: 1; }
.lesson-tile-text h5 { font-size: 0.98rem; margin-bottom: 2px; }
.lesson-tile-text p { font-size: 0.82rem; color: var(--text-muted); }
.lesson-tile .class-emblem { width: 40px; height: 40px; font-size: 0.82rem; }

/* =========================================================================
   CLASSROOMS
   ========================================================================= */
.class-emblem img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.class-emblem svg { width: 55%; height: 55%; }

/* Picking a class picture */
.icon-choice-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(58px, 1fr)); gap: var(--s2);
}
.icon-choice {
    display: inline-flex; align-items: center; justify-content: center;
    aspect-ratio: 1; width: 100%;
    background: var(--surface-sunken); color: var(--text-soft);
    border: 2px solid transparent; border-radius: var(--r-md);
    cursor: pointer; transition: 0.14s var(--ease);
}
.icon-choice:hover { color: var(--primary-strong); background: color-mix(in srgb, var(--primary) 12%, var(--surface-sunken)); }
.icon-choice.active {
    border-color: var(--primary); color: #fff;
    background: linear-gradient(140deg, var(--primary), var(--secondary));
}
.icon-choice:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.class-card-head { cursor: pointer; }

/* The code a student types to join. Monospaced so a 0 and an O are not
   mistaken for one another when it is read out in a lesson. */
.join-code {
    display: inline-flex; align-items: center; gap: var(--s2);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1rem; font-weight: 700; letter-spacing: 0.16em;
    background: var(--surface-sunken); border: 1px dashed var(--border-strong);
    border-radius: var(--r-sm); padding: 7px 12px; color: var(--text);
}
.join-code.lg { font-size: 1.3rem; padding: 10px 18px; }

.class-hero {
    display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-lg); padding: var(--s5); box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden; margin-bottom: var(--s5);
}
.class-hero::before {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 5px;
    background: var(--class-color, var(--primary));
}
.class-hero .class-emblem { width: 62px; height: 62px; font-size: 1.3rem; }
.class-hero-text { min-width: 0; flex: 1; }
.class-hero-text h2 { font-size: 1.5rem; margin-bottom: 2px; }
.class-hero-text p { font-size: 0.88rem; color: var(--text-muted); }

/* Who has watched what */
.watch-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: var(--s3); padding: 9px 0; border-bottom: 1px solid var(--border);
    font-size: 0.88rem;
}
.watch-row:last-child { border-bottom: none; }
.watch-row .watch-when { color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }
.watch-summary {
    font-size: 0.82rem; color: var(--text-muted);
    display: flex; align-items: center; gap: var(--s2);
}

/* =========================================================================
   COMMENTS
   What a class says under a lesson. A question, which goes privately to the
   teacher, is a different thing and lives on the action bar below.
   ========================================================================= */
.comment-panel {
    background: var(--surface); border-top: 1px solid var(--border);
    padding: var(--s5);
}
.comment-head { display: flex; align-items: baseline; gap: var(--s3); margin-bottom: var(--s4); }
.comment-head h4 { font-size: 1rem; }
.comment-head p { font-size: 0.82rem; color: var(--text-muted); }

.comment-compose { display: flex; gap: var(--s3); align-items: flex-end; margin-bottom: var(--s4); }
.comment-compose textarea {
    flex: 1; font-family: inherit; font-size: 0.92rem; line-height: 1.55;
    padding: 10px 13px; border: 1px solid var(--border); border-radius: var(--r-sm);
    background: var(--surface); color: var(--text); resize: vertical; min-height: 46px;
}
.comment-compose textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 16%, transparent);
}

.comment {
    display: flex; gap: var(--s3);
    padding: var(--s3) 0; border-top: 1px solid var(--border);
}
.comment:first-child { border-top: none; }
.comment .avatar { width: 32px; height: 32px; font-size: 0.72rem; }
.comment-body { min-width: 0; flex: 1; }
.comment-meta {
    display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap;
    font-size: 0.78rem; color: var(--text-muted); margin-bottom: 3px;
}
.comment-meta strong { font-size: 0.88rem; color: var(--text); }
.comment-body p { font-size: 0.92rem; line-height: 1.6; color: var(--text-soft); overflow-wrap: anywhere; }
.comment-remove { font-size: 0.76rem; padding: 0 4px; margin-left: auto; }

/* =========================================================================
   PLAYER TOP BAR
   ========================================================================= */
.player-topbar {
    position: relative; z-index: 2;
    width: 100%; max-width: 1400px; margin: 0 auto;
    padding: var(--s4) var(--s5) 0;
    display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
    flex-wrap: wrap;
}
.player-topbar .wordmark { font-size: 1.15rem; }
.player-topbar-actions { display: flex; align-items: center; gap: var(--s3); }
.player-who {
    display: flex; align-items: center; gap: var(--s2);
    font-size: 0.86rem; font-weight: 600; color: var(--text-soft);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--r-pill); padding: 5px 14px 5px 5px;
}
.player-who .avatar { width: 28px; height: 28px; font-size: 0.7rem; }
.player-who span { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =========================================================================
   MEDIA TRANSPORT
   The browser's own controls are replaced with a bar that matches the rest
   of the product and can carry the lesson's chapter markers.
   ========================================================================= */
.media-bar {
    display: flex; align-items: center; gap: var(--s3);
    padding: 10px var(--s4);
    background: var(--surface); border-top: 1px solid var(--border);
    flex-wrap: nowrap;
}
.media-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; flex-shrink: 0;
    border: none; border-radius: 50%; cursor: pointer;
    background: var(--surface-sunken); color: var(--text);
    transition: background 0.16s var(--ease), color 0.16s var(--ease);
}
.media-btn:hover { background: color-mix(in srgb, var(--primary) 14%, var(--surface-sunken)); color: var(--primary-strong); }
.media-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.media-btn.primary { background: var(--primary); color: #fff; width: 44px; height: 44px; }
.media-btn.primary:hover { background: var(--primary-strong); color: #fff; }

.media-time {
    font-size: 0.82rem; font-weight: 600; color: var(--text-muted);
    font-variant-numeric: tabular-nums; flex-shrink: 0; min-width: 42px; text-align: center;
}

.media-scrub {
    position: relative; flex: 1; min-width: 60px; height: 24px;
    display: flex; align-items: center; cursor: pointer; touch-action: none;
}
.media-scrub:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; border-radius: var(--r-pill); }
.media-track {
    position: relative; width: 100%; height: 6px;
    background: var(--surface-sunken); border-radius: var(--r-pill); overflow: hidden;
}
.media-buffered {
    position: absolute; inset: 0 auto 0 0; width: 0;
    background: color-mix(in srgb, var(--text) 12%, transparent);
}
.media-played {
    position: absolute; inset: 0 auto 0 0; width: 0;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}
.media-handle {
    position: absolute; top: 50%; left: 0; width: 14px; height: 14px;
    margin: -7px 0 0 -7px; border-radius: 50%;
    background: var(--surface); border: 3px solid var(--primary);
    box-shadow: var(--shadow-sm); pointer-events: none;
    transform: scale(0.86); transition: transform 0.14s var(--ease);
}
.media-scrub:hover .media-handle, .media-scrub.is-dragging .media-handle { transform: scale(1); }

/* Chapter markers sit on the same track a teacher dropped them on. */
.media-chapter {
    position: absolute; top: 0; bottom: 0; width: 2px;
    background: color-mix(in srgb, var(--text) 45%, transparent);
    pointer-events: none;
}

.media-volume-wrap { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.media-volume {
    width: 78px; height: 6px; -webkit-appearance: none; appearance: none;
    background: var(--surface-sunken); border-radius: var(--r-pill); cursor: pointer;
}
.media-volume::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 13px; height: 13px; border-radius: 50%;
    background: var(--primary); border: 2px solid var(--surface); box-shadow: var(--shadow-sm);
}
.media-volume::-moz-range-thumb {
    width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--surface);
    background: var(--primary); box-shadow: var(--shadow-sm);
}

@media (max-width: 620px) {
    .media-volume-wrap { display: none; }
    .media-bar { gap: var(--s2); padding: 9px var(--s3); }
}

/* =========================================================================
   DUAL SOURCE AND AUDIO-ONLY PLAYBACK
   ========================================================================= */

/* Screen and camera recorded together are shown together, the camera inset
   into the corner of the screen rather than hidden behind a switcher. */
.video-stage.dual .main-video.is-inset {
    position: absolute; right: 3.2%; bottom: 4.5%;
    width: 25%; min-width: 132px; max-height: none;
    border: 2px solid rgba(255, 255, 255, 0.85);
    border-radius: var(--r-sm); box-shadow: var(--shadow-xl);
    z-index: 3; background: #000;
}
.video-stage.dual.inset-hidden .main-video.is-inset { display: none; }
.dual-controls {
    position: absolute; top: var(--s3); right: var(--s3); z-index: 4;
    display: flex; gap: 6px;
}
.dual-controls button {
    font-family: inherit; font-size: 0.76rem; font-weight: 700;
    color: #fff; background: rgba(15, 23, 42, 0.66);
    border: 1px solid rgba(255, 255, 255, 0.28); border-radius: var(--r-pill);
    padding: 6px 13px; cursor: pointer; backdrop-filter: blur(6px);
}
.dual-controls button:hover { background: rgba(15, 23, 42, 0.85); }

/* A voice-only lesson gets a branded panel instead of a black rectangle. */
.audio-stage {
    width: 100%; padding: var(--s7) var(--s5) var(--s5);
    display: flex; flex-direction: column; align-items: center; gap: var(--s5);
    text-align: center;
}
.audio-stage-mark {
    width: 84px; height: 84px; border-radius: var(--r-lg);
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.22);
    overflow: hidden;
}
.audio-stage-mark img { width: 100%; height: 100%; object-fit: contain; padding: 10px; }
.audio-stage h3 { color: #fff; font-size: 1.2rem; }
.audio-stage p { color: rgba(255, 255, 255, 0.72); font-size: 0.88rem; margin-top: 4px; }
/* The transport bar under the stage drives it, so the element itself is
   only there to hold the sound. */
.audio-stage audio { display: none; }

@media (max-width: 1080px) {
    .studio-grid { grid-template-columns: 1fr; }
    .hero { grid-template-columns: 1fr; gap: var(--s6); }
    .student-workspace { flex-direction: column; }
    .sidebar-panel { width: 100%; max-height: none; }
}

@media (max-width: 900px) {
    .mobile-bar { display: flex; }

    .sidebar {
        position: fixed; top: 0; bottom: 0; left: 0; z-index: 60;
        width: min(84vw, 300px); height: 100dvh;
        transform: translateX(-100%);
        transition: transform 0.28s var(--ease);
        background: var(--surface); box-shadow: var(--shadow-xl);
    }
    .sidebar.open { transform: none; }

    .dashboard-layout { flex-direction: column; }
    .main-workspace { padding: var(--s4) var(--s4) var(--s7); }

    .settings-layout { grid-template-columns: 1fr; }
    .settings-nav {
        position: static; flex-direction: row; overflow-x: auto;
        gap: var(--s2); padding-bottom: var(--s2); margin-bottom: var(--s4);
        border-bottom: 1px solid var(--border);
    }
    .settings-nav button { white-space: nowrap; }

    .library-layout { grid-template-columns: 1fr; }
    .folder-list { flex-direction: row; overflow-x: auto; gap: var(--s2); }
    .folder-item { white-space: nowrap; }
    .desktop-only { display: none; }

    .site-footer-inner { grid-template-columns: 1fr; gap: var(--s5); }
    .site-nav { display: none; }

    .setting-row { flex-direction: column; align-items: stretch; gap: var(--s3); }
    .setting-row-control { width: 100%; }
    .setting-row-control .modern-select, .setting-row-control select { width: 100%; }
    /* A toggle stays on its own line, left-aligned, rather than stretching. */
    .setting-row-control:has(.switch), .setting-row-control:has(.tri-toggle) { width: auto; align-self: flex-start; }

    .top-header { align-items: flex-start; }
    .student-workspace { padding: var(--s3); }
    .student-action-bar { flex-direction: column; align-items: stretch; }
    .btn-raise-hand { width: 100%; }
    .modal-card { padding: var(--s5); }
    .time-display { font-size: 2.4rem; }
}

@media (max-width: 560px) {
    .action-group { width: 100%; }
    .action-group > * { flex: 1; }
    .lesson-grid, .class-grid { grid-template-columns: 1fr; }
    .card-actions { flex-wrap: wrap; }
}

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

@media print { .sidebar, .mobile-bar, .site-header, .site-footer { display: none !important; } }
