/* Fathom — design tokens & styles
   Palette: AAA-compliant on cream/white. Typography: Newsreader (serif headers) + Public Sans (UI).
   Mobile-first; focus rings explicit; respects prefers-reduced-motion. */

:root {
  /* Brand — AAA contrast on #FBF7F0 */
  --c-cream:    #FBF7F0;
  --c-paper:    #FFFFFF;
  --c-ink:      #1A202C;     /* slate (headings, body) — AAA on cream */
  --c-ink-soft: #4A5568;     /* secondary text — AAA on cream (7.4:1) */
  --c-pine:     #1F4E3D;     /* primary action — AAA on cream */
  --c-pine-soft:#2D6E54;
  --c-clay:     #7C2D12;     /* alerts/active — AAA on cream */
  --c-clay-soft:#A14021;
  --c-rule:     #E8E0D2;
  --c-rule-strong:#C9BFA9;
  --c-bg:       var(--c-cream);
  --c-surface:  var(--c-paper);
  --c-text:     var(--c-ink);
  --c-text-soft:var(--c-ink-soft);
  --c-link:     var(--c-pine);
  --c-warn:     var(--c-clay);

  /* Typography */
  --f-serif: "Newsreader", "Iowan Old Style", "Charter", "Georgia", serif;
  --f-sans:  "Public Sans", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  /* Spacing scale */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-7: 32px; --s-8: 40px; --s-9: 56px; --s-10: 80px;

  /* Radii & shadows (subtle, not glossy) */
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px; --r-pill: 999px;
  --shadow-1: 0 1px 0 rgba(26,32,44,.04), 0 0 0 1px rgba(26,32,44,.06);
  --shadow-2: 0 6px 24px -8px rgba(26,32,44,.18), 0 0 0 1px rgba(26,32,44,.08);

  /* Layout */
  --topbar-h: 56px;
  --tabbar-h: 64px;
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);

  /* Motion */
  --t-fast: 120ms;
  --t-med:  220ms;
  --t-slow: 360ms;
  --ease:   cubic-bezier(.2,.7,.2,1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --c-cream:    #0E1A14;
    --c-paper:    #131F18;
    --c-ink:      #F0E8D6;
    --c-ink-soft: #B7B1A2;
    --c-pine:     #6CC3A2;     /* AAA on dark cream */
    --c-pine-soft:#A4DCC2;
    --c-clay:     #F2A07F;     /* AAA on dark */
    --c-rule:     #243029;
    --c-rule-strong:#3A4A40;
    --shadow-1: 0 1px 0 rgba(0,0,0,.5), 0 0 0 1px rgba(255,255,255,.06);
    --shadow-2: 0 8px 28px -10px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.08);
  }
}

* { box-sizing: border-box; }

/* HTML hidden attribute must beat any later display rules. */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

html {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--f-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  display: flex; flex-direction: column;
  font-feature-settings: "ss01", "cv11";
}

/* Skip link */
.skip-link {
  position: absolute; left: -9999px; top: 0; padding: 8px 12px;
  background: var(--c-ink); color: var(--c-cream);
  border-radius: 0 0 var(--r-sm) 0;
  font-weight: 600;
  z-index: 100;
}
.skip-link:focus { left: 0; outline: 3px solid var(--c-clay); }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-top) + var(--s-3)) var(--s-4) var(--s-3);
  height: calc(var(--topbar-h) + var(--safe-top));
  background: color-mix(in oklab, var(--c-bg), transparent 4%);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--c-rule);
}
.brand {
  display: inline-flex; align-items: center; gap: var(--s-2);
  text-decoration: none; color: var(--c-text);
  font-family: var(--f-serif); font-weight: 600; letter-spacing: .005em;
}
.brand-name { font-size: 1.15rem; }
.brand img { display: block; }

/* Topbar quick-toggle cluster — language + view-mode + settings, always visible. */
.topbar-tools { display: inline-flex; align-items: center; gap: var(--s-2); }
.quick-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border-radius: var(--r-pill);
  font-family: inherit; font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  background: var(--c-rule);
  color: var(--c-text-soft);
  border: 1px solid var(--c-rule-strong);
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.quick-toggle:hover {
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 90%);
  color: var(--c-pine);
  border-color: color-mix(in oklab, var(--c-pine), transparent 75%);
}
.quick-toggle:focus-visible { outline: 2px solid var(--c-clay); outline-offset: 2px; }
.quick-toggle[aria-pressed="true"] {
  background: color-mix(in oklab, var(--c-pine), transparent 88%);
  color: var(--c-pine);
  border-color: color-mix(in oklab, var(--c-pine), transparent 65%);
}
.quick-toggle .qt-icon { font-size: .85rem; line-height: 1; min-width: 1.2em; text-align: center; }
.quick-toggle .qt-label { display: inline; }
/* Hide the verbose label on narrow viewports — icon alone reads as the state. */
@media (max-width: 380px) {
  .quick-toggle .qt-label { display: none; }
  .quick-toggle { padding: 0 8px; }
}

/* Bottom tabs */
.tabs {
  position: sticky; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(5, 1fr);
  gap: 0;
  padding: var(--s-2) var(--s-2) calc(var(--s-2) + var(--safe-bot));
  background: color-mix(in oklab, var(--c-bg), transparent 4%);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-top: 1px solid var(--c-rule);
}
.tab {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px;
  color: var(--c-text-soft);
  text-decoration: none;
  font-size: 12px; font-weight: 500;
  border-radius: var(--r-sm);
  transition: color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.tab svg { width: 22px; height: 22px; }
.tab[aria-current="page"] { color: var(--c-pine); background: color-mix(in oklab, var(--c-pine), transparent 92%); }
.tab:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }

/* Main content */
main {
  flex: 1; min-height: 0;
  padding: var(--s-5) var(--s-4) calc(var(--tabbar-h) + var(--s-7) + var(--safe-bot));
  max-width: 720px; width: 100%; margin: 0 auto;
}

h1, h2, h3 { font-family: var(--f-serif); color: var(--c-text); margin: 0 0 var(--s-3); line-height: 1.18; letter-spacing: -.01em; }
h1 { font-size: 1.85rem; font-weight: 600; }
h2 { font-size: 1.4rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0 0 var(--s-3); }
small, .meta { color: var(--c-text-soft); font-size: 0.86rem; }
ul { margin: 0 0 var(--s-3); padding: 0 0 0 1.1em; }
li { margin-bottom: var(--s-2); }
strong { color: var(--c-text); font-weight: 600; }
em { font-style: italic; }
a { color: var(--c-link); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; border-radius: 2px; }
hr { border: 0; border-top: 1px solid var(--c-rule); margin: var(--s-5) 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2);
  height: 48px; padding: 0 var(--s-5);
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  font: 600 0.97rem var(--f-sans);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
  text-decoration: none;
  background: var(--c-pine); color: var(--c-cream);
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
}
.btn:hover { background: var(--c-pine-soft); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-ghost {
  background: transparent; color: var(--c-text);
  border-color: var(--c-rule-strong);
}
.btn-ghost:hover { background: color-mix(in oklab, var(--c-pine), transparent 94%); }
.btn-clay { background: var(--c-clay); }
.btn-clay:hover { background: var(--c-clay-soft); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 var(--s-4); font-size: 0.88rem; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px;
  background: transparent; border: 0; color: var(--c-text);
  border-radius: 50%; cursor: pointer;
}
.icon-btn:hover { background: color-mix(in oklab, var(--c-pine), transparent 92%); }
.icon-btn:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }

/* Cards */
.card {
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  padding: var(--s-5);
  box-shadow: var(--shadow-1);
  margin-bottom: var(--s-4);
}
.card-feature {
  background: linear-gradient(180deg, color-mix(in oklab, var(--c-pine), var(--c-bg) 88%), var(--c-surface));
  border-color: color-mix(in oklab, var(--c-pine), transparent 70%);
  padding: var(--s-6);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}
.card-feature h2 { color: var(--c-pine); }

/* Pills/chips */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: color-mix(in oklab, var(--c-pine), transparent 90%);
  color: var(--c-pine);
  font-size: .78rem; font-weight: 600; letter-spacing: .02em;
  border: 1px solid color-mix(in oklab, var(--c-pine), transparent 75%);
}
.pill-clay { background: color-mix(in oklab, var(--c-clay), transparent 90%); color: var(--c-clay); border-color: color-mix(in oklab, var(--c-clay), transparent 75%); }
.pill-soft { background: var(--c-rule); color: var(--c-text-soft); border-color: var(--c-rule-strong); }
/* Clickable mode-pill in lesson header — toggles compact / detailed view. */
button.pill-mode {
  cursor: pointer;
  font-family: inherit;
  background: var(--c-rule);
  color: var(--c-text-soft);
  border-color: var(--c-rule-strong);
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
button.pill-mode:hover { background: color-mix(in oklab, var(--c-pine), var(--c-bg) 90%); color: var(--c-pine); border-color: color-mix(in oklab, var(--c-pine), transparent 75%); }
button.pill-mode:focus-visible { outline: 2px solid var(--c-pine); outline-offset: 2px; }
button.pill-mode[aria-pressed="true"] {
  background: color-mix(in oklab, var(--c-pine), transparent 88%);
  color: var(--c-pine);
  border-color: color-mix(in oklab, var(--c-pine), transparent 65%);
}
button.pill-mode .view-mode-icon { font-size: .9rem; line-height: 1; }

/* Lists / nav-rows */
.row-list { display: flex; flex-direction: column; gap: var(--s-2); }
.row {
  display: flex; align-items: center; gap: var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  text-decoration: none; color: var(--c-text);
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.row:hover { border-color: var(--c-rule-strong); }
.row:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }
.row-icon {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 12px;
  background: var(--c-cream);
  border: 1px solid var(--c-rule);
  display: grid; place-items: center;
  overflow: hidden;
}
.row-icon img { width: 30px; height: 30px; object-fit: contain; }
.row-text { flex: 1 1 auto; min-width: 0; }
.row-text h3 { margin: 0 0 2px; font-family: var(--f-sans); font-size: 1rem; font-weight: 600; }
.row-text p { margin: 0; color: var(--c-text-soft); font-size: 0.88rem; }
.row-chev { color: var(--c-text-soft); }
.row[aria-disabled="true"] { opacity: .65; }
.row-locked .row-text h3::after {
  content: ""; display: inline-block; width: 14px; height: 14px; margin-left: 6px; vertical-align: -2px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><rect x='5' y='11' width='14' height='10' rx='2'/><path d='M8 11V7a4 4 0 0 1 8 0v4'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2'><rect x='5' y='11' width='14' height='10' rx='2'/><path d='M8 11V7a4 4 0 0 1 8 0v4'/></svg>") center/contain no-repeat;
}

/* Hero */
.hero {
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: var(--s-5);
  position: relative;
  border: 1px solid var(--c-rule);
}
.hero img { display: block; width: 100%; height: auto; aspect-ratio: 16/9; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: auto 0 0 0; padding: var(--s-5);
  background: linear-gradient(180deg, transparent, color-mix(in oklab, var(--c-bg), transparent 12%) 60%);
  color: var(--c-text);
}

/* Lesson view */
.lesson { max-width: 64ch; margin: 0 auto; }
.lesson-head { margin-bottom: var(--s-5); }
.lesson-head h1 { font-size: 1.7rem; }
.lesson-meta { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; margin-bottom: var(--s-2); }
.lesson-hook {
  font-family: var(--f-serif); font-size: 1.25rem; font-style: italic; color: var(--c-text);
  border-left: 3px solid var(--c-pine); padding-left: var(--s-4); margin: var(--s-5) 0;
  line-height: 1.4;
}
.lesson-frame, .lesson-takeaway {
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 96%);
  border: 1px solid color-mix(in oklab, var(--c-pine), transparent 86%);
  border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
  margin: var(--s-4) 0;
}
.lesson-takeaway { background: color-mix(in oklab, var(--c-clay), var(--c-bg) 96%); border-color: color-mix(in oklab, var(--c-clay), transparent 86%); }
.lesson-takeaway h3 { color: var(--c-clay); margin-bottom: var(--s-2); }
.lesson-story { font-size: 1.02rem; }
.viz-card { padding: var(--s-5); border: 1px dashed var(--c-rule-strong); border-radius: var(--r-md); margin: var(--s-4) 0; }
.viz-card svg { display: block; max-width: 100%; height: auto; }

