/* ═══════════════════════════════════════════════════════════════════
   LernCraft course studio
   Calm, neutral work surface: a collapsible sidebar for navigation, one
   main column, an optional details pane. Hairline borders instead of
   shadows (shadows only on things that float), one teal accent used for
   the primary action, focus and progress.
   Palette after malacarne.com ("nebula"): deep violet surfaces, lavender
   ink, teal accent, violet and pink as quiet secondaries. Values are tuned
   where the site's are too light for small text (contrast notes below).
   Every colour, size and radius below comes from the tokens; screens
   only combine components.
   Motion: nothing moves unless something happened. Only transform and
   opacity animate; reduced motion and calm mode switch it all off.
   ═══════════════════════════════════════════════════════════════════ */

/* ─── 1. Tokens ─────────────────────────────────────────────────── */
:root {
  /* neutrals – violet-tinted, light (contrast on --bg: ink 16.3:1, ink-2 7.6:1, ink-3 5.5:1; on --sidebar ink-3 5.0:1) */
  --bg: #f6f2fc;           /* main work area */
  --sidebar: #efe7fa;      /* navigation */
  --surface: #ffffff;      /* cards, inputs */
  --surface-2: #f3edfb;    /* insets, wells */
  --pane: #faf7fd;         /* details pane */
  --hover: rgba(29, 16, 48, 0.05);
  --active: rgba(29, 16, 48, 0.08);
  --ink: #1d1030;
  --ink-2: #54476f;
  --ink-3: #685c88;
  --line: #e2d7f3;
  --line-strong: #c9b5ec;
  /* the one accent: the site's teal, one step darker so white text on it reads (5.95:1) */
  --accent: #0a7068;
  --accent-hover: #085c55;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in srgb, #0f9b8e 10%, transparent);
  --accent-line: color-mix(in srgb, #0a7068 40%, transparent);
  --focus: color-mix(in srgb, #0f9b8e 55%, transparent);
  /* secondaries, used sparingly (celebrations, info) */
  --violet: #6d28d9;
  --pink: #db2777;
  /* status */
  --ok: #157a3e;   --ok-soft: color-mix(in srgb, #157a3e 10%, transparent);
  --warn: #9a5a06; --warn-soft: color-mix(in srgb, #d97706 12%, transparent);
  --bad: #b42318;  --bad-soft: color-mix(in srgb, #b42318 9%, transparent);
  --info: #6d28d9; --info-soft: color-mix(in srgb, #7c3aed 9%, transparent);
  --sk: #ebe3f6; --sk-hi: #f4effb;
  --scrim: rgba(29, 16, 48, 0.32);
  --player-bg: #150825;

  /* type – one family, three weights, a short scale */
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.75rem;     /* 12 – labels, meta */
  --fs-sm: 0.8125rem;   /* 13 – secondary text, sidebar */
  --fs-base: 0.875rem;  /* 14 – body */
  --fs-md: 0.9375rem;   /* 15 – lead, inputs */
  --fs-lg: 1.0625rem;   /* 17 – card titles */
  --fs-xl: 1.375rem;    /* 22 – page title */
  --fw-normal: 400; --fw-medium: 500; --fw-bold: 600;
  --lh: 1.55; --lh-tight: 1.3;

  /* space – 4 px grid */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 48px;

  /* shape */
  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-full: 999px;
  --bw: 1px;

  /* elevation – only for things that float above the page */
  --shadow-pop: 0 1px 2px rgba(29, 16, 48, 0.06), 0 8px 24px -6px color-mix(in srgb, #7c3aed 22%, transparent);
  --shadow-drawer: 0 0 0 1px rgba(29, 16, 48, 0.04), 0 16px 48px -8px color-mix(in srgb, #7c3aed 30%, transparent);

  /* layout */
  --sb-w: 268px;
  --pane-w: 300px;
  --bar-h: 52px;
  --page-w: 800px;

  /* motion */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-1: 120ms; --dur-2: 180ms; --dur-3: 260ms; --dur-4: 420ms; --dur-5: 900ms;

  color-scheme: light;
}

/* dark: follows the system unless the visitor picked light; or forced by picking dark.
   malacarne.com's default look. Contrast on --bg: ink 14.6:1, ink-2 9.0:1, ink-3 6.0:1 (5.2:1 on --surface-2);
   accent-ink on accent 10.6:1. --line and --line-strong are the site's violet border (#a855f7 at 20% / 32%) made solid. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a0a2e; --sidebar: #150825; --surface: #241338; --surface-2: #2a1742; --pane: #170a29;
    --hover: rgba(232, 224, 245, 0.06); --active: rgba(232, 224, 245, 0.1);
    --ink: #e8e0f5; --ink-2: #b9aed6; --ink-3: #978cbb;
    --line: #361956; --line-strong: #47226e;
    --accent: #2dd4bf; --accent-hover: #5eead4; --accent-ink: #0f061c;
    --accent-soft: color-mix(in srgb, #2dd4bf 12%, transparent); --accent-line: color-mix(in srgb, #2dd4bf 42%, transparent);
    --focus: color-mix(in srgb, #2dd4bf 60%, transparent);
    --violet: #c084fc; --pink: #f472b6;
    --ok: #5dd38a; --ok-soft: color-mix(in srgb, #5dd38a 12%, transparent);
    --warn: #f2b84b; --warn-soft: color-mix(in srgb, #f2b84b 12%, transparent);
    --bad: #f28b82; --bad-soft: color-mix(in srgb, #f28b82 12%, transparent);
    --info: #c084fc; --info-soft: color-mix(in srgb, #a855f7 14%, transparent);
    --sk: #2a1742; --sk-hi: #33204d; --scrim: rgba(7, 2, 15, 0.6); --player-bg: #07020f;
    --shadow-pop: 0 0 0 1px color-mix(in srgb, #a855f7 22%, transparent), 0 10px 28px -6px rgba(7, 2, 15, 0.7);
    --shadow-drawer: 0 0 0 1px color-mix(in srgb, #a855f7 18%, transparent), 0 16px 48px -8px rgba(7, 2, 15, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1a0a2e; --sidebar: #150825; --surface: #241338; --surface-2: #2a1742; --pane: #170a29;
  --hover: rgba(232, 224, 245, 0.06); --active: rgba(232, 224, 245, 0.1);
  --ink: #e8e0f5; --ink-2: #b9aed6; --ink-3: #978cbb;
  --line: #361956; --line-strong: #47226e;
  --accent: #2dd4bf; --accent-hover: #5eead4; --accent-ink: #0f061c;
  --accent-soft: color-mix(in srgb, #2dd4bf 12%, transparent); --accent-line: color-mix(in srgb, #2dd4bf 42%, transparent);
  --focus: color-mix(in srgb, #2dd4bf 60%, transparent);
  --violet: #c084fc; --pink: #f472b6;
  --ok: #5dd38a; --ok-soft: color-mix(in srgb, #5dd38a 12%, transparent);
  --warn: #f2b84b; --warn-soft: color-mix(in srgb, #f2b84b 12%, transparent);
  --bad: #f28b82; --bad-soft: color-mix(in srgb, #f28b82 12%, transparent);
  --info: #c084fc; --info-soft: color-mix(in srgb, #a855f7 14%, transparent);
  --sk: #2a1742; --sk-hi: #33204d; --scrim: rgba(7, 2, 15, 0.6); --player-bg: #07020f;
  --shadow-pop: 0 0 0 1px color-mix(in srgb, #a855f7 22%, transparent), 0 10px 28px -6px rgba(7, 2, 15, 0.7);
  --shadow-drawer: 0 0 0 1px color-mix(in srgb, #a855f7 18%, transparent), 0 16px 48px -8px rgba(7, 2, 15, 0.8);
  color-scheme: dark;
}

/* ─── 2. Motion off: reduced motion and calm mode ───────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important;
    transition-duration: 0.01ms !important; transition-delay: 0ms !important;
  }
  html { scroll-behavior: auto !important; }
}
html.calm *, html.calm *::before, html.calm *::after {
  animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0ms !important;
  transition-duration: 0.01ms !important; transition-delay: 0ms !important;
}
html.calm { scroll-behavior: auto !important; }
html.calm ::view-transition-group(*), html.calm ::view-transition-old(*), html.calm ::view-transition-new(*) { animation: none !important; }

/* ─── 3. Base ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + var(--s-4)); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--ink);
  font: var(--fw-normal) var(--fs-base)/var(--lh) var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01";
  -webkit-tap-highlight-color: transparent;
}
::selection { background: var(--accent-soft); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; color: var(--ink); font-weight: var(--fw-bold); line-height: var(--lh-tight); letter-spacing: -0.006em; }
h1 { font-size: var(--fs-xl); letter-spacing: -0.015em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-base); }
p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; }
.muted { color: var(--ink-3); }
.small { font-size: var(--fs-sm); }
.ic { width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: -3px; }
.eyebrow { margin: 0 0 2px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink-3); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:is(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.skip { position: fixed; left: var(--s-3); top: var(--s-3); z-index: 200; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow-pop); transform: translateY(-160%); }
.skip:focus { transform: none; }
#app:focus { outline: none; }

/* keyframes */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
@keyframes sink { to { opacity: 0; transform: translateY(4px); } }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.97) translateY(-2px); } }
@keyframes shimmer { to { transform: translateX(100%); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes breathe { 50% { opacity: 0.35; } }
@keyframes indet { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes bump { 40% { transform: scale(1.06); } }
@keyframes tick-in { 0% { transform: scale(0.6); } 60% { transform: scale(1.12); } }
@keyframes swap-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@keyframes reveal { from { opacity: 0.4; transform: scale(0.985); } }
.rise { animation: rise var(--dur-4) var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 50ms); }
.enter { animation: rise var(--dur-3) var(--ease-out) backwards; }
.leave { animation: sink var(--dur-2) var(--ease-in-out) forwards; }
.bump { animation: bump var(--dur-3) var(--ease-out); }
.shake { animation: shake 360ms var(--ease-in-out); }
::view-transition-old(root) { animation: 140ms var(--ease-in-out) both fade reverse; }
::view-transition-new(root) { animation: 180ms var(--ease-out) both fade; }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }

/* the request bar: a hairline at the very top while a request the visitor started is open */
.topbar { position: fixed; inset: 0 0 auto; height: 2px; z-index: 150; overflow: hidden; pointer-events: none; opacity: 0; transition: opacity var(--dur-2); }
.topbar span { position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--accent); }
html.is-busy .topbar { opacity: 1; }
html.is-busy .topbar span { animation: indet 1.1s var(--ease-in-out) infinite; }

/* ─── 4. Components ─────────────────────────────────────────────── */

/* buttons: primary (one per screen), secondary, ghost, danger; sm / lg; icon-only */
.btn {
  --btn-h: 34px;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  min-height: var(--btn-h); padding: 0 var(--s-4); border-radius: var(--r-md);
  border: var(--bw) solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: var(--fw-medium) var(--fs-base)/1 var(--sans); white-space: nowrap; cursor: pointer; text-decoration: none;
  transition: background-color var(--dur-2), border-color var(--dur-2), color var(--dur-2), transform var(--dur-1);
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: var(--surface); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn-sm { --btn-h: 30px; padding: 0 var(--s-3); font-size: var(--fs-sm); }
.btn-lg { --btn-h: 40px; padding: 0 var(--s-5); font-size: var(--fs-md); }
.btn-block { width: 100%; }
@media (hover: hover) {
  .btn:hover { background: var(--surface-2); border-color: var(--line-strong); }
  .btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
  .btn-ghost:hover { background: var(--hover); border-color: transparent; color: var(--ink); }
  .btn-danger:hover { background: color-mix(in srgb, var(--bad) 88%, #000); border-color: transparent; }
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .spin { position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; opacity: 0; }
.btn.is-busy .spin { opacity: 1; animation: spin 0.8s linear infinite; }
.btn.is-busy > :not(.spin) { opacity: 0; }
.btn > :not(.spin) { transition: opacity var(--dur-2); }
.btn:disabled.is-busy { opacity: 1; cursor: progress; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink-3); cursor: pointer;
  transition: background-color var(--dur-2), color var(--dur-2);
}
.icon-btn .ic { width: 18px; height: 18px; }
@media (hover: hover) { .icon-btn:hover { background: var(--hover); color: var(--ink); } }
.icon-btn:active, .icon-btn[aria-expanded="true"].is-pressed { background: var(--active); }

.kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  border: var(--bw) solid var(--line); border-bottom-width: 2px; border-radius: var(--r-xs);
  background: var(--surface); color: var(--ink-3); font: var(--fw-medium) 11px/1 var(--sans); letter-spacing: 0.02em;
}

/* form controls */
form { margin: 0; }
.field { display: grid; gap: 6px; min-width: 0; }
.field + .field, .row + .field, .field + .row, .row + .row { margin-top: var(--s-4); }
.field-lbl { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--ink-2); margin: 0; }
.field-lbl .muted { font-weight: var(--fw-normal); }
input, select, textarea {
  width: 100%; min-height: 36px; padding: 7px 11px;
  border: var(--bw) solid var(--line-strong); border-radius: var(--r-md);
  background: var(--surface); color: var(--ink); font: var(--fw-normal) var(--fs-md)/1.4 var(--sans);
  transition: border-color var(--dur-2), box-shadow var(--dur-2);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); opacity: 0.8; }
@media (hover: hover) { input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--ink) 30%, var(--line-strong)); } }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select {
  appearance: none; padding-right: 32px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
}
textarea { resize: vertical; min-height: 72px; }
.row > .field { margin-top: 0; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-3) var(--s-4); }
.form-error { margin: var(--s-3) 0 0; padding: var(--s-2) var(--s-3); border-radius: var(--r-md); background: var(--bad-soft); color: var(--bad); font-size: var(--fs-sm); }

