/* FocusBack. A sibling of Riil: warm paper, slate ink, deep teal that carries authority
   without severity, generous radii and soft layered shadows. FocusBack's own mark is the
   honey thread: the colour of your own attention and your own words. AI speaks in teal,
   quietly, and always second. Self-hosted fonts; nothing here contacts another server.
   Plus Jakarta Sans: Gumpita Rahayu / Tokotype. Literata: TypeTogether. IBM Plex Mono: IBM.
   All SIL OFL 1.1. */

@font-face { font-family: 'Plus Jakarta Sans'; src: url('../fonts/PlusJakartaSans.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Literata'; src: url('../fonts/Literata.woff2') format('woff2'); font-weight: 400 600; font-style: normal; font-display: swap; }
@font-face { font-family: 'Literata'; src: url('../fonts/Literata-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/IBMPlexMono-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'IBM Plex Mono'; src: url('../fonts/IBMPlexMono-500.woff2') format('woff2'); font-weight: 500; font-display: swap; }

:root {
  --ground: #faf8f4;
  --glow: rgba(233, 176, 84, .16);
  --surface: #ffffff;
  --inset: #f4f0e9;
  --ink: #25333c;
  --ink-muted: #5d6873;
  --ink-faint: #8a939b;
  --line: rgba(37, 51, 60, .11);
  --line-strong: rgba(37, 51, 60, .2);

  --accent: #1f4e5f;
  --accent-strong: #2c6a7e;
  --accent-soft: rgba(31, 78, 95, .08);
  --grad-accent: linear-gradient(180deg, var(--accent-strong) 0%, var(--accent) 65%);

  --honey: #dc9a2e;          /* the thread: your attention */
  --honey-ink: #8a5a12;      /* honey as readable text */
  --honey-wash: #fbf0da;     /* your own words sit on this */
  --swash: rgba(220, 154, 46, .28);
  --reveal: #b85335;         /* the reveal moment, as in Riil */
  --reveal-soft: rgba(184, 83, 53, .1);
  --trust: #2e7a5e;
  --ai: #2c6a7e;
  --ai-wash: rgba(31, 78, 95, .06);
  --danger: #a8321e;

  --shadow: 0 1px 1px rgba(37, 51, 60, .03), 0 2px 6px -2px rgba(37, 51, 60, .06), 0 16px 32px -24px rgba(37, 51, 60, .22);
  --shadow-lg: 0 1px 1px rgba(37, 51, 60, .03), 0 4px 10px -4px rgba(37, 51, 60, .07), 0 28px 56px -32px rgba(37, 51, 60, .28);

  --f-ui: 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-read: 'Literata', Georgia, 'Times New Roman', serif;
  --f-num: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --read-size: 19px;
  --read-leading: 1.68;
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  --gutter: 18px;
  --nav-h: 66px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #161b1f; --glow: rgba(232, 174, 76, .07); --surface: #1e252a; --inset: #252d33;
    --ink: #ece8e1; --ink-muted: #a9afb4; --ink-faint: #7d858b; --line: rgba(236, 232, 225, .1); --line-strong: rgba(236, 232, 225, .2);
    --accent: #3d7f93; --accent-strong: #4f95a9; --accent-soft: rgba(127, 181, 196, .12);
    --honey: #e8ae4c; --honey-ink: #f0c274; --honey-wash: #332a1a; --swash: rgba(232, 174, 76, .25);
    --reveal: #e3906f; --reveal-soft: rgba(227, 144, 111, .13); --trust: #6fbf9c; --ai: #8cc3d1; --ai-wash: rgba(127, 181, 196, .08); --danger: #f08a78;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 28px -18px rgba(0, 0, 0, .5);
    --shadow-lg: 0 1px 2px rgba(0, 0, 0, .3), 0 24px 48px -28px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #161b1f; --glow: rgba(232, 174, 76, .07); --surface: #1e252a; --inset: #252d33;
  --ink: #ece8e1; --ink-muted: #a9afb4; --ink-faint: #7d858b; --line: rgba(236, 232, 225, .1); --line-strong: rgba(236, 232, 225, .2);
  --accent: #3d7f93; --accent-strong: #4f95a9; --accent-soft: rgba(127, 181, 196, .12);
  --honey: #e8ae4c; --honey-ink: #f0c274; --honey-wash: #332a1a; --swash: rgba(232, 174, 76, .25);
  --reveal: #e3906f; --reveal-soft: rgba(227, 144, 111, .13); --trust: #6fbf9c; --ai: #8cc3d1; --ai-wash: rgba(127, 181, 196, .08); --danger: #f08a78;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 28px -18px rgba(0, 0, 0, .5);
  --shadow-lg: 0 1px 2px rgba(0, 0, 0, .3), 0 24px 48px -28px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 16px/1.55 var(--f-ui);
  background: radial-gradient(1200px 600px at 12% -10%, var(--glow), transparent 60%), var(--ground);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--honey); outline-offset: 2px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-family: var(--f-num); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }

/* ---------- shell ---------- */
.shell { max-width: 720px; margin: 0 auto; padding: 0 var(--gutter) calc(var(--nav-h) + 40px); }
.topbar { display: flex; align-items: center; gap: 12px; height: 64px; max-width: 720px; margin: 0 auto; padding: 0 var(--gutter); }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -.03em; }
.brand-mark { width: 26px; height: 7px; border-radius: 4px; background: linear-gradient(90deg, var(--honey) 0 55%, transparent 55% 70%, var(--honey) 70%); }
.topbar .spacer { flex: 1; }
.icon-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 14px; border: 0; background: transparent; cursor: pointer; color: var(--ink-muted); text-decoration: none; }
.icon-btn:hover { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.icon-btn svg { width: 22px; height: 22px; }

.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center; gap: 2px;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--line);
}
.nav a { flex: 1; max-width: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none; font-size: 12px; font-weight: 600; color: var(--ink-muted); border-radius: 14px; }
.nav a svg { width: 22px; height: 22px; }
.nav a[aria-current="page"] { color: var(--ink); }
.nav a[aria-current="page"]::after { content: ""; width: 18px; height: 4px; border-radius: 2px; background: var(--honey); }
@media (min-width: 900px) {
  .nav { position: sticky; top: 0; bottom: auto; height: auto; border: 0; padding: 6px; background: transparent; backdrop-filter: none; }
  .nav a { flex-direction: row; max-width: none; flex: 0 0 auto; padding: 9px 16px; font-size: 14px; gap: 8px; }
  .nav a svg { width: 18px; height: 18px; }
  .nav a[aria-current="page"] { background: var(--surface); box-shadow: var(--shadow); }
  .nav a[aria-current="page"]::after { display: none; }
  .shell { padding-bottom: 72px; }
}

