/* ============================================================
   NEO Trainer Prep Tool — visual system
   "Editorial reading room / live teleprompter desk"
   Type: IBM Plex Serif (headings + reading body),
         IBM Plex Sans (UI), IBM Plex Mono (data/labels)
   Accent: Xiaomi orange, sole accent. Warm paper neutrals.
   ============================================================ */

:root {
  color-scheme: light;

  /* warm paper neutrals */
  --paper: #f4efe6;
  --paper-edge: #ece5d8;
  --surface: #fbf8f2;
  --surface-2: #efe8db;
  --surface-3: #e7dfd0;
  --ink: #211c16;
  --ink-2: #4c453b;
  --muted: #8a8073;
  --faint: #ab9f8d;
  --line: #e4dccc;
  --line-2: #d3c8b3;

  /* Xiaomi orange — sole accent */
  --accent: #ff6900;
  --accent-ink: #c2470a;      /* accessible orange text on paper */
  --accent-soft: #fbe6d3;
  --accent-soft-2: #f6d7bd;

  /* semantic (pace / status) */
  --ok-ink: #4a6b41;
  --ok-soft: #e6efdf;
  --warn-ink: #a2611a;
  --warn-soft: #f7e8cf;

  /* method categories — low-chroma warm-compatible tints */
  --m-direct-bg: #e7edf2;   --m-direct-fg: #345a76;
  --m-story-bg:  #efe6ee;   --m-story-fg:  #6c4670;
  --m-group-bg:  #f5e7d5;   --m-group-fg:  #8a5320;
  --m-whole-bg:  #e5eddf;   --m-whole-fg:  #4a6b3f;
  --m-practice-bg:#f4edd0;  --m-practice-fg:#786220;
  --m-transition-bg:#eae3d5;--m-transition-fg:#6d6558;

  --shadow-sm: 0 1px 2px rgba(48,36,16,.05);
  --shadow: 0 1px 2px rgba(48,36,16,.05), 0 14px 30px -18px rgba(64,46,18,.28);
  --shadow-pop: 0 20px 48px -20px rgba(48,34,12,.4);

  --r: 4px;
  --r-md: 7px;
  --r-lg: 12px;

  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "IBM Plex Serif", ui-serif, Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* live stage tokens — always dark (broadcast desk) */
  --stage-bg: #14110c;
  --stage-surface: #1e1a13;
  --stage-surface-2: #272115;
  --stage-ink: #f3ecdd;
  --stage-ink-2: #d8ceba;
  --stage-muted: #a99d88;
  --stage-line: #372f22;
  --stage-line-2: #4a3f2d;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #16130d;
    --paper-edge: #100e09;
    --surface: #211c14;
    --surface-2: #2a241a;
    --surface-3: #342c1f;
    --ink: #f0e8d9;
    --ink-2: #cdc2ad;
    --muted: #9c9080;
    --faint: #7d7161;
    --line: #322b20;
    --line-2: #443b2c;

    --accent: #ff7a1f;
    --accent-ink: #ff9a54;
    --accent-soft: #38230f;
    --accent-soft-2: #462c11;

    --ok-ink: #9cc088;
    --ok-soft: #21301a;
    --warn-ink: #e2a85a;
    --warn-soft: #33260f;

    --m-direct-bg: #1c2a33;   --m-direct-fg: #8fb6d0;
    --m-story-bg:  #2b2130;   --m-story-fg:  #c4a0c8;
    --m-group-bg:  #33260f;   --m-group-fg:  #d9a566;
    --m-whole-bg:  #1f2c1a;   --m-whole-fg:  #9cc088;
    --m-practice-bg:#2f2810;  --m-practice-fg:#d3bd6a;
    --m-transition-bg:#282216;--m-transition-fg:#b0a48f;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 16px 34px -18px rgba(0,0,0,.7);
    --shadow-pop: 0 24px 54px -20px rgba(0,0,0,.75);
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.live-active { background: var(--paper); }
body.lightbox-open { overflow: hidden; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

img { display: block; max-width: 100%; height: auto; }

a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

::selection { background: var(--accent-soft-2); color: var(--ink); }

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

.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;
}

/* ---------------------------------------------------------
   Header
   --------------------------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 12px 16px;
  align-items: center;
  padding: 12px clamp(16px, 4vw, 32px);
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
/* Home: brand cluster left, MiWork script links right — no off-center course pills */
body.is-home .app-header {
  grid-template-columns: auto auto 1fr auto;
}
body.is-home .course-nav:empty {
  display: none;
}
body.is-home .mode-nav {
  justify-content: flex-end;
  grid-column: 4;
}
body.has-course .course-nav {
  justify-content: center;
}
a.nav-link {
  text-decoration: none;
  color: var(--muted);
}
a.nav-link:hover {
  color: var(--ink);
  text-decoration: none;
  background: var(--surface-2);
}

.brand-button {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 4px;
  margin: -4px;
  border-radius: var(--r);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: 0 3px 8px -2px rgba(255,105,0,.5);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
}

.brand-text {
  white-space: nowrap;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.02rem;
  letter-spacing: -.005em;
}

.help-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-weight: 600;
  font-size: .9rem;
  box-shadow: var(--shadow-sm);
}
.help-button:hover {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2));
}

.course-nav, .mode-nav {
  display: flex;
  min-width: 0;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.course-nav { justify-content: center; }
.mode-nav { justify-content: flex-end; }

.nav-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-weight: 500;
  font-size: .875rem;
  padding: 7px 13px;
  border-radius: var(--r-md);
  white-space: nowrap;
  transition: color .15s, background .15s, border-color .15s;
}
.nav-button:hover { color: var(--ink); background: var(--surface-2); }
.course-nav .nav-button[aria-current="true"] {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.mode-nav .nav-button[aria-current="true"] {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-2);
  box-shadow: var(--shadow-sm);
}
.mode-nav .nav-button[aria-current="true"]::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}