/* switch */
.switch { display: flex; align-items: flex-start; gap: var(--s-3); cursor: pointer; font-size: var(--fs-base); line-height: 1.45; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.switch-track { position: relative; flex: none; width: 32px; height: 18px; margin-top: 1px; border-radius: var(--r-full); background: var(--line-strong); transition: background-color var(--dur-2); }
.switch-knob { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform var(--dur-3) var(--ease-out); }
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-knob { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* segmented control (theme picker, video tabs) */
.seg { position: relative; display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r-md); background: var(--surface-2); border: var(--bw) solid var(--line); }
.seg label, .seg button {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 30px; height: 28px; padding: 0 var(--s-3); border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-3); font: var(--fw-medium) var(--fs-sm)/1 var(--sans); cursor: pointer;
  transition: color var(--dur-2), background-color var(--dur-2);
}
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; pointer-events: none; }
.seg label:has(input:checked), .seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 var(--bw) var(--line), 0 1px 2px rgba(0, 0, 0, 0.05); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }
@media (hover: hover) { .seg label:hover, .seg button:hover { color: var(--ink); } }
.seg-ind { display: none; }
.seg:empty { display: none; }

/* status badge: a dot and a word, tinted by tone */
.status {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; flex: none;
  border-radius: var(--r-sm); background: var(--surface-2); color: var(--ink-2);
  font-size: var(--fs-xs); font-weight: var(--fw-medium); white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.9; }
.status.t-run { background: var(--accent-soft); color: var(--accent); }
.status.t-run::before { animation: breathe 1.6s ease-in-out infinite; }
.status.t-act { background: var(--warn-soft); color: var(--warn); }
.status.t-ok { background: var(--ok-soft); color: var(--ok); }
.status.t-bad { background: var(--bad-soft); color: var(--bad); }
.status.is-new { animation: pop var(--dur-3) var(--ease-out); }
.tag, .opt { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: var(--r-xs); border: var(--bw) solid var(--line); color: var(--ink-3); font-size: 11px; font-weight: var(--fw-medium); }
.count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--r-full); background: var(--active); color: var(--ink-3); font-size: 11px; font-weight: var(--fw-medium); }

/* card: a bordered surface, no shadow */
.card { position: relative; background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); padding: var(--s-6); }
.card + .card { margin-top: var(--s-4); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-4); }
.card-head h2 { font-size: var(--fs-lg); }
.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); }
.head-txt { min-width: 0; }
.section-h { font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--ink-3); margin: 0 0 var(--s-3); letter-spacing: 0.01em; }

/* callouts */
.note, .fact { display: flex; gap: var(--s-2); align-items: flex-start; margin: var(--s-4) 0 0; padding: var(--s-3); border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-sm); }
.note .ic, .fact .ic { margin-top: 1px; color: var(--ink-3); }
.fact.ok { background: var(--ok-soft); } .fact.ok .ic { color: var(--ok); }
.fact.warn { background: var(--warn-soft); } .fact.warn .ic { color: var(--warn); }

/* details / disclosure */
details > summary { list-style: none; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.logbox > summary, .video details > summary {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 0; color: var(--ink-2); font-size: var(--fs-sm); font-weight: var(--fw-medium); border-radius: var(--r-xs);
}
.logbox > summary::before, .video details > summary::before {
  content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(-45deg); transition: transform var(--dur-2) var(--ease-out); margin-right: 2px;
}
.logbox[open] > summary::before, .video details[open] > summary::before { transform: rotate(45deg); }
@media (hover: hover) { .logbox > summary:hover, .video details > summary:hover { color: var(--ink); } }

/* skeletons */
.sk { position: relative; display: block; overflow: hidden; height: 10px; border-radius: var(--r-xs); background: var(--sk); }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, var(--sk-hi), transparent); animation: shimmer 1.4s infinite; }
.sk-line { height: 10px; margin: 5px 0; }
.sk-title { height: 22px; width: min(320px, 70%); }
.w45 { width: 45%; } .w60 { width: 60%; } .w70 { width: 70%; }

/* empty and error states */
.empty { display: grid; justify-items: center; gap: var(--s-2); padding: var(--s-6) var(--s-4); text-align: center; color: var(--ink-3); font-size: var(--fs-sm); }
.empty b { color: var(--ink); font-weight: var(--fw-bold); font-size: var(--fs-base); }
.empty-ic { display: grid; place-items: center; width: 36px; height: 36px; border-radius: var(--r-md); background: var(--surface); border: var(--bw) solid var(--line); color: var(--ink-3); }
.empty.is-error .empty-ic { color: var(--bad); background: var(--bad-soft); border-color: transparent; }
.empty .btn { margin-top: var(--s-2); }

/* popover and dialog */
.popover {
  position: absolute; left: 0; bottom: calc(100% + 6px); z-index: 80; width: 248px; padding: var(--s-2);
  border-radius: var(--r-lg); background: var(--surface); border: var(--bw) solid var(--line); box-shadow: var(--shadow-pop);
  animation: pop var(--dur-2) var(--ease-out);
}
.pop-h { margin: var(--s-1) var(--s-2) var(--s-2); font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--ink-3); }
.popover .seg { display: flex; margin: 0 var(--s-1); }
.popover .seg label { flex: 1; padding: 0 6px; font-size: var(--fs-xs); }
.pop-sep { height: 1px; margin: var(--s-2) 0; background: var(--line); }
.pop-row {
  display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: 8px var(--s-2); border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--ink); font: var(--fw-normal) var(--fs-base)/1.3 var(--sans); text-align: left; cursor: pointer;
}
.pop-row .ic { color: var(--ink-3); }
.pop-row-t { flex: 1; display: grid; }
.pop-row-t small { font-size: var(--fs-xs); color: var(--ink-3); }
@media (hover: hover) { .pop-row:hover { background: var(--hover); } }
.calm-sw { position: relative; flex: none; width: 28px; height: 16px; border-radius: var(--r-full); background: var(--line-strong); transition: background-color var(--dur-2); }
.calm-sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform var(--dur-3) var(--ease-out); }
.calm-btn[aria-pressed="true"] .calm-sw { background: var(--accent); }
.calm-btn[aria-pressed="true"] .calm-sw::after { transform: translateX(12px); }
.calm-btn[aria-pressed="true"] > .ic { color: var(--accent); }

.dialog {
  width: min(440px, calc(100vw - 32px)); padding: var(--s-5); border: var(--bw) solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-drawer);
}
.dialog[open] { animation: pop var(--dur-3) var(--ease-out); }
.dialog::backdrop { background: var(--scrim); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--s-3); }
.dialog-head h2 { font-size: var(--fs-lg); }
.keys { margin: 0; display: grid; }
.keys > div { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding: 9px 0; border-top: var(--bw) solid var(--line); }
.keys dt { color: var(--ink-2); }
.keys dd { margin: 0; display: flex; gap: 4px; }

/* toasts */
.toasts { position: fixed; right: var(--s-4); bottom: var(--s-4); z-index: 120; display: grid; gap: var(--s-2); justify-items: end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: var(--s-2); max-width: min(380px, calc(100vw - 32px)); padding: 10px 14px;
  border-radius: var(--r-md); background: var(--ink); color: var(--bg); font-size: var(--fs-sm); box-shadow: var(--shadow-pop);
  animation: rise var(--dur-3) var(--ease-out); pointer-events: auto;
}
.toast .ic { color: #f28b82; }
.toast.ok .ic { color: #5dd38a; }
.toast.leave { animation: sink var(--dur-2) var(--ease-in-out) forwards; }

/* ─── 5. App shell ──────────────────────────────────────────────── */
.shell { display: grid; grid-template-columns: var(--sb-w) minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; transition: grid-template-columns var(--dur-3) var(--ease-out); }
html.sb-collapsed .shell { grid-template-columns: 0 minmax(0, 1fr); }
html.view-login .shell { grid-template-columns: minmax(0, 1fr); }
html.view-login .sidebar, html.view-login .appbar, html.view-login .scrim { display: none !important; }

/* sidebar */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; width: var(--sb-w); overflow: hidden;
  display: flex; flex-direction: column; background: var(--sidebar); border-right: var(--bw) solid var(--line);
  transition: transform var(--dur-3) var(--ease-out), visibility 0s;
}
html.sb-collapsed .sidebar { visibility: hidden; transform: translateX(-24px); transition: transform var(--dur-3) var(--ease-out), visibility 0s var(--dur-3); }
.sb-head { display: flex; align-items: center; justify-content: space-between; height: var(--bar-h); padding: 0 var(--s-2) 0 var(--s-4); flex: none; }
.brand { display: inline-flex; align-items: center; gap: var(--s-2); color: var(--ink); border-radius: var(--r-sm); }
.brand:hover { text-decoration: none; }
.mark { display: grid; place-items: center; width: 24px; height: 24px; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-ink); }
.mark svg { width: 16px; height: 16px; }
.word { font-size: var(--fs-md); font-weight: var(--fw-bold); letter-spacing: -0.01em; }
.beta { font-size: 10px; font-weight: var(--fw-medium); color: var(--ink-3); border: var(--bw) solid var(--line-strong); border-radius: var(--r-xs); padding: 1px 4px; }

.sb-new, .sb-search { display: flex; align-items: center; gap: var(--s-2); margin: 0 var(--s-2); padding: 0 var(--s-2) 0 10px; height: 34px; border-radius: var(--r-md); flex: none; }
.sb-new { color: var(--ink); font-weight: var(--fw-medium); }
.sb-new .ic { color: var(--accent); width: 18px; height: 18px; }
.sb-new span { flex: 1; }
.sb-new:hover { text-decoration: none; }
@media (hover: hover) { .sb-new:hover { background: var(--hover); } }
.sb-new[aria-current="page"] { background: var(--active); }
.sb-search { margin-top: 2px; color: var(--ink-3); cursor: text; }
.sb-search input { min-height: 0; height: 30px; padding: 0; border: 0; background: transparent; font-size: var(--fs-base); box-shadow: none; }
.sb-search input:focus { box-shadow: none; }
.sb-search input::-webkit-search-cancel-button { cursor: pointer; }
.sb-search:focus-within { background: var(--surface); box-shadow: 0 0 0 var(--bw) var(--line-strong); }
.sb-search:focus-within .kbd { display: none; }
.sb-new .kbd, .sb-search .kbd { opacity: 0; transition: opacity var(--dur-2); background: transparent; }
@media (hover: hover) { .sidebar:hover .kbd { opacity: 1; } }

