@font-face { font-family: "JetBrains Mono"; src: url(/fonts/jetbrains-mono-v24-latin.woff2) format("woff2"); font-weight: 400 700; font-style: normal; font-display: optional; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Inter"; src: url(/fonts/inter-v20-latin.woff2) format("woff2"); font-weight: 400 600; font-style: normal; font-display: optional; unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --u-bg: #0e0e14; --u-bg-1: #14141c; --u-bg-2: #1c1c26; --u-bg-code: #0b0b10;
  --u-ink: #ede8dc; --u-ink-2: #c8c3b8; --u-ink-3: #8b8678; --u-ink-4: #5a554a; --u-ink-5: #3a362e;
  --u-gold: #c9a14a; --u-gold-bright: #e0b955; --u-gold-dim: #7a6228; --u-gold-glow: rgba(201,161,74,0.18);
  --u-signal-pass: #4dbfb5; --u-signal-warn: #d4a252; --u-signal-fail: #d4699e;
  --u-signal-info: #6b8fad; --u-signal-trace: #9b7ec8;
  --u-rule: #2a2a36; --u-rule-soft: #1f1f2a; --u-rule-strong: #4a4a5a;
  --u-page-0: #1a1a23; --u-page-1: #2b2a35; --u-page-2: #4a453b;
  --u-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --u-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body { background: var(--u-bg); color: var(--u-ink-2); font-family: var(--u-sans); -webkit-font-smoothing: antialiased; }
::selection { background: var(--u-gold-glow); color: var(--u-ink); }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--u-gold); outline-offset: 2px; border-radius: 3px; }