/* ─── /me/subscribe — provider-offline notice + per-plan unavailable row ── */
.subscribe-notice {
  display: flex; align-items: flex-start; gap: 12px;
  margin: 0 0 18px;
  padding: 14px 16px;
  background: color-mix(in oklab, var(--c-rule), var(--c-bg) 50%);
  border: 1px solid color-mix(in oklab, var(--c-rule-strong), transparent 40%);
  border-radius: var(--r-md);
  color: var(--c-text);
  flex-wrap: wrap;
}
.subscribe-notice-text { flex: 1 1 220px; min-width: 0; }
.subscribe-notice-retry { flex: 0 0 auto; align-self: center; }
.subscribe-notice-icon {
  flex: 0 0 auto;
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: color-mix(in oklab, var(--c-rule-strong), transparent 50%);
  color: var(--c-meta);
  font-size: .95rem;
  margin-top: 1px;
}
.subscribe-notice-title {
  margin: 0 0 4px;
  font-family: var(--f-sans);
  font-size: .92rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.subscribe-notice-body {
  margin: 0;
  font-size: .88rem;
  line-height: 1.5;
  color: var(--c-meta);
}

.plan-unavailable {
  margin: 0;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: .82rem;
  color: var(--c-meta);
  background: color-mix(in oklab, var(--c-rule), transparent 50%);
  border: 1px dashed color-mix(in oklab, var(--c-rule-strong), transparent 40%);
  border-radius: var(--r-md);
  text-align: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  cursor: not-allowed;
  user-select: none;
}
.plan-unavailable span { font-size: .9rem; opacity: .7; }

/* ─── User-set accessibility prefs (override OS media queries) ─────── */
html[data-prefers-motion="reduce"] *,
html[data-prefers-motion="reduce"] *::before,
html[data-prefers-motion="reduce"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
  scroll-behavior: auto !important;
}
html[data-prefers-text-size="large"] {
  font-size: 18px;   /* default ~16px → ~112.5% */
}
html[data-prefers-text-size="large"] body {
  font-size: clamp(1.07rem, 2.7vw, 1.15rem);
  line-height: 1.65;
}

/* ─── /me Preferences — inline segmented controls + toggle switches ─── */
.me-pref-list {
  background: color-mix(in oklab, var(--c-rule), transparent 70%);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.me-pref-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--c-bg);
  flex-wrap: wrap;
}
.me-pref-text { flex: 1 1 220px; min-width: 0; }
.me-pref-label {
  font-family: var(--f-sans);
  font-size: .98rem;
  font-weight: 600;
  margin: 0 0 2px;
}
.me-pref-sub {
  font-size: .82rem;
  color: var(--c-meta);
  line-height: 1.45;
}

/* Segmented control (pills row) — language + view mode */
.me-seg {
  display: inline-flex;
  border: 1px solid var(--c-rule-strong);
  border-radius: 999px;
  padding: 3px;
  background: var(--c-bg);
  gap: 2px;
  flex-shrink: 0;
}
.me-seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--c-text);
  font-family: var(--f-sans);
  font-size: .85rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  min-height: 32px;
  white-space: nowrap;
}
.me-seg-btn:hover { background: color-mix(in oklab, var(--c-pine), transparent 92%); }
.me-seg-btn[aria-pressed="true"] {
  background: var(--c-pine);
  color: #FBF7F0;
  font-weight: 600;
}
.me-seg-btn:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }

/* Inline action button living inside a chevron .row (e.g. Wisdom Reset) */
.row .me-row-action {
  flex-shrink: 0;
  margin-right: 4px;
}
.row .me-row-action:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* iOS-style toggle switch — sized for finger-tap on mobile */
.me-switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
  cursor: pointer;
}
.me-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.me-switch-track {
  position: absolute;
  inset: 0;
  background: color-mix(in oklab, var(--c-rule-strong), transparent 40%);
  border-radius: 999px;
  transition: background .2s ease;
}
.me-switch-track::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  background: var(--c-bg);
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
  transition: transform .2s ease;
}
.me-switch input:checked + .me-switch-track {
  background: var(--c-pine);
}
.me-switch input:checked + .me-switch-track::before {
  transform: translateX(20px);
}
.me-switch input:focus-visible + .me-switch-track {
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--c-clay), transparent 50%);
}

/* ─── /me page — grouped settings with an at-a-glance hero ──────────── */
.me-page h1 { margin: 0 0 var(--s-4); }
.me-hero { padding: var(--s-5); margin-bottom: var(--s-5); }
.me-hero-top {
  display: flex; align-items: center; gap: var(--s-4); margin-bottom: var(--s-4);
}
.me-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 80%);
  color: var(--c-pine); font-family: var(--f-serif); font-size: 1.6rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; user-select: none;
}
.me-hero-id { flex: 1 1 auto; min-width: 0; }
.me-hero-email {
  font-family: var(--f-sans); font-size: 1.05rem; font-weight: 600;
  margin: 0 0 6px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.me-hero-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.me-hero-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-3);
  margin: 0 0 var(--s-4); padding: var(--s-3) 0;
  border-top: 1px solid color-mix(in oklab, var(--c-rule), transparent 50%);
  border-bottom: 1px solid color-mix(in oklab, var(--c-rule), transparent 50%);
}
.me-hero-stats div { text-align: center; }
.me-hero-stats dt {
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--c-meta); margin-bottom: 2px;
}
.me-hero-stats dd {
  font-family: var(--f-serif); font-size: 1.4rem; margin: 0; color: var(--c-pine);
  font-feature-settings: "tnum";
}
.me-hero-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; }

.me-group { margin: var(--s-5) 0; }
.me-group-label {
  font-family: var(--f-sans); font-size: .72rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--c-meta);
  margin: 0 0 var(--s-2); padding: 0 var(--s-2);
}
.me-group .row-list { gap: 1px; background: color-mix(in oklab, var(--c-rule), transparent 70%); border-radius: var(--r-md); overflow: hidden; }
.me-group .row { border: 0; border-radius: 0; }
.me-group .row:first-child { border-top-left-radius: var(--r-md); border-top-right-radius: var(--r-md); }
.me-group .row:last-child  { border-bottom-left-radius: var(--r-md); border-bottom-right-radius: var(--r-md); }
.me-group-danger { margin-top: var(--s-6); }
.me-session-actions { display: flex; gap: var(--s-2); flex-wrap: wrap; padding: 0 var(--s-2); }

/* Editorial still-life imagery (volume hero + per-lesson illustration).
   Width matches the content column (the parent .lesson / main wrapper); we
   explicitly zero figure inline margin because the UA stylesheet defaults
   <figure> to margin: 1em 40px which would push it past the text box. */
.vol-hero, .lesson-illustration {
  display: block;
  margin: var(--s-3) 0 var(--s-5);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}
.vol-hero img, .lesson-illustration img {
  display: block; width: 100%; max-width: 100%; height: auto;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  box-sizing: border-box;
  border-radius: var(--r-md);
  border: 1px solid color-mix(in oklab, var(--c-rule), transparent 30%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 8px 24px rgba(0,0,0,0.06);
  background: color-mix(in oklab, var(--c-rule), var(--c-bg) 70%);
}
.lesson-illustration { margin-top: var(--s-2); margin-bottom: var(--s-4); }
.lesson-illustration img { border-radius: var(--r-sm, 6px); }
@media (prefers-reduced-motion: no-preference) {
  .vol-hero img, .lesson-illustration img { transition: transform .35s ease; }
}

/* Inline lesson illustrations — placed at structurally-significant slots in
   the lesson body. Orientation is chosen per asset by the planner with
   mobile reading in mind: portrait fills the phone screen vertically and
   slows the reader, landscape stays compact for atmospheric pivots, and
   square is the default for infographics. We honor those choices via the
   data-orientation attribute. */
.lesson-inline-illustration {
  display: block;
  margin: var(--s-5) auto;
  width: 100%;
  max-width: 540px;
  box-sizing: border-box;
}
.lesson-inline-illustration img {
  display: block; width: 100%; max-width: 100%; height: auto;
  object-fit: cover;
  box-sizing: border-box;
  border-radius: var(--r-sm, 6px);
  border: 1px solid color-mix(in oklab, var(--c-rule), transparent 40%);
  box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 6px 18px rgba(0,0,0,0.05);
  background: color-mix(in oklab, var(--c-rule), var(--c-bg) 80%);
}
/* Orientation defaults — applied to the FIGURE (max-width) and to the IMG
   (aspect-ratio). Portrait gets a narrower max-width so it doesn't
   dominate desktop reads; on mobile it'll be full-width regardless. */
.lesson-inline-illustration[data-orientation="landscape"] { max-width: 540px; }
.lesson-inline-illustration[data-orientation="landscape"] img { aspect-ratio: 16 / 9; }

.lesson-inline-illustration[data-orientation="square"] { max-width: 460px; }
.lesson-inline-illustration[data-orientation="square"] img { aspect-ratio: 1 / 1; }

.lesson-inline-illustration[data-orientation="portrait"] { max-width: 360px; }
.lesson-inline-illustration[data-orientation="portrait"] img { aspect-ratio: 9 / 16; }

/* Infographics get a subtle outline shift — they read more like a diagram
   than a photo, so we tighten the corner radius and soften the shadow to
   communicate "structural" rather than "atmospheric." */
.lesson-inline-illustration[data-asset-type="infographic"] img {
  border-radius: var(--r-xs, 4px);
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  background: color-mix(in oklab, var(--c-rule), var(--c-bg) 88%);
}

/* Position-aware spacing — images right after the hook breathe more so they
   don't crowd the headline; images near the challenge sit tighter to mark
   the structural pivot. */
.lesson-inline-illustration[data-position="after-hook"] { margin-top: var(--s-6); }
.lesson-inline-illustration[data-position="before-challenge"] { margin-bottom: var(--s-4); }

/* Mobile (the primary surface): portraits and squares fill the column
   completely. Landscape stays at the natural 16:9 reading width. */
@media (max-width: 480px) {
  .lesson-inline-illustration { max-width: 100% !important; }
}

/* Detailed-companion scene/annotation anchors — invisible markers the JS
   uses to inject inline figures at the right structural boundary. Display
   none would skip them in the tree-walk; we keep them as zero-height spans. */
.dc-anchor {
  display: block;
  height: 0;
  overflow: hidden;
  /* Prevent the marker from affecting baseline / margin-collapse. */
  margin: 0;
  padding: 0;
}

/* Quiz */
.quiz { margin: var(--s-5) 0; }
.quiz fieldset { border: 1px solid var(--c-rule); border-radius: var(--r-md); padding: var(--s-4) var(--s-5); margin: 0; }
.quiz legend { padding: 0 var(--s-2); font-weight: 600; }
.quiz-options { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-3); }
.quiz-option {
  display: flex; align-items: flex-start; gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  cursor: pointer; background: var(--c-surface);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.quiz-option:hover { border-color: var(--c-rule-strong); }
.quiz-option input { accent-color: var(--c-pine); margin-top: 2px; }
.quiz-option.correct { border-color: var(--c-pine); background: color-mix(in oklab, var(--c-pine), var(--c-bg) 92%); }
.quiz-option.wrong { border-color: var(--c-clay); background: color-mix(in oklab, var(--c-clay), var(--c-bg) 92%); }
.quiz-feedback { margin-top: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--r-sm); }
.quiz-feedback.ok { background: color-mix(in oklab, var(--c-pine), var(--c-bg) 90%); color: var(--c-text); border: 1px solid color-mix(in oklab, var(--c-pine), transparent 70%); }
.quiz-feedback.no { background: color-mix(in oklab, var(--c-clay), var(--c-bg) 92%); color: var(--c-text); border: 1px solid color-mix(in oklab, var(--c-clay), transparent 70%); }

