

:root {
  --bg: #fbf9f6;
  --fg: #1d1b19;
  --muted: #5b5751;
  --card: #ffffff;
  --band: #f4f0ea;
  --line: #e0dad1;
  --accent: #002e99;
  --attack: #d32f2f;
  --defended: #002e99;
  --clean: #f5bc7a;
  --clean-text: #b0611f;
  --mirror: #000000;
  --phantom: #d32f2f;
  --phantombg: #f2ad94;
  --real: #b5b5b5;
  --direct: #7e8ec1;
  --reflected: #d97e3d;
  --removed: #002e99;
  --road: #e9e9e9;
  --lane: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.05), 0 4px 16px rgba(0, 0, 0, 0.05);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #121315;
  --fg: #ebe7e1;
  --muted: #a8a39c;
  --card: #1b1c20;
  --band: #16171a;
  --line: #2e3035;
  --accent: #9aa8e0;
  --attack: #ef6b61;
  --defended: #8e9fe0;
  --clean: #f5bc7a;
  --clean-text: #f5bc7a;
  --mirror: #f2f2f2;
  --phantom: #ef5a50;
  --phantombg: #b9786a;
  --real: #6d6d6d;
  --direct: #8e9fe0;
  --reflected: #e39352;
  --removed: #6f8cff;
  --road: #26272b;
  --lane: #4a4b50;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font);
  font-size: 17px; line-height: 1.6; transition: background 0.2s, color 0.2s;
}
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.65rem, 3.3vw, 2.55rem); letter-spacing: -0.01em; text-align: center; margin-top: 0.4em; }
h2 { font-size: clamp(1.4rem, 2.4vw, 1.85rem); margin-top: 0; }
h3 { font-size: 1.15rem; margin-top: 1.4em; }
h4 { font-size: 1rem; margin: 0.2em 0; }
p { margin: 0 0 1em; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 20px; }
.wrap-wide { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
section { padding: 56px 0; }
section.band { background: var(--band); }
.lead { font-size: 1.06rem; }
.hint { color: var(--muted); font-size: 0.93rem; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--card); padding: 8px 12px; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }


.topbar {
  position: sticky; top: 0; z-index: 50; backdrop-filter: saturate(1.4) blur(10px);
  background: color-mix(in srgb, var(--bg) 86%, transparent); border-bottom: 1px solid var(--line);
}
.nav { display: flex; align-items: center; gap: 16px; height: 54px; max-width: 1240px; }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; white-space: nowrap; }
.navlinks { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; overflow-x: auto; flex: 1; scrollbar-width: none; }
.navlinks::-webkit-scrollbar { display: none; }
.navlinks a { display: block; padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 0.93rem; white-space: nowrap; }
.navlinks a:hover { color: var(--fg); background: var(--band); }
.theme-toggle {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--card);
  color: var(--fg); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 0.88rem; cursor: pointer; white-space: nowrap;
}
.theme-icon { width: 14px; height: 14px; border-radius: 50%; background: linear-gradient(90deg, var(--fg) 50%, transparent 50%); border: 1.5px solid var(--fg); }


.hero { padding-top: 28px; }
.authors { text-align: center; font-size: 1.05rem; margin: 0.2em 0 0; }
.venue { text-align: center; color: var(--muted); margin: 0.1em 0 0.8em; font-size: 0.95rem; }
.venue span { margin: 0 0.6em; }
.logo { display: block; margin: 0 auto; }
.claim { text-align: center; font-size: 1.12rem; max-width: 760px; margin: 0.6em auto 1em; }
.buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 0 0 26px; }
.btn, button {
  font: inherit; font-size: 0.95rem; border: 1px solid var(--line); background: var(--card); color: var(--fg);
  border-radius: 999px; padding: 7px 16px; text-decoration: none; cursor: pointer; line-height: 1.3;
}
.btn:hover, button:hover:not(:disabled) { border-color: var(--muted); }
.btn.primary, button.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.btn.disabled { color: var(--muted); cursor: default; border-style: dashed; }
button:disabled { opacity: 0.5; cursor: default; }