.sb-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: var(--s-3) var(--s-2) var(--s-4); }
.sb-label { display: flex; align-items: center; gap: 6px; margin: var(--s-2) var(--s-2) 4px; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink-3); }
.sb-group { margin: var(--s-3) var(--s-2) 2px; font-size: 11px; font-weight: var(--fw-medium); color: var(--ink-3); list-style: none; }
.sb-group:first-child { margin-top: 0; }

/* course rows (sidebar) */
.courses { list-style: none; display: grid; gap: 1px; }
.courses > li { list-style: none; }
.c-row { display: flex; align-items: center; gap: 10px; padding: 7px var(--s-2); border-radius: var(--r-md); color: var(--ink); transition: background-color var(--dur-1); }
.c-row:hover { text-decoration: none; }
@media (hover: hover) { .c-row:hover { background: var(--hover); } }
.c-row[aria-current="page"] { background: var(--active); }
.c-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); opacity: 0.55; }
.c-row.t-run .c-dot { background: var(--accent); opacity: 1; animation: breathe 1.6s ease-in-out infinite; }
.c-row.t-act .c-dot { background: var(--warn); opacity: 1; }
.c-row.t-ok .c-dot { background: var(--ok); opacity: 1; }
.c-row.t-bad .c-dot { background: var(--bad); opacity: 1; }
.c-main { flex: 1; min-width: 0; display: grid; }
.c-title { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--fs-base); line-height: 1.35; }
.c-sub { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.4; }
.c-row.is-act .c-sub b { color: var(--warn); font-weight: var(--fw-medium); }
.c-sub b { font-weight: var(--fw-normal); }
.c-row .tag { height: 16px; font-size: 10px; padding: 0 4px; }
.courses .empty { padding: var(--s-5) var(--s-2); }
.courses .sk-row { padding: 9px var(--s-2); }
.courses .sk-row .sk-line:last-child { height: 8px; }
.no-match { padding: var(--s-3) var(--s-2); color: var(--ink-3); font-size: var(--fs-sm); }

/* sidebar footer: engine, credits, settings */
.sb-foot { position: relative; display: flex; align-items: center; gap: var(--s-2); flex: none; padding: var(--s-2) var(--s-2) var(--s-2) var(--s-4); border-top: var(--bw) solid var(--line); padding-bottom: max(var(--s-2), env(safe-area-inset-bottom)); }
.sb-stats { flex: 1; min-width: 0; display: grid; font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.5; }
.engine { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
.engine .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.engine.ok .dot { background: var(--ok); }
.engine.off .dot { background: var(--bad); }
.engine.off { color: var(--bad); }
.credits b { color: var(--ink-2); font-weight: var(--fw-medium); font-variant-numeric: tabular-nums; }
.menu-wrap { position: relative; }
.menu-wrap .popover { left: auto; right: 0; }

.scrim { position: fixed; inset: 0; z-index: 55; background: var(--scrim); animation: fade var(--dur-2); }

/* main column and app bar */
.main-col { min-width: 0; display: flex; flex-direction: column; }
.appbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: var(--s-2);
  height: var(--bar-h); padding: 0 var(--s-3); padding-left: max(var(--s-3), env(safe-area-inset-left));
  background: color-mix(in srgb, var(--bg) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: var(--bw) solid transparent; transition: border-color var(--dur-2);
}
html.is-scrolled .appbar { border-bottom-color: var(--line); }
.appbar-title { flex: 1; min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--ink-2); opacity: 0; transition: opacity var(--dur-2); }
html.is-scrolled .appbar-title, html.show-title .appbar-title { opacity: 1; }
.appbar-r { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.sb-open { display: none; }
html.sb-collapsed .sb-open { display: inline-grid; }
#pane-toggle[aria-expanded="true"] { color: var(--ink); background: var(--active); }

main { flex: 1; min-width: 0; }
.page { width: 100%; max-width: calc(var(--page-w) + 2 * var(--s-7)); margin: 0 auto; padding: var(--s-4) var(--s-7) var(--s-8); }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-5); }
.page-head h1 { overflow-wrap: anywhere; }
.lead { margin: 6px 0 0; max-width: 62ch; font-size: var(--fs-md); color: var(--ink-2); }
.meta { display: flex; flex-wrap: wrap; gap: 2px var(--s-2); margin: 6px 0 0; color: var(--ink-3); font-size: var(--fs-sm); }
.meta span + span::before { content: "·"; margin-right: var(--s-2); color: var(--line-strong); }
.head-actions { display: flex; align-items: center; gap: var(--s-2); flex: none; padding-top: 3px; }

/* ─── 6. Screens ────────────────────────────────────────────────── */

/* login */
.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: var(--s-5); padding: var(--s-6) var(--s-4); }
.login { width: min(380px, calc(100vw - 32px)); padding: var(--s-7) var(--s-6); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); }
.mark-lg { width: 36px; height: 36px; border-radius: var(--r-md); margin-bottom: var(--s-5); }
.mark-lg svg { width: 22px; height: 22px; }
.login h1 { font-size: var(--fs-xl); }
.lead-sm { margin: 6px 0 var(--s-5); color: var(--ink-3); font-size: var(--fs-base); }
.login .btn { margin-top: var(--s-4); }
.login-foot { margin: 0; font-size: var(--fs-sm); color: var(--ink-3); }
.login-alt { margin: var(--s-3) 0 0; text-align: center; font-size: var(--fs-sm); }
.login-alt + .login-alt { margin-top: var(--s-1); }
.login-alt a, .link-btn { color: var(--ink-2); }
.link-btn { padding: 0; border: 0; background: none; font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link-btn:hover, .login-alt a:hover { color: var(--ink); }
.key-line { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: 0 0 var(--s-2); }
.key-line code { padding: 4px 8px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--ink); font-size: var(--fs-base); letter-spacing: .04em; user-select: all; overflow-wrap: anywhere; }
.key-line .key-link { font-size: var(--fs-xs); letter-spacing: 0; }
.tbl .row-act { text-align: right; white-space: nowrap; }

/* home: the new-course page */
.page-home { max-width: calc(960px + 2 * var(--s-7)); }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 248px; gap: var(--s-6); align-items: start; }
.how { order: 2; position: sticky; top: calc(var(--bar-h) + var(--s-4)); padding-top: var(--s-1); }
.journey { list-style: none; display: grid; gap: 0; }
.journey li { position: relative; display: flex; gap: var(--s-3); padding-bottom: var(--s-4); }
.journey li:not(:last-child)::before { content: ""; position: absolute; left: 11px; top: 26px; bottom: 4px; width: 1px; background: var(--line-strong); }
.j-num { display: grid; place-items: center; width: 23px; height: 23px; flex: none; border-radius: 50%; border: var(--bw) solid var(--line-strong); background: var(--surface); color: var(--ink-3); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.journey li:first-child .j-num { border-color: var(--accent); color: var(--accent); }
.j-txt { display: grid; line-height: 1.4; padding-top: 2px; }
.j-txt b { font-weight: var(--fw-medium); color: var(--ink); }
.j-txt span { font-size: var(--fs-xs); color: var(--ink-3); }
.hero-note { display: flex; gap: var(--s-2); margin: var(--s-1) 0 0; padding-top: var(--s-4); border-top: var(--bw) solid var(--line); font-size: var(--fs-sm); color: var(--ink-3); }
.hero-note .ic { color: var(--ok); margin-top: 2px; }

.form-card { padding: 0; }
.form-card .card-head { padding: var(--s-4) var(--s-6); margin: 0; border-bottom: var(--bw) solid var(--line); }
.form-card .card-head h2 { font-size: var(--fs-base); }
.draft { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--ink-3); opacity: 0; transition: opacity var(--dur-3); }
.draft .ic { width: 14px; height: 14px; color: var(--ok); }
.draft.on { opacity: 1; }
.fstep { margin: 0; padding: var(--s-5) var(--s-6); border: 0; border-bottom: var(--bw) solid var(--line); min-width: 0; }
.fstep legend { float: left; width: 100%; display: flex; align-items: center; gap: 10px; margin: 0 0 var(--s-4); padding: 0; font-size: var(--fs-base); font-weight: var(--fw-bold); color: var(--ink); }
.fstep legend + * { clear: both; }
.f-num { position: relative; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: var(--bw) solid var(--line-strong); color: var(--ink-3); font-size: var(--fs-xs); font-weight: var(--fw-medium); transition: background-color var(--dur-2), border-color var(--dur-2); }
.f-num > * { grid-area: 1 / 1; transition: opacity var(--dur-2), transform var(--dur-3) var(--ease-out); }
.f-num .ic { width: 12px; height: 12px; opacity: 0; transform: scale(0.6); }
.fstep.is-done .f-num { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.fstep.is-done .f-num > span { opacity: 0; }
.fstep.is-done .f-num .ic { opacity: 1; transform: none; }

.drop {
  position: relative; display: grid; justify-items: center; gap: 4px; padding: var(--s-6) var(--s-4); text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg); background: var(--surface-2); transition: border-color var(--dur-2), background-color var(--dur-2);
}
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.drop-ic { display: grid; place-items: center; width: 32px; height: 32px; margin-bottom: 4px; border-radius: var(--r-md); background: var(--surface); border: var(--bw) solid var(--line); color: var(--ink-2); }
.drop-txt { font-size: var(--fs-base); color: var(--ink-2); }
.drop-txt b { color: var(--accent); font-weight: var(--fw-medium); }
.drop-hint { font-size: var(--fs-xs); color: var(--ink-3); }
.hint-act { color: var(--warn); font-weight: var(--fw-medium); }
.drop:hover, .drop.is-over { border-color: var(--accent-line); background: var(--accent-soft); }
.drop:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.drop-files { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: var(--s-2); }
.drop-files:empty { display: none; }
.drop-files { position: relative; z-index: 1; cursor: default; }
.chip-t { overflow: hidden; text-overflow: ellipsis; }
.chip-x { display: grid; place-items: center; width: 18px; height: 18px; min-height: 0; margin: -2px -4px -2px 0; padding: 0; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-3); cursor: pointer; }
.chip-x .ic { width: 11px; height: 11px; }
.chip-x:hover { background: var(--hover); color: var(--ink); }
.chip-x:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 8px; border-radius: var(--r-sm); background: var(--surface); border: var(--bw) solid var(--line); font-size: var(--fs-xs); color: var(--ink-2); animation: pop var(--dur-3) var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 40ms); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .ic { width: 13px; height: 13px; color: var(--ink-3); }
.drop.has-files { border-style: solid; border-color: var(--line); background: var(--surface); padding: var(--s-4); }

.mode { display: grid; gap: var(--s-2); }
.mode-opts { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }
.mode-opt { position: relative; display: flex; align-items: center; gap: var(--s-2); padding: 10px var(--s-3); border-radius: var(--r-md); border: var(--bw) solid var(--line-strong); cursor: pointer; font-size: var(--fs-sm); transition: border-color var(--dur-2), background-color var(--dur-2); }
.mode-opt input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.mode-opt b { font-weight: var(--fw-bold); color: var(--ink); margin-right: 4px; }
@media (hover: hover) { .mode-opt:hover { background: var(--hover); } }
.mode-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 var(--bw) var(--accent); }
.mode-opt:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.mode .muted.small { margin: 0; }

.opts { margin-top: var(--s-4); border: var(--bw) solid var(--line); border-radius: var(--r-md); }
.opts > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: 10px var(--s-3); font-size: var(--fs-sm); border-radius: var(--r-md); }
@media (hover: hover) { .opts > summary:hover { background: var(--hover); } }
.opts-sum { color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.opts-edit { flex: none; display: inline-flex; align-items: center; gap: 6px; color: var(--accent); font-weight: var(--fw-medium); }
.opts-edit::after { content: ""; width: 6px; height: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform var(--dur-2); }
.opts[open] .opts-edit::after { transform: rotate(-135deg) translateY(-1px); }
.opts[open] > summary { border-bottom: var(--bw) solid var(--line); border-radius: var(--r-md) var(--r-md) 0 0; }
.opts-body { padding: var(--s-4) var(--s-3); }
.ai-opts { margin-top: var(--s-4); padding-top: var(--s-4); border-top: var(--bw) solid var(--line); }
.ai-opts > .field-lbl { margin-bottom: var(--s-3); color: var(--ink); font-weight: var(--fw-bold); }
.ai-opts .muted { margin: var(--s-3) 0 0; }

.submit { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-4); padding: var(--s-5) var(--s-6); }
.after { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-sm); color: var(--ink-3); }
#new-error { margin: 0 var(--s-6) var(--s-5); }