/* Challenge / reflection */
.challenge {
  background: color-mix(in oklab, var(--c-clay), var(--c-bg) 95%);
  border: 1px solid color-mix(in oklab, var(--c-clay), transparent 80%);
  border-radius: var(--r-md);
  padding: var(--s-5);
  margin: var(--s-5) 0;
}
.challenge h3 { color: var(--c-clay); margin: 0 0 var(--s-2); }

textarea, input[type="text"], input[type="email"], input[type="password"] {
  width: 100%;
  padding: var(--s-3) var(--s-4);
  border: 1px solid var(--c-rule-strong);
  background: var(--c-surface);
  border-radius: var(--r-md);
  color: var(--c-text);
  font: inherit;
  min-height: 44px;
}
textarea { min-height: 120px; resize: vertical; }
:where(textarea, input):focus-visible {
  outline: 3px solid var(--c-clay); outline-offset: 2px; border-color: var(--c-pine);
}

/* Onboarding */
.onb-step { display: none; }
.onb-step.active { display: block; }
.onb-options { display: flex; flex-direction: column; gap: var(--s-2); margin-top: var(--s-4); }
.onb-options label {
  display: flex; align-items: center; gap: var(--s-3);
  padding: var(--s-4);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  background: var(--c-surface);
  cursor: pointer;
  transition: border-color var(--t-fast);
}
.onb-options label:has(input:checked) { border-color: var(--c-pine); background: color-mix(in oklab, var(--c-pine), var(--c-bg) 94%); }
.onb-options input { accent-color: var(--c-pine); }
.onb-progress { display: flex; gap: 6px; margin-bottom: var(--s-5); }
.onb-progress span { flex: 1; height: 4px; background: var(--c-rule); border-radius: 2px; }
.onb-progress span.on { background: var(--c-pine); }
.onb-actions { display: flex; gap: var(--s-3); margin-top: var(--s-5); }

/* Paywall */
.tier-grid { display: grid; gap: var(--s-4); margin: var(--s-5) 0; }
@media (min-width: 540px) { .tier-grid { grid-template-columns: 1fr 1fr; } }
.tier {
  padding: var(--s-5); border-radius: var(--r-lg);
  border: 1px solid var(--c-rule); background: var(--c-surface);
  /* Column flex so the CTA button aligns to the bottom across all three
     cards even when feature counts differ (monthly has no savings line,
     semester/year do). plan-actions gets margin-top:auto to fill the gap. */
  display: flex;
  flex-direction: column;
}
.tier .plan-actions { margin-top: auto; }
.tier-prem { border-color: var(--c-pine); background: color-mix(in oklab, var(--c-pine), var(--c-bg) 96%); }

/* ─── Editorial hero above the picker ─────────────────────────────── */
/* Break out of the 720px reading column so 3 cards fit in one row at desktop. */
.subscribe-page {
  padding-top: 0;
  --tier-cols: 1fr;
}
@media (min-width: 760px)  { .subscribe-page { --tier-cols: 1fr 1fr; } }
@media (min-width: 1024px) {
  main:has(.subscribe-page) { max-width: 1080px !important; }
  .subscribe-page { --tier-cols: repeat(3, 1fr); }
}
.subscribe-page .tier-grid { grid-template-columns: var(--tier-cols) !important; }
.subscribe-hero {
  margin: var(--s-3) calc(-1 * var(--s-3)) var(--s-5);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-surface, var(--c-bg));
  box-shadow: 0 6px 20px -8px rgba(31,78,61,0.18);
  aspect-ratio: 16 / 7;           /* widescreen — crop top/bottom slightly */
  position: relative;
}
.subscribe-hero img {
  width: 100%; height: 100%;
  object-fit: cover;
  /* Keep the blueprint diagram in frame; crop wood-table edge top and bottom. */
  object-position: center 55%;
  display: block;
}
.subscribe-hero::after {
  /* Soft bottom gradient so any overlapping text reads. */
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg,
              transparent 55%,
              color-mix(in oklab, var(--c-bg), transparent 35%) 100%);
  pointer-events: none;
}
.subscribe-h1 {
  margin-top: 0;
  font-family: var(--f-serif, "Iowan Old Style", "Cambria", Georgia, serif);
  font-size: clamp(1.6rem, 4.2vw, 2.3rem);
  letter-spacing: -.01em;
}
.subscribe-intro { max-width: 56ch; }
@media (max-width: 600px) {
  .subscribe-hero { margin-left: 0; margin-right: 0; aspect-ratio: 4 / 3; }
}

/* ─── Tier card motif + best-value ribbon ─────────────────────────── */
.tier { position: relative; }
.tier-motif {
  margin: 0 auto var(--s-3);
  width: 120px; height: 120px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 92%);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c-pine), transparent 70%);
  /* Inline SVGs use `stroke="currentColor"` — pine on cards, cream on prem. */
  color: var(--c-pine);
  transition: transform .25s ease;
}
.tier:hover .tier-motif { transform: scale(1.03); }
.tier-motif svg {
  width: 78%; height: 78%;
  overflow: visible;
}
.tier-prem .tier-motif {
  background: var(--c-pine);
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--c-pine), white 25%),
              0 4px 16px -6px color-mix(in oklab, var(--c-pine), transparent 40%);
  color: var(--c-bg);
}
.tier-prem .tier-motif svg [fill="currentColor"] {
  /* On the dark pine card the .10 fill is too faint — bump to .20 for read. */
  fill-opacity: .20;
}
.tier-prem .tier-motif svg path { stroke-width: 2.8; }
.tier-ribbon {
  position: absolute;
  top: 14px; right: -8px;
  padding: 4px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--c-bg);
  background: var(--c-pine);
  border-radius: 4px 0 0 4px;
  box-shadow: -2px 2px 0 0 color-mix(in oklab, var(--c-pine), black 30%);
}

/* Coupon entry beneath the pricing cards. */
.coupon-row {
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  border: 1px dashed var(--c-rule);
  border-radius: var(--r-md);
  background: var(--c-surface);
}
.coupon-row label { display: block; margin-bottom: var(--s-2); }
.coupon-controls {
  display: flex; gap: var(--s-2); flex-wrap: wrap; align-items: center;
}
.coupon-controls input {
  flex: 1; min-width: 140px;
  padding: 8px 12px;
  border: 1px solid var(--c-rule); border-radius: var(--r-sm);
  background: var(--c-bg); color: var(--c-ink);
  font-size: 0.95rem; letter-spacing: .04em;
  text-transform: uppercase;
}
.coupon-status { margin: var(--s-2) 0 0; min-height: 1.2em; }
.tier h3 { font-family: var(--f-sans); font-size: 1rem; text-transform: uppercase; letter-spacing: .08em; color: var(--c-text-soft); margin-bottom: var(--s-2); }
.tier .price { font-family: var(--f-serif); font-size: 2rem; font-weight: 600; color: var(--c-text); margin-bottom: var(--s-2); }
.tier .price small { font-family: var(--f-sans); font-size: .9rem; font-weight: 500; color: var(--c-text-soft); margin-left: 4px; }
.tier ul { padding-left: 1.2em; }
.tier li { font-size: .94rem; }

/* Modal */
.modal { padding: 0; border: 0; border-radius: var(--r-lg); max-width: 480px; width: calc(100% - 32px); background: var(--c-surface); color: var(--c-text); box-shadow: var(--shadow-2); }
.modal::backdrop { background: rgba(26,32,44,.55); backdrop-filter: blur(2px); }
.modal article { padding: 0; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--c-rule); }
.modal-head h2 { margin: 0; font-size: 1.05rem; font-family: var(--f-sans); font-weight: 600; }
#modal-body { padding: var(--s-5); max-height: 70vh; overflow: auto; }
.modal-message {
  margin: 0 0 var(--s-5);
  color: var(--c-text);
  font-size: 0.96rem;
  line-height: 1.55;
}
.modal-actions {
  display: flex; gap: var(--s-2);
  justify-content: flex-end;
  flex-wrap: wrap;
}
.modal-actions .btn { min-width: 120px; }
@media (max-width: 480px) {
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .btn { width: 100%; }
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--s-5) + var(--safe-bot));
  transform: translateX(-50%);
  background: var(--c-ink); color: var(--c-cream);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-pill);
  font-size: .92rem;
  z-index: 50;
  box-shadow: var(--shadow-2);
}

/* Today screen */
.greet h1 { margin-bottom: 4px; }
.greet p { color: var(--c-text-soft); margin-bottom: var(--s-5); }
.streak-row { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-5); flex-wrap: wrap; }

/* Reflect screen */
.reflect-list { display: flex; flex-direction: column; gap: var(--s-3); }
.reflect-item { background: var(--c-surface); border: 1px solid var(--c-rule); border-radius: var(--r-md); padding: var(--s-4); }
.reflect-item .meta { margin-bottom: 4px; }

