/* Wisp Study's page. The tokens are the app's own (src/theme.rs): the warm
   window surface, the working plane, the violet of the icon, the four status
   colours of a screening decision. No web fonts: the page loads nothing from
   anywhere else. */

:root {
  --paper: #F5F4F1;
  --surface: #FFFFFF;
  --sunken: #ECEBE6;
  --ink: #1F2329;
  --ink-2: #5C636E;
  --ink-3: #8A9099;
  --line: #E0DFD9;
  --line-strong: #CBCAC4;
  --accent: #6A4CC6;
  --accent-soft: #EBE6FA;
  --on-accent: #FFFFFF;
  --marker: rgba(232, 178, 30, 0.38);
  --ok: #23764A; --ok-bg: #E0F1E7;
  --info: #2A5FC4; --info-bg: #E3ECFD;
  --warn: #8F5C0C; --warn-bg: #F8ECD2;
  --bad: #B23B30; --bad-bg: #FBE6E3;
  --term-bg: #1E1F23; --term-ink: #E6E7EA; --term-dim: #8B909A;
  --shadow: 0 1px 2px rgba(31, 35, 41, .05), 0 12px 32px -8px rgba(31, 35, 41, .16), 0 40px 80px -32px rgba(59, 58, 143, .22);
  --shadow-lg: 0 4px 12px rgba(31, 35, 41, .08), 0 24px 64px -12px rgba(31, 35, 41, .28);
  --backdrop: rgba(20, 21, 24, .36);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", "Source Han Serif SC", "Source Han Serif CN", STSong, SimSun, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", monospace;

  --rail: 132px;
  --top: 56px;
}