/* course page: main column + details pane */
.page-course { display: grid; grid-template-columns: minmax(0, 1fr) var(--pane-w); max-width: none; padding: 0; transition: grid-template-columns var(--dur-3) var(--ease-out); }
html.pane-collapsed .page-course { grid-template-columns: minmax(0, 1fr) 0; }
.page-main { width: 100%; max-width: calc(var(--page-w) + 2 * var(--s-7)); margin: 0 auto; padding: var(--s-4) var(--s-7) var(--s-8); min-width: 0; }
.course-head .sk-title { margin-top: 2px; }

.pane {
  position: sticky; top: var(--bar-h); align-self: start; height: calc(100vh - var(--bar-h)); height: calc(100dvh - var(--bar-h));
  overflow-y: auto; overscroll-behavior: contain; background: var(--pane); border-left: var(--bw) solid var(--line);
  width: var(--pane-w); padding: 0 var(--s-5) var(--s-6);
}
html.pane-collapsed .pane { visibility: hidden; }
.pane-head { display: flex; align-items: center; justify-content: space-between; height: 44px; margin: 0 calc(-1 * var(--s-2)) var(--s-1) 0; }
.pane-head h2 { font-size: var(--fs-base); }
.pane-sec { padding: var(--s-4) 0; border-top: var(--bw) solid var(--line); }
.pane-h { margin: 0 0 var(--s-3); font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--ink-3); }
.brief { margin: 0; display: grid; gap: var(--s-2); }
.brief > div { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: var(--s-2); font-size: var(--fs-sm); }
.brief dt { color: var(--ink-3); }
.brief dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

/* course steps (pane): a vertical checklist */
.steps { list-style: none; display: grid; }
.steps li { position: relative; display: flex; align-items: center; gap: 10px; padding: 5px 0; color: var(--ink-3); font-size: var(--fs-sm); }
.steps li:not(:last-child)::after { content: ""; position: absolute; left: 9.5px; top: 25px; height: 12px; width: 1px; background: var(--line-strong); }
.steps li.done:not(:last-child)::after { background: var(--accent-line); }
.sdot { position: relative; display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 50%; border: var(--bw) solid var(--line-strong); background: var(--surface); font-size: 10px; font-weight: var(--fw-medium); }
.sdot > * { grid-area: 1 / 1; }
.sdot .ic { width: 11px; height: 11px; opacity: 0; }
.snum { transition: opacity var(--dur-2); }
.steps li.done { color: var(--ink-2); }
.steps li.done .sdot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.steps li.done .sdot .ic { opacity: 1; }
.steps li.done .snum, .steps li.bad .snum { opacity: 0; }
.steps li.now { color: var(--ink); font-weight: var(--fw-medium); }
.steps li.now .sdot { border: 2px solid var(--accent); color: var(--accent); }
.steps li.now.wait .sdot { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.steps li.now.wait { color: var(--warn); }
.steps li.bad { color: var(--bad); }
.steps li.bad .sdot { border-color: var(--bad); background: var(--bad-soft); }
.steps li.bad .sdot::before { content: "!"; grid-area: 1 / 1; font-weight: var(--fw-bold); color: var(--bad); }
.steps li.stopped .sdot { border-style: dashed; }
.steps li.stopped { color: var(--ink-2); }

/* materials (pane) */
.m-count { font-weight: var(--fw-normal); }
.m-list { list-style: none; display: grid; gap: 2px; margin: 0 calc(-1 * var(--s-2)); }
.m-file { display: flex; align-items: center; gap: var(--s-2); padding: 6px var(--s-2); border-radius: var(--r-md); color: var(--ink); font-size: var(--fs-sm); }
.m-file:hover { text-decoration: none; }
@media (hover: hover) { .m-file:hover { background: var(--hover); } .m-file:hover .ic:last-child { opacity: 1; } }
.m-file span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-file .ic { color: var(--ink-3); }
.m-file .ic:last-child { opacity: 0.5; transition: opacity var(--dur-2); }

/* wayfinding strip: now / next / time */
.wayfind { display: grid; grid-template-columns: 1.4fr 1fr 1fr; margin: 0 0 var(--s-4); border: var(--bw) solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.wayfind > div { padding: var(--s-3) var(--s-4); min-width: 0; }
.wayfind > div + div { border-left: var(--bw) solid var(--line); }
.wayfind dt { font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: 2px; }
.wayfind dd { margin: 0; font-size: var(--fs-base); font-weight: var(--fw-medium); color: var(--ink); }
.wayfind[data-tone="act"] > div:first-child { background: var(--warn-soft); }
.wayfind[data-tone="act"] > div:first-child dd { color: var(--warn); }
.wayfind[data-tone="ok"] > div:first-child dd { color: var(--ok); }
.wayfind[data-tone="bad"] > div:first-child dd { color: var(--bad); }

/* confirm and revise panels */
.confirm, .revise { margin: 0 0 var(--s-4); padding: var(--s-4); border-radius: var(--r-lg); background: var(--surface); border: var(--bw) solid var(--line-strong); }
.revise { margin: var(--s-4) 0 0; background: var(--surface-2); border-color: var(--line); display: grid; gap: var(--s-2); }
.confirm-q { margin: 0 0 4px; font-weight: var(--fw-bold); color: var(--ink); }
.confirm .muted { margin: 0; font-size: var(--fs-sm); }
.confirm-btns { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--s-2); margin-top: var(--s-3); }
.revise textarea { width: 100%; }
.revise p { margin: 0; }
#c-revise-len { float: right; font-variant-numeric: tabular-nums; }
.cancel-open { color: var(--ink-3); }
@media (hover: hover) { .cancel-open:hover { color: var(--bad); background: var(--bad-soft); } }

/* progress card */
.progress .card-head { margin-bottom: var(--s-3); }
.pct { font-size: var(--fs-lg); font-weight: var(--fw-medium); color: var(--accent); font-variant-numeric: tabular-nums; }
.nowline { display: flex; align-items: center; flex-wrap: wrap; gap: 4px var(--s-2); margin: 0 0 var(--s-3); font-size: var(--fs-md); }
.nl-lbl { font-size: var(--fs-xs); color: var(--ink-3); }
#c-nowline { font-weight: var(--fw-medium); }
#c-nowline.swap { animation: swap-in var(--dur-3) var(--ease-out); }
.live { position: relative; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: breathe 1.6s ease-in-out infinite; }
.bar { position: relative; height: 6px; border-radius: var(--r-full); background: var(--surface-2); box-shadow: inset 0 0 0 var(--bw) var(--line); overflow: hidden; }
.bar > div { height: 100%; border-radius: inherit; background: var(--accent); transform-origin: left; transform: scaleX(0); transition: transform var(--dur-5) var(--ease-out); }
.progress.is-full .bar > div { transition-duration: 480ms; }
.clock { display: flex; justify-content: space-between; gap: var(--s-3); margin: var(--s-2) 0 var(--s-4); font-size: var(--fs-sm); color: var(--ink-3); font-variant-numeric: tabular-nums; }
#c-left { color: var(--ink-2); }
.track { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2px var(--s-4); margin-bottom: var(--s-4); }
.track li { display: flex; align-items: center; gap: 10px; padding: 5px 0; color: var(--ink-3); font-size: var(--fs-sm); }
.t-dot { display: grid; place-items: center; width: 18px; height: 18px; flex: none; border-radius: 50%; border: var(--bw) solid var(--line-strong); }
.t-dot .ic { width: 10px; height: 10px; opacity: 0; }
.track li.done { color: var(--ink-2); }
.track li.done .t-dot { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.track li.done .t-dot .ic { opacity: 1; }
.track li.now { color: var(--ink); font-weight: var(--fw-medium); }
.track li.now .t-dot { border: 2px solid var(--accent); border-right-color: transparent; animation: spin 0.9s linear infinite; }
.track li.tick .t-dot { animation: tick-in var(--dur-3) var(--ease-out); }
.logbox { margin-top: var(--s-2); }
.logbox p { margin: var(--s-2) 0 var(--s-3); font-size: var(--fs-sm); color: var(--ink-2); overflow-wrap: anywhere; }
.leave-ok { margin: var(--s-4) 0 0; padding-top: var(--s-3); border-top: var(--bw) solid var(--line); }

.ai-line { margin: var(--s-2) 0 0; padding: 6px 10px; border-radius: var(--r-md); background: var(--surface-2); color: var(--ink-2); font-size: var(--fs-xs); }
.steplog { list-style: none; margin: var(--s-2) 0 0; padding: var(--s-2) var(--s-3); background: var(--surface-2); border: var(--bw) solid var(--line); border-radius: var(--r-md); display: grid; gap: 2px; max-height: 420px; overflow: auto; font-size: var(--fs-sm); }
.steplog .enter { animation: rise var(--dur-3) var(--ease-out) backwards; }
.sd-note { padding: 10px 0 4px; font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--ink-3); }
.sd-note:first-child { padding-top: 2px; }
.sd { display: flex; gap: 10px; padding: 5px 0; color: var(--ink-2); }
.sd-dot { flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; border: 2px solid var(--line-strong); }
.sd-done .sd-dot { background: var(--accent); border-color: var(--accent); }
.sd-now .sd-dot { border-color: var(--accent); border-right-color: transparent; animation: spin 0.9s linear infinite; }
.sd-check .sd-dot, .sd-retry .sd-dot { background: var(--warn-soft); border-color: var(--warn); }
.sd-fail .sd-dot { background: var(--bad-soft); border-color: var(--bad); }
.sd-main { min-width: 0; flex: 1; }
.sd-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.sd-now .sd-lbl { color: var(--ink); font-weight: var(--fw-medium); }
.sd-try, .sd-tag { font-size: 11px; padding: 0 6px; border-radius: var(--r-xs); background: var(--surface); border: var(--bw) solid var(--line); color: var(--ink-3); }
.sd-check .sd-tag, .sd-retry .sd-tag { background: var(--warn-soft); border-color: transparent; color: var(--warn); }
.sd-fail .sd-tag { background: var(--bad-soft); border-color: transparent; color: var(--bad); }
.sd-dur { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink-3); font-size: var(--fs-xs); }
.sd-facts { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 2px; font-size: var(--fs-xs); color: var(--ink-3); }
.sd-facts span { overflow-wrap: anywhere; }
@media (prefers-reduced-motion: reduce) { .sd-now .sd-dot, .track li.now .t-dot, .live, .status.t-run::before, .c-row.t-run .c-dot { animation: none; } }
html.calm :is(.sd-now .sd-dot, .track li.now .t-dot, .live, .status.t-run::before, .c-row.t-run .c-dot) { animation: none; }

/* review gates */
.gate { margin-bottom: var(--s-2); }
.gate-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-xs); font-weight: var(--fw-medium); }
.gate-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.review > h2 { margin-bottom: var(--s-2); }
.review > .muted { margin: 0 0 var(--s-2); }
.rev-note { display: inline-flex; margin: 0 0 var(--s-2); padding: 2px 8px; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink-2); background: var(--surface-2); border: var(--bw) solid var(--line); }
.sub { display: flex; align-items: center; gap: var(--s-2); margin: var(--s-6) 0 var(--s-3); font-size: var(--fs-base); }
.sub-num { display: inline-grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 50%; background: var(--surface-2); border: var(--bw) solid var(--line); color: var(--ink-3); font-size: 11px; font-weight: var(--fw-medium); }