/* Mood picker */
.mood {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--s-2);
  margin: var(--s-4) 0;
}
.mood button {
  aspect-ratio: 1/1;
  border: 1px solid var(--c-rule); background: var(--c-surface);
  border-radius: var(--r-md); cursor: pointer;
  font-size: 1.5rem;
  transition: border-color var(--t-fast), background var(--t-fast), transform var(--t-fast);
}
.mood button[aria-pressed="true"] { border-color: var(--c-pine); background: color-mix(in oklab, var(--c-pine), var(--c-bg) 90%); }
.mood button:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Print: minimal */
@media print {
  .topbar, .tabs, .btn { display: none !important; }
  body { background: white; }
}

/* High contrast users */
@media (forced-colors: active) {
  .btn { border: 1px solid CanvasText; }
  .card, .row, .quiz-option { border: 1px solid CanvasText; }
}

/* Visually hidden */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ===== v0.6.0 volume sections ===== */

.vol-section {
  margin: var(--s-7) 0 var(--s-5);
}
.vol-section:first-of-type { margin-top: var(--s-5); }
.vol-section-head {
  margin-bottom: var(--s-3);
  padding-top: var(--s-4);
  border-top: 1px solid var(--c-rule);
}
.vol-section:first-of-type .vol-section-head {
  border-top: 0; padding-top: 0;
}
.vol-section-eyebrow {
  margin: 0 0 var(--s-2);
  color: var(--c-pine);
  font-size: 0.74rem; font-weight: 600;
  letter-spacing: 0.14em; text-transform: uppercase;
}
.vol-section-head h2 {
  font-family: var(--f-serif);
  font-size: 1.25rem; font-weight: 600;
  margin: 0 0 4px;
}
.vol-section-head .meta {
  margin: 0 0 var(--s-2);
  color: var(--c-text-soft);
  font-size: 0.92rem;
}

/* ===== v0.9.0 a11y + breadcrumbs ===== */

.breadcrumb {
  margin: 0 0 var(--s-3);
  font-size: 0.86rem;
  color: var(--c-text-soft);
}
.breadcrumb ol {
  list-style: none; padding: 0; margin: 0;
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.breadcrumb li:not(:first-child)::before {
  content: "›"; margin-right: 6px; color: var(--c-rule-strong); font-size: 1rem; vertical-align: -1px;
}
.breadcrumb a { color: var(--c-text-soft); text-decoration: none; }
.breadcrumb a:hover { color: var(--c-pine); text-decoration: underline; text-underline-offset: 3px; }
.breadcrumb [aria-current="page"] { color: var(--c-text); font-weight: 500; }

.transcript { margin-top: var(--s-3); padding-top: var(--s-3); border-top: 1px solid var(--c-rule); }
.transcript summary { cursor: pointer; color: var(--c-pine); font-size: 0.88rem; font-weight: 500; }
.transcript summary:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; border-radius: 4px; }
.transcript p { margin-top: var(--s-2); }

/* ===== v0.5.0 path / wisdom / legal ===== */

/* Path selection */
.path-card { padding: var(--s-6) var(--s-5) 0; }
.path-head { padding: var(--s-6) var(--s-3) var(--s-4); text-align: center; }
.path-head .splash-h1 { margin-top: 6px; }
.path-grid {
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-3) var(--s-3) var(--s-5);
}
@media (min-width: 720px) {
  .path-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); }
  .path-tile-both { grid-column: 1 / -1; }
}
.path-tile {
  background: var(--c-surface);
  border: 1.5px solid var(--c-rule);
  border-radius: var(--r-md);
  padding: var(--s-5);
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.path-tile:hover { border-color: var(--c-rule-strong); }
.path-tile:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }
.path-tile[aria-pressed="true"] {
  border-color: var(--c-pine);
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 92%);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--c-pine), transparent 80%);
}
.path-tile h3 { font-family: var(--f-serif); font-size: 1.2rem; margin: var(--s-3) 0 4px; }
.path-tile ul { padding-left: 1.1em; margin: var(--s-3) 0 0; }
.path-tile li { margin-bottom: var(--s-2); font-size: 0.94rem; }
.path-icon {
  width: 56px; height: 56px;
  background: var(--c-cream); border: 1px solid var(--c-rule);
  border-radius: 14px; display: grid; place-items: center;
  font-family: var(--f-serif); font-size: 1.6rem; color: var(--c-pine);
}
.path-icon img { width: 38px; height: 38px; object-fit: contain; }
.path-tile-both .path-icon { background: color-mix(in oklab, var(--c-clay), var(--c-bg) 90%); color: var(--c-clay); }

/* Wisdom card on Today */
.wisdom-card {
  background: linear-gradient(180deg,
    color-mix(in oklab, var(--c-clay), var(--c-bg) 96%),
    var(--c-surface));
  border: 1px solid color-mix(in oklab, var(--c-clay), transparent 78%);
  border-radius: var(--r-md);
  padding: var(--s-5);
  margin: var(--s-4) 0;
}
.wisdom-eyebrow {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.78rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--c-clay);
  margin-bottom: var(--s-3);
}
.wisdom-eyebrow .meta { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--c-text-soft); }
.wisdom-text {
  margin: 0; font-family: var(--f-serif); font-style: italic;
  font-size: 1.08rem; line-height: 1.5;
  color: var(--c-text);
}
.wisdom-actions {
  display: flex; gap: var(--s-4); margin-top: var(--s-4);
  align-items: center; flex-wrap: wrap;
}

/* Wisdom index page */
.wisdom-grid {
  display: grid; gap: var(--s-3);
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .wisdom-grid { grid-template-columns: 1fr 1fr; } }
.wisdom-tile {
  background: var(--c-surface); border: 1px solid var(--c-rule); border-radius: var(--r-md);
  padding: var(--s-4) var(--s-5);
}
.wisdom-tile.seen { background: var(--c-bg); opacity: 0.85; }
.wisdom-tile p { margin: 0; font-family: var(--f-serif); font-size: 1rem; line-height: 1.5; }

/* ─── Wisdom library (the /wisdom encyclopedia page) ─────────────────────── */
.wisdom-page .wisdom-head { margin-bottom: var(--s-4); }
.wisdom-page .wisdom-head h1 { margin: 0 0 6px; }

.wisdom-filters {
  margin: var(--s-3) 0 var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  display: flex; flex-direction: column; gap: var(--s-2);
}
.wisdom-search {
  width: 100%;
  padding: 10px 14px;
  font-size: 1rem;
  border: 1px solid var(--c-rule);
  border-radius: var(--r-sm);
  background: var(--c-bg);
  color: var(--c-ink);
}
.wisdom-search:focus {
  outline: 2px solid var(--c-pine);
  outline-offset: -1px;
}
.wisdom-chips {
  display: flex; gap: var(--s-3); flex-wrap: wrap; align-items: center;
}
.wisdom-chips label {
  display: flex; flex-direction: column; gap: 2px; font-size: .8rem;
}
.wisdom-chips select {
  padding: 6px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--c-rule);
  background: var(--c-bg); color: var(--c-ink);
  font-size: .9rem;
}
.wisdom-meta { margin: 0; font-size: .85rem; }

.wisdom-paywall {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 92%);
  border: 1px solid color-mix(in oklab, var(--c-pine), transparent 60%);
  margin-bottom: var(--s-4);
}
.wisdom-paywall p { margin: 4px 0 0; font-size: .92rem; }

/* Tile updates */
.wisdom-eyebrow { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.wisdom-course-pill {
  font-size: .68rem; font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 88%);
  color: var(--c-pine);
}
.wisdom-cat {
  font-size: .7rem; color: var(--c-text-soft);
  text-transform: uppercase; letter-spacing: .06em;
}
.wisdom-lock { margin-left: auto; font-size: .85rem; opacity: .55; }
.wisdom-tile-text { margin: var(--s-2) 0 var(--s-3) !important; }
.wisdom-themes {
  display: flex; gap: 6px; flex-wrap: wrap; font-size: .7rem;
}
.wisdom-themes span {
  padding: 2px 7px; border-radius: 4px;
  background: var(--c-bg); color: var(--c-text-soft);
}
.wisdom-tile.locked {
  position: relative;
  background: color-mix(in oklab, var(--c-rule), var(--c-bg) 60%);
  border-style: dashed;
}
.wisdom-tile.locked .wisdom-tile-text {
  color: var(--c-text-soft);
  filter: blur(0.25px);
  -webkit-mask-image: linear-gradient(to bottom, black 35%, transparent 95%);
          mask-image: linear-gradient(to bottom, black 35%, transparent 95%);
}
.wisdom-tile.locked::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: 36px; height: 1px;
  background: linear-gradient(to right, transparent, color-mix(in oklab, var(--c-pine), transparent 60%), transparent);
}
.wisdom-tile-unlock {
  display: inline-block;
  margin-top: var(--s-2);
  font-size: .85rem; font-weight: 600;
  color: var(--c-pine);
  text-decoration: none;
}
.wisdom-tile-unlock:hover { text-decoration: underline; }

.wisdom-pager {
  display: flex; align-items: center; justify-content: center;
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding: var(--s-3) 0;
}
.wisdom-pager button[disabled] { opacity: .4; cursor: not-allowed; }

@media (min-width: 1024px) {
  .wisdom-page .wisdom-grid { grid-template-columns: 1fr 1fr 1fr; }
  main:has(.wisdom-page) { max-width: 1180px !important; }
}

/* Legal page */
.legal-page article { max-width: 64ch; margin: 0 auto; }
.legal-page h1 { margin-top: var(--s-5); }
.legal-page h2 { margin-top: var(--s-7); border-top: 1px solid var(--c-rule); padding-top: var(--s-5); }
.legal-page h3 { margin-top: var(--s-5); }
.legal-page table {
  width: 100%; border-collapse: collapse; margin: var(--s-4) 0;
  font-size: 0.92rem;
}
.legal-page th, .legal-page td {
  padding: 8px 10px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--c-rule);
}
.legal-page th {
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 92%);
  font-weight: 600;
}

/* Onboarding legal block */
.onb-legal-block {
  margin-top: var(--s-4);
  padding: var(--s-3) var(--s-4);
  background: var(--c-bg);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
}
.onb-legal-label {
  display: flex; align-items: flex-start; gap: 12px;
  cursor: pointer; user-select: none;
  font-size: 0.92rem; line-height: 1.5;
}
.onb-legal-label input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px; flex: 0 0 auto;
  border: 2px solid var(--c-rule-strong);
  border-radius: 5px;
  background: var(--c-surface);
  display: grid; place-items: center;
  cursor: pointer; margin-top: 2px;
}
.onb-legal-label input[type="checkbox"]:checked {
  background: var(--c-pine); border-color: var(--c-pine);
}
.onb-legal-label input[type="checkbox"]:checked::after {
  content: ""; width: 6px; height: 11px;
  border: solid var(--c-cream); border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.onb-legal-label input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--c-clay); outline-offset: 2px;
}

/* ===== v0.4.0 splash ===== */

body.splash-active .topbar,
body.splash-active .tabs { display: none; }
body.splash-active main {
  padding: 0; max-width: 100%;
  min-height: 100dvh;
  display: flex; align-items: stretch; justify-content: center;
}

