/* ------------------------------------------------------------------
   Visual-Geometric Policy Steering: project page
   ------------------------------------------------------------------ */
:root {
  --bg: #f7f6f2;
  --bg-2: #efede6;
  --surface: #ffffff;
  --surface-2: #f3f2ee;
  --ink: #16181d;
  --ink-2: #454a55;
  --ink-3: #6f7480;
  --line: #dedbd2;
  --line-2: #cbc7bb;
  --accent: #2f6fdb;      /* ours */
  --accent-soft: #dbe7fb;
  --base: #b8563f;        /* base policy */
  --base-soft: #f5e0da;
  --green: #3f8f4e;
  --green-soft: #dcefdc;
  --yellow: #c79a1c;
  --yellow-soft: #fbf0cf;
  --red: #c24536;
  --code-bg: #f3f2ee;
  --shadow: 0 1px 2px rgba(20, 20, 30, .05), 0 8px 24px rgba(20, 20, 30, .06);
  --radius: 14px;
  --maxw: 1180px;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1116; --bg-2: #141720; --surface: #171a22; --surface-2: #1d212b;
    --ink: #eceef3; --ink-2: #b9bfcc; --ink-3: #8a91a0; --line: #272c38; --line-2: #343a48;
    --accent: #7badf4; --accent-soft: #1d2d49; --base: #e08a6e; --base-soft: #3a2420;
    --green: #88bd75; --green-soft: #1f3322; --yellow: #ffe085; --yellow-soft: #3a3320;
    --red: #ec6f5f; --code-bg: #12151c;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1116; --bg-2: #141720; --surface: #171a22; --surface-2: #1d212b;
  --ink: #eceef3; --ink-2: #b9bfcc; --ink-3: #8a91a0; --line: #272c38; --line-2: #343a48;
  --accent: #7badf4; --accent-soft: #1d2d49; --base: #e08a6e; --base-soft: #3a2420;
  --green: #88bd75; --green-soft: #1f3322; --yellow: #ffe085; --yellow-soft: #3a3320;
  --red: #ec6f5f; --code-bg: #12151c;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--sans); font-size: 16.5px; line-height: 1.65;
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
img, video { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--serif); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); }
h3 { font-size: 1.35rem; margin-top: 1.6em; }
h4 { font-family: var(--sans); font-size: 1rem; font-weight: 650; margin-top: 1.4em; }
p { margin: 0 0 1em; color: var(--ink-2); }
strong { color: var(--ink); }
code, pre { font-family: var(--mono); font-size: .86em; }
code { background: var(--code-bg); padding: .1em .35em; border-radius: 5px; }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
@media (max-width: 640px) { .wrap { padding: 0 16px; } body { font-size: 16px; } }

