/* ==========================================================================
   OpenVLHarness project page
   Visual language: a "viewfinder" — detection boxes, corner brackets, handles.
   Colors follow the paper's Figure 2 roles ("Signal" palette): --cap (cobalt) =
   capability layer, --ev (orange) = rendered evidence, --mem (magenta) = persistent memory.
   ========================================================================== */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-grid: rgba(17, 19, 24, 0.045);
  --surface: #ffffff;
  --surface-2: #f4f5f7;
  --surface-3: #e9ebef;
  --ink: #111318;
  --ink-2: #444a55;
  --ink-3: #737a85;
  --line: #e3e5ea;
  --line-2: #cdd1d9;

  --cap: #2653c1;
  --cap-soft: rgba(38, 83, 193, 0.10);
  --ev: #c9520e;
  --ev-soft: rgba(201, 82, 14, 0.10);
  --obs: #0e7f74;
  --obs-soft: rgba(14, 127, 116, 0.10);
  --mem: #a83a6d;
  --mem-soft: rgba(168, 58, 109, 0.10);
  --on-accent: #ffffff;
  --rose: #c9520e;

  /* chart series (entity-bound, never re-ordered) */
  --s-ours: #2653c1;
  --s-base: #a4a8ae;
  --s-codex: #e46212;
  --s-vs: #b54076;
  --s-octo: #c58d04;
  --s-other: #8d9097;
  --pos: #2653c1;
  --neg: #c9520e;

  --shadow: 0 1px 2px rgba(20, 24, 27, 0.04), 0 8px 24px -12px rgba(20, 24, 27, 0.12);
  --radius: 14px;
  --radius-sm: 9px;

  --f-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --f-body: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --maxw: 1320px;
  --gutter: clamp(16px, 3vw, 40px);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1115;
  --bg-grid: rgba(238, 240, 244, 0.045);
  --surface: #14171c;
  --surface-2: #1a1e24;
  --surface-3: #222730;
  --ink: #eef0f4;
  --ink-2: #b3b9c4;
  --ink-3: #808896;
  --line: #232831;
  --line-2: #303641;
  --cap: #7c9ff0;
  --cap-soft: rgba(124, 159, 240, 0.13);
  --ev: #f28a4c;
  --ev-soft: rgba(242, 138, 76, 0.13);
  --obs: #45c4b4;
  --obs-soft: rgba(69, 196, 180, 0.13);
  --mem: #e0709f;
  --mem-soft: rgba(224, 112, 159, 0.14);
  --on-accent: #0f1115;
  --rose: #f28a4c;
  --s-ours: #5782e0;
  --s-base: #6b7380;
  --s-codex: #e1712d;
  --s-vs: #b13d73;
  --s-octo: #af8e2a;
  --s-other: #7d838e;
  --pos: #5782e0;
  --neg: #f28a4c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -14px rgba(0, 0, 0, 0.6);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--cap); text-decoration-thickness: 1px; text-underline-offset: 3px; }
code, .mono { font-family: var(--f-mono); font-size: 0.86em; }
h1, h2, h3, h4 { font-family: var(--f-display); letter-spacing: -0.015em; line-height: 1.15; margin: 0; }
p { margin: 0 0 1em; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.muted { color: var(--ink-3); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 20px; height: 58px; }
.brand { display: flex; align-items: center; gap: 9px; font-family: var(--f-display); font-weight: 700; color: var(--ink); text-decoration: none; font-size: 17px; letter-spacing: -0.02em; }
.brand-mark { width: 22px; height: 22px; color: var(--cap); }
.nav-links { display: flex; gap: 4px; margin-left: auto; }
.nav-links a {
  color: var(--ink-2); text-decoration: none; font-size: 14px; font-weight: 500;
  padding: 6px 10px; border-radius: 8px; transition: background .2s, color .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--ink); background: var(--surface-2); }
.theme-switch {
  position: relative; flex: none; width: 58px; height: 30px; padding: 0; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--surface-2);
  display: flex; align-items: center; justify-content: space-between; padding: 0 8px;
  transition: background .25s, border-color .25s;
}
.theme-switch:hover { border-color: var(--ink-3); }
.theme-switch:focus-visible { outline: 2px solid var(--cap); outline-offset: 2px; }
.theme-switch svg { width: 13px; height: 13px; color: var(--ink-3); position: relative; z-index: 1; transition: color .25s; }
.theme-switch .ts-knob {
  position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 0 0 1px var(--line);
  transition: transform .28s cubic-bezier(.3,1.3,.5,1);
}
.theme-switch .ts-sun { color: var(--ev); }
:root[data-theme="dark"] .theme-switch { background: var(--surface-3); }
:root[data-theme="dark"] .theme-switch .ts-knob { transform: translateX(28px); background: var(--ink-2); }
:root[data-theme="dark"] .theme-switch .ts-sun { color: var(--ink-3); }
:root[data-theme="dark"] .theme-switch .ts-moon { color: var(--mem); }

/* ---------- hero ---------- */
.hero { padding: 72px 0 36px; text-align: center; position: relative; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.04em;
  color: var(--ink-2); background: var(--surface); border: 1px solid var(--line);
  padding: 5px 12px; border-radius: 999px; margin-bottom: 26px;
}
.eyebrow .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cap); box-shadow: 0 0 0 3px var(--cap-soft); }

.title-box { position: relative; display: inline-block; padding: 10px 22px 12px; margin-bottom: 14px; }
.title-box h1 {
  font-size: clamp(40px, 7.4vw, 84px); font-weight: 700; letter-spacing: -0.04em; line-height: 1;
}
.title-box h1 .vl { color: var(--cap); }
/* animated detection box around the title */
.det-box { position: absolute; inset: 0; pointer-events: none; }
.det-box i {
  position: absolute; width: 18px; height: 18px; border: 2.5px solid var(--ev);
  opacity: 0; transition: opacity .4s ease, transform .9s cubic-bezier(.2,.8,.2,1);
}
.det-box i:nth-of-type(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; transform: translate(-30px, -22px); }
.det-box i:nth-of-type(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; transform: translate(30px, -22px); }
.det-box i:nth-of-type(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; transform: translate(-30px, 22px); }
.det-box i:nth-of-type(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; transform: translate(30px, 22px); }
.det-box .det-label {
  position: absolute; left: -1px; top: -24px; font-family: var(--f-mono); font-size: 11.5px; font-weight: 500;
  background: var(--ev); color: var(--on-accent); padding: 2px 8px; border-radius: 4px 4px 4px 0;
  opacity: 0; transform: translateY(4px); transition: opacity .4s ease .7s, transform .4s ease .7s; white-space: nowrap;
}
.det-box.on i { opacity: 1; transform: none; }
.det-box.on .det-label { opacity: 1; transform: none; }

.subtitle {
  font-family: var(--f-display); font-weight: 500; color: var(--ink-2);
  font-size: clamp(19px, 2.4vw, 26px); letter-spacing: -0.01em; max-width: 820px; margin: 0 auto 26px; line-height: 1.3;
}
.authors { font-size: 16px; color: var(--ink); margin: 0 auto 6px; max-width: 900px; }
.authors span { white-space: nowrap; }
.authors a { color: var(--ink); text-decoration: none; border-bottom: 1px dashed var(--line-2); }
.authors sup { color: var(--ink-3); }
.affils { font-size: 14px; color: var(--ink-3); margin-bottom: 26px; line-height: 1.7; }
.affils .eq { font-size: 12.5px; }
.placeholder-note {
  display: inline-block; font-family: var(--f-mono); font-size: 11px; color: var(--ev);
  border: 1px dashed var(--ev); border-radius: 6px; padding: 1px 7px; margin-left: 6px; vertical-align: 2px;
}

.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 44px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: 10px; font-weight: 600; font-size: 15px; text-decoration: none;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-2);
  transition: transform .15s ease, border-color .2s, background .2s; cursor: pointer;
}
.btn:hover { transform: translateY(-1px); border-color: var(--ink-3); }
.btn svg { width: 17px; height: 17px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.primary:hover { border-color: var(--ink); }
.btn .soon { font-family: var(--f-mono); font-size: 10.5px; font-weight: 500; color: var(--ink-3); border-left: 1px solid var(--line-2); padding-left: 8px; }
.btn.primary .soon { color: color-mix(in srgb, var(--bg) 65%, transparent); border-color: color-mix(in srgb, var(--bg) 30%, transparent); }

/* hero charts */
.hero-charts { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; text-align: left; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); position: relative;
}
.chart-card { padding: 18px 20px 14px; min-width: 0; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 4px; flex-wrap: wrap; }
.chart-kicker { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.chart-title { font-family: var(--f-display); font-weight: 600; font-size: 17px; color: var(--ink); margin: 2px 0 8px; }
.chart-note { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; line-height: 1.45; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin: 4px 0 6px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.legend i.line { height: 3px; width: 16px; border-radius: 2px; }
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }

/* svg chart parts */
.ax text, .chart text { font-family: var(--f-body); }
.ax-label { fill: var(--ink-3); font-size: 11.5px; }
.ax-title { fill: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.grid-line { stroke: var(--line); stroke-width: 1; }
.base-line { stroke: var(--line-2); stroke-width: 1; }
.val-label { fill: var(--ink-2); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.val-label.strong { fill: var(--ink); font-weight: 700; }
.cat-label { fill: var(--ink-2); font-size: 12px; font-weight: 500; }
.delta-chip rect { fill: var(--cap-soft); }
.delta-chip text { fill: var(--cap); font-size: 11.5px; font-weight: 700; font-family: var(--f-mono); }

.anim-bar { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); transition: transform .9s cubic-bezier(.2,.8,.2,1); }
.anim-hbar { transform-box: fill-box; transform-origin: 0 50%; transform: scaleX(0); transition: transform .9s cubic-bezier(.2,.8,.2,1); }
.anim-fade { opacity: 0; transition: opacity .5s ease; }
.anim-line { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1.6s cubic-bezier(.4,0,.2,1); }
.anim-pop { transform-box: fill-box; transform-origin: center; transform: scale(0); transition: transform .45s cubic-bezier(.3,1.5,.5,1); }
.chart.in .anim-bar, .chart.in .anim-hbar, .chart.in .anim-pop { transform: none; }
.chart.in .anim-fade { opacity: 1; }
.chart.in .anim-line { stroke-dashoffset: 0; }

.tip {
  position: absolute; pointer-events: none; z-index: 10;
  background: var(--ink); color: var(--bg); font-size: 12.5px; line-height: 1.45;
  padding: 7px 10px; border-radius: 8px; white-space: nowrap; opacity: 0; transform: translate(-50%, calc(-100% - 10px));
  transition: opacity .12s; box-shadow: 0 6px 18px rgba(0,0,0,.18);
}
.tip.show { opacity: 1; }
.tip b { font-weight: 700; }
.tip .k { opacity: .7; }

/* ---------- sections ---------- */
section.block { padding: 84px 0 20px; }
.sec-head { margin-bottom: 34px; max-width: 820px; }
.sec-tag {
  display: inline-flex; align-items: center; gap: 8px; position: relative;
  font-family: var(--f-mono); font-size: 12px; font-weight: 500; letter-spacing: 0.05em; color: var(--cap);
  padding: 4px 10px; margin-bottom: 16px;
}
/* corner-bracket "detection" frame on section tags */
.sec-tag::before, .sec-tag::after {
  content: ""; position: absolute; width: 8px; height: 8px; border: 1.5px solid currentColor;
}
.sec-tag::before { left: 0; top: 0; border-right: 0; border-bottom: 0; }
.sec-tag::after { right: 0; bottom: 0; border-left: 0; border-top: 0; }
.sec-head h2 { font-size: clamp(30px, 4vw, 44px); font-weight: 700; letter-spacing: -0.03em; margin-bottom: 14px; }
.sec-head p.lead { font-size: 18px; color: var(--ink-2); margin: 0; }

/* ---------- demo + playground ---------- */
.playground { padding: 0; overflow: hidden; }
.pg-bar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.pg-bar .dots { display: flex; gap: 6px; }
.pg-bar .dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--line-2); }
.pg-bar .title { font-family: var(--f-mono); font-size: 12.5px; color: var(--ink-2); }
.badge {
  font-family: var(--f-mono); font-size: 11px; font-weight: 600; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px; background: var(--ev-soft); color: var(--ev); margin-left: auto;
}
.pg-body { display: grid; grid-template-columns: 1fr 1.25fr; min-height: 300px; }
.pg-left { padding: 20px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.drop {
  flex: 1; min-height: 160px; border: 1.5px dashed var(--line-2); border-radius: 12px; display: grid; place-items: center;
  text-align: center; color: var(--ink-3); font-size: 14px; padding: 16px;
}
.drop svg { width: 30px; height: 30px; margin: 0 auto 8px; color: var(--ink-3); }
.ask { display: flex; gap: 8px; }
.ask input {
  flex: 1; min-width: 0; font: inherit; font-size: 14.5px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3);
}
.ask button { font: inherit; font-weight: 600; font-size: 14px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--line-2); color: var(--ink-3); cursor: not-allowed; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); background: var(--surface); }
.pg-right { padding: 20px; position: relative; }
.pg-right h4 { font-family: var(--f-mono); font-weight: 500; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.ghost-step { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.ghost-step .gi { width: 28px; height: 28px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); flex: none; }
.ghost-step .gl { height: 10px; border-radius: 5px; background: var(--surface-3); }
.pg-overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: color-mix(in srgb, var(--surface) 55%, transparent); backdrop-filter: blur(1.5px);
}
.pg-overlay div { max-width: 320px; }
.pg-overlay strong { font-family: var(--f-display); font-size: 19px; display: block; margin-bottom: 4px; }
.pg-overlay span { font-size: 14px; color: var(--ink-2); }

