:root {
  color-scheme: light;
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --paper: #f6f6f3;
  --stage: #f9f9f7;
  --text: #20231e;
  --muted: #555d51;
  --rule: #d3d6cd;
  --accent: #35442b;
  background: var(--paper);
  color: var(--text);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main, .mast { width: min(1500px, 100%); margin: auto; padding: 0 clamp(12px, 3vw, 38px); }
a { color: var(--accent); }
.mast { padding-block: 14px 12px; }
.mast a { font-size: 13px; text-decoration: none; }
.mast a:hover { text-decoration: underline; }
h1 { font-size: clamp(24px, 4vw, 40px); line-height: 1.1; letter-spacing: -.045em; margin: 8px 0 0; }
body[data-embed] .mast { display: none; }
body[data-embed] main { padding: 0; }
button, select, input { font: inherit; color: inherit; }
button, select { min-height: 44px; }
button, select {
  border: 1px solid var(--rule);
  border-radius: 7px;
  background: var(--stage);
  padding: 5px 11px;
  cursor: pointer;
}
button:focus-visible, select:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #346995; outline-offset: 2px; }
button:disabled, select:disabled { cursor: default; opacity: .52; }
button[aria-pressed="true"] { background: var(--accent); color: white; border-color: var(--accent); }
.settings { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; padding: 0 0 8px; }
.settings label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); min-width: 0; }
.settings select { letter-spacing: 0; font-size: 14px; color: var(--text); max-width: 100%; }
.layouts { display: flex; gap: 3px; margin-left: auto; }
.cameras { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 0 8px; }
.cameras button { font-size: 13px; padding-inline: 10px; }
.stage { position: relative; display: flex; height: clamp(370px, 64svh, 760px); isolation: isolate; background: var(--stage); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
body[data-embed] .stage { height: clamp(370px, calc(100svh - 215px), 650px); }
.pane { width: 50%; height: 100%; min-width: 0; margin: 0; position: relative; }
.pane.comparison { border-right: 1px solid var(--rule); }
.pane > canvas, #model-scene, #model-scene canvas { width: 100%; height: 100%; display: block; }
#model-scene canvas { cursor: grab; touch-action: none; }
#model-scene canvas:active { cursor: grabbing; }
.pane figcaption { position: absolute; top: 8px; left: 8px; max-width: calc(100% - 16px); background: var(--stage); padding: 3px 6px; border-radius: 4px; font-size: 12px; font-weight: 600; pointer-events: none; }
.empty { position: absolute; inset: 42px 12px 12px; display: grid; place-items: center; text-align: center; margin: 0; color: var(--muted); }
.divider { display: none; }
.stage[data-mode="wipe"] .primary, .stage[data-mode="orbit"] .primary { width: 100%; }
.stage[data-mode="orbit"] .comparison { display: none; }
.stage[data-mode="wipe"] .comparison { position: absolute; inset: 0; width: 100%; z-index: 1; clip-path: inset(0 calc(100% - var(--split, 50%)) 0 0); pointer-events: none; border: 0; }
.stage[data-mode="wipe"] .primary figcaption { left: auto; right: 8px; }
.stage[data-mode="wipe"] .divider { display: block; position: absolute; inset: 0 auto 0 var(--split, 50%); width: 2px; background: #36402f; z-index: 2; pointer-events: none; }
.understage { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; padding: 8px 0 0; }
.understage output, .note { color: var(--muted); font-size: 12px; }
.wipe { display: flex; flex: 1 1 170px; align-items: center; gap: 8px; }
.wipe input { width: 100%; min-height: 44px; accent-color: var(--accent); }
.note { margin: 5px 0 10px; }
@media (max-width: 640px) {
  .settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .layouts { grid-column: 1 / -1; margin-left: 0; }
  .layouts button { flex: 1; }
  .cameras { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .cameras button { padding-inline: 4px; }
  .stage { height: clamp(315px, 54svh, 515px); }
  body[data-embed] .stage { height: clamp(315px, calc(100svh - 385px), 515px); }
  .pane figcaption { font-size: 11px; }
}
