@font-face {
    font-family: "DM Sans";
    src: url("images/fonts/dm-sans.ttf") format("truetype");
    font-weight: 100 1000;
    font-display: swap;
}
:root {
    color-scheme: dark;
    --ground: #05131f;
    --paper: #0a1b2a;
    --subtle: #102638;
    --ink: #fff;
    --quiet: #adbdcb;
    --line: #263e51;
    --accent: #0088ff;
    --accent-hover: #58b2ff;
    --accent-surface: #102d47;
    --success: #79e2ad;
    --success-bg: #0c2f27;
    --error: #ffb7b7;
    --error-bg: #37212a;
    --heading: "DM Sans", system-ui, sans-serif;
    --sans: "DM Sans", system-ui, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
    accent-color: var(--accent);
}
*, *::before, *::after { box-sizing: border-box; }
html { min-width: 280px; scrollbar-gutter: stable; }
.app-frame { min-height: 100vh; background: var(--ground); color: var(--ink); overflow-x: clip; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 1rem/1.55 var(--sans); }
button, input, select, textarea { font: inherit; }
a { color: var(--accent); text-underline-offset: .2em; }
button, .btn, .button { cursor: pointer; }
button:disabled, .btn[aria-disabled=true] { cursor: not-allowed; opacity: .52; }
img, video, audio, iframe { max-width: 100%; }
img { display: block; }
h1, h2, h3, h4, p, figure { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
h1, h2 { font-family: var(--heading); font-weight: 650; line-height: 1.1; letter-spacing: -.045em; }
h1 { font-size: clamp(2.15rem, 4vw, 3.4rem); }
h2 { font-size: clamp(1.55rem, 2.65vw, 2.15rem); }
h3 { font-size: 1.22rem; font-weight: 650; letter-spacing: -.03em; line-height: 1.25; }
h4 { font-size: 1rem; font-weight: 650; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
h1[tabindex="-1"]:focus { outline: none; }
::selection { background: #99d3ff; color: #05131f; }
.shell, .container { width: min(1240px, calc(100% - 8vw)); margin-inline: auto; }
main.shell, main.container { padding-block: clamp(1.6rem, 3vw, 3rem) 5rem; }
.site-header { border-bottom: 1px solid var(--line); background: var(--ground); }
.navbar { display: flex; align-items: center; gap: clamp(1rem, 3vw, 3.5rem); min-height: 64px; }
.navbar nav, .nav-actions, .actions, .row, .toolbar, .filters {
    display: flex; align-items: center; gap: .7rem; flex-wrap: wrap;
}
.navbar nav { gap: clamp(.8rem, 2vw, 2rem); }
.nav-actions { margin-inline-start: auto; }
.navbar nav a, .nav-actions > a:not(.btn,.button) {
    color: var(--quiet); text-decoration: none; font-size: .91rem; font-weight: 570;
}
.navbar nav a:hover, .navbar nav a.active, .nav-actions > a:hover { color: var(--accent); }
.brand {
    display: inline-flex; align-items: center; gap: .6rem; color: var(--ink);
    font: 720 1.63rem/1 var(--sans); letter-spacing: -.055em; text-decoration: none;
}
.brand-mark {
    display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 auto;
    background: var(--accent); color: var(--ground); font: 800 1.1rem/1 var(--mono);
}
.btn, .button, button {
    display: inline-flex; align-items: center; justify-content: center; gap: .48rem;
    min-height: 40px; padding: .55rem .95rem; border: 1px solid var(--line); background: var(--paper); color: var(--ink); text-decoration: none; font: 600 .9rem/1.25 var(--sans);
    transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover, .button:hover, button:hover:enabled { background: var(--subtle); border-color: var(--quiet); }
.btn.primary, .button.primary, button.primary, .btn-primary, button[type=submit]:not(.secondary,.danger,.ghost) {
    color: var(--ground); background: var(--accent); border-color: var(--accent);
}
.btn.primary:hover, .button.primary:hover, button.primary:hover:enabled, .btn-primary:hover,
button[type=submit]:not(.secondary,.danger,.ghost):hover:enabled {
    background: var(--accent-hover); color: var(--ground); border-color: var(--accent-hover);
}
.btn.secondary, .btn-secondary { background: var(--paper); color: var(--ink); }
.btn.ghost, button.ghost { border-color: transparent; background: transparent; color: var(--accent); }
button.danger, .btn.danger { color: var(--error); }
.btn svg, button svg { width: 17px; height: 17px; }
.icon-button { width: 40px; padding: 0; }
.hero {
    position: relative; isolation: isolate;
    display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    align-items: center; gap: clamp(1.75rem, 5vw, 5rem);
    min-height: clamp(26rem, 62vh, 40rem);
    padding-block: clamp(2rem, 6vw, 5.25rem);
}
.hero-copy { position: relative; display: grid; justify-items: start; gap: 1.6rem; }
/* Darkens the tiles directly behind the headline so the white text keeps its contrast. */
.hero-copy::before {
    content: ""; position: absolute; inset: -30% -25%; z-index: -1; pointer-events: none;
    background: radial-gradient(closest-side, rgb(5 19 31 / .88), rgb(5 19 31 / .55) 60%, transparent);
}

/* Frosted tile field (tiles built by hero-tiles.js). Full-bleed: .app-frame clips the 100vw overflow. */
.hero-tiles {
    --tile: 64px; --gap: 8px;
    position: absolute; inset: 0 calc(50% - 50vw); z-index: -1; overflow: hidden; pointer-events: none;
    display: grid; grid-template-columns: repeat(var(--cols, 1), var(--tile)); grid-auto-rows: var(--tile);
    gap: var(--gap); justify-content: center; align-content: center;
    background:
        radial-gradient(42rem 26rem at 72% 45%, rgb(0 136 255 / .22), transparent 70%),
        radial-gradient(30rem 22rem at 18% 70%, rgb(88 178 255 / .12), transparent 70%);
    mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 80%, transparent);
}
.hero-tiles i {
    display: block; border-radius: 6px;
    background: linear-gradient(145deg, rgb(255 255 255 / .075), rgb(255 255 255 / .02));
    border: 1px solid rgb(255 255 255 / .07);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .08);
    animation: tile-wave 6s ease-in-out infinite;
    animation-delay: calc(var(--d, 0) * -.14s);
    transition: opacity .25s ease, scale .25s ease;
}
.hero-tiles i[data-gone] { opacity: 0; scale: .85; }
.hero-tiles[data-paused] i { animation-play-state: paused; }
@keyframes tile-wave {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-7px) scale(1.035); }
}