/* ---------- method (animated figure) ---------- */
.method-fig { padding: 18px; }
.mf-grid {
  display: grid; gap: 14px;
  grid-template-columns: minmax(0, 2.15fr) minmax(0, 1fr);
}
.mf-main { display: grid; gap: 12px; grid-template-rows: auto auto auto auto; min-width: 0; }
.mf-row { display: grid; gap: 12px; min-width: 0; }
.mf-row.top { grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr) minmax(0, 1.1fr); }
.mf-row.mid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.box {
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px 13px;
  transition: border-color .35s, box-shadow .35s, background .35s; position: relative; min-width: 0;
}
.box h5 { font-family: var(--f-display); font-size: 13.5px; font-weight: 600; margin: 0 0 8px; display: flex; align-items: center; gap: 7px; }
.box h5 .ico { width: 15px; height: 15px; }
.box.lit { box-shadow: 0 0 0 3px var(--cap-soft); border-color: var(--cap); }
.box.lit-a { box-shadow: 0 0 0 3px var(--ev-soft); border-color: var(--ev); }
.box.lit-v { box-shadow: 0 0 0 3px var(--mem-soft); border-color: var(--mem); }
.b-user .q { font-size: 13.5px; line-height: 1.4; margin-bottom: 8px; color: var(--ink); }
.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.thumbs figure { margin: 0; min-width: 0; }
.thumbs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.thumbs figcaption { font-family: var(--f-mono); font-size: 9.5px; color: var(--ink-3); margin-top: 2px; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.final {
  margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--ink-3); display: flex; align-items: center; gap: 6px;
  transition: color .3s;
}
.final .ans { font-family: var(--f-mono); padding: 1px 7px; border-radius: 5px; background: var(--surface-2); color: var(--ink-3); transition: all .4s; }
.final.done { color: var(--cap); }
.final.done .ans { background: var(--cap); color: var(--on-accent); }
.b-orch { display: grid; place-items: center; text-align: center; background: var(--surface-2); }
.brain { width: 54px; height: 54px; color: var(--cap); margin: 4px auto 6px; }
.b-orch .t { font-family: var(--f-display); font-weight: 600; font-size: 14px; line-height: 1.2; }
.b-orch .st { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); margin-top: 4px; min-height: 1.4em; }
.b-orch.thinking .brain { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); opacity: .75; } }
.mono-box { font-family: var(--f-mono); font-size: 11px; line-height: 1.55; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.mono-box .k { color: var(--ink-3); }
.mono-box .new { color: var(--mem); font-weight: 600; animation: flash 1.2s ease; }
@keyframes flash { 0% { background: var(--mem-soft); } 100% { background: transparent; } }
.b-call .mono-box .fn { color: var(--cap); font-weight: 600; }
.b-ev .ev { display: grid; grid-template-columns: 112px 1fr; gap: 10px; align-items: start; min-height: 86px; }
.b-ev .ev img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.b-ev .ev img.sq { object-fit: contain; }
.b-ev .ev .cap { font-family: var(--f-mono); font-size: 9.5px; color: var(--ink-3); text-align: center; margin-top: 2px; }
.b-ev .ev pre { margin: 0; font-family: var(--f-mono); font-size: 10.5px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; }
.ev-empty { font-size: 12.5px; color: var(--ink-3); font-style: italic; }
.swap { animation: swapIn .45s ease; }
@keyframes swapIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.cap-layer { border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); padding: 10px 12px 12px; }
.cap-layer .lbl { font-family: var(--f-display); font-weight: 600; font-size: 13.5px; text-align: center; margin-bottom: 8px; color: var(--cap); }
.cap-groups { display: grid; grid-template-columns: 5fr 3fr 1.25fr; gap: 8px; }
.cap-group { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 6px 6px 8px; min-width: 0; }
.cap-group .gl { font-size: 11px; font-weight: 600; color: var(--cap); margin: 0 0 4px 4px; }
.cap-items { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
.cap {
  text-align: center; font-size: 10.5px; color: var(--ink-2); padding: 6px 2px 5px; border-radius: 8px;
  transition: background .3s, color .3s, transform .3s; line-height: 1.2; min-width: 0;
}
.cap svg { width: 20px; height: 20px; display: block; margin: 0 auto 4px; color: var(--ink-3); transition: color .3s; }
.cap.on { background: var(--cap); color: var(--on-accent); transform: translateY(-2px); }
.cap.on svg { color: var(--on-accent); }
.backends { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }
.be { font-size: 11px; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3); transition: all .3s; }
.be.on { border-color: var(--cap); color: var(--cap); background: var(--cap-soft); font-weight: 600; }

/* connectors */
.flow {
  height: 18px; position: relative; display: grid; grid-template-columns: 1fr 1.25fr; gap: 12px; justify-items: center;
}
.flow .pipe-v { width: 2px; height: 100%; background: var(--line-2); position: relative; overflow: hidden; border-radius: 2px; }
.flow .pipe-v::after {
  content: ""; position: absolute; left: 0; right: 0; height: 8px; border-radius: 2px; opacity: 0;
}
.flow .pipe-v.down::after { background: var(--cap); top: -8px; }
.flow .pipe-v.up::after { background: var(--ev); bottom: -8px; }
.flow .pipe-v.go.down::after { opacity: 1; animation: runDown .7s linear infinite; }
.flow .pipe-v.go.up::after { opacity: 1; animation: runUp .7s linear infinite; }
@keyframes runDown { to { top: 100%; } }
@keyframes runUp { to { bottom: 100%; } }

.mem { border: 1px solid color-mix(in srgb, var(--mem) 35%, var(--line)); background: var(--mem-soft); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; transition: box-shadow .35s; min-width: 0; }
.mem.lit-v { box-shadow: 0 0 0 3px var(--mem-soft); border-color: var(--mem); }
.mem > h5 { font-family: var(--f-display); font-weight: 600; font-size: 14px; color: var(--mem); margin: 0; display: flex; align-items: center; gap: 7px; }
.mem-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.mem-sec .h { font-size: 11.5px; font-weight: 600; color: var(--mem); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.mem-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; min-height: 58px; }
.mem-imgs figure { margin: 0; animation: memIn .5s cubic-bezier(.2,.8,.2,1); }
.mem-imgs img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); background: #fff; }
.mem-imgs img.sq { object-fit: contain; }
.mem-imgs figcaption { font-family: var(--f-mono); font-size: 8.5px; color: var(--ink-3); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.mem-data { font-family: var(--f-mono); font-size: 10.5px; line-height: 1.6; color: var(--ink-2); min-height: 40px; }
.mem-data div { animation: memIn .5s cubic-bezier(.2,.8,.2,1); border-radius: 4px; padding: 0 3px; transition: background .3s, color .3s; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mem-data div.fetch { background: var(--cap); color: var(--on-accent); }
.mem-data .ty { color: var(--ink-3); }
.mem-data div.fetch .ty { color: rgba(255,255,255,.8); }
.mem-web { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); }
@keyframes memIn { from { opacity: 0; transform: translateX(-14px) scale(.96); } to { opacity: 1; transform: none; } }
.mem-io { display: flex; justify-content: space-around; font-family: var(--f-mono); font-size: 10px; color: var(--ink-3); }
.mem-io span { display: flex; align-items: center; gap: 4px; transition: color .3s; }
.mem-io span.on { color: var(--mem); font-weight: 600; }

.mf-controls { display: flex; align-items: center; gap: 14px; margin-top: 16px; flex-wrap: wrap; }
.ctl {
  width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.ctl:hover { border-color: var(--ink-3); }
.ctl svg { width: 16px; height: 16px; }
.ctl.play-btn { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.steps { display: flex; gap: 6px; flex: 1; min-width: 220px; }
.steps button {
  flex: 1; height: 30px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer;
  font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); position: relative; overflow: hidden; padding: 0 4px;
  white-space: nowrap; text-overflow: ellipsis;
}
.steps button .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--cap); width: 0; }
.steps button.done { color: var(--ink-2); }
.steps button.done .bar { width: 100%; }
.steps button.cur { border-color: var(--cap); color: var(--cap); font-weight: 600; }
.steps button.cur .bar { animation: fill var(--step-ms, 3800ms) linear forwards; }
.steps button.cur.paused .bar { animation-play-state: paused; }
@keyframes fill { from { width: 0; } to { width: 100%; } }
.mf-caption { margin-top: 14px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); border-left: 3px solid var(--cap); min-height: 76px; }
.mf-caption .s { font-family: var(--f-mono); font-size: 11.5px; color: var(--cap); letter-spacing: .04em; }
.mf-caption .t { font-family: var(--f-display); font-weight: 600; font-size: 17px; margin: 2px 0 4px; }
.mf-caption .d { font-size: 14.5px; color: var(--ink-2); margin: 0; }

.pillars { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 26px; }
.pillar { padding: 20px; }
.pillar .pi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 12px; }
.pillar .pi svg { width: 20px; height: 20px; }
.pillar.t .pi { background: var(--cap-soft); color: var(--cap); }
.pillar.a .pi { background: var(--ev-soft); color: var(--ev); }
.pillar.v .pi { background: var(--mem-soft); color: var(--mem); }
.pillar h3 { font-size: 18px; margin-bottom: 8px; }
.pillar p { font-size: 14.5px; color: var(--ink-2); margin: 0; }
.pillar code { font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.cap-table { margin-top: 18px; overflow-x: auto; }
.cap-table > summary {
  cursor: pointer; list-style: none; padding: 14px 18px; font-weight: 600; font-size: 15px; color: var(--ink);
  display: flex; align-items: center; gap: 10px;
}
.cap-table > summary::-webkit-details-marker { display: none; }
.cap-table > summary::before {
  content: "+"; font-family: var(--f-mono); width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line-2);
  display: grid; place-items: center; color: var(--cap); flex: none;
}
.cap-table[open] > summary::before { content: "−"; }
.cap-table[open] > summary { border-bottom: 1px solid var(--line); }
.cap-table table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.cap-table th { text-align: left; font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); font-weight: 500; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.cap-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
.cap-table td:first-child { color: var(--ink); font-weight: 600; white-space: nowrap; }
.cap-table td .grp { font-family: var(--f-mono); font-size: 10.5px; color: var(--cap); display: block; font-weight: 500; }
.cap-table tr:last-child td { border-bottom: 0; }
.cap-table b { color: var(--ink); font-weight: 600; }

