:root {
  color-scheme: light dark;
  --bg: light-dark(#f4f7f6, #0d1316);
  --surface: light-dark(#ffffff, #141c20);
  --surface-2: light-dark(#eef3f1, #1a2429);
  --surface-3: light-dark(#e4ebe8, #222e34);
  --ink: light-dark(#0f2420, #e6efec);
  --ink-2: light-dark(#4d605b, #a1b3ae);
  --ink-3: light-dark(#6f817c, #7f918c);
  --line: light-dark(#e0e7e4, #243037);
  --line-strong: light-dark(#c8d4d0, #34434b);
  --brand: light-dark(#0b7a68, #4fd1b3);
  --brand-strong: light-dark(#075e50, #7de0c8);
  --brand-tint: light-dark(#e2f3ee, #12302a);
  --on-brand: light-dark(#ffffff, #03211b);
  --accent: light-dark(#dc4b35, #ff8b72);
  --accent-tint: light-dark(#fdeee9, #3a1f19);
  --warning: light-dark(#9a5b00, #f5b94f);
  --warning-tint: light-dark(#fff5e0, #33280f);
  --danger: light-dark(#b42318, #ff8f85);
  --danger-tint: light-dark(#fef0ee, #3a1c1a);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px light-dark(rgb(15 36 32 / .06), rgb(0 0 0 / .35));
  --shadow: 0 1px 2px light-dark(rgb(15 36 32 / .05), rgb(0 0 0 / .3)), 0 8px 24px -10px light-dark(rgb(15 36 32 / .16), rgb(0 0 0 / .55));
  --shadow-lg: 0 28px 64px -20px light-dark(rgb(15 36 32 / .32), rgb(0 0 0 / .7));
  --ring: 0 0 0 3px light-dark(rgb(11 122 104 / .28), rgb(79 209 179 / .35));
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --paper: var(--bg);
  --panel: var(--surface);
  --soft: var(--ink-2);
  --muted: var(--ink-2);
  --tint: var(--brand-tint);
  --header-height: 64px;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Base */
* { box-sizing: border-box; }
html { height: 100%; overflow: hidden; }
body { margin: 0; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol { margin: 0; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.015em; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 3.4vw, 2.25rem); letter-spacing: -.025em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p, li { overflow-wrap: anywhere; }
a { color: var(--brand); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.eyebrow { font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.container { width: min(1160px, 100% - 48px); margin-inline: auto; }
.skip-link { position: absolute; top: -100px; left: 12px; z-index: 60; background: var(--surface); padding: 10px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.skip-link:focus { top: 10px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 10px; background: none; font-size: .9375rem; font-weight: 600; line-height: 1.2; text-align: center; text-decoration: none; white-space: nowrap; color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--brand-strong); border-color: var(--brand-strong); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-quiet { color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--surface); border-color: var(--line-strong); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-tint); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: .875rem; border-radius: var(--radius-sm); }
.btn-lg { min-height: 50px; padding: 0 24px; font-size: 1rem; border-radius: var(--radius); }
.btn-block { width: 100%; white-space: normal; padding-block: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn[aria-busy="true"] { cursor: progress; opacity: .85; }
.link { padding: 0; border: 0; background: none; color: var(--brand); font-weight: 600; font-size: inherit; text-align: left; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.spinner { display: inline-block; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid color-mix(in srgb, currentColor 22%, transparent); border-top-color: currentColor; animation: spin .8s linear infinite; }
.btn .spinner { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--ink-2); font-size: .75rem; font-weight: 650; line-height: 1.5; white-space: nowrap; }
.chip-brand { background: var(--brand-tint); color: var(--brand-strong); }
.chip-warning { background: var(--warning-tint); color: var(--warning); }
.chip-danger { background: var(--danger-tint); color: var(--danger); }

/* Forms */
.field { display: flex; flex-direction: column; gap: 6px; }
label { font-size: .875rem; font-weight: 600; color: var(--ink); }
input:not([type="checkbox"]), textarea { width: 100%; min-height: 46px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: var(--ink); font-size: 1rem; }
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 1; }
input:not([type="checkbox"]):focus-visible, textarea:focus-visible { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
input:disabled { opacity: .6; }
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
.field-help { font-size: .8125rem; color: var(--ink-2); }
.label-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.label-row .link { font-size: .8125rem; }
.inline-field { display: flex; gap: 8px; }
.inline-field input { flex: 1; min-width: 0; }
form { display: flex; flex-direction: column; gap: 16px; }

/* Header */
.site-header { flex: none; height: var(--header-height); background: color-mix(in srgb, var(--surface) 88%, transparent); border-bottom: 1px solid var(--line); position: relative; z-index: 20; }
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 750; font-size: 1.15rem; letter-spacing: -.02em; border-radius: var(--radius-sm); }
.brand-mark { width: 32px; height: 32px; flex: none; }
.brand-mark rect { fill: var(--brand); }
.brand-mark circle { fill: var(--on-brand); }
.brand-mark path { fill: none; stroke: var(--on-brand); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.header-nav { display: flex; align-items: center; gap: 8px; }
.header-nav .btn { min-height: 38px; padding: 0 14px; font-size: .875rem; }

.site-footer { flex: none; padding: 18px 0; border-top: 1px solid var(--line); color: var(--ink-2); font-size: .875rem; text-align: center; }
.site-footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 8px; }
.site-footer a { color: inherit; }

.legal-page { width: min(760px, 100%); display: grid; gap: 20px; padding-block: clamp(32px, 7vw, 72px); }
.legal-page > header { display: grid; gap: 10px; }
.legal-page section { display: grid; gap: 10px; }
.legal-page ul { display: grid; gap: 8px; padding-left: 24px; }
.legal-page .card { gap: 14px; }

#feedback-panel fieldset { margin: 0; padding: 0; border: 0; }
#feedback-panel input[type="radio"] { width: auto; min-height: 0; margin: 0; accent-color: var(--brand); }
#feedback-panel fieldset label { display: inline-flex; align-items: center; gap: 5px; }
#feedback-instructor-options { display: grid; gap: 10px; }

/* Toast */
.toast-region { position: fixed; top: calc(var(--header-height) + 12px); left: 50%; z-index: 50; width: min(560px, 100% - 32px); transform: translateX(-50%); pointer-events: none; }
.toast { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 12px 12px 12px 14px; border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); opacity: 0; transform: translateY(-8px); }
.toast.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.toast-icon { width: 20px; height: 20px; margin-top: 1px; fill: none; stroke: var(--brand); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toast-icon-error { display: none; }
.toast[data-tone="error"] { border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); background: color-mix(in srgb, var(--danger-tint) 55%, var(--surface)); }
.toast[data-tone="error"] .toast-icon { stroke: var(--danger); }
.toast[data-tone="error"] .toast-icon-ok { display: none; }
.toast[data-tone="error"] .toast-icon-error { display: inline; }
.toast-body { display: grid; gap: 8px; font-size: .9375rem; }
#notice[data-error="true"] { color: var(--danger); }
#recovery { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; font-size: .8125rem; color: var(--ink-2); }
.toast-close { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-3); }
.toast-close:hover { background: var(--surface-2); color: var(--ink); }
.toast-close svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.toast:not(.is-visible) .toast-close { visibility: hidden; }

/* Main area: fills the viewport. Layouts are sized to fit one screen on
   desktop; the page only scrolls as a fallback on small or short screens. */
#main { flex: 1; min-height: 0; width: 100%; overflow: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
#main:focus { outline: none; }
#main > * { flex: none; }
.loading { flex: 1 !important; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--ink-2); }
.loading .spinner { width: 32px; height: 32px; color: var(--brand); }

/* Landing (signed out) */
.landing { --landing-pad: clamp(16px, 3.5vh, 44px); flex: 1 0 auto !important; display: flex; align-items: center; padding: var(--landing-pad) 0; background:
  radial-gradient(900px 520px at 92% 0%, color-mix(in srgb, var(--brand) 14%, transparent), transparent 70%),
  radial-gradient(700px 480px at 0% 100%, color-mix(in srgb, var(--accent) 8%, transparent), transparent 70%); }
/* The grid claims the visible height (capped), and the example diagram
   absorbs whatever is left, so the page fits without a scrollbar. */
.landing-grid { display: grid; min-height: min(calc(100dvh - var(--header-height) - 2 * var(--landing-pad)), 760px); grid-template-columns: minmax(0, 1fr) minmax(360px, 410px); grid-template-rows: auto 1fr; grid-template-areas: "text auth" "visual auth"; column-gap: clamp(32px, 4.5vw, 72px); row-gap: clamp(14px, 2.6vh, 28px); }
.hero-text { grid-area: text; display: flex; flex-direction: column; align-items: flex-start; gap: clamp(10px, 1.8vh, 18px); }
.hero-visual { grid-area: visual; display: flex; flex-direction: column; gap: clamp(12px, 2vh, 18px); min-width: 0; }
.kicker { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: color-mix(in srgb, var(--surface) 80%, transparent); font-size: .8125rem; font-weight: 600; color: var(--ink-2); }
.kicker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.hero-title { font-size: clamp(2rem, min(3.6vw, 5.8vh), 3.1rem); line-height: 1.06; letter-spacing: -.035em; font-weight: 800; text-wrap: balance; }
.highlight { color: var(--brand); background: linear-gradient(transparent 64%, color-mix(in srgb, var(--accent) 20%, transparent) 64%, color-mix(in srgb, var(--accent) 20%, transparent) 92%, transparent 92%); padding-inline: .04em; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.hero-lede { max-width: 36em; font-size: clamp(1rem, 2vh, 1.125rem); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.tour-cta { display: inline-flex; align-items: center; gap: 12px; padding: 8px 18px 8px 8px; border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); border-radius: var(--radius-pill); background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.tour-cta:hover { border-color: var(--brand); background: var(--brand-tint); }
.tour-cta-play { display: grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.tour-cta-play svg { width: 18px; height: 18px; fill: #fff; }
.tour-cta-text { display: grid; line-height: 1.3; }
.tour-cta-text strong { font-size: .9375rem; }
.tour-cta-text small { font-size: .8125rem; color: var(--ink-2); }

.preview-frame { position: relative; flex: 1 1 0; min-height: 180px; display: flex; flex-direction: column; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.preview-cover { position: absolute; inset: 0; border-radius: inherit; }
.preview-cover:focus-visible { outline: 3px solid var(--brand); outline-offset: -3px; }
.preview-try { margin-left: auto; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--accent-tint); color: var(--accent); font-size: .75rem; font-weight: 700; white-space: nowrap; }
.preview-frame:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.preview-frame:hover .preview-try { background: var(--accent); color: #fff; }
.preview-bar, .preview-feedback { flex: none; }
.preview-bar { display: flex; align-items: center; gap: 7px; min-height: 40px; padding: 6px 12px 6px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.preview-bar > span:not(.chip):not(.preview-try) { width: 10px; height: 10px; border-radius: 50%; background: var(--line-strong); }
.preview-bar p { flex: 1; min-width: 0; margin-left: 8px; font-size: .8125rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mechanism { display: block; flex: 1 1 0; width: 100%; min-height: 80px; max-height: 300px; padding: 6px 16px 0; margin-block: auto; }
.mechanism text { font-family: var(--font); font-size: 30px; font-weight: 500; fill: var(--ink); text-anchor: middle; dominant-baseline: central; }
.mechanism .dot { fill: var(--ink); }
.mechanism .bond { stroke: var(--ink); stroke-width: 2.6; stroke-linecap: round; fill: none; }
.mechanism .bond.thin { stroke-width: 1.8; }
.mechanism .wedge { fill: var(--ink); }
.mechanism .charge { fill: none; stroke: var(--ink); stroke-width: 1.6; }
.mechanism .charge-sign { stroke: var(--ink); stroke-width: 1.8; stroke-linecap: round; }
.mechanism .arrow { fill: none; stroke: var(--accent); stroke-width: 2.8; stroke-linecap: round; }
.mechanism .arrow-head { fill: var(--accent); transform-box: fill-box; transform-origin: center; }
/* Electrons that travel along the arrows in the animated example (site.js). */
.mechanism .electron { fill: var(--accent); stroke: color-mix(in srgb, var(--accent) 28%, transparent); stroke-width: 5; paint-order: stroke; }
.preview-moves { position: absolute; top: 52px; right: 14px; display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--surface-2); color: var(--ink-2); font-size: .75rem; font-weight: 650; line-height: 1.5; white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none; }
.preview-moves svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.preview-moves:not([data-done="true"]) svg { display: none; }
.preview-moves[data-done="true"] { background: var(--brand-tint); color: var(--brand-strong); }
.preview-feedback { display: flex; align-items: flex-start; gap: 10px; margin: 6px 14px 14px; padding: 10px 12px; border-radius: var(--radius); background: var(--brand-tint); color: var(--brand-strong); font-size: .875rem; font-weight: 550; line-height: 1.45; }
.preview-feedback svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stats { display: flex; flex-wrap: wrap; gap: 8px 36px; padding: 0; list-style: none; }
.stats li { display: flex; flex-direction: column; }
.stats strong { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stats span { font-size: .8125rem; color: var(--ink-2); }
.instructor-note { font-size: .875rem; color: var(--ink-2); }
.instructor-note strong { color: var(--ink); }

/* Auth card */
.auth-card { grid-area: auth; align-self: center; position: relative; display: flex; flex-direction: column; gap: clamp(14px, 2.2vh, 20px); padding: clamp(20px, 3vh, 28px); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); }
.segmented { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--surface-2); }
.segmented button { min-height: 38px; border: 0; border-radius: 9px; background: none; color: var(--ink-2); font-weight: 600; font-size: .9375rem; }
.segmented button:hover { color: var(--ink); }
.segmented button[aria-pressed="true"] { background: light-dark(var(--surface), var(--surface-3)); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.link-back { display: inline-flex; align-items: center; gap: 4px; width: fit-content; margin: -4px 0 -6px -6px; padding: 4px 8px 4px 4px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-2); font-weight: 600; font-size: .875rem; }
.link-back:hover { background: var(--surface-2); color: var(--ink); }
.link-back svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.auth-illustration { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 18px; background: var(--brand-tint); }
.auth-illustration svg { width: 34px; height: 34px; fill: none; stroke: var(--brand); stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round; }
.auth-heading { display: grid; gap: 4px; }
.auth-heading h2 { font-size: 1.5rem; letter-spacing: -.02em; }
#auth-description { color: var(--ink-2); font-size: .9375rem; }
#auth-description strong { color: var(--ink); overflow-wrap: anywhere; }
#auth-form { gap: clamp(12px, 1.9vh, 16px); }
#auth-form input { min-height: clamp(42px, 5.4vh, 46px); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 72px; }
.password-toggle { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); min-height: 32px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-2); font-size: .8125rem; font-weight: 600; }
.password-toggle:hover { background: var(--surface-2); color: var(--ink); }
.password-rule { display: flex; align-items: center; gap: 6px; }
.password-rule svg { width: 16px; height: 16px; flex: none; fill: none; stroke: var(--ink-3); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.password-rule svg path { stroke: transparent; }
.password-rule[data-met="true"] { color: var(--brand-strong); }
.password-rule[data-met="true"] svg circle { fill: var(--brand); stroke: var(--brand); }
.password-rule[data-met="true"] svg path { stroke: var(--on-brand); stroke-width: 1.8; }
.fineprint { font-size: .8125rem; color: var(--ink-3); text-align: center; text-wrap: pretty; }
.fineprint strong { color: var(--ink-2); font-weight: 650; }
.auth-links { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 16px; padding-top: clamp(12px, 2vh, 16px); border-top: 1px solid var(--line); font-size: .875rem; }

/* Task mode (invitation, shared reaction, password reset): only the form */
.landing.is-task .hero-text, .landing.is-task .hero-visual { display: none; }
.landing.is-task .landing-grid { min-height: 0; grid-template-columns: minmax(0, 440px); grid-template-rows: auto; grid-template-areas: "auth"; justify-content: center; }

/* Dashboard (signed in) */
.dashboard { display: flex; flex-direction: column; gap: clamp(14px, 2.4vh, 22px); padding: clamp(18px, 3.4vh, 36px) 0; }
.dash-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; }
.dash-heading h1 { font-size: clamp(1.5rem, min(2.6vw, 4.2vh), 2rem); }
.dash-heading #account-email { font-size: .9375rem; }
.banner-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 20px; border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); border-radius: var(--radius-lg); background: var(--brand-tint); }
.banner-card > div { display: grid; gap: 2px; }
.banner-card h2 { font-size: 1.05rem; }
.banner-card p { color: var(--ink-2); font-size: .875rem; }
.banner-card .btn { flex: none; }

.study-hero { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 32px; padding: clamp(22px, 4vh, 36px) clamp(24px, 3.4vw, 40px); border-radius: 22px; color: #fff; background:
  radial-gradient(420px 260px at 100% 0%, rgb(255 255 255 / .16), transparent 70%),
  radial-gradient(360px 240px at 85% 120%, rgb(255 139 114 / .28), transparent 70%),
  linear-gradient(135deg, light-dark(#075e50, #0a4a41), light-dark(#0b7a68, #0d5f53)); box-shadow: var(--shadow); overflow: hidden; }
.study-hero-copy { position: relative; display: grid; gap: 8px; max-width: 640px; }
.study-hero .eyebrow { color: rgb(255 255 255 / .75); }
.study-hero h2 { font-size: clamp(1.4rem, min(2.6vw, 4.4vh), 2rem); letter-spacing: -.025em; }
.study-hero p { color: rgb(255 255 255 / .86); }
.study-hero .btn-primary { position: relative; flex: none; background: #fff; border-color: #fff; color: #075e50; box-shadow: 0 8px 24px -8px rgb(0 0 0 / .35); }
.study-hero .btn-primary:hover:not(:disabled) { background: #eafaf5; border-color: #eafaf5; }
.study-hero .btn-primary:not([aria-busy])::after { content: "→"; font-size: 1.1em; }
.course-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; }
.course-chips li { display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px; border-radius: var(--radius-pill); background: var(--brand-tint); color: var(--brand-strong); font-size: .8125rem; font-weight: 600; }
.course-chips li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.course-chips li[data-available="false"] { background: var(--surface-3); color: var(--ink-3); }
.study-hero .course-chips li { background: rgb(255 255 255 / .16); color: #fff; }
.study-hero .course-chips li[data-available="false"] { background: rgb(255 255 255 / .08); color: rgb(255 255 255 / .7); }

.paywall { position: relative; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: clamp(20px, 3vw, 36px); padding: clamp(22px, 3.6vh, 32px); border: 1px solid var(--line); border-radius: 22px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.paywall::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--brand), var(--accent)); }
.paywall-copy { display: grid; align-content: start; gap: clamp(8px, 1.6vh, 14px); }
.paywall-copy h2 { font-size: clamp(1.4rem, min(2.6vw, 4.4vh), 2rem); letter-spacing: -.025em; }
#paywall-description { color: var(--ink-2); font-size: 1rem; }
.paywall-plan { display: flex; flex-direction: column; gap: 14px; padding: clamp(18px, 2.8vh, 24px); border-radius: var(--radius-lg); background: var(--surface-2); align-self: center; }
.plan-name { font-weight: 700; color: var(--ink-2); font-size: .9375rem; }
.plan-price { font-size: clamp(2rem, 5vh, 2.5rem); font-weight: 800; letter-spacing: -.035em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plan-price small { font-size: 1rem; font-weight: 600; letter-spacing: 0; color: var(--ink-2); }
.checklist { display: grid; gap: clamp(8px, 1.4vh, 12px); padding: 0; list-style: none; }
.checklist li { position: relative; padding-left: 32px; color: var(--ink); font-size: .9375rem; }
.checklist li::before { content: ""; position: absolute; left: 0; top: .1em; width: 22px; height: 22px; border-radius: 50%; background: var(--brand-tint); }
.checklist li::after { content: ""; position: absolute; left: 8px; top: calc(.1em + 5px); width: 5px; height: 10px; border: solid var(--brand); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.checklist strong { font-weight: 750; }
.pending { display: flex; gap: 12px; padding: 14px; border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); border-radius: var(--radius); background: var(--surface); }
.pending .spinner { color: var(--brand); margin-top: 2px; }
.pending p { margin-top: 4px; font-size: .875rem; color: var(--ink-2); }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: clamp(14px, 2vh, 20px); align-items: stretch; }
.card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: clamp(16px, 2.6vh, 22px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-sm); }
.card h2 { font-size: 1.05rem; }
.card > p:not(.muted):not(.price) { color: var(--ink-2); font-size: .875rem; }
.card .muted { font-size: .8125rem; }
.card-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 10px; }
.card .actions { margin-top: auto; padding-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.price { font-size: 1.1rem; font-weight: 700; letter-spacing: -.01em; }
.admin-card form { gap: 8px; }
.admin-card .actions { margin-top: 0; }

.switch { display: inline-flex; align-items: center; gap: 12px; width: fit-content; cursor: pointer; font-size: .9375rem; }
.switch input { appearance: none; flex: none; position: relative; width: 44px; height: 26px; margin: 0; border-radius: var(--radius-pill); background: var(--line-strong); cursor: pointer; }
.switch input::before { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); }
.switch input:checked { background: var(--brand); }
.switch input:checked::before { transform: translateX(18px); }
.setup-issues { border-radius: var(--radius); background: var(--warning-tint); font-size: .8125rem; }
.setup-issues summary { padding: 8px 12px; color: var(--warning); font-weight: 650; cursor: pointer; }
.setup-issues ul { display: grid; gap: 4px; padding: 0 12px 10px 30px; color: var(--ink); }

/* Classroom dialog */
.modal { width: min(900px, 100vw - 32px); max-height: calc(100dvh - 48px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg); }
.modal[open] { display: flex; flex-direction: column; }
.modal::backdrop { background: rgb(8 20 17 / .45); backdrop-filter: blur(2px); }
.modal-header { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 1.25rem; }
.modal-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; display: grid; gap: 16px; padding: 20px; }
.classroom-status { padding: 10px 14px; border-radius: var(--radius); background: var(--surface-2); color: var(--ink-2); font-size: .875rem; }
.classroom-status:empty { display: none; }
.classroom-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.form-step { gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg); }
.form-step-label { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.list-title { font-size: .9375rem; margin-bottom: 8px; }
.invite-list { display: grid; gap: 8px; padding: 0; list-style: none; }
.invite-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.invite-list li > div:first-child { display: grid; gap: 2px; min-width: 0; }
.invite-list li strong { overflow-wrap: anywhere; font-size: .9375rem; }
.invite-list li span { font-size: .8125rem; color: var(--ink-2); }
.invite-list .invite-empty { justify-content: flex-start; color: var(--ink-3); font-size: .875rem; border-style: dashed; background: none; }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 6px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--warning-tint); color: var(--warning); font-size: .75rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.count-badge[hidden] { display: none; }
.review-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 8px; }
.review-toolbar .list-title { margin: 0 auto 0 0; }
.review-check { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: .875rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.review-list input[type="checkbox"], .review-check input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--brand); cursor: pointer; }
.review-list li > div:not(.actions) { flex: 1; display: grid; gap: 2px; min-width: 0; }
.review-list li .actions { flex: none; margin-top: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-row:not(:has(> .field:not([hidden]))) { display: none; }
.optional { font-weight: 500; color: var(--ink-3); font-size: .8125rem; }
.step-num { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--brand-tint); color: var(--brand-strong); font-size: .8125rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.form-step .btn { align-self: flex-start; }
.form-step .inline-field .btn { align-self: stretch; min-height: 46px; }
#classroom-roster { width: 100%; border-collapse: collapse; font-size: .875rem; }
#classroom-roster caption { text-align: left; font-weight: 700; padding: 4px 0 10px; }
#classroom-roster th, #classroom-roster td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
#classroom-roster thead th { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); background: var(--surface-2); border-bottom: 0; }
#classroom-roster tbody th { font-weight: 600; overflow-wrap: anywhere; }
.invite-link { display: flex; align-items: center; gap: 6px; min-width: 240px; }
.invite-link input { min-width: 0; min-height: 34px; padding: 4px 10px; font-size: .8125rem; font-family: var(--mono); }
.noscript { margin: 24px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }

/* Learning workspace (iframe) */
body.studying .site-header { display: none; }
body.studying #main { overflow: hidden; }
body.studying .toast-region { top: 12px; }
#learner, #learner-mount { display: flex; flex: 1 !important; min-height: 0; min-width: 0; }
#learner-frame { flex: 1; width: 100%; height: 100%; border: 0; background: var(--bg); }

@media (prefers-reduced-motion: no-preference) {
  .btn, .segmented button, .link-back, .password-toggle, .toast-close, input, textarea, .switch input, .switch input::before { transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .15s ease; }
  /* The toast's enter/exit spring is driven from site.js (Motion). */
  /* Signed-in view changes (site.js): the page settles upward into place,
     and "Open learning library" grows into the workspace. */
  .site-header { view-transition-name: site-header; }
  #launch-learner, #learner { view-transition-name: workspace; }
  ::view-transition-group(*) { animation-duration: .38s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); }
  ::view-transition-old(root) { animation: .16s ease-in both vt-fade-out; }
  ::view-transition-new(root) { animation: .34s cubic-bezier(.2, .8, .2, 1) .04s both vt-rise-in; }
  ::view-transition-old(workspace) { animation: .14s ease-in both vt-fade-out; }
  ::view-transition-new(workspace) { animation: .3s ease-out both vt-fade-in; }
  ::view-transition-old(workspace), ::view-transition-new(workspace) { height: 100%; object-fit: cover; object-position: top left; }
}
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in { from { opacity: 0; } }
@keyframes vt-rise-in { from { opacity: 0; transform: translateY(12px); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2.4s; }
}

/* Short desktop screens: trim secondary landing content before scrolling. */
@media (min-width: 1021px) and (max-height: 800px) {
  .kicker, .instructor-note { display: none; }
  .stats strong { font-size: 1.25rem; }
  .auth-card, #auth-form { gap: 12px; }
  #auth-form input { min-height: 40px; }
  #auth-form .field { gap: 4px; }
  .auth-card { padding-block: 18px; }
  .auth-links { padding-top: 10px; }
}

/* Tablet and phone: one natural column; scrolling is expected here. */
@media (max-width: 1020px) {
  .landing { align-items: flex-start; }
  .landing-grid { min-height: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "text" "auth" "visual"; row-gap: 28px; }
  .auth-card { width: min(100%, 480px); align-self: auto; }
  .preview-frame { flex: none; min-height: 0; }
  .mechanism { flex: none; height: auto; max-height: 240px; }
  .paywall { grid-template-columns: minmax(0, 1fr); }
  .paywall-plan { align-self: stretch; }
}
@media (max-width: 640px) {
  .field-row { grid-template-columns: minmax(0, 1fr); }
  :root { --header-height: 56px; }
  .container { width: calc(100% - 32px); }
  .brand-name { font-size: 1.05rem; }
  .landing { padding: 24px 0 36px; }
  .hero-title { font-size: 2.1rem; }
  .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 16px; }
  .stats strong { font-size: 1.3rem; }
  .auth-card { padding: 20px 18px; border-radius: 20px; }
  .mechanism { padding: 6px 6px 0; }
  .preview-feedback { margin: 4px 10px 10px; }
  .banner-card { flex-direction: column; align-items: stretch; }
  .study-hero { flex-direction: column; align-items: stretch; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .inline-field { flex-direction: column; }
  .form-step .inline-field .btn { align-self: flex-start; }
  .review-list li { flex-wrap: wrap; }
  .review-list li .actions { flex-basis: 100%; }
  .modal { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; }
  .modal-header { padding: 12px 16px; }
  .modal-body { padding: 16px; }
}