:root[data-theme="light"] {
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1A1B1D;
    --surface: #222326;
    --sunken: #2A2B2F;
    --ink: #E6E7EA;
    --ink-2: #ABAFB7;
    --ink-3: #80858E;
    --line: #333539;
    --line-strong: #47494F;
    --accent: #A592EE;
    --accent-soft: rgba(159, 138, 234, .18);
    --on-accent: #141518;
    --marker: rgba(232, 185, 46, .34);
    --ok: #63C48F; --ok-bg: rgba(99, 196, 143, .16);
    --info: #7CA8F5; --info-bg: rgba(124, 168, 245, .16);
    --warn: #E0B25A; --warn-bg: rgba(224, 178, 90, .16);
    --bad: #EE877C; --bad-bg: rgba(238, 135, 124, .16);
    --term-bg: #121315;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -8px rgba(0, 0, 0, .5);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45), 0 28px 72px -12px rgba(0, 0, 0, .72);
    --backdrop: rgba(8, 9, 11, .62);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #1A1B1D;
  --surface: #222326;
  --sunken: #2A2B2F;
  --ink: #E6E7EA;
  --ink-2: #ABAFB7;
  --ink-3: #80858E;
  --line: #333539;
  --line-strong: #47494F;
  --accent: #A592EE;
  --accent-soft: rgba(159, 138, 234, .18);
  --on-accent: #141518;
  --marker: rgba(232, 185, 46, .34);
  --ok: #63C48F; --ok-bg: rgba(99, 196, 143, .16);
  --info: #7CA8F5; --info-bg: rgba(124, 168, 245, .16);
  --warn: #E0B25A; --warn-bg: rgba(224, 178, 90, .16);
  --bad: #EE877C; --bad-bg: rgba(238, 135, 124, .16);
  --term-bg: #121315;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, .45), 0 28px 72px -12px rgba(0, 0, 0, .72);
  --backdrop: rgba(8, 9, 11, .62);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--top) + 28px); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.8 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  text-autospace: normal;
  overflow-x: hidden;
}
::selection { background: var(--accent-soft); color: var(--ink); }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: .22em; text-decoration-thickness: 1px; }
a:hover { text-decoration-color: var(--accent); color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
code { font: .88em var(--mono); background: var(--sunken); padding: .12em .38em; border-radius: 4px; }
h1, h2, h3, h4, p, ol, ul, figure, blockquote { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p, li, dd, figcaption { text-wrap: pretty; }
ol, ul { padding: 0; list-style: none; }
strong, b { font-weight: 650; }
kbd {
  font: .8em/1 var(--mono);
  padding: .22em .5em;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface);
  white-space: nowrap;
}

.wrap { max-width: 1220px; margin: 0 auto; padding-inline: clamp(18px, 4.2vw, 48px); }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 6px 12px; border-radius: 6px; z-index: 40; border: 1px solid var(--line-strong); }
.skip:focus { left: 12px; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.top-in { height: 100%; display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 700 1.08rem/1 var(--serif); letter-spacing: .01em; flex: none; }
.brand:hover { color: inherit; }
.top nav { display: flex; gap: 2px; margin-left: auto; }
.top nav a, .gh { font-size: .88rem; text-decoration: none; padding: 6px 10px; border-radius: 7px; color: var(--ink-2); white-space: nowrap; transition: background-color .15s ease, color .15s ease; }
.top nav a:hover, .gh:hover { background: var(--sunken); color: var(--ink); }
.top nav a[aria-current="page"] { color: var(--ink); background: var(--sunken); font-weight: 600; }
.gh { border: 1px solid var(--line-strong); color: var(--ink); padding: 5px 11px; }
.lang { font-size: .86rem; text-decoration: none; padding: 6px 6px; color: var(--ink-3); white-space: nowrap; border-radius: 7px; transition: color .15s ease, background-color .15s ease; }
.lang:hover { color: var(--ink); background: var(--sunken); }

/* Right-side quiet utilities injected or present in .top */
.top-tools { display: flex; align-items: center; gap: 6px; flex: none; }
.top-search {
  appearance: none; cursor: pointer; font: .83rem/1 var(--sans); color: var(--ink-2);
  background: var(--sunken); border: 1px solid var(--line); border-radius: 8px;
  height: 32px; padding: 0 7px 0 10px;
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}
.top-search:hover { border-color: var(--line-strong); background: var(--surface); color: var(--ink); }
.top-search svg { flex: none; opacity: .75; }
.top-search kbd {
  font-size: .7rem; padding: .2em .42em; border-bottom-width: 1px;
  background: var(--paper); border-color: var(--line-strong); color: var(--ink-3);
}
.top-icon-btn {
  appearance: none; cursor: pointer; flex: none;
  width: 32px; height: 32px; padding: 0; border-radius: 8px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.top-icon-btn:hover { background: var(--sunken); color: var(--ink); }
.top-icon-btn[aria-expanded="true"] { background: var(--accent-soft); color: var(--accent); }
.top-shelf-btn { display: none; margin-right: -6px; }

/* Razor-thin reading progress hairline on the bottom edge of .top */
.read-progress {
  position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%;
  background: var(--accent); transform-origin: left center; transform: scaleX(0);
  pointer-events: none; opacity: .9; will-change: transform;
}

/* ---------- hero ---------- */
.hero { position: relative; isolation: isolate; padding-top: clamp(56px, 9vw, 124px); padding-bottom: clamp(64px, 9vw, 120px); }
.wisp {
  position: absolute; z-index: -1; pointer-events: none;
  top: clamp(8px, 3vw, 44px); right: clamp(-40px, -2vw, 0px);
  width: min(47%, 560px); overflow: visible;
}
.wisp path { fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.wisp-thick { stroke: url(#wisp-ink); stroke-width: 15; animation: draw 1.7s cubic-bezier(.6, 0, .2, 1) .15s backwards; }
.wisp-thin { stroke: #B9A8F5; stroke-width: 6.5; opacity: .6; animation: draw 1.4s cubic-bezier(.6, 0, .2, 1) .7s backwards; }
@keyframes draw { from { stroke-dashoffset: 1; } }

.kicker { font: 600 .82rem/1 var(--mono); letter-spacing: .14em; color: var(--accent); margin-bottom: clamp(20px, 3vw, 34px); display: flex; flex-wrap: wrap; gap: .4em 1.4em; }
.kicker-version { color: var(--ink-3); letter-spacing: .06em; }
h1 {
  font: 900 clamp(2.5rem, 7.6vw, 6.4rem)/1.1 var(--serif);
  letter-spacing: .01em;
  margin-left: -.03em;
}
.hero-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); margin-top: clamp(32px, 5vw, 64px); align-items: start; }
.lead { font-size: clamp(1.06rem, 1.5vw, 1.24rem); line-height: 1.85; max-width: 31em; }
.cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.fine { margin-top: 18px; font-size: .84rem; color: var(--ink-3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  padding: .72em 1.35em; border-radius: 9px; border: 1px solid var(--line-strong);
  font: 600 .96rem/1.3 var(--sans); text-decoration: none; color: var(--ink); background: transparent;
  transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
}
.btn:hover { color: var(--ink); border-color: var(--ink-3); background: var(--surface); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { color: var(--on-accent); background: color-mix(in srgb, var(--accent) 88%, var(--ink)); border-color: transparent; }

.abstract { border-top: 2px solid var(--ink); padding-top: 16px; font-size: .9rem; line-height: 1.95; color: var(--ink-2); }
.abstract b { font-family: var(--serif); color: var(--ink); font-weight: 700; }
.keywords { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: .84rem; }

/* A citation: of a figure on this page, or of a sentence in the demo. */
.cite {
  appearance: none; border: 0; cursor: pointer; display: inline;
  font: 600 .8em/1.4 var(--mono); letter-spacing: 0;
  color: var(--accent); background: var(--accent-soft);
  padding: .18em .5em; border-radius: 5px; text-decoration: none; white-space: nowrap;
  transition: background-color .15s ease, color .15s ease;
}
.cite:hover, .cite[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

/* ---------- figures ---------- */
.shot { position: relative; }
.shot img {
  border-radius: 10px; border: 1px solid var(--line-strong);
  box-shadow: var(--shadow); background: var(--surface);
  transition: filter .2s ease, border-color .2s ease;
}
.shot[data-zoom] img { cursor: zoom-in; }
.shot[data-zoom]:hover img { border-color: color-mix(in srgb, var(--accent) 45%, var(--line-strong)); }
.shot-zoom-btn {
  position: absolute; top: 12px; right: 12px; z-index: 2;
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(24, 25, 29, .76); color: #F5F4F1;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font: 600 .74rem/1 var(--sans); letter-spacing: .02em;
  opacity: 0; transform: translateY(-2px);
  transition: opacity .18s ease, transform .18s ease, background-color .15s ease;
}
.shot:hover .shot-zoom-btn, .shot-zoom-btn:focus-visible { opacity: 1; transform: translateY(0); }
.shot-zoom-btn:hover { background: rgba(24, 25, 29, .92); }

/* Gentle brightness softening for light-mode screenshots viewed in dark mode */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .shot img { filter: brightness(.92) contrast(1.02); }
  :root:not([data-theme="light"]) .shot:hover img { filter: none; }
}
:root[data-theme="dark"] .shot img { filter: brightness(.92) contrast(1.02); }
:root[data-theme="dark"] .shot:hover img { filter: none; }

figcaption { margin-top: 14px; font-size: .86rem; line-height: 1.72; color: var(--ink-2); max-width: 56em; }
figcaption b { font-family: var(--serif); color: var(--ink); font-weight: 700; font-variant-numeric: lining-nums tabular-nums; }
figcaption, .verdict span { background: linear-gradient(var(--marker), var(--marker)) no-repeat 0 100% / 0% 100%; width: fit-content; }
.lit figcaption, figcaption.lit { animation: sweep 2.8s ease-out; }
@keyframes sweep { 0% { background-size: 0% 100%; } 22%, 70% { background-size: 100% 100%; } 100% { background-size: 100% 0%; } }
.hero .shot { margin-top: clamp(48px, 7vw, 96px); }

/* Arrival highlight when jumping from ⌘K search ("带出处的跳转") */
.lit-block {
  position: relative;
  border-radius: 6px;
  animation: block-sweep 3.2s ease-out;
}
@keyframes block-sweep {
  0% { background-color: transparent; box-shadow: -4px 0 0 0 transparent; }
  12%, 68% { background-color: color-mix(in srgb, var(--marker) 55%, transparent); box-shadow: -4px 0 0 0 var(--accent); }
  100% { background-color: transparent; box-shadow: -4px 0 0 0 transparent; }
}
mark.hl-hit {
  background: var(--marker); color: inherit; border-radius: 3px; padding: .04em .16em;
}

/* ---------- sections ---------- */
.sec { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); padding-block: clamp(72px, 10vw, 136px); position: relative; }
.sec::before { content: ""; position: absolute; top: 0; left: clamp(18px, 4.2vw, 48px); right: clamp(18px, 4.2vw, 48px); border-top: 1px solid var(--line-strong); }
.rail { position: sticky; top: calc(var(--top) + 36px); align-self: start; display: flex; flex-direction: column; align-items: flex-start; gap: 16px; }
.rail .no { font: 600 .8rem/1 var(--mono); color: var(--accent); letter-spacing: .08em; }
.rail .v { writing-mode: vertical-rl; font: 700 1.6rem/1 var(--serif); letter-spacing: .42em; }
:lang(en) .rail .v { letter-spacing: .1em; }
.rail::after { content: ""; width: 1px; height: 72px; background: var(--line-strong); margin-left: .78rem; }

h2 { font: 900 clamp(1.8rem, 4.1vw, 3.15rem)/1.22 var(--serif); letter-spacing: .01em; max-width: 18em; }
.sec-lead { margin-top: 22px; max-width: 41em; color: var(--ink-2); }
.sec-main h3 { font: 900 1.38rem/1.35 var(--serif); }
.nb { display: inline-block; }
.more { margin-top: 44px; font-weight: 600; }
.more a { text-decoration-color: var(--accent); }

/* ---------- §1: where 353 papers went ---------- */
.flow { margin-top: clamp(40px, 6vw, 72px); }
.ledger { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--line-strong); }
.ledger li { padding: 18px 16px 20px 0; position: relative; }
.ledger li + li { padding-left: 20px; border-left: 1px solid var(--line); }
.ledger b { display: block; font: 900 clamp(2rem, 4.4vw, 3.5rem)/1.05 var(--serif); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.01em; }
.ledger span { display: block; margin-top: 8px; font-weight: 600; font-size: .95rem; line-height: 1.5; }
.ledger small { display: block; font-weight: 400; font-size: .8rem; color: var(--ink-3); margin-top: 2px; }
.ledger .sum b { color: var(--accent); }

.bar { display: flex; gap: 3px; height: 58px; margin-top: 6px; }
.seg { flex: 1 1 0; min-width: 9px; display: flex; align-items: center; justify-content: center; gap: .5em; border-radius: 5px; font-size: .9rem; white-space: nowrap; overflow: hidden; }
.seg:first-child { border-radius: 9px 5px 5px 9px; }
.seg:last-child { border-radius: 5px 9px 9px 5px; }
.seg b { font: 700 1.12rem/1 var(--serif); font-variant-numeric: lining-nums; }
.seg i { font-style: normal; }
.ok { color: var(--ok); background: var(--ok-bg); }
.info { color: var(--info); background: var(--info-bg); }
.warn { color: var(--warn); background: var(--warn-bg); }
.bad { color: var(--bad); background: var(--bad-bg); }

.chip { display: inline-block; font-size: .8rem; line-height: 1.5; font-weight: 600; padding: .12em .7em; border-radius: 999px; white-space: nowrap; }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 32px; margin-top: 20px; font-size: .88rem; color: var(--ink-2); }
.legend .chip { margin-right: .8em; }
.after { margin-top: 22px; max-width: 44em; }
.after b { font-family: var(--serif); font-size: 1.15em; }

/* ---------- §1: the eight steps ---------- */
.steps { margin-top: clamp(56px, 8vw, 104px); display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.steps-list { display: flex; flex-direction: column; border-top: 1px solid var(--line-strong); position: sticky; top: calc(var(--top) + 28px); }
.steps-list button {
  appearance: none; background: none; border: 0; border-bottom: 1px solid var(--line); border-left: 3px solid transparent;
  font: inherit; color: var(--ink-2); text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 1.3em minmax(0, 1fr) auto; align-items: baseline; gap: 8px;
  padding: 12px 10px 12px 9px; font-size: .95rem; line-height: 1.5;
  transition: background-color .15s ease, color .15s ease;
}
.steps-list button:hover { color: var(--ink); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.steps-list button[aria-selected="true"] { color: var(--ink); background: var(--surface); border-left-color: var(--accent); font-weight: 650; }
.steps i, .try i { font: italic 700 1.1em/1 var(--serif); color: var(--accent); }
.steps-list time { font: .72rem/1 var(--mono); color: var(--ink-3); font-weight: 400; }
.steps-panels h3 { display: flex; align-items: baseline; gap: .6em; }
.steps-panels p { margin-top: 12px; max-width: 43em; }
.steps-panels .shot { margin-top: 26px; }
.steps-panels article + article { margin-top: 64px; }
.js .steps-panels article + article { margin-top: 0; }
.js .steps-panels article:not([hidden]) { animation: rise .3s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
html:not(.js) .steps { grid-template-columns: minmax(0, 1fr); }
html:not(.js) .steps-list { display: none; }

.steps-nav {
  margin-top: 22px; padding-top: 14px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.steps-nav button {
  appearance: none; background: none; border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 12px; font: 600 .84rem/1.3 var(--sans); color: var(--ink-2); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.steps-nav button:hover:not(:disabled) { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }
.steps-nav button:disabled { opacity: .35; cursor: default; }

/* ---------- demos: a card drawn like the app's ---------- */
.try { margin-top: clamp(64px, 9vw, 112px); display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.try-text p { margin-top: 14px; color: var(--ink-2); }
.try-text strong { color: var(--ink); }
.demo-pill {
  display: inline-flex; align-items: center; gap: 6px;
  margin-bottom: 12px; padding: 3px 10px; border-radius: 999px;
  font: 600 .72rem/1.4 var(--mono); letter-spacing: .06em;
  color: var(--accent); background: var(--accent-soft);
}
.demo-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
}
.card { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 20px 22px 18px; box-shadow: var(--shadow); font-size: .9rem; line-height: 1.7; }
.card-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; }
.card-head strong { display: block; font-size: .98rem; line-height: 1.45; }
.byline { display: block; font-size: .8rem; color: var(--ink-3); margin-top: 3px; }
.reason { margin-top: 14px; }
.card blockquote { margin-top: 12px; padding: 9px 14px; border-left: 3px solid var(--accent); background: var(--sunken); border-radius: 0 7px 7px 0; font-size: .86rem; color: var(--ink-2); display: flex; gap: 12px; justify-content: space-between; }
.card blockquote cite { font-style: normal; font-size: .76rem; color: var(--ink-3); white-space: nowrap; }
.card-meta { margin-top: 10px; font-size: .76rem; color: var(--ink-3); }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.choices button {
  appearance: none; font: 600 .86rem/1.3 var(--sans); color: var(--ink); cursor: pointer;
  padding: .55em 1em; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface);
  transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.choices button:hover { border-color: var(--ink-3); }
.choices button:active { transform: translateY(1px); }
.choices .suggested { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.choices button[aria-pressed="true"] { outline: 2px solid var(--accent); outline-offset: 2px; }
.verdict { margin-top: 14px; font-size: .86rem; color: var(--ink-2); min-height: 3.4em; }
.verdict span { -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.verdict span.lit { animation: sweep 2.8s ease-out; }

/* ---------- §1: the door to the tutorials (site/tutorials/) ---------- */
.guides-head { margin-top: clamp(64px, 9vw, 112px); }
.guides-head p { margin-top: 12px; max-width: 41em; color: var(--ink-2); }
.guides-bar {
  margin-top: 24px;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 16px;
  border-bottom: 1px solid var(--line-strong);
}
.guides-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: -1px; }
.guides-tabs button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 9px 12px; font: 600 .88rem/1.3 var(--sans); color: var(--ink-2); cursor: pointer;
  display: inline-flex; align-items: baseline; gap: 5px;
  transition: color .15s ease, border-color .15s ease;
}
.guides-tabs button:hover { color: var(--ink); }
.guides-tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.guides-tabs button small { font: 500 .72rem/1 var(--mono); color: var(--ink-3); }
.guides-tabs button[aria-selected="true"] small { color: var(--accent); }
.guides-find {
  appearance: none; background: none; border: 0; padding: 6px 0 9px;
  font: 600 .82rem/1.3 var(--sans); color: var(--accent); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.guides-find:hover { text-decoration: underline; text-underline-offset: .25em; }

.guides { margin-top: 26px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 clamp(20px, 3vw, 40px); border-top: 1px solid var(--line-strong); }
.guides-bar + .guides { margin-top: 0; border-top: 0; }
.guides a { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr); column-gap: 10px; padding: 18px 0 20px; border-bottom: 1px solid var(--line); text-decoration: none; }
.guides a[hidden] { display: none; }
.guides a:hover { color: inherit; }
.guides .num { font-size: 1.5rem; line-height: 1.25; }
.guides > a > span:last-child { display: block; }
.guides strong { font: 900 1.06rem/1.45 var(--serif); transition: color .15s ease; }
.guides a:hover strong { color: var(--accent); }
.guides span span { display: block; margin-top: 4px; font-size: .86rem; line-height: 1.65; color: var(--ink-2); }

/* ---------- §2: the theses ---------- */
.theses { margin-top: clamp(40px, 6vw, 72px); border-bottom: 1px solid var(--line-strong); }
.thesis { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr) minmax(0, 19rem); column-gap: clamp(20px, 3.5vw, 52px); padding-block: clamp(28px, 4vw, 44px); border-top: 1px solid var(--line-strong); align-items: start; }
.num { font: 400 clamp(2.2rem, 4vw, 3.2rem)/1 var(--serif); color: var(--accent); font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.02em; }
.thesis h3 { font-size: clamp(1.3rem, 2.3vw, 1.72rem); font-weight: 900; }
.thesis h3 + p { margin-top: 12px; max-width: 35em; }
.proof { font-size: .86rem; line-height: 1.75; color: var(--ink-2); padding-top: .5rem; }
.proof b { display: block; font: 600 .72rem/1 var(--mono); letter-spacing: .14em; color: var(--accent); margin-bottom: 9px; }

.cite-demo { grid-column: 2 / -1; margin-top: 30px; }
.cite-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(16px, 2.5vw, 28px); align-items: stretch; }
.chat { background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 20px 22px; font-size: .92rem; line-height: 1.85; box-shadow: var(--shadow); }
.chat .q { width: fit-content; max-width: 92%; margin-left: auto; background: var(--accent-soft); padding: 8px 14px; border-radius: 12px 12px 3px 12px; line-height: 1.6; }
.chat .a { margin-top: 16px; }
.chat .cite { white-space: normal; }
.sources { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.sources span { display: inline-block; font-size: .8rem; padding: .2em .8em; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink-2); }
.sheet {
  position: relative; background: #FDFCF9; color: #26282C; border: 1px solid var(--line-strong); border-radius: 3px;
  padding: 26px 30px 44px; font: .84rem/1.9 var(--serif); box-shadow: var(--shadow);
}
.sheet h4 { font: 700 1.05rem/1.4 var(--serif); text-align: center; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #DDD9CF; }
.sheet p { text-indent: 2em; }
.sheet p + p { margin-top: 6px; }
.sheet mark { color: inherit; background: linear-gradient(rgba(232, 178, 30, .5), rgba(232, 178, 30, .5)) no-repeat 0 60% / 0% 78%; padding: .1em 0; transition: background-size .6s cubic-bezier(.4, 0, .2, 1); }
.sheet mark.on { background-size: 100% 78%; }
.pageno { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-size: .74rem; color: #8A8D93; }

.limits { margin-top: clamp(40px, 6vw, 64px); display: grid; grid-template-columns: 5.4rem minmax(0, 1fr); column-gap: clamp(20px, 3.5vw, 52px); }
.limits h3 { grid-column: 2; }
.limits ul { grid-column: 2; margin-top: 16px; columns: 2; column-gap: 48px; font-size: .92rem; color: var(--ink-2); max-width: 60em; }
.limits li { break-inside: avoid; padding: 7px 0 7px 1.3em; position: relative; }
.limits li::before { content: "–"; position: absolute; left: 0; color: var(--ink-3); }

/* ---------- §4: the questions ---------- */
.faq-bar {
  margin-top: clamp(32px, 5vw, 56px);
  display: flex; justify-content: flex-end; gap: 10px;
}
.faq-bar button {
  appearance: none; background: none; border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 11px; font: 600 .8rem/1.3 var(--sans); color: var(--ink-2); cursor: pointer;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.faq-bar button:hover { border-color: var(--line-strong); color: var(--ink); background: var(--surface); }

.faq { margin-top: clamp(40px, 6vw, 72px); border-bottom: 1px solid var(--line-strong); }
.faq-bar + .faq { margin-top: 14px; }
.faq details { border-top: 1px solid var(--line-strong); scroll-margin-top: calc(var(--top) + 12px); }
.faq summary, .faq .a { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr) 1.4rem; column-gap: clamp(20px, 3.5vw, 52px); }
.faq summary { align-items: baseline; padding-block: clamp(20px, 2.6vw, 28px); cursor: pointer; list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 400 1.5rem/1 var(--serif); color: var(--ink-3); justify-self: end; }
.faq details[open] > summary::after { content: "−"; }
.faq summary:hover::after { color: var(--accent); }
.faq .q { font: 600 .8rem/1 var(--mono); color: var(--accent); letter-spacing: .08em; }
.faq h3 { font-size: clamp(1.12rem, 1.9vw, 1.32rem); font-weight: 700; display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.faq .a { padding-bottom: clamp(28px, 4vw, 44px); row-gap: 14px; }
.faq .a > * { grid-column: 2; max-width: 41em; }
.faq .a li { padding: 5px 0 5px 1.3em; position: relative; }
.faq .a li::before { content: "–"; position: absolute; left: 0; color: var(--ink-3); }

/* ---------- §3: tools ---------- */
.code-cols { margin-top: clamp(36px, 5vw, 56px); display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.code { background: var(--term-bg); color: var(--term-ink); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; border: 1px solid rgba(255, 255, 255, .06); }
.code figcaption {
  margin: 0; padding: 9px 14px 9px 18px;
  font: .74rem/1.5 var(--sans); letter-spacing: .04em; color: var(--term-dim);
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  background: none; width: auto; max-width: none;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.code-copy {
  appearance: none; cursor: pointer; flex: none;
  font: 600 .72rem/1 var(--sans); letter-spacing: .02em;
  color: var(--term-dim); background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 6px;
  padding: 5px 10px;
  transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}
.code-copy:hover { color: var(--term-ink); background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .22); }
.code-copy.copied { color: #63C48F; border-color: rgba(99, 196, 143, .45); background: rgba(99, 196, 143, .12); }

.code pre { margin: 0; padding: 16px 18px 18px; overflow-x: auto; font: .82rem/1.85 var(--mono); flex: 1; }
.code code { background: none; padding: 0; font: inherit; color: inherit; }
.code .p, .code .c { color: var(--term-dim); }
.code .p { user-select: none; }

.tool-filter {
  margin-top: clamp(32px, 5vw, 48px);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
}
.tool-pills { display: inline-flex; gap: 4px; background: var(--sunken); padding: 3px; border-radius: 9px; border: 1px solid var(--line); }
.tool-pills button {
  appearance: none; background: none; border: 0; border-radius: 6px;
  padding: 5px 11px; font: 600 .78rem/1.2 var(--sans); color: var(--ink-2); cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}
.tool-pills button:hover { color: var(--ink); }
.tool-pills button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }

.tool-table { margin-top: clamp(36px, 5vw, 56px); width: 100%; border-collapse: collapse; font-size: .9rem; line-height: 1.6; }
.tool-filter + .tool-table { margin-top: 14px; }
.tool-table caption { caption-side: top; text-align: left; font-size: .86rem; color: var(--ink-2); padding-bottom: 12px; }
.tool-table caption b { font-family: var(--serif); color: var(--ink); }
.tool-table tr { border-top: 1px solid var(--line); }
.tool-table tr[hidden] { display: none; }
.tool-table tr:first-child { border-top-color: var(--line-strong); }
.tool-table tr:last-child { border-bottom: 1px solid var(--line-strong); }
.tool-table th { text-align: left; font-weight: 400; padding: 9px 20px 9px 0; white-space: nowrap; vertical-align: baseline; width: 1%; }
.tool-table th code { background: none; padding: 0; font-size: .86rem; font-weight: 600; }
.tool-table td { padding: 9px 0; color: var(--ink-2); }
.w { display: inline-block; font: 600 .68rem/1 var(--sans); color: var(--warn); background: var(--warn-bg); padding: .28em .45em; border-radius: 4px; margin: 0 .5em; vertical-align: .12em; }

/* ---------- §5: download ---------- */
.dl-grid { margin-top: clamp(32px, 5vw, 52px); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.dl { position: relative; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 26px 24px 24px; display: flex; flex-direction: column; }
.dl.mine { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow); }
.dl.mine::after { content: "你的系统"; position: absolute; top: 18px; right: 18px; font-size: .72rem; font-weight: 600; color: var(--accent); background: var(--accent-soft); padding: .2em .7em; border-radius: 999px; }
:lang(en) .dl.mine::after { content: "Your system"; }
.dl h3 { font-size: 1.7rem; font-weight: 900; }
.dl-req { font-size: .86rem; color: var(--ink-3); margin-top: 2px; }
.dl .btn { margin-top: 22px; align-self: flex-start; }
.dl:not(.mine) .btn.primary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.dl:not(.mine) .btn.primary:hover { background: var(--sunken); border-color: var(--ink-3); }
.dl-grid:not(:has(.mine)) .btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.dl-file { margin-top: 12px; font: .74rem/1.6 var(--mono); color: var(--ink-3); overflow-wrap: anywhere; }
.dl-file i { font-style: normal; }
.dl-file + .dl-file { margin-top: 2px; }
.dl-pick { margin-top: 22px; display: flex; flex-wrap: wrap; gap: 10px; }
.dl .dl-pick .btn { margin-top: 0; }
.dl-note { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); font-size: .86rem; line-height: 1.7; color: var(--ink-2); }
.dl-foot { margin-top: clamp(36px, 5vw, 56px); display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 56px); align-items: start; }
.dl-foot ul { margin-top: 12px; font-size: .92rem; color: var(--ink-2); }
.dl-foot li { padding: 7px 0 7px 1.3em; position: relative; }
.dl-foot li::before { content: "–"; position: absolute; left: 0; color: var(--ink-3); }

/* ---------- footer ---------- */
.foot { border-top: 1px solid var(--line-strong); background: var(--sunken); padding-block: clamp(48px, 7vw, 88px); font-size: .9rem; }
.foot-in { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); }
.foot h2 { font-size: 1.3rem; }
.refs ol { margin-top: 16px; counter-reset: ref; }
.refs li { counter-increment: ref; padding: 5px 0 5px 2.6em; position: relative; }
.refs li::before { content: "[" counter(ref) "]"; position: absolute; left: 0; font: .82rem/2 var(--mono); color: var(--ink-3); }
.colophon { color: var(--ink-2); }
.colophon p + p { margin-top: 12px; }
.colophon b { font-family: var(--serif); color: var(--ink); }

/* ---------- heading / FAQ anchor copy ---------- */
.anchor-btn {
  appearance: none; background: none; border: 0; cursor: pointer;
  font: 600 .82rem/1 var(--mono); color: var(--ink-3);
  padding: 3px 5px; border-radius: 5px;
  opacity: 0; transition: opacity .15s ease, color .15s ease, background-color .15s ease;
}
.anchor-btn:hover, .anchor-btn:focus-visible { opacity: 1; color: var(--accent); background: var(--accent-soft); }
.anchor-btn.copied { opacity: 1; color: var(--ok); background: var(--ok-bg); font-family: var(--sans); font-size: .74rem; padding: 3px 7px; }
.faq summary:hover .anchor-btn { opacity: 1; }

/* ---------- ⌘K full-site search dialog ---------- */
.search-dialog {
  width: min(680px, calc(100vw - 24px));
  max-height: min(80vh, 660px);
  margin: clamp(24px, 9vh, 88px) auto auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-dialog[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
.search-dialog::backdrop { background: var(--backdrop); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: translateY(-6px) scale(.99); } }

.search-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}
.search-head svg { flex: none; color: var(--ink-3); }
.search-input {
  flex: 1; min-width: 0; border: 0; background: none; color: var(--ink);
  font: 1rem/1.5 var(--sans); padding: 4px 0; outline: none;
}
.search-input::placeholder { color: var(--ink-3); }
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search-clear {
  appearance: none; background: var(--sunken); border: 0; color: var(--ink-2);
  width: 24px; height: 24px; border-radius: 999px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; font-size: .9rem;
}
.search-clear[hidden] { display: none; }
.search-clear:hover { color: var(--ink); background: var(--line); }
.search-esc { font-size: .72rem; color: var(--ink-3); }

.search-tabs {
  display: flex; align-items: center; gap: 2px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 55%, var(--surface));
  overflow-x: auto; scrollbar-width: none;
}
.search-tabs::-webkit-scrollbar { display: none; }
.search-tabs button {
  appearance: none; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 8px 10px; font: 600 .8rem/1.2 var(--sans); color: var(--ink-2); cursor: pointer;
  white-space: nowrap; display: inline-flex; align-items: baseline; gap: 5px;
  margin-bottom: -1px;
}
.search-tabs button:hover { color: var(--ink); }
.search-tabs button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.search-tabs button span { font: 500 .7rem/1 var(--mono); color: var(--ink-3); }

.search-body { flex: 1; overflow-y: auto; padding: 10px; min-height: 220px; }
.search-group-label {
  font: 600 .72rem/1 var(--mono); letter-spacing: .12em; color: var(--ink-3);
  padding: 10px 10px 6px; text-transform: uppercase;
}
.search-chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 4px 10px 12px; }
.search-chips button {
  appearance: none; cursor: pointer;
  font: 500 .82rem/1.3 var(--sans); color: var(--ink-2);
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px;
  padding: 5px 12px;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.search-chips button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.search-hit {
  display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) auto; align-items: start; gap: 10px;
  padding: 10px 12px; border-radius: 9px; text-decoration: none; color: inherit;
  border: 1px solid transparent;
  transition: background-color .1s ease, border-color .1s ease;
}
.search-hit:hover { color: inherit; background: var(--paper); }
.search-hit[aria-selected="true"] { background: var(--paper); border-color: var(--line-strong); }
.hit-badge {
  font: 600 .72rem/1.4 var(--mono); color: var(--accent); background: var(--accent-soft);
  padding: 3px 6px; border-radius: 5px; text-align: center; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hit-badge.is-tool { color: var(--info); background: var(--info-bg); }
.hit-badge.is-faq { color: var(--ok); background: var(--ok-bg); }
.hit-badge.is-idea { color: var(--warn); background: var(--warn-bg); }
.hit-top { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; }
.hit-title { font: 700 .94rem/1.45 var(--serif); color: var(--ink); }
.hit-crumb { font: .76rem/1.4 var(--sans); color: var(--ink-3); }
.hit-snippet {
  margin-top: 3px; font-size: .82rem; line-height: 1.55; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.hit-title mark, .hit-snippet mark {
  background: var(--marker); color: var(--ink); border-radius: 2px; padding: 0 .1em;
}
.hit-go { font: .82rem/1.4 var(--mono); color: var(--accent); opacity: 0; align-self: center; }
.search-hit[aria-selected="true"] .hit-go, .search-hit:hover .hit-go { opacity: 1; }
.search-empty { padding: 36px 20px; text-align: center; color: var(--ink-2); font-size: .9rem; }
.search-empty small { display: block; margin-top: 6px; color: var(--ink-3); font-size: .82rem; }
.search-ask-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; margin: 2px 0 8px; padding: 10px 12px; border-radius: 9px;
  appearance: none; cursor: pointer; text-align: left;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface));
  color: var(--ink); font: 600 .86rem/1.45 var(--sans);
  transition: border-color .15s ease, background-color .15s ease;
}
.search-ask-row:hover { border-color: var(--accent); background: var(--accent-soft); }
.search-ask-row .ask-row-main { display: flex; align-items: center; gap: 8px; min-width: 0; }
.search-ask-row .ask-row-main svg { flex: none; color: var(--accent); }
.search-ask-row .ask-row-q { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.search-ask-row .ask-row-tag {
  flex: none; font: 600 .72rem/1 var(--mono); color: var(--accent);
  white-space: nowrap;
}

/* ---------- BYOK Web Assistant (floating trigger + non-blocking drawer) ---------- */
.ask-fab {
  position: fixed; right: clamp(16px, 2.4vw, 28px); bottom: clamp(16px, 2.4vw, 28px); z-index: 28;
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 16px 0 14px; border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow);
  font: 600 .88rem/1 var(--sans);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.ask-fab:hover {
  border-color: var(--accent); color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}
.ask-fab:active { transform: translateY(0); }
.ask-fab svg { flex: none; color: var(--accent); }
.ask-fab-dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--ok);
  flex: none;
}
.ask-fab-dot[hidden] { display: none; }
.ask-fab.is-busy .ask-fab-dot { background: var(--accent); animation: ask-pulse 1.1s ease-in-out infinite; }
@keyframes ask-pulse { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.15); } }
.ask-fab[hidden] { display: none; }