/* brand mark: staggered breathing lines + nudging chevron */
@keyframes markBreath { 0%,100% { stroke-dashoffset: 0; } 50% { stroke-dashoffset: 8; } }
@keyframes markChev   { 0%,100% { transform: translateX(0); } 50% { transform: translateX(2px); } }
.mark-anim .line { stroke-dasharray: 4 4; animation: markBreath 4s ease-in-out infinite; }
.mark-anim .line.l2 { animation-delay: 0.3s; }
.mark-anim .line.l3 { animation-delay: 0.6s; }
.mark-anim .chev { animation: markChev 4s ease-in-out infinite; transform-origin: center; }
@media (prefers-reduced-motion: reduce) {
  .mark-anim .line, .mark-anim .chev { animation: none; }
}
/* ── editor shell ─────────────────────────────────────────────────────── */
html, body { height: 100%; overflow: hidden; }
body { background: #0a0a0f; }
.skip {
  position: fixed; left: -9999px; top: 8px; z-index: 200;
  background: var(--u-gold); color: var(--u-bg); padding: 8px 12px; border-radius: 6px;
  font: 600 12px var(--u-mono); text-decoration: none;
}
.skip:focus { left: 8px; }

.ide {
  --ex-w: 264px; --tb-h: 46px; --sb-h: 26px;
  --chrome: #0a0a0f; --side: #0c0c11;
  height: 100vh; height: 100dvh;
  display: grid;
  grid-template-columns: var(--ex-w) minmax(0, 1fr);
  grid-template-rows: var(--tb-h) minmax(0, 1fr) auto var(--sb-h);
  grid-template-areas: "title title" "explorer editor" "explorer panel" "status status";
  transition: grid-template-columns .18s ease;
}
/* the explorer starts tucked away; html.ex (the visitor's own choice, set before
   first paint) brings it back. Without JS there's no toggle, so it stays open. */
@media (min-width: 861px) {
  html.js:not(.ex) .ide { grid-template-columns: 0 minmax(0, 1fr); }
  html.js:not(.ex) .explorer { visibility: hidden; border-right-color: transparent; }
}
@media (prefers-reduced-motion: reduce) { .ide { transition: none; } }

.ico { width: 16px; height: 16px; flex: none; }
kbd {
  font: 10.5px var(--u-mono); color: var(--u-ink-3); white-space: nowrap;
  background: var(--u-bg-2); border: 1px solid var(--u-rule); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px;
}

/* ── titlebar ── */
.titlebar {
  grid-area: title; display: flex; align-items: center; gap: 10px; min-width: 0;
  padding: 0 12px 0 9px; background: var(--chrome); border-bottom: 1px solid var(--u-rule-soft);
  font-family: var(--u-mono); font-size: 12px;
}
.tb-btn {
  display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px;
  border: 0; border-radius: 6px; background: none; color: var(--u-ink-3); cursor: pointer;
  transition: background .15s, color .15s;
}
.tb-btn:hover { background: var(--u-bg-2); color: var(--u-ink); }
.brand {
  display: flex; align-items: center; gap: 9px; flex: none;
  color: var(--u-ink); text-decoration: none; font-weight: 600; letter-spacing: -0.01em;
}
.tb-search {
  flex: 0 1 440px; margin: 0 auto; min-width: 0;
  display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 6px 0 10px;
  background: var(--u-bg-1); border: 1px solid var(--u-rule); border-radius: 7px;
  color: var(--u-ink-4); font: 12px var(--u-mono); cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.tb-search span { flex: 1; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-search:hover { border-color: var(--u-rule-strong); color: var(--u-ink-3); background: #16161f; }
.tb-links { display: flex; align-items: center; gap: 18px; flex: none; }
.tb-links a { color: var(--u-ink-3); text-decoration: none; letter-spacing: 0.04em; transition: color .15s; }
.tb-links a:hover, .tb-links a[aria-current]:not(.cta) { color: var(--u-ink); }
.tb-links a.cta {
  color: var(--u-bg); background: var(--u-gold); padding: 6px 12px; border-radius: 6px;
  font-weight: 600; letter-spacing: 0.02em; transition: background .15s;
}
.tb-links a.cta:hover { background: var(--u-gold-bright); }

/* ── explorer ── */
.explorer {
  grid-area: explorer; display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--side); border-right: 1px solid var(--u-rule-soft);
  font-family: var(--u-mono); font-size: 12.5px; overflow: hidden;
}
.pane { padding: 8px 8px 10px; overflow-y: auto; }
.pane-outline { flex: 1; min-height: 100px; border-top: 1px solid var(--u-rule-soft); }
.pane-t {
  padding: 8px 10px 8px; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--u-ink-4);
}
.tree a.f, .dir summary {
  display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 10px;
  border-radius: 6px; color: var(--u-ink-3); text-decoration: none; white-space: nowrap;
  transition: background .12s, color .12s;
}
.tree a.f span, .dir summary span { overflow: hidden; text-overflow: ellipsis; }
.dir a.f { padding-left: 30px; }
.tree a.f:hover, .dir summary:hover { background: rgba(255,255,255,0.035); color: var(--u-ink-2); }
.tree a.f[aria-current] { background: rgba(201,161,74,0.11); color: var(--u-ink); }
.dir summary { list-style: none; cursor: pointer; color: var(--u-ink-2); gap: 6px; }
.dir summary::-webkit-details-marker { display: none; }
.chev { width: 12px; height: 12px; flex: none; color: var(--u-ink-4); transition: transform .15s; }
.dir[open] > summary .chev { transform: rotate(90deg); }
.k-md .ico { color: var(--u-signal-info); }
.k-py .ico { color: var(--u-gold); }
.k-readme .ico { color: var(--u-gold-bright); }
.k-lock .ico { color: var(--u-ink-3); }

.outline a {
  display: block; margin-left: 10px; padding: 4px 8px 4px 12px;
  border-left: 1px solid var(--u-rule); color: var(--u-ink-3); text-decoration: none;
  font-family: var(--u-sans); font-size: 12.5px; line-height: 1.35;
  transition: color .12s, border-color .12s;
}
.outline a.o3 { padding-left: 24px; font-size: 12px; }
.outline a:hover { color: var(--u-ink); }
.outline a.on { color: var(--u-ink); border-left-color: var(--u-gold); }
.outline:not(:has(a))::before { content: "No outline"; display: block; padding: 4px 10px; color: var(--u-ink-5); font-size: 12px; }

/* ── editor ── */
.editor { grid-area: editor; display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--u-bg); }
.crumbs {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 22px;
  font: 12px var(--u-mono); color: var(--u-ink-4); white-space: nowrap; overflow: hidden;
  background: var(--chrome); border-bottom: 1px solid var(--u-rule-soft);
}
.crumbs a { color: var(--u-ink-3); text-decoration: none; padding: 3px 4px; margin: 0 -4px; border-radius: 4px; transition: color .12s, background .12s; }
.crumbs a:hover { color: var(--u-ink); background: var(--u-bg-2); }
.crumbs b { display: inline-flex; align-items: center; gap: 7px; color: var(--u-ink); font-weight: 500; }
.crumbs b .ico { width: 14px; height: 14px; }
.crumbs i { font-style: normal; color: var(--u-ink-5); }
.scroll {
  overflow: auto; overscroll-behavior: contain;
  container: main / size;
  scroll-padding-top: 24px;
}
.view:focus { outline: none; }
@media (prefers-reduced-motion: no-preference) { .scroll { scroll-behavior: smooth; } }

/* ── terminal panel ── */
.panel { grid-area: panel; display: flex; flex-direction: column; height: 232px; min-width: 0; background: var(--chrome); border-top: 1px solid var(--u-rule); }
.panel[hidden] { display: none; }
.panel-bar {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 6px 0 14px; flex: none;
  font: 11px var(--u-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--u-ink-3);
  border-bottom: 1px solid var(--u-rule-soft);
}
.panel-t { display: flex; align-items: center; gap: 8px; color: var(--u-ink); }
.panel-t .ico { width: 14px; height: 14px; color: var(--u-gold); }
.panel-sub { text-transform: none; letter-spacing: 0.02em; color: var(--u-ink-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow { flex: 1; }
.term { flex: 1; margin: 0; padding: 12px 18px; overflow: auto; font: 12.5px/1.7 var(--u-mono); color: var(--u-ink-2); font-variant-ligatures: none; }
.term .pr { color: var(--u-signal-pass); }
.term .dl { color: var(--u-ink-4); }
.term .cmd { color: var(--u-ink); }
.term .out { color: var(--u-ink-3); }
.term .cur { display: inline-block; width: 7px; height: 14px; margin-left: 1px; vertical-align: -2px; background: var(--u-gold); animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .term .cur { animation: none; } }

/* ── status bar ── */
.statusbar {
  grid-area: status; display: flex; align-items: center; min-width: 0;
  padding: 0 4px; background: var(--chrome); border-top: 1px solid var(--u-rule-soft);
  font: 11px var(--u-mono); color: var(--u-ink-3); white-space: nowrap; overflow: hidden;
}
.sb-item {
  display: inline-flex; align-items: center; gap: 6px; height: 100%; padding: 0 9px;
  border: 0; background: none; color: inherit; text-decoration: none;
}
.sb-btn { cursor: pointer; }
.sb-btn:hover, a.sb-item:hover { background: var(--u-bg-2); color: var(--u-ink); }
.sb-brand { color: var(--u-gold); }
.sb-beta i { width: 6px; height: 6px; border-radius: 50%; background: var(--u-signal-pass); box-shadow: 0 0 6px rgba(77,191,181,0.6); }
.sb-item .ico { width: 13px; height: 13px; }
.sb-item kbd { font-size: 10px; padding: 0 4px; border-bottom-width: 1px; }
.sb-motion i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--u-gold); background: var(--u-gold); transition: background .15s; }
.sb-motion[aria-pressed="false"] i { background: transparent; border-color: var(--u-ink-4); }

/* motion off: scenes stay on their posters, each with a way to start them */
.readme .play {
  display: none; position: absolute; z-index: 4; top: 18px; right: 18px;
  align-items: center; gap: 8px; padding: 7px 12px 7px 10px; cursor: pointer;
  font: 11px var(--u-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--u-ink);
  background: rgba(14,14,20,0.72); border: 1px solid var(--u-rule-strong); border-radius: 999px;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: border-color .15s, color .15s;
}
.readme .play::before { content: ""; width: 0; height: 0; border-left: 8px solid var(--u-gold); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.readme .play:hover { border-color: var(--u-gold); color: var(--u-gold); }
html.motion-off .readme .play { display: inline-flex; }

/* ── command palette ── */
.palette {
  position: fixed; inset: 0; z-index: 100; display: flex; justify-content: center; align-items: flex-start;
  padding: 12vh 16px 16px; background: rgba(4,4,7,0.6); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.palette[hidden] { display: none; }
.pal-box {
  width: 100%; max-width: 640px; overflow: hidden;
  background: #121219; border: 1px solid var(--u-rule-strong); border-radius: 12px;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,0.9), 0 0 0 1px rgba(0,0,0,0.4);
  font-family: var(--u-mono);
}
@media (prefers-reduced-motion: no-preference) {
  .palette:not([hidden]) .pal-box { animation: palIn .14s ease-out; }
  @keyframes palIn { from { transform: translateY(-6px) scale(0.99); opacity: 0; } }
}
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--u-rule); color: var(--u-ink-4); }
.pal-in input { flex: 1; height: 50px; border: 0; outline: 0; background: none; color: var(--u-ink); font: 14px var(--u-mono); }
.pal-in input::placeholder { color: var(--u-ink-4); }
.pal-list { max-height: min(52vh, 460px); overflow-y: auto; padding: 4px 6px 8px; }
.pal-group { padding: 12px 10px 5px; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--u-ink-4); }
.pal-item {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px;
  color: var(--u-ink-2); font-size: 13px; cursor: pointer;
}
.pal-item .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-item .sub { margin-left: auto; padding-left: 12px; color: var(--u-ink-4); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 1; }
.pal-item mark { background: none; color: var(--u-gold); }
.pal-item[aria-selected="true"] { background: rgba(201,161,74,0.12); color: var(--u-ink); }
.pal-hash { display: inline-grid; place-items: center; width: 16px; flex: none; color: var(--u-ink-4); }
.pal-empty { padding: 20px 12px; color: var(--u-ink-4); font-size: 13px; }
.pal-foot { display: flex; gap: 18px; padding: 9px 16px; border-top: 1px solid var(--u-rule-soft); font-size: 11px; color: var(--u-ink-4); }
.pal-foot kbd { margin-right: 2px; }