.plan { display: grid; gap: var(--s-4); }
.module h3 { margin: 0 0 var(--s-2); font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--ink-3); }
.module { display: grid; gap: var(--s-2); animation: rise var(--dur-4) var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 60ms); }
.video { position: relative; display: flex; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-md); border: var(--bw) solid var(--line); background: var(--surface); cursor: pointer; transition: border-color var(--dur-2), background-color var(--dur-2); }
.video input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.radio { position: relative; flex: none; width: 16px; height: 16px; margin-top: 2px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: var(--surface); transition: border-color var(--dur-2); }
.radio::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: var(--accent); transform: scale(0); transition: transform var(--dur-3) var(--ease-out); }
@media (hover: hover) { .video:hover { border-color: var(--line-strong); } }
.video:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 var(--bw) var(--accent); }
.video:has(input:checked) .radio { border-color: var(--accent); }
.video:has(input:checked) .radio::after { transform: scale(1); }
.video:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.video > div { min-width: 0; flex: 1; }
.v-title { font-weight: var(--fw-bold); color: var(--ink); margin-right: var(--s-2); }
.v-meta { font-size: var(--fs-xs); color: var(--ink-3); }
.pilot-tag { display: none; margin-left: var(--s-2); padding: 1px 6px; border-radius: var(--r-xs); background: var(--accent); color: var(--accent-ink); font-size: 10px; font-weight: var(--fw-bold); vertical-align: 1px; }
.video:has(input:checked) .pilot-tag { display: inline-block; }
.video p { margin: 4px 0 6px; color: var(--ink-2); }
.video details { margin-top: 2px; }
.d-body { margin-top: var(--s-2); padding: var(--s-3); border-radius: var(--r-md); background: var(--surface); border: var(--bw) solid var(--line); font-size: var(--fs-sm); color: var(--ink-2); }
.d-body ul { margin: 0 0 var(--s-2); padding-left: 18px; }
.d-body p { margin: 0 0 var(--s-2); }
.d-h { margin: var(--s-3) 0 4px !important; font-size: var(--fs-xs); font-weight: var(--fw-bold); color: var(--ink-3); }
.d-body .d-h:first-child { margin-top: 0 !important; }
.q { display: flex; gap: 6px; }
.voice { display: grid; gap: var(--s-4); }
.reveal-field { padding-left: 44px; }
@media (max-width: 560px) { .reveal-field { padding-left: 0; } }

/* voice picker: the chosen voice, then a searchable list with a sample button per voice */
.vp { display: grid; gap: var(--s-3); min-width: 0; }
.vp-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); font-size: var(--fs-base); }
.vp-body { display: grid; gap: var(--s-3); padding: var(--s-3); border: var(--bw) solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.vp-filters { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); gap: var(--s-2); align-items: end; }
.vp-filters .field { margin-top: 0; }
@media (max-width: 560px) { .vp-filters { grid-template-columns: 1fr 1fr; } .vp-filters .field:first-child { grid-column: 1 / -1; } }
.vp-state:empty { display: none; }
.vp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; max-height: 320px; overflow-y: auto; overscroll-behavior: contain; }
.vp-row { display: flex; align-items: center; gap: var(--s-2); padding: 4px; border-radius: var(--r-md); border: var(--bw) solid transparent; }
.vp-row:hover { background: var(--hover); }
.vp-row.is-on { background: var(--accent-soft); border-color: var(--accent-line); }
.vp-play { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: var(--bw) solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.vp-play:hover { border-color: var(--accent); color: var(--accent); }
.vp-play.is-playing { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.vp-play.is-playing .ic { animation: vp-pulse 1s ease-in-out infinite; }
.vp-play.is-none { border-style: dashed; cursor: default; opacity: 0.4; }
.vp-play:focus-visible, .vp-pick:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.vp-pick { flex: 1; min-width: 0; display: grid; gap: 1px; text-align: left; padding: 4px 6px; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer; border-radius: var(--r-sm, 6px); }
.vp-pick .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-transform: none; }
.vp-badge { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: var(--fs-xs); background: var(--accent-soft); color: var(--accent); vertical-align: 1px; }
.vp-adv summary { cursor: pointer; font-size: var(--fs-sm); color: var(--ink-2); }
.vp-adv .field { margin-top: var(--s-2); }
.st-voice { margin-top: var(--s-4); }
@keyframes vp-pulse { 50% { opacity: 0.55; } }
@media (prefers-reduced-motion: reduce) { .vp-play.is-playing .ic { animation: none; } }

.approve-bar {
  position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3);
  margin: var(--s-6) calc(-1 * var(--s-6)) calc(-1 * var(--s-6)); padding: var(--s-3) var(--s-6); padding-bottom: max(var(--s-3), env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-top: var(--bw) solid var(--line); border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.pick-sum { display: flex; align-items: center; gap: var(--s-2); margin: 0; font-size: var(--fs-sm); min-width: 0; }
.pick-sum b { font-weight: var(--fw-bold); }
.approve-btns { display: flex; flex-wrap: wrap; gap: var(--s-2); }
.approve-btns #c-revise-open[disabled] { opacity: 0.5; cursor: not-allowed; }

/* result */
.ready { display: flex; align-items: center; gap: var(--s-4); margin: 0 0 var(--s-5); padding: var(--s-4); border-radius: var(--r-md); background: var(--ok-soft); }
.ready.reveal { animation: reveal var(--dur-4) var(--ease-out); }
.ready-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--ok); color: #fff; }
.ready-ic .ic { width: 18px; height: 18px; }
.ready h2 { font-size: var(--fs-lg); }
.ready p { margin: 2px 0 0; }
.result-head { align-items: flex-end; margin-bottom: var(--s-4); }
.result-head h2 { overflow-wrap: anywhere; }
.player { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: var(--player-bg); border: var(--bw) solid var(--line); }
.player::before { content: ""; position: absolute; inset: 0; margin: auto; width: 24px; height: 24px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.4); border-right-color: transparent; opacity: 0; transition: opacity var(--dur-2); }
.player.is-loading::before { opacity: 1; animation: spin 0.9s linear infinite; }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; transition: opacity var(--dur-3); }
.player.is-loading iframe { opacity: 0.35; }
.player:fullscreen { border-radius: 0; border: 0; }
.under { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-top: var(--s-2); }
.ai-note { display: flex; align-items: center; gap: 6px; margin: 0; font-size: var(--fs-xs); color: var(--ink-3); }
.ai-note .ic { width: 14px; height: 14px; }
.more { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-3) var(--s-4); margin-top: var(--s-5); padding: var(--s-4); border-radius: var(--r-md); border: var(--bw) solid var(--warn-soft); background: color-mix(in srgb, var(--warn-soft) 55%, transparent); }
.more .gate { margin-bottom: 6px; }
.more-q { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-top: var(--s-5); padding-top: var(--s-5); border-top: var(--bw) solid var(--line); }

/* failed / not available */
.error-card { display: flex; gap: var(--s-4); border-color: color-mix(in srgb, var(--bad) 30%, var(--line)); }
.error-card h2 { margin-bottom: 4px; }
.err-ic { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--r-md); background: var(--bad-soft); color: var(--bad); }
.err-ic .ic { width: 18px; height: 18px; }
.err-lead { margin-bottom: var(--s-3); }
.error-card .btn { margin-top: var(--s-4); }

/* milestone burst: a ring and a few bits from the milestone's element */
.burst { position: fixed; z-index: 130; width: 0; height: 0; pointer-events: none; }
.burst > * { position: absolute; left: 0; top: 0; will-change: transform, opacity; }
.burst b { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--accent); }
.burst i { width: 6px; height: 6px; border-radius: 50%; }
.burst i.sq { border-radius: 1px; width: 5px; height: 9px; }
.burst .c0 { background: var(--accent); } .burst .c1 { background: var(--ok); } .burst .c2 { background: var(--violet); } .burst .c3 { background: var(--pink); }

/* ─── 7. Responsive ─────────────────────────────────────────────── */

/* the details pane floats over the page below 1180 px */
@media (max-width: 1179px) {
  .page-course, html.pane-collapsed .page-course { grid-template-columns: minmax(0, 1fr); }
  .pane {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; height: auto; width: min(340px, 88vw);
    box-shadow: var(--shadow-drawer); border-left: 0; transform: translateX(105%); visibility: hidden;
    transition: transform var(--dur-3) var(--ease-out), visibility 0s var(--dur-3);
  }
  html.pane-collapsed .pane { visibility: hidden; }
  html.pane-open .pane { transform: none; visibility: visible; transition: transform var(--dur-3) var(--ease-out), visibility 0s; }
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .how { order: 0; position: static; padding: 0; }
  .journey { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-3); }
  .journey li { flex-direction: column; gap: 6px; padding: 0; }
  .journey li:not(:last-child)::before { left: 30px; right: -6px; top: 11px; bottom: auto; width: auto; height: 1px; }
  .hero-note { border-top: 0; padding-top: var(--s-3); }
}

/* the sidebar becomes a drawer below 900 px */
@media (max-width: 899px) {
  .shell, html.sb-collapsed .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60; width: min(300px, 86vw); height: auto;
    box-shadow: var(--shadow-drawer); border-right: 0; transform: translateX(-105%); visibility: hidden;
    transition: transform var(--dur-3) var(--ease-out), visibility 0s var(--dur-3);
  }
  html.sb-collapsed .sidebar { transform: translateX(-105%); }
  html.sb-open .sidebar { transform: none; visibility: visible; transition: transform var(--dur-3) var(--ease-out), visibility 0s; }
  .sb-open { display: inline-grid; }
  .sb-new .kbd, .sb-search .kbd { display: none; }
}

@media (max-width: 720px) {
  :root { --bar-h: 48px; }
  .page, .page-main { padding: var(--s-2) var(--s-4) var(--s-7); }
  .page-head { flex-direction: column; gap: var(--s-3); margin-bottom: var(--s-4); }
  .head-actions { padding-top: 0; flex-wrap: wrap; }
  .card { padding: var(--s-4); border-radius: var(--r-md); }
  .form-card { padding: 0; }
  .card + .card { margin-top: var(--s-3); }
  .form-card .card-head, .fstep, .submit { padding-left: var(--s-4); padding-right: var(--s-4); }
  #new-error { margin: 0 var(--s-4) var(--s-4); }
  .submit .btn { width: 100%; }
  .journey { grid-template-columns: 1fr 1fr; }
  .journey li { flex-direction: row; }
  .journey li::before { display: none; }
  .wayfind { grid-template-columns: 1fr; }
  .wayfind > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s-3); padding: 8px var(--s-3); }
  .wayfind > div + div { border-left: 0; border-top: var(--bw) solid var(--line); }
  .wayfind dt { flex: none; margin: 0; }
  .wayfind dd { text-align: right; }
  .result-head { flex-direction: column; align-items: stretch; }
  .seg-vids { align-self: flex-start; max-width: 100%; overflow-x: auto; }
  .player { aspect-ratio: 4 / 5; }
  .approve-bar { margin: var(--s-5) calc(-1 * var(--s-4)) calc(-1 * var(--s-4)); padding-left: var(--s-4); padding-right: var(--s-4); border-radius: 0 0 var(--r-md) var(--r-md); }
  .approve-btns, .approve-btns .btn { width: 100%; }
  .approve-btns { flex-direction: column-reverse; }
  .actions .btn { flex: 1 1 calc(50% - var(--s-2)); }
  .more .btn { width: 100%; }
  .error-card { flex-direction: column; }
  .reveal-field { padding-left: 0; }
  .toasts { left: var(--s-3); right: var(--s-3); bottom: var(--s-3); justify-items: stretch; }
  :root:has(#c-review:not([hidden])) .toasts { bottom: 136px; }
  .login { padding: var(--s-6) var(--s-5); }
}
@media (max-width: 380px) {
  .mode-opts { grid-template-columns: 1fr; }
  .journey { grid-template-columns: 1fr; }
}

/* ─── Account ───────────────────────────────────────────────────── */
/* avatar: a picture, or the initials on a soft accent disc */
.avatar { position: relative; display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; overflow: hidden;
  background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: var(--fw-bold); letter-spacing: 0.02em;
  box-shadow: inset 0 0 0 var(--bw) var(--accent-line); }
.avatar.has-img { box-shadow: inset 0 0 0 var(--bw) var(--line); background: var(--surface-2); }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-lg); }
.avatar-xl { width: 88px; height: 88px; font-size: 1.75rem; }
.avatar.is-busy::after { content: ""; position: absolute; inset: 0; background: color-mix(in srgb, var(--surface) 60%, transparent); }
.avatar.bump { animation: pop var(--dur-3) var(--ease-out); }