/* ---------- nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; gap: 18px; height: 58px; }
.nav .brand { font-family: var(--serif); font-weight: 700; color: var(--ink); white-space: nowrap; font-size: 1.05rem; }
.nav .links { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav .links::-webkit-scrollbar { display: none; }
.nav .links a {
  color: var(--ink-2); font-size: .9rem; padding: 6px 11px; border-radius: 8px; white-space: nowrap; font-weight: 500;
}
.nav .links a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.nav .links a.active { color: var(--ink); background: var(--surface-2); }
.nav .links a.appx { color: var(--accent); font-weight: 650; }
.theme-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer; flex: none; display: grid; place-items: center;
}
.theme-btn svg { width: 17px; height: 17px; }
@media (max-width: 760px) { .nav .brand { display: none; } .nav .links { margin-left: 0; } }

/* ---------- hero ---------- */
.hero { padding: 72px 0 36px; text-align: center; }
.venue {
  display: inline-block; font-size: .8rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); border: 1px solid var(--line-2); padding: 4px 12px; border-radius: 999px; margin-bottom: 22px;
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.4rem); max-width: 980px; margin: 0 auto .45em; font-weight: 700; }
.hero .authors { color: var(--ink-3); font-size: 1.02rem; margin-bottom: 26px; }
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 18px; border-radius: 10px;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: .95rem; border: 1px solid var(--ink);
}
.btn:hover { text-decoration: none; opacity: .9; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn svg { width: 17px; height: 17px; }

.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 44px auto 0; max-width: 1040px; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 12px; text-align: center;
}
.stat b { display: block; font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat span { font-size: .82rem; color: var(--ink-3); line-height: 1.35; display: block; margin-top: 4px; }
@media (max-width: 860px) { .stats { grid-template-columns: repeat(2, 1fr); } .stat:last-child { grid-column: span 2; } }

.teaser { margin-top: 40px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden;
}
.card.pad { padding: 22px; }
.figure-white { background: #fff; padding: 14px; }
figcaption, .caption { font-size: .9rem; color: var(--ink-3); padding: 12px 4px 0; line-height: 1.55; }
.card figcaption { padding: 12px 18px 16px; }

.tldr {
  max-width: 880px; margin: 34px auto 0; font-size: 1.12rem; color: var(--ink-2); text-align: left;
  border-left: 3px solid var(--accent); padding: 4px 0 4px 18px;
}
.tldr strong { color: var(--ink); }

/* ---------- sections ---------- */
section.block { padding: 72px 0 24px; }
section.block + section.block { border-top: 1px solid var(--line); }
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.lead { font-size: 1.08rem; max-width: 820px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.q {
  font-family: var(--serif); font-size: 1.3rem; color: var(--ink); margin: 2.2em 0 .6em; display: flex; gap: 10px; align-items: baseline;
}
.q .tag { font-family: var(--sans); font-size: .75rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); padding: 3px 8px; border-radius: 6px; flex: none; }

/* ---------- video ---------- */
.video-frame { position: relative; border-radius: var(--radius); overflow: hidden; background: #000; box-shadow: var(--shadow); }
.video-frame video { width: 100%; }

/* ---------- method stepper ---------- */
.stepper { display: grid; grid-template-columns: 300px 1fr; gap: 22px; margin-top: 28px; }
@media (max-width: 860px) { .stepper { grid-template-columns: 1fr; } }
.steps { display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 860px) { .steps { flex-direction: row; overflow-x: auto; } .steps button { min-width: 200px; } }
.steps button {
  text-align: left; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
  border-radius: 12px; padding: 12px 14px; cursor: pointer; font: inherit; font-size: .92rem; line-height: 1.4;
  transition: border-color .15s, background .15s;
}
.steps button b { display: block; color: var(--ink); font-size: .98rem; margin-bottom: 2px; }
.steps button .n { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); }
.steps button.on { border-color: var(--accent); background: var(--accent-soft); }
.step-view { background: #0f1116; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.step-view video { width: 100%; aspect-ratio: 16/9; object-fit: contain; background: #0f1116; }
.step-view .txt { padding: 14px 18px 18px; color: #c9ceda; font-size: .95rem; background: #151821; }
.step-view .txt b { color: #fff; }

.eq { overflow-x: auto; padding: 6px 0; color: var(--ink); }
.eqbox { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 18px; margin: 12px 0 18px; overflow-x: auto; }

/* ---------- charts ---------- */
.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 {
  border: 0; background: transparent; color: var(--ink-2); font: inherit; font-size: .86rem; font-weight: 550;
  padding: 6px 12px; border-radius: 7px; cursor: pointer;
}
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0 18px; }
.controls label { font-size: .82rem; color: var(--ink-3); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 190px 1fr 58px; gap: 12px; align-items: center; font-size: .92rem; }
@media (max-width: 640px) { .bar-row { grid-template-columns: 120px 1fr 48px; font-size: .84rem; } }
.bar-row .lbl { color: var(--ink-2); text-align: right; line-height: 1.25; }
.bar-track { height: 26px; background: var(--surface-2); border-radius: 7px; position: relative; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 7px; background: var(--ink-3); width: 0; transition: width .7s cubic-bezier(.2,.8,.2,1); }
.bar-fill.ours { background: var(--accent); }
.bar-fill.base { background: color-mix(in srgb, var(--ink-3) 70%, transparent); }
.bar-fill.vls { background: color-mix(in srgb, var(--yellow) 80%, transparent); }
.bar-fill.bad { background: color-mix(in srgb, var(--base) 70%, transparent); }
.bar-row .val { font-variant-numeric: tabular-nums; font-weight: 650; color: var(--ink); }
.bar-ref { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .35; }

.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; }
.chart-card h4 { margin-top: 0; }
.chart-note { font-size: .85rem; color: var(--ink-3); margin: 12px 0 0; }

/* heat table */
.heat { width: 100%; border-collapse: separate; border-spacing: 4px; font-size: .9rem; }
.heat th { font-weight: 600; color: var(--ink-3); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; padding: 4px; }
.heat td { text-align: center; border-radius: 8px; padding: 10px 4px; font-variant-numeric: tabular-nums; cursor: pointer; position: relative; }
.heat td.rowh { text-align: left; cursor: default; font-weight: 600; color: var(--ink-2); background: none; font-family: var(--mono); font-size: .82rem; }
.heat td .d { display: block; font-size: .75rem; opacity: .85; }
.heat td:not(.rowh):hover { outline: 2px solid var(--accent); }
.heat td.sel { outline: 2px solid var(--ink); }

/* tables */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 14px 0 8px; }
table.t { border-collapse: collapse; width: 100%; font-size: .9rem; font-variant-numeric: tabular-nums; }
table.t th, table.t td { padding: 9px 14px; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th { font-weight: 650; color: var(--ink-2); background: var(--surface-2); font-size: .84rem; }
table.t td:first-child, table.t th:first-child { text-align: left; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.ours td { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
table.t tr.group td { background: var(--surface-2); font-style: italic; color: var(--ink-3); font-size: .82rem; padding: 6px 14px; }
table.t tr.sum td { border-top: 2px solid var(--line-2); }
table.t .best { font-weight: 750; color: var(--ink); }
table.t .ci { color: var(--ink-3); font-size: .78rem; }
.tcap { font-size: .88rem; color: var(--ink-3); margin: 6px 2px 0; }
.tcap b { color: var(--ink-2); }

/* ---------- real-robot grid ---------- */
.gridpair { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .gridpair { grid-template-columns: 1fr; } }
.cellgrid { display: grid; grid-template-columns: 26px repeat(4, 1fr); gap: 6px; }
.cellgrid .hd { font-family: var(--mono); font-size: .78rem; color: var(--ink-3); display: grid; place-items: center; }
.cellgrid .cell {
  aspect-ratio: 1.35; border-radius: 9px; border: 2px solid transparent; cursor: pointer; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  font-variant-numeric: tabular-nums; transition: transform .12s;
}
.cellgrid .cell:hover { transform: translateY(-2px); }
.cellgrid .cell.sel { border-color: var(--ink); }
.cellgrid .cell .dots { display: flex; gap: 4px; }
.cellgrid .cell .dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.cellgrid .cell .dots i.s { background: var(--green); }
.cellgrid .cell .dots i.f { border: 2px solid var(--red); }
.cellgrid .cell .nm { font-family: var(--mono); font-size: .72rem; color: var(--ink-3); }
.cellgrid .cell.z-in { box-shadow: inset 0 0 0 1.5px var(--green); }
.cellgrid .cell.z-far { background-image: repeating-linear-gradient(135deg, transparent 0 6px, color-mix(in srgb, var(--ink-3) 10%, transparent) 6px 7px); }
.gridtitle { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.gridtitle b { font-size: 1rem; }
.gridtitle span { font-size: .86rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: .84rem; color: var(--ink-3); margin: 14px 0 0; align-items: center; }
.legend i { display: inline-block; width: 11px; height: 11px; border-radius: 50%; vertical-align: -1px; margin-right: 5px; }
.legend i.s { background: var(--green); }
.legend i.f { border: 2px solid var(--red); }
.legend i.zin { border-radius: 3px; box-shadow: inset 0 0 0 1.5px var(--green); }
.legend i.zfar { border-radius: 3px; background-image: repeating-linear-gradient(135deg, transparent 0 3px, var(--ink-3) 3px 4px); }

.cellview { margin-top: 22px; }
.cellview .hdr { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.cellview .hdr b { font-size: 1.05rem; }
.cmp { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
@media (max-width: 760px) { .cmp { grid-template-columns: 1fr; } }
.cmp h5 { margin: 0 0 8px; font-size: .88rem; text-transform: uppercase; letter-spacing: .06em; }
.cmp h5.base { color: var(--base); }
.cmp h5.ours { color: var(--accent); }

/* confusion */
.conf { display: grid; grid-template-columns: auto repeat(4, 1fr); gap: 4px; font-size: .86rem; }
.conf .h { color: var(--ink-3); font-size: .76rem; font-weight: 600; display: grid; place-items: center; text-align: center; padding: 2px; }
.conf .h.r { justify-items: end; padding-right: 8px; }
.conf .c { border-radius: 8px; padding: 12px 4px; text-align: center; cursor: pointer; font-weight: 650; font-variant-numeric: tabular-nums; border: 2px solid transparent; }
.conf .c:hover { border-color: var(--accent); }
.conf .c.sel { border-color: var(--ink); }
.conf .c.zero { cursor: default; opacity: .6; }

/* ---------- video tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.tiles.lg { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile {
  position: relative; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: pointer;
  border: 1px solid var(--line); aspect-ratio: 1; content-visibility: auto; contain-intrinsic-size: 200px;
}
.tile.wide { aspect-ratio: 4/3; }
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.tile video { opacity: 0; transition: opacity .2s; }
.tile.playing video { opacity: 1; }
.tile .badge {
  position: absolute; top: 7px; left: 7px; font-size: .68rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; color: #fff; z-index: 2;
}
.tile .badge.ours { background: rgba(47, 111, 219, .92); }
.tile .badge.base { background: rgba(120, 120, 128, .92); }
.tile .badge.realperc { background: rgba(122, 82, 199, .92); }
.tile .badge.vls { background: rgba(196, 110, 24, .92); }
.tile .res {
  position: absolute; top: 7px; right: 7px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  font-size: .72rem; font-weight: 800; color: #fff; z-index: 2;
}
.tile .res.s { background: #3f8f4e; }
.tile .res.f { background: #c24536; }
.tile .meta {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 8px 6px; z-index: 2;
  background: linear-gradient(transparent, rgba(0,0,0,.78)); color: #fff; font-size: .72rem; line-height: 1.3;
}
.tile .meta b { font-weight: 650; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.explorer-bar { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: flex-end; margin: 18px 0; }
.explorer-bar .f { display: flex; flex-direction: column; gap: 5px; }
.explorer-bar .count { margin-left: auto; font-size: .9rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.explorer-bar .count b { color: var(--ink); font-size: 1.1rem; }
select {
  font: inherit; font-size: .88rem; padding: 7px 30px 7px 10px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); appearance: none; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-3) 50%), linear-gradient(135deg, var(--ink-3) 50%, transparent 50%);
  background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; background-size: 5px 5px; background-repeat: no-repeat;
}
.more { display: flex; justify-content: center; margin: 22px 0 0; }
.empty { padding: 40px; text-align: center; color: var(--ink-3); border: 1px dashed var(--line-2); border-radius: 12px; }

/* pair viewer */
.pairs { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 16px; }
.pair { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.pair .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair .two .tile { aspect-ratio: 1; }
.pair .inst { font-size: .84rem; color: var(--ink-2); padding: 8px 4px 2px; line-height: 1.35; }
.pair .inst span { font-family: var(--mono); font-size: .74rem; color: var(--ink-3); }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; z-index: 100; background: rgba(8, 9, 12, .86); display: none; align-items: center; justify-content: center; padding: 24px; }
.lb.open { display: flex; }
.lb .box { max-width: min(980px, 100%); width: 100%; background: #111318; border-radius: 14px; overflow: hidden; color: #e7e9ee; }
.lb video { width: 100%; max-height: 72vh; background: #000; object-fit: contain; }
.lb .info { padding: 12px 18px 16px; font-size: .9rem; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.lb .info .kv { display: flex; flex-wrap: wrap; gap: 6px 16px; color: #b8bdc9; }
.lb .info .kv b { color: #fff; font-weight: 600; }
.lb .x, .lb .nv {
  background: #252933; border: 0; color: #fff; border-radius: 8px; padding: 7px 12px; cursor: pointer; font: inherit; font-size: .88rem;
}
.lb .nv:disabled { opacity: .35; cursor: default; }

/* ---------- appendix ---------- */
.appendix-layout { display: grid; grid-template-columns: 250px 1fr; gap: 40px; align-items: start; }
@media (max-width: 960px) { .appendix-layout { grid-template-columns: 1fr; } .toc { position: static !important; max-height: none !important; } }
.toc {
  position: sticky; top: 78px; max-height: calc(100vh - 100px); overflow-y: auto;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 14px 10px; font-size: .88rem;
}
.toc b { display: block; padding: 0 8px 8px; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.toc a { display: flex; gap: 8px; color: var(--ink-2); padding: 5px 8px; border-radius: 7px; line-height: 1.35; }
.toc a span { font-family: var(--mono); font-size: .76rem; color: var(--ink-3); flex: none; width: 30px; }
.toc a:hover { background: var(--surface-2); text-decoration: none; }
.toc a.active { background: var(--accent-soft); color: var(--ink); }
.appx-sec { padding: 8px 0 26px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.appx-sec:last-child { border-bottom: 0; }
.appx-sec h3 { margin-top: .3em; display: flex; gap: 12px; align-items: baseline; }
.appx-sec h3 .num { font-family: var(--mono); font-size: .9rem; color: var(--accent); flex: none; }
.appx-sec h3 a.anchor { opacity: 0; font-size: .9rem; margin-left: auto; font-family: var(--sans); }
.appx-sec h3:hover a.anchor { opacity: .7; }
.appx-sec ul { color: var(--ink-2); padding-left: 1.2em; }
.appx-sec li { margin: .25em 0; }

.algo { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin: 14px 0; }
.algo .ah { padding: 9px 16px; border-bottom: 1px solid var(--line); font-size: .9rem; background: var(--surface-2); }
.algo ol { margin: 0; padding: 12px 16px 14px 44px; font-size: .9rem; color: var(--ink-2); line-height: 1.75; }
.algo ol li::marker { color: var(--ink-3); font-family: var(--mono); font-size: .8rem; }
.algo .cm { color: var(--ink-3); font-style: italic; float: right; }
.algo .in1 { padding-left: 1.4em; }
.algo .in2 { padding-left: 2.8em; }

details.prompt { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 12px 0; overflow: hidden; }
details.prompt summary {
  cursor: pointer; padding: 12px 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; list-style: none;
}
details.prompt summary::-webkit-details-marker { display: none; }
details.prompt summary::before { content: "▸"; color: var(--ink-3); transition: transform .15s; }
details.prompt[open] summary::before { transform: rotate(90deg); }
details.prompt summary .role { font-family: var(--mono); font-size: .75rem; padding: 2px 8px; border-radius: 5px; background: var(--surface-2); color: var(--ink-2); font-weight: 600; }
details.prompt summary .sz { margin-left: auto; font-size: .8rem; color: var(--ink-3); font-weight: 500; }
details.prompt pre {
  margin: 0; padding: 14px 16px; background: var(--code-bg); border-top: 1px solid var(--line); max-height: 540px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; font-size: .8rem; line-height: 1.55; color: var(--ink-2);
}
.copy { margin-left: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-2); border-radius: 6px; padding: 2px 9px; font-size: .75rem; cursor: pointer; font-family: var(--sans); }

.refs { font-size: .86rem; color: var(--ink-3); padding-left: 1.4em; }
.refs li { margin: .35em 0; }

footer { padding: 50px 0 70px; color: var(--ink-3); font-size: .88rem; text-align: center; border-top: 1px solid var(--line); margin-top: 40px; }

.pill { display: inline-block; font-size: .74rem; padding: 2px 8px; border-radius: 999px; font-weight: 650; }
.pill.ours { background: var(--accent-soft); color: var(--accent); }
.pill.base { background: var(--surface-2); color: var(--ink-3); border: 1px solid var(--line); }

.callout { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--yellow); border-radius: 10px; padding: 12px 16px; font-size: .92rem; color: var(--ink-2); margin: 14px 0; }
.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin: 14px 0 6px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-width: 150px; }
.kpi b { font-family: var(--serif); font-size: 1.45rem; display: block; line-height: 1.15; }
.kpi span { font-size: .8rem; color: var(--ink-3); }
.kpi .up { color: var(--green); }

.fade-in { opacity: 0; transform: translateY(10px); transition: opacity .6s, transform .6s; }
.fade-in.vis { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .fade-in { opacity: 1; transform: none; } html { scroll-behavior: auto; } }
.katex { font-size: 1.05em; }
.muted { color: var(--ink-3); }
.small { font-size: .88rem; }
.mt0 { margin-top: 0; }
.appx-body, .appendix-layout > *, .grid-2 > *, .grid-3 > *, .gridpair > *, .cmp > * { min-width: 0; }
.kpi b span { font-size: inherit; }
#profBars .bar-row { grid-template-columns: 150px 1fr 96px; }
@media (max-width: 640px) { #profBars .bar-row { grid-template-columns: 90px 1fr 84px; } }
@media (max-width: 640px) {
  .tiles, .tiles.lg { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pairs { grid-template-columns: 1fr; }
  .conf { font-size: .78rem; }
  .explorer-bar .count { margin-left: 0; width: 100%; }
}
.seg button.minor { opacity: .6; font-size: .8rem; }
.seg button.minor.on { opacity: 1; }
.heat td.dim { opacity: .42; }
.heat td.dim:hover { opacity: 1; }
.heat td.focus { box-shadow: inset 0 0 0 2px var(--accent); }
.focus-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 16px 20px; margin: 22px 0 8px; }
.fc-head { display: flex; flex-direction: column; gap: 2px; }
.fc-head b { font-family: var(--serif); font-size: 1.15rem; }