/* ── narrow screens: the explorer becomes a drawer ── */
.scrim { display: none; }
@media (max-width: 860px) {
  .ide { grid-template-columns: minmax(0, 1fr); grid-template-areas: "title" "editor" "panel" "status"; }
  .explorer {
    position: fixed; z-index: 60; top: var(--tb-h); bottom: var(--sb-h); left: 0; width: min(300px, 86vw);
    transform: translateX(-100%); visibility: hidden; transition: transform .2s ease, visibility .2s;
    box-shadow: 20px 0 60px -20px rgba(0,0,0,0.8);
  }
  .ide.ex-open .explorer { transform: none; visibility: visible; }
  .scrim {
    display: block; position: fixed; inset: var(--tb-h) 0 var(--sb-h); z-index: 55;
    background: rgba(0,0,0,0.5); opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .ide.ex-open .scrim { opacity: 1; pointer-events: auto; }
  .tb-search { flex: none; width: 32px; padding: 0; justify-content: center; margin-left: auto; }
  .tb-search span, .tb-search kbd { display: none; }
  .tb-links a:not(.cta) { display: none; }
  .crumbs { padding: 0 14px; }
  .sb-item kbd, .sb-llms, .sb-motion span { display: none; }
  .panel { height: 200px; }
  html:not(.js) .explorer { position: static; transform: none; visibility: visible; width: auto; }
}

/* ── code blocks (every view) ─────────────────────────────────────────── */
.code { background: var(--u-bg-code); border: 1px solid var(--u-rule); border-radius: 8px; overflow: hidden; }
.code-bar {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--u-rule-soft);
  font-family: var(--u-mono); font-size: 11.5px; color: var(--u-ink-4);
}
.code-bar .file { flex: 1; color: var(--u-ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.code-bar .file::before {
  content: ""; display: inline-block; width: 6px; height: 6px; margin-right: 9px; vertical-align: 1px;
  border-radius: 50%; background: var(--u-gold-dim);
}
.code-bar .open, .copy {
  font: 11px var(--u-mono); color: var(--u-ink-3); text-decoration: none; cursor: pointer;
  background: transparent; border: 1px solid var(--u-rule); border-radius: 5px; padding: 3px 8px;
  transition: color .15s, border-color .15s;
}
.code-bar .open:hover, .copy:hover { color: var(--u-gold); border-color: var(--u-gold-dim); }
html:not(.js) .copy { display: none; }
.code pre, pre.sig, pre.lines {
  margin: 0; font-family: var(--u-mono); font-size: 13px; line-height: 1.7; color: var(--u-ink-2);
  white-space: pre; overflow-x: auto; tab-size: 4; font-variant-ligatures: none;
}
.code pre { padding: 16px 18px; }
.code code, pre.sig code, pre.lines code { font: inherit; color: inherit; background: none; border: 0; padding: 0; white-space: inherit; }
.tk-k { color: var(--u-signal-trace); }
.tk-s { color: var(--u-signal-pass); }
.tk-f { color: var(--u-gold); }
.tk-c { color: var(--u-ink-4); font-style: italic; }
.tk-n { color: var(--u-signal-warn); }
.tk-a { color: var(--u-signal-info); }
.tk-p { color: var(--u-ink-4); user-select: none; }

/* ── docs ─────────────────────────────────────────────────────────────── */
.doc { max-width: 900px; margin: 0 auto; padding: 44px 56px 88px; }
.doc > * { max-width: 760px; }
.doc > .code, .doc > table, .doc > .cards, .doc > .rpc, .doc > .layers, .doc > .pager { max-width: 820px; }
.doc .eyebrow {
  font-family: var(--u-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--u-gold); margin-bottom: 12px;
}
.doc h1 {
  font-family: var(--u-mono); font-weight: 700; font-size: clamp(30px, 4.6cqi, 42px);
  letter-spacing: -0.035em; line-height: 1.06; color: var(--u-ink); margin: 0 0 16px;
}
.doc .lede { font-size: 17.5px; line-height: 1.65; color: var(--u-ink-2); margin: 0 0 30px; }
.doc h2 {
  font-family: var(--u-mono); font-weight: 700; font-size: 22px; letter-spacing: -0.02em; line-height: 1.25;
  color: var(--u-ink); margin: 52px 0 14px; padding-top: 26px; border-top: 1px dashed var(--u-rule);
}
.doc h3 { font-family: var(--u-mono); font-weight: 600; font-size: 16.5px; color: var(--u-ink); margin: 34px 0 10px; }
.doc h4 { font-family: var(--u-mono); font-weight: 600; font-size: 14.5px; color: var(--u-ink); margin: 32px 0 8px; }
.doc h5 {
  font-family: var(--u-mono); font-weight: 500; font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--u-ink-3); margin: 0 0 8px;
}
.doc :is(h1, h2, h3, h4) { overflow-wrap: anywhere; scroll-margin-top: 16px; }
.doc :is(h2, h3, h4) code { font: inherit; color: inherit; background: none; padding: 0; }
.doc p, .doc li { font-size: 15.5px; line-height: 1.7; }
.doc p { margin: 0 0 16px; }
.doc ul { margin: 0 0 18px; padding-left: 20px; }
.doc li { margin: 5px 0; }
.doc li::marker { color: var(--u-ink-4); }
.doc :is(b, strong) { color: var(--u-ink); font-weight: 500; }
.doc a { color: var(--u-gold); text-decoration: underline; text-decoration-color: var(--u-gold-dim); text-underline-offset: 3px; transition: text-decoration-color .15s; }
.doc a:hover { text-decoration-color: var(--u-gold); }
.doc a:has(> code:only-child) { text-decoration: none; }
.doc :not(pre) > code {
  font-family: var(--u-mono); font-size: 0.86em; color: var(--u-ink);
  background: rgba(255,255,255,0.045); border-radius: 4px; padding: 0.12em 0.38em;
  white-space: nowrap;
}
.doc a > code { color: var(--u-gold); background: rgba(201,161,74,0.1); }
.doc a:hover > code { background: rgba(201,161,74,0.16); }
.doc code.wrap { white-space: normal; overflow-wrap: anywhere; }
.anchor {
  margin-left: 10px; color: var(--u-ink-4) !important; text-decoration: none !important;
  font-weight: 400; opacity: 0; transition: opacity .15s;
}
:is(h2, h3, h4):hover > .anchor, .anchor:focus-visible { opacity: 1; }
.doc .code { margin: 0 0 20px; }
.doc pre.sig {
  background: var(--u-bg-1); border: 1px solid var(--u-rule); border-left: 2px solid var(--u-gold-dim);
  border-radius: 6px; padding: 10px 14px; margin: 0 0 12px; font-size: 12.5px;
}

.doc table { width: 100%; border-collapse: collapse; margin: 0 0 22px; font-size: 14px; }
.doc th {
  text-align: left; font-family: var(--u-mono); font-weight: 500; font-size: 10.5px;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--u-ink-3);
  padding: 8px 14px 8px 0; border-bottom: 1px solid var(--u-rule-strong);
}
.doc td { padding: 10px 14px 10px 0; border-bottom: 1px solid var(--u-rule); vertical-align: top; line-height: 1.55; }
.doc td:first-child { white-space: nowrap; }
.doc td.yes { color: var(--u-signal-pass); font-family: var(--u-mono); font-size: 13px; }