/* Dual labels: full on desktop, short on narrow */
.nav-label-short { display: none; }
.nav-label-full { display: inline; }

/* Live mode keeps the same light/dark header as the rest of the app */
body.live-active .app-header {
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom-color: var(--line);
}

/* ---------------------------------------------------------
   Page scaffolding
   --------------------------------------------------------- */
.app-main { outline: none; }

.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(24px, 5vw, 48px) clamp(16px, 4vw, 32px) 96px;
}
.narrow-page { max-width: 760px; }

.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin: 0 0 10px;
}

.page-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.06;
  letter-spacing: -.02em;
  margin: 0 0 16px;
}

.page-copy {
  color: var(--ink-2);
  font-size: 1.02rem;
  line-height: 1.65;
  max-width: 60ch;
  margin: 0 0 32px;
}

.loading-state, .error-state, .empty-state {
  font-family: var(--mono);
  font-size: .9rem;
  color: var(--muted);
  padding: 28px;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  text-align: center;
}
.error-state { color: var(--accent-ink); border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2)); }

/* ---------------------------------------------------------
   Home page
   --------------------------------------------------------- */
.home-page {
  max-width: 980px;
  position: relative;
}
.home-page::before {
  content: "";
  position: absolute;
  inset: -40px -10% auto;
  height: 280px;
  background:
    radial-gradient(ellipse 50% 80% at 12% 20%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(ellipse 40% 70% at 88% 10%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 65%);
  pointer-events: none;
  z-index: 0;
}
.home-hero {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(180px, 0.85fr);
  gap: 28px 36px;
  align-items: center;
  margin-bottom: 40px;
  padding: 8px 0 8px;
}
.home-hero-copy { min-width: 0; }
.home-hero .page-title { margin-bottom: 12px; }
.home-hero .page-copy { margin-bottom: 18px; }
.home-hero-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.home-hero-pills span {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--ink-2);
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 6px 11px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.home-hero-art {
  position: relative;
  min-height: 200px;
  display: grid;
  place-items: center;
}
.home-hero-illu {
  display: block;
  width: 100%;
  max-width: 340px;
  height: auto;
  border-radius: 18px;
  box-shadow:
    0 1px 2px rgba(48, 36, 16, .06),
    0 22px 44px -22px rgba(64, 46, 18, .38);
  object-fit: cover;
  background: var(--surface);
}

.home-section { position: relative; z-index: 1; margin-bottom: 36px; }
.home-section-head { margin-bottom: 14px; }
.home-section-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.35rem;
  margin: 0 0 4px;
  letter-spacing: -.01em;
}
.home-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
}

/* ---------------------------------------------------------
   Course chooser + mode chooser cards
   --------------------------------------------------------- */
.course-card-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.course-card-wrap .course-card {
  width: 100%;
  flex: 1;
}
.course-card-link {
  align-self: flex-start;
  font-weight: 600;
  font-size: .88rem;
  color: var(--accent-ink);
  text-decoration: none;
  padding: 4px 2px;
}
.course-card-link:hover {
  text-decoration: underline;
  color: var(--ink);
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.course-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  text-align: left;
  padding: 24px 24px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(165deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 78%, var(--paper)) 100%);
  color: var(--ink);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform .16s ease, border-color .16s, box-shadow .16s;
}
.course-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
  transform: scaleY(0);
  transform-origin: top;
  transition: transform .2s ease;
}
.course-card::after {
  content: "";
  position: absolute;
  right: -30px; top: -30px;
  width: 110px; height: 110px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%);
  pointer-events: none;
}
.course-card-history::after {
  background: radial-gradient(circle, color-mix(in srgb, #3b82c4 16%, transparent), transparent 70%);
}
.course-card-culture::after {
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 18%, transparent), transparent 70%);
}
.course-card:hover {
  transform: translateY(-3px);
  border-color: var(--line-2);
  box-shadow: var(--shadow-pop);
}
.course-card:hover::before { transform: scaleY(1); }
.course-card-badge {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 4px 9px;
  border-radius: 999px;
}
.course-card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45rem;
  letter-spacing: -.01em;
  margin: 2px 0 0;
  position: relative;
  z-index: 1;
}
.course-card-blurb {
  color: var(--ink-2) !important;
  font-size: .94rem !important;
  line-height: 1.5;
  margin: 0;
  position: relative;
  z-index: 1;
}
.course-card-meta,
.course-card p {
  color: var(--muted);
  font-size: .88rem;
  margin: 0;
  line-height: 1.5;
  position: relative;
  z-index: 1;
}
.course-progress {
  margin-top: 12px;
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .02em;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 5px 10px;
  border-radius: 999px;
  position: relative;
  z-index: 1;
}

.miwork-home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.miwork-home-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  text-decoration: none;
  color: inherit;
  padding: 22px 22px 18px;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.miwork-home-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .9;
  pointer-events: none;
}
.miwork-home-card.history::before {
  background:
    linear-gradient(135deg, color-mix(in srgb, #1e3a5f 12%, transparent), transparent 55%),
    linear-gradient(180deg, transparent 40%, var(--surface));
}
.miwork-home-card.culture::before {
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), transparent 55%),
    linear-gradient(180deg, transparent 40%, var(--surface));
}
.miwork-home-card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: var(--shadow-pop);
  text-decoration: none;
  color: inherit;
}
.miwork-home-kicker {
  position: relative;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.miwork-home-card strong {
  position: relative;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.28rem;
  letter-spacing: -.01em;
}
.miwork-home-card p {
  position: relative;
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
}
.miwork-home-actions {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 10px;
  align-items: center;
}
.miwork-home-cta {
  position: relative;
  margin-top: 0;
  font-weight: 600;
  font-size: .9rem;
  color: var(--accent-ink);
  text-decoration: none;
}
.miwork-home-cta:hover {
  text-decoration: underline;
  color: var(--ink);
}
.miwork-home-cta.secondary {
  color: var(--ink-2);
  font-weight: 500;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.mode-card {
  text-align: left;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .16s, border-color .16s, box-shadow .16s;
}
.mode-card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--shadow); }
.mode-card h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  margin: 0 0 6px;
}
.mode-card p { color: var(--muted); font-size: .9rem; margin: 0; line-height: 1.5; }