.splash {
  flex: 1 1 auto; display: flex; flex-direction: column;
  background: var(--c-bg);
  min-height: 100dvh;
  padding: max(var(--safe-top), 0px) 0 max(var(--safe-bot), 0px);
}
.splash-card {
  flex: 1 1 auto; display: flex; flex-direction: column;
  max-width: 720px; width: 100%; margin: 0 auto;
  padding: 0;
}

.splash-media {
  flex: 0 0 auto;
  background: var(--c-cream);
  border-bottom: 1px solid var(--c-rule);
  display: grid; place-items: center;
  overflow: hidden;
  aspect-ratio: 16/10;
  max-height: 46vh;
}
.splash-media img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  animation: splashFade var(--t-slow) var(--ease);
}
.splash-media .splash-icon {
  width: 38%; max-width: 220px; height: auto; object-fit: contain;
  padding: 28px;
  filter: drop-shadow(0 1px 0 rgba(26,32,44,0.04));
}
@keyframes splashFade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.splash-body {
  flex: 1 1 auto;
  padding: var(--s-6) var(--s-5) var(--s-3);
  display: flex; flex-direction: column; gap: var(--s-3);
  animation: splashFade var(--t-slow) var(--ease) 60ms backwards;
}
.splash-eyebrow {
  margin: 0; color: var(--c-text-soft);
  font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase;
}
.splash-h1 {
  margin: 0; font-family: var(--f-serif);
  font-size: clamp(1.8rem, 6vw, 2.4rem); font-weight: 600; letter-spacing: -0.01em;
  color: var(--c-text);
}
.splash-sub {
  margin: 0; font-family: var(--f-serif); font-style: italic;
  color: var(--c-pine);
  font-size: clamp(1rem, 3.4vw, 1.15rem);
}
.splash-text {
  margin: var(--s-2) 0 0;
  color: var(--c-text);
  font-size: 1rem; line-height: 1.62;
  max-width: 56ch;
}
.splash-bullets {
  margin: var(--s-2) 0 0;
  padding-left: 1.1em;
  display: flex; flex-direction: column; gap: var(--s-3);
  max-width: 56ch;
}
.splash-bullets li { line-height: 1.5; padding-left: 4px; }
.splash-bullets li::marker { color: var(--c-pine); font-weight: 700; }

.splash-foot {
  flex: 0 0 auto;
  padding: var(--s-3) var(--s-5) var(--s-5);
  border-top: 1px solid var(--c-rule);
  background: var(--c-bg);
}
.splash-dots {
  display: flex; gap: 8px; justify-content: center;
  padding: 4px 0 var(--s-4);
}
/* Splash dots — real <button>s with AAA-sized 44x44 hit area + visual 8px dot via ::after */
/* (See bottom of file for the consolidated rule.) */
.splash-actions {
  display: flex; gap: var(--s-3); justify-content: space-between; align-items: center;
}
.splash-actions .btn { min-width: 140px; }
.splash-actions .btn-link { color: var(--c-text-soft); }

.splash-dont {
  display: flex; align-items: center; justify-content: center;
  gap: 10px;
  padding: 4px 0 var(--s-3);
  color: var(--c-text-soft);
  font-size: 0.92rem;
  cursor: pointer;
  user-select: none;
}
.splash-dont input[type="checkbox"] {
  appearance: none; -webkit-appearance: none;
  width: 20px; height: 20px;
  border: 2px solid var(--c-rule-strong);
  border-radius: 5px;
  background: var(--c-surface);
  display: grid; place-items: center;
  cursor: pointer;
  transition: border-color var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
  flex: 0 0 auto;
}
.splash-dont input[type="checkbox"]:checked {
  background: var(--c-pine); border-color: var(--c-pine);
}
.splash-dont input[type="checkbox"]:checked::after {
  content: ""; width: 6px; height: 11px;
  border: solid var(--c-cream); border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}
.splash-dont input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--c-clay); outline-offset: 2px;
}
.splash-dont:hover input[type="checkbox"]:not(:checked) {
  border-color: var(--c-pine);
}

/* Tablet+ — image on the left, body on the right */
@media (min-width: 760px) {
  .splash-card { flex-direction: row; flex-wrap: wrap; }
  .splash-media {
    flex: 1 1 50%; max-height: none; aspect-ratio: auto;
    border-bottom: 0; border-right: 1px solid var(--c-rule);
  }
  .splash-body { flex: 1 1 50%; padding: var(--s-7) var(--s-6); justify-content: center; }
  .splash-foot { flex: 0 0 100%; }
}

/* ===== v0.3.0 additions ===== */

/* Audio card on lesson */
.audio-card {
  margin: 0 0 var(--s-5); padding: var(--s-3) var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
}
.audio-card audio { width: 100%; margin-top: 6px; }

/* Tap-to-highlight — real <button>s now (WCAG 4.1.2) */
.hl-btn {
  display: inline; width: 100%; text-align: left;
  background: transparent; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer;
  border-radius: 6px;
  transition: background var(--t-fast) var(--ease);
  min-height: 44px;          /* WCAG 2.5.5 enhanced target size */
}
.lesson-frame li, .lesson-takeaway li { list-style: disc outside; padding-left: 0; }
.lesson-frame .hl-btn, .lesson-takeaway .hl-btn { display: block; padding: 4px 6px; }
.hl-btn:hover { background: color-mix(in oklab, var(--c-clay), transparent 92%); }
.hl-btn.hl {
  background: color-mix(in oklab, var(--c-clay), var(--c-bg) 80%);
  box-shadow: inset 3px 0 0 0 var(--c-clay);
  padding-left: 12px;
}
.lesson-hook.hl-btn {
  font-family: var(--f-serif); font-size: 1.25rem; font-style: italic;
  color: var(--c-text);
  border-left: 3px solid var(--c-pine); padding: 8px var(--s-4); margin: var(--s-5) 0;
  line-height: 1.4;
  border-radius: 0 6px 6px 0;
}
.lesson-hook.hl-btn.hl {
  border-left-color: var(--c-clay);
  background: color-mix(in oklab, var(--c-clay), var(--c-bg) 88%);
}
.hl-btn:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }

/* Voice-recorder progress meter (replaced custom bar; native <progress> is screen-reader-aware) */
.vr-meter {
  flex: 1 1 80px; min-width: 80px; max-width: 200px;
  height: 8px; appearance: none; -webkit-appearance: none;
  background: var(--c-rule); border: 0; border-radius: var(--r-pill); overflow: hidden;
}
.vr-meter::-webkit-progress-bar { background: var(--c-rule); border-radius: var(--r-pill); }
.vr-meter::-webkit-progress-value { background: var(--c-pine); border-radius: var(--r-pill); transition: width 80ms linear; }
.vr-meter::-moz-progress-bar { background: var(--c-pine); border-radius: var(--r-pill); }

/* AAA target sizes: pagination dots, modal X */
.splash-dot {
  position: relative;
  width: 44px; height: 44px;
  background: transparent; border: 0; padding: 0;
  cursor: pointer;
}
.splash-dot::after {
  content: "";
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c-rule-strong);
  transition: width var(--t-fast) var(--ease), background var(--t-fast) var(--ease);
}
.splash-dot.on::after { width: 28px; border-radius: var(--r-pill); background: var(--c-pine); }
.splash-dot:focus-visible { outline: 3px solid var(--c-clay); outline-offset: -4px; border-radius: 50%; }
.splash-dot:hover::after { background: var(--c-pine); }

/* Chip / tag UI */
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 28px; padding: 0 10px;
  background: var(--c-surface);
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--r-pill);
  color: var(--c-text); text-decoration: none;
  font-size: .82rem;
}
.chip.on { background: color-mix(in oklab, var(--c-pine), var(--c-bg) 88%); border-color: var(--c-pine); color: var(--c-pine); }
.chip-static {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 92%);
  border: 1px solid color-mix(in oklab, var(--c-pine), transparent 78%);
  color: var(--c-pine);
  border-radius: var(--r-pill);
  font-size: .78rem;
}
.chip-static .x {
  background: transparent; border: 0; color: inherit; cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 0 2px;
}
.tag-input {
  height: 28px; min-height: 28px; padding: 0 10px;
  border-radius: var(--r-pill); border: 1px dashed var(--c-rule-strong);
  background: transparent; font-size: .85rem; max-width: 160px;
}

/* Tag filters strip */
.tag-filters { display: flex; flex-wrap: wrap; gap: 6px; }

.btn-link {
  background: transparent; border: 0; color: var(--c-pine); cursor: pointer;
  font: inherit; font-weight: 600; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px;
}
.btn-link:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; border-radius: 2px; }
.reflect-actions { display: flex; gap: 12px; margin-top: 8px; }

/* Checklist */
.checklist {
  list-style: none; padding: 0; margin: var(--s-4) 0;
  display: flex; flex-direction: column; gap: 8px;
}
.check-item {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px;
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
}
.check-item.done { background: color-mix(in oklab, var(--c-pine), var(--c-bg) 94%); border-color: color-mix(in oklab, var(--c-pine), transparent 75%); }
.check-box {
  flex: 0 0 28px; width: 28px; height: 28px;
  border: 2px solid var(--c-rule-strong); background: transparent;
  border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; font-weight: 700;
  color: var(--c-pine);
}
.check-box[aria-pressed="true"] { background: var(--c-pine); color: var(--c-cream); border-color: var(--c-pine); }
.check-box:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }
.check-text { flex: 1 1 auto; }
.check-note { width: 100%; min-height: 44px; margin-top: 6px; font-size: .92rem; }
.check-item.done .check-text > div:first-child { text-decoration: line-through; opacity: .8; }

/* Voice recorder */
.vr {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 0;
}
.vr-time {
  font-variant-numeric: tabular-nums; font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  min-width: 56px;
}
.vr-meter {
  flex: 1 1 80px; min-width: 80px; max-width: 200px;
  height: 8px; background: var(--c-rule); border-radius: var(--r-pill); overflow: hidden;
}
.vr-bar { display: block; height: 100%; width: 0%; background: var(--c-pine); transition: width 80ms linear; }
.vr audio { width: 100%; max-width: 100%; }

/* Voice note list items */
.vn-item {
  display: grid; grid-template-columns: 1fr; gap: 8px;
  padding: 12px; background: var(--c-surface);
  border: 1px solid var(--c-rule); border-radius: var(--r-md);
  margin-bottom: 8px;
}
@media (min-width: 540px) {
  .vn-item { grid-template-columns: 1fr 220px auto; align-items: center; }
}
.vn-meta { font-size: .9rem; }

/* Couples mode */
.card pre { background: var(--c-bg); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: .82rem; }
code { background: var(--c-rule); padding: 1px 6px; border-radius: 4px; font-size: .92em; }


/* ============================================================
   i18n — RTL + Urdu typography (Noto Nastaliq Urdu, self-hosted)
   ============================================================ */

@font-face {
  font-family: "Noto Nastaliq Urdu";
  src: url("/public/fonts/NotoNastaliqUrdu.ttf") format("truetype");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+08A0-08FF, U+FB50-FDFF, U+FE70-FEFF;
}