/* sidebar footer: the account row */
.sb-acct { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s-2); margin: 0 0 0 calc(-1 * var(--s-2)); padding: 6px var(--s-2);
  border-radius: var(--r-md); color: inherit; text-decoration: none; transition: background-color var(--dur-1); }
.sb-acct:hover { background: var(--hover); text-decoration: none; }
.sb-acct[aria-current="page"] { background: var(--active); }
.sb-acct:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sb-acct .sb-stats { flex: 1; }
.sb-name { color: var(--ink); font-size: var(--fs-sm); font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-meta { display: flex; align-items: center; gap: var(--s-2); min-width: 0; white-space: nowrap; }
.sb-meta .engine .pill-txt { overflow: hidden; text-overflow: ellipsis; }

/* header and section tabs */
.acct-head { align-items: center; }
.acct-id { display: flex; align-items: center; gap: var(--s-4); min-width: 0; }
.acct-id .head-txt { min-width: 0; }
.acct-id h1 { margin: 0; }
.acct-id p { margin: 2px 0 0; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 2px; margin: 0 0 var(--s-5); border-bottom: var(--bw) solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; flex: none; padding: var(--s-2) var(--s-3) 10px; color: var(--ink-3); font-size: var(--fs-sm); font-weight: var(--fw-medium);
  text-decoration: none; white-space: nowrap; border-radius: var(--r-sm) var(--r-sm) 0 0; transition: color var(--dur-1); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::after { content: ""; position: absolute; left: var(--s-3); right: var(--s-3); bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.tabs a:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.a-body.enter { animation: rise var(--dur-3) var(--ease-out); }

/* stat tiles */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-4); }
.stat-grid .card + .card { margin-top: 0; }
.stat { display: grid; gap: 2px; padding: var(--s-4) var(--s-5); color: inherit; text-decoration: none; }
a.stat { transition: border-color var(--dur-1); }
a.stat:hover { border-color: var(--line-strong); }
.stat-lbl { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink-3); }
.stat-num { font-size: var(--fs-xl); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; line-height: 1.25; }
.stat-xl { font-size: 2rem; }
.stat-sub { font-size: var(--fs-xs); color: var(--ink-3); }

/* profile completeness */
.meter { height: 6px; border-radius: var(--r-full); background: var(--surface-2); box-shadow: inset 0 0 0 var(--bw) var(--line); overflow: hidden; }
.meter span { display: block; height: 100%; width: var(--v, 0%); border-radius: inherit; background: var(--accent); transition: width var(--dur-5) var(--ease-out); }
.todo { list-style: none; margin: var(--s-3) 0 0; padding: 0; display: grid; gap: 2px; }
.todo a, .todo .done { display: flex; align-items: center; gap: var(--s-2); padding: 6px var(--s-2); margin: 0 calc(-1 * var(--s-2)); border-radius: var(--r-sm); color: var(--ink-2); text-decoration: none; font-size: var(--fs-sm); }
.todo a:hover { background: var(--hover); color: var(--ink); }
.todo a span { flex: 1; }
.todo .ic { width: 15px; height: 15px; color: var(--ink-3); }
.todo .done .ic { color: var(--ok); }
.ctx { margin-top: var(--s-3); }
.empty-line { color: var(--ink-3); font-size: var(--fs-sm); margin: var(--s-2) 0 0; }

/* forms */
.a-form .row + .row, .a-form .row + .field, .a-form .field + .field { margin-top: var(--s-4); }
.a-h2 { font-size: var(--fs-lg); margin: var(--s-7) 0 var(--s-4); padding-top: var(--s-5); border-top: var(--bw) solid var(--line); }
.a-sub { margin: var(--s-5) 0 var(--s-3); }
.count-hint { justify-self: end; font-variant-numeric: tabular-nums; }
.save-row { display: flex; align-items: center; justify-content: flex-end; gap: var(--s-3); margin-top: var(--s-5); padding-top: var(--s-4); border-top: var(--bw) solid var(--line); }
.a-form.is-dirty .save-state { color: var(--warn); }
.save-state.bump { animation: pop var(--dur-3) var(--ease-out); }
.av-row { display: flex; align-items: center; gap: var(--s-5); margin-bottom: var(--s-5); }
.av-act { display: grid; gap: var(--s-2); }
.av-act .btns { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.av-act p { margin: 0; }
.av-act label.btn { cursor: pointer; }
.av-act label.btn:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.st-sw { margin-top: var(--s-4); }
.seg-wrap { flex-wrap: wrap; justify-self: start; }

/* interests: a tag input and suggestion chips */
.tags-in { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: var(--s-3); padding: 6px; min-height: 42px; cursor: text;
  border: var(--bw) solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); }
.tags-in:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tag-list { display: contents; list-style: none; }
.tag-x { display: inline-flex; align-items: center; gap: 2px; padding: 2px 2px 2px 8px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); animation: pop var(--dur-3) var(--ease-out) backwards; }
.tag-x button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: var(--r-xs); background: none; color: inherit; cursor: pointer; }
.tag-x button:hover { background: var(--accent-soft); }
.tag-x .ic { width: 12px; height: 12px; }
.tags-in input { flex: 1; min-width: 160px; border: 0; outline: 0; background: none; box-shadow: none; padding: 4px; min-height: 0; font: inherit; color: var(--ink); }
.sugg-lbl { margin: var(--s-4) 0 var(--s-2); }
.sugg { display: flex; flex-wrap: wrap; gap: 6px; }
.sugg-b, .pick-b span { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: var(--bw) solid var(--line); border-radius: var(--r-full);
  background: var(--surface); color: var(--ink-2); font: var(--fw-medium) var(--fs-sm)/1 var(--sans); cursor: pointer; transition: border-color var(--dur-1), background-color var(--dur-1), color var(--dur-1); }
.sugg-b:hover, .pick-b:hover span { border-color: var(--line-strong); color: var(--ink); }
.sugg-b .ic, .pick-b .ic { width: 13px; height: 13px; color: var(--ink-3); }
.pick { display: flex; flex-wrap: wrap; gap: 6px; }
.pick-b { position: relative; }
.pick-b input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.pick-b .ic { display: none; }
.pick-b input:checked + span { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.pick-b input:checked + span .ic { display: block; color: var(--accent); }
.pick-b input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

/* credits and payments */
.bal-card { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }
.bal-card > div:first-child { display: grid; gap: 2px; }
.bal-act { display: grid; justify-items: end; gap: 6px; text-align: right; }
.tbl-wrap { overflow-x: auto; margin: 0 calc(-1 * var(--s-2)); }
.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tbl th { text-align: left; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink-3); padding: 0 var(--s-2) var(--s-2); border-bottom: var(--bw) solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px var(--s-2); border-bottom: var(--bw) solid var(--line); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td:first-child { white-space: nowrap; color: var(--ink-3); }
.tbl td b { font-weight: var(--fw-medium); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .pos { color: var(--ok); }
.tbl .neg { color: var(--ink); }

/* usage and courses lists */
.use-list, .co-list { list-style: none; margin: 0; padding: 0; }
.co-list { margin-top: var(--s-4); }
.use-list li + li, .co-list li + li { border-top: var(--bw) solid var(--line); }
.use-list a, .co-list a { display: grid; gap: 6px; padding: var(--s-3) var(--s-2); margin: 0 calc(-1 * var(--s-2)); border-radius: var(--r-sm); color: inherit; text-decoration: none; }
.use-list a:hover, .co-list a:hover { background: var(--hover); }
.use-top { display: flex; justify-content: space-between; gap: var(--s-3); font-size: var(--fs-sm); }
.use-t, .co-t { font-weight: var(--fw-medium); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.use-top b { font-variant-numeric: tabular-nums; font-weight: var(--fw-medium); }
.use-bar { height: 4px; border-radius: var(--r-full); background: var(--surface-2); overflow: hidden; }
.use-bar span { display: block; height: 100%; width: var(--v); border-radius: inherit; background: var(--accent); }
.use-meta, .co-meta { font-size: var(--fs-xs); color: var(--ink-3); }
.co-list a { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.co-main { display: grid; gap: 2px; min-width: 0; }
.co-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.personal-sw { margin-top: var(--s-4); }

@media (max-width: 599px) {
  .acct-head { flex-wrap: wrap; }
  .av-row { align-items: flex-start; }
  .avatar-xl { width: 64px; height: 64px; font-size: 1.25rem; }
  .bal-act { justify-items: start; text-align: left; }
  .tbl td:first-child { white-space: normal; }
}
@media (prefers-reduced-motion: reduce) { .meter span { transition: none; } .tag-x, .a-body.enter { animation: none; } }
html.calm .meter span { transition: none; }
html.calm :is(.tag-x, .a-body.enter, .avatar.bump, .save-state.bump) { animation: none; }
:is(.tabs a, a.stat, .todo a, .use-list a, .co-list a):hover { text-decoration: none; }

/* projects, archive and delete */
.sb-view { gap: 2px; margin-right: 0; }
.sb-view-pick { flex: 1; min-width: 0; display: flex; }
.sb-view select {
  width: auto; max-width: 100%; min-height: 0; height: 26px; padding: 0 22px 0 6px; margin-left: -6px; border-color: transparent; border-radius: var(--r-sm);
  background-color: transparent; background-position: right 4px center; background-size: 12px;
  font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
@media (hover: hover) { .sb-view select:hover { border-color: transparent; background-color: var(--hover); color: var(--ink); } }
.sb-view select:focus { box-shadow: 0 0 0 2px var(--accent-soft); color: var(--ink); }
.sb-view-btn { width: 26px; height: 26px; min-height: 0; flex: none; color: var(--ink-3); }
.sb-view-btn .ic { width: 15px; height: 15px; }
.sb-view .count { flex: none; }
.c-row .tag-proj { max-width: 9em; overflow: hidden; text-overflow: ellipsis; display: inline-block; line-height: 14px; }
.pop-down { top: calc(100% + 6px); bottom: auto; }
.pop-field { margin: 0 var(--s-1); }
.pop-field select { min-height: 32px; font-size: var(--fs-base); }
.pop-danger, .pop-danger .ic { color: var(--bad); }
@media (hover: hover) { .pop-danger:hover { background: var(--bad-soft); } }
.dialog .field { margin-top: var(--s-3); }
.dialog-btns { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-4); }
.dialog-gap { flex: 1; }
.proj-del { color: var(--bad); }
@media (hover: hover) { .proj-del:hover { background: var(--bad-soft); } }
.proj-del.is-armed { background: var(--bad); color: #fff; }
.is-archived-note { color: var(--ink-3); }
.meta .meta-org { display: inline-flex; align-items: center; gap: 6px; }
.meta .meta-org:empty { display: none; }
.meta .meta-org span::before { content: none; }
.meta .tag-proj { gap: 4px; max-width: 16em; }
.meta .tag-proj .ic { width: 12px; height: 12px; flex: none; }

/* ─── Landing page (signed out, #/) ──────────────────────────────── */
.lp { --lp-w: 1120px; position: relative; overflow-x: clip; min-height: 100vh; min-height: 100dvh; }
.lp::before {                                    /* soft violet and teal light behind the hero */
  content: ""; position: absolute; inset: -20vh -10vw auto; height: 110vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(40% 45% at 78% 30%, color-mix(in srgb, var(--violet) 18%, transparent), transparent 70%),
    radial-gradient(35% 40% at 18% 20%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
}
.lp > section, .lp-top, .lp-foot { width: 100%; max-width: calc(var(--lp-w) + 2 * var(--s-6)); margin-inline: auto; padding-inline: var(--s-6); }

.lp-top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--s-5); height: 60px; }
.lp-top::before {
  content: ""; position: absolute; inset: 0 calc(50% - 50vw); z-index: -1;
  background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: var(--bw) solid color-mix(in srgb, var(--line) 70%, transparent);
}
.lp-top .word { font-weight: var(--fw-bold); font-size: var(--fs-md); }
.lp-links { display: flex; gap: var(--s-5); margin-left: auto; font-size: var(--fs-sm); }
.lp-links a { color: var(--ink-2); }
.lp-links a:hover { color: var(--ink); text-decoration: none; }

/* hero */
.lp-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: var(--s-8); padding-block: clamp(40px, 9vh, 96px) clamp(48px, 10vh, 112px); }
.lp-kick { margin: 0 0 var(--s-4); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--accent); letter-spacing: 0.01em; }
.lp-h1 { margin: 0; font-size: clamp(2.1rem, 1.3rem + 3vw, 3.5rem); line-height: 1.08; letter-spacing: -0.03em; font-weight: var(--fw-bold); text-wrap: balance; }
.lp-grad { background: linear-gradient(100deg, var(--accent) 10%, var(--violet) 60%, var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lp-lead { margin: var(--s-5) 0 0; max-width: 34em; font-size: clamp(var(--fs-md), 0.85rem + 0.35vw, 1.0625rem); line-height: 1.6; color: var(--ink-2); }
.lp-cta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-7); }
.lp-cta .btn-lg { --btn-h: 46px; padding: 0 var(--s-6); border-radius: var(--r-md); }
.lp-proof { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); margin: var(--s-6) 0 0; font-size: var(--fs-sm); color: var(--ink-3); }
.lp-proof span::before { content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--accent); vertical-align: 2px; }