/* ---------------------------------------------------------
   Mode header (Outline / Preview / Reading)
   --------------------------------------------------------- */
.mode-header {
  display: flex;
  flex-wrap: wrap;
  gap: 20px 32px;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 22px;
  margin-bottom: 28px;
  border-bottom: 2px solid var(--ink);
}
.mode-header > div:first-child { max-width: 62ch; }
.mode-header h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(1.9rem, 4.5vw, 2.6rem);
  line-height: 1.05;
  letter-spacing: -.02em;
  margin: 0 0 10px;
}
.mode-header p { color: var(--ink-2); margin: 0; font-size: .98rem; line-height: 1.6; }

.stats-row { display: flex; flex-wrap: wrap; gap: 8px; }
.stat-chip {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .03em;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 6px 11px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------------------------------------------------------
   Course intro
   --------------------------------------------------------- */
.course-intro {
  position: relative;
  padding: 18px 22px 18px 24px;
  margin-bottom: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.course-intro strong {
  display: block;
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-bottom: 8px;
}
.course-intro p {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--ink-2);
}

/* ---------------------------------------------------------
   Buttons (shared)
   --------------------------------------------------------- */
.ghost-button {
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font-size: .84rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--r-md);
  white-space: nowrap;
  transition: background .14s, color .14s, border-color .14s;
}
.ghost-button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); border-color: var(--muted); }
.ghost-button:disabled { opacity: .42; cursor: not-allowed; }

.pill-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: .86rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: var(--r-md);
  white-space: nowrap;
  box-shadow: 0 6px 16px -8px rgba(255,105,0,.7);
  transition: filter .14s, transform .14s, box-shadow .14s;
}
.pill-button:hover:not(:disabled) { filter: brightness(1.05); transform: translateY(-1px); }
.pill-button:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--muted);
  border-radius: var(--r-md);
  transition: color .14s, background .14s, border-color .14s;
}
.icon-button:hover { color: var(--accent-ink); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2)); }
.icon-button svg { width: 18px; height: 18px; stroke: currentColor; }

/* ---------------------------------------------------------
   Outline — prep desk (plan + preview + edit)
   --------------------------------------------------------- */
.outline-page .mode-header { margin-bottom: 18px; }

/* MiWork mode hub inside the app */
.miwork-mode .page-title { margin-bottom: 8px; }
.miwork-panel {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px 26px;
  margin: 20px 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.miwork-panel-copy { min-width: 0; }
.miwork-panel-kicker {
  display: inline-block;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.miwork-panel-copy strong {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -.01em;
  line-height: 1.25;
  margin-bottom: 8px;
}
.miwork-panel-copy p {
  margin: 0;
  color: var(--ink-2);
  font-size: .95rem;
  line-height: 1.55;
  max-width: 52ch;
}
.miwork-panel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}
a.pill-button.miwork-open,
a.ghost-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
a.pill-button.miwork-open {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 600;
}
a.pill-button.miwork-open:hover { filter: brightness(1.05); text-decoration: none; color: #fff; }
.miwork-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.miwork-link-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  text-decoration: none;
  color: inherit;
}
.miwork-link-card:hover {
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
  text-decoration: none;
}
.miwork-link-card span {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.miwork-link-card strong {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.02rem;
}
@media (max-width: 720px) {
  .miwork-links { grid-template-columns: 1fr; }
}

/* Two-column: pure text TOC + card list */
.outline-workspace {
  display: grid;
  grid-template-columns: minmax(200px, 260px) minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}
.outline-main-col { min-width: 0; }

.outline-toc {
  position: sticky;
  top: 130px;
  max-height: calc(100vh - 148px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.outline-toc-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 55%, var(--surface));
}
.outline-toc-head strong {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -.01em;
}
.outline-toc-head span {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.outline-toc-nav {
  overflow-y: auto;
  padding: 8px 0 12px;
  overscroll-behavior: contain;
}
.outline-toc-section { margin-bottom: 6px; }
.outline-toc-section-btn {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 14px 4px;
  cursor: pointer;
  color: var(--ink);
}
.outline-toc-section-btn:hover .outline-toc-section-title { color: var(--accent-ink); }
.outline-toc-section-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: .88rem;
  line-height: 1.3;
}
.outline-toc-section-count {
  font-family: var(--mono);
  font-size: .66rem;
  color: var(--muted);
  flex-shrink: 0;
}
.outline-toc-list {
  list-style: none;
  margin: 0;
  padding: 0 0 4px;
}
.outline-toc-item {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 5px 12px 5px 14px;
  cursor: pointer;
  color: var(--ink-2);
  border-left: 2px solid transparent;
  font-size: .8rem;
  line-height: 1.35;
}
.outline-toc-item:hover {
  background: var(--paper);
  color: var(--ink);
}
.outline-toc-item.is-selected {
  color: var(--ink);
}
.outline-toc-item.is-selected .outline-toc-mark {
  color: var(--accent);
}
.outline-toc-item.is-current {
  background: var(--accent-soft);
  border-left-color: var(--accent);
  color: var(--ink);
}
.outline-toc-mark {
  font-size: .55rem;
  line-height: 1.6;
  color: var(--faint);
}
.outline-toc-text {
  min-width: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.outline-toc-dur {
  font-family: var(--mono);
  font-size: .64rem;
  color: var(--muted);
  white-space: nowrap;
  padding-top: 2px;
}
.outline-toc-item.is-optional .outline-toc-text {
  color: var(--ink-2);
}
.outline-toc-item.is-gap .outline-toc-text {
  font-style: italic;
  color: var(--muted);
}
.outline-toc-empty {
  margin: 0;
  padding: 12px 14px;
  font-size: .85rem;
  color: var(--muted);
}
.outline-card.is-flash {
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent), var(--shadow);
  transition: box-shadow .3s ease;
}

.outline-session-bar {
  position: sticky;
  top: 66px;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin-bottom: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(12px) saturate(1.15);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
}
.outline-session-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.outline-session-copy strong {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.12rem;
  letter-spacing: -.01em;
}
.outline-session-copy span {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  letter-spacing: .01em;
}
.outline-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.outline-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(120px, .7fr) minmax(120px, .7fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px 16px;
  margin-bottom: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.outline-toolbar .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.outline-toolbar .field > span {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.outline-toolbar input,
.outline-toolbar select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
}
.outline-toolbar input:focus,
.outline-toolbar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.outline-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding-bottom: 1px;
}

.outline-list { display: flex; flex-direction: column; gap: 36px; }

.outline-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  margin-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}
.outline-section-head h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
  letter-spacing: -.015em;
  margin: 0;
}
.outline-section-head span {
  font-family: var(--mono);
  font-size: .74rem;
  color: var(--muted);
  letter-spacing: .02em;
  white-space: nowrap;
}

