:root {
  color-scheme: light;
  --page: #f9f9f7; --surface: #fcfcfb; --ink: #0b0b0b; --ink2: #52514e; --muted: #6b6a65;
  --grid: #e1e0d9; --base: #c3c2b7; --ring: rgba(11, 11, 11, 0.10);
  --obs: #2a78d6; --obs-wash: #e9f1fb; --gen: #eb6834; --gen-wash: #fdeee6; --beh: #1baf7a; --free: #f0efec;
  --obs-ink: #1c5cab; --gen-ink: #b4461b;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --w: 760px; --wide: 1120px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--page); color: var(--ink); font: 17px/1.62 var(--sans); }
main > section { max-width: var(--w); margin: 0 auto; padding: 18px 22px; }
main > section.wide { max-width: var(--wide); }
.narrow { max-width: var(--w); }
h1, h2, h3 { line-height: 1.2; font-weight: 650; }
h2 { font-size: 1.55rem; margin: 2.2rem 0 0.8rem; scroll-margin-top: 16px; }
p { margin: 0.7rem 0; }
a { color: var(--obs-ink); }
var { font-family: "Times New Roman", Times, serif; font-style: italic; font-size: 1.08em; }
var, sub, sup { line-height: 0; }
var.cal { padding-right: 0.14em; }
b { font-weight: 650; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fine { color: var(--ink2); font-size: 0.86rem; line-height: 1.5; }
.dia-cue { display: none; margin-top: 6px; }
.obs-t { color: var(--obs-ink); font-weight: 600; }
.gen-t { color: var(--gen-ink); font-weight: 600; }

.hero { text-align: center; padding: 36px 20px 12px; }
.hero h1 { font-size: clamp(2rem, 4.6vw, 3.2rem); margin: 0.2rem 0 0.6rem; letter-spacing: -0.01em; }
.hero h1 .h { display: inline-block; text-wrap: balance; }
.venue { color: var(--muted); font-size: 0.95rem; margin: 0; }
.subtitle { color: var(--ink2); font-size: 1.25rem; margin: 0 0 1.2rem; }
.links { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: 999px; border: 1px solid var(--ink);
  background: var(--ink); color: #fff; text-decoration: none; font: 600 0.95rem var(--sans); cursor: pointer; }
.btn:hover { background: #2b2b2a; }
.btn.disabled { background: transparent; color: var(--muted); border-color: var(--base); cursor: default; }
.btn.small { padding: 5px 14px; font-size: 0.88rem; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--base); }
.btn.ghost:hover { background: var(--free); }
button:focus-visible, select:focus-visible, input:focus-visible, .node:focus-visible { outline: 2px solid var(--obs); outline-offset: 2px; }

.teaser { padding-top: 8px; }
.teaser-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { min-width: 0; margin: 0; background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--ring); padding: 12px; }
.panel-h { font-size: 0.9rem; color: var(--ink2); margin: 0 0 8px; }
.frame-img { width: 100%; aspect-ratio: 1; object-fit: contain; display: block; background: #fff; border-radius: 8px; }
.filmstrip { display: flex; gap: 2px; margin-top: 8px; height: 30px; }
.filmstrip img { height: 30px; flex: 1 1 0; min-width: 0; object-fit: cover; border-radius: 3px; opacity: 0.35; cursor: pointer; }
.filmstrip img.seen { opacity: 1; }
.filmstrip img.now { box-shadow: 0 0 0 2px var(--ink); }
.teaser .frame-img, .teaser .viewer { max-height: max(260px, calc(100vh - 420px)); }
.viewer { width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface); position: relative;
  cursor: grab; touch-action: none; }
.viewer.dragging { cursor: grabbing; }
.viewer canvas { display: block; width: 100% !important; height: 100% !important; }
.viewer.loading::after { content: "loading…"; position: absolute; left: 10px; top: 8px; color: var(--muted); font-size: 0.8rem; }
.viewer[data-error]::after { content: attr(data-error); position: absolute; inset: 40% 10px auto; color: var(--ink2);
  font-size: 0.85rem; text-align: center; }
.share-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 0.88rem; color: var(--ink2); }
.share-bar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.share-track { flex: 0 0 120px; height: 10px; border-radius: 5px; background: var(--obs); overflow: hidden; display: flex; }
.share-gen { height: 100%; background: var(--gen); box-shadow: 2px 0 0 var(--surface); }
.controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; margin: 14px 0 4px; font-size: 0.92rem; color: var(--ink2); }
.controls.tight { margin: 10px 0 0; }
.slider-l { display: inline-flex; align-items: center; gap: 8px; }
.slider-l.grow { flex: 1 1 220px; }
.slider-l.grow input { flex: 1; }
input[type=range] { accent-color: var(--ink); min-width: 180px; }
.controls.tight input[type=range], .slider-l.grow input[type=range] { min-width: 120px; }
select { font: inherit; color: var(--ink); padding: 4px 8px; border-radius: 8px; border: 1px solid var(--base); background: var(--surface); }
label { color: var(--ink2); }
.check { display: inline-flex; align-items: center; gap: 6px; }
.seg { display: inline-flex; border-radius: 10px; box-shadow: 0 0 0 1px var(--base); overflow: hidden; background: var(--surface); }
.seg button { font: 500 0.88rem var(--sans); border: 0; background: transparent; color: var(--ink2); padding: 6px 12px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.seg button + button { box-shadow: -1px 0 0 var(--base); }
.seg button[aria-pressed=true] { background: var(--ink); color: #fff; }
.seg.vertical { flex-direction: column; width: 100%; }
.seg.vertical button { justify-content: flex-start; padding: 8px 12px; text-align: left; }
.seg.vertical button + button { box-shadow: 0 -1px 0 var(--base); }
.seg.frames { width: auto; }
.key { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.key.obs { background: var(--obs); } .key.gen { background: var(--gen); }
.tldr { background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--ring); padding: 16px 20px; margin-top: 18px; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 12px; margin: 1.1rem 0; }
.tiles.four { grid-template-columns: repeat(4, 1fr); }
.tile { background: var(--surface); border-radius: 12px; box-shadow: 0 0 0 1px var(--ring); padding: 14px 16px;
  display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 0; margin-bottom: 12px; }
.tile-l { font-size: 0.85rem; color: var(--ink2); line-height: 1.35; min-height: 2.3em; }
.tile-v { font-size: 2rem; font-weight: 650; margin: 4px 0 2px; }
.tile-d { font-size: 0.82rem; color: var(--muted); line-height: 1.35; }

.diagram { margin: 10px 0 0; background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--ring); padding: 10px; }
.diagram svg { width: 100%; height: auto; display: block; font-family: var(--sans); }
.grp { stroke-width: 1; }
.grp.obs { fill: var(--obs-wash); stroke: #b6d0f0; }
.grp.gen { fill: var(--gen-wash); stroke: #f4c3ac; }
.grp-t { font-size: 13px; font-weight: 650; }
.grp-t.obs { fill: var(--obs-ink); } .grp-t.gen { fill: var(--gen-ink); }
.box { fill: var(--surface); stroke-width: 1.5; }
.box.obs { stroke: var(--obs); } .box.gen { stroke: var(--gen); } .box.io { stroke: var(--base); }
.bt { font-size: 15px; font-weight: 650; fill: var(--ink); text-anchor: middle; }
.bs { font-size: 12.5px; fill: var(--ink2); text-anchor: middle; }
.bt.l, .bs.l { text-anchor: start; }
.el { font-size: 12px; fill: var(--ink2); } .el.gen { fill: var(--gen-ink); }
.edge { fill: none; stroke: var(--ink2); stroke-width: 1.6; }
.edge.gen { stroke: var(--gen); } .edge.dashed { stroke: var(--gen); stroke-dasharray: 6 4; } .edge.dotted { stroke-dasharray: 2 4; }
.node { cursor: pointer; }
.node:hover .box { stroke-width: 2.6; }
.node image { pointer-events: none; }

.toy { display: grid; grid-template-columns: minmax(0, 620px) minmax(260px, 1fr); gap: 22px; background: var(--surface);
  border-radius: 14px; box-shadow: 0 0 0 1px var(--ring); padding: 16px; margin-top: 12px; }
.toy-stage { position: relative; min-width: 0; }
.toy-canvas, .toy-strip { max-width: 100%; }
.toy-canvas { display: block; border-radius: 8px; cursor: crosshair; }
.toy-strip { display: block; border-radius: 3px; box-shadow: 0 0 0 1px var(--grid); }
.strip-l { font-size: 0.78rem; color: var(--muted); margin: 8px 0 4px; }
.toy-tip, .chart-tip { position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 0.8rem;
  padding: 5px 9px; border-radius: 6px; white-space: nowrap; z-index: 5; }
.chart-tip { max-width: calc(100vw - 32px); }
.chart-tip .row span { white-space: normal; }
.notes { display: grid; margin: 12px 0 0; }
.notes > .note { grid-area: 1 / 1; }
.notes > .note[hidden] { display: block !important; visibility: hidden; }   .note { font-size: 0.9rem; color: var(--ink2); line-height: 1.5; }
.readout { display: grid; grid-template-columns: 1fr auto; margin: 14px 0 0; font-size: 0.86rem; border-top: 1px solid var(--grid); }
.readout > div { display: contents; }
.readout dt { color: var(--ink2); padding: 5px 0; border-bottom: 1px solid var(--grid); }
.readout dd { margin: 0; padding: 5px 0; text-align: right; border-bottom: 1px solid var(--grid); font-weight: 600; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px;
  box-shadow: 0 0 0 1px var(--ring); }
.sw.surf { background: var(--obs); } .sw.beh { background: var(--beh); } .sw.unk { background: var(--gen); }
.sw.free { background: var(--free); box-shadow: inset 0 0 0 1px #898781; }
.lab { white-space: nowrap; font-weight: 500; }
.dash-key { display: inline-block; width: 22px; border-top: 2px dashed var(--gen); vertical-align: middle; }
.dia-key { display: inline-block; width: 9px; height: 9px; border: 2px solid var(--gen); transform: rotate(45deg); vertical-align: 0; margin: 0 2px; }
.gt-key { display: inline-block; width: 22px; border-top: 1.5px dotted var(--ink2); vertical-align: middle; }

.stepno { display: inline-grid; place-items: center; width: 1.6em; height: 1.6em; border-radius: 50%; font-size: 0.8em;
  margin-right: 10px; vertical-align: 0.08em; background: var(--ink); color: #fff; }
.stepno.obs { background: var(--obs); } .stepno.gen { background: var(--gen); }
.eq { margin: 1rem 0; padding: 14px 18px; background: var(--surface); border-radius: 10px; box-shadow: 0 0 0 1px var(--ring);
  text-align: center; font-size: 1.12rem; overflow-x: auto; line-height: 1.5; }
.eq .nw { display: inline-block; white-space: nowrap; margin: 0.15em 0.5em; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; margin: 0 4px; }
.frac > span:first-child { border-bottom: 1px solid var(--ink); padding: 0 4px 2px; }
.frac > span:last-child { padding: 2px 4px 0; }
.eq.cases { display: flex; align-items: center; gap: 14px; justify-content: center; text-align: left; }
.cases-t { border-collapse: collapse; border-left: 2px solid var(--ink); font-size: 0.98rem; }
.cases-t td { padding: 4px 12px; white-space: nowrap; }
.cases-t td.cm { white-space: normal; }
.eq .lhs { white-space: nowrap; }
.cases-t td.cm { color: var(--ink2); font-size: 0.86rem; font-family: var(--sans); }
.card { margin: 1.2rem 0; background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--ring); padding: 14px 16px; }
.card figcaption { font-size: 0.88rem; color: var(--ink2); margin-top: 10px; line-height: 1.5; }
.card-controls { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-bottom: 12px; font-size: 0.9rem; }
.slice-row { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 16px; align-items: start; }
.slice-wrap img { width: 100%; image-rendering: pixelated; display: block; border-radius: 6px; box-shadow: 0 0 0 1px var(--grid); }
.slice-side .legend { display: grid; gap: 4px; margin: 12px 0; font-size: 0.86rem; }
.fr-cap { display: none; font-size: 0.8rem; color: var(--muted); margin-bottom: 4px; }
.ring-img { width: 100%; display: block; border-radius: 6px; box-shadow: 0 0 0 1px var(--grid); background: #fff; }
.ring-stat { font-size: 0.88rem; color: var(--ink2); margin: 8px 0 0; font-variant-numeric: tabular-nums; }
.why { padding-left: 1.2em; } .why li { margin: 0.4rem 0; }
.triptych { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.triptych .viewer { box-shadow: 0 0 0 1px var(--grid); }
.vcap { font-size: 0.86rem; color: var(--ink2); text-align: center; margin: 6px 0 0; }
img.full { width: 100%; display: block; }
.qual { display: grid; grid-template-columns: auto repeat(4, minmax(0, 1fr)); gap: 6px 8px; align-items: center; }
.qual img { width: 100%; aspect-ratio: 1; display: block; border-radius: 6px; box-shadow: 0 0 0 1px var(--grid); background: #fff; }
.qual .ql-h { font-size: 0.84rem; color: var(--ink2); text-align: center; font-weight: 600; align-self: end; }
.qual .ql-h.ours { color: var(--obs-ink); }
.qual .ql-r { font-size: 0.84rem; color: var(--ink2); white-space: nowrap; padding-right: 4px; }

.chart-h { font-weight: 650; font-size: 1rem; }
.chart-sub { font-size: 0.84rem; color: var(--ink2); margin: 2px 0 6px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; font-family: var(--sans); overflow: visible; }
.chart .gridl { stroke: var(--grid); stroke-width: 1; }
.chart .basel { stroke: var(--base); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.chart .axis-l { fill: var(--ink2); font-size: 12px; }
.chart .dlabel { fill: var(--ink); font-size: 12.5px; font-weight: 600; }
.chart .dlabel2 { fill: var(--ink2); font-size: 12px; }
.chart .dlabel, .chart .dlabel2 { paint-order: stroke; stroke: var(--surface); stroke-width: 7px; stroke-linejoin: round; }
.chart .xhair { stroke: var(--ink2); stroke-width: 1; }
.chart-tip .row { display: flex; align-items: center; gap: 8px; }
.chart-tip .row i { width: 12px; height: 2px; display: inline-block; border-radius: 1px; }
.chart-tip .row b { font-variant-numeric: tabular-nums; min-width: 3.4em; }
.chart-tip .row span { color: #c3c2b7; }
.chart-tip .hd { color: #c3c2b7; margin-bottom: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.86rem; color: var(--ink2); }
.chart-legend button { border: 0; background: none; font: inherit; color: var(--ink2); display: inline-flex; align-items: center;
  gap: 7px; cursor: pointer; padding: 2px 0; }
.chart-legend button i { width: 16px; height: 2px; border-radius: 1px; display: inline-block; }
.chart-legend button[aria-pressed=false] { opacity: 0.4; text-decoration: line-through; }
.mk-key { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--grid); margin-right: 4px; vertical-align: -1px; }
.table-wrap { overflow-x: auto;
  background: linear-gradient(90deg, var(--surface) 30%, rgba(252, 252, 251, 0)) left / 24px 100% no-repeat local,
    linear-gradient(270deg, var(--surface) 30%, rgba(252, 252, 251, 0)) right / 24px 100% no-repeat local,
    linear-gradient(90deg, rgba(11, 11, 11, 0.12), rgba(11, 11, 11, 0)) left / 10px 100% no-repeat scroll,
    linear-gradient(270deg, rgba(11, 11, 11, 0.12), rgba(11, 11, 11, 0)) right / 10px 100% no-repeat scroll; }
table.res { border-collapse: collapse; width: 100%; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
table.res th, table.res td { padding: 6px 10px; text-align: right; border-bottom: 1px solid var(--grid); white-space: nowrap; }
table.res th:first-child, table.res td:first-child { text-align: left; }
table.res th { color: var(--ink2); font-weight: 600; border-bottom: 1px solid var(--base); }
table.res tr.sep td { border-top: 1px solid var(--base); }
table.res.compact th, table.res.compact td { padding: 6px 6px; }
table.res.compact td:first-child { white-space: normal; min-width: 11em; }
table.res tr.ours td { background: rgba(42, 120, 214, 0.10); }      table.res th:first-child, table.res td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface);
  box-shadow: inset -1px 0 0 var(--grid); }
table.res th:first-child::after, table.res td:first-child::after { content: ""; position: absolute; top: 0; bottom: 0;
  right: -8px; width: 8px; pointer-events: none; background: linear-gradient(90deg, rgba(11, 11, 11, 0.08), rgba(11, 11, 11, 0)); }
table.res tr.ours td:first-child { background: var(--obs-wash); }
table.res tr.ours td:first-child { font-weight: 600; }
.bib { background: var(--surface); box-shadow: 0 0 0 1px var(--ring); border-radius: 10px; padding: 14px 16px; font: 0.82rem/1.5 var(--mono); overflow-x: auto; }
footer { max-width: var(--w); margin: 2rem auto 3rem; padding: 0 22px; color: var(--muted); font-size: 0.85rem; }

@media (max-width: 860px) {
  .teaser-grid, .toy { grid-template-columns: minmax(0, 1fr); }
  .diagram { overflow-x: auto;
    background: linear-gradient(270deg, rgba(11, 11, 11, 0.10), rgba(11, 11, 11, 0)) right / 12px 100% no-repeat scroll,
      var(--surface); }
  .diagram svg { min-width: 860px; }
  .dia-cue { display: block; }
  .seg.vertical.frames { flex-direction: row; width: 100%; }
  .seg.vertical.frames button { flex: 1 1 0; justify-content: center; padding: 6px 0; }
  .seg.vertical.frames button + button { box-shadow: -1px 0 0 var(--base); }
  .seg.frames .lg { display: none; }
  .fr-cap { display: block; }
  .slice-side .legend { display: flex; flex-wrap: wrap; gap: 4px 14px; }
  .slice-side .legend > span { white-space: nowrap; }
  .tiles, .tiles.four { grid-template-columns: 1fr 1fr; }
  .slice-row { grid-template-columns: 1fr; }
  .eq.cases { flex-direction: column; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .qual { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .qual .ql-h:first-child { display: none; }
  .qual .ql-r { grid-column: 1 / -1; padding: 4px 0 0; }
  .qual .ql-h[data-short] { font-size: 0; }
  .qual .ql-h[data-short]::after { content: attr(data-short); font-size: 0.74rem; }
  #ql-objs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  #ql-objs button { justify-content: center; }
  #ql-objs button:nth-child(3) { box-shadow: 0 -1px 0 var(--base); }
  #ql-objs button:nth-child(4) { box-shadow: -1px 0 0 var(--base), 0 -1px 0 var(--base); }
  .bib { white-space: pre-wrap; overflow-wrap: anywhere; }
  .qual { gap: 4px; }
  .qual .ql-h, .qual .ql-r { font-size: 0.72rem; }
  .qual .ql-r { white-space: normal; }
  .cases-t tr { display: grid; grid-template-columns: 1fr auto; }
  .cases-t td.cm { grid-column: 1 / -1; padding-top: 0; }
  .tiles, .tiles.four, .triptych { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  table.res:not(.compact) th:first-child, table.res:not(.compact) td:first-child { white-space: normal; min-width: 7.5em; }
  .controls .seg { flex-wrap: wrap; }
  .controls .seg button { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