/* ---------- type ---------- */
.eyebrow { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--reveal); margin: 0 0 10px; }
.eyebrow.quiet { color: var(--ink-muted); }
h1, h2, h3 { margin: 0; font-family: var(--f-ui); text-wrap: balance; letter-spacing: -.025em; line-height: 1.12; }
.h-page { font-size: clamp(30px, 7.4vw, 42px); font-weight: 800; margin: 14px 0 8px; }
.h-sec { font-size: 20px; font-weight: 750; margin: 36px 0 14px; }
.lede { color: var(--ink-muted); margin: 0 0 22px; max-width: 54ch; font-size: 16.5px; }
.muted { color: var(--ink-muted); }
.small { font-size: 14px; }
.tiny { font-size: 12.5px; }
/* Riil's highlighter swash, in FocusBack honey: marks the human part of a sentence. */
.swash { background: linear-gradient(transparent 58%, var(--swash) 58%, var(--swash) 92%, transparent 92%); padding: 0 .08em; border-radius: 2px; }
.serif { font-family: var(--f-read); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 0 22px;
  border-radius: 15px; border: 0; background: var(--grad-accent); color: #fff; font-weight: 700; font-size: 16px;
  cursor: pointer; text-decoration: none; box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 8px 18px -10px rgba(31, 78, 95, .6);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.btn:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, .18) inset, 0 12px 22px -10px rgba(31, 78, 95, .7); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong) inset; }
.btn.ghost:hover { box-shadow: 0 0 0 1px var(--ink-faint) inset, var(--shadow); }
.btn.quiet { background: transparent; color: var(--ink-muted); box-shadow: none; padding: 0 12px; font-weight: 600; }
.btn.quiet:hover { color: var(--ink); }
.btn.block { width: 100%; }
.btn.danger { background: var(--danger); box-shadow: none; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.linkish { background: none; border: 0; padding: 0; color: var(--ink-muted); text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; cursor: pointer; font-size: 14px; }
.linkish:hover { color: var(--ink); }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 15px; border-radius: 999px; border: 0; background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong) inset; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--ink); }
.chip:hover { box-shadow: 0 0 0 1px var(--ink-faint) inset; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--ground); box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 13px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset, var(--shadow); font-size: 13.5px; font-weight: 600; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--trust); }