/* Urdu locale: swap fonts, keep AAA contrast, give more line-height for Nastaliq */
:root[lang="ur"], body.locale-ur {
  --f-serif: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Nafees Nastaleeq",
             "Iowan Old Style", "Newsreader", Georgia, serif;
  --f-sans:  "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Nafees Nastaleeq",
             "Public Sans", "Inter", system-ui, sans-serif;
}

body.locale-ur,
body.locale-ur p,
body.locale-ur li,
body.locale-ur button,
body.locale-ur input,
body.locale-ur textarea,
body.locale-ur h1,
body.locale-ur h2,
body.locale-ur h3 {
  /* Nastaliq needs roomier vertical rhythm; otherwise descenders collide */
  line-height: 1.95;
  letter-spacing: 0;
}
body.locale-ur h1 { line-height: 1.6; }
body.locale-ur h2, body.locale-ur h3 { line-height: 1.7; }

/* RTL flips — only the bits where direction-reversal matters semantically.
   Most of the layout is logical (gap, flexbox) and already RTL-aware. */
[dir="rtl"] .skip-link { left: auto; right: 8px; }

[dir="rtl"] .breadcrumb ol { padding-inline-start: 0; }
[dir="rtl"] .row-chev,
[dir="rtl"] .splash-actions .btn-link::before { transform: scaleX(-1); display: inline-block; }

/* Back-arrow text glyphs (‹/›) used as link prefixes — flip them in RTL */
[dir="rtl"] a.meta { unicode-bidi: plaintext; }

/* Highlight buttons render text-aligned; respect direction */
[dir="rtl"] .hl-btn { text-align: right; }
[dir="rtl"] .lesson-hook.hl-btn { border-left: 0; border-right: 3px solid var(--c-pine); border-radius: 6px 0 0 6px; }
[dir="rtl"] .lesson-hook.hl-btn.hl { border-right-color: var(--c-clay); border-left: 0; }
[dir="rtl"] .hl-btn.hl { box-shadow: inset -3px 0 0 0 var(--c-clay); padding-left: 6px; padding-right: 12px; }

/* Tabs at the bottom — keep "today" first by reversing in RTL so visual order matches reading order */
[dir="rtl"] .tabs { flex-direction: row-reverse; }

/* Onboarding progress dots: keep left-to-right step animation
   regardless of writing direction — these are progress, not text. */
.onb-progress { direction: ltr; }

/* Splash arrows in CTAs — handled by content text, no flip needed.
   But "‹ Back" / "Skip intro" link text reads naturally in either direction. */

/* Language switcher pill */
.lang-switch {
  display: inline-flex; gap: 4px; padding: 4px;
  background: var(--c-surface); border: 1px solid var(--c-rule); border-radius: var(--r-pill);
}
.lang-switch button {
  appearance: none; border: 0; background: transparent;
  padding: 6px 14px; border-radius: var(--r-pill);
  font: inherit; font-weight: 600; cursor: pointer;
  color: var(--c-text-soft); min-height: 36px;
}
.lang-switch button[aria-pressed="true"] {
  background: var(--c-pine); color: var(--c-cream);
}
.lang-switch button:focus-visible { outline: 3px solid var(--c-clay); outline-offset: 2px; }

/* Inline language picker on Me view */
.lang-picker {
  display: flex; flex-direction: column; gap: 8px;
  padding: var(--s-4); background: var(--c-surface);
  border: 1px solid var(--c-rule); border-radius: var(--r-md);
}
.lang-picker .lang-row {
  display: flex; gap: 12px; align-items: center;
}
.lang-picker label { display: flex; gap: 10px; align-items: center; cursor: pointer; }

/* Keep numerals always LTR so "5/35" doesn't render as "35/5" in RTL contexts */
.meta, .row-icon, .pill, code, .vr-time, .price { unicode-bidi: plaintext; }

/* Reduce orphan punctuation drift in mixed RTL/LTR sentences */
body.locale-ur { text-align: start; }

/* ============================================================
   "More context" — optional annotated case study below the lesson
   Quiet by default. Never competes with the micro-lesson.
   ============================================================ */

.more-context {
  margin: var(--s-6) 0 var(--s-5);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  background: var(--c-surface);
  overflow: hidden;
}
.more-context > summary {
  list-style: none;
  cursor: pointer;
  padding: var(--s-3) var(--s-4);
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 56px;
  justify-content: center;
  font: inherit;
  color: var(--c-text);
  position: relative;
  padding-inline-end: 44px;        /* leave room for chevron */
  border-radius: var(--r-md);
  transition: background var(--t-fast) var(--ease);
}
.more-context > summary::-webkit-details-marker { display: none; }
.more-context > summary::after {
  content: "+";
  position: absolute;
  inset-inline-end: var(--s-4);
  top: 50%;
  transform: translateY(-50%);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 1px solid var(--c-rule-strong);
  border-radius: 50%;
  font-weight: 600; font-size: 1.1rem;
  color: var(--c-pine);
  transition: transform var(--t-fast) var(--ease);
}
.more-context[open] > summary::after { content: "−"; }
.more-context > summary:hover { background: color-mix(in oklab, var(--c-pine), var(--c-bg) 92%); }
.more-context > summary:focus-visible {
  outline: 3px solid var(--c-clay);
  outline-offset: -3px;
}
.more-context-label {
  font-family: var(--f-sans);
  font-weight: 600;
  font-size: .98rem;
  color: var(--c-pine);
}
.more-context-sub {
  font-size: .82rem;
}

.more-context-body {
  padding: var(--s-4) var(--s-5) var(--s-5);
  border-top: 1px solid var(--c-rule);
  font-family: var(--f-serif);
  font-size: 1.02rem;
  line-height: 1.7;
  color: var(--c-text);
}
.more-context-body p {
  margin: 0 0 var(--s-3);
}
.more-context-body p:last-child {
  margin-bottom: 0;
  font-style: italic;
  color: var(--c-pine);
}

/* Scene headings — small, all-caps, sit close to the next paragraph */
.dc-scene-h {
  font-family: var(--f-sans);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c-text-soft);
  margin: var(--s-5) 0 var(--s-2);
  padding: 0;
}
.dc-scene-h:first-child { margin-top: 0; }
.dc-h {
  font-family: var(--f-serif);
  font-weight: 600;
  margin: var(--s-5) 0 var(--s-2);
}

/* Annotation block — visually distinct, like a sidebar/marginalia */
.dc-annotation {
  margin: var(--s-4) 0;
  padding: var(--s-3) var(--s-4);
  background: color-mix(in oklab, var(--c-clay), var(--c-bg) 94%);
  border-inline-start: 3px solid var(--c-clay);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  font-family: var(--f-sans);
  font-size: .94rem;
  line-height: 1.6;
  color: var(--c-text);
}
.dc-annotation p { margin: 0 0 var(--s-2); }
.dc-annotation p:last-child { margin-bottom: 0; font-style: normal; color: inherit; }

.dc-annotation-tag {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--c-clay);
  margin-bottom: 6px;
}

/* RTL — annotation sits on the right edge */
[dir="rtl"] .dc-annotation {
  border-inline-start: 0;
  border-inline-end: 3px solid var(--c-clay);
  border-radius: var(--r-md) 0 0 var(--r-md);
}

/* Force the meta italic-pine "closing question" only when it's clearly the last block */
.more-context-body > p:last-child {
  margin-top: var(--s-3);
}

/* Reduce visual weight on devices where the micro-lesson is what users came for */
@media (max-width: 480px) {
  .more-context-body { font-size: .98rem; padding: var(--s-3) var(--s-4); }
  .dc-annotation { padding: var(--s-3); }
}

/* ─── Multi-course platform (catalog, course landing, subscribe, feedback) ── */

.course-grid {
  display: grid;
  gap: var(--s-3);
  grid-template-columns: 1fr;
  margin-top: var(--s-3);
}
@media (min-width: 640px) {
  .course-grid { grid-template-columns: 1fr 1fr; }
}
.course-card {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--c-card, var(--c-bg));
  border: 1px solid var(--c-rule);
  border-radius: var(--r-card, var(--r-md));
  padding: var(--s-4);
  transition: border-color .15s ease, transform .15s ease;
}
.course-card:hover {
  border-color: color-mix(in oklab, var(--c-pine), transparent 60%);
  transform: translateY(-1px);
}
.course-card-head {
  display: flex;
  align-items: flex-start;
  gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.course-card-head img { flex: 0 0 auto; }
.course-card-name { flex: 1; }
.course-card-name h3 {
  margin: 0 0 2px;
  font-family: var(--f-serif);
  font-size: 1.1rem;
}
.course-card-name p { margin: 0; }
.course-card p { margin: 0 0 var(--s-3); }
.course-card-foot {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  flex-wrap: wrap;
}
.course-stats { margin-top: var(--s-2); }

/* ─── Library hub (active-course header + TOC + switcher) ─────────────────── */

.course-head {
  margin: 0 0 var(--s-7);
  padding: var(--s-5) 0 var(--s-6);
  border-bottom: 1px solid var(--c-rule);
}
.course-head-row {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
  margin-bottom: var(--s-4);
}
.course-head-row > img {
  flex: 0 0 auto;
  border-radius: var(--r-md, 8px);
  margin-top: 2px;
}
.course-head-name {
  flex: 1;
  min-width: 0;
}
.course-head-name h1 {
  margin: 0 0 var(--s-1);
  font-family: var(--f-serif);
  font-size: 1.65rem;
  line-height: 1.15;
}
.course-head-name p {
  margin: 0;
  line-height: 1.5;
}
.course-head-status {
  flex: 0 0 auto;
  margin-top: 4px;
}
.course-head-desc {
  margin: var(--s-4) 0 0;
  line-height: 1.6;
  color: var(--c-text);
  max-width: 65ch;
}
.course-head-trial-note {
  margin: var(--s-5) 0 0;
  padding: var(--s-3) var(--s-4);
  background: color-mix(in oklab, var(--c-clay), var(--c-bg) 92%);
  border: 1px solid color-mix(in oklab, var(--c-clay), transparent 70%);
  border-radius: var(--r-md, 8px);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s-2);
  line-height: 1.5;
}
.course-head-trial-note .pill { margin-right: var(--s-1); }

.library-toc {
  margin: 0 0 var(--s-8);
}
.library-toc-title,
.library-switcher-title {
  margin: 0 0 var(--s-3);
  font-family: var(--f-sans);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--c-text), transparent 35%);
}

.library-switcher {
  margin: var(--s-8) 0 var(--s-7);
  padding-top: var(--s-6);
  border-top: 1px solid var(--c-rule);
}
.library-switcher .library-switcher-title:not(:first-child) {
  margin-top: var(--s-7);
}
.library-switcher .course-grid {
  margin-top: var(--s-3);
  margin-bottom: var(--s-2);
}

/* Card variant for the switcher (article, not anchor — has its own CTAs). */
.course-card-mini {
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  background: var(--c-card, var(--c-bg));
  border: 1px solid var(--c-rule);
  border-radius: var(--r-card, var(--r-md));
  padding: var(--s-4);
  transition: border-color .15s ease;
}
.course-card-mini:hover {
  border-color: color-mix(in oklab, var(--c-pine), transparent 70%);
}
.course-card-mini .course-card-head { margin-bottom: 0; }
.course-card-mini .course-card-foot { margin-top: auto; }
.course-card-mini .onb-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin-top: var(--s-2) !important;
}