/* "Pause, then write" demo. Base styles are the paused end state (shown when motion is reduced);
   the keyframes share one 6.5s timeline so the cursor, button and caret stay in sync. */
.hero-demo { --demo: 6.5s; position: relative; justify-self: center; width: min(100%, 26rem); aspect-ratio: 4 / 3; }
.demo-panel {
    position: absolute; inset: 0; border-radius: 14px;
    background: linear-gradient(145deg, rgb(255 255 255 / .09), rgb(255 255 255 / .025)), rgb(10 27 42 / .7);
    border: 1px solid rgb(255 255 255 / .1);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / .1), 0 24px 60px rgb(0 0 0 / .35);
    /* Real frost here: one blurred layer over the moving tiles is cheap, unlike blurring every tile. */
    backdrop-filter: blur(14px) saturate(1.2);
}
.demo-track { position: absolute; top: 18%; left: 12%; right: 12%; height: 4px; border-radius: 2px; background: rgb(255 255 255 / .12); overflow: hidden; }
.demo-progress { position: absolute; inset: 0; background: var(--accent); transform-origin: left; transform: scaleX(.46); animation: demo-progress var(--demo) linear infinite; }
.demo-button {
    position: absolute; top: 42%; left: 50%; width: 56px; height: 56px; translate: -50% -50%;
    display: grid; place-items: center; border-radius: 50%;
    background: var(--accent); box-shadow: 0 8px 24px rgb(0 136 255 / .35);
    animation: demo-press var(--demo) ease infinite;
}
.demo-pause, .demo-play { grid-area: 1 / 1; }
.demo-pause { width: 14px; height: 18px; border-inline: 5px solid var(--ground); opacity: 0; animation: demo-pause-icon var(--demo) step-end infinite; }
.demo-play { width: 0; height: 0; margin-left: 4px; border-block: 9px solid transparent; border-inline-start: 15px solid var(--ground); animation: demo-play-icon var(--demo) step-end infinite; }
.demo-ripple { grid-area: 1 / 1; width: 100%; height: 100%; border-radius: 50%; border: 2px solid var(--accent-hover); opacity: 0; animation: demo-ripple var(--demo) ease-out infinite; }
.demo-answer {
    position: absolute; top: 70%; left: 16%; right: 16%; height: 2.6rem; border-radius: 8px;
    border: 1px solid var(--accent); background: rgb(5 19 31 / .7);
    animation: demo-answer var(--demo) step-end infinite;
}
.demo-caret {
    position: absolute; left: 14px; top: 50%; width: 2px; height: 1.2rem; translate: 0 -50%; background: var(--ink);
    animation: demo-caret-window var(--demo) step-end infinite, demo-blink 1s steps(1) infinite;
}
.demo-cursor {
    position: absolute; left: calc(16% + 24px); top: calc(70% + 1.3rem - 14px); width: 28px; height: 28px;
    filter: drop-shadow(0 2px 3px rgb(0 0 0 / .5));
    animation: demo-cursor var(--demo) ease-in-out infinite;
}
.demo-cursor svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.cursor-arrow { fill: var(--ink); stroke: var(--ground); stroke-width: 1.3; stroke-linejoin: round; opacity: 0; animation: demo-arrow var(--demo) ease infinite; }
.cursor-ibeam { fill: none; stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; animation: demo-ibeam var(--demo) ease infinite; }