/* ---------- cards ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 14px; }
.stack > * + * { margin-top: 12px; }

/* ---------- today ---------- */
.greet { font-size: 15px; color: var(--ink-muted); margin: 10px 0 4px; }
.page-card { position: relative; padding: 26px 22px 22px 30px; overflow: hidden; box-shadow: var(--shadow-lg); }
.page-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--honey); }
.page-title { font-size: clamp(25px, 6.4vw, 33px); font-weight: 800; line-height: 1.12; margin: 2px 0 10px; letter-spacing: -.03em; }
.page-meta { color: var(--ink-muted); margin: 0 0 18px; }
.teaser { font-family: var(--f-read); font-size: 16.5px; line-height: 1.55; color: var(--ink); margin: 0 0 20px; padding: 14px 16px; border-radius: var(--r-md); background: var(--inset); }
.teaser .from { display: block; font-family: var(--f-ui); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-muted); margin-bottom: 6px; }
.story { font-size: 17px; line-height: 1.7; margin: 0; }
.story b { font-family: var(--f-num); font-weight: 500; color: var(--reveal); font-size: .95em; white-space: nowrap; }
.coach { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-md); background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; font-size: 15px; }
.coach + .coach { margin-top: 10px; }
.coach .dot { flex: 0 0 9px; height: 9px; border-radius: 50%; background: var(--honey); margin-top: 7px; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-radius: var(--r-md); overflow: hidden; margin-top: 16px; }
.metric-row > div { background: var(--surface); padding: 12px 14px; }
.metric-row .k { font-size: 12.5px; color: var(--ink-muted); }
.metric-row .v { font-family: var(--f-num); font-size: 19px; font-weight: 500; margin-top: 2px; }
.metric-row .v.none { color: var(--ink-faint); }

/* ---------- the thread (signature) ---------- */
.thread-rail { position: fixed; left: 0; top: 0; bottom: 0; width: 7px; background: var(--line); z-index: 30; }
.thread-fill { position: absolute; left: 0; top: 0; width: 100%; background: var(--honey); transition: height .9s linear; border-radius: 0 0 4px 0; }
.thread-notch { position: absolute; left: 0; width: 14px; height: 3px; background: var(--ink); border-radius: 0 2px 2px 0; }
.thread-knot { position: absolute; left: -4px; bottom: 8px; width: 15px; height: 15px; border-radius: 50%; background: var(--honey); box-shadow: 0 0 0 4px var(--ground); transform: scale(0); transition: transform .5s cubic-bezier(.3, 1.6, .5, 1); }
.thread-rail.done .thread-knot { transform: scale(1); }
@media (min-width: 900px) { .thread-rail { width: 9px; } }

.threadlog { display: grid; gap: 16px; }
.tl-row { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; align-items: end; }
.tl-label { font-size: 13.5px; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tl-label b { color: var(--ink); font-weight: 650; }
.tl-val { font-family: var(--f-num); font-size: 13px; color: var(--ink); text-align: right; }
.tl-bar { grid-column: 1 / -1; position: relative; height: 12px; display: flex; align-items: center; }
.tl-seg { height: 7px; border-radius: 4px; background: var(--honey); flex: none; }
.tl-gap { height: 2px; flex: none; background: repeating-linear-gradient(90deg, var(--ink-faint) 0 2px, transparent 2px 5px); opacity: .7; }
.tl-think { height: 7px; border-radius: 4px; background: var(--ink); flex: none; margin-left: 3px; }
.tl-ai { width: 11px; height: 11px; border-radius: 50%; background: var(--ai); margin-left: 4px; flex: none; }
.tl-listen { height: 7px; border-radius: 4px; flex: none; background: repeating-linear-gradient(90deg, var(--honey) 0 3px, transparent 3px 6px); }
.tl-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--ink-muted); margin-top: 16px; }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl-legend i { display: inline-block; width: 16px; height: 7px; border-radius: 4px; }
.draw .tl-bar > * { animation: grow .7s cubic-bezier(.2, .8, .2, 1) both; transform-origin: left center; }
@keyframes grow { from { transform: scaleX(0); } }

/* ---------- session beats ---------- */
.beats { display: flex; gap: 6px; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; color: var(--ink-faint); letter-spacing: .02em; margin: 2px 0 0; }
.beats span { display: inline-flex; align-items: center; gap: 6px; }
.beats span + span::before { content: ""; width: 16px; height: 2px; border-radius: 1px; background: var(--line-strong); }
.beats .on { color: var(--ink); }
.beats .done { color: var(--honey-ink); }