/* RTL refinements: flip the status pill placement. */
[dir="rtl"] .course-head-row { flex-direction: row-reverse; }
[dir="rtl"] .course-head-status { margin-left: 0; margin-right: auto; }

/* ─── Lock screen ─────────────────────────────────────────────────────────── */
.visually-hidden { position:absolute; left:-9999px; width:1px; height:1px; overflow:hidden; }

.lock-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: var(--c-bg);
  z-index: 100;
}
body.locked > header.topbar,
body.locked > main,
body.locked > nav.tabs { display: none !important; }
.lock-card {
  width: 100%; max-width: 380px;
  background: var(--c-paper);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md, 14px);
  padding: 36px 28px 28px;
  text-align: center;
  box-shadow: var(--shadow-2, 0 6px 24px -8px rgba(26,32,44,.18));
}
.lock-card img { display: block; margin: 0 auto 12px; }
.lock-card h1 { font-family: var(--f-serif); margin: 0 0 4px; }
.lock-card p.meta { margin: 0; }
.lock-card form {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 24px;
}
.lock-card input[type="password"] {
  height: 48px; padding: 0 16px;
  font: 600 1rem var(--f-sans); letter-spacing: 0.05em; text-align: center;
  background: var(--c-bg);
  color: var(--c-text);
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--r-pill);
  outline: none;
}
.lock-card input[type="password"]:focus-visible {
  border-color: var(--c-pine);
  outline: 2px solid color-mix(in oklab, var(--c-pine), transparent 50%);
  outline-offset: 1px;
}
.lock-card #lock-err,
.lock-card #login-err,
.lock-card #signup-err {
  color: var(--c-clay);
  font-weight: 500;
}

.lock-tabs {
  display: flex;
  gap: 2px;
  margin: 20px auto 0;
  padding: 4px;
  background: color-mix(in oklab, var(--c-rule), transparent 60%);
  border-radius: var(--r-pill);
  width: fit-content;
}
.lock-tab {
  padding: 6px 14px;
  font: 500 .82rem var(--f-sans);
  background: transparent;
  border: 0;
  color: color-mix(in oklab, var(--c-text), transparent 35%);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.lock-tab[aria-selected="true"] {
  background: var(--c-paper, var(--c-bg));
  color: var(--c-text);
  box-shadow: 0 1px 3px -1px rgba(0,0,0,.1);
}
.lock-card input[type="email"] {
  height: 44px; padding: 0 14px;
  font: 500 .92rem var(--f-sans);
  background: var(--c-bg);
  color: var(--c-text);
  border: 1px solid var(--c-rule-strong);
  border-radius: var(--r-pill);
  text-align: center;
  outline: none;
}
.lock-card input[type="email"]:focus-visible {
  border-color: var(--c-pine);
  outline: 2px solid color-mix(in oklab, var(--c-pine), transparent 50%);
  outline-offset: 1px;
}

/* ═══ Lesson pager (Previous / Next) ════════════════════════════════════
   The previous design crammed a label + a long lesson title into a .btn
   that assumed single-line content; long titles spilled past the visual
   container. The new design uses pager CARDS — a contained box that owns
   its own typography, 2-line clamps the title, and stacks vertically on
   narrow screens so titles never run wider than the column. */
.lesson-pager {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
  margin-top: var(--s-6);
  margin-bottom: var(--s-3);
}
.lesson-pager-empty { display: block; }   /* spacer when there's no prev */

.lesson-pager-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  min-height: 74px;
  background: var(--c-paper);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--c-ink);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
  overflow: hidden;
}
/* Next-card variant gets the chevron on the right; flip the grid order so
   the body sits left of the arrow. */
.lesson-pager-card[data-dir="next"] {
  grid-template-columns: 1fr auto;
  text-align: end;
}
.lesson-pager-card:hover {
  border-color: var(--c-rule-strong, var(--c-pine));
  box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 6px 16px rgba(0,0,0,0.05);
  transform: translateY(-1px);
}
.lesson-pager-card:focus-visible {
  outline: 2px solid var(--c-pine);
  outline-offset: 2px;
  border-color: var(--c-pine);
}
/* The "primary" next card (the action the reader most likely wants) is
   pine-tinted to draw the eye, like other primary CTAs in the app. */
.lesson-pager-card-primary {
  background: var(--c-pine);
  color: var(--c-paper);
  border-color: var(--c-pine);
}
.lesson-pager-card-primary:hover {
  background: var(--c-pine-soft, var(--c-pine));
  border-color: var(--c-pine-soft, var(--c-pine));
}

.lesson-pager-arrow {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--c-soft);
  font-family: var(--f-serif), Georgia, serif;
  font-weight: 400;
  flex-shrink: 0;
}
.lesson-pager-card-primary .lesson-pager-arrow {
  color: color-mix(in oklab, var(--c-paper), transparent 25%);
}

.lesson-pager-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;       /* lets the title actually shrink + truncate */
}

.lesson-pager-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--c-soft);
  line-height: 1.2;
}
.lesson-pager-card-primary .lesson-pager-label {
  color: color-mix(in oklab, var(--c-paper), transparent 25%);
}

.lesson-pager-title {
  /* Title is the SECONDARY info (the reader knows what they're moving
     toward; the directional cue is the action). Two-line clamp with a
     trailing ellipsis handles long Cambridge-style titles like
     "Choosing a partner is a structural decision" gracefully — never
     spilling past the card's visual box. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: var(--f-serif), Georgia, serif;
  font-size: 0.98rem;
  line-height: 1.3;
  font-weight: 500;
  color: var(--c-ink);
  /* Tight word-break so very long single words can still wrap rather than
     forcing overflow. */
  overflow-wrap: anywhere;
  word-break: normal;
  hyphens: auto;
}
.lesson-pager-card-primary .lesson-pager-title { color: var(--c-paper); }

/* Mobile (the primary surface): stack the two cards. Long titles still
   clamp to 2 lines but get the full column width to do so. */
@media (max-width: 560px) {
  .lesson-pager {
    grid-template-columns: 1fr;
    gap: var(--s-2);
  }
  /* When stacked, both cards align text to the start — the arrow direction
     still encodes which is which. */
  .lesson-pager-card,
  .lesson-pager-card[data-dir="next"] {
    grid-template-columns: auto 1fr;
    text-align: start;
  }
  .lesson-pager-card[data-dir="next"] {
    grid-template-areas: "body arrow";
  }
  .lesson-pager-card[data-dir="next"] .lesson-pager-body { grid-area: body; }
  .lesson-pager-card[data-dir="next"] .lesson-pager-arrow { grid-area: arrow; }
}

@media (prefers-reduced-motion: reduce) {
  .lesson-pager-card { transition: none; }
  .lesson-pager-card:hover { transform: none; }
}

/* ─── Segments — multi-axis library taxonomy ──────────────────────────── */
.segments-page .segments-head { margin-bottom: var(--s-5); }
.segments-page .segments-head h1 { margin: 0 0 6px; }

.segments-axis { margin: var(--s-5) 0; }
.segments-axis-head { margin-bottom: var(--s-3); }
.segments-axis-head h2 {
  font-family: var(--f-serif);
  font-size: 1.3rem;
  margin: 0 0 4px;
  color: var(--c-pine);
  letter-spacing: -.01em;
}
.segments-axis-head .meta { max-width: 60ch; }

.segments-grid {
  display: grid; gap: var(--s-3);
  grid-template-columns: 1fr;
}
@media (min-width: 640px)  { .segments-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1024px) { .segments-grid { grid-template-columns: 1fr 1fr 1fr; } }

.segment-card {
  display: flex; flex-direction: column; gap: var(--s-2);
  padding: var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  text-decoration: none; color: inherit;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.segment-card:hover {
  border-color: var(--c-pine);
  transform: translateY(-2px);
  box-shadow: 0 4px 14px -8px color-mix(in oklab, var(--c-pine), transparent 40%);
}
.segment-card-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-2);
}
.segment-card-head h3 {
  font-family: var(--f-serif);
  font-size: 1.05rem; font-weight: 600;
  margin: 0;
  color: var(--c-ink);
}
.segment-count {
  font-size: .85rem; font-weight: 700;
  color: var(--c-pine);
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--c-pine), var(--c-bg) 88%);
}
.segment-desc {
  font-size: .9rem; line-height: 1.5; color: var(--c-text-soft);
  margin: 0;
}
.segment-card-empty {
  opacity: .65;
  border-style: dashed;
}
.segment-card-empty .segment-count {
  background: var(--c-rule);
  color: var(--c-text-soft);
}
.segment-future-tag {
  display: inline-block;
  font-size: .68rem; font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px;
  background: var(--c-bg); color: var(--c-text-soft);
  align-self: flex-start;
}

/* Segment detail page */
.segment-detail-head {
  margin-bottom: var(--s-5);
  max-width: 60ch;
}
.segment-axis-label {
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: .72rem;
  margin: 0 0 4px;
}
.segment-detail-head h1 { margin: 0 0 8px; }
.segment-detail-head p { font-size: 1.05rem; }

.course-card-segs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: var(--s-2);
}
.segment-pill {
  font-size: .7rem; font-weight: 500;
  padding: 2px 8px; border-radius: 999px;
  background: var(--c-bg);
  color: var(--c-text-soft);
  border: 1px solid var(--c-rule);
}
.segment-pill-link {
  text-decoration: none;
  transition: background .15s ease, color .15s ease;
}
.segment-pill-link:hover {
  background: var(--c-pine);
  color: var(--c-bg);
  border-color: var(--c-pine);
}

.segment-related {
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: 1px solid var(--c-rule);
}
.segment-related h2 {
  font-family: var(--f-serif);
  font-size: 1.1rem;
  margin: 0 0 4px;
}
.segment-related-list {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin-top: var(--s-2);
}

/* ─── Install banner / install page / storage-consent modal ─────────────── */