/* the hero picture: a page of text flows into a lesson (one 9 s loop) */
.lp-morph { position: relative; display: grid; grid-template-columns: 0.72fr 0.3fr 1.2fr; align-items: center; aspect-ratio: 5 / 3.2; }
.lp-doc {
  position: relative; display: grid; align-content: start; gap: 9px; padding: 18px 16px; aspect-ratio: 3 / 4;
  background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-md); box-shadow: var(--shadow-pop);
  transform: rotate(-4deg); animation: lp-doc 9s var(--ease-in-out) infinite;
}
.lp-doc-h { height: 9px; width: 62%; border-radius: 3px; background: var(--ink-3); opacity: 0.55; margin-bottom: 4px; }
.lp-doc i { display: block; height: 5px; border-radius: 3px; background: var(--line-strong); }
.lp-doc i.s { width: 70%; }
.lp-doc i:nth-of-type(3), .lp-doc i:nth-of-type(6) { background: color-mix(in srgb, var(--accent) 55%, var(--line-strong)); animation: lp-mark 9s var(--ease-in-out) infinite; }
.lp-doc-tag { position: absolute; left: 12px; bottom: 10px; font-size: 10px; color: var(--ink-3); }
.lp-beam { position: relative; height: 2px; margin-inline: -6px; }
.lp-beam span { position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); opacity: 0; animation: lp-fly 9s linear infinite; }
.lp-beam span:nth-child(2) { animation-delay: 0.25s; background: var(--violet); box-shadow: 0 0 12px var(--violet); }
.lp-beam span:nth-child(3) { animation-delay: 0.5s; background: var(--pink); box-shadow: 0 0 12px var(--pink); }
.lp-vid {
  position: relative; display: grid; grid-template-rows: 1fr auto auto; overflow: hidden; aspect-ratio: 16 / 11;
  background: var(--player-bg); border-radius: var(--r-lg); box-shadow: 0 24px 60px -20px color-mix(in srgb, var(--violet) 55%, transparent), 0 0 0 1px color-mix(in srgb, var(--violet) 25%, transparent);
  color: #f2f5fa;
}
.lp-vid-stage { display: flex; align-items: center; padding: 15% 13% 0; min-height: 0; }
.lp-vid-stage svg { display: block; width: 100%; height: auto; overflow: visible; }
.lp-vid .n { fill: #1b2a4a; stroke: #5fe0c8; stroke-width: 2.5; transform-box: fill-box; transform-origin: center; transform: scale(0); animation: lp-pop 9s var(--ease-out) infinite; }
.lp-vid .n2 { stroke: #8fb0ff; animation-delay: 0.35s; } .lp-vid .n3 { stroke: #ffc46b; animation-delay: 0.7s; } .lp-vid .n4 { stroke: #c4a2ff; animation-delay: 1.05s; }
.lp-vid .e { fill: none; stroke: #92a3c2; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 60; stroke-dashoffset: 60; animation: lp-draw 9s var(--ease-out) infinite; }
.lp-vid .e2 { animation-delay: 0.35s; } .lp-vid .e3 { animation-delay: 0.7s; } .lp-vid .e4 { animation-delay: 1.05s; }
.lp-cap { margin: 0; padding: 6px 14px 8px; white-space: nowrap; text-align: center; font-size: clamp(11px, 0.55rem + 0.45vw, 14px); font-weight: var(--fw-medium); }
.lp-cap b { font-weight: inherit; opacity: 0.35; animation: lp-word 9s linear infinite; }
.lp-cap b:nth-child(2) { animation-delay: 0.6s; } .lp-cap b:nth-child(3) { animation-delay: 1.2s; }
.lp-bar { height: 3px; background: rgba(255, 255, 255, 0.12); }
.lp-bar span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #5fe0c8, #c4a2ff); transform-origin: left; transform: scaleX(0); animation: lp-prog 9s linear infinite; }
.lp-quiz {
  position: absolute; right: 10px; top: 10px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px 5px 7px;
  border-radius: var(--r-full); background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.16); font-size: 11px;
  backdrop-filter: blur(6px); opacity: 0; animation: lp-quiz 9s var(--ease-out) infinite;
}
.lp-quiz .ic { width: 14px; height: 14px; color: #6ee7a8; }

@keyframes lp-doc { 0%, 100% { transform: rotate(-4deg) translateY(0); } 50% { transform: rotate(-2deg) translateY(-6px); } }
@keyframes lp-mark { 0%, 8% { opacity: 0.4; } 14%, 70% { opacity: 1; } 85%, 100% { opacity: 0.4; } }
@keyframes lp-fly { 0%, 10% { left: 0; opacity: 0; } 13% { opacity: 1; } 24% { left: calc(100% - 8px); opacity: 1; } 27%, 100% { left: calc(100% - 8px); opacity: 0; } }
@keyframes lp-pop { 0%, 24% { transform: scale(0); } 30%, 86% { transform: scale(1); } 94%, 100% { transform: scale(0); } }
@keyframes lp-draw { 0%, 30% { stroke-dashoffset: 60; } 38%, 86% { stroke-dashoffset: 0; } 94%, 100% { stroke-dashoffset: 60; } }
@keyframes lp-word { 0%, 40% { opacity: 0.35; } 43%, 88% { opacity: 1; } 95%, 100% { opacity: 0.35; } }
@keyframes lp-prog { 0%, 24% { transform: scaleX(0); } 90% { transform: scaleX(1); } 100% { transform: scaleX(0); } }
@keyframes lp-quiz { 0%, 60% { opacity: 0; transform: translateY(-6px); } 66%, 88% { opacity: 1; transform: none; } 95%, 100% { opacity: 0; } }

/* motion off: the finished picture, standing still */
@media (prefers-reduced-motion: reduce) {
  .lp-doc, .lp-doc i, .lp-beam span, .lp-vid .n, .lp-vid .e, .lp-cap b, .lp-bar span, .lp-quiz { animation: none !important; }
  .lp-vid .n { transform: none; } .lp-vid .e { stroke-dashoffset: 0; } .lp-cap b, .lp-quiz { opacity: 1; } .lp-bar span { transform: scaleX(0.62); }
}
html.calm .lp-vid .n { transform: none; } html.calm .lp-vid .e { stroke-dashoffset: 0; } html.calm .lp-cap b, html.calm .lp-quiz { opacity: 1; } html.calm .lp-bar span { transform: scaleX(0.62); }

/* sections */
.lp > section:not(.lp-hero) { padding-block: clamp(48px, 9vh, 96px); scroll-margin-top: 60px; }
.lp-sec-head { max-width: 680px; margin-bottom: var(--s-7); }
.lp-eyebrow { margin: 0 0 var(--s-2); font-size: var(--fs-xs); font-weight: var(--fw-bold); text-transform: uppercase; letter-spacing: 0.08em; color: var(--violet); }
.lp h2 { margin: 0; font-size: clamp(1.5rem, 1.1rem + 1.4vw, 2.25rem); line-height: 1.15; letter-spacing: -0.02em; text-wrap: balance; }
.lp-sub { margin: var(--s-4) 0 0; font-size: var(--fs-md); line-height: 1.6; color: var(--ink-2); }

/* the embedded course */
.lp-frame {
  position: relative; overflow: hidden; aspect-ratio: 16 / 9; max-height: 78vh; width: 100%; border-radius: var(--r-lg); background: #070b15;
  box-shadow: 0 30px 80px -30px color-mix(in srgb, var(--violet) 60%, transparent), 0 0 0 1px color-mix(in srgb, var(--violet) 28%, transparent);
}
.lp-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.lp-poster {
  position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: var(--s-2); text-align: center; color: #f2f5fa;
  background:
    radial-gradient(60% 70% at 50% 110%, rgba(95, 224, 200, 0.22), transparent 70%),
    radial-gradient(50% 60% at 15% 0%, rgba(196, 162, 255, 0.25), transparent 70%),
    repeating-linear-gradient(90deg, rgba(143, 176, 255, 0.07) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(0deg, rgba(143, 176, 255, 0.07) 0 1px, transparent 1px 64px), #0d1526;
}
.lp-poster-glow { position: absolute; left: 50%; top: 50%; width: 260px; height: 260px; margin: -150px 0 0 -130px; border-radius: 50%; background: radial-gradient(circle, rgba(95, 224, 200, 0.35), transparent 65%); animation: lp-breathe 4s var(--ease-in-out) infinite; }
.lp-play {
  position: relative; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; border: 0; cursor: pointer;
  background: #5fe0c8; color: #07101f; box-shadow: 0 0 0 10px rgba(95, 224, 200, 0.16), 0 12px 32px -6px rgba(95, 224, 200, 0.6);
  transition: transform var(--dur-2) var(--ease-out), box-shadow var(--dur-2);
}
.lp-play svg { width: 34px; height: 34px; margin-left: 4px; }
.lp-play:hover { transform: scale(1.06); box-shadow: 0 0 0 14px rgba(95, 224, 200, 0.2), 0 16px 40px -6px rgba(95, 224, 200, 0.7); }
.lp-play:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.lp-poster-t { position: relative; margin: var(--s-4) 0 0; font-size: var(--fs-lg); font-weight: var(--fw-bold); }
.lp-poster-s { position: relative; margin: 0; font-size: var(--fs-sm); color: #92a3c2; }
@keyframes lp-breathe { 0%, 100% { transform: scale(0.9); opacity: 0.7; } 50% { transform: scale(1.1); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .lp-poster-glow { animation: none; } }
.lp-frame-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s-2) var(--s-4); margin: var(--s-3) 0 0; font-size: var(--fs-sm); color: var(--ink-3); }
.lp-frame-foot a { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-weight: var(--fw-medium); }
.lp-frame-foot .ic { width: 14px; height: 14px; }

/* how it works */
.lp-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4); counter-reset: none; }
.lp-steps li { position: relative; padding: var(--s-6) var(--s-5); background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--r-lg); }
.lp-steps li.gate { border-color: var(--accent-line); background: linear-gradient(180deg, var(--accent-soft), transparent 60%), var(--surface); }
.lp-num { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--active); font-size: var(--fs-sm); font-weight: var(--fw-bold); }
.gate .lp-num { background: var(--accent); color: var(--accent-ink); }
.lp-steps h3, .lp-cards h3 { margin: var(--s-4) 0 var(--s-2); font-size: var(--fs-lg); }
.lp-steps p, .lp-cards p { margin: 0; font-size: var(--fs-base); line-height: 1.55; color: var(--ink-2); }
.lp-gate { position: absolute; top: var(--s-6); right: var(--s-5); font-size: 11px; font-weight: var(--fw-bold); color: var(--accent); }

/* why */
.lp-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.lp-cards article { padding: var(--s-6) var(--s-5); border-radius: var(--r-lg); border: var(--bw) solid var(--line); background: var(--surface); }
.lp-cards .ic { width: 26px; height: 26px; color: var(--violet); }
.lp-for { margin: var(--s-7) 0 0; max-width: 680px; font-size: var(--fs-md); line-height: 1.6; color: var(--ink-2); }
.lp-for b { color: var(--ink); font-weight: var(--fw-medium); }

