/* =========================================================================
   Math Inline landing: "graph paper at midnight"
   ========================================================================= */

@font-face { font-family: "Newsreader"; src: url(../fonts/newsreader.woff2) format("woff2"); font-weight: 200 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url(../fonts/newsreader-italic.woff2) format("woff2"); font-weight: 200 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Inter"; src: url(../fonts/inter.woff2) format("woff2"); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(../fonts/jetbrains-mono.woff2) format("woff2"); font-weight: 100 800; font-style: normal; font-display: swap; }

/* ---------- Tokens ---------- */
:root {
  --font-display: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --brand: #3b4fb8;
  --radius: 14px;
  --radius-sm: 8px;
  --wrap: 1180px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* dark (default) */
  --bg: #0b0d1a;
  --bg-2: #0f1224;
  --surface: #151935;
  --surface-2: #1c2144;
  --border: rgb(143 156 255 / .14);
  --border-strong: rgb(143 156 255 / .28);
  --text: #e9e7f2;
  --muted: #a3a8c7;
  --brand-text: #8f9cff;
  --accent: #f5a855;
  --accent-soft: rgb(245 168 85 / .14);
  --danger: #ff6b81;
  --grid: rgb(143 156 255 / .055);
  --grid-major: rgb(143 156 255 / .09);
  --symbol: rgb(173 182 255 / .07);
  --shadow: 0 30px 80px -30px rgb(0 0 0 / .7), 0 0 0 1px var(--border);
  --glow: radial-gradient(60% 50% at 70% 30%, rgb(59 79 184 / .35), transparent 70%);

  --ed-bg: #0f1226;
  --ed-chrome: #0a0c1c;
  --ed-tab: #131733;
  --ed-gutter: #4d5384;
  --ed-text: #d7daf0;
  --ed-line: rgb(143 156 255 / .07);
  --ed-status: #3b4fb8;
  --tx-cmd: #9aa8ff;
  --tx-brace: #7c83ad;
  --tx-op: #e58fd0;
  --tx-delim: var(--accent);
  --tx-heading: #ffd29a;
  --tx-quote: #8b91b8;
  --math: #f1efff;
  --caret: #ffd29a;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f8f5ee; --bg-2: #f2eee4; --surface: #ffffff; --surface-2: #f3f0e8;
    --border: rgb(27 29 64 / .12); --border-strong: rgb(27 29 64 / .24);
    --text: #1a1c33; --muted: #555a78; --brand-text: #3b4fb8;
    --accent: #a8501a; --accent-soft: rgb(168 80 26 / .1); --danger: #d1243f;
    --grid: rgb(59 79 184 / .07); --grid-major: rgb(59 79 184 / .11); --symbol: rgb(59 79 184 / .07);
    --shadow: 0 30px 70px -35px rgb(26 28 51 / .35), 0 0 0 1px var(--border);
    --glow: radial-gradient(60% 50% at 70% 30%, rgb(59 79 184 / .14), transparent 70%);
    --ed-bg: #fffdf8; --ed-chrome: #efebe1; --ed-tab: #f6f3eb; --ed-gutter: #a19d93; --ed-text: #24263d;
    --ed-line: rgb(59 79 184 / .06); --tx-cmd: #3b4fb8; --tx-brace: #8a8676; --tx-op: #a3267f;
    --tx-heading: #8a3d0f; --tx-quote: #6b6f8c; --math: #15172b; --caret: #3b4fb8;
  }
}
:root[data-theme="light"] {
  --bg: #f8f5ee; --bg-2: #f2eee4; --surface: #ffffff; --surface-2: #f3f0e8;
  --border: rgb(27 29 64 / .12); --border-strong: rgb(27 29 64 / .24);
  --text: #1a1c33; --muted: #555a78; --brand-text: #3b4fb8;
  --accent: #a8501a; --accent-soft: rgb(168 80 26 / .1); --danger: #d1243f;
  --grid: rgb(59 79 184 / .07); --grid-major: rgb(59 79 184 / .11); --symbol: rgb(59 79 184 / .07);
  --shadow: 0 30px 70px -35px rgb(26 28 51 / .35), 0 0 0 1px var(--border);
  --glow: radial-gradient(60% 50% at 70% 30%, rgb(59 79 184 / .14), transparent 70%);
  --ed-bg: #fffdf8; --ed-chrome: #efebe1; --ed-tab: #f6f3eb; --ed-gutter: #a19d93; --ed-text: #24263d;
  --ed-line: rgb(59 79 184 / .06); --tx-cmd: #3b4fb8; --tx-brace: #8a8676; --tx-op: #a3267f;
  --tx-heading: #8a3d0f; --tx-quote: #6b6f8c; --math: #15172b; --caret: #3b4fb8;
  color-scheme: light;
}
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 1.0625rem/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--brand-text); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
code, kbd, pre { font-family: var(--font-mono); font-size: .88em; }
:not(pre) > code {
  padding: .1em .35em; border-radius: 5px;
  background: var(--surface-2); border: 1px solid var(--border);
  white-space: nowrap;
}
kbd {
  display: inline-block; padding: .05em .45em; min-width: 1.6em; text-align: center;
  border-radius: 6px; border: 1px solid var(--border-strong); border-bottom-width: 2px;
  background: var(--surface); font-size: .82em; line-height: 1.5;
}
strong { font-weight: 600; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 1em; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: rgb(59 79 184 / .45); color: inherit; }