.ask-backdrop {
  position: fixed; inset: 0; z-index: 33;
  background: var(--backdrop);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.ask-backdrop.open { opacity: 1; pointer-events: auto; }

.ask-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 35;
  width: min(460px, 100vw); height: 100dvh;
  background: var(--paper); color: var(--ink);
  border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(104%);
  transition: transform .24s cubic-bezier(.3, 0, .2, 1);
  visibility: hidden;
}
.ask-drawer.open { transform: translateX(0); visibility: visible; }
@media (min-width: 960px) {
  .ask-backdrop { display: none; }
  .ask-drawer {
    top: var(--top);
    height: calc(100dvh - var(--top));
    z-index: 18;
  }
}

.ask-head {
  flex: none; height: var(--top);
  padding: 0 12px 0 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.ask-head-id { display: flex; align-items: center; gap: 9px; min-width: 0; }
.ask-head-id svg { flex: none; color: var(--accent); }
.ask-head-title { font: 700 .96rem/1.2 var(--serif); white-space: nowrap; }
.ask-model-pill {
  appearance: none; cursor: pointer;
  max-width: 155px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--sunken); color: var(--ink-2);
  font: 500 .7rem/1.3 var(--mono);
  transition: border-color .15s ease, color .15s ease;
}
.ask-model-pill:hover { border-color: var(--accent); color: var(--accent); }
.ask-model-pill.unset { border-style: dashed; color: var(--accent); background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

.ask-head-acts { display: flex; align-items: center; gap: 4px; flex: none; }
.ask-hbtn {
  appearance: none; cursor: pointer;
  height: 30px; padding: 0 9px; border-radius: 7px;
  border: 1px solid transparent; background: transparent; color: var(--ink-2);
  font: 600 .78rem/1 var(--sans);
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  transition: background-color .14s ease, color .14s ease, border-color .14s ease;
}
.ask-hbtn:hover { background: var(--sunken); color: var(--ink); }
.ask-hbtn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.ask-hbtn.icon { width: 30px; padding: 0; font-size: 1.05rem; }

/* Settings view inside drawer */
.ask-settings {
  flex: 1; overflow-y: auto; padding: 18px 18px 24px;
  display: flex; flex-direction: column; gap: 14px;
}
.ask-settings[hidden] { display: none; }
.ask-privacy {
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface);
  font-size: .82rem; line-height: 1.65; color: var(--ink-2);
}
.ask-privacy b { display: block; font: 600 .7rem/1 var(--mono); letter-spacing: .12em; color: var(--accent); margin-bottom: 6px; }
.ask-presets-label { font: 600 .72rem/1 var(--mono); letter-spacing: .1em; color: var(--ink-3); margin-bottom: 6px; display: block; }
.ask-presets { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-presets button {
  appearance: none; cursor: pointer;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: 600 .78rem/1.2 var(--sans);
  transition: border-color .14s ease, color .14s ease, background-color .14s ease;
}
.ask-presets button:hover { border-color: var(--line-strong); color: var(--ink); }
.ask-presets button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.ask-field { display: flex; flex-direction: column; gap: 5px; }
.ask-field label { font: 600 .78rem/1.2 var(--sans); color: var(--ink-2); display: flex; justify-content: space-between; align-items: baseline; }
.ask-field label small { font-weight: 400; color: var(--ink-3); font-size: .74rem; }
.ask-field input, .ask-field select {
  width: 100%; height: 36px; padding: 0 10px;
  border: 1px solid var(--line-strong); border-radius: 8px;
  background: var(--surface); color: var(--ink);
  font: .86rem/1.4 var(--mono); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ask-field select { font-family: var(--sans); }
.ask-field input:focus, .ask-field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ask-key-wrap { position: relative; display: flex; align-items: center; }
.ask-key-wrap input { padding-right: 54px; }
.ask-key-eye {
  position: absolute; right: 6px;
  appearance: none; border: 0; background: none; cursor: pointer;
  font: 600 .74rem/1 var(--sans); color: var(--ink-3); padding: 4px 6px; border-radius: 5px;
}
.ask-key-eye:hover { color: var(--ink); background: var(--sunken); }

.ask-check {
  display: flex; align-items: flex-start; gap: 8px;
  font-size: .82rem; line-height: 1.55; color: var(--ink-2); cursor: pointer;
}
.ask-check input { margin-top: 3px; accent-color: var(--accent); }

.ask-test-msg {
  padding: 9px 12px; border-radius: 8px; font-size: .82rem; line-height: 1.6;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
}
.ask-test-msg[hidden] { display: none; }
.ask-test-msg.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.ask-test-msg.err { background: var(--bad-bg); color: var(--bad); border-color: transparent; }

.ask-sacts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 2px; }
.ask-sacts .btn { padding: .55em 1.05em; font-size: .85rem; }
.ask-clear-key {
  margin-left: auto; appearance: none; background: none; border: 0; cursor: pointer;
  font: 600 .8rem/1 var(--sans); color: var(--bad); padding: 6px 4px;
}
.ask-clear-key:hover { text-decoration: underline; }
.ask-clear-key[hidden] { display: none; }

/* Thread view inside drawer */
.ask-chat-pane { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ask-chat-pane[hidden] { display: none; }
.ask-thread {
  flex: 1; overflow-y: auto; padding: 18px 18px 28px;
  display: flex; flex-direction: column; gap: 18px;
  scrollbar-width: thin;
}
.ask-empty {
  margin: auto 0; padding: 12px 4px;
  display: flex; flex-direction: column; gap: 14px;
}
.ask-empty h3 { font: 900 1.24rem/1.35 var(--serif); }
.ask-empty p { font-size: .88rem; line-height: 1.7; color: var(--ink-2); }
.ask-starters { display: flex; flex-direction: column; gap: 7px; margin-top: 4px; }
.ask-starters button {
  appearance: none; cursor: pointer; text-align: left;
  padding: 10px 13px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: 500 .85rem/1.5 var(--sans);
  transition: border-color .14s ease, color .14s ease, background-color .14s ease;
}
.ask-starters button:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); }