.reader-top {
  position: sticky; top: 0; z-index: 15; max-width: 780px; margin: 0 auto; padding: 8px var(--gutter) 6px 20px;
  background: color-mix(in srgb, var(--ground) 92%, transparent); backdrop-filter: blur(10px);
}
.reader-bar { display: flex; align-items: center; gap: 4px; height: 46px; }
@media (max-width: 440px) { .reader-title { visibility: hidden; } }
.reader-title { flex: 1; min-width: 0; font-size: 14px; font-weight: 650; color: var(--ink-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.timer { font-family: var(--f-num); font-size: 15px; padding: 6px 11px; border-radius: 11px; background: var(--surface); box-shadow: 0 0 0 1px var(--line) inset; white-space: nowrap; }
.timer .of { color: var(--ink-faint); }
.locked { position: relative; }
.locked::after { content: ""; position: absolute; right: 7px; bottom: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); box-shadow: 0 0 0 2px var(--ground); }

/* threshold: the quiet page before reading */
.threshold { max-width: 560px; margin: 0 auto; padding: 5vh var(--gutter) 60px; }
.threshold .page-title { font-size: clamp(30px, 8vw, 44px); }
.promise { font-size: 18px; color: var(--ink-muted); margin: 0 0 26px; max-width: 40ch; }
.promise b { color: var(--ink); }

.reader { max-width: 680px; margin: 0 auto; padding: 10px 24px 200px 28px; }
.reader h1 { font-family: var(--f-read); font-weight: 600; font-size: calc(var(--read-size) * 1.6); line-height: 1.2; letter-spacing: -.01em; margin: 18px 0 6px; }
.reader .source { font-size: 13px; color: var(--ink-muted); margin-bottom: 30px; }
.reader p, .reader .h {
  font-family: var(--f-read); font-size: var(--read-size); line-height: var(--read-leading);
  margin: 0 0 1.05em; hyphens: auto; overflow-wrap: break-word; scroll-margin-top: 110px;
  border-radius: 6px; transition: background .5s;
}
:root[data-font="sans"] .reader p, :root[data-font="sans"] .reader .h, :root[data-font="sans"] .reader h1 { font-family: var(--f-ui); }
.reader .h { font-weight: 600; font-size: calc(var(--read-size) * 1.12); margin-top: 1.6em; }
.reader p.here { background: var(--honey-wash); box-shadow: -10px 0 0 var(--honey-wash), 10px 0 0 var(--honey-wash); }
.reader p.speaking { background: var(--ai-wash); box-shadow: -10px 0 0 var(--ai-wash), 10px 0 0 var(--ai-wash); }
.reader .pageref { font-family: var(--f-num); font-size: 11px; color: var(--ink-faint); margin-left: 6px; }
.reader-end { text-align: center; color: var(--ink-muted); font-size: 14px; padding: 28px 0; border-top: 1px dashed var(--line-strong); }

.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 16; padding: 14px var(--gutter) calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--ground) 32%); }
.dock-inner { max-width: 640px; margin: 0 auto; display: flex; gap: 10px; align-items: center; justify-content: center; }
.dock-msg { font-size: 14.5px; color: var(--ink); text-align: center; margin: 0 auto 10px; max-width: 640px; font-weight: 600; }
.dock .btn.ghost { min-width: 50px; padding: 0 16px; }

.define-chip { position: absolute; z-index: 25; transform: translate(-50%, -115%); padding: 7px 13px; border-radius: 12px; border: 0; background: var(--ink); color: var(--ground); font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow-lg); }
.define-chip[aria-disabled="true"] { background: var(--ink-muted); font-weight: 500; max-width: 250px; }

/* your turn */
.stage { max-width: 680px; margin: 0 auto; padding: 10px var(--gutter) 150px 24px; }
.turn-title { font-size: clamp(34px, 9vw, 48px); font-weight: 800; letter-spacing: -.035em; line-height: 1; margin: 6px 0 12px; }
.gate-q { font-size: clamp(21px, 5.4vw, 27px); font-weight: 700; line-height: 1.22; margin: 0 0 18px; letter-spacing: -.02em; }
.take-box {
  width: 100%; min-height: 160px; resize: vertical; padding: 18px 18px 18px 20px; font-family: var(--f-read); font-size: 18.5px; line-height: 1.55;
  background: var(--surface); border: 0; box-shadow: 0 0 0 1.5px var(--line-strong) inset, var(--shadow); border-left: 7px solid var(--honey); border-radius: var(--r-md); color: var(--ink);
}
.take-box:focus { outline: none; box-shadow: 0 0 0 2px var(--honey) inset, var(--shadow-lg); }
.take-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; color: var(--ink-muted); margin: 10px 0 18px; }
.gate-warn { color: var(--danger); font-size: 14px; margin: -8px 0 14px; }