.note {
  border: 1px solid var(--u-gold-dim); border-radius: 8px; background: rgba(201,161,74,0.06);
  padding: 13px 16px; margin: 0 0 24px; font-size: 15px; line-height: 1.6;
}
.note b { color: var(--u-gold); }
.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 8px 0 24px; }
.doc a.card {
  display: block; padding: 16px 18px; text-decoration: none;
  border: 1px solid var(--u-rule); border-radius: 8px; background: var(--u-bg-1);
  transition: border-color .15s, background .15s;
}
.doc a.card:hover { border-color: var(--u-gold-dim); background: #16161f; }
.doc a.card b { display: block; font-family: var(--u-mono); font-size: 14px; color: var(--u-ink); margin-bottom: 4px; }
.doc a.card span { display: block; font-size: 14px; color: var(--u-ink-3); line-height: 1.5; }
.layers { display: grid; gap: 6px; margin: 4px 0 22px; font-family: var(--u-mono); }
.layer {
  display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: baseline;
  padding: 12px 16px; border: 1px solid var(--u-rule); border-radius: 6px; background: var(--u-bg-1);
}
.layer b { font-size: 13px; color: var(--u-ink); font-weight: 600; }
.layer span { font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--u-signal-pass); }
.layer em { grid-column: 1 / -1; font-style: normal; font-size: 12px; color: var(--u-ink-3); }
.layer.private { border-color: var(--u-gold-dim); }
.layer.private span { color: var(--u-gold); }