.ask-msg { display: flex; flex-direction: column; gap: 8px; }
.ask-msg.user { align-items: flex-end; }
.ask-msg.user .ask-bubble {
  max-width: 88%; padding: 9px 14px;
  border-radius: 13px 13px 3px 13px;
  background: var(--accent-soft); color: var(--ink);
  font-size: .9rem; line-height: 1.65; white-space: pre-wrap; word-break: break-word;
}

.ask-msg.assistant { align-items: stretch; }
.ask-ctx {
  border: 1px solid var(--line); border-radius: 9px; background: var(--surface);
  font-size: .78rem; color: var(--ink-2);
}
.ask-ctx summary {
  padding: 7px 11px; cursor: pointer; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font: 600 .74rem/1.3 var(--mono); color: var(--ink-3);
}
.ask-ctx summary::-webkit-details-marker { display: none; }
.ask-ctx summary::after { content: "▾"; font-size: .8rem; }
.ask-ctx[open] summary::after { content: "▴"; }
.ask-ctx-list {
  padding: 6px 11px 10px; border-top: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 5px;
}
.ask-ctx-list a {
  display: grid; grid-template-columns: 2.3rem minmax(0, 1fr); gap: 6px;
  text-decoration: none; color: var(--ink-2); line-height: 1.45;
}
.ask-ctx-list a b { font: 600 .72rem/1.45 var(--mono); color: var(--accent); }
.ask-ctx-list a:hover { color: var(--accent); }