/* the reveal */
.your-take { background: var(--honey-wash); border-radius: var(--r-lg); padding: 18px 20px 18px 22px; border-left: 7px solid var(--honey); }
.your-take .label { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--honey-ink); margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.your-take .text { font-family: var(--f-read); font-size: 19px; line-height: 1.55; white-space: pre-wrap; }
.your-take + .your-take { margin-top: 10px; }
.your-take.revised { background: var(--surface); box-shadow: var(--shadow); }
.locked-in { animation: settle .6s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes settle { from { transform: translateY(10px) scale(.985); opacity: 0; } }

.ai-block { margin-top: 18px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.ai-head { display: flex; align-items: center; gap: 8px; padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-muted); }
.ai-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--ai); background: var(--ai-wash); padding: 5px 9px; border-radius: 8px; }
.ai-sec { padding: 18px 20px; font-size: 15.5px; }
.ai-sec + .ai-sec { border-top: 1px solid var(--line); }
.ai-sec h3 { font-size: 14.5px; font-weight: 750; margin: 0 0 12px; letter-spacing: -.01em; }
.ai-sec ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.ai-sec li { display: grid; grid-template-columns: 14px 1fr; gap: 9px; }
.ai-sec li::before { content: ""; width: 8px; height: 8px; margin-top: 8px; border-radius: 3px; background: var(--ai); }
.ai-sec li.hit::before { background: var(--honey); border-radius: 50%; }
.kind { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--reveal); margin-right: 6px; }
.push { font-family: var(--f-read); font-style: italic; font-size: 19px; line-height: 1.5; }
.cite { display: inline-flex; align-items: center; margin-left: 6px; padding: 1px 8px; border-radius: 7px; border: 0; box-shadow: 0 0 0 1px var(--line-strong) inset; background: var(--ground); font-family: var(--f-num); font-size: 12px; color: var(--ink-muted); cursor: pointer; vertical-align: 1px; }
.cite:hover { color: var(--ai); box-shadow: 0 0 0 1px var(--ai) inset; }
.ai-foot { padding: 13px 20px; font-size: 12.5px; color: var(--ink-muted); background: var(--inset); }
.reveal-in { animation: settle .55s cubic-bezier(.2, .8, .2, 1) both; }
.score { display: flex; align-items: center; gap: 16px; }
.score .big { font-family: var(--f-ui); font-size: clamp(34px, 9vw, 44px); font-weight: 800; color: var(--reveal); letter-spacing: -.03em; line-height: 1; white-space: nowrap; }
.dots { display: flex; gap: 7px; }
.dots i { width: 15px; height: 15px; border-radius: 50%; box-shadow: 0 0 0 2px var(--line-strong) inset; }
.dots i.on { background: var(--honey); box-shadow: none; animation: pop .4s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes pop { from { transform: scale(0); } }
.calib { font-size: 14px; color: var(--ink-muted); margin: 12px 0 0; }
.reveal-btn { margin: 4px 20px 20px; }

.wait { padding: 22px 20px; }
.wait-line { display: flex; align-items: center; gap: 10px; color: var(--ink-muted); font-size: 15px; }
.pulse { width: 10px; height: 10px; border-radius: 50%; background: var(--ai); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.55); opacity: .4; } }
.confidence { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line-strong); }

/* the ending */
.ending-title { font-size: clamp(30px, 8vw, 42px); font-weight: 800; letter-spacing: -.035em; margin: 6px 0 16px; line-height: 1.05; }
.next-target { font-family: var(--f-num); font-size: 46px; font-weight: 500; letter-spacing: -.03em; line-height: 1; margin: 4px 0 8px; color: var(--ink); }
.growth { display: grid; gap: 10px; }
.growth .tag { justify-self: start; }