.outline-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  /* isolation so open tips can rise above later siblings */
  isolation: isolate;
}

.outline-card {
  position: relative;
  z-index: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  /* visible so tip popovers are not clipped; media/edit panels clip themselves */
  overflow: visible;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
/* Lift the whole card while a tip is open so the panel paints above the next card */
.outline-card.is-tip-open,
.outline-card:has(.tip-popover.is-open),
.content-card.is-tip-open,
.reading-item.is-tip-open {
  z-index: 30;
}
.outline-card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow);
}
.outline-card.is-selected {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 22%, transparent), var(--shadow-sm);
}
.outline-card.is-expanded {
  border-color: color-mix(in srgb, var(--accent) 28%, var(--line-2));
  box-shadow: var(--shadow);
}
.outline-card.has-override {
  border-left: 3px solid var(--accent);
}
.outline-card.has-priority-override {
  background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface));
}

.outline-card-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px 14px;
  align-items: start;
  padding: 14px 14px 14px 12px;
  position: relative;
  z-index: 2;
}
.outline-card.is-expanded .outline-card-head {
  z-index: 3;
}

.outline-check {
  display: flex;
  align-items: center;
  padding-top: 6px;
}
.outline-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.outline-check input:disabled { opacity: .35; cursor: not-allowed; }

.outline-card-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.outline-card-toggle {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  cursor: pointer;
  border-radius: var(--r);
}
.outline-card-toggle:hover .outline-card-title { color: var(--accent-ink); }
.outline-card-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.outline-card-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.12rem;
  line-height: 1.3;
  letter-spacing: -.01em;
  color: var(--ink);
  transition: color .14s;
}
.outline-card-chevron {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  position: relative;
}
.outline-card-chevron::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 6px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .16s ease;
}
.outline-card.is-expanded .outline-card-chevron::before {
  top: 9px;
  transform: rotate(225deg);
}
.outline-card-purpose {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .9rem;
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 72ch;
}
.outline-card.is-expanded .outline-card-purpose { display: none; }

.outline-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.outline-edit-button {
  align-self: start;
  margin-top: 2px;
}
.outline-edit-button.is-active {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.meta-chip-button {
  cursor: pointer;
  font: inherit;
  appearance: none;
  transition: border-color .14s, background .14s, color .14s;
}
.meta-chip-button:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  color: var(--accent-ink);
  background: var(--accent-soft);
}

.outline-card {
  scroll-margin-top: 140px;
}
.outline-card-body {
  padding: 0 16px 18px 44px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 55%, var(--surface));
  animation: bodyIn .18s ease;
}
.outline-card-body .card-body-grid {
  padding-top: 16px;
}
.outline-card-body .note-box { margin-top: 14px; }
.outline-card-body .edit-panel {
  margin-top: 14px;
  margin-bottom: 4px;
}

/* ---------------------------------------------------------
   Chips / badges / markers
   --------------------------------------------------------- */
.meta-chip {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .02em;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: var(--r);
  white-space: nowrap;
}

.priority-badge {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.priority-essential { color: #fff; background: var(--accent); border-color: color-mix(in srgb, var(--accent) 70%, #000 12%); }
.priority-optional  { color: var(--ink-2); background: transparent; border-color: var(--line-2); }
.priority-gap       { color: var(--faint); background: var(--surface-2); border-color: var(--line); }

button.priority-toggle { cursor: pointer; transition: filter .14s, box-shadow .14s; position: relative; }
button.priority-toggle:hover { box-shadow: 0 0 0 3px var(--accent-soft); }
button.priority-optional:hover { border-color: var(--accent-ink); color: var(--accent-ink); }

.priority-custom-marker {
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-ink);
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--line-2));
  padding: 2px 7px;
  border-radius: var(--r);
}
.priority-reset-button {
  font-family: var(--mono);
  font-size: .68rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  padding: 2px 4px;
}
.priority-reset-button:hover { color: var(--accent-ink); }

.edited-marker {
  font-family: var(--mono);
  font-size: .66rem;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: var(--r);
}