/* ---------- insights ---------- */
.insight { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.25fr); gap: 40px; align-items: center; padding: 34px 0; border-top: 1px solid var(--line); }
.insight:first-of-type { border-top: 0; padding-top: 0; }
.insight.flip { grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr); }
.insight.flip .ins-text { order: 2; }
.ins-num { font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); letter-spacing: .06em; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; }
.ins-num::after { content: ""; height: 1px; width: 40px; background: var(--line-2); }
.ins-text h3 { font-size: clamp(22px, 2.4vw, 28px); font-weight: 700; letter-spacing: -0.025em; margin-bottom: 12px; }
.ins-text p { color: var(--ink-2); font-size: 16px; }
.ins-text p strong { color: var(--ink); }
.ins-stat { display: flex; gap: 22px; margin-top: 16px; flex-wrap: wrap; }
.ins-stat div { min-width: 0; }
.ins-stat .n { font-family: var(--f-display); font-weight: 700; font-size: 28px; color: var(--cap); letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.ins-stat .l { font-size: 12.5px; color: var(--ink-3); margin-top: 5px; max-width: 160px; line-height: 1.35; }
.ins-fig { padding: 18px 20px 14px; min-width: 0; }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button {
  font: inherit; font-size: 12.5px; font-weight: 500; padding: 5px 11px; border-radius: 7px; border: 0; background: transparent;
  color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); font-weight: 600; }
.fig-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }

/* ---------- examples gallery ---------- */
.seg button .n { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); margin-left: 3px; }
.exg-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.exg-select select {
  font: inherit; font-size: 13.5px; font-weight: 500; color: var(--ink); background: var(--surface); cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 10px; padding: 7px 34px 7px 12px; appearance: none; -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
.exg-tags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.exg-tags-l { font-family: var(--f-mono); font-size: 11.5px; color: var(--ink-3); letter-spacing: .05em; text-transform: uppercase; margin-right: 4px; }
.tagchip {
  font: inherit; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; transition: all .15s;
}
.tagchip svg { width: 14px; height: 14px; color: var(--ink-3); }
.tagchip:hover { border-color: var(--ink-3); }
.tagchip[aria-pressed="true"] { background: var(--cap); border-color: var(--cap); color: var(--on-accent); }
.tagchip[aria-pressed="true"] svg { color: var(--on-accent); }
.tagclear { font: inherit; font-size: 12.5px; border: 0; background: none; color: var(--cap); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.exg-count { font-size: 13px; color: var(--ink-3); margin-bottom: 12px; }
.exg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.exg-empty { color: var(--ink-3); grid-column: 1 / -1; padding: 30px 0; text-align: center; }
.exg-card {
  font: inherit; text-align: left; padding: 0; cursor: pointer; overflow: hidden; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--ink);
  transition: transform .2s ease, border-color .2s, box-shadow .2s; animation: cardIn .45s ease both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.exg-card:hover, .exg-card:focus-visible { transform: translateY(-3px); border-color: var(--cap); box-shadow: 0 0 0 3px var(--cap-soft), var(--shadow); outline: none; }
.exg-card .thumb { position: relative; aspect-ratio: 4 / 3; background: var(--surface-2); overflow: hidden; }
.exg-card .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: opacity .35s ease, transform .5s ease; }
.exg-card .thumb img.alt { opacity: 0; }
.exg-card:hover .thumb img.alt, .exg-card:focus-visible .thumb img.alt { opacity: 1; }
.exg-card:hover .thumb img { transform: scale(1.03); }
.badge-n, .badge-k {
  position: absolute; top: 10px; font-family: var(--f-mono); font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 5px;
  background: rgba(15, 20, 22, .72); color: #fff; backdrop-filter: blur(4px);
}
.badge-n { left: 10px; }
.badge-k { right: 10px; }
.exg-card .body { padding: 12px 14px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.exg-card .meta { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); }
.exg-card .q { font-size: 14px; font-weight: 600; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.exg-card .foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 4px; }
.exg-card .tools { display: flex; gap: 3px; flex-wrap: wrap; }
.exg-card .tools span { width: 24px; height: 24px; border-radius: 6px; background: var(--cap-soft); display: grid; place-items: center; }
.exg-card .tools svg { width: 14px; height: 14px; color: var(--cap); }
.exg-card .calls { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); white-space: nowrap; }