/* ---------- library ---------- */
.lib-item { display: grid; grid-template-columns: 1fr auto; gap: 7px 12px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.lib-item:last-child { border-bottom: 0; }
.lib-title { font-weight: 750; font-size: 17px; line-height: 1.3; text-decoration: none; letter-spacing: -.01em; }
.lib-title:hover { text-decoration: underline; text-decoration-color: var(--honey); text-underline-offset: 4px; }
.lib-meta { grid-column: 1 / -1; font-size: 13px; color: var(--ink-muted); display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--inset); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--honey); border-radius: 3px; }
.tag { display: inline-flex; font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 7px; background: var(--inset); color: var(--ink-muted); }
.search { width: 100%; height: 50px; padding: 0 16px; border-radius: 15px; border: 0; box-shadow: 0 0 0 1px var(--line-strong) inset; background: var(--surface); }
.search:focus { outline: none; box-shadow: 0 0 0 2px var(--accent) inset; }

/* ---------- forms ---------- */
.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label, .field .label { font-size: 14px; font-weight: 700; }
.input, .textarea, .select { width: 100%; min-height: 50px; padding: 11px 15px; border-radius: 15px; border: 0; box-shadow: 0 0 0 1px var(--line-strong) inset; background: var(--surface); }
.textarea { min-height: 190px; font-family: var(--f-read); line-height: 1.55; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { outline: none; box-shadow: 0 0 0 2px var(--accent) inset; }
.tabs { display: flex; gap: 4px; padding: 5px; background: var(--surface); border-radius: 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.tabs button { flex: 1; min-height: 44px; border: 0; border-radius: 12px; background: transparent; font-weight: 700; color: var(--ink-muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--ink); color: var(--ground); }
.option { display: flex; gap: 12px; align-items: flex-start; padding: 15px 17px; border-radius: var(--r-md); background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong) inset; cursor: pointer; }
.option + .option { margin-top: 8px; }
.option input { margin-top: 4px; accent-color: var(--accent); width: 18px; height: 18px; flex: none; }
.option b { display: block; color: var(--ink); }
.option span { font-size: 14px; color: var(--ink-muted); }
.option:has(input:checked) { box-shadow: 0 0 0 2px var(--accent) inset; }
.error { color: var(--danger); font-size: 14px; }
.notice { padding: 15px 17px; border-radius: var(--r-md); background: var(--ai-wash); font-size: 14.5px; }

/* ---------- story (progress) ---------- */
.metrics { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .metrics { grid-template-columns: 1fr 1fr; } }
.metric { background: var(--surface); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); }
.metric.hero { grid-column: 1 / -1; padding: 24px 22px; }
.metric .k { font-size: 14px; font-weight: 700; }
.metric .v { font-family: var(--f-num); font-size: 28px; font-weight: 500; margin: 4px 0 2px; }
.metric.hero .v { font-family: var(--f-ui); font-weight: 800; font-size: clamp(42px, 11vw, 60px); letter-spacing: -.04em; color: var(--reveal); }
.metric .d { font-size: 13.5px; color: var(--ink-muted); }
.metric .v.none { color: var(--ink-faint); }
.spark { display: block; width: 100%; height: 42px; margin-top: 12px; }
.spark path.line { fill: none; stroke: var(--honey-ink); stroke-width: 2; }
.spark path.area { fill: var(--honey-wash); }