.method-tag {
  font-family: var(--sans);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 3px 10px;
  border-radius: var(--r);
  white-space: nowrap;
}
.method-direct-instruction      { color: var(--m-direct-fg);     background: var(--m-direct-bg); }
.method-storytelling            { color: var(--m-story-fg);      background: var(--m-story-bg); }
.method-group-discussion        { color: var(--m-group-fg);      background: var(--m-group-bg); }
.method-whole-class-interaction { color: var(--m-whole-fg);      background: var(--m-whole-bg); }
.method-individual-practice     { color: var(--m-practice-fg);   background: var(--m-practice-bg); }
.method-transition              { color: var(--m-transition-fg); background: var(--m-transition-bg); }

.gap-badge {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--m-transition-fg);
  background: var(--m-transition-bg);
}

/* ---------------------------------------------------------
   Instructor tip popover
   --------------------------------------------------------- */
.tip-popover { position: relative; display: inline-flex; vertical-align: middle; }
.tip-marker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
}
.tip-marker::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.tip-marker:hover { background: var(--accent-soft-2); }
.tip-popover.is-open .tip-marker {
  background: var(--accent-soft-2);
  border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}

.tip-panel {
  display: none;
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  z-index: 60;
  width: min(340px, 82vw);
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  /* fully opaque so card text never shows through */
  background: var(--paper);
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop), 0 0 0 1px color-mix(in srgb, var(--ink) 4%, transparent);
}
/* Prefer opening under the chip, aligned to start of tip chip */
.outline-meta .tip-popover .tip-panel,
.outline-card .tip-popover .tip-panel {
  left: 0;
  right: auto;
}
.tip-popover.is-open .tip-panel { display: flex; }
.tip-panel strong {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.tip-text {
  font-size: .9rem;
  line-height: 1.55;
  color: var(--ink);
}
.tip-text em {
  display: inline-block;
  margin-top: 3px;
  font-family: var(--mono);
  font-style: normal;
  font-size: .72rem;
  color: var(--muted);
}

/* ---------------------------------------------------------
   Preview — manuscript reading column
   --------------------------------------------------------- */
.preview-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}
.section-nav {
  position: sticky;
  top: 86px;
  align-self: start;
  padding-right: 8px;
}
.section-nav h2 {
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 14px;
}
.section-nav a {
  display: block;
  padding: 7px 0 7px 14px;
  border-left: 2px solid var(--line-2);
  color: var(--ink-2);
  font-size: .88rem;
  line-height: 1.4;
  transition: color .14s, border-color .14s;
}
.section-nav a:hover { color: var(--accent-ink); border-left-color: var(--accent); text-decoration: none; }

.preview-status {
  position: sticky;
  top: 78px;
  z-index: 8;
  padding: 12px 16px;
  margin-bottom: 28px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.progress-line {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink-2);
  letter-spacing: .02em;
  margin-bottom: 9px;
}
.progress-track {
  height: 5px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width .3s ease;
}

.section-heading {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.6rem;
  letter-spacing: -.01em;
  margin: 44px 0 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--ink);
  scroll-margin-top: 120px;
}
.section-heading:first-child { margin-top: 0; }

.content-card {
  padding: 20px 22px 22px;
  margin: 0 0 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  scroll-margin-top: 120px;
}
.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.card-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.28rem;
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 0;
}
.read-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}
.read-check:hover { border-color: var(--line-2); color: var(--ink-2); }
.read-check input {
  width: 15px; height: 15px;
  accent-color: var(--accent);
  cursor: pointer;
}
.read-check-label { letter-spacing: .02em; }

/* Image + script as one editorial unit */
.card-body-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.95fr) minmax(0, 1.15fr);
  gap: clamp(16px, 2.4vw, 28px);
  align-items: start;
}
.card-media { min-width: 0; }
.card-media .slides-grid {
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 0;
}
.card-media .slide-frame {
  background: #111;
  border-color: var(--line-2);
}
.card-media .slide-frame img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0d0d0d;
}
.card-copy { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.card-copy .meta-row { margin-bottom: 0; }
.card-copy .script-block { max-width: none; }
.card-copy .purpose-block { margin: 0; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.card-markers { margin-top: 0; }

.purpose-block {
  font-size: .92rem;
  line-height: 1.55;
  color: var(--ink-2);
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin: 0 0 18px;
}
.purpose-block strong {
  display: inline-block;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
  margin-right: 8px;
}

.script-block {
  font-family: var(--serif);
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--ink);
  max-width: 68ch;
}
.script-block p { margin: 0 0 0.9em; }
.script-block p:last-child { margin-bottom: 0; }
.script-block strong { font-weight: 600; }
.script-block em { color: var(--accent-ink); font-style: italic; }

/* Stage directions: (advance slide), (pause…), etc. */
.stage-dir {
  display: inline-block;
  font-family: var(--mono);
  font-size: .78rem;
  font-style: normal;
  line-height: 1.45;
  letter-spacing: .01em;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid color-mix(in srgb, var(--accent) 55%, var(--line-2));
  border-radius: 0 var(--r) var(--r) 0;
  padding: 4px 10px;
  margin: 2px 0;
}

.gap-note {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--muted);
  font-style: normal;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  border-radius: var(--r-md);
  display: inline-block;
}