/* API reference */
.rpc + .rpc { border-top: 1px solid var(--u-rule-soft); margin-top: 36px; }
.rpc h3 { margin-top: 28px; }
.endpoint {
  display: inline-flex; align-items: center; gap: 10px; max-width: 100%; overflow-x: auto;
  font-family: var(--u-mono); font-size: 12.5px;
  background: var(--u-bg-1); border: 1px solid var(--u-rule); border-radius: 6px;
  padding: 6px 10px; margin: 0 0 16px;
}
.endpoint .verb { color: var(--u-gold); font-weight: 600; }
.doc .endpoint code { background: none; padding: 0; color: var(--u-ink-2); }
.rpc-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; margin-bottom: 14px; }
.rpc-cols > div { min-width: 0; }
.doc table.fields { font-size: 13px; margin-bottom: 8px; }
.doc table.fields td { padding: 7px 10px 7px 0; }
.doc table.fields td.ty { font-family: var(--u-mono); font-size: 12px; color: var(--u-ink-3); white-space: nowrap; }
.oneof { font-family: var(--u-mono); font-size: 10.5px; color: var(--u-signal-info); white-space: nowrap; }
.stream { font-size: 14px; color: var(--u-signal-info); }
.empty { font-size: 13px; color: var(--u-ink-4); }

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--u-rule); }
.doc .pager a {
  display: block; padding: 14px 16px; border: 1px solid var(--u-rule); border-radius: 8px;
  text-decoration: none; color: var(--u-ink); font-family: var(--u-mono); font-size: 14px;
  transition: border-color .15s, background .15s;
}
.doc .pager a:hover { border-color: var(--u-gold-dim); background: var(--u-bg-1); }
.pager a span { display: block; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--u-ink-4); margin-bottom: 4px; }
.pager .next { text-align: right; grid-column: 2; }

@container main (max-width: 720px) {
  .doc { padding: 30px 20px 64px; }
  .rpc-cols, .cards { grid-template-columns: 1fr; }
  .doc td:first-child { white-space: normal; }
  .doc table { display: block; overflow-x: auto; }
}

/* ── example files ────────────────────────────────────────────────────── */
.file-view { display: flex; flex-direction: column; min-height: 100%; }
.fv-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap;
  padding: 28px 28px 18px; border-bottom: 1px solid var(--u-rule-soft);
}
.fv-head h1 { margin: 0 0 6px; font: 700 22px/1.2 var(--u-mono); letter-spacing: -0.02em; color: var(--u-ink); }
.fv-head p { margin: 0; font-size: 14.5px; color: var(--u-ink-3); }
.fv-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font: 11.5px var(--u-mono); color: var(--u-ink-4); }
.fv-meta a { color: var(--u-ink-3); text-decoration: none; border-bottom: 1px solid var(--u-rule-strong); }
.fv-meta a:hover { color: var(--u-gold); border-bottom-color: var(--u-gold-dim); }
pre.lines { flex: 1; padding: 16px 0 40px; font-size: 13.5px; line-height: 1.75; counter-reset: ln; }
pre.lines .l { display: block; padding: 0 28px 0 0; }
pre.lines .l::before {
  counter-increment: ln; content: counter(ln);
  display: inline-block; width: 3.6em; padding-right: 1.6em; text-align: right;
  color: var(--u-ink-5); user-select: none;
}
pre.lines .l:target { background: rgba(201,161,74,0.08); }
pre.lines .l:target::before { color: var(--u-gold); }

/* ── console and not-found ────────────────────────────────────────────── */
.v-console { min-height: 100%; display: grid; }

/* README */
/* README view: concept scenes, then the reference sections. Scoped to .readme by
   the build. Sizes follow the editor pane (container "main"), not the window. */