.install-banner {
  display: flex; align-items: center; gap: var(--s-3);
  margin-bottom: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: color-mix(in oklab, var(--c-clay, #7C2D12), var(--c-bg) 92%);
  border: 1px solid color-mix(in oklab, var(--c-clay, #7C2D12), transparent 70%);
  border-radius: var(--r-md);
  font-size: 0.9rem;
}
.install-banner-text { flex: 1; }
.install-banner-text strong { display: block; margin-bottom: 2px; }
.install-banner-text .meta { color: var(--c-text); }
.install-banner-dismiss {
  background: transparent; border: 0; cursor: pointer;
  color: var(--c-text-soft); font-size: 1.1rem;
  padding: 4px 8px;
}
.install-banner-dismiss:hover { color: var(--c-ink); }

/* /install page */
.install-page .install-head { max-width: 60ch; margin-bottom: var(--s-4); }
.install-page .install-installed {
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: color-mix(in oklab, var(--c-pine, #1F4E3D), var(--c-bg) 90%);
  border-left: 3px solid var(--c-pine, #1F4E3D);
  border-radius: var(--r-sm);
}
.install-card {
  padding: var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
}
.install-card h2 {
  font-family: var(--f-serif);
  font-size: 1.1rem;
  margin: 0 0 var(--s-2);
  color: var(--c-pine, #1F4E3D);
}
.install-card ol, .install-card ul {
  margin: var(--s-2) 0;
  padding-left: 1.4em;
}
.install-card li { margin: 4px 0; }
.install-card-active {
  border-color: var(--c-pine, #1F4E3D);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--c-pine, #1F4E3D), transparent 78%);
}
.install-card-warn { background: color-mix(in oklab, var(--c-clay, #7C2D12), var(--c-bg) 94%); }
.install-card-info { background: color-mix(in oklab, var(--c-pine, #1F4E3D), var(--c-bg) 94%); }
.install-foot { margin-top: var(--s-5); text-align: center; }

/* Storage-consent modal */
.storage-consent-modal::backdrop { background: rgba(20,30,25,0.55); }
.storage-consent-card { max-width: 560px; padding: var(--s-5); }
.storage-consent-card h3 {
  font-family: var(--f-serif);
  margin-top: 0;
}
.storage-consent-card p { margin: 0 0 var(--s-3); line-height: 1.55; font-size: 0.95rem; }
.sc-recommend {
  padding: var(--s-2) var(--s-3);
  background: color-mix(in oklab, var(--c-pine, #1F4E3D), var(--c-bg) 90%);
  border-left: 3px solid var(--c-pine, #1F4E3D);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.sc-check {
  display: flex; align-items: flex-start; gap: var(--s-2);
  padding: var(--s-2) 0;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.45;
}
.sc-check input { margin-top: 3px; flex-shrink: 0; }

/* ─── Install one-click block + sync page ───────────────────────────────── */
.install-oneclick {
  margin-top: var(--s-3);
  padding: var(--s-3) var(--s-4);
  background: color-mix(in oklab, var(--c-pine, #1F4E3D), var(--c-bg) 90%);
  border-left: 3px solid var(--c-pine, #1F4E3D);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.install-oneclick p { margin: 0 0 var(--s-2); }
.install-locality-note {
  margin-top: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border: 1px dashed var(--c-rule);
  border-radius: var(--r-sm);
  background: var(--c-bg);
}
.install-gate-cancel { text-align: center; margin: var(--s-2) 0 0; font-size: 0.8rem; }
.install-gate-cancel a { color: var(--c-text-soft); }

.sync-page .sync-head { max-width: 65ch; margin-bottom: var(--s-4); }
.sync-warn {
  padding: var(--s-2) var(--s-3);
  background: color-mix(in oklab, var(--c-clay, #7C2D12), var(--c-bg) 92%);
  border-left: 3px solid var(--c-clay, #7C2D12);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  margin-bottom: var(--s-4);
}
.sync-warn strong { display: block; margin-bottom: 4px; }
.sync-card {
  padding: var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
  margin-bottom: var(--s-3);
}
.sync-card h2 {
  font-family: var(--f-serif);
  font-size: 1.1rem;
  margin: 0 0 var(--s-2);
  color: var(--c-pine, #1F4E3D);
}
.sync-card-note {
  background: color-mix(in oklab, var(--c-pine, #1F4E3D), var(--c-bg) 96%);
}
.sync-form {
  display: flex; flex-direction: column; gap: var(--s-2);
  margin: var(--s-3) 0;
}
.sync-form label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 0.9rem; color: var(--c-text-soft);
}
.sync-form label.checkbox { flex-direction: row; align-items: center; gap: 8px; }
.sync-form input[type="password"],
.sync-form input[type="file"] {
  font-size: 0.95rem; padding: 8px 12px;
  border: 1px solid var(--c-rule); border-radius: var(--r-sm);
  background: var(--c-bg); color: var(--c-ink);
}
.sync-form button { align-self: flex-start; }
.sync-msg { margin: 8px 0 0; min-height: 1.2em; }

/* ─── Branded install confirmation modal ─────────────────────────────── */
.install-modal::backdrop {
  background: color-mix(in oklab, var(--c-ink, #1a1a1a), transparent 35%);
  backdrop-filter: blur(2px);
}
.install-modal-card {
  max-width: 480px;
  padding: var(--s-5) var(--s-5) var(--s-4);
  text-align: left;
  border-radius: var(--r-lg);
  background: var(--c-surface, var(--c-bg));
  box-shadow: 0 24px 60px -16px color-mix(in oklab, var(--c-pine, #1F4E3D), transparent 55%);
}
.install-modal-art {
  margin: 0 auto var(--s-3);
  width: 96px; height: 96px;
  display: flex; align-items: center; justify-content: center;
  color: var(--c-pine, #1F4E3D);
}
.install-modal-art svg { width: 100%; height: 100%; }
.install-modal-card h3 {
  font-family: var(--f-serif);
  font-size: 1.35rem;
  margin: 0 0 var(--s-2);
  text-align: center;
  color: var(--c-ink);
}
.install-modal-sub {
  margin: 0 0 var(--s-3);
  text-align: center;
  color: var(--c-text-soft, var(--c-ink));
  font-size: 0.95rem;
  line-height: 1.5;
}
.install-modal-benefits {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--s-3);
}
.install-modal-benefits li {
  position: relative;
  padding: 8px 0 8px 26px;
  font-size: 0.92rem;
  line-height: 1.5;
  border-bottom: 1px solid color-mix(in oklab, var(--c-rule, #d4cfc1), transparent 50%);
}
.install-modal-benefits li:last-child { border-bottom: 0; }
.install-modal-benefits li::before {
  content: "✓";
  position: absolute; left: 0; top: 8px;
  font-weight: 700;
  color: var(--c-pine, #1F4E3D);
}
.install-modal-foot {
  margin: 0 0 var(--s-3);
  padding: var(--s-2) var(--s-3);
  background: color-mix(in oklab, var(--c-pine, #1F4E3D), var(--c-bg) 92%);
  border-left: 3px solid var(--c-pine, #1F4E3D);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 0.85rem;
  line-height: 1.45;
}
.install-modal-card .modal-actions {
  display: flex; justify-content: flex-end; gap: var(--s-2);
  margin: 0;
  padding: 0;
}

/* ─── Install-required card on lesson / reflect pages ───────────────────── */
.install-required-card {
  border: 1px solid color-mix(in oklab, var(--c-pine, #1F4E3D), transparent 70%);
  background: color-mix(in oklab, var(--c-pine, #1F4E3D), var(--c-bg) 96%);
  padding: var(--s-4);
  margin-top: var(--s-4);
}
.install-required-head {
  display: flex; align-items: flex-start; gap: var(--s-3);
  margin-bottom: var(--s-3);
}
.install-required-icon {
  flex-shrink: 0;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--c-pine, #1F4E3D);
  color: var(--c-bg, #fff);
  font-size: 1.1rem; font-weight: 700;
}
.install-required-head h3 {
  margin: 0 0 4px;
  font-family: var(--f-sans);
  font-size: 1rem;
}
.install-required-head .meta { line-height: 1.5; }
.install-required-disabled {
  margin: var(--s-3) 0;
  padding: var(--s-3);
  background: var(--c-bg);
  border: 1px dashed var(--c-rule);
  border-radius: var(--r-sm);
  opacity: .85;
}
.install-required-section-label {
  font-family: var(--f-sans);
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-text-soft);
  margin: 0 0 6px;
}
.install-required-disabled textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  border: 1px solid var(--c-rule);
  border-radius: 4px;
  background: color-mix(in oklab, var(--c-rule, #d4cfc1), var(--c-bg) 70%);
  color: var(--c-text-soft);
  font-family: inherit;
  resize: none;
  cursor: not-allowed;
}
.install-required-voice-placeholder {
  display: flex; align-items: center; gap: var(--s-2);
  padding: 12px;
  background: color-mix(in oklab, var(--c-rule, #d4cfc1), var(--c-bg) 70%);
  border-radius: 4px;
}
.install-required-mic { font-size: 1.4rem; opacity: .5; }
.install-required-actions {
  display: flex; align-items: center; gap: var(--s-3);
  margin-top: var(--s-3);
}

/* ─── Compliance UI: age attestation, pre-subscribe disclosure, refund ── */
.signup-age-attest {
  display: flex; align-items: flex-start; gap: 8px;
  margin: 12px 0 4px;
  font-size: 0.82rem;
  line-height: 1.45;
}
.signup-age-attest input { margin-top: 3px; flex-shrink: 0; }

.subscribe-disclose-modal::backdrop { background: rgba(20,30,25,0.55); }
.subscribe-disclose-card { max-width: 560px; padding: var(--s-5); }
.subscribe-disclose-card h3 {
  font-family: var(--f-serif);
  margin: 0 0 var(--s-2);
}
.subscribe-disclose-lede {
  margin: 0 0 var(--s-3);
  font-size: 0.95rem;
  line-height: 1.55;
}
.subscribe-disclose-facts {
  margin: 0 0 var(--s-3);
  padding: var(--s-3);
  background: color-mix(in oklab, var(--c-pine, #1F4E3D), var(--c-bg) 92%);
  border-radius: var(--r-sm);
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 14px;
  font-size: 0.9rem;
}
.subscribe-disclose-facts div { display: contents; }
.subscribe-disclose-facts dt {
  font-weight: 600;
  color: var(--c-pine, #1F4E3D);
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
}
.subscribe-disclose-facts dd { margin: 0; }
.subscribe-disclose-rights {
  padding: var(--s-2) var(--s-3);
  border-left: 3px solid var(--c-pine, #1F4E3D);
  background: var(--c-bg);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-size: 0.85rem;
  line-height: 1.5;
  margin: 0 0 var(--s-3);
}

.manage-sub {
  margin-top: var(--s-5);
  padding: var(--s-4);
  background: var(--c-surface);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-md);
}
.manage-sub h2 {
  font-family: var(--f-serif);
  font-size: 1.1rem;
  margin: 0 0 var(--s-2);
  color: var(--c-pine, #1F4E3D);
}
.manage-sub-actions {
  display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap;
  margin-top: var(--s-2);
}

.refund-page { max-width: 60ch; }
.refund-form {
  display: flex; flex-direction: column; gap: var(--s-3);
  margin: var(--s-4) 0;
}
.refund-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; }
.refund-form textarea {
  padding: var(--s-2);
  border: 1px solid var(--c-rule);
  border-radius: var(--r-sm);
  font-family: inherit;
  font-size: 0.95rem;
}
.refund-form button[type=submit]:disabled {
  opacity: .6; cursor: not-allowed;
}
.refund-msg { min-height: 1.2em; }

/* Offline UX (added 2026-06-14) */
.offline-banner{background:#7C2D12;color:#fff;font-size:.9rem;line-height:1.4;padding:8px 16px;text-align:center;}
.offline-empty{padding:28px 20px;text-align:center;border:1px dashed var(--rule,#E8E0D2);border-radius:14px;background:var(--paper,#fff);}
.offline-empty h3{margin:0 0 6px;font-size:1.1rem;}