.lp-foot { padding-block: var(--s-7) var(--s-8); border-top: var(--bw) solid var(--line); font-size: var(--fs-base); color: var(--ink-2); }
.lp-foot p { margin: 0; }
.lp-foot .link-btn { font: inherit; color: var(--accent); }
.lp-foot a { color: var(--accent); }
.lp-small { margin-top: var(--s-2) !important; font-size: var(--fs-sm); color: var(--ink-3); }

.lp-dlg { width: min(400px, calc(100vw - 32px)); padding: var(--s-6); }
.lp-dlg .dialog-head { margin-bottom: 0; }
.lp-dlg .btn { margin-top: var(--s-4); }

/* tablets and phones */
@media (max-width: 900px) {
  .lp-hero { grid-template-columns: minmax(0, 1fr); gap: var(--s-7); }
  .lp-morph { max-width: 520px; }
  .lp-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .lp > section, .lp-top, .lp-foot { padding-inline: var(--s-4); }
  .lp-links { display: none; }
  .lp-top .btn { margin-left: auto; }
  .lp-steps, .lp-cards { grid-template-columns: minmax(0, 1fr); }
  .lp-frame { aspect-ratio: 4 / 5; max-height: 80vh; }
  .lp-cta .btn-lg { flex: 1 1 auto; }
}

/* footer links (landing page and info pages) */
.lp-foot { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--s-4) var(--s-7); }
.lp-foot-main { min-width: 0; flex: 1 1 360px; }
.lp-foot-nav { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); font-size: var(--fs-sm); }
.lp-foot .lp-foot-nav a { color: var(--ink-2); }
.lp-foot .lp-foot-nav a:hover, .lp-foot .lp-foot-nav a[aria-current="page"] { color: var(--ink); }
.lp-foot .lp-foot-nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 3px; }
.lp-links a[aria-current="page"] { color: var(--ink); }

/* About, Contact, Impressum */
.lp-pg { display: flex; flex-direction: column; }
.lp-pg::before { height: 60vh; }
.lp-article { flex: 1 0 auto; width: 100%; max-width: calc(680px + 2 * var(--s-6)); margin-inline: auto; padding: clamp(40px, 8vh, 80px) var(--s-6) clamp(48px, 9vh, 96px); font-size: var(--fs-md); line-height: 1.65; color: var(--ink-2); }
.lp-article h1 { margin: 0; font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem); line-height: 1.12; letter-spacing: -0.025em; color: var(--ink); text-wrap: balance; }
.lp-article h2 { margin: var(--s-7) 0 var(--s-2); font-size: var(--fs-lg); letter-spacing: -0.01em; color: var(--ink); }
.lp-article p { margin: 0 0 var(--s-3); }
.lp-article .lp-lede { margin-top: var(--s-4); font-size: clamp(var(--fs-md), 0.9rem + 0.3vw, 1.125rem); color: var(--ink-2); }
.lp-article ul { margin: 0 0 var(--s-3); padding-left: 1.2em; }
.lp-article li { margin-bottom: var(--s-2); }
.lp-article li::marker { color: var(--accent); }
.lp-article b { color: var(--ink); font-weight: var(--fw-medium); }
.lp-article address { font-style: normal; color: var(--ink); }
.lp-article a { color: var(--accent); }
.lp-mail {
  display: inline-flex; align-items: center; gap: var(--s-4); margin: var(--s-6) 0 var(--s-2); padding: var(--s-4) var(--s-6) var(--s-4) var(--s-4);
  border: var(--bw) solid var(--accent-line); border-radius: var(--r-lg); background: var(--accent-soft); color: var(--ink) !important;
  transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2);
}
.lp-mail:hover { text-decoration: none; transform: translateY(-1px); border-color: var(--accent); }
.lp-mail > .ic { width: 36px; height: 36px; padding: 8px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.lp-mail-k { display: block; font-size: var(--fs-xs); color: var(--ink-3); }
.lp-mail-v { display: block; font-size: var(--fs-lg); font-weight: var(--fw-bold); overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .lp-article { padding-inline: var(--s-4); }
  .lp-pg .lp-links { display: none; }
}

/* language switch (landing top bar, info pages) */
.lang-sw { display: inline-flex; margin-left: auto; padding: 2px; border: var(--bw) solid var(--line); border-radius: var(--r-full); background: var(--surface); }
.lang-sw button { min-width: 32px; height: 24px; padding: 0 8px; border: 0; border-radius: var(--r-full); background: transparent; color: var(--ink-3); font: inherit; font-size: var(--fs-xs); font-weight: var(--fw-bold); cursor: pointer; }
.lang-sw button:hover { color: var(--ink); }
.lang-sw button[aria-pressed="true"] { background: var(--active); color: var(--ink); }
.lp-links + .lang-sw { margin-left: 0; }
@media (max-width: 640px) { .lp-top .lang-sw { margin-left: auto; } .lp-top .lang-sw + .btn { margin-left: 0; } }

/* 404 page (public/404.html) */
.nf { flex: 1 0 auto; width: 100%; max-width: calc(680px + 2 * var(--s-6)); margin-inline: auto; padding: clamp(48px, 12vh, 120px) var(--s-6) clamp(48px, 10vh, 96px); }
.nf-code {
  font-size: clamp(5rem, 3rem + 10vw, 9rem); line-height: 0.9; font-weight: var(--fw-bold); letter-spacing: -0.05em;
  background: linear-gradient(100deg, var(--accent) 10%, var(--violet) 60%, var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nf h1 { margin: var(--s-5) 0 0; font-size: clamp(1.6rem, 1.15rem + 1.8vw, 2.4rem); line-height: 1.15; letter-spacing: -0.025em; text-wrap: balance; }
.nf-lead { margin: var(--s-4) 0 0; max-width: 34em; font-size: var(--fs-md); line-height: 1.6; color: var(--ink-2); }
.nf-path { margin: var(--s-4) 0 0; }
.nf-path code { display: inline-block; max-width: 100%; padding: 4px 10px; border-radius: var(--r-sm); background: var(--active); color: var(--ink-2); font-size: var(--fs-sm); overflow-wrap: anywhere; }
.nf-cta { display: flex; flex-wrap: wrap; gap: var(--s-3); margin-top: var(--s-7); }
.nf-cta .btn-lg { --btn-h: 46px; padding: 0 var(--s-6); border-radius: var(--r-md); }
@media (max-width: 640px) { .nf { padding-inline: var(--s-4); } .nf-cta .btn-lg { flex: 1 1 auto; } }

/* live examples: external learning worlds (landing page) */
.lx-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-4); }
.lx-card {
  display: flex; flex-direction: column; overflow: hidden; border: var(--bw) solid var(--line); border-radius: var(--r-lg);
  background: var(--surface); color: var(--ink); transition: transform var(--dur-2) var(--ease-out), border-color var(--dur-2), box-shadow var(--dur-2);
}
.lx-card:hover { text-decoration: none; transform: translateY(-3px); border-color: color-mix(in srgb, var(--c1) 55%, var(--line)); box-shadow: 0 18px 40px -20px color-mix(in srgb, var(--c2) 60%, transparent); }
.lx-card:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.lx-art {
  position: relative; display: flex; align-items: baseline; gap: 8px; padding: var(--s-6) var(--s-5) var(--s-5); min-height: 120px; color: #f2f5fa;
  background:
    radial-gradient(80% 120% at 100% 0%, color-mix(in srgb, var(--c2) 45%, transparent), transparent 70%),
    radial-gradient(70% 110% at 0% 100%, color-mix(in srgb, var(--c1) 40%, transparent), transparent 70%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 28px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 28px), #0d1526;
}
.lx-num { font-size: 3.2rem; line-height: 1; font-weight: var(--fw-bold); letter-spacing: -0.04em; background: linear-gradient(100deg, var(--c1), var(--c2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lx-unit { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: #c9d3e6; }
.lx-body { display: flex; flex: 1; flex-direction: column; padding: var(--s-5); }
.lx-tag { margin: 0; font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--ink-3); }
.lx-body h3 { margin: var(--s-2) 0 var(--s-2); font-size: var(--fs-lg); }
.lx-body p:not(.lx-tag) { margin: 0; font-size: var(--fs-base); line-height: 1.55; color: var(--ink-2); }
.lx-go { display: inline-flex; align-items: center; gap: 6px; margin-top: auto; padding-top: var(--s-4); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--accent); }
.lx-go .ic { width: 14px; height: 14px; }
@media (max-width: 900px) { .lx-grid { grid-template-columns: minmax(0, 1fr); } .lx-art { min-height: 96px; } }

/* 3D look picker (new-course form): preset cards with swatches, own colours and fonts, and the live sample course */
.sp { display: grid; gap: var(--s-3); margin-top: var(--s-4); }
.sp-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: var(--s-2); }
.sp-card { position: relative; display: grid; gap: 4px; padding: 6px; border-radius: var(--r-md); border: var(--bw) solid var(--line-strong); cursor: pointer; font-size: var(--fs-sm); }
.sp-card input { position: absolute; opacity: 0; width: 1px; height: 1px; min-height: 0; }
.sp-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 var(--bw) var(--accent); }
.sp-card:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.sp-sw { display: flex; align-items: center; gap: 4px; height: 44px; padding: 0 8px; border-radius: calc(var(--r-md) - 2px); }
.sp-sw i { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.sp-sw b { margin-left: auto; font-size: 18px; font-weight: 800; }
.sp-name { font-weight: var(--fw-bold); color: var(--ink); padding: 0 2px; }
.sp-card .muted { padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-custom { display: grid; gap: var(--s-3); padding: var(--s-3); border: var(--bw) solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.sp-custom .row > .field { margin-top: 0; }
.sp-colors { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); }
.sp-color { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-sm); cursor: pointer; }
.sp-color input { width: 34px; height: 34px; padding: 2px; border-radius: var(--r-md); border: var(--bw) solid var(--line-strong); background: var(--surface); cursor: pointer; min-height: 0; }
.sp-warn { margin: 0; color: var(--bad); }
.sp-preview { display: grid; gap: var(--s-2); }
.sp-preview .muted.small { margin: 0; }
.sp-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2); }
.sp-open { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
.sp-frame { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r-md); overflow: hidden; background: var(--player-bg); border: var(--bw) solid var(--line); }
.sp-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
@media (max-width: 560px) { .sp-frame { aspect-ratio: 4 / 5; } }
/* "Let LernCraft decide" and the consumption prediction (new-course form) */
.auto-sw { margin: var(--s-4) 0 var(--s-2); }
#size-row.is-off { opacity: 0.5; }
.pred { display: grid; gap: var(--s-2); margin-top: var(--s-5); padding: var(--s-3) var(--s-4); border: var(--bw) solid var(--line); border-radius: var(--r-md); background: var(--surface-2); }
.pred-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--s-2); }
.pred-head h3 { margin: 0; font-size: var(--fs-base); font-weight: var(--fw-bold); }
.pred-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-3); margin: 0; }
@media (max-width: 640px) { .pred-grid { grid-template-columns: 1fr; gap: var(--s-2); } }
.pred-grid dt { font-size: var(--fs-xs); color: var(--ink-3); }
.pred-grid dd { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--ink); display: grid; gap: 2px; }
.pred-grid dd .muted { font-size: var(--fs-xs); }
.pred-warn { color: var(--warn); font-size: var(--fs-xs); }
.pred .muted.small { margin: 0; }
/* public profile (Account → Profile) and "show on my profile" (course page) */
.pp-what { margin: 0 0 var(--s-2); }
.pp-handle { display: flex; align-items: stretch; min-width: 0; border: var(--bw) solid var(--line-strong); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
.pp-handle:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.pp-prefix { display: flex; align-items: center; padding: 0 2px 0 var(--s-3); color: var(--ink-3); font-size: var(--fs-sm); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.pp-handle input { flex: 1; min-width: 0; border: 0; background: transparent; box-shadow: none; outline: none; padding-left: 0; }
.pp-link { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-2); margin: var(--s-3) 0 0; font-size: var(--fs-sm); word-break: break-all; }
.pub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s-2) var(--s-4); margin-top: var(--s-4); padding-top: var(--s-4); border-top: var(--bw) solid var(--line); }
.pub-link { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); }