/* ── scenes ── */
.readme .stage { position: relative; border-bottom: 1px solid var(--u-rule-soft); }
/* 16:10, but never taller than the pane, so a whole scene and its copy are always
   in view; a short pane makes the stage wider and the diagram keeps its size */
.readme .media {
  position: relative; overflow: hidden; background: var(--u-bg);
  height: min(62.5cqi, max(400px, 100cqb)); container: scene / size;
}
/* a scene is its poster, then a live canvas, or a recorded loop where there is no WebGPU */
.readme .media .poster, .readme .media > canvas, .readme .media > .loop { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.readme .media .poster, .readme .media > .loop { object-fit: cover; object-position: right center; }
.readme .stage[data-side="right"] .media :is(.poster, .readme .loop) { object-position: left center; }
.readme .stage[data-scene="fork"] .media :is(.poster, .readme .loop) { object-position: center; }
/* the scene and its poster cross-fade: the hero's canvas is partly transparent,
   and the poster must not show through it */
.readme .media .poster, .readme .media > canvas, .readme .media > .loop { transition: opacity .9s ease; }
.readme .media > canvas, .readme .media > .loop, .readme .stage.live .media .poster { opacity: 0; }
.readme .stage.live .media > :is(canvas, .readme .loop) { opacity: 1; }
/* the same soft scrim behind the copy in every scene */
.readme .media::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: linear-gradient(90deg, rgba(14,14,20,0.86) 0%, rgba(14,14,20,0.52) 32%, transparent 56%);
}
.readme .stage[data-side="right"] .media::after { background: linear-gradient(270deg, rgba(14,14,20,0.86) 0%, rgba(14,14,20,0.52) 32%, transparent 56%); }

.readme .blurb { position: absolute; z-index: 3; left: 6%; bottom: 9%; width: min(520px, 42%); }
/* a soft pool of dark behind the copy, so light in the scene never runs through the text */
.readme .blurb::before {
  content: ""; position: absolute; z-index: -1; inset: -18% -16% -14% -14%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(14,14,20,0.72), rgba(14,14,20,0.4) 60%, transparent);
}
.readme .stage[data-side="right"] .blurb { left: auto; right: 6%; }
.readme .eyebrow, .readme .s-label {
  display: flex; gap: 14px; align-items: baseline;
  font-family: var(--u-mono); font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--u-ink-3);
  margin-bottom: 20px;
}
.readme .eyebrow b, .readme .s-label b { color: var(--u-gold); font-weight: 400; }
.readme .blurb h1, .readme .blurb h2 { font-family: var(--u-mono); font-weight: 700; color: var(--u-ink); letter-spacing: -0.04em; line-height: 0.98; margin: 0 0 20px; }
/* sized so the longest line fits the blurb (42cqi): 10 mono characters for the
   h1, 17 for an h2; and kept short enough that the copy fits a short pane */
.readme .blurb h1 { font-size: clamp(42px, min(7.3cqi, 13cqb), 90px); }
.readme .blurb h2 { font-size: clamp(28px, min(4.3cqi, 8cqb), 54px); }
.readme .gold { color: var(--u-gold-bright); }
.readme .blurb p { font-size: clamp(15px, 1.35cqi, 17.5px); line-height: 1.6; color: var(--u-ink-2); margin: 0 0 22px; max-width: 46ch; }
.readme .detail {
  display: flex; flex-wrap: wrap; gap: 8px 18px; max-width: 46ch; padding-top: 14px; border-top: 1px solid var(--u-rule);
  font-family: var(--u-mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--u-ink-4);
}
.readme .detail span::before { content: ""; display: inline-block; width: 5px; height: 5px; margin-right: 8px; vertical-align: 0.15em; background: var(--u-gold); }

.readme .cta-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.readme .btn {
  display: inline-flex; align-items: center; gap: 10px; cursor: pointer;
  font-family: var(--u-mono); font-size: 13px; color: var(--u-ink); text-decoration: none;
  padding: 11px 16px; border: 1px solid var(--u-rule-strong); border-radius: 6px; background: rgba(14,14,20,0.6);
  transition: border-color .15s, color .15s, background .15s;
}
.readme .btn:hover { border-color: var(--u-gold); color: var(--u-gold); }
.readme .btn.solid { background: var(--u-gold); border-color: var(--u-gold); color: var(--u-bg); font-weight: 600; }
.readme .btn.solid:hover { background: var(--u-gold-bright); border-color: var(--u-gold-bright); color: var(--u-bg); }
.readme .btn .pr { color: var(--u-ink-4); }