.ask-md {
  font-size: .91rem; line-height: 1.78; color: var(--ink);
  word-break: break-word;
}
.ask-md > * + * { margin-top: 10px; }
.ask-md h3, .ask-md h4 { font: 700 1rem/1.4 var(--serif); margin-top: 14px; }
.ask-md ul, .ask-md ol { padding-left: 1.3em; list-style: disc; }
.ask-md ol { list-style: decimal; }
.ask-md li + li { margin-top: 4px; }
.ask-md pre {
  background: var(--term-bg); color: var(--term-ink);
  padding: 11px 13px; border-radius: 9px; overflow-x: auto;
  font: .8rem/1.65 var(--mono);
}
.ask-md pre code { background: none; padding: 0; color: inherit; font: inherit; }
.ask-md .cite { margin-inline: 1px; vertical-align: baseline; white-space: normal; text-align: left; }
.ask-md .ask-cursor {
  display: inline-block; width: 2px; height: 1em; background: var(--accent);
  vertical-align: -.15em; margin-left: 2px; animation: ask-blink .9s step-end infinite;
}
@keyframes ask-blink { 50% { opacity: 0; } }

.ask-err {
  padding: 10px 13px; border-radius: 9px;
  background: var(--bad-bg); color: var(--bad);
  font-size: .84rem; line-height: 1.65;
}
.ask-err button {
  margin-top: 8px; appearance: none; cursor: pointer;
  padding: 4px 10px; border-radius: 6px;
  border: 1px solid currentColor; background: transparent; color: inherit;
  font: 600 .78rem/1.3 var(--sans);
}