/* Slide images */
.slides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.slide-frame {
  margin: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-3);
  box-shadow: var(--shadow-sm);
  transition: transform .16s, box-shadow .16s, border-color .16s;
}
.slide-frame:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--muted); }
.slide-frame.has-custom-image { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.slide-frame img { width: 100%; cursor: zoom-in; aspect-ratio: 16 / 9; object-fit: cover; }
.slide-frame figcaption {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .04em;
  color: var(--muted);
  padding: 7px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.slide-frame figcaption span {
  color: var(--accent-ink);
  text-transform: uppercase;
  font-weight: 500;
}

/* ---------------------------------------------------------
   Reading — searchable collapsed list
   --------------------------------------------------------- */
.reading-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) repeat(2, minmax(150px, 1fr)) auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  margin-bottom: 28px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.field input, .field select {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
  font-size: .9rem;
  transition: border-color .14s, box-shadow .14s;
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.reading-actions { display: flex; gap: 8px; align-items: end; }

.reading-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}
.reading-item { border-bottom: 1px solid var(--line); }
.reading-summary-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 8px;
}
.reading-summary {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 16px 6px 16px 22px;
  border-left: 3px solid transparent;
  transition: background .14s, border-color .14s;
}
.reading-summary:hover { background: var(--surface); border-left-color: var(--accent); }
.reading-summary[aria-expanded="true"] { border-left-color: var(--accent); background: var(--surface); }
.summary-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.04rem;
  line-height: 1.35;
  min-width: 0;
}
.reading-summary[aria-expanded="true"] .summary-title { color: var(--accent-ink); }
.summary-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-shrink: 0;
}
.reading-summary::after {
  content: "";
  flex-shrink: 0;
  width: 9px; height: 9px;
  margin-left: 4px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .18s;
}
.reading-summary[aria-expanded="true"]::after { transform: rotate(-135deg); border-color: var(--accent-ink); }

.reading-body {
  padding: 8px 18px 22px 20px;
  animation: bodyIn .2s ease;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border-top: 1px solid var(--line);
}
@keyframes bodyIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.card-tools { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.reading-body .card-body-grid { margin-top: 2px; }
.reading-body .note-box { margin-top: 16px; }

/* ---------------------------------------------------------
   Notes box
   --------------------------------------------------------- */
.note-box { display: flex; flex-direction: column; gap: 7px; margin-top: 18px; }
.note-box > span {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.note-box textarea {
  min-height: 84px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--sans);
  font-size: .94rem;
  line-height: 1.55;
  resize: vertical;
  transition: border-color .14s, box-shadow .14s;
}
.note-box textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.note-status {
  font-family: var(--mono);
  font-size: .7rem;
  color: var(--ok-ink);
  min-height: 1em;
  letter-spacing: .02em;
}

/* ---------------------------------------------------------
   Edit panel
   --------------------------------------------------------- */
.edit-panel {
  margin-top: 16px;
  padding: 18px 18px 16px;
  background: var(--paper);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-left: 4px solid var(--accent);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  animation: editIn .18s ease;
}
@keyframes editIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.edit-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
}
.edit-head-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.edit-head strong {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.edit-head-hint {
  font-size: .86rem;
  line-height: 1.4;
  color: var(--ink-2);
}
.edit-images-label {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 8px;
}
.edit-empty {
  margin: 0;
  font-size: .88rem;
  color: var(--muted);
}
.edit-field { display: flex; flex-direction: column; gap: 7px; }
.edit-field > span {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.edit-field textarea {
  min-height: 180px;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.65;
  resize: vertical;
}
.edit-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.duration-edit-field {
  padding: 12px 14px;
  margin-bottom: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.duration-input-row input {
  font-size: 1.05rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.edit-inline-actions { margin: 10px 0 4px; }

.duration-edit-field {
  margin-bottom: 14px;
}
.duration-input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.duration-input-row input {
  width: 110px;
  padding: 9px 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink);
}
.duration-input-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.duration-input-row > span {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
}

.edit-images {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 18px 0;
}
.edit-slide {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(0, 1.1fr);
  gap: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--paper);
}
.edit-slide img {
  width: 100%;
  height: 100%;
  min-height: 120px;
  aspect-ratio: 16/9;
  object-fit: contain;
  background: #111;
  cursor: zoom-in;
}
.edit-slide-controls {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  padding: 14px 16px;
}
.edit-slide-controls strong { font-family: var(--mono); font-size: .74rem; color: var(--ink-2); }
.edit-slide-controls input[type="file"] { font-size: .78rem; color: var(--muted); }
.edit-slide-controls input[type="file"]::file-selector-button {
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  padding: 5px 10px;
  margin-right: 8px;
  cursor: pointer;
}
.edit-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.edit-status { font-family: var(--mono); font-size: .72rem; color: var(--ok-ink); }

/* ---------------------------------------------------------
   Live-Teaching — same paper system as the rest of the app
   --------------------------------------------------------- */
.live-page {
  min-height: calc(100vh - 66px);
  background: var(--paper);
  color: var(--ink);
  padding: clamp(16px, 3vw, 28px);
}
.live-shell {
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.empty-live-shell { padding-top: 60px; }

/* HUD bar */
.live-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 16px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  position: relative;
  box-shadow: var(--shadow-sm);
}
.live-top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
}
.live-counter {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 12px;
  min-width: 0;
}
.live-counter strong {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  color: var(--ink);
  letter-spacing: .01em;
}
.live-counter-meta,
.live-counter span {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  letter-spacing: .01em;
}
.scope-chip {
  font-family: var(--mono) !important;
  font-size: .7rem !important;
  color: var(--accent-ink) !important;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  padding: 3px 9px;
  border-radius: 999px;
}
.live-top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.live-markers { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.live-top .icon-button {
  background: var(--paper);
  border-color: var(--line-2);
  color: var(--muted);
}
.live-top .icon-button:hover {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line-2));
}