.media-box { position: relative; width: 100%; background: #0f1012; border-radius: var(--radius); overflow: hidden; }
.media-box video, .media-box img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.teaser { margin: 0 auto; }
.teaser figcaption { margin-top: 10px; color: var(--muted); font-size: 0.92rem; text-align: center; }
.teaser-split { display: none; }
.teaser-split .half { position: relative; margin-bottom: 10px; }
.teaser-split video { object-fit: cover !important; }
.teaser-split .half-left { object-position: 0% 50%; }
.teaser-split .half-right { object-position: 100% 50%; }
.tag { display: inline-block; margin-top: 4px; font-size: 0.85rem; font-weight: 600; }
.tag-attack { color: var(--attack); }
.tag-defended { color: var(--defended); }
@media (max-width: 700px) {
  .teaser-wide { display: none; }
  .teaser-split { display: block; }
}

.tldr { margin-top: 30px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 24px 8px; box-shadow: var(--shadow); }
.tldr h2 { font-size: 1.1rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.tldr ul { padding-left: 1.2em; margin: 0 0 0.8em; }
.tldr li { margin-bottom: 0.45em; }


.attack-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 24px; align-items: start; margin: 18px 0 8px; }
@media (max-width: 860px) { .attack-grid { grid-template-columns: 1fr; } }
.canvas-box { position: relative; width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.canvas-box canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.steps { padding-left: 1.3em; margin: 0 0 12px; }
.steps li { margin-bottom: 0.5em; color: var(--muted); transition: color 0.2s; }
.steps li.active { color: var(--fg); font-weight: 600; }
.controls { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 8px; }
.sw { display: inline-block; flex: none; }
.sw-line { width: 26px; height: 0; border-top: 3px solid; }
.sw-direct { border-color: var(--direct); }
.sw-reflected { border-color: var(--reflected); border-top-style: dashed; }
.sw-cont { border-color: var(--phantom); border-top-style: dotted; }
.sw-bar { width: 26px; height: 6px; background: var(--mirror); border-radius: 2px; }
.sw-dot { width: 11px; height: 11px; border-radius: 50%; }
.sw-phantom { background: var(--phantom); }
.sw-box { width: 22px; height: 12px; border-radius: 3px; background: var(--fg); opacity: 0.8; }
.sw-other { background: var(--real); }
.sw-board { background: var(--mirror); box-shadow: 0 0 0 1px var(--line); }
.sw-phantombg { background: var(--phantombg); }
.sw-removed { background: var(--removed); }


.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 20px 0 26px; }
@media (max-width: 900px) { .cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { margin: 0.35em 0 0.3em; font-size: 1.05rem; }
.card p { font-size: 0.93rem; margin: 0; }
.num { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--fg); color: var(--bg); font-weight: 700; font-size: 0.85rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.panel h3 { margin-top: 0; }
.panel .canvas-box { border: none; border-radius: 8px; background: var(--band); }
.status { font-weight: 600; margin: 10px 0 0; min-height: 3.2em; }
.status.through { color: var(--attack); }
.status.direct { color: var(--muted); }
.slider-row { display: grid; grid-template-columns: 1fr; gap: 6px; font-size: 0.93rem; margin-bottom: 8px; }
.slider-row input { width: 100%; accent-color: var(--accent); }
.slider-row output { font-family: var(--mono); }
.pass-bars { display: grid; gap: 8px; margin: 8px 0 6px; }
.pass-row { display: grid; grid-template-columns: 150px 1fr 48px; align-items: center; gap: 10px; font-size: 0.9rem; }
.pass-track { height: 14px; background: var(--band); border-radius: 7px; overflow: hidden; }
.pass-fill { height: 100%; border-radius: 7px; transition: width 0.15s; }
.pass-fill.single { background: var(--real); }
.pass-fill.double { background: var(--phantom); }
.pass-row output { font-family: var(--mono); text-align: right; }
.scale-title { font-size: 0.98rem; margin-top: 1.2em; }
.scale-box svg { width: 100%; height: auto; display: block; overflow: visible; }


.pipeline { display: flex; align-items: stretch; gap: 0; margin: 22px 0 10px; }
.io, .phase { border-radius: var(--radius); padding: 12px 14px; }
.io { flex: 0 0 130px; display: grid; place-items: center; text-align: center; font-size: 0.88rem; background: var(--card); border: 1.5px dashed var(--muted); }
.phase { flex: 1; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow); }
.phase-name { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.phase p { font-size: 0.9rem; margin: 0.2em 0 0; }
.phase-1 { border-top: 4px solid var(--direct); }
.phase-2 { border-top: 4px solid var(--phantom); }
.phase-3 { border-top: 4px solid var(--defended); }
.arrow { flex: 0 0 26px; position: relative; }
.arrow::after { content: ""; position: absolute; top: 50%; left: 50%; transform: translate(-40%, -50%); border: 8px solid transparent; border-left: 11px solid var(--muted); }
.pipeline > .arrow:last-of-type { flex-basis: 26px; }
@media (max-width: 860px) {
  .pipeline { flex-direction: column; }
  .io { flex-basis: auto; }
  .arrow { flex-basis: 24px; }
  .arrow::after { transform: translate(-50%, -30%) rotate(90deg); }
}
.facts { padding-left: 1.2em; }
.stats, .bignums { display: grid; gap: 12px; }
.stats { grid-template-columns: repeat(4, 1fr); }
.bignums { grid-template-columns: repeat(5, 1fr); margin: 18px 0 26px; }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, 1fr); } .bignums { grid-template-columns: repeat(2, 1fr); } }
.stat, .big { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.stat-v, .big-v { font-size: 1.6rem; font-weight: 750; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.big-v { color: var(--defended); }
.stat-l, .big-l { font-size: 0.86rem; color: var(--muted); line-height: 1.35; }


.viewer { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin: 10px 0 18px; }
.viewer-stage { position: relative; aspect-ratio: 16 / 8; background: var(--band); }
@media (max-width: 700px) { .viewer-stage { aspect-ratio: 4 / 5; } }
.viewer-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; outline: none; }
.viewer-cover { position: absolute; inset: 0; display: grid; place-content: center; gap: 10px; text-align: center; z-index: 3; background: var(--band); }
.viewer-cover[hidden] { display: none; }
.viewer-msg { color: var(--muted); font-size: 0.92rem; margin: 0; min-height: 1.5em; }
.hud {
  position: absolute; top: 12px; left: 12px; z-index: 2; background: color-mix(in srgb, var(--card) 88%, transparent);
  border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 0.84rem; line-height: 1.45; min-width: 230px;
  font-variant-numeric: tabular-nums; pointer-events: none;
}
.hud:empty { display: none; }
.hud b { font-size: 0.95rem; }
.hud .win-in { color: var(--attack); font-weight: 600; }
.hud .row { display: flex; justify-content: space-between; gap: 14px; }
.viewer-legend { position: absolute; bottom: 12px; left: 12px; z-index: 2; background: color-mix(in srgb, var(--card) 88%, transparent); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 0.8rem; }
@media (max-width: 700px) { .hud { min-width: 0; font-size: 0.76rem; padding: 6px 8px; } .viewer-legend { font-size: 0.72rem; padding: 5px 8px; gap: 1px; } }
.viewer-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px; border-top: 1px solid var(--line); font-size: 0.9rem; }
.range-wrap { flex: 1 1 180px; display: flex; }
.range-wrap input { width: 100%; accent-color: var(--accent); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { border: none; border-radius: 0; padding: 6px 12px; background: var(--card); font-size: 0.86rem; }
.seg button[aria-checked="true"] { background: var(--fg); color: var(--bg); }
.check, .select { display: inline-flex; align-items: center; gap: 6px; }
select { font: inherit; font-size: 0.86rem; background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }


.gallery { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 18px 0 12px; }
@media (max-width: 760px) { .gallery { grid-template-columns: 1fr; } }
.vcard { margin: 0; }
.vcard figcaption { font-size: 0.9rem; margin-top: 8px; color: var(--muted); }
.vtitle { font-weight: 700; color: var(--fg); display: block; }
.vcard-attack .vtitle { color: var(--attack); }
.vcard-defended .vtitle { color: var(--defended); }
.vcard-clean .vtitle { color: var(--clean-text); }
.chart-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 6px; box-shadow: var(--shadow); margin: 16px 0 20px; }
.chart-card h3 { margin-top: 0; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tabs button { font-size: 0.88rem; padding: 5px 12px; }
.tabs button[aria-selected="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.85rem; color: var(--muted); margin: 4px 0 6px; min-height: 1.4em; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-box { position: relative; width: 100%; }
@media (max-width: 600px) { .chart-box { aspect-ratio: 4 / 3 !important; } }
.chart-box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.chart-box svg text { fill: var(--muted); font-family: var(--font); }
.tooltip { position: absolute; z-index: 5; pointer-events: none; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 9px; font-size: 0.8rem; box-shadow: var(--shadow); white-space: nowrap; font-variant-numeric: tabular-nums; }
#resMetric { margin: 4px 0 6px; flex-wrap: wrap; }


.rearend-slot { margin: 16px 0 0; }
.slot-badge { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: rgba(0, 0, 0, 0.72); color: #fff; padding: 8px 16px; border-radius: 999px; font-size: 0.92rem; text-align: center; max-width: 90%; }
.rearend-slot figcaption { color: var(--muted); font-size: 0.92rem; margin-top: 8px; }
.rearend-videos { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 760px) { .rearend-videos { grid-template-columns: 1fr; } }

.limits { color: var(--muted); font-size: 0.93rem; border-left: 3px solid var(--line); padding-left: 12px; }
.bib { position: relative; }
.bib pre { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; overflow-x: auto; font-family: var(--mono); font-size: 0.85rem; line-height: 1.5; margin: 0; }
.bib button { position: absolute; top: 10px; right: 10px; font-size: 0.8rem; padding: 4px 10px; }
.footer { border-top: 1px solid var(--line); padding: 26px 0 40px; color: var(--muted); font-size: 0.86rem; }
.viewer-legend .sw-other { background: #6f6c69; }
[data-theme="dark"] .viewer-legend .sw-other { background: #a9a9a9; }
.viewer-legend .sw-removed { background: #002e99; }
[data-theme="dark"] .viewer-legend .sw-removed { background: #6f8cff; }
.bscale { margin: 6px 0 8px; font-size: 0.84rem; }
.brow { margin-bottom: 6px; }
.blabel { color: var(--fg); line-height: 1.3; margin-bottom: 3px; }
.btrack { position: relative; height: 14px; }
.bgrid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.bband { position: absolute; top: 2px; height: 10px; border-radius: 3px; min-width: 4px; margin-left: -2px; }
.bband.fill.ph { background: var(--phantom); }
.bband.fill.mirror { background: var(--mirror); }
.bband.outline.ph { border: 2px solid var(--phantom); }
.bband.tick { width: 0 !important; min-width: 0; top: -2px; height: 18px; border-left: 3px solid var(--fg); margin-left: -1px; border-radius: 0; }
.bband.tick.dash { border-left-style: dotted; }
.baxis { position: relative; height: 18px; color: var(--muted); font-size: 0.78rem; }
.baxis span { position: absolute; transform: translateX(-50%); }
.baxis span:first-child { transform: none; }
.stats + .hint { margin-top: 12px; }
.big-v { color: var(--fg); }
.pass-row { grid-template-columns: 170px 1fr 48px; }
@media (max-width: 520px) { .pass-row { grid-template-columns: 110px 1fr 40px; } }
.sw-sensor { background: #7e8ec1; }
[data-theme="dark"] .sw-sensor { background: #9aa8e0; }
.sw-grad { width: 34px; height: 10px; border-radius: 3px; background: linear-gradient(90deg, #440154, #3b528b, #21918c, #5ec962, #fde725); }
.legend li[hidden] { display: none; }
@media (max-width: 700px) {
  .viewer-stage { aspect-ratio: 3 / 4; }
  .hud { font-size: 0.68rem; line-height: 1.35; max-width: 70%; top: 8px; left: 8px; }
  .hud b { font-size: 0.78rem; }
  .viewer-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 1px 10px; font-size: 0.66rem; left: 8px; right: 8px; bottom: 8px; }
  .viewer-legend .sw-dot { width: 8px; height: 8px; }
}
@media (max-width: 520px) { .slot-badge { font-size: 0.74rem; padding: 5px 10px; bottom: 8px; border-radius: 10px; max-width: 94%; } }
.formula { font-family: "Latin Modern Math", "STIX Two Math", Cambria, "Times New Roman", serif; font-size: 1.15rem; text-align: center; margin: 4px 0 10px; }
.pass-fill.obj { background: var(--phantombg); }
.pass-track { position: relative; }
.pass-meas { position: absolute; top: -3px; bottom: -3px; min-width: 4px; background: repeating-linear-gradient(90deg, var(--fg) 0 2px, transparent 2px 4px); opacity: 0.55; border-radius: 2px; z-index: 1; }
.pass-fill { position: relative; }
output.in-band { color: var(--phantom); font-weight: 700; }
.meas-note { display: flex; align-items: center; gap: 8px; margin: 4px 0 6px; }
.meas-sw { width: 14px; height: 14px; flex: none; background: repeating-linear-gradient(90deg, var(--fg) 0 2px, transparent 2px 4px); opacity: 0.55; border-radius: 2px; }
.sw-path { border-color: var(--clean); border-top-style: dashed; border-top-width: 4px; }
.pass-track { overflow: visible; }
.pass-row { grid-template-columns: 1fr 52px !important; row-gap: 3px; }
.pass-row .pass-label { grid-column: 1 / -1; }
.pass-meas { z-index: 2; top: -4px; bottom: -4px; background: transparent; opacity: 1; border: 2px solid var(--fg); border-radius: 3px; box-sizing: border-box; }
.meas-sw { background: transparent; border: 2px solid var(--fg); opacity: 1; width: 12px; height: 16px; }
.setup { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 16px; margin: 6px 0 16px; box-shadow: var(--shadow); }
.setup summary { cursor: pointer; font-weight: 700; padding: 2px 0; }
.setup-grid { display: grid; grid-template-columns: max-content 1fr max-content 1fr; gap: 4px 14px; margin: 8px 0 6px; font-size: 0.9rem; }
.setup-grid dt { color: var(--muted); font-weight: 600; }
.setup-grid dd { margin: 0; }
.setup .hint { margin: 4px 0 2px; font-size: 0.82rem; }
.setup-field .setup-grid { grid-template-columns: max-content 1fr; }
@media (max-width: 900px) { .setup-grid { grid-template-columns: max-content 1fr; } }
@media (max-width: 520px) { .setup-grid { grid-template-columns: 1fr; gap: 0 0; } .setup-grid dd { margin-bottom: 6px; } }
.rearend-player .pair-tags { display: flex; justify-content: space-between; margin-bottom: 6px; }
.rearend-player .tag { font-size: 0.95rem; }
.rearend-sel { margin: 10px auto 0; display: flex; width: max-content; max-width: 100%; flex-wrap: wrap; }
#rearend .setup { margin-top: 0; }
.rearend-note { text-align: center; margin: 10px auto 6px; max-width: 760px; }
.rearend-drive { text-align: center; font-size: 0.95rem; margin: 8px 0 0; min-height: 1.5em; }
.rearend-drive { margin-bottom: 14px; }
.demo-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 24px; align-items: center; max-width: 900px; margin: 0 auto; }
.demo-split .demo-text h3 { margin-top: 0; }
.demo-split .canvas-box { border: none; border-radius: 8px; background: var(--band); }
@media (max-width: 760px) { .demo-split { grid-template-columns: 1fr; } }

.viewer {
  --bg: #121315; --fg: #ebe7e1; --muted: #a8a39c; --card: #1b1c20; --band: #16171a; --line: #2e3035;
  --accent: #9aa8e0; --phantom: #ff5a4f; --phantombg: #d08a78; --mirror: #ffffff; --removed: #6f8cff;
  color-scheme: dark; color: var(--fg); background: var(--card); border-color: var(--line);
}
.viewer .viewer-legend .sw-other { background: #b9b9b9; }
.viewer .viewer-legend .sw-board { background: #ffffff; box-shadow: none; }
.viewer .viewer-legend .sw-removed { background: #6f8cff; }
.viewer .viewer-legend .sw-sensor { background: #9aa8e0; }
.viewer .viewer-legend .sw-phantombg { background: #d08a78; }
.viewer button.primary { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.viewer .hud .win-in { color: #ff7a70; }