.ask-sources {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding-top: 10px; border-top: 1px solid var(--line);
}
.ask-source-chip {
  appearance: none; cursor: pointer; text-align: left;
  display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%;
  padding: 4px 9px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  font: .77rem/1.4 var(--sans);
  transition: border-color .14s ease, color .14s ease;
}
.ask-source-chip b { font: 600 .72rem/1 var(--mono); color: var(--accent); flex: none; }
.ask-source-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-source-chip:hover { border-color: var(--accent); color: var(--ink); }

.ask-msg-foot {
  display: flex; align-items: center; gap: 10px;
  font-size: .75rem; color: var(--ink-3);
}
.ask-msg-foot button {
  appearance: none; background: none; border: 0; padding: 2px 4px; cursor: pointer;
  color: var(--ink-3); font: 600 .74rem/1 var(--sans); border-radius: 4px;
}
.ask-msg-foot button:hover { color: var(--ink); background: var(--sunken); }

/* Composer */
.ask-composer {
  flex: none; padding: 10px 14px 14px;
  border-top: 1px solid var(--line); background: var(--surface);
  display: flex; flex-direction: column; gap: 8px;
}
.ask-page-ctx {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: .76rem; color: var(--ink-3);
}
.ask-page-ctx[hidden] { display: none; }
.ask-page-ctx label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; min-width: 0; }
.ask-page-ctx label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ask-page-ctx input { accent-color: var(--accent); }
.ask-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 7px 7px 7px 12px; border-radius: 11px;
  border: 1px solid var(--line-strong); background: var(--paper);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.ask-input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.ask-textarea {
  flex: 1; min-width: 0; resize: none; border: 0; background: none; color: var(--ink);
  font: .9rem/1.55 var(--sans); max-height: 132px; padding: 3px 0; outline: none;
}
.ask-textarea::placeholder { color: var(--ink-3); }
.ask-send {
  appearance: none; cursor: pointer; flex: none;
  height: 32px; padding: 0 13px; border-radius: 8px;
  border: 0; background: var(--accent); color: var(--on-accent);
  font: 600 .82rem/1 var(--sans);
  transition: opacity .14s ease, background-color .14s ease;
}
.ask-send:disabled { opacity: .4; cursor: default; }
.ask-send.stop { background: var(--bad); color: #FFFFFF; }
.ask-disclaimer { font-size: .72rem; line-height: 1.45; color: var(--ink-3); text-align: center; }

@media (max-width: 600px) {
  .ask-fab { height: 42px; width: 42px; padding: 0; justify-content: center; }
  .ask-fab-label { display: none; }
  .ask-fab-dot { position: absolute; top: 7px; right: 7px; }
  .ask-head { padding: 0 8px 0 12px; gap: 6px; }
  .ask-head-id { gap: 6px; }
  .ask-hbtn { padding: 0 6px; }
}

.search-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 9px 16px; border-top: 1px solid var(--line);
  background: var(--paper); font: .76rem/1.4 var(--sans); color: var(--ink-3);
}
.search-keys { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.search-keys span { display: inline-flex; align-items: center; gap: 4px; }
.search-keys kbd { font-size: .68rem; padding: .15em .4em; border-bottom-width: 1px; }

/* ---------- Screenshot Lightbox ---------- */
.lightbox {
  width: 100vw; height: 100dvh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent; color: #F5F4F1;
}
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lightbox::backdrop { background: rgba(14, 15, 18, .9); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.lb-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: rgba(14, 15, 18, .55);
  border-bottom: 1px solid rgba(255, 255, 255, .1);
}
.lb-count { font: 600 .8rem/1 var(--mono); color: #C8CBD2; letter-spacing: .06em; }
.lb-actions { display: flex; align-items: center; gap: 8px; }
.lb-btn {
  appearance: none; cursor: pointer;
  font: 600 .8rem/1 var(--sans); color: #F5F4F1;
  background: rgba(255, 255, 255, .09); border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 7px; padding: 7px 12px;
  display: inline-flex; align-items: center; gap: 6px;
  transition: background-color .15s ease;
}
.lb-btn:hover { background: rgba(255, 255, 255, .18); }
.lb-stage {
  position: relative; overflow: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 20px 64px;
}
.lb-stage.is-zoomed { align-items: flex-start; justify-content: flex-start; padding: 20px; }
.lb-img {
  max-width: calc(100vw - 140px); max-height: calc(100dvh - 160px);
  width: auto; height: auto; border-radius: 8px;
  box-shadow: 0 20px 70px rgba(0, 0, 0, .55);
  cursor: zoom-in; background: #FFFFFF; filter: none !important;
}
.lb-stage.is-zoomed .lb-img { max-width: none; max-height: none; cursor: zoom-out; margin: auto; }
.lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 2;
  appearance: none; cursor: pointer;
  width: 42px; height: 42px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(24, 25, 29, .72); color: #F5F4F1;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.2rem; transition: background-color .15s ease, transform .15s ease;
}
.lb-nav:hover { background: rgba(255, 255, 255, .2); }
.lb-nav.prev { left: 16px; }
.lb-nav.next { right: 16px; }
.lb-nav[hidden] { display: none; }
.lb-cap {
  padding: 12px 24px 16px; text-align: center;
  background: rgba(14, 15, 18, .65); border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: .88rem; line-height: 1.65; color: #D4D6DC;
}
.lb-cap p { max-width: 56rem; margin: 0 auto; }
.lb-cap b { font-family: var(--serif); color: #FFFFFF; font-weight: 700; }

/* ---------- narrower ---------- */
@media (max-width: 1040px) {
  .guides { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .thesis { grid-template-columns: 4rem minmax(0, 1fr); }
  .proof { grid-column: 2; padding-top: 14px; }
  .limits { grid-template-columns: 4rem minmax(0, 1fr); }
  .faq summary, .faq .a { grid-template-columns: 4rem minmax(0, 1fr) 1.4rem; }
  .try { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  body { font-size: 16px; }
  .top-in { gap: 10px; }
  .top-search-label, .top-search kbd { display: none; }
  .top-search { width: 32px; padding: 0; justify-content: center; background: transparent; border-color: transparent; }
  .sec { grid-template-columns: minmax(0, 1fr); }
  .rail { position: static; flex-direction: row; align-items: baseline; gap: 12px; margin-bottom: 18px; }
  .rail .v { writing-mode: horizontal-tb; font-size: 1rem; letter-spacing: .3em; }
  .rail::after { display: none; }
  .hero-cols { grid-template-columns: minmax(0, 1fr); }
  .wisp { width: 62%; opacity: .5; top: 4px; right: -8%; }
  .ledger { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ledger li:nth-child(4) { padding-left: 0; border-left: 0; }
  .ledger li:nth-child(n+4) { border-top: 1px solid var(--line); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .steps-list { position: static; flex-direction: row; overflow-x: auto; border-top: 0; border-bottom: 1px solid var(--line-strong); margin-inline: calc(-1 * clamp(18px, 4.2vw, 48px)); padding-inline: clamp(18px, 4.2vw, 48px); scrollbar-width: none; }
  .steps-list::-webkit-scrollbar { display: none; }
  .steps-list button { flex: none; display: flex; border: 0; border-bottom: 3px solid transparent; padding: 10px 12px; }
  .steps-list button[aria-selected="true"] { border-bottom-color: var(--accent); background: none; }
  .steps-list time { display: none; }
  .cite-cols, .code-cols, .dl-foot, .foot-in { grid-template-columns: minmax(0, 1fr); }
  .dl-grid { grid-template-columns: minmax(0, 1fr); }
  .limits ul { columns: 1; }
  .lb-stage { padding: 14px 16px; }
  .lb-img { max-width: calc(100vw - 32px); max-height: calc(100dvh - 150px); }
  .lb-nav { width: 36px; height: 36px; }
}
@media (max-width: 600px) {
  .guides { grid-template-columns: minmax(0, 1fr); }
  .top nav a { padding: 6px 6px; font-size: .84rem; }
  .top nav a[href$="#faq"] { display: none; }
  .gh { display: none; }
  :lang(en) .top nav { gap: 0; }
  :lang(en) .top nav a { padding: 6px 4px; font-size: .78rem; }
  .brand span { display: none; }
  .top-in { gap: 6px; }
  .top-tools { gap: 2px; margin-left: 0; }
  .lang { padding: 6px 4px; font-size: .8rem; }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ledger li, .ledger li + li { padding: 14px 12px 16px 0; border-left: 0; border-top: 1px solid var(--line); }
  .ledger li:nth-child(-n+2) { border-top: 0; }
  .ledger .sum { grid-column: 1 / -1; }
  .seg i { display: none; }
  .bar { height: 46px; }
  .legend { grid-template-columns: minmax(0, 1fr); }
  .legend .chip { display: table; margin: 0 0 4px; }
  .thesis, .limits { grid-template-columns: minmax(0, 1fr); }
  .proof, .cite-demo, .limits h3, .limits ul { grid-column: 1; }
  .num { margin-bottom: 10px; }
  .faq summary { grid-template-columns: minmax(0, 1fr) 1.4rem; column-gap: 14px; }
  .faq .q { grid-column: 1 / -1; margin-bottom: 8px; }
  .faq .a { grid-template-columns: minmax(0, 1fr); }
  .faq .a > * { grid-column: 1; }
  .card { padding: 16px; }
  .card-head { flex-direction: column; gap: 10px; }
  .sheet { padding: 20px 20px 40px; }
  .tool-table th, .tool-table td { display: block; width: auto; padding: 0; white-space: normal; }
  .tool-table th { padding-top: 10px; }
  .tool-table td { padding-bottom: 10px; }
  .search-hit { grid-template-columns: 2.8rem minmax(0, 1fr); }
  .hit-go { display: none; }
  .search-keys { display: none; }
}

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

/* ---------- print / save as PDF ---------- */
@media print {
  :root, :root[data-theme="dark"] {
    --paper: #FFFFFF; --surface: #FFFFFF; --sunken: #F6F6F4;
    --ink: #111111; --ink-2: #444444; --ink-3: #666666;
    --line: #DDDDDD; --line-strong: #BBBBBB;
    --accent: #3F2C8A; --accent-soft: #EFEBF9;
    --shadow: none;
  }
  body { background: #FFFFFF !important; color: #111111 !important; font-size: 11pt; line-height: 1.65; }
  .top, .foot, .skip, .wisp, .cta, .top-tools, .guides-bar, .steps-list, .steps-nav,
  .tool-filter, .faq-bar, .code-copy, .shot-zoom-btn, .anchor-btn, .demo-pill,
  .shelf-rail, .shelf-backdrop, .toc, .pager, .shelf-toolbar, .doc-meta-row .focus-btn,
  .ask-fab, .ask-drawer, .ask-backdrop,
  dialog { display: none !important; }
  .wrap { max-width: none; padding-inline: 0; }
  .doc-shell, .doc-cols { display: block !important; max-width: none !important; }
  .doc-shell > .doc-wrap { padding-inline: 0 !important; }
  .sec { display: block; padding-block: 18pt; }
  .sec::before { left: 0; right: 0; }
  .rail { position: static; flex-direction: row; margin-bottom: 8pt; }
  .rail .v { writing-mode: horizontal-tb; font-size: 10pt; letter-spacing: .15em; }
  .rail::after { display: none; }
  .steps { display: block; }
  .steps-panels article { display: block !important; margin-top: 16pt !important; break-inside: avoid; }
  .shot, .flow, .thesis, .note, .code, table, blockquote { break-inside: avoid; }
  .shot img { box-shadow: none; filter: none !important; border-color: #CCCCCC; max-height: 55vh; width: auto; }
  .code { background: #F6F6F4; color: #111111; border: 1px solid #CCCCCC; }
  .code figcaption { color: #555555; border-bottom-color: #DDDDDD; }
  .code .p, .code .c { color: #666666; }
  a { text-decoration: none; }
}