/* labels sit on the scene's own geometry; positions come from the build */
.readme .labels { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.readme .label, .readme .legend { left: var(--x); top: var(--y); }
.readme .label {
  position: absolute; transform: translateY(-100%); white-space: nowrap;
  font-family: var(--u-mono); font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--u-ink-2);
  line-height: 1.35; text-shadow: 0 1px 4px var(--u-bg);
}
.readme .scene-note { font-size: 11px; text-transform: none; color: var(--u-ink-3); }
.readme .stage[data-scene="isolation"] .scene-note { font-size: clamp(9px, 2.3cqi, 11px); }
.readme .stage[data-scene="isolation"] .isolation-centered { transform: translate(-50%, -100%); }
.readme .stage[data-scene="isolation"] .isolation-policy { transform: translate(-50%, -50%); color: var(--u-signal-pass); }
.readme .stage[data-scene="isolation"] .isolation-blocked { transform: translate(-50%, -50%); color: var(--u-signal-fail); }
.readme .stage[data-scene="isolation"] .isolation-agent, .readme .stage[data-scene="isolation"] .private-writes { color: var(--u-gold); }
.readme .stage[data-scene="isolation"] .isolation-reads { color: var(--u-signal-pass); }
.readme .label b { color: var(--u-ink); font-weight: 500; }
/* Dedup IDs sit at tile centres; only the currently selected content is named. */
.readme .stage[data-scene="dedup"] .source-name {
  transform: translate(-50%, -100%); color: var(--u-ink-3); font-size: 10px;
}
.readme .stage[data-scene="dedup"] .block-id {
  transform: translate(-50%, -50%); font-size: clamp(8px, 1.65cqh, 11px);
  font-weight: 600; letter-spacing: 0.02em; color: #242016; text-shadow: none;
}
.readme .stage[data-scene="dedup"] .block-status {
  font-size: 11px; text-transform: none; color: var(--u-gold);
}
.readme .stage[data-scene="dedup"] .block-id, .readme .stage[data-scene="dedup"] .block-status { opacity: 0; }
.readme .stage[data-content="0"] [data-content-id="0"], .readme .stage[data-content="1"] [data-content-id="1"], .readme .stage[data-content="2"] [data-content-id="2"], .readme .stage[data-content="3"] [data-content-id="3"], .readme .stage[data-content="4"] [data-content-id="4"], .readme .stage[data-content="5"] [data-content-id="5"] { opacity: 1; }
.readme .stage[data-scene="dedup"]:not([data-phase="hold"]) .block-status, .readme .stage[data-scene="dedup"]:not([data-phase="hold"]) .store-id { opacity: 0; }
.readme .legend {
  position: absolute; display: flex; gap: 18px; white-space: nowrap;
}
.readme .legend, .readme .scene-key {
  font-family: var(--u-mono); font-size: 12px; line-height: 1.5; letter-spacing: 0.025em; text-transform: uppercase; color: var(--u-ink-2);
}
.readme .scene-key { display: none; }
.readme .legend .sw, .readme .scene-key .sw { display: inline-block; width: 9px; height: 9px; margin-right: 8px; vertical-align: -1px; border-radius: 1.5px; }
.readme .legend .sw.shared, .readme .scene-key .sw.shared { box-shadow: inset 0 0 0 1px #8d8799; }
.readme .legend .sw.copied, .readme .scene-key .sw.copied { background: var(--u-gold-bright); box-shadow: 0 0 6px rgba(224,185,85,0.45); }

/* ── reference sections ── */
.readme .s { padding: 72px 6% 80px; border-bottom: 1px solid var(--u-rule-soft); }
.readme .s-title {
  font-family: var(--u-mono); font-weight: 700; font-size: clamp(28px, 3.6cqi, 46px);
  letter-spacing: -0.03em; line-height: 1.06; color: var(--u-ink); margin: 0 0 16px; max-width: 24ch;
}
.readme .s-lede { font-size: 16.5px; line-height: 1.65; color: var(--u-ink-2); max-width: 62ch; margin: 0 0 36px; }
.readme .s .code { max-width: 920px; }

.readme .steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 36px; margin-top: 32px; max-width: 920px; }
.readme .step { padding-top: 18px; border-top: 1px solid var(--u-rule); }
.readme .step .n { font-family: var(--u-mono); font-size: 11px; letter-spacing: 0.16em; color: var(--u-gold); margin-bottom: 8px; }
.readme .step h4 { font-family: var(--u-mono); font-size: 14.5px; font-weight: 600; color: var(--u-ink); margin: 0 0 6px; }
.readme .step p { font-size: 14.5px; line-height: 1.6; margin: 0; }

.readme .uses { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid var(--u-rule); border-left: 1px solid var(--u-rule); }
.readme .use { padding: 24px 22px 26px; border-right: 1px solid var(--u-rule); border-bottom: 1px solid var(--u-rule); transition: background .2s; }
.readme .use:hover { background: rgba(201,161,74,0.03); }
.readme .use .ix { font-family: var(--u-mono); font-size: 11px; color: var(--u-ink-4); letter-spacing: 0.1em; margin-bottom: 16px; }
.readme .use h3 { font-family: var(--u-mono); font-size: 15px; font-weight: 600; color: var(--u-ink); margin: 0 0 8px; }
.readme .use p { font-size: 14px; line-height: 1.6; margin: 0; }

.readme .built { border: 1px solid var(--u-rule); background: var(--u-bg-1); border-radius: 8px; overflow-x: auto; max-width: 1040px; }
.readme .built table { width: 100%; border-collapse: collapse; font-family: var(--u-mono); font-size: 13px; }
.readme .built th, .readme .built td { text-align: left; padding: 14px 20px; border-bottom: 1px solid var(--u-rule); vertical-align: top; }
.readme .built th { font-weight: 500; color: var(--u-gold); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; width: 1%; padding-top: 16px; }
.readme .built td { color: var(--u-ink-3); line-height: 1.6; }
.readme .built td b { color: var(--u-ink); font-weight: 500; }
.readme .built tr:last-child th, .readme .built tr:last-child td { border-bottom: none; }