@keyframes demo-cursor {
    0% { left: 90%; top: 96%; opacity: 0; scale: 1; }
    6% { left: 88%; top: 92%; opacity: 1; scale: 1; }
    30%, 31% { left: calc(50% - 6px); top: calc(42% - 4px); scale: 1; }
    33% { scale: .82; }
    36% { left: calc(50% - 6px); top: calc(42% - 4px); scale: 1; }
    48%, 88% { left: calc(16% + 24px); top: calc(70% + 1.3rem - 14px); opacity: 1; }
    95%, 100% { left: calc(16% + 24px); top: calc(70% + 1.3rem - 14px); opacity: 0; }
}
@keyframes demo-arrow {
    0%, 40% { opacity: 1; scale: 1; }
    47%, 97% { opacity: 0; scale: .6; }
    100% { opacity: 1; scale: 1; }
}
@keyframes demo-ibeam {
    0%, 40% { opacity: 0; scale: .6; }
    47%, 97% { opacity: 1; scale: 1; }
    100% { opacity: 0; scale: .6; }
}
@keyframes demo-press {
    0%, 31%, 37%, 100% { scale: 1; }
    33% { scale: .9; }
}
@keyframes demo-ripple {
    0%, 32% { opacity: 0; scale: .6; }
    33% { opacity: .7; scale: .8; }
    46%, 100% { opacity: 0; scale: 1.9; }
}
@keyframes demo-pause-icon { 0% { opacity: 1; } 33% { opacity: 0; } 97% { opacity: 1; } }
@keyframes demo-play-icon { 0% { opacity: 0; } 33% { opacity: 1; } 97% { opacity: 0; } }
@keyframes demo-progress {
    0% { transform: scaleX(0); }
    33%, 94% { transform: scaleX(.46); }
    100% { transform: scaleX(0); }
}
@keyframes demo-answer { 0% { border-color: var(--line); } 47% { border-color: var(--accent); } 94% { border-color: var(--line); } }
@keyframes demo-caret-window { 0% { visibility: hidden; } 49% { visibility: visible; } 90% { visibility: hidden; } }
@keyframes demo-blink { 0% { opacity: 1; } 50% { opacity: 0; } }
.eyebrow, .kicker { font: 550 .75rem/1.3 var(--mono); text-transform: uppercase; letter-spacing: .07em; color: var(--accent-hover); }
.hero h1 { font-size: clamp(2.9rem, 5.8vw, 5.5rem); line-height: 1.02; font-weight: 640; letter-spacing: -.05em; }
.hero h1 span { color: var(--accent-hover); }
.lead, .lede { max-width: 53ch; color: var(--quiet); font-size: clamp(1rem, 1.3vw, 1.13rem); }
.hero .actions { margin-top: .4rem; }
.section-heading, .section-header, .page-heading {
    display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 1rem;
}
.section-heading, .section-header { margin-block: clamp(2.15rem, 4vw, 3.75rem) 1.35rem; }
.page-heading { margin-bottom: clamp(1.5rem, 3vw, 2.5rem); }
.section-heading p, .section-header p, .page-heading p { margin-top: .5rem; color: var(--quiet); }
.section-heading > a { font-size: .94rem; font-weight: 600; }
.course-grid, .card-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(min(100%, 305px),1fr)); gap: 1.25rem; }
.course-card, .card, .panel, .metric, .auth-card {
    border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
.course-card { display: flex; flex-direction: column; overflow: hidden; text-decoration: none; }
a.course-card:hover, .course-card:focus-within { border-color: var(--accent); }
.card-body, .panel, .card, .auth-card, .metric { padding: clamp(1.1rem, 2.2vw, 1.75rem); }
.card-body, .stack { display: flex; flex-direction: column; align-items: stretch; gap: .85rem; }
.card-body h3 { font-size: 1.35rem; }
.card-body p, .muted, .hint, small { color: var(--quiet); }
.card-body > .actions { margin-top: auto; }
.meta { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; color: var(--quiet); font-size: .85rem; }
.chip, .badge, .tag { display: inline-flex; align-items: center; gap: .35rem; width: fit-content; padding: .2rem .65rem; background: var(--accent-surface); color: var(--accent-hover); font-size: .76rem; font-weight: 650; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,150px),1fr)); gap: .8rem; }
.metric { display: flex; flex-direction: column; align-items: start; gap: .5rem; }
.metric strong { font: 600 2.35rem/1 var(--heading); color: var(--accent-hover); }
.metric small, .metric span { color: var(--quiet); }
.panel + .panel, .panel + .table-wrap { margin-top: 1rem; }
.panel > h2, .panel > h3, .auth-card > h1 { margin-bottom: .9rem; }
.panel h2 { font-size: 2.15rem; }
.workspace { display: grid; grid-template-columns: minmax(160px,.75fr) minmax(0,2.6fr) minmax(200px,1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); overflow: clip; }
.workspace:has(> :last-child:nth-child(2)) { grid-template-columns: minmax(165px,.75fr) minmax(0,3fr); }
.workspace > * { min-width: 0; background: var(--paper); }
.document-list, .document-pane, .learning-panel { padding: clamp(.8rem, 1.5vw, 1.6rem); }
.document-list, .learning-panel, .document-sidebar { background: var(--ground); }
.document-sidebar > details, .document-tools { margin: 0 clamp(.8rem, 1.5vw, 1.6rem) 1rem; }
.workspace + .transport, .transport + .workspace, .transport + .actions { margin-top: 1rem; }
.document-list h3, .learning-panel h3 { margin-block: .35rem .8rem; }
.document-list details { margin-bottom: .8rem; }
.document-list summary { cursor: pointer; color: var(--quiet); font-weight: 650; font-size: .88rem; }
.document-list button { display: flex; justify-content: start; width: 100%; text-align: start; overflow-wrap: anywhere; }
.document-list button.active, .document-list button[aria-current=true] { background: var(--accent-surface); border-color: var(--accent); color: var(--accent-hover); }
.document-pane { min-height: 345px; }
.document-pane textarea { min-height: 18rem; }
.document-pane video, .document-pane audio { width: 100%; }
.document-pane iframe { border: 0; background: var(--subtle); width: 100%; min-height: 25rem; }
.document-pane pre, .prose { white-space: pre-wrap; overflow-wrap: anywhere; }
.transport { display: flex; align-items: center; flex-wrap: wrap; gap: .72rem; padding: .8rem 1rem; background: var(--paper); border: 1px solid var(--line); }
.transport input[type=range] { min-width: 90px; flex: 1; }
.transport time { font-variant-numeric: tabular-nums; }
.transport select { width: auto; }
.auth-card { width: min(100%, 445px); margin: clamp(1rem,7vh,5rem) auto; }
.auth-card h1 { font-size: 3rem; }
.auth-card form, form.stack { display: grid; gap: 1rem; }
.auth-card > p { margin-block: 1rem; }
.field, label:has(> input:not([type=radio],[type=checkbox]), > textarea, > select, > .test-paper) { display: grid; gap: .35rem; }
label, legend { font-size: .91rem; font-weight: 600; }
input:not([type=checkbox],[type=radio],[type=range],[type=file],[type=hidden],[type=submit]), select, textarea {
    width: 100%; max-width: 100%; min-width: 0; min-height: 40px; padding: .58rem .75rem;
    border: 1px solid var(--line); background: var(--paper); color: var(--ink);
}
input[type=file] { max-width: 100%; }
input[type=file]::file-selector-button { padding: .52rem .75rem; margin-right: .5rem; color: var(--accent-hover); background: var(--accent-surface); border: 0; font: inherit; }
input[type=range] { padding-inline: 0; }
textarea { resize: vertical; min-height: 5.5rem; }
input::placeholder, textarea::placeholder { color: var(--quiet); opacity: .84; }
fieldset { min-width: 0; border: 1px solid var(--line); }
hr { width: 100%; border: 0; border-top: 1px solid var(--line); }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: var(--paper); }
table { width: 100%; text-align: start; border-collapse: collapse; font-size: .93rem; }
th, td { padding: .75rem .95rem; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
th { font-size: .82rem; color: var(--quiet); background: var(--subtle); }
tr:last-child td { border-bottom: 0; }
.notice, .alert, .toast, .empty-state { padding: .85rem 1rem; border: 1px solid var(--line); background: var(--subtle); }
.notice.success, .success { color: var(--success); background: var(--success-bg); }
.error, .validation-message, .validation-errors { color: var(--error); }
.notice.error, .alert-danger { border-color: var(--error); background: var(--error-bg); }
.empty-state { padding: 2rem; color: var(--quiet); }
progress { max-width: 100%; accent-color: var(--accent); }
footer { color: var(--quiet); font-size: .87rem; border-top: 1px solid var(--line); padding-block: 1.5rem; }
.skip-link { position: absolute; top: .5rem; left: .5rem; transform: translateY(-200%); z-index: 30; }
.skip-link:focus-visible { transform: none; background: var(--paper); padding: .5rem .8rem; }
#blazor-error-ui { display: none; position: fixed; inset: auto 0 0; z-index: 100; padding: .8rem 1.2rem; color: var(--error); background: var(--error-bg); }
@media (max-width: 850px) {
    .workspace { grid-template-columns: minmax(145px,.8fr) minmax(0,2fr); }
    .workspace .learning-panel { grid-column: 1/-1; }
    .navbar { flex-wrap: wrap; gap: 1rem; padding-block: .85rem; }
}
@media (max-width: 650px) {
    .shell, .container { width: calc(100% - 2rem); }
    .navbar { min-height: 64px; }
    .navbar nav { order: 2; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: .2rem; }
    .navbar nav a { white-space: nowrap; }
    .brand { font-size: 1.45rem; }
    .hero { grid-template-columns: 1fr; }
    .hero h1 { font-size: clamp(3rem, 12vw, 4.5rem); }
    .hero-tiles { --tile: 44px; --gap: 6px; }
    .hero-demo { width: min(100%, 20rem); }
    .workspace, .workspace:has(> :last-child:nth-child(2)) { grid-template-columns: minmax(0, 1fr); }
    .document-pane { min-height: 220px; }
    .document-pane textarea { min-height: 12rem; }
    .section-heading, .page-heading { align-items: start; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
    /* A near-zero duration on an infinite loop strobes; show the hero's static end state instead. */
    .hero-tiles *, .hero-demo * { animation: none !important; }
}

.workspace-loading { margin: clamp(2rem, 8vw, 7rem) auto; text-align: center; color: var(--quiet); }
body:has(main) > .workspace-loading { display: none; }

.lesson-identity { flex: 1 1 12rem; min-width: 0; }
.lesson-identity h1 { font-size: clamp(1.15rem, 2vw, 1.75rem); overflow-wrap: anywhere; }
.lesson-identity a, .lesson-identity small { font-size: .8rem; }
.lesson-identity small { color: var(--quiet); }
.lesson-player { --lesson-height: clamp(22rem, calc(100dvh - 26rem), 48rem); display: flex; flex-direction: column; background: var(--ground); border: 1px solid var(--line); }
.lesson-player > audio { display: none; }
.lesson-player-header {
    display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; padding: .5rem .8rem;
    min-height: 56px; border-bottom: 1px solid var(--line); background: var(--paper);
}
.lesson-status { display: flex; align-items: center; gap: .5rem; color: var(--quiet); font-size: .85rem; }
.status-light { width: 7px; height: 7px; background: var(--quiet); }
.status-light.live { background: var(--accent); }
.lesson-follow, .lesson-checking { font-size: .83rem; }
.lesson-checking { color: var(--quiet); }
button.lesson-submit, button.lesson-submit:hover:enabled {
    border-color: #57d68c; color: #071b12; background: #57d68c;
}
button.lesson-submit:hover:enabled { background: #7ae6a7; }

.lesson-workspace { flex: 1; display: grid; grid-template-columns: minmax(10rem, 17%) minmax(0, 1fr); min-height: 0; }
.lesson-documents { border-inline-end: 1px solid var(--line); background: var(--ground); overflow: auto; }
.document-list-compact { padding: .85rem .65rem; }
.document-list-compact h3 { font-size: .88rem; margin: .15rem .35rem .55rem; }
.document-list .document-picker { display: none; }
.document-count { font-weight: 400; }
.document-list-items { display: grid; gap: .2rem; margin-top: .35rem; }
.document-list-compact summary { font-size: .78rem; padding: .35rem; }
.document-list-compact details { margin-bottom: .8rem; }
.document-list-compact .badge { padding: 0; flex-shrink: 0; min-width: 2.45rem; background: none; font: 600 .7rem/1 var(--mono); }
.document-list-compact button { border-color: transparent; background: none; font-size: .82rem; padding-inline: .45rem; }
.document-list-compact button:hover:enabled { border-color: var(--line); }
.document-list-compact button.active { border-color: var(--line); border-inline-start-color: var(--accent); color: var(--ink); }
.lesson-stage { position: relative; min-width: 0; min-height: 0; display: flex; background: var(--paper); }
.lesson-canvas {
    flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain;
    height: var(--lesson-height);
}
.lesson-canvas:focus-visible { outline-offset: -3px; }
.lesson-document { border: 0; margin: 0; padding: 0; flex: 1; min-width: 0; order: 0; }
.lesson-document .document-pane { padding: clamp(.9rem, 2.2vw, 1.65rem); display: grid; gap: .9rem; min-height: 0; }
.lesson-document .document-pane h3 { font-size: 1.04rem; }
.lesson-document .document-pane iframe { height: 46vh; min-height: 17rem; }
.lesson-document .document-pane video { max-height: 46vh; background: #020a11; }
.lesson-document.media-dock {
    order: 1; flex: 0 0 auto; position: sticky; bottom: 0; align-self: end;
    width: min(19rem, 100%); border: 1px solid var(--line); background: var(--ground);
}
.media-dock .document-pane { gap: .35rem; padding: .65rem; }
.media-dock .document-pane h3 { font-size: .85rem; }
.media-dock .document-pane video { max-height: 10rem; }
.media-dock .document-pane small { display: none; }
.student-notebook { display: grid; gap: .75rem; }
.student-notebook textarea { width: 100%; line-height: 1.7; }
.student-notebook .lesson-submit { justify-self: start; }
.lesson-feedback {
    position: absolute; z-index: 3; top: .65rem; right: .65rem; width: min(23rem, calc(100% - 1.3rem));
    max-height: calc(100% - 1.3rem); overflow: auto; padding: .8rem; background: var(--ground);
    border: 1px solid var(--line); border-top: 2px solid var(--success);
    box-shadow: 0 8px 20px #0005; display: grid; gap: .5rem;
}
.graded-edits { margin: .25rem 0; padding-inline-start: 1.4rem; overflow-wrap: anywhere; }
.graded-edits span { white-space: nowrap; }
.graded-edits small { display: block; }
.feedback-heading { display: flex; justify-content: space-between; align-items: center; gap: .5rem; font-weight: 650; font-size: .88rem; }
.feedback-heading button { width: 30px; min-height: 30px; flex-shrink: 0; }
.lesson-feedback strong { color: var(--success); }
.lesson-feedback [role=status] p, .lesson-feedback summary { font-size: .88rem; }
.lesson-feedback summary { cursor: pointer; color: var(--accent-hover); }
.lesson-feedback details .panel { border: 0; padding: .6rem 0 0; background: transparent; }
.lesson-transport { border-top: 1px solid var(--line); padding: .3rem .8rem .55rem; background: var(--paper); }
.lesson-transport > input { display: block; width: 100%; height: 1rem; margin: 0 0 .35rem; }
.lesson-transport-row, .lesson-transport-end { display: flex; align-items: center; gap: .65rem; }
.lesson-transport-row > time { color: var(--quiet); font: .76rem/1.2 var(--mono); white-space: nowrap; }
.lesson-transport-end { margin-inline-start: auto; }
.lesson-transport-end select { width: auto; }
.play-control { min-width: 5.45rem; color: var(--ink); }
.play-icon { width: 0; height: 0; border-block: 5px solid transparent; border-inline-start: 8px solid var(--accent-hover); }
.pause-icon { width: 9px; height: 11px; border-inline: 3px solid var(--accent-hover); }
.transport-menu { position: relative; }
.transport-menu > summary { cursor: pointer; padding: .45rem .2rem; color: var(--quiet); font-size: .83rem; }
.transport-popover {
    display: grid; gap: .35rem; position: absolute; z-index: 5; bottom: calc(100% + .25rem);
    padding: .55rem; min-width: 12rem; max-width: min(22rem, 75vw); background: var(--ground); border: 1px solid var(--line);
}
.transport-popover button { justify-content: start; text-align: start; }
.volume-control .transport-popover { right: 0; }
.fullscreen-icon {
    display: block; width: 15px; height: 15px; background:
        linear-gradient(var(--ink), var(--ink)) top left / 5px 1px,
        linear-gradient(var(--ink), var(--ink)) top left / 1px 5px,
        linear-gradient(var(--ink), var(--ink)) top right / 5px 1px,
        linear-gradient(var(--ink), var(--ink)) top right / 1px 5px,
        linear-gradient(var(--ink), var(--ink)) bottom left / 5px 1px,
        linear-gradient(var(--ink), var(--ink)) bottom left / 1px 5px,
        linear-gradient(var(--ink), var(--ink)) bottom right / 5px 1px,
        linear-gradient(var(--ink), var(--ink)) bottom right / 1px 5px;
    background-repeat: no-repeat;
}
.lesson-player:fullscreen, .lesson-player[data-expanded] { width: 100%; height: 100dvh; border: 0; }
html:has(.lesson-player[data-expanded]) { overflow: hidden; scrollbar-gutter: auto; }
.app-frame:has(.lesson-player[data-expanded]) > :is(header, footer, .skip-link) { display: none; }
.lesson-player[data-expanded] { position: fixed; inset: 0; z-index: 30; }
.lesson-player:is(:fullscreen, [data-expanded]) .lesson-canvas { height: auto; }

@media (min-width: 651px) {
    .lesson-player:is(:fullscreen, [data-expanded]) .lesson-document:has(iframe) .document-pane {
        display: flex; flex-direction: column; height: 100%;
    }
    .lesson-player:is(:fullscreen, [data-expanded]) .document-pane iframe {
        flex: 1; min-height: 12rem; resize: none;
    }
}
@media (max-width: 650px) {
    .lesson-workspace { display: flex; flex-direction: column; overflow: auto; }
    .lesson-documents { border-inline-end: 0; border-bottom: 1px solid var(--line); overflow: visible; }
    .document-list-compact { padding: .5rem .8rem; }
    .document-list-compact .document-groups { display: none; }
    .document-list-compact .document-picker { display: flex; align-items: center; gap: .65rem; }
    .document-picker select { min-width: 0; flex: 1; }
    .lesson-stage { flex: 1 0 auto; }
    .lesson-canvas { height: 21rem; }
    .lesson-player:is(:fullscreen, [data-expanded]) .lesson-stage { min-height: 18rem; }
    .lesson-transport-row { flex-wrap: wrap; gap: .35rem .55rem; }
    .lesson-transport-end { gap: .35rem; }
    .lesson-transport-end > select { padding-inline: .3rem; }
    .transport-popover { inset-inline-start: auto; inset-inline-end: 0; }
}

/* Shared helpers */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.row.between { justify-content: space-between; }
.badge.private { background: var(--subtle); color: var(--quiet); border: 1px dashed var(--line); font-weight: 600; }

/* Course workspace */
.module .lesson-row { padding-block: .35rem; border-bottom: 1px solid var(--line); }
.new-lesson { padding: 1rem; border: 1px solid var(--accent); background: var(--ground); }

/* Recording studio */
.breadcrumbs { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; color: var(--quiet); font-size: .9rem; }
.studio-heading { margin-block: .6rem 1rem; }
.studio-state { padding: .4rem .8rem; border: 1px solid var(--line); background: var(--paper); color: var(--quiet); font-weight: 600; font-size: .9rem; }
.studio-state.live { color: var(--ink); border-color: var(--error); }
.transport.sticky { position: sticky; top: 0; z-index: 10; box-shadow: 0 6px 16px #0007; }
.transport time { font: 600 1.15rem/1 var(--mono); min-width: 4.5ch; }
.transport-note { flex-basis: 100%; color: var(--quiet); }
.transport-end { margin-inline-start: auto; }
.rec-dot { display: inline-block; width: .65rem; height: .65rem; border-radius: 50%; background: #ff5d5d; }
.mic-state .rec-dot { background: var(--quiet); }
.mic-state .rec-dot.on { background: #ff5d5d; }
.mic-state { display: inline-flex; align-items: center; gap: .45rem; font-weight: 650; }
.pause-glyph { width: 9px; height: 11px; border-inline: 3px solid currentColor; }
.stop-glyph { width: 10px; height: 10px; background: currentColor; }
button.stop { border-color: var(--error); color: var(--error); }
.start-options h2 { margin-bottom: 1rem; }
.start-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 1.5rem; }
.start-grid > .stack { align-content: start; padding: 1rem; border: 1px solid var(--line); background: var(--ground); }
.sidebar-actions { display: grid; gap: .6rem; margin: 0 clamp(.8rem, 1.5vw, 1.6rem) 1rem; }
.studio-workspace .board-column { display: flex; flex-direction: column; gap: .6rem; padding-bottom: 1rem; }
.studio-workspace .board-column > .hint, .editor-toolbar { margin-inline: clamp(.8rem, 1.5vw, 1.6rem); }
.editor-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.challenge-panel { padding: clamp(.8rem, 1.5vw, 1.2rem); display: grid; align-content: start; gap: 1.2rem; overflow: auto; }
.challenge-panel .panel-title { font-size: 1.15rem; letter-spacing: -.02em; }
.challenge-form { display: grid; gap: .8rem; padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.challenge-item { display: grid; gap: .45rem; padding: .7rem; border: 1px solid var(--line); background: var(--ground); }
.challenge-item p { font-size: .85rem; }
.timeline { margin: 0; padding-inline-start: 1.1rem; display: grid; gap: .35rem; font-size: .88rem; }
.timeline time { font-family: var(--mono); }
.student-preview { display: grid; gap: .6rem; padding: .9rem; border: 1px solid var(--accent); border-style: dashed; background: var(--ground); }
.student-preview h3 { font-size: 1rem; }
/* A small copy of the learner's page (.test-paper): same paper colours and font, no input. */
.preview-paper { margin: 0; padding: 1rem 1.1rem; background: white; color: #171717; color-scheme: light; box-shadow: 0 2px 10px #0004;
    font: 400 1rem/1.6 var(--sans); white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-paper-empty { color: #6b7079; font-style: italic; }
.preview-blank { padding: 0 .1em; border-radius: 2px; background: #0088ff2e; color: inherit; }
.excerpt { margin: .5rem 0 0; padding-inline-start: .7rem; border-inline-start: 2px solid var(--quiet); color: var(--quiet); }
.confirm-answer { padding: .5rem .7rem; border: 1px solid var(--accent); background: var(--accent-surface); }
@media (min-width: 1100px) {
    .studio-workspace { grid-template-columns: minmax(13rem, 19%) minmax(0, 1fr) minmax(17rem, 26%); }
    .studio-workspace:has(> :last-child:nth-child(2)) { grid-template-columns: minmax(13rem, 19%) minmax(0, 1fr); }
}
@media (max-width: 1099px) {
    .studio-workspace, .studio-workspace:has(> :last-child:nth-child(2)) { grid-template-columns: minmax(150px,.8fr) minmax(0,2fr); }
    .studio-workspace .challenge-panel { grid-column: 1 / -1; }
}
@media (max-width: 650px) {
    .studio-workspace, .studio-workspace:has(> :last-child:nth-child(2)) { grid-template-columns: minmax(0, 1fr); }
    .transport.sticky { gap: .45rem; padding: .55rem .7rem; }
}

/* Flags and the answers dialog */
.flag-banner { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-inline: clamp(.8rem, 1.5vw, 1.6rem); border-color: var(--accent); }
.studio-workspace .board-column > .notice.error { margin-inline: clamp(.8rem, 1.5vw, 1.6rem); }
.dialog-backdrop { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 1rem; background: #020a11cc; }
.dialog { width: min(46rem, 100%); max-height: calc(100dvh - 2rem); overflow: auto; display: grid; gap: .8rem; padding: clamp(1rem, 2.5vw, 1.6rem); background: var(--paper); border: 1px solid var(--line); border-top: 2px solid var(--accent); box-shadow: 0 12px 32px #000a; }
.flag-summary { display: grid; gap: .4rem; padding: .7rem .8rem; background: var(--ground); border: 1px solid var(--line); }
.flag-summary code { font: .85rem/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.answer-kind { display: inline-block; padding: .1rem .5rem; margin-inline-end: .35rem; border: 1px solid var(--accent); color: var(--accent-hover); font-size: .78rem; font-weight: 700; }
.context-answer { border-color: var(--accent); }
.lesson-feedback .received { font-weight: 650; }
.grade-label { display: inline-block; padding: .1rem .45rem; border: 1px solid currentColor; font-size: .78rem; font-weight: 700; }
.grade-label.pending { color: var(--quiet); }
.feedback-link { font-size: .85rem; }

/* Submissions */
.status-badge { display: inline-block; padding: .15rem .55rem; border: 1px solid currentColor; font-size: .85rem; font-weight: 650; }
.status-badge.graded { color: var(--success); }
.status-badge.pending { color: var(--quiet); border-style: dashed; }
.response-compare { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 1rem; }
.response-compare > section { padding: .8rem; border: 1px solid var(--line); background: var(--ground); }
.response-compare .expected { border-style: dashed; }
.field-label { color: var(--quiet); font-size: .82rem; font-weight: 600; }
.response { white-space: pre-wrap; overflow-wrap: anywhere; }

.studio-workspace .sidebar-actions,
.studio-workspace .sidebar-actions label,
.studio-workspace .document-list-items { grid-template-columns: minmax(0, 1fr); }
.studio-workspace .sidebar-actions > *,
.studio-workspace .sidebar-actions input[type=file] { width: 100%; min-width: 0; }
.studio-workspace .document-list .badge { flex: none; white-space: nowrap; padding-inline: .4rem; }
.studio-workspace .document-list button span:last-child { min-width: 0; }
.studio-workspace .document-pane h3 { min-width: 0; overflow-wrap: anywhere; }
.writing-tools { display: grid; align-content: start; gap: .75rem; min-width: 0; }
.writing-tools label, .test-file-tools { min-width: 0; }
.writing-tools .actions button { flex: 1 1 8rem; }
.question-outline { list-style: none; padding: 0; margin: .4rem 0 0; max-height: 18rem; overflow: auto; }
.question-outline button { display: grid; justify-items: start; width: 100%; text-align: start; overflow-wrap: anywhere; }

/* The native editor remains the writing surface, including its selection and scroll position. */
.test-paper {
    display: block;
    position: relative;
    inline-size: min(100%, 210mm);
    aspect-ratio: 210 / 297;
    margin-inline: auto;
    background: white;
    box-shadow: 0 2px 10px #0004;
}
.test-paper > textarea {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding: clamp(1rem, 7.15%, 15mm);
    border: 0;
    border-radius: 0;
    resize: none;
    background: white;
    color: #171717;
    color-scheme: light;
    font: 400 1rem/1.6 var(--sans);
}
.test-paper > textarea:focus-visible { outline-offset: 2px; }

/* Formatting mirror (test-markup.js). It shows the same characters as the textarea, styled, behind a
   transparent textarea that keeps the caret, selection and input. Styles here must not change glyph
   widths or line heights: no font size, weight or family changes, or the caret drifts from the text. */
.paper-mirror { display: none; }
.test-paper > .paper-mirror[data-ready] {
    display: block;
    position: absolute;
    box-sizing: border-box;
    margin: 0;
    overflow: hidden;
    pointer-events: none;
    color: #171717;
    background: white;
}
.test-paper > .paper-mirror[data-ready] + textarea { color: transparent; background: transparent; caret-color: #171717; }
.test-paper > .paper-mirror[data-ready] + textarea::selection { color: transparent; background: #0088ff47; }
.paper-mirror .tm-mark { color: #8a8f98; }
/* Bold look without changing advance widths. */
.tm-h1, .tm-h2 { text-shadow: .03em 0 0 currentColor; }
.tm-h1 { color: #0b3d91; background: #e8f0fd; box-shadow: 0 .1em 0 #0b3d91; }
.tm-h2 { color: #244a73; box-shadow: 0 .08em 0 #9db4cf; }
.tm-red { color: #c0262d; }
.tm-blue { color: #1356c2; }
.tm-green { color: #1a7f37; }
.tm-orange { color: #b85600; }
.tm-purple { color: #7a2fb5; }
@media (forced-colors: active) {
    .test-paper > .paper-mirror[data-ready] { display: none; }
    .test-paper > .paper-mirror[data-ready] + textarea { color: CanvasText; background: Canvas; }
}

.format-tools { display: grid; align-content: start; gap: .75rem; min-width: 0; }
.format-tools label { min-width: 0; }
.format-tools code { font: .85em var(--mono); }
.format-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.format-row button { flex: 1 1 auto; }
.format-row .swatch { flex: 0 0 2.6rem; padding-inline: 0; background: white; border-color: var(--line); }
.format-row .swatch span { font-weight: 800; text-shadow: none; }

/* Full-screen test editor. Everything else on the page is hidden, so it also leaves the tab order. */
/* The page's stable scrollbar gutter would leave a strip beside the fixed editor. */
html:has(.test-focus) { overflow: hidden; scrollbar-gutter: auto; }
body:has(.test-focus) { overflow: hidden; visibility: hidden; }
.test-focus, .dialog-backdrop, #blazor-error-ui, #components-reconnect-modal, .test-printout { visibility: visible; }
.test-focus { position: fixed; inset: 0; z-index: 30; margin: 0; border: 0; border-radius: 0; background: var(--ground); overflow: hidden; }
.focus-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem 1rem;
    padding: .7rem clamp(.8rem, 2vw, 1.6rem); border-bottom: 1px solid var(--line); background: var(--paper); }
.focus-title { display: grid; min-width: 0; }
.focus-title h2 { margin: 0; font-size: 1.15rem; }
.test-focus > .notice, .test-focus .board-column > .notice { margin: .6rem clamp(.8rem, 2vw, 1.6rem) 0; }
.start-options.test-focus { display: flex; flex-direction: column; padding: 0; }
.start-options.test-focus .start-grid { flex: 1; min-height: 0; grid-template-columns: minmax(0, 1fr) minmax(18rem, 25rem); gap: 0; }
.start-options.test-focus .start-grid > .stack { border: 0; overflow: auto; min-height: 0; }
.start-options.test-focus .start-grid > form { padding: 1rem clamp(1rem, 3vw, 3rem) 2rem; }
.start-options.test-focus .test-file-tools { border-inline-start: 1px solid var(--line); background: var(--paper); }
.studio-workspace.test-focus,
.studio-workspace.test-focus:has(> :last-child:nth-child(2)) { display: grid; grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem); }
.studio-workspace.test-focus > .document-sidebar { display: none; }
.studio-workspace.test-focus .board-column { overflow: auto; min-height: 0; }
.studio-workspace.test-focus .board-column > .focus-bar { position: sticky; top: 0; z-index: 1; }
.studio-workspace.test-focus .challenge-panel { grid-column: auto; min-height: 0; border-inline-start: 1px solid var(--line); background: var(--paper); }
@media (max-width: 760px) {
    .test-focus { overflow: auto; }
    .start-options.test-focus .start-grid,
    .studio-workspace.test-focus,
    .studio-workspace.test-focus:has(> :last-child:nth-child(2)) { grid-template-columns: minmax(0, 1fr); }
    .start-options.test-focus .start-grid > .stack, .studio-workspace.test-focus .board-column { overflow: visible; }
    .start-options.test-focus .test-file-tools, .studio-workspace.test-focus .challenge-panel { border-inline-start: 0; border-top: 1px solid var(--line); }
}
.test-printout { display: none; }

@page test-page { size: A4 portrait; margin: 15mm; }
@media print {
    html:has(.test-printout), body:has(> .test-printout) {
        overflow: visible;
        height: auto;
        margin: 0;
        padding: 0;
        background: white;
    }
    body:has(> .test-printout) > :not(.test-printout) { display: none !important; }
    .test-printout {
        display: block;
        page: test-page;
        color: black;
        font: 12pt/1.5 var(--sans);
        white-space: pre-wrap;
        overflow-wrap: anywhere;
    }
    .test-printout h1 { margin-bottom: 5mm; font-size: 17pt; }
    .test-printout > p + p, .test-printout > p + .test-printout-body { margin-top: 5mm; }
    .test-printout-body > * { margin: 0; }
    .test-printout-body > h2 { margin-block: 3mm 1mm; font-size: 15pt; }
    .test-printout-body > h3 { margin-block: 2mm 1mm; font-size: 13pt; }
}