/* ---------- overlays ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(22, 27, 31, .42); display: flex; align-items: flex-end; justify-content: center; animation: fade .18s ease; }
@media (min-width: 700px) { .scrim { align-items: center; } }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--surface); border-radius: 26px 26px 0 0; padding: 24px 22px calc(24px + env(safe-area-inset-bottom)); animation: rise .24s cubic-bezier(.2, .8, .2, 1); }
@media (min-width: 700px) { .sheet { border-radius: 26px; } }
.sheet h2 { font-size: 22px; font-weight: 800; margin-bottom: 8px; }
.sheet .body { color: var(--ink-muted); margin-bottom: 18px; }
.sheet .passage { font-family: var(--f-read); font-size: 17px; line-height: 1.62; color: var(--ink); padding: 15px 17px; background: var(--ground); border-radius: var(--r-md); border-left: 4px solid var(--ai); }
.sheet .btn-row { flex-direction: column; align-items: stretch; }
@media (min-width: 700px) { .sheet .btn-row { flex-direction: row-reverse; justify-content: flex-start; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.toast { position: fixed; left: 50%; top: 76px; z-index: 60; transform: translateX(-50%); background: var(--ink); color: var(--ground); padding: 11px 17px; border-radius: 14px; font-weight: 600; font-size: 14px; box-shadow: var(--shadow-lg); animation: rise .2s ease; max-width: calc(100vw - 32px); }

.back-here { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: color-mix(in srgb, var(--ground) 86%, transparent); backdrop-filter: blur(4px); padding: var(--gutter); }
.back-card { max-width: 430px; width: 100%; box-shadow: var(--shadow-lg); }
.back-card .quote { font-family: var(--f-read); font-size: 17px; line-height: 1.55; margin: 12px 0 18px; padding-left: 14px; border-left: 4px solid var(--honey); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.reset { position: fixed; inset: 0; z-index: 45; background: var(--ground); display: grid; place-items: center; text-align: center; padding: var(--gutter); }
.reset-line { width: 7px; height: 50vh; border-radius: 4px; background: var(--line); margin: 0 auto 24px; position: relative; overflow: hidden; }
.reset-line i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--honey); height: 0; transition: height 30s linear; }

/* ---------- prologue ---------- */
.prologue { max-width: 560px; margin: 0 auto; padding: 22px var(--gutter) 40px; min-height: 100dvh; display: flex; flex-direction: column; }
.prologue-top { display: flex; align-items: center; justify-content: space-between; height: 44px; margin-bottom: 18px; }
.progress-dots { display: flex; gap: 6px; }
.progress-dots i { width: 22px; height: 5px; border-radius: 3px; background: var(--line-strong); }
.progress-dots i.on { background: var(--honey); }
.scene { flex: 1; display: flex; flex-direction: column; justify-content: center; animation: settle .5s cubic-bezier(.2, .8, .2, 1) both; }
.scene-title { font-size: clamp(32px, 8.6vw, 46px); font-weight: 800; letter-spacing: -.035em; line-height: 1.04; margin: 0 0 16px; }
.scene-body { font-size: 18px; color: var(--ink-muted); margin: 0 0 26px; max-width: 42ch; line-height: 1.6; }
.scene-body b { color: var(--ink); font-weight: 650; }
.vignette { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); padding: 20px; margin: 0 0 28px; }
.vignette .lines i { display: block; height: 9px; border-radius: 5px; background: var(--inset); margin-bottom: 9px; }
.vignette .lines i.read { background: var(--honey); opacity: .85; }
.vignette .bubble { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; padding: 9px 13px; border-radius: 14px; background: var(--ai-wash); color: var(--ai); font-size: 14px; font-weight: 700; }
.vignette .bubble svg { width: 18px; height: 18px; }
.vignette .bubble.tap { animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-3px); } }
.order { display: grid; gap: 10px; }
.order-step { display: grid; grid-template-columns: 36px 1fr; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); box-shadow: var(--shadow); }
.order-step .n { width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 15px; }
.order-step:nth-child(1) .n { background: var(--honey-wash); color: var(--honey-ink); }
.order-step:nth-child(2) .n { background: var(--honey-wash); color: var(--honey-ink); }
.order-step:nth-child(3) .n { background: var(--ai-wash); color: var(--ai); }
.order-step b { display: block; color: var(--ink); }
.order-step span { font-size: 14px; color: var(--ink-muted); }
.goal { display: block; width: 100%; text-align: left; padding: 17px 19px; border-radius: var(--r-md); border: 0; background: var(--surface); box-shadow: 0 0 0 1px var(--line-strong) inset; cursor: pointer; margin-bottom: 10px; }
.goal b { display: block; font-size: 17px; }
.goal span { color: var(--ink-muted); font-size: 14px; }
.goal:hover { box-shadow: 0 0 0 2px var(--accent) inset, var(--shadow); }
.goal .tag { margin-bottom: 8px; }