/* Practice timer — always expanded, high visibility */
.practice-timer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 88%, var(--accent-soft));
  box-shadow: var(--shadow-sm);
}
.practice-timer.is-running {
  border-color: color-mix(in srgb, var(--ok-ink) 35%, var(--line));
  background: color-mix(in srgb, var(--ok-soft) 65%, var(--surface));
}
.practice-timer.is-over {
  border-color: color-mix(in srgb, var(--warn-ink) 45%, var(--line));
  background: color-mix(in srgb, var(--warn-soft) 75%, var(--surface));
}
.practice-timer-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 18px;
}
.practice-timer-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  color: var(--accent-ink);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  flex-shrink: 0;
}
.practice-timer-icon.is-running {
  color: var(--ok-ink);
  background: var(--ok-soft);
  border-color: color-mix(in srgb, var(--ok-ink) 30%, var(--line));
}
.practice-timer-icon.is-over {
  color: var(--warn-ink);
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn-ink) 35%, var(--line));
  animation: pulseDot 1s ease infinite;
}
.practice-clock-svg { display: block; }
.practice-timer-clocks {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.practice-timer-primary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}
.practice-timer-secondary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.practice-timer-label {
  font-family: var(--mono);
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  font-size: .68rem;
}
.practice-timer-current {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.65rem;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.02em;
}
.practice-timer-slash {
  font-family: var(--mono);
  font-size: 1.2rem;
  color: var(--faint);
}
.practice-timer-target {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1.2rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.practice-timer.is-over .practice-timer-current {
  color: var(--warn-ink);
}
.practice-timer-total {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.practice-over-badge {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--warn-ink);
  padding: 3px 8px;
  border-radius: 999px;
  align-self: center;
}
.practice-over-badge[hidden] { display: none !important; }
.practice-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.timer-btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: .9rem;
  padding: 10px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  min-width: 5.5rem;
  transition: background .14s, border-color .14s, color .14s, box-shadow .14s, opacity .14s;
}
.timer-btn:disabled {
  opacity: .4;
  cursor: not-allowed;
}
.timer-btn-start {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 2px 8px -2px rgba(255, 105, 0, .55);
}
.timer-btn-start:hover:not(:disabled) {
  filter: brightness(1.05);
}
.timer-btn-pause {
  color: var(--ink);
  background: var(--surface-2);
  border-color: var(--line-2);
}
.timer-btn-pause:hover:not(:disabled) {
  border-color: var(--ink-2);
}
.timer-btn-reset {
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}
.timer-btn-reset:hover:not(:disabled) {
  color: var(--ink);
  border-color: var(--line-2);
  background: var(--surface);
}
@keyframes pulseDot {
  50% { transform: scale(1.06); opacity: .88; }
}
.practice-readout {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  padding-top: 2px;
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
}
.live-keys-hint {
  margin: 0;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .02em;
  color: var(--faint);
}
.live-focus-btn.is-active,
.live-tool-btn.is-active {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.live-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
}
.live-tool-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  flex-shrink: 0;
}
.live-tool-btn span {
  font-size: .84rem;
  font-weight: 600;
}

/* Script-focus mode: big teleprompter, slides tucked away */
body.live-script-focus .live-slides,
.live-page.is-script-focus .live-slides {
  display: none;
}
body.live-script-focus .live-card,
.live-page.is-script-focus .live-card {
  grid-template-columns: 1fr;
}
body.live-script-focus .live-script,
.live-page.is-script-focus .live-script {
  font-size: clamp(1.35rem, 2.4vw, 1.85rem);
  line-height: 1.55;
  max-width: 42ch;
}
body.live-script-focus .live-title,
.live-page.is-script-focus .live-title {
  font-size: clamp(1.2rem, 2vw, 1.6rem);
}
body.live-script-focus .live-purpose,
.live-page.is-script-focus .live-purpose {
  display: none;
}
.outline-card-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.live-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: transparent;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  overflow: hidden;
}
.live-progress > div {
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(255,105,0,.6);
  transition: width .3s ease;
}

.practice-pace, .practice-last { font-size: .74rem !important; }
.practice-pace.is-good, .practice-last.is-good { color: var(--ok-ink) !important; }
.practice-pace.is-over, .practice-last.is-over { color: var(--warn-ink) !important; }

/* Stage */
.live-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: stretch;
}
.live-side {
  display: grid;
  place-items: center;
  width: 52px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 1.3rem;
  border-radius: var(--r-lg);
  transition: color .14s, background .14s, border-color .14s;
}
.live-side:hover:not(:disabled) {
  color: var(--accent-ink);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--line));
}
.live-side:disabled { opacity: .28; cursor: not-allowed; }

.live-content {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(18px, 3vw, 28px);
  box-shadow: var(--shadow-sm);
}
.live-card {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.1fr);
  gap: clamp(18px, 2.8vw, 32px);
  align-items: start;
}
.live-card.is-gap { grid-template-columns: 1fr; justify-items: center; text-align: center; }

.live-slides { position: sticky; top: 86px; }
.live-slides .slides-grid {
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}
/* Two slides side-by-side instead of a tall stack */
.live-slides .slides-grid:has(> :nth-child(2)) {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.live-slides .slide-frame { background: #111; border-color: var(--line-2); }
.live-slides .slide-frame figcaption {
  background: var(--surface-2);
  border-top-color: var(--line);
  color: var(--muted);
}
.live-slides .slide-frame img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #0d0d0d;
}

.live-script-panel { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.live-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.45rem, 2.6vw, 2.05rem);
  line-height: 1.15;
  letter-spacing: -.015em;
  color: var(--ink);
  margin: 0;
}
.live-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.live-purpose {
  width: 100%;
  font-size: .9rem;
  line-height: 1.5;
  color: var(--muted);
  padding-top: 2px;
}
.live-script.script-block {
  font-family: var(--serif);
  font-size: clamp(1.08rem, 1.7vw, 1.32rem);
  line-height: 1.65;
  color: var(--ink);
  max-width: none;
}
.live-script.script-block em { color: var(--accent-ink); }
.live-gap-message {
  font-family: var(--serif);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--muted);
  margin: 24px 0;
}
.live-note-panel { border-top: 1px solid var(--line); padding-top: 4px; }