/* example viewer (modal) */
html.modal-open { overflow: hidden; }
.exv { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; }
.exv[hidden] { display: none; }
.exv-backdrop { position: absolute; inset: 0; background: rgba(12, 16, 19, .55); backdrop-filter: blur(3px); opacity: 0; transition: opacity .2s; }
.exv-dialog {
  position: relative; width: min(1120px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--bg); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45);
  opacity: 0; transform: translateY(14px) scale(.985); transition: opacity .2s, transform .25s cubic-bezier(.2,.8,.2,1);
}
.exv.show .exv-backdrop { opacity: 1; }
.exv.show .exv-dialog { opacity: 1; transform: none; }
.exv-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px 12px 20px; border-bottom: 1px solid var(--line); }
.exv-meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-family: var(--f-mono); font-size: 12px; color: var(--ink-3); }
.exv-meta span:not(.pill)::before { content: "·"; margin-right: 8px; color: var(--line-2); }
.exv-meta .pill { background: var(--cap-soft); color: var(--cap); padding: 2px 9px; border-radius: 999px; font-weight: 600; }
.exv-nav { display: flex; gap: 6px; }
.exv-nav .ctl { width: 34px; height: 34px; }
.exv-body { overflow-y: auto; padding: 22px 26px 30px; overscroll-behavior: contain; }
.exv-q { font-family: var(--f-display); font-size: 21px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.35; margin-bottom: 16px; white-space: pre-line; }
.exv-inputs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.exv-inputs figure, .st-imgs figure { margin: 0; }
.exv-inputs img { height: 190px; width: auto; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; }
.exv-inputs.many img { height: 110px; }
.exv-inputs figcaption, .st-imgs figcaption { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }
.exv-ov { margin: 0 0 18px; padding: 14px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 10px; }
.ov-row { display: grid; grid-template-columns: 170px 1fr; gap: 14px; }
.ov-row dt { font-size: 12.5px; font-weight: 700; color: var(--cap); text-transform: uppercase; letter-spacing: .04em; font-family: var(--f-mono); padding-top: 2px; }
.ov-row dd { margin: 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.55; }
.exv-ans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; margin-bottom: 26px; }
.ans { padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.ans .al { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.ans .av { font-size: 14.5px; color: var(--ink); font-weight: 500; overflow-wrap: anywhere; white-space: pre-line; max-height: 140px; overflow-y: auto; }
.ans.notool .av { color: var(--ink-2); }
.ans.ours { border-color: color-mix(in srgb, var(--cap) 45%, transparent); background: var(--cap-soft); }
.ans.ours .al { color: var(--cap); }
.ans .ok { color: var(--on-accent); background: var(--cap); border-radius: 50%; width: 16px; height: 16px; display: inline-grid; place-items: center; font-size: 10px; }
.ans .ok.part { background: var(--ev); }
.exv-sub { font-family: var(--f-mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 12px; }
.steps-tl { list-style: none; margin: 0; padding: 0; }
.st { display: grid; grid-template-columns: 34px 1fr; gap: 12px; }
.st-rail { position: relative; display: flex; justify-content: center; }
.st-rail::after { content: ""; position: absolute; top: 30px; bottom: -4px; width: 2px; background: var(--line); }
.st:last-child .st-rail::after { display: none; }
.st-n { width: 28px; height: 28px; border-radius: 50%; background: var(--surface); border: 2px solid var(--cap); color: var(--cap); display: grid; place-items: center; font-family: var(--f-mono); font-size: 12px; font-weight: 700; position: relative; z-index: 1; }
.st-main { padding-bottom: 22px; min-width: 0; }
.st-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 28px; }
.st-h svg { width: 17px; height: 17px; color: var(--cap); }
.st-h .nm { font-weight: 700; font-size: 15px; }
.st-h code { font-size: 11px; color: var(--ink-3); background: var(--surface-2); padding: 1px 6px; border-radius: 4px; }
.st-say { margin: 6px 0 8px; font-size: 14px; color: var(--ink-2); font-style: italic; border-left: 2px solid var(--line-2); padding-left: 10px; white-space: pre-line; }
.st-args, .st-out, .st-code pre {
  margin: 6px 0 0; font-family: var(--f-mono); font-size: 11.5px; line-height: 1.55; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; white-space: pre-wrap; overflow-wrap: anywhere;
}
.st-args { background: var(--surface-2); }
.st-args .k { color: var(--cap); }
.st-out { max-height: 340px; overflow-y: auto; }
.st-imgs { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.st-imgs img { height: 170px; width: auto; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; }
.st-more, .st-code { margin-top: 6px; }
.st-more summary, .st-code summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--cap); }
.st-code pre { max-height: 420px; overflow: auto; white-space: pre; overflow-wrap: normal; }
.st-ol { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-top: 8px; text-transform: uppercase; letter-spacing: .04em; }
.exv-final { display: inline-flex; gap: 8px; align-items: center; padding: 9px 14px; border-radius: 10px; background: var(--cap); color: var(--on-accent); font-size: 14.5px; margin-left: 46px; max-width: calc(100% - 46px); }
.exv-final svg { width: 16px; height: 16px; flex: none; }
.exv-final b { overflow-wrap: anywhere; }
.lightbox { position: fixed; inset: 0; z-index: 120; background: rgba(8, 10, 12, .88); display: grid; place-items: center; padding: 30px; cursor: zoom-out; }
.lightbox[hidden] { display: none; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 90px); border-radius: 8px; background: #fff; }
.lightbox .lb-cap { position: absolute; bottom: 18px; left: 0; right: 0; text-align: center; color: #ddd; font-family: var(--f-mono); font-size: 12px; }

/* ---------- full table ---------- */
.tbl-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tbl-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
table.res { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; font-variant-numeric: tabular-nums; }
table.res th, table.res td { padding: 7px 9px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.res thead th { background: var(--surface-2); font-weight: 600; color: var(--ink-2); font-size: 12px; position: sticky; top: 0; }
table.res thead tr.grp th { font-family: var(--f-display); font-size: 13px; color: var(--ink); text-align: center; border-left: 1px solid var(--line); }
table.res thead tr.sub th { font-family: var(--f-mono); font-size: 11px; font-weight: 500; }
table.res thead tr.sub th.ours { color: var(--cap); font-weight: 700; }
table.res th.first, table.res td.first { text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; font-weight: 500; color: var(--ink); border-right: 1px solid var(--line); }
table.res thead th.first { background: var(--surface-2); z-index: 2; }
table.res td.gstart, table.res th.gstart { border-left: 1px solid var(--line); }
table.res td { color: var(--ink-2); }
table.res td.ours { background: var(--cap-soft); color: var(--ink); }
table.res td.best { font-weight: 700; color: var(--ink); }
table.res td.gbest { text-decoration: underline; text-decoration-color: var(--cap); text-underline-offset: 3px; text-decoration-thickness: 2px; }
table.res tr.dom td { background: var(--surface-2); font-family: var(--f-mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); text-align: left; padding-top: 9px; }
table.res tr.dom td.first { background: var(--surface-2); }
table.res tr.avg td { font-weight: 700; color: var(--ink); border-top: 2px solid var(--line-2); border-bottom: 0; }
table.res tr:hover td:not(.ours) { background: color-mix(in srgb, var(--surface-2) 70%, var(--surface)); }
table.res tr.dom:hover td { background: var(--surface-2); }
.tbl-cap { font-size: 13px; color: var(--ink-3); margin-top: 12px; line-height: 1.55; }
.tbl-cap b { color: var(--ink-2); }

/* ---------- cite ---------- */
.bib { position: relative; padding: 0; overflow: hidden; }
.bib pre { margin: 0; padding: 22px 24px; font-family: var(--f-mono); font-size: 13px; line-height: 1.65; overflow-x: auto; color: var(--ink-2); }
.copy-btn {
  position: absolute; top: 12px; right: 12px; font: inherit; font-size: 12.5px; font-weight: 600; padding: 6px 12px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); cursor: pointer; display: flex; gap: 6px; align-items: center;
}
.copy-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.copy-btn svg { width: 14px; height: 14px; }

footer { padding: 70px 0 50px; color: var(--ink-3); font-size: 13.5px; text-align: center; }
footer a { color: var(--ink-2); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1040px) {
  .mf-grid { grid-template-columns: 1fr; }
  .mem { display: grid; grid-template-columns: 1fr 1fr; }
  .mem > h5, .mem-io { grid-column: 1 / -1; }
  .mem-imgs { grid-template-columns: repeat(5, 1fr); }
}
@media (max-width: 900px) {
  .nav-links { display: none; }
  .theme-switch { margin-left: auto; }
  .hero-charts, .insight { grid-template-columns: 1fr; }
  .insight.flip { grid-template-columns: 1fr; }
  .insight.flip .ins-text { order: 0; }
  .pillars { grid-template-columns: 1fr; }
  .pg-body { grid-template-columns: 1fr; }
  .pg-left { border-right: 0; border-bottom: 1px solid var(--line); }
  .mf-row.top { grid-template-columns: 1fr 1fr; }
  .mf-row.top .b-env { grid-column: 1 / -1; }
  .mf-row.mid { grid-template-columns: 1fr; }
  .cap-groups { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  :root { --gutter: 16px; }
  .exv { padding: 0; }
  .exv-dialog { max-height: 100vh; height: 100%; border-radius: 0; }
  .exv-body { padding: 18px 16px 26px; }
  .ov-row { grid-template-columns: 1fr; gap: 2px; }
  .exv-inputs img { height: 130px; }
  .st-imgs img { height: 130px; }
  .exv-final { margin-left: 0; max-width: 100%; }
  .exg-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .exg-card .q { font-size: 13px; }
  body { font-size: 16px; }
  .hero { padding-top: 40px; }
  section.block { padding-top: 64px; }
  .mem { grid-template-columns: 1fr; }
  .mem-imgs { grid-template-columns: repeat(4, 1fr); }
  .mf-row.top { grid-template-columns: 1fr 1fr; }
  .mf-row.top .b-user { grid-column: 1 / -1; }
  .mf-row.top .b-env { grid-column: auto; }
  .brain { width: 38px; height: 38px; }
  .eyebrow { font-size: 11px; }
  .b-ev .ev { grid-template-columns: 90px 1fr; }
  .steps button { font-size: 0; }
  .steps button::before { content: attr(data-n); font-size: 11px; }
  .cap-items { grid-auto-flow: row; grid-template-columns: repeat(3, 1fr); }
  .btn { padding: 9px 14px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* chart subtitles and per-point effort labels */
.chart-title .chart-sub { display: block; font-family: var(--f-body); font-weight: 400; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.eff-label { font-family: var(--f-body); font-size: 10.5px; font-weight: 500; }

/* ==========================================================================
   Trajectory player (method figure driven by examples.js)
   ========================================================================== */
.tp-pick { display: grid; gap: 10px; margin-bottom: 14px; }
.tp-dom button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); font-weight: 600; }
.tp-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.tp-chip { flex: none; scroll-snap-align: start; display: flex; align-items: center; gap: 8px; padding: 5px 10px 5px 5px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; font: inherit; text-align: left; transition: border-color .2s, box-shadow .2s; }
.tp-chip img { width: 44px; height: 34px; object-fit: cover; border-radius: 6px; display: block; }
.tp-chip .tc-t { display: grid; gap: 2px; }
.tp-chip .tc-t b { font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.tp-chip .tc-t span { display: flex; gap: 3px; }
.tp-chip .tc-t svg { width: 12px; height: 12px; color: var(--ink-3); }
.tp-chip:hover { border-color: var(--line-2); }
.tp-chip.on { border-color: var(--cap); box-shadow: 0 0 0 2px var(--cap-soft); }
.tp-chip.on .tc-t svg { color: var(--cap); }
.tp-chip:focus-visible { outline: 2px solid var(--cap); outline-offset: 2px; }

.tp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12.5px; color: var(--ink-3); margin-bottom: 12px; font-family: var(--f-mono); }
.tp-head .pill { background: var(--cap-soft); color: var(--cap); padding: 2px 9px; border-radius: 999px; font-weight: 600; font-family: var(--f-body); }
.tp-head .caps { display: inline-flex; gap: 5px; }
.tp-head .caps svg { width: 14px; height: 14px; color: var(--cap); }
.tp-full { margin-left: auto; font: 600 12.5px var(--f-body); color: var(--cap); background: none; border: 1px solid var(--line-2); border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.tp-full:hover { border-color: var(--cap); }

#methodFig .mf-row.top { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr); }
#methodFig .mf-row.mid { grid-template-columns: minmax(0, .78fr) minmax(0, 1.62fr); }
#methodFig .box h5 { position: relative; padding-right: 26px; }
.xp { position: absolute; right: -4px; top: -4px; width: 24px; height: 24px; border-radius: 6px; border: 1px solid transparent; background: none; color: var(--ink-3); cursor: pointer; display: grid; place-items: center; padding: 0; }
.xp svg { width: 13px; height: 13px; }
.xp:hover, .xp:focus-visible { border-color: var(--line-2); color: var(--ink); background: var(--surface-2); outline: none; }
.mem > h5 { position: relative; padding-right: 26px; }

/* user input */
.b-user .q { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.thumbs.n1 { grid-template-columns: minmax(0, 1fr); }
.thumbs.n1 img { aspect-ratio: 16 / 10; }
.thumbs.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.thumbs.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.thumbs .im, .x-imgs .im { position: relative; }
.thumbs img { cursor: zoom-in; display: block; }
.thumbs .more { align-self: center; font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); }
.mk { position: absolute; width: 0; height: 0; pointer-events: none; }
.mk::before { content: ""; position: absolute; left: -9px; top: -9px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; box-shadow: 0 0 0 2px rgba(255,255,255,.75); animation: mkPulse 1.8s ease-in-out infinite; }
.mk.red { color: #e5322d; } .mk.blue { color: #2f6bff; }
.mk em { position: absolute; left: 13px; top: -22px; font: 600 11px/1 var(--f-mono); font-style: normal; white-space: nowrap; color: #fff; padding: 4px 6px; border-radius: 4px; }
.mk.red em { background: #c92a26; } .mk.blue em { background: #2458d6; }
.mk-legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-2); margin: -2px 0 7px; }
.mk-legend:empty { display: none; }
.mk-legend span { display: inline-flex; align-items: center; gap: 5px; }
.mk-legend i { width: 9px; height: 9px; border-radius: 50%; }
.mk-legend .red i { background: #e5322d; } .mk-legend .blue i { background: #2f6bff; }
@keyframes mkPulse { 50% { transform: scale(1.25); opacity: .7; } }
.final .gt { margin-left: 8px; font-size: 11.5px; color: var(--ink-3); font-weight: 400; }
.final .gt b { font-family: var(--f-mono); color: var(--ink-2); font-weight: 500; }
.final .okm { color: var(--cap); font-weight: 700; }

/* orchestrator */
#methodFig .b-orch { display: flex; flex-direction: column; text-align: left; place-items: stretch; min-height: 168px; }
#methodFig .b-orch h5 { gap: 6px; flex-wrap: wrap; }
#methodFig .b-orch .brain { width: 16px; height: 16px; margin: 0; color: var(--cap); }
#methodFig .b-orch.thinking .brain { animation: pulse 1.1s ease-in-out infinite; }
#methodFig .b-orch .st { font: inherit; color: var(--ink-3); margin: 0; min-height: 0; }

.thought { font-size: 12.5px; line-height: 1.5; color: var(--ink-2); max-height: 7.6em; overflow: hidden; position: relative; flex: 1; }
.caret { display: inline-block; width: 6px; height: 1.05em; margin-left: 1px; vertical-align: -2px; background: var(--cap); animation: blink .9s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* tool call */
#mfCallTxt { max-height: 150px; overflow: hidden; }

/* evidence */
#mfEvBody { min-height: 150px; }
.ev2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 12px; align-items: start; animation: swapIn .35s ease; }
.ev2.txt-only { grid-template-columns: 1fr; }
.ev2 .ev-txt { min-width: 0; display: grid; gap: 5px; align-content: start; }
.ev2 .hd { font-family: var(--f-mono); font-size: 10.5px; color: var(--mem); font-weight: 600; }
.ev2 .count { font-size: 12px; color: var(--ink-2); display: flex; flex-wrap: wrap; gap: 4px; }
.ev2 .count b { color: var(--ink); font-family: var(--f-mono); font-weight: 600; }
.ev2 .url { font-family: var(--f-mono); font-size: 10.5px; color: var(--mem); background: var(--mem-soft); padding: 0 5px; border-radius: 4px; }
.ev2 pre { margin: 0; font-family: var(--f-mono); font-size: 10.5px; line-height: 1.5; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; max-height: 128px; overflow: hidden; }
.stage { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 210px; border-radius: 8px; overflow: hidden; background: #0b0d10; border: 1px solid var(--line); }
.stage > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.stage .bx { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity .4s; }
.stage .bx rect { fill: rgba(124, 159, 240, .14); stroke: #7c9ff0; stroke-width: 3; vector-effect: non-scaling-stroke; opacity: 0; transform-box: fill-box; transform-origin: center; }
.stage.drawn .bx rect { animation: boxIn .35s cubic-bezier(.2,.8,.2,1) forwards; }
.stage .after { opacity: 0; transition: opacity .45s ease; }
.stage.done .after { opacity: 1; }
.stage.done .bx { opacity: 0; }
@keyframes boxIn { from { opacity: 0; transform: scale(1.35); } to { opacity: 1; transform: none; } }
/* depth: wipe from RGB to the colorized map */
.stage .after.wipe { opacity: 1; clip-path: inset(0 100% 0 0); transition: clip-path .95s cubic-bezier(.6,0,.3,1); }
.stage.go .after.wipe, .stage.done .after.wipe { clip-path: inset(0 0 0 0); }
.stage .scan { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #f28a4c; box-shadow: 0 0 12px 2px rgba(242,138,76,.7); opacity: 0; }
.stage.go .scan { animation: scan .95s cubic-bezier(.6,0,.3,1) forwards; }
@keyframes scan { 0% { left: 0; opacity: 1; } 95% { opacity: 1; } 100% { left: 100%; opacity: 0; } }
/* zoom: draw the crop box, then expand the crop into the frame */
.stage .zr { position: absolute; border: 2px solid #f28a4c; box-shadow: 0 0 0 9999px rgba(0,0,0,.0); opacity: 0; transition: opacity .3s, box-shadow .5s; }
.stage.drawn .zr { opacity: 1; box-shadow: 0 0 0 9999px rgba(0,0,0,.45); }
.stage .after.zoomed { left: var(--x); top: var(--y); width: var(--w); height: var(--h); inset: auto; object-fit: cover; transition: left .55s cubic-bezier(.6,0,.2,1), top .55s cubic-bezier(.6,0,.2,1), width .55s cubic-bezier(.6,0,.2,1), height .55s cubic-bezier(.6,0,.2,1), opacity .2s; background: #0b0d10; }
.stage.done .after.zoomed { left: 0; top: 0; width: 100%; height: 100%; object-fit: contain; }
/* camera trajectory: views converge, then the pose plot */
.stage .cam-in { position: absolute; inset: 0; display: grid; place-items: center; }
.stage .cam-in img { position: absolute; width: 46%; aspect-ratio: 4/3; object-fit: cover; border: 2px solid #fff; border-radius: 4px; transform: translate(calc((var(--k) - 1) * 62%), calc((var(--k) - 1) * -10%)) rotate(calc((var(--k) - 1) * 6deg)); transition: transform .8s cubic-bezier(.6,0,.2,1), opacity .5s .5s; }
.stage.go .cam-in img, .stage.done .cam-in img { transform: translate(0, 0) scale(.6); opacity: 0; }
.stage .after.plot { background: #fff; }
/* search results */
.res-grid { display: grid; gap: 6px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.res-grid.n1 { grid-template-columns: minmax(0, 1fr); }
.res-grid.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.res-grid figure { margin: 0; opacity: 0; animation: cardIn .4s ease forwards; }
.res-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #fff; display: block; }
.res-grid figcaption { font-family: var(--f-mono); font-size: 9px; color: var(--ink-3); text-align: center; margin-top: 2px; }
/* coding agent: editor + terminal */
.ev2.code { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.ed, .term { border-radius: 8px; overflow: hidden; border: 1px solid #23282f; background: #0e1116; min-width: 0; }
.ed-bar { display: flex; justify-content: space-between; gap: 8px; font: 10px/1 var(--f-mono); color: #8a93a2; padding: 6px 9px; border-bottom: 1px solid #1d2229; background: #12161c; }
.ed-src, .term-out { margin: 0; padding: 8px 10px; font: 10.5px/1.5 var(--f-mono); color: #d6dbe3; white-space: pre; overflow: auto; height: 176px; max-height: none; scrollbar-width: none; }
.term-out { white-space: pre-wrap; height: 176px; }
.term.err .st { color: #ff7b72; } .term.ok .st { color: #7ee2a8; }
.term.err .term-out { color: #ffb3ad; }
.ed-src .c { color: #6f7b8c; font-style: italic; }
.ed-src .s, .x-pre.code .s { color: #f2a76a; }
.ed-src .k, .x-pre.code .k { color: #8fb0ff; }
.ed-src .n, .x-pre.code .n { color: #e98bb7; }
.ed-src .b, .x-pre.code .b { color: #0e1116; background: #e0709f; border-radius: 3px; padding: 0 2px; }
.ed-src .caret, .term-out .caret { background: #8fb0ff; }

/* memory */
.mem-sec .h .cnt { margin-left: auto; font-family: var(--f-mono); font-weight: 400; color: var(--ink-3); font-size: 10px; }
.mem-imgs figure { animation: none; }
.mem-imgs figure.new { animation: memIn .5s cubic-bezier(.2,.8,.2,1); }
.mem-imgs img { cursor: zoom-in; }
.mem-data div { animation: none; }
.mem-data div.new { animation: memIn .5s cubic-bezier(.2,.8,.2,1), flash 1.4s ease; }
.mem-web { display: flex; flex-wrap: wrap; gap: 4px; }
.mem-web span { font-family: var(--f-mono); font-size: 10px; color: var(--ink-2); background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.mem-web span.new { animation: flash 1.4s ease; color: var(--mem); }
.mem-web .ev-empty, .mem-web .more { background: none; padding: 0; }
.ev-empty { font-size: 12px; }

/* controls */
.ctl.speed { font: 600 12px var(--f-mono); width: 44px; }
#mfSteps { overflow-x: auto; scrollbar-width: none; }
#mfSteps button { flex: 1 0 auto; min-width: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 6px; }
#mfSteps button svg { width: 13px; height: 13px; }
#mfSteps button .nn { font-size: 10.5px; }
#mfSteps button.cur .bar { animation: none; width: 100%; }
.mf-caption { min-height: 0; }
.mf-caption .d:empty { display: none; }

/* expand dialog */
.tp-x[hidden] { display: none; }
.tp-x { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; }
.tp-x-bd { position: absolute; inset: 0; background: rgba(8, 10, 14, .55); opacity: 0; transition: opacity .18s; }
.tp-x-dlg { position: relative; width: min(1120px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); transform: translateY(10px) scale(.98); opacity: 0; transition: transform .18s, opacity .18s; }
.tp-x.show .tp-x-bd { opacity: 1; }
.tp-x.show .tp-x-dlg { transform: none; opacity: 1; }
.tp-x-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.tp-x-top h3 { margin: 0; font-family: var(--f-display); font-size: 17px; }
.tp-x-top .ctl { width: 34px; height: 34px; }
.tp-x-top .ctl svg { width: 15px; height: 15px; }
.tp-x-body { padding: 16px 18px 22px; overflow: auto; display: grid; gap: 12px; }
.xq { margin: 0; font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.x-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.x-imgs.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.x-imgs figure { margin: 0; }
.x-imgs img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; cursor: zoom-in; background: #fff; }
.x-imgs.grid img { aspect-ratio: 4/3; object-fit: cover; }
.x-imgs figcaption { font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); margin-top: 3px; }
.x-imgs figcaption span { color: var(--ink-3); opacity: .8; }
.x-lbl { font-family: var(--f-mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.x-pre { margin: 0; font: 12px/1.55 var(--f-mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); max-height: 420px; overflow: auto; }
.x-pre.code { background: #0e1116; color: #d6dbe3; border-color: #23282f; white-space: pre; }
.x-pre.code .c { color: #6f7b8c; }
.x-note { margin: 0; font-size: 14px; color: var(--ink-2); }
.x-ans { display: flex; flex-wrap: wrap; gap: 10px; }
.x-ans div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; display: grid; gap: 2px; min-width: 140px; }
.x-ans span { font-size: 11.5px; color: var(--ink-3); }
.x-ans b { font-family: var(--f-mono); font-size: 14px; }
.x-th { border-left: 2px solid var(--line); padding: 2px 0 2px 12px; }
.x-th.cur { border-color: var(--cap); }
.x-th-h { font-size: 12px; font-weight: 600; color: var(--ink-2); display: flex; gap: 8px; align-items: center; }
.x-th-h span { font-family: var(--f-mono); color: var(--ink-3); font-weight: 400; }
.x-th p { margin: 3px 0 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }

@media (max-width: 900px) {
  #methodFig .mf-row.top { grid-template-columns: 1fr 1fr; }
  #methodFig .mf-row.top .b-env { grid-column: 1 / -1; }
  #methodFig .mf-row.mid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  #methodFig .mf-row.top { grid-template-columns: 1fr; }
  .ev2, .ev2.code { grid-template-columns: 1fr; }
  .tp-full { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mk::before, .caret { animation: none; }
}

.orch-st { display: flex; gap: 8px; align-items: baseline; margin: -3px 0 6px; font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); }
.orch-st .tok { margin-left: auto; }
.thumbs .mk::before { left: -7px; top: -7px; width: 14px; height: 14px; }
.mf-caption { padding: 10px 14px; display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.mf-caption .t { font-size: 15px; margin: 0; }
.orch-st .st { white-space: nowrap; }
.thought { max-height: 12.2em; }
.ed-bar span { white-space: nowrap; }
.b-user .final { flex-wrap: wrap; row-gap: 4px; }
.b-user .final .ans { white-space: nowrap; }

/* title label: typed tool readouts; brackets re-lock on each change */
.det-box .det-label { background: var(--ink); color: var(--bg); font-weight: 400; min-height: 1.5em; }
.det-box .det-label b { color: var(--ev); font-weight: 600; }
:root[data-theme="dark"] .det-box .det-label b { color: #c9520e; }
.det-box i { border-color: var(--cap); }
.det-box.on.relock i { animation: relock .5s cubic-bezier(.2,.8,.2,1); }
@keyframes relock { 0% { transform: scale(1.18); opacity: .4; } 100% { transform: none; opacity: 1; } }
.det-box.relock i:nth-of-type(1) { transform-origin: 0 0; } .det-box.relock i:nth-of-type(2) { transform-origin: 100% 0; }
.det-box.relock i:nth-of-type(3) { transform-origin: 0 100%; } .det-box.relock i:nth-of-type(4) { transform-origin: 100% 100%; }

/* brand mark: viewfinder brackets lock onto a four-band depth tile (inferno), bands fill far→near (once, on load) */
.brand-mark { color: var(--cap); }
.brand-mark .bm-br { transform-origin: 16px 16px; animation: bmLock .7s cubic-bezier(.2,.8,.2,1) .15s both; }
.brand-mark .bm-b { animation: bmB .35s ease both; }
.brand-mark .bm-b:nth-of-type(1) { animation-delay: .6s; } .brand-mark .bm-b:nth-of-type(2) { animation-delay: .72s; }
.brand-mark .bm-b:nth-of-type(3) { animation-delay: .84s; } .brand-mark .bm-b:nth-of-type(4) { animation-delay: .96s; }
@keyframes bmLock { from { transform: scale(1.18); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bmB { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .brand-mark * { animation: none !important; } }

/* models & services row below the capability layer */
.flow.svc .pipe-v { background: var(--line-2); }
.flow.svc .pipe-v.down::after, .flow.svc .pipe-v.up::after { background: var(--ink-3); }
.svc-layer { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 8px 12px 10px; }
.svc-layer .lbl { font-family: var(--f-display); font-weight: 600; font-size: 13px; text-align: center; margin-bottom: 6px; color: var(--ink-2); }
.svc-items { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.svc-items .be { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; padding: 5px 10px; color: var(--ink-2); background: var(--surface-2); }
.svc-items .be svg { width: 15px; height: 15px; color: var(--ink-3); transition: color .3s; }
.svc-items .be.on svg { color: var(--cap); }
.svc-items { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; }
.svc-items .be { justify-content: center; font-size: 11.5px; padding: 6px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1100px) { .svc-items { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 520px) { .svc-items { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.svc-items .be { white-space: normal; overflow: visible; line-height: 1.2; text-align: left; padding: 5px 6px; min-height: 36px; }
.svc-items .be svg { flex: none; }

/* playback: steps row, then controls row; speed selector; CSS animations follow --spd */
.mf-steps { display: flex; gap: 6px; margin-top: 16px; }
.mf-controls { margin-top: 10px; gap: 10px; }
.speed-ctl { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.speed-l { font: 11.5px var(--f-mono); color: var(--ink-3); letter-spacing: .04em; text-transform: uppercase; }
.speed-seg button { font-family: var(--f-mono); font-size: 12px; padding: 5px 9px; }
.speed-seg button[aria-checked="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 0 0 1px var(--line); font-weight: 600; }
.speed-seg button:focus-visible { outline: 2px solid var(--cap); outline-offset: 1px; }
#methodFig .stage .after { transition-duration: calc(.45s / var(--spd, 1)); }
#methodFig .stage .after.wipe { transition-duration: calc(.95s / var(--spd, 1)); }
#methodFig .stage.go .scan { animation-duration: calc(.95s / var(--spd, 1)); }
#methodFig .stage.drawn .bx rect { animation-duration: calc(.35s / var(--spd, 1)); }
#methodFig .stage .after.zoomed { transition-duration: calc(.55s / var(--spd, 1)); }
#methodFig .stage .cam-in img { transition-duration: calc(.8s / var(--spd, 1)), calc(.5s / var(--spd, 1)); transition-delay: 0s, calc(.5s / var(--spd, 1)); }
#methodFig .stage .zr { transition-duration: calc(.3s / var(--spd, 1)), calc(.5s / var(--spd, 1)); }
@media (max-width: 640px) { .speed-ctl { margin-left: 0; } }

/* ---------- playback toolbar (steps → caption → controls) ---------- */
#methodFig .mf-caption { margin-top: 10px; }
#methodFig .mf-controls {
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line);
}
#methodFig .pb { width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); transition: border-color .15s, color .15s, background .15s, transform .1s; }
#methodFig .pb svg { width: 18px; height: 18px; }
#methodFig .pb:hover { border-color: var(--cap); color: var(--cap); background: var(--cap-soft); }
#methodFig .pb:active { transform: scale(.95); }
#methodFig .pb.play-btn { width: 54px; height: 54px; border-radius: 50%; background: var(--cap); border-color: var(--cap); color: var(--on-accent); box-shadow: 0 6px 18px -6px var(--cap), 0 0 0 4px var(--cap-soft); }
#methodFig .pb.play-btn:hover { filter: brightness(1.08); color: var(--on-accent); }
#methodFig .pb.play-btn svg { width: 20px; height: 20px; }
#methodFig .pb:focus-visible, .speed-btn:focus-visible, .speed-menu li:focus-visible, #mfSteps button:focus-visible { outline: 2.5px solid var(--cap); outline-offset: 2px; }
.speed-dd { position: relative; margin-left: 6px; }
.speed-btn { height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px 0 14px; border-radius: 999px; border: 1.5px solid var(--cap); background: var(--surface); color: var(--cap); cursor: pointer; font: inherit; transition: background .15s; }
.speed-btn:hover, .speed-btn[aria-expanded="true"] { background: var(--cap-soft); }
.speed-btn .sl { font: 500 11px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.speed-btn b { font: 700 14px var(--f-mono); min-width: 3.4ch; text-align: left; }
.speed-btn svg { width: 15px; height: 15px; transition: transform .15s; }
.speed-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.speed-menu { position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%); z-index: 20; list-style: none; margin: 0; padding: 6px; min-width: 132px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 16px 40px -12px rgba(0,0,0,.35); outline: none; }
.speed-menu[hidden] { display: none; }
.speed-menu li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; font: 500 13.5px var(--f-mono); color: var(--ink-2); cursor: pointer; }
.speed-menu li span { font: 400 11px var(--f-body); color: var(--ink-3); }
.speed-menu li:hover { background: var(--surface-2); color: var(--ink); }
.speed-menu li[aria-selected="true"] { background: var(--cap-soft); color: var(--cap); font-weight: 700; }
.speed-menu li[aria-selected="true"]::after { content: "✓"; font-family: var(--f-body); }
/* steps: clearer current / done states */
#mfSteps button { height: 34px; border: 1.5px solid var(--line); color: var(--ink-3); transition: border-color .15s, background .15s, color .15s; }
#mfSteps button:hover { border-color: var(--cap); color: var(--cap); }
#mfSteps button.done { color: var(--ink-2); border-color: var(--line-2); }
#mfSteps button.done .bar { background: var(--cap); opacity: .55; }
#mfSteps button.cur { background: var(--cap); border-color: var(--cap); color: var(--on-accent); font-weight: 600; box-shadow: 0 4px 12px -6px var(--cap); }
#mfSteps button.cur .bar { opacity: 0; }
@media (max-width: 640px) { .speed-dd { margin-left: 0; } .speed-menu { left: auto; right: 0; transform: none; } }

/* wider layout: let evidence images and the figure use the extra width */
.stage { max-height: 280px; }
.ed-src, .term-out { height: 220px; }
.ev2 pre { max-height: 170px; }
#mfCallTxt { max-height: 190px; }
.thought { max-height: 14em; }
.sec-head { max-width: 900px; }

/* gallery card currently playing in the method figure */
.exg-card.playing { border-color: var(--cap); box-shadow: 0 0 0 3px var(--cap-soft); }
.exg-card.playing .thumb::after { content: "Playing in figure ↑"; position: absolute; right: 8px; bottom: 8px; font: 600 11px var(--f-body); color: var(--on-accent); background: var(--cap); padding: 3px 8px; border-radius: 999px; }

/* prominent task-domain selectors (player + gallery) */
.tp-dom-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.dom-l { font: 500 11.5px var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.tp-dom, #exgDomain { background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 12px; padding: 4px; gap: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.tp-dom button, #exgDomain button { font-size: 14px; font-weight: 500; padding: 8px 16px; border-radius: 9px; color: var(--ink-2); transition: background .15s, color .15s; }
.tp-dom button:hover, #exgDomain button:hover { background: var(--cap-soft); color: var(--cap); }
.tp-dom button[aria-pressed="true"], #exgDomain button.on { background: var(--cap); color: var(--on-accent); font-weight: 600; box-shadow: 0 4px 12px -6px var(--cap); }
#exgDomain button.on .n { color: var(--on-accent); opacity: .8; }
.tp-dom button:focus-visible, #exgDomain button:focus-visible { outline: 2.5px solid var(--cap); outline-offset: 2px; }
/* steadier figure height across examples, so playback does not shift the page */
#methodFig .mem-imgs { min-height: calc(3 * (var(--mi-h, 74px) + 16px)); align-content: start; }
#methodFig .b-user .q { min-height: calc(4 * 1.4em); }
#methodFig .mem-data { min-height: 96px; }

/* compact, fixed-height rows: wider panels, shorter boxes, stable figure height */
#methodFig .mf-grid { grid-template-columns: minmax(0, 2.9fr) minmax(0, 1fr); }
#methodFig .mf-row.top { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.3fr) minmax(0, 1fr); }
#methodFig .mf-row.top > .box { height: 216px; overflow: hidden; display: flex; flex-direction: column; }
#methodFig .b-user .q { min-height: 0; -webkit-line-clamp: 3; margin-bottom: 6px; }
#methodFig .b-user .thumbs img { aspect-ratio: 16 / 10; }
#methodFig .b-user .thumbs.n1 { grid-template-columns: minmax(0, .62fr); }
#methodFig .b-user .final { margin-top: auto; padding-top: 6px; }
#methodFig .b-orch { min-height: 0; }
#methodFig .thought { max-height: none; flex: 1; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 1.6em); mask-image: linear-gradient(to bottom, transparent 0, #000 1.6em); padding-top: .4em; }
#methodFig .b-env .mono-box { flex: 1; overflow: hidden; -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent); mask-image: linear-gradient(to bottom, #000 80%, transparent); }
#methodFig .mf-row.mid > .box { height: 236px; overflow: hidden; }
#methodFig .stage { max-height: 178px; }
#methodFig .ed-src, #methodFig .term-out { height: 150px; }
#methodFig .ev2 pre { max-height: 120px; }
#methodFig .mem-imgs { min-height: 0; }
@media (max-width: 1040px) {
  #methodFig .mf-grid { grid-template-columns: 1fr; }
  #methodFig .mf-row.top > .box, #methodFig .mf-row.mid > .box { height: auto; max-height: 300px; }
}
#methodFig .mf-row.top > .box { height: 226px; }
#methodFig .mf-row.top > .box > * { flex-shrink: 0; }
#methodFig .mf-row.top > .box > .thought, #methodFig .mf-row.top > .box > .mono-box { flex: 1 1 auto; min-height: 0; }
#methodFig .b-user .q { flex: none; }
#methodFig .b-user .thumbs { grid-template-columns: repeat(auto-fill, 84px); gap: 6px; }
#methodFig .b-user .thumbs img { width: 84px; height: 54px; aspect-ratio: auto; object-fit: cover; }
#methodFig .b-user .thumbs.n1 { grid-template-columns: 84px; }
#methodFig .b-user .thumbs img { width: 100%; }
#methodFig .b-user .thumbs.n2 { grid-template-columns: repeat(2, minmax(0, 96px)); }
#methodFig .b-user .thumbs.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
#methodFig .b-user .thumbs.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; }
#methodFig .b-user .thumbs.n4 img { height: 46px; }
#methodFig .mf-row.top > .box { height: 236px; }

/* title banner: tool call → output, typed */
.det-box .det-label { --lb-tool: #f28a4c; --lb-res: #a9c1ff; max-width: min(640px, calc(100vw - 40px)); overflow: hidden; text-overflow: ellipsis; padding: 3px 9px; font-size: 11.5px; transition: opacity .25s; }
:root[data-theme="dark"] .det-box .det-label { --lb-tool: #b34507; --lb-res: #2653c1; }
.det-box .det-label b { color: var(--lb-tool); font-weight: 600; }
.det-box .det-label .ag { opacity: .7; }
.det-box .det-label .ar { opacity: .6; }
.det-box .det-label .rs { color: var(--lb-res); font-weight: 500; }
.det-box .det-label .run { opacity: .55; }
.det-box .det-label .run::after { content: ""; animation: runDots 1s steps(4) infinite; }
@keyframes runDots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.det-box .det-label.out { opacity: 0; }

/* ---------- live demo ---------- */
.dm-status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-bottom: 12px; padding: 5px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.dm-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.dm-status[data-k="ok"] .dot { background: #2f9e5b; box-shadow: 0 0 0 3px rgba(47,158,91,.18); }
.dm-status[data-k="off"] .dot { background: var(--ev); }
.dm-status a { color: var(--cap); }
.dm-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr); gap: 16px; align-items: start; }
.dm-setup { padding: 18px; display: grid; gap: 16px; margin: 0; }
.dm-f { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; min-width: 0; }
.dm-l { font: 600 13px var(--f-body); color: var(--ink); padding: 0; }
.dm-l span, .dm-in em { font-weight: 400; font-style: normal; color: var(--ink-3); font-size: 12px; margin-left: 6px; }
.dm-l2 { font: 500 11px var(--f-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.dm-drop { display: grid; place-items: center; min-height: 74px; border: 1.5px dashed var(--line-2); border-radius: 12px; background: var(--surface-2); color: var(--ink-3); font-size: 13.5px; cursor: pointer; transition: border-color .15s, background .15s; text-align: center; padding: 10px; }
.dm-drop:hover, .dm-drop.over { border-color: var(--cap); background: var(--cap-soft); color: var(--cap); }
.dm-thumbs { display: flex; flex-wrap: wrap; gap: 8px; }
.dm-thumbs:empty { display: none; }
.dm-thumbs figure { margin: 0; position: relative; width: 96px; }
.dm-thumbs img { width: 96px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); display: block; }
.dm-thumbs figcaption { font: 9.5px var(--f-mono); color: var(--ink-3); margin-top: 2px; }
.dm-thumbs button { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }
.dm-samples { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dm-samples > div { display: flex; flex-wrap: wrap; gap: 6px; }
.dm-sample { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px 3px 3px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); font: 500 12.5px var(--f-body); color: var(--ink-2); cursor: pointer; }
.dm-sample img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.dm-sample:hover { border-color: var(--cap); color: var(--cap); }
.dm-setup textarea, .dm-in input { width: 100%; font: 14px var(--f-body); color: var(--ink); background: var(--surface); border: 1.5px solid var(--line-2); border-radius: 10px; padding: 9px 11px; resize: vertical; }
.dm-in input { font-family: var(--f-mono); font-size: 13px; }
.dm-setup textarea:focus, .dm-in input:focus { outline: none; border-color: var(--cap); box-shadow: 0 0 0 3px var(--cap-soft); }
.dm-model { border-top: 1px solid var(--line); padding-top: 14px; }
.dm-prov button[aria-checked="true"] { background: var(--cap); color: var(--on-accent); font-weight: 600; }
.dm-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.dm-in { display: grid; gap: 4px; font: 500 12px var(--f-body); color: var(--ink-2); }
.dm-in[hidden] { display: none; }
.dm-test { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dm-note { font-size: 12.5px; color: var(--ink-3); }
.dm-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.dm-btn { font: 600 14px var(--f-body); border-radius: 10px; padding: 10px 18px; cursor: pointer; border: 1.5px solid var(--line-2); background: var(--surface); color: var(--ink); }
.dm-btn.primary { background: var(--cap); border-color: var(--cap); color: var(--on-accent); padding: 11px 28px; box-shadow: 0 6px 16px -8px var(--cap); }
.dm-btn.primary:disabled { opacity: .7; cursor: progress; }
.dm-btn.ghost:hover { border-color: var(--cap); color: var(--cap); }
.dm-btn[hidden] { display: none; }
.dm-btn:focus-visible, .dm-sample:focus-visible, .dm-drop:focus-within { outline: 2.5px solid var(--cap); outline-offset: 2px; }
.dm-trace { padding: 0; min-height: 420px; max-height: 760px; display: flex; flex-direction: column; overflow: hidden; }
.dm-trace-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font: 600 14px var(--f-body); }
.dm-meta { font: 12px var(--f-mono); color: var(--ink-3); font-weight: 400; }
.dm-steps { list-style: none; margin: 0; padding: 14px 16px; display: grid; gap: 10px; overflow: auto; flex: 1; align-content: start; }
.dm-empty { color: var(--ink-3); font-size: 14px; }
.dm-st { border-radius: 10px; }
.dm-st.th p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); border-left: 2px solid var(--line-2); padding-left: 10px; }
.dm-st.call { border: 1px solid color-mix(in srgb, var(--cap) 40%, var(--line)); background: var(--cap-soft); padding: 9px 11px; }
.dm-st-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.dm-st-h svg { width: 16px; height: 16px; color: var(--cap); }
.dm-st-h code { font-size: 11px; color: var(--ink-3); }
.dm-n { font: 600 11px var(--f-mono); color: var(--on-accent); background: var(--cap); border-radius: 999px; min-width: 20px; height: 20px; display: inline-grid; place-items: center; padding: 0 5px; }
.dm-args, .dm-out { margin: 6px 0 0; font: 11.5px/1.5 var(--f-mono); white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
.dm-st.res { border: 1px solid color-mix(in srgb, var(--ev) 35%, var(--line)); background: var(--surface); padding: 9px 11px; margin-left: 18px; }
.dm-st.res details summary { cursor: pointer; font-size: 12px; color: var(--cap); margin-top: 4px; }
.dm-imgs { display: flex; flex-wrap: wrap; gap: 6px; }
.dm-imgs img { height: 120px; width: auto; max-width: 100%; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; background: #fff; }
.dm-st.ans { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; background: var(--cap); color: var(--on-accent); }
.dm-st.ans span { font: 600 11px var(--f-mono); text-transform: uppercase; letter-spacing: .06em; opacity: .85; }
.dm-st.ans b { font-size: 15px; }
.dm-st.wait { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); }
.dm-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--cap); animation: dmspin .8s linear infinite; }
@keyframes dmspin { to { transform: rotate(360deg); } }
@media (max-width: 900px) { .dm-grid { grid-template-columns: 1fr; } }
.dm-st.err { display: grid; gap: 4px; padding: 10px 14px; border: 1px solid var(--ev); background: var(--ev-soft); }
.dm-st.err span { font: 600 11px var(--f-mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ev); }
.dm-st.err p { margin: 0; font: 12.5px/1.5 var(--f-mono); color: var(--ink-2); word-break: break-word; }

/* banner: memory handles registered by the call */
.det-box .det-label .hd { color: var(--lb-hd, #9aa1ad); font-weight: 400; animation: hdIn .25s ease; }
:root[data-theme="dark"] .det-box .det-label .hd { --lb-hd: #6b7280; }
.det-box .det-label { max-width: min(760px, calc(100vw - 40px)); }
@keyframes hdIn { from { opacity: 0; } to { opacity: 1; } }

/* demo: sample grid and full-width provider toggle */
.dm-samples { display: grid; gap: 6px; }
.dm-l2 em { font-style: normal; text-transform: none; letter-spacing: 0; margin-left: 6px; }
#dmSamples { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; max-height: 196px; overflow-y: auto; padding-right: 2px; }
.dm-sample { border-radius: 10px; padding: 4px 8px 4px 4px; text-align: left; min-width: 0; }
.dm-sample img { width: 34px; height: 28px; border-radius: 6px; flex: none; }
.dm-sample span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.dm-sample em { font: 600 9.5px var(--f-mono); font-style: normal; color: var(--mem); margin-left: 3px; text-transform: uppercase; }
.dm-prov { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
.dm-prov button { text-align: center; padding: 8px 10px; font-size: 13.5px; }
.dm-sample em.x { color: var(--ink-3); }

/* results table: full baseline names wrap within their column */
table.res thead tr.sub th { line-height: 1.2; vertical-align: bottom; font-size: 10.5px; }
table.res th, table.res td { padding: 7px 6px; }
table.res th.first, table.res td.first { padding-left: 10px; padding-right: 10px; }

/* ---------- harness optimization ---------- */
.op-flow { list-style: none; margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; counter-reset: none; }
.op-flow li { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; position: relative; }
.op-flow li:not(:last-child)::after { content: "→"; position: absolute; right: -11px; top: 50%; transform: translateY(-50%); font: 600 15px var(--f-body); color: var(--ink-3); background: var(--bg); padding: 0 1px; }
.op-n { flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--cap); color: var(--on-accent); display: grid; place-items: center; font: 700 13px var(--f-mono); }
.op-flow h4 { margin: 2px 0 4px; font: 600 15px var(--f-display); }
.op-flow p { margin: 0; font-size: 13.5px; line-height: 1.55; color: var(--ink-2); }
.ch-t, .ch-y, .ch-z { font-family: var(--f-mono); font-size: 12px; padding: 0 4px; border-radius: 4px; }
.ch-t { background: var(--cap-soft); color: var(--cap); } .ch-y { background: var(--ev-soft); color: var(--ev); } .ch-z { background: var(--surface-2); color: var(--ink-3); }
.op-fig { padding: 18px 20px; margin-bottom: 16px; }
.op-fig .chart-title { margin-bottom: 10px; }
.op-wf { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 16px; margin-bottom: 16px; align-items: start; }
.op-card { padding: 18px 20px; display: grid; gap: 10px; }
.op-card header { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.op-card h3 { margin: 0; font: 600 19px var(--f-display); }
.op-card > p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--ink-2); }
.op-tag { font: 600 11px var(--f-mono); padding: 2px 8px; border-radius: 999px; }
.op-tag.y { background: var(--ev-soft); color: var(--ev); } .op-tag.t { background: var(--cap-soft); color: var(--cap); }
.op-params { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.op-params div { display: flex; gap: 6px; align-items: baseline; border: 1px solid var(--line); border-radius: 8px; padding: 3px 9px; background: var(--surface-2); }
.op-params dt { font: 500 10.5px var(--f-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.op-params dd { margin: 0; font: 600 12.5px var(--f-mono); color: var(--ink); }
.op-more summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--cap); }
.op-more blockquote { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--ev); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 13px; line-height: 1.55; color: var(--ink-2); }
.op-more blockquote b { color: var(--ink); }
.op-src { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.op-tools { overflow-x: auto; }
.op-tools table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.op-tools th { text-align: left; font: 500 10.5px var(--f-mono); text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.op-tools td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--ink-2); line-height: 1.45; }
.op-tools td:nth-child(3), .op-tools td:nth-child(4), .op-tools th:nth-child(3), .op-tools th:nth-child(4) { text-align: right; white-space: nowrap; font-family: var(--f-mono); }
.op-tools td code { font-size: 11.5px; color: var(--cap); word-break: break-word; }
.op-tools tr.g td { background: var(--surface-2); font: 500 11px var(--f-mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; padding: 5px 8px; }
@media (max-width: 960px) { .op-flow, .op-wf { grid-template-columns: 1fr; } .op-flow li:not(:last-child)::after { content: "↓"; right: 50%; top: auto; bottom: -15px; transform: translateX(50%); } }
.det-box .det-label { max-width: min(760px, calc(100vw - 64px)); }
.op-tools td:first-child { min-width: 210px; }
.op-tools td code { word-break: normal; }
@media (max-width: 640px) { .op-tools td:first-child { min-width: 0; } .op-tools td code { word-break: break-all; } }

/* ---------- method figure connectors (SVG overlay, paper Fig. 2) ---------- */
#methodFig .mf-grid { position: relative; column-gap: 46px; }
#methodFig .mf-main { row-gap: 34px; }
#methodFig .mf-row.top { column-gap: 40px; }
#methodFig .mf-row.mid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); column-gap: 18px; }
#methodFig .flow { height: 30px; }
#methodFig .flow .pipe-v { visibility: hidden; }
#methodFig .mem-io { display: none; }
.mf-arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.mf-arrows .ar { color: var(--ink-3); opacity: .9; transition: opacity .25s; }
.mf-arrows .ar line { stroke: currentColor; stroke-width: 3; stroke-linecap: butt; }
.mf-arrows .ar polygon { fill: currentColor; }
.mf-arrows .ar.c-user { color: var(--ink-2); }
.mf-arrows .ar.c-cap { color: var(--cap); }
.mf-arrows .ar.c-ev { color: var(--ev); }
.mf-arrows .ar.c-mem { color: var(--mem); }
.mf-arrows .ar.c-svc { color: var(--ink-3); opacity: .55; }
.mf-arrows .ar.go { opacity: 1; filter: drop-shadow(0 0 4px currentColor); }
.mf-arrows .ar.go line { stroke-dasharray: 7 5; animation: arFlow .6s linear infinite; }
.mf-arrows text { font: 600 10.5px var(--f-body); fill: var(--ink-3); }
.mf-arrows text.on { fill: var(--mem); }
@keyframes arFlow { to { stroke-dashoffset: -12; } }
@media (prefers-reduced-motion: reduce) { .mf-arrows .ar.go line { animation: none; stroke-dasharray: none; } }
@media (max-width: 1040px) { .mf-arrows { display: none; } #methodFig .mf-grid { column-gap: 14px; } #methodFig .mf-main { row-gap: 12px; } #methodFig .mf-row.top { column-gap: 12px; } }
#methodFig .flow:not(.svc) { height: 0; }

/* memory column: narrower, two images per row growing downward; left panels wider and shorter */
#methodFig .mf-grid { grid-template-columns: minmax(0, 3.6fr) minmax(0, 1fr); column-gap: 42px; }
#methodFig .mem-imgs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
#methodFig .mem-imgs figure { min-width: 0; }
#methodFig .mem-imgs figcaption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#methodFig .mf-row.top > .box { height: 212px; }
#methodFig .mf-row.mid > .box { height: 222px; }
#methodFig .mf-row.top > .box { height: 222px; }
#methodFig .b-user .thumbs img { height: 46px; }
#methodFig .mem-sec .h { flex-wrap: nowrap; white-space: nowrap; }
#methodFig .b-user:has(.mk-legend:not(:empty)) .q { -webkit-line-clamp: 2; }
#methodFig .b-user .final { flex-wrap: nowrap; }
#methodFig .final .gt abbr { text-decoration: none; }
#methodFig .b-user .final { min-width: 0; }
#methodFig .b-user .final .ans { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#methodFig .b-user .final .gt { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#methodFig .b-orch .brain { width: 22px; height: 22px; }
#methodFig .mf-grid { column-gap: 32px; }
#methodFig .b-orch .brain { width: 30px; height: 30px; margin: -5px 0 -5px -3px; }

@media (max-width: 1040px) { #methodFig .mf-grid { grid-template-columns: minmax(0, 1fr); } #methodFig .mem-sec .h { flex-wrap: wrap; white-space: normal; } }

/* academic section headings */
.sec-head h2 { font-size: clamp(24px, 2.6vw, 30px); font-weight: 700; letter-spacing: -0.015em; margin: 0 0 8px; }
.sec-head { margin-bottom: 22px; }
.sec-head p.lead { font-size: 16px; }
#methodFig .b-orch .brain { width: 22px; height: 22px; margin: -2px 0 -2px -1px; }
#methodFig .stage.drawn .bx rect { animation-duration: calc(.22s / var(--spd, 1)); }

/* ablation table (paper Table 2) */
.insight.wide { grid-template-columns: 1fr; gap: 14px; align-items: start; }
.insight.wide .ins-text { max-width: 900px; }
.abl-card { padding: 14px 16px 10px; }
.abl-wrap { overflow-x: auto; }
table.abl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
table.abl th, table.abl td { padding: 7px 8px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.abl thead th { font-size: 12px; font-weight: 600; color: var(--ink-2); background: var(--surface-2); }
table.abl thead th.dom { text-align: center; font-family: var(--f-display); color: var(--ink); border-left: 1px solid var(--line); }
table.abl thead th.sc { font: 500 11px var(--f-mono); color: var(--ink-3); }
table.abl th.cfg { text-align: left; font-weight: 600; color: var(--ink); background: var(--surface); position: sticky; left: 0; z-index: 1; border-right: 1px solid var(--line); }
table.abl thead th.cfg { background: var(--surface-2); vertical-align: bottom; }
table.abl .gs { border-left: 1px solid var(--line); }
table.abl .ov { font-weight: 600; }
table.abl thead th.ov { background: color-mix(in srgb, var(--cap) 8%, var(--surface-2)); }
table.abl td b { font-weight: 500; color: var(--ink); }
table.abl td .d { display: block; font: 600 10.5px var(--f-mono); margin-top: 1px; }
table.abl td .d.up { color: var(--cap); } table.abl td .d.dn { color: var(--ev); }
table.abl tr.full th.cfg, table.abl tr.full td b { font-weight: 700; }
table.abl tbody tr:last-child td, table.abl tbody tr:last-child th { border-bottom: 0; }
.abl-cap { margin: 8px 0 0; font-size: 12px; color: var(--ink-3); }
.abl-cap .sw { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: -1px; }
.abl-cap .sw.pos { background: color-mix(in srgb, var(--cap) 40%, transparent); } .abl-cap .sw.neg { background: color-mix(in srgb, var(--ev) 40%, transparent); }
table.abl { table-layout: fixed; min-width: 760px; }
table.abl th.cfg { width: 17%; }
.insight.wide > * { min-width: 0; }

/* analysis: title, text, full-width figure */
#insights .insight.wide { display: block; padding: 30px 0; }
#insights .insight.wide .ins-text { max-width: none; margin-bottom: 14px; }
#insights .insight.wide .ins-text h3 { margin-top: 0; }
#insights .insight.wide .ins-fig, #insights .insight.wide .abl-card { width: 100%; }
#insights .insight.wide .ins-text p, #insights .sec-head p.lead, #optimization .sec-head p.lead, #results .sec-head p.lead { max-width: none; }
.sec-head, .insight.wide .ins-text, #insights .insight.wide .ins-text { max-width: none; }
.sec-head p.lead, .ins-text p { max-width: none; }
#resTable th .ver { font: 500 10px var(--f-mono); color: var(--ink-3); letter-spacing: 0; }
/* ablation row highlight (matches the results table) */
table.abl tbody tr td, table.abl tbody tr th.cfg { transition: box-shadow .12s; }
table.abl tbody tr:hover td, table.abl tbody tr:hover th.cfg { box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--ink) 6%, transparent); }
/* demo: trajectory panel matches the setup panel's height and scrolls inside */
@media (min-width: 901px) {
  .dm-grid { align-items: stretch; }
  .dm-trace { contain: size; min-height: 420px; max-height: none; }
}
@media (max-width: 900px) { .dm-trace { height: 560px; max-height: none; } }
/* larger table headers */
table.res thead tr.grp th { font-size: 15px; }
table.res thead tr.sub th { font-size: 12.5px; }
table.res thead th.first { font-size: 14px; }
#resTable th .ver { font-size: 11px; }
table.abl thead th.dom { font-size: 14.5px; }
table.abl thead th.sc { font-size: 12.5px; }
table.abl thead th.cfg { font-size: 14px; }
table.res th, table.res td { padding-left: 5px; padding-right: 5px; }
table.res thead tr.sub th { font-size: 12px; letter-spacing: -0.01em; }
#methodFig .pb.pb-lbl { width: auto; padding: 0 14px; gap: 6px; display: inline-flex; align-items: center; font: 600 13.5px var(--f-body); }
#methodFig .pb.pb-lbl svg { flex: none; }
@media (max-width: 520px) { #methodFig .pb.pb-lbl span { display: none; } #methodFig .pb.pb-lbl { padding: 0; width: 44px; justify-content: center; } }
.dm-keynote { margin: -4px 0 2px; font-size: 12px; color: var(--ink-3); }

/* tool usage by domain (paper Fig. 7) */
.tm-pies { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 6px 0 4px; }
.tm-pie { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.tm-pie svg { width: 100%; max-width: 190px; height: auto; display: block; }
.tm-t { font: 600 14px var(--f-display); color: var(--ink); text-align: center; }
.tm-n { font: 500 12px var(--f-mono); color: var(--ink-3); }
.tm-w { transition: opacity .12s; }
.tm-pie svg:hover .tm-w { opacity: .55; } .tm-pie svg .tm-w:hover { opacity: 1; }
.tm-legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.tm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tm-legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
@media (max-width: 720px) { .tm-pies { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* pie sweep-in: clockwise from 12 o'clock, staggered per domain */
@property --sweep { syntax: '<angle>'; inherits: false; initial-value: 360deg; }
.tm-pies.chart:not(.in) .tm-pie svg { --sweep: 0deg; }
.tm-pie svg { -webkit-mask: conic-gradient(#000 var(--sweep), transparent 0); mask: conic-gradient(#000 var(--sweep), transparent 0); }
.tm-pies.chart.in .tm-pie svg { transition: --sweep 1.1s cubic-bezier(.4, 0, .2, 1) var(--d, 0ms); }
.tm-pies.chart .tm-n { opacity: 0; transition: opacity .4s ease calc(var(--d, 0ms) + .8s); }
.tm-pies.chart.in .tm-n { opacity: 1; }
.chart.tm-pies svg { width: 100%; overflow: hidden; }
@media (prefers-reduced-motion: reduce) { .tm-pie svg { -webkit-mask: none; mask: none; } .tm-pies.chart .tm-n { opacity: 1; transition: none; } }
.authors a { color: inherit; text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .15s, color .15s; }
.authors a:hover, .authors a:focus-visible { color: var(--cap); border-bottom-color: currentColor; }

/* === architecture figure below 900px: these must come last; earlier desktop rules (fixed
   3-column top row, 2-column mid row, fixed heights) otherwise override the responsive ones. */
@media (max-width: 900px) {
  #methodFig .mf-row.top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  #methodFig .mf-row.top .b-user { grid-column: 1 / -1; }
  #methodFig .mf-row.top .b-env { grid-column: auto; }
  #methodFig .mf-row.mid { grid-template-columns: minmax(0, 1fr); }
  #methodFig .mf-row.top > .b-user { height: auto; }
  #methodFig .mf-row.top > .box:not(.b-user) { height: 230px; }
  #methodFig .mf-row.mid > .box { height: 250px; }
}
@media (max-width: 640px) {
  #methodFig .mf-row.top { grid-template-columns: minmax(0, 1fr); }
  #methodFig .mf-row.top .b-user, #methodFig .mf-row.top .b-env { grid-column: auto; }
  #methodFig .mf-row.top > .box:not(.b-user) { height: 210px; }
}
/* hero banner: cap to the title box, not the viewport (it starts at the box's left edge) */
.det-box .det-label { max-width: min(760px, calc(100% + 40px)); }
@media (max-width: 640px) { .det-box .det-label { max-width: calc(100% + 2px); } }

/* === architecture figure, desktop: one gap everywhere so every connector arrow has the same
   length; memory column a little wider; overall height unchanged (left column fills to the
   memory column's 799px: 2 x 232 box rows + capability layer + services + 3 gaps). */
@media (min-width: 1041px) {
  #methodFig { --ag: 36px; }
  #methodFig .mf-grid { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); column-gap: var(--ag); }
  #methodFig .mf-main { row-gap: var(--ag); grid-template-rows: auto auto auto; } /* 3 children; a 4th declared row added a stray trailing gap */
  #methodFig .mf-row.top { column-gap: var(--ag); }
  #methodFig .flow.svc { height: var(--ag); }
  #methodFig .mf-row.top > .box, #methodFig .mf-row.mid > .box { height: 232px; }
  #methodFig .mem-imgs img { aspect-ratio: 3 / 2; }
}

/* === architecture figure colors: orchestrator = orange (reasoning), tool call + capability
   layer = blue (actions), rendered evidence = teal (observations), memory = magenta. */
#methodFig .b-orch .brain { color: var(--ev); }
#methodFig .b-orch.lit { box-shadow: 0 0 0 3px var(--ev-soft); border-color: var(--ev); }
#methodFig .b-orch .caret { background: var(--ev); }
#methodFig .box.lit-a { box-shadow: 0 0 0 3px var(--obs-soft); border-color: var(--obs); }
#methodFig .flow .pipe-v.up::after { background: var(--obs); }
.mf-arrows .ar.c-ev { color: var(--obs); }
/* grounding boxes: thin outlines so dense results (e.g. 134 pills) stay readable */
.stage .bx rect { fill: rgba(124, 159, 240, .07); stroke-width: 1.6; }
/* models & services: keep each name on one line */
@media (min-width: 1101px) { #methodFig .svc-items .be { white-space: nowrap; padding-inline: 4px; gap: 5px; font-size: 11.5px; } }
#methodFig .b-orch h5 { color: var(--ev); }
.tm-pie.na svg circle { fill: none; stroke: var(--line-2); stroke-width: 1.5; stroke-dasharray: 5 5; }
.tm-pie.na .tm-n { opacity: 1; }

/* step caption + playback controls share one panel: caption left, buttons right */
#methodFig .mf-dock { margin-top: 12px; display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; padding: 10px 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
#methodFig .mf-dock .mf-caption { margin: 0; flex: 1 1 320px; min-width: 0; background: none; border-radius: 0; border-left: 3px solid var(--cap); padding: 4px 0 4px 12px; }
#methodFig .mf-dock .mf-controls { margin: 0; flex: 0 0 auto; padding: 0; background: none; border: 0; border-radius: 0; }
@media (max-width: 760px) { #methodFig .mf-dock .mf-controls { flex: 1 1 100%; } }
/* keep the playback buttons centered in the panel: equal side columns, caption in the left one */
@media (min-width: 761px) {
  #methodFig .mf-dock { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); }
  #methodFig .mf-dock .mf-caption { grid-column: 1; }
  #methodFig .mf-dock .mf-controls { grid-column: 2; justify-content: center; }
}
/* step title left, controls centered, "STEP n / N" right; no accent bar */
@media (min-width: 761px) {
  #methodFig .mf-dock .mf-caption { display: contents; }
  #methodFig .mf-dock .mf-caption .t { grid-column: 1; grid-row: 1; align-self: center; margin: 0; padding-left: 4px; }
  #methodFig .mf-dock .mf-caption .s { grid-column: 3; grid-row: 1; align-self: center; justify-self: end; padding-right: 4px; white-space: nowrap; }
  #methodFig .mf-dock .mf-caption .d { grid-column: 1 / -1; grid-row: 2; }
  #methodFig .mf-dock .mf-controls { grid-row: 1; }
}
@media (max-width: 760px) {
  #methodFig .mf-dock .mf-caption { border-left: 0; padding-left: 0; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
  #methodFig .mf-dock .mf-caption .s { order: 2; white-space: nowrap; }
}
@media (max-width: 760px) { #methodFig .mf-dock .mf-caption { flex-wrap: nowrap; } #methodFig .mf-dock .mf-caption .t { min-width: 0; } }
/* orchestrator icon: the brain from paper Fig. 2, as outline + fill masks tinted with the theme */
#methodFig .brain-ic { position: relative; display: inline-block; width: 24px; height: 24px; flex: none; margin: -3px 0 -3px -2px; }
#methodFig .brain-ic i { position: absolute; inset: 0; -webkit-mask: center / contain no-repeat; mask: center / contain no-repeat; }
#methodFig .brain-ic .o { -webkit-mask-image: url(../icons/brain_outline.png); mask-image: url(../icons/brain_outline.png); background: var(--ev); }
#methodFig .brain-ic .f { -webkit-mask-image: url(../icons/brain_fill.png); mask-image: url(../icons/brain_fill.png); background: color-mix(in srgb, var(--ev) 30%, var(--surface)); }
#methodFig .b-orch.thinking .brain-ic { animation: pulse 1.1s ease-in-out infinite; }
/* coding model = the orchestrator's backbone in a fresh context: small brain + muted note */
#methodFig .be-coder .be-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
#methodFig .be-coder small { display: inline-flex; align-items: center; gap: 3px; font-size: 9.5px; font-weight: 500; color: var(--ink-3); white-space: nowrap; margin-top: 1px; }
#methodFig .brain-ic.sm { width: 11px; height: 11px; margin: 0; }
#methodFig .be-coder .brain-ic.bi { width: 16px; height: 16px; margin: 0; }
#methodFig .be-coder small { color: var(--ev); opacity: .85; }