/* ── narrower panes ── */
@container main (max-width: 1080px) {
  .readme .uses { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container main (max-width: 780px) {
  /* the copy moves below the scene, so the scene becomes a banner that leaves it in view */
  .readme .media { height: min(62.5cqi, max(200px, 52cqb)); }
  /* a diagram's banner is 1.25:1, its posters drawn to match; a short pane widens
     it past 1.45:1, and the diagram holds to its edge again */
  .readme .stage:is([data-scene="sharing"], .readme [data-scene="dedup"], .readme [data-scene="isolation"], .readme [data-scene="finale"]) .media { height: min(80cqi, max(200px, 64cqb)); }
  .readme .media::after, .readme .blurb::before { display: none; }
  .readme .blurb, .readme .stage[data-side="right"] .blurb { position: static; width: auto; padding: 26px 20px 40px; }
  .readme .label { font-size: 10px; letter-spacing: 0.025em; }
  /* Keep the key in normal flow below the canvas, clear of the bottom row and copy. */
  .readme .labels .legend { display: none; }
  .readme .scene-key { display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 16px 20px 0; font-size: 10.5px; }
  .readme .scene-key > span { white-space: nowrap; }
  .readme .steps { grid-template-columns: 1fr; gap: 18px; }
  .readme .s { padding: 52px 20px 60px; }
}
@container main (max-width: 520px) {
  .readme .uses { grid-template-columns: 1fr; }
}
/* a stage narrower than this is a banner, and its diagram is centred in it (scenes.js) */
@container scene (aspect-ratio < 1.45) {
  .readme .label, .readme .legend { left: var(--bx, var(--x)); top: var(--by, var(--y)); }
  .readme .label { font-size: clamp(10px, 2.6cqi, 11px); letter-spacing: 0.025em; }
}
/* Short landscape panes retain enough space between adjacent sandbox labels. */
@container scene (max-height: 240px) and (aspect-ratio >= 1.45) {
  .readme .label { font-size: 9px; letter-spacing: 0.015em; }
}

.readme .btn.copied { border-color: var(--u-signal-pass); color: var(--u-signal-pass); }

/* console */
  /* Console view: the invite-only gate. Scoped to .console-view by the build. */
  .console-view .gate {
    min-height: 100%; position: relative;
    display: grid; place-items: center;
    padding: 72px 16px 88px;
    overflow: hidden;
  }
  /* faint page grid, fading out from the card */
  .console-view .gate::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background-image:
      linear-gradient(var(--u-rule-soft) 1px, transparent 1px),
      linear-gradient(90deg, var(--u-rule-soft) 1px, transparent 1px);
    background-size: 32px 32px;
    -webkit-mask-image: radial-gradient(ellipse 50% 60% at 50% 50%, #000 0%, transparent 78%);
            mask-image: radial-gradient(ellipse 50% 60% at 50% 50%, #000 0%, transparent 78%);
  }
  .console-view .card {
    position: relative; width: 100%; max-width: 400px;
    background: var(--u-bg-1); border: 1px solid var(--u-rule); border-radius: 8px;
    padding: 30px 30px 26px;
    box-shadow: 0 40px 100px -50px rgba(0,0,0,0.9);
  }
  .console-view .pages { display: grid; grid-template-columns: repeat(16, 1fr); gap: 3px; margin-bottom: 26px; }
  .console-view .pages i { display: block; aspect-ratio: 1; border-radius: 1.5px; background: var(--u-page-0); }
  .console-view .pages i.p1 { background: var(--u-page-1); }
  .console-view .pages i.p2 { background: var(--u-page-2); }
  .console-view .pages i.w { background: var(--u-gold); box-shadow: 0 0 8px rgba(201,161,74,0.45); }
  .console-view .tag {
    display: inline-flex; align-items: center; gap: 8px;
    font-family: var(--u-mono); font-size: 10.5px; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--u-gold); border: 1px solid var(--u-gold-dim); border-radius: 999px;
    padding: 4px 10px 4px 9px; margin-bottom: 18px;
  }
  .console-view .tag svg { display: block; }
  .console-view h1 {
    font-family: var(--u-mono); font-weight: 700; font-size: 26px; line-height: 1.15;
    letter-spacing: -0.03em; color: var(--u-ink); margin: 0 0 12px;
  }
  .console-view .card p { font-size: 15px; line-height: 1.6; margin: 0 0 24px; }
  .console-view .actions { display: grid; gap: 10px; }
  .console-view .btn {
    display: flex; align-items: center; justify-content: center; gap: 10px;
    font-family: var(--u-mono); font-size: 13px; text-decoration: none;
    padding: 12px 16px; border-radius: 4px;
    border: 1px solid var(--u-rule-strong); color: var(--u-ink);
    transition: border-color .15s, color .15s, background .15s;
  }
  .console-view .btn:hover { border-color: var(--u-gold); color: var(--u-gold); }
  .console-view .btn.solid { background: var(--u-gold); border-color: var(--u-gold); color: var(--u-bg); font-weight: 600; }
  .console-view .btn.solid:hover { background: var(--u-gold-bright); border-color: var(--u-gold-bright); color: var(--u-bg); }
  .console-view .fine {
    margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--u-rule-soft);
    font-family: var(--u-mono); font-size: 11px; color: var(--u-ink-4); letter-spacing: 0.02em;
    display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  }
  @container main (max-width: 480px) {
    .console-view .gate { padding: 48px 16px 64px; }
    .console-view .card { padding: 24px 20px 20px; }
    .console-view h1 { font-size: 23px; }
  }