/* ---------------------------------------------------------
   Lightbox
   --------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16,12,6,.86);
  backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lightbox-panel {
  position: relative;
  max-width: min(1100px, 94vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lightbox-panel img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--r-md);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.7);
}
.lightbox-close {
  align-self: flex-end;
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.24);
  padding: 8px 16px;
  border-radius: var(--r-md);
}
.lightbox-close:hover { background: var(--accent); border-color: var(--accent); }

/* ---------------------------------------------------------
   Onboarding
   --------------------------------------------------------- */
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 90;
  /* Shade/spotlight are visual only so users can click the highlighted target
     (e.g. choose a course while the tour is open). */
  pointer-events: none;
}
.onboarding-shade {
  position: absolute;
  inset: 0;
  background: rgba(16, 12, 6, .38);
  pointer-events: none;
}
.onboarding-spotlight {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: var(--r-lg);
  box-shadow: 0 0 0 9999px rgba(16, 12, 6, .32), 0 0 0 6px rgba(255,105,0,.22);
  pointer-events: none;
}
.onboarding-card {
  position: fixed;
  top: var(--onboarding-top, 50%);
  left: var(--onboarding-left, 50%);
  transform: var(--onboarding-transform, translate(-50%, -50%));
  width: min(360px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  padding: 20px;
  background: var(--surface);
  pointer-events: auto;
  color: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
}
.onboarding-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--muted);
}
.onboarding-close:hover { color: var(--accent-ink); background: var(--accent-soft); }
.onboarding-step {
  margin: 0 34px 8px 0;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.onboarding-card h2 {
  margin: 0 34px 8px 0;
  font-family: var(--serif);
  font-size: 1.25rem;
  font-weight: 500;
  line-height: 1.25;
}
.onboarding-body {
  margin: 0;
  color: var(--ink-2);
  font-size: .95rem;
  line-height: 1.55;
}
.onboarding-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ---------------------------------------------------------
   Responsive
   --------------------------------------------------------- */
@media (max-width: 900px) {
  .preview-layout { grid-template-columns: 1fr; gap: 24px; }
  .outline-workspace {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .outline-toc {
    position: static;
    max-height: 220px;
  }
  .section-nav {
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0;
  }
  .section-nav h2 { width: 100%; margin-bottom: 6px; }
  .section-nav a { border-left: 0; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; font-size: .8rem; }
  .outline-toolbar {
    grid-template-columns: 1fr 1fr;
  }
  .outline-search { grid-column: 1 / -1; }
  .outline-toolbar-actions { grid-column: 1 / -1; justify-content: flex-start; }
  .card-body-grid { grid-template-columns: 1fr; gap: 14px; }
  .card-media .slides-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  }
  .edit-slide { grid-template-columns: 1fr; }
  .live-card { grid-template-columns: 1fr; gap: 16px; }
  .live-slides { position: static; }
  .live-slides .slides-grid:has(> :nth-child(2)) { grid-template-columns: 1fr 1fr; }
  .reading-controls { grid-template-columns: 1fr 1fr; }
  .reading-controls .field:first-child { grid-column: 1 / -1; }
  .reading-actions { grid-column: 1 / -1; }
}

@media (max-width: 820px) {
  .home-hero { grid-template-columns: 1fr; }
  .home-hero-art { min-height: 140px; order: -1; }
  .course-grid,
  .miwork-home-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .app-header { grid-template-columns: auto auto 1fr; row-gap: 8px; padding: 10px 12px; }
  body.is-home .app-header { grid-template-columns: auto auto 1fr; }
  body.is-home .mode-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
  .brand-text { display: none; }
  .course-nav { justify-content: flex-end; }
  .mode-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    gap: 4px;
  }
  .nav-label-full { display: none; }
  .nav-label-short { display: inline; }
  .nav-button { padding: 7px 11px; font-size: .84rem; }
  .outline-session-bar { top: 58px; }
  .preview-status { top: 62px; }
  .mode-header { border-bottom-width: 1px; }
  .content-card { padding: 14px 14px 16px; }
  .outline-card-body { padding-left: 14px; padding-right: 14px; }
  .outline-card-head { grid-template-columns: auto minmax(0, 1fr); }
  .outline-edit-button { grid-column: 2; justify-self: end; }
  .outline-toolbar { grid-template-columns: 1fr; }
  .live-page { padding: 12px; }
  .live-top { padding: 10px 12px 12px; }
  .live-counter-meta:nth-of-type(1) { display: none; } /* hide Card x/y if tight */
  .onboarding-card {
    top: auto !important;
    left: 14px !important;
    right: 14px;
    bottom: 14px;
    width: auto;
  }
  .onboarding-actions { justify-content: stretch; }
  .onboarding-actions .ghost-button,
  .onboarding-actions .pill-button { flex: 1; }
}

@media (max-width: 480px) {
  body { font-size: 15px; }
  .page { padding: 20px 14px 80px; }
  .card-top { flex-direction: column; gap: 10px; align-items: stretch; }
  .read-check { align-self: flex-start; }
  .reading-controls { grid-template-columns: 1fr; }
  .reading-summary { flex-direction: column; align-items: flex-start; gap: 8px; }
  .summary-meta { justify-content: flex-start; }
  .reading-summary::after { position: absolute; right: 8px; top: 22px; }
  .reading-summary-wrap { position: relative; }
  .card-media .slides-grid { grid-template-columns: 1fr 1fr; }
  .live-side { width: 36px; font-size: 1.05rem; }
  .live-stage { gap: 6px; }
  .live-content { padding: 14px; }
  .live-title { font-size: 1.3rem; }
  .live-script.script-block { font-size: 1.05rem; }
  .live-slides .slides-grid:has(> :nth-child(2)) { grid-template-columns: 1fr; }
  .outline-session-copy strong { font-size: 1rem; }
  .practice-timer-current { font-size: 1.4rem; }
  .timer-btn { min-width: 4.8rem; padding: 9px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