.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 100; padding: .6rem 1rem; background: var(--brand); color: #fff; border-radius: var(--radius-sm); }
.skip-link:focus { top: 1rem; }
.muted { color: var(--muted); }
.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }
.narrow { width: min(100% - 2.5rem, 820px); }
@media (max-width: 480px) { .wrap, .narrow { width: calc(100% - 1.5rem); } }

.display {
  font-family: var(--font-display);
  font-weight: 450;
  letter-spacing: -.02em;
  line-height: 1.05;
  font-optical-sizing: auto;
}
.display em { font-style: italic; color: var(--accent); font-weight: 400; }

.eyebrow {
  display: inline-flex; align-items: center; gap: .6rem;
  margin: 0 0 1.1rem; font: 500 .8rem/1 var(--font-mono);
  letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.eyebrow__mark { color: var(--accent); font-family: var(--font-display); font-style: italic; font-size: 1.15rem; letter-spacing: 0; text-transform: none; }

/* ---------- Backdrop ---------- */
.backdrop { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.backdrop__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 120px 120px, 120px 120px, 24px 24px, 24px 24px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 30%, transparent 100%);
}
.backdrop::before { content: ""; position: absolute; inset: 0; background: var(--glow); }
.backdrop__symbols span {
  position: absolute; left: var(--x); top: var(--y);
  font: italic 400 var(--s)/1 var(--font-display);
  color: var(--symbol);
  animation: drift var(--d) ease-in-out infinite alternate;
  will-change: transform;
}
.backdrop__symbols span:nth-child(even) { animation-direction: alternate-reverse; }
@keyframes drift {
  from { transform: translate3d(0, 0, 0) rotate(-6deg); }
  to   { transform: translate3d(3vw, -6vh, 0) rotate(8deg); }
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  border-bottom: 1px solid var(--border);
}
.site-header__inner { display: flex; align-items: center; gap: 1.5rem; height: 4rem; }
.brand { display: inline-flex; align-items: center; gap: .6rem; color: var(--text); text-decoration: none; font: 500 1.25rem/1 var(--font-display); letter-spacing: -.01em; }
.brand img { border-radius: 7px; }
.site-nav { display: flex; gap: 1.6rem; margin-left: auto; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.site-nav a:hover { color: var(--text); }
.site-header__actions { display: flex; gap: .4rem; }
.icon-btn {
  display: inline-grid; place-items: center; width: 2.5rem; height: 2.5rem;
  border-radius: 10px; border: 1px solid var(--border); background: transparent;
  color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.icon-btn--text { width: auto; padding: 0 .75rem; font: 600 .8rem/1 var(--font-body); letter-spacing: .06em; text-decoration: none; }
.i-moon { display: none; }
:root[data-theme="light"] .i-sun { display: none; }
:root[data-theme="light"] .i-moon { display: block; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .i-sun { display: none; }
  :root:not([data-theme]) .i-moon { display: block; }
}
@media (max-width: 760px) { .site-nav { display: none; } .site-header__actions { margin-left: auto; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .55rem;
  padding: .85rem 1.35rem; border-radius: 12px;
  font: 600 1rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  border: 1px solid transparent; transition: transform .2s var(--ease), background .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn--primary {
  background: var(--brand); color: #fff;
  box-shadow: 0 10px 30px -10px rgb(59 79 184 / .8), inset 0 1px 0 rgb(255 255 255 / .18);
}
.btn--primary:hover { background: #4558c9; }
.btn--ghost { color: var(--text); border-color: var(--border-strong); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.btn--ghost:hover { background: var(--surface); }
.btn--small { padding: .55rem .9rem; font-size: .88rem; color: var(--text); background: var(--surface); border-color: var(--border); }

/* ---------- Hero ---------- */
.hero { padding: clamp(3rem, 8vw, 6.5rem) 0 clamp(3rem, 7vw, 5rem); overflow-x: clip; }
.hero__inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 4rem); align-items: center; }
@media (min-width: 1040px) { .hero__inner { grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr); } }
.hero h1 { font-size: clamp(2.5rem, 5.6vw, 4.6rem); margin-bottom: 1.4rem; text-wrap: balance; }
.lede { font-size: clamp(1.05rem, 1.6vw, 1.2rem); color: var(--muted); max-width: 36rem; margin-bottom: 2rem; }
.lede strong { color: var(--text); }
.cta-row { display: flex; flex-wrap: wrap; gap: .8rem; margin-bottom: 1.6rem; }

.install {
  display: inline-flex; align-items: center; gap: .7rem; max-width: 100%;
  padding: .45rem .45rem .45rem 1rem;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border);
}
.install__prompt { color: var(--accent); font-family: var(--font-mono); }
.install code { min-width: 0; background: none; border: 0; padding: 0; font-size: .92rem; overflow-x: auto; white-space: nowrap; }
.install__copy {
  display: inline-flex; align-items: center; gap: .4rem; flex: none;
  padding: .5rem .75rem; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font: 500 .85rem/1 var(--font-body); cursor: pointer;
}
.install__copy:hover { border-color: var(--border-strong); }
.install__copy.is-copied { color: var(--accent); }
.install__hint { margin-top: .75rem; font-size: .88rem; color: var(--muted); }

.hero__demo { margin: 0; position: relative; }
.hero__demo::before {
  content: ""; position: absolute; inset: -12% -8%; z-index: -1;
  background: radial-gradient(closest-side, rgb(59 79 184 / .35), transparent);
  filter: blur(20px);
}
.steps { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.4rem; margin: 1.1rem 0 0; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; font-size: .85rem; color: var(--muted); transition: color .3s; display: inline-flex; align-items: center; gap: .45rem; }
.steps li::before {
  content: counter(s); display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem;
  border-radius: 50%; border: 1px solid var(--border-strong); font: 500 .72rem/1 var(--font-mono);
  transition: background .3s, color .3s, border-color .3s;
}
.steps li.is-current { color: var(--text); }
.steps li.is-current::before { background: var(--accent); border-color: var(--accent); color: var(--bg); }

/* ---------- Editor (shared) ---------- */
.editor {
  --lh: 1.95em;
  container-type: inline-size;
  background: var(--ed-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  color: var(--ed-text);
}
.editor__chrome { display: flex; align-items: center; gap: .8rem; height: 2.4rem; padding: 0 .9rem; background: var(--ed-chrome); border-bottom: 1px solid var(--border); }
.editor__dots { display: flex; gap: .4rem; }
.editor__dots i { width: .7rem; height: .7rem; border-radius: 50%; background: #ff5f57; }
.editor__dots i:nth-child(2) { background: #febc2e; }
.editor__dots i:nth-child(3) { background: #28c840; }
.editor__title { flex: 1; text-align: center; font: 400 .78rem/1 var(--font-body); color: var(--muted); }
.editor__pause {
  display: inline-grid; place-items: center; width: 1.9rem; height: 1.9rem; margin-right: -.4rem;
  border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer;
}
.editor__pause:hover { color: var(--text); border-color: var(--border-strong); }
.editor__pause .i-play { display: none; }
.editor__pause[aria-pressed="true"] .i-play { display: block; }
.editor__pause[aria-pressed="true"] .i-pause { display: none; }
.editor__tabs { display: flex; background: var(--ed-chrome); font: .78rem/1 var(--font-body); }
.editor__tab { padding: .65rem 1rem; color: var(--muted); border-right: 1px solid var(--border); }
.editor__tab.is-active { background: var(--ed-bg); color: var(--text); box-shadow: inset 0 2px 0 var(--accent); }
.md-icon { color: var(--brand-text); font-weight: 700; margin-right: .35rem; font-size: .7rem; }
.editor__body {
  position: relative;
  padding: 1rem 0 1.2rem;
  font: 400 clamp(11px, 2.35cqi, 15px)/var(--lh) var(--font-mono);
}
.editor__lines { margin: 0; padding: 0; list-style: none; }
.editor__lines > li {
  position: relative;
  min-height: var(--lh);
  padding: 0 1.25rem 0 3.6em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.editor__lines > li::before {
  content: counter(list-item);
  position: absolute; left: 0; width: 2.4em; text-align: right;
  color: var(--ed-gutter); font-size: .9em;
}
.editor__lines > li.is-active { background: var(--ed-line); }
.editor__lines > li.is-active::before { color: var(--ed-text); }
.ln-h { color: var(--tx-heading); font-weight: 600; }
.ln-q { color: var(--tx-quote); }
.editor--hero .editor__body { font-size: clamp(10.5px, 2.15cqi, 14.5px); }
.editor__status {
  display: flex; gap: 1rem; padding: .3rem .9rem;
  background: var(--ed-status); color: #fff; font: .72rem/1.4 var(--font-body);
}
.status__right { margin-left: auto; }
.status__brand { font-weight: 600; }
@media (max-width: 420px) { .editor__tabs .editor__tab:not(.is-active) { display: none; } }

/* TeX source colours */
.tx-cmd { color: var(--tx-cmd); }
.tx-brace { color: var(--tx-brace); }
.tx-op { color: var(--tx-op); }
.tx-delim { color: var(--tx-delim); font-weight: 600; }
.tx-code { color: var(--muted); }

/* Rendered math */
.m-r { color: var(--math); }
.m-r .katex { font-size: 1.12em; }
.m-r--display .katex-display { margin: 0; display: inline-block; }
.m-src { position: relative; }
.m-src.is-error, .m-err { text-decoration: underline wavy var(--danger); text-decoration-skip-ink: none; text-underline-offset: 4px; text-decoration-thickness: 1.5px; }
.m-err { cursor: help; }
.m-preview {
  display: inline-block;
  margin-left: .9em; padding: 0 .5em;
  border-left: 2px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 6px 6px 0;
  color: var(--math);
  opacity: .9;
  white-space: nowrap;
  animation: pop .25s var(--ease);
}
.m-preview .katex { font-size: 1.15em; }
@keyframes pop { from { opacity: 0; transform: translateX(-4px); } }
.caret {
  display: inline-block; width: 2px; height: 1.25em; margin: 0 -1px;
  vertical-align: -.25em; background: var(--caret);
  animation: blink 1.05s steps(1) infinite;
}
.is-typing .caret { animation: none; }
@keyframes blink { 50% { opacity: 0; } }
.tex-fallback { background: none !important; border: 0 !important; padding: 0 !important; color: var(--tx-cmd); }
.js .nojs-src { visibility: hidden; }

/* Fake mouse pointer */
.pointer {
  position: absolute; left: 0; top: 0; z-index: 3;
  opacity: 0; transition: transform 1s var(--ease), opacity .3s;
  filter: drop-shadow(0 2px 3px rgb(0 0 0 / .4));
}
.pointer.is-visible { opacity: 1; }
.pointer.is-click { animation: click .3s; }
@keyframes click { 50% { scale: .82; } }

/* Row-by-row tables: each row on its own line, left column padded to a shared width */
.row { display: inline-flex; align-items: baseline; color: var(--math); white-space: nowrap; }
.rows__l { display: inline-block; min-width: var(--lw, 0); text-align: right; }
.row .katex { font-size: 1.08em; }
.mini:hover .tip, .mini:focus .tip, .mini:focus-within .tip { opacity: 1; translate: -50% -.3rem; }

/* ---------- Sections ---------- */
.section { padding: clamp(4rem, 9vw, 7.5rem) 0; }
.section__head { max-width: 46rem; margin-bottom: clamp(2rem, 4vw, 3.2rem); }
.section__head h2 { font-size: clamp(2.1rem, 4.6vw, 3.4rem); margin-bottom: 1rem; text-wrap: balance; }
.section__lede { color: var(--muted); font-size: 1.1rem; margin: 0; }

/* ---------- Compare slider ---------- */
.compare { --pos: 58%; position: relative; max-width: 860px; margin-inline: auto; display: grid; border-radius: var(--radius); box-shadow: var(--shadow); container-type: inline-size; }
.compare__pane { grid-area: 1 / 1; box-shadow: none; border-radius: var(--radius); }
.compare__pane .editor__body { padding-top: 3.2rem; font-size: clamp(10px, 2.75cqi, 19px); }
.compare__pane .editor__lines > li { white-space: pre; overflow: visible; overflow-wrap: normal; }
.compare__pane--rendered { clip-path: inset(0 calc(100% - var(--pos)) 0 0); background: var(--ed-bg); }
.compare__pane--raw { background: color-mix(in srgb, var(--ed-bg) 92%, var(--bg)); }
.compare__tag {
  position: absolute; top: .9rem; right: 1rem; z-index: 2;
  padding: .3rem .6rem; border-radius: 6px;
  font: 500 .72rem/1 var(--font-mono); letter-spacing: .04em; text-transform: uppercase;
  background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.compare__tag--left { right: auto; left: 1rem; color: var(--accent); }
.compare__handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos); z-index: 3; width: 2px; margin-left: -1px;
  background: var(--accent); pointer-events: none;
}
.compare__handle span {
  position: absolute; top: 50%; left: 50%; translate: -50% -50%;
  display: grid; place-items: center; width: 2.6rem; height: 2.6rem; border-radius: 50%;
  background: var(--accent); color: var(--bg); font-size: 1.1rem; font-weight: 700;
  box-shadow: 0 6px 20px -4px rgb(0 0 0 / .5);
}
.compare__range {
  position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: ew-resize; -webkit-appearance: none; appearance: none;
}
.compare:has(.compare__range:focus-visible) .compare__handle span { outline: 3px solid var(--text); outline-offset: 3px; }

/* ---------- Feature cards ---------- */
.cards { display: grid; gap: 1.1rem; padding: 0; margin: 0; list-style: none; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
@media (min-width: 980px) {
  .cards { grid-template-columns: repeat(12, 1fr); }
  .card { grid-column: span 4; }
  .card--wide { grid-column: span 7; }
  .card--side { grid-column: span 5; }
  .cards .card--full { grid-column: span 12; display: grid; grid-template-columns: 1.2fr 1fr; gap: 0 1.5rem; align-items: center; }
  .card--full .card__demo { grid-row: span 2; }
  .card--full h3 { margin-top: 0; align-self: end; }
  .card--full p { align-self: start; }
}
.card {
  display: flex; flex-direction: column;
  padding: 1.1rem 1.1rem 1.5rem;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--surface) 70%, var(--bg)));
  border: 1px solid var(--border);
  transition: border-color .25s, transform .25s var(--ease);
}
.card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.card h3 { font: 500 1.45rem/1.2 var(--font-display); letter-spacing: -.01em; margin: 1.2rem .3rem .5rem; }
.card p { color: var(--muted); font-size: .97rem; margin: 0 .3rem; }

.mini {
  position: relative;
  display: grid; place-items: center;
  min-height: 9.5rem; padding: 1rem;
  border-radius: 10px; background: var(--ed-bg); border: 1px solid var(--border);
  font: 400 15px/1.9 var(--font-mono); color: var(--ed-text);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 16px 16px;
}
.mini:focus-visible { outline-offset: 2px; }
.mini__line { white-space: nowrap; }
.mini__hint {
  position: absolute; bottom: .5rem; right: .7rem;
  font: 500 .68rem/1 var(--font-body); letter-spacing: .04em; text-transform: uppercase; color: var(--muted);
}
.mini--block { place-items: stretch; padding: .7rem 0; font-size: clamp(11.5px, 3.4vw, 13.5px); overflow-x: auto; }
.mini--block .editor__lines > li { --lh: 1.9em; padding-left: 3.2em; white-space: pre; }
.mini--block .m-preview { font-size: .92em; }

.tip {
  position: absolute; left: 50%; bottom: calc(100% - .4rem); translate: -50% 0;
  z-index: 5; width: max-content; max-width: min(19rem, 90vw);
  padding: .55rem .75rem; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  box-shadow: 0 12px 30px -10px rgb(0 0 0 / .5);
  font: 400 .82rem/1.4 var(--font-body); color: var(--text); white-space: normal; text-align: left;
  opacity: 0; pointer-events: none; transition: opacity .18s, translate .18s var(--ease);
}
.tip b { display: block; font-weight: 600; color: var(--danger); margin-bottom: .15rem; font-size: .75rem; letter-spacing: .03em; text-transform: uppercase; }
.tip--math { font-size: 1.05rem; padding: .9rem 1.1rem; color: var(--math); }
.tip--math .katex-display { margin: 0; }
.tip-host { position: relative; display: inline-block; }
.mini .tip-host { position: static; }
.mini .tip { bottom: auto; top: calc(50% + 1.2rem); }
.mini .tip-host:hover .tip, .mini .tip-host:focus-within .tip, .mini .tip-host.is-open .tip, .mini:hover .tip, .mini:focus .tip { translate: -50% .3rem; }
.tip-host:hover .tip, .tip-host:focus-within .tip, .tip-host:focus .tip, .tip-host.is-open .tip { opacity: 1; translate: -50% -.3rem; }

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .05rem .55rem; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--accent-soft); color: var(--accent);
  font: 500 .88em/1.6 var(--font-body); cursor: pointer;
}
.chip:hover, .chip:focus-visible { background: color-mix(in srgb, var(--accent) 24%, transparent); }

.dollar-plain { border-bottom: 1px dashed color-mix(in srgb, var(--muted) 70%, transparent); }
.dollars { display: grid; gap: .55rem; justify-items: start; font-size: 14px; }
.dollars__legend { display: flex; gap: 1rem; font: 400 .72rem/1 var(--font-body); color: var(--muted); }
.dollars__legend span::before { content: ""; display: inline-block; width: .75rem; height: 2px; margin-right: .35rem; vertical-align: middle; }
.dollars__legend .lg-text::before { border-top: 1px dashed var(--muted); }
.dollars__legend .lg-math::before { background: var(--accent); }

.mini--problems { place-items: stretch; padding: 0; overflow: hidden; }
.problems { font: 400 .82rem/1.5 var(--font-body); }
.problems__tabs { display: flex; gap: 1.2rem; padding: .7rem 1rem; border-bottom: 1px solid var(--border); font-size: .7rem; letter-spacing: .05em; color: var(--muted); }
.problems__tabs .is-active { color: var(--text); box-shadow: 0 2px 0 var(--accent); padding-bottom: .4rem; }
.problems__tabs b { display: inline-grid; place-items: center; min-width: 1.2rem; height: 1.2rem; margin-left: .3rem; border-radius: 999px; background: var(--surface-2); font-weight: 600; }
.problems__row { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: .2rem .6rem; margin: 0; padding: .9rem 1rem; color: var(--ed-text); }
.problems__icon { color: #e2b93d; }
.problems__loc { grid-column: 2; color: var(--muted); font-size: .75rem; }
.problems__src { padding: 0 1rem 1rem; font: 400 14px/1.9 var(--font-mono); }
.problems__src .m-src { text-decoration: underline wavy #e2b93d; text-underline-offset: 4px; text-decoration-skip-ink: none; }

/* ---------- Playground ---------- */
.play { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; }
@media (min-width: 900px) { .play { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.play__col { display: flex; flex-direction: column; min-width: 0; }
.play__label { margin: 0 0 .6rem; font: 500 .8rem/1 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.play__input {
  flex: 1; min-height: 20rem; width: 100%; resize: vertical;
  padding: 1rem 1.1rem; border-radius: var(--radius);
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong);
  font: 400 14px/1.95 var(--font-mono); tab-size: 2;
}
.play__input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.play__help { margin: .6rem 0 0; font-size: .85rem; color: var(--muted); }
.play__output { flex: 1; min-height: 20rem; }
.play__output .editor__body { font-size: 14px; }
.play__output .ln-h { font-size: 1em; }
.play__output li.ln-display { text-align: center; padding-block: .3rem; }
.play__output .m-err:focus-visible { outline-offset: 2px; }
.play__actions { display: flex; justify-content: flex-end; margin-top: .7rem; }

/* ---------- Settings ---------- */
.settings__grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.4rem; align-items: start; }
@media (min-width: 900px) { .settings__grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); } }
.code { margin: 0; padding: 1.2rem 1.4rem 1.4rem; overflow-x: auto; font: 400 13.5px/1.75 var(--font-mono); color: var(--ed-text); }
.code:focus-visible { outline-offset: -3px; }
.c-k { color: var(--tx-cmd); }
.c-s { color: #b5d88a; }
:root[data-theme="light"] .c-s { color: #3f7a17; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .c-s { color: #3f7a17; } }
.c-n, .c-b { color: var(--accent); }
.c-p { color: var(--tx-brace); }
.c-cm { color: var(--muted); font-style: italic; }
.shortcut {
  padding: 2rem; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
}
.shortcut__keys { display: flex; align-items: center; gap: .5rem; margin-bottom: 1.4rem; font-size: 1.6rem; color: var(--muted); }
.shortcut__keys kbd { font-size: 1.1rem; padding: .35rem .8rem; border-radius: 10px; border-bottom-width: 3px; color: var(--text); }
.shortcut h3 { font: 500 1.6rem/1.2 var(--font-display); margin-bottom: .7rem; }
.shortcut p { color: var(--muted); }
.shortcut p:last-child { margin: 0; font-size: .93rem; }

/* ---------- Limitations + FAQ ---------- */
.limits {
  margin-bottom: clamp(4rem, 8vw, 6rem);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 50%, transparent);
}
.limits summary { display: flex; align-items: center; gap: .7rem; padding: 1.1rem 1.3rem; cursor: pointer; font-weight: 500; list-style: none; }
.limits summary::-webkit-details-marker, .faq summary::-webkit-details-marker { display: none; }
.limits summary::after, .faq summary::after {
  content: "+"; margin-left: auto; font: 300 1.5rem/1 var(--font-body); color: var(--muted); transition: rotate .25s var(--ease);
}
.limits[open] summary::after, .faq details[open] summary::after { rotate: 45deg; }
.limits ul { margin: 0; padding: 0 1.5rem 1.3rem 2.6rem; color: var(--muted); }
.limits li { margin-bottom: .55rem; }
.limits li::marker { color: var(--accent); }

.faq { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary { display: flex; align-items: center; gap: 1rem; padding: 1.3rem .2rem; cursor: pointer; list-style: none; font: 500 1.3rem/1.3 var(--font-display); }
.faq summary:hover { color: var(--brand-text); }
.faq details p { margin: 0; padding: 0 .2rem 1.4rem; color: var(--muted); max-width: 62ch; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 3rem 0 2rem; background: color-mix(in srgb, var(--bg-2) 80%, transparent); }
.site-footer__inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2rem; }
.site-footer__title { font-size: 1.8rem; margin: 0 0 .4rem; }
.site-footer__links { display: flex; flex-wrap: wrap; gap: .5rem 1.6rem; padding: 0; margin: .6rem 0 0; list-style: none; }
.site-footer__links a { color: var(--text); text-decoration: none; }
.site-footer__links a:hover { color: var(--brand-text); text-decoration: underline; }
.site-footer__fine { margin-top: 2.5rem; font-size: .82rem; }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .backdrop__symbols { display: none; }
  .js .reveal { opacity: 1; transform: none; }
  .caret { animation: none; }
}

@media (forced-colors: active) {
  .compare__handle, .caret { background: Highlight; }
  .m-src.is-error, .m-err { text-decoration-color: Mark; }
}