.empty { text-align: center; padding: 38px 18px; color: var(--ink-muted); }
.empty .btn-row { justify-content: center; margin-top: 16px; }
hr.soft { border: 0; border-top: 1px dashed var(--line-strong); margin: 26px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- ReadSmart: efficient reading preparation ---------- */
.readsmart-shell { padding-bottom: calc(var(--nav-h) + 56px); }
.readsmart-title { font-size: clamp(34px, 9vw, 50px); font-weight: 800; line-height: 1.02; letter-spacing: -.04em; max-width: 12ch; margin: 4px 0 10px; }
.rs-hero { margin-top: 4px; padding: 22px; border-left: 7px solid var(--honey); }
.rs-hero h2 { font-size: 22px; margin: 0 0 8px; }
.rs-hero p:last-child { margin: 0; color: var(--ink-muted); line-height: 1.6; }
.purpose-grid { display: grid; gap: 10px; }
.purpose-card { width: 100%; text-align: left; border: 0; border-radius: 16px; background: var(--surface); padding: 16px 17px; box-shadow: 0 0 0 1px var(--line-strong) inset, var(--shadow); cursor: pointer; }
.purpose-card[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent) inset, var(--shadow); }
.purpose-label { display: block; font-weight: 750; font-size: 16px; margin-bottom: 3px; }
.purpose-note { display: block; font-size: 13.5px; color: var(--ink-muted); line-height: 1.45; }
.rs-grid { display: grid; gap: 12px; margin-top: 12px; }
.rs-card { background: var(--surface); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); }
.rs-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.rs-card h2 { font-size: 22px; margin: 0; }
.rs-card-head .eyebrow { margin-bottom: 6px; }
.rs-time { padding: 6px 10px; border-radius: 9px; background: var(--inset); color: var(--ink-muted); font-size: 12px; white-space: nowrap; }
.route-list { display: grid; }
.route-step { display: grid; grid-template-columns: 30px 1fr auto; align-items: start; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.route-step:last-child { border-bottom: 0; padding-bottom: 2px; }
.route-num { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 10px; background: var(--honey-wash); color: var(--honey-ink); font-size: 12px; font-weight: 800; }
.route-step b { display: block; font-size: 14.5px; margin-bottom: 2px; }
.route-step div span { display: block; color: var(--ink-muted); font-size: 13px; line-height: 1.45; }
.route-time { color: var(--ink-muted); font-size: 12px; padding-top: 3px; white-space: nowrap; }
.lens-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.lens-item { display: grid; grid-template-columns: 24px 1fr; gap: 8px; align-items: start; padding: 12px; background: var(--inset); border-radius: 14px; }
.lens-item > span { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; background: var(--surface); font-family: var(--f-num); font-size: 11px; color: var(--ink-muted); }
.lens-item p { margin: 1px 0 0; font-size: 13.5px; line-height: 1.4; }
.rs-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--line-strong); color: var(--ink-muted); font-size: 13px; }
.section-map { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.section-map li { display: grid; grid-template-columns: 26px 1fr; gap: 9px; align-items: start; font-size: 14px; line-height: 1.45; }
.section-map li > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; background: var(--inset); color: var(--ink-muted); font-family: var(--f-num); font-size: 11px; }
.rs-start { position: sticky; bottom: calc(var(--nav-h) + 8px); z-index: 10; margin: 14px 0 0; padding: 14px 16px; border-radius: 18px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(14px); box-shadow: 0 0 0 1px var(--line) inset, var(--shadow-lg); display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.rs-start p { margin: 0; font-weight: 650; }
.rs-start .eyebrow { margin: 0 0 3px; }
@media (min-width: 680px) { .purpose-grid { grid-template-columns: 1fr 1fr; } .rs-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
@media (max-width: 430px) { .lens-grid { grid-template-columns: 1fr; } .rs-start { flex-direction: column; align-items: stretch; } .rs-start .btn { width: 100%; } }
.smart-entry { border-left: 7px solid var(--honey); }

/* ---------- ReadSmart triage and synthesis ---------- */
.triage-card { margin-top: 12px; }
.triage-signals { display: grid; gap: 8px; }
.triage-signal { display: flex; gap: 8px; align-items: flex-start; color: var(--ink-muted); font-size: 14px; }
.triage-signal > span { color: var(--honey-ink); font-weight: 800; }
.section-map-row { display: grid; grid-template-columns: 26px 1fr; gap: 9px; align-items: start; }
.section-map-row + .section-map-row { margin-top: 8px; }
.section-map-row > span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 8px; background: var(--inset); color: var(--ink-muted); font-family: var(--f-num); font-size: 11px; }
.section-map-row p { margin: 1px 0 0; font-size: 14px; line-height: 1.45; }
.synthesis-box { background: var(--surface); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow); margin-bottom: 12px; }
.synthesis-input { width: 100%; min-height: 92px; padding: 13px 14px; border: 0; border-radius: 13px; background: var(--inset); box-shadow: 0 0 0 1px var(--line) inset; font-family: var(--f-read); font-size: 17px; line-height: 1.5; resize: vertical; }
.synthesis-input:focus { outline: none; box-shadow: 0 0 0 2px var(--honey) inset; }
.synthesis-box .field { margin-bottom: 14px; }
.synthesis-box .field:last-of-type { margin-bottom: 0; }
@media (max-width: 430px) { .synthesis-box { padding: 17px; } }
