:root {
  color-scheme: light;
  --page: #f1f1f1;
  --panel: #fafafa;
  --stroke: #d3d3d3;
  --text: #242424;
  --muted: #666;
  --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing:border-box; }
[hidden] { display:none !important; }
body { margin:0; color:var(--text); background:var(--page); }
h1,h2,p { margin:0; }
button { font:inherit; color:inherit; cursor:pointer; -webkit-tap-highlight-color:transparent; }
button:focus-visible { outline:2px solid #343434; outline-offset:3px; }
button:disabled { opacity:.42; cursor:default; }
.shell { max-width:1780px; margin:auto; padding:26px clamp(14px,3.3vw,56px) 24px; }
.masthead,.toolbar,.dock-title,.desk-title,.desk-head,.desk-foot,.tools,.telemetry,.inspect-head,.inspect-buttons { display:flex; align-items:center; }
.masthead { justify-content:space-between; gap:14px; margin-bottom:20px; }
h1 { font-size:clamp(21px,2vw,29px); line-height:1.2; letter-spacing:-.04em; }
.toolbar { gap:8px; flex-wrap:wrap; }
.toolbar button,.inspect button,.desk-head button,.tools button {
  min-height:44px; border:1px solid var(--stroke); border-radius:7px; background:#fff; padding:0 12px; font-size:13px; font-weight:600;
}
button:not(:disabled):hover { filter:brightness(.96); }
.segments { display:flex; gap:2px; padding:3px; border:1px solid var(--stroke); border-radius:9px; background:#e9e9e9; }
.segments button { border:0; min-height:44px; background:transparent; color:#585858; border-radius:5px; }
.segments button[aria-pressed=true] { color:#222; background:#fff; box-shadow:0 0 0 1px #d3d3d3; }
.toolbar .primary { color:#fff; background:#292929; border-color:#292929; }
.primary span { margin-right:3px; font-size:16px; }

.workspace { display:grid; grid-template-columns:240px minmax(0,1fr); gap:15px; align-items:start; }
.dock,.desk { min-width:0; background:var(--panel); border:1px solid var(--stroke); border-radius:11px; }
.dock { padding:15px 12px 12px; }
.dock-title,.inspect-head { justify-content:space-between; gap:8px; }
.dock-title h2,.desk-title h2 { font-size:15px; }
.dock-title span,.desk-title .spec { font:12px/1.3 var(--mono); color:var(--muted); }
.dock-hint,.inspect p { font-size:12px; line-height:1.55; color:var(--muted); }
.dock-hint { margin:7px 0 12px; }
.token-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.token {
  display:grid; place-items:center; position:relative; min-height:64px; min-width:0;
  width:100%; padding:2px; border:1px solid var(--stroke); border-radius:7px; background:#f4f4f4; touch-action:none; cursor:grab;
}
.token:active { cursor:grabbing; }
.token.is-active { border-color:#999; }
.token[aria-pressed=true] { border-color:#333; background:#fff; box-shadow:inset 0 0 0 1px #333; }
.token.is-active::after { content:""; position:absolute; top:7px; right:7px; width:5px; height:5px; border-radius:50%; background:#555; }
.puck-art { display:block; width:57px; height:auto; pointer-events:none; }
.inspect { border-top:1px solid var(--stroke); margin-top:14px; padding-top:11px; }
.inspect-head { font-size:12px; font-weight:600; }
.inspect-head output { font:12px var(--mono); }
.inspect-buttons { gap:6px; margin:7px 0 5px; }
.inspect button { flex:1; padding:0 3px; white-space:nowrap; }
.inspect p { font-size:11px; }

.desk { overflow:hidden; }
.desk-head,.desk-foot { justify-content:space-between; gap:8px; padding:4px 10px; min-height:54px; }
.desk-title,.telemetry,.tools { gap:8px; }
.desk-title .spec { border-left:1px solid #ccc; padding-left:8px; white-space:nowrap; font-size:11px; }
.live-dot { display:inline-block; flex:none; width:6px; height:6px; border-radius:50%; background:#525252; }
.desk-head button,.tools button { padding:0 9px; white-space:nowrap; }
.stage {
  aspect-ratio:16 / 9; background:#eaeaea; width:100%; position:relative; overflow:hidden;
  isolation:isolate; touch-action:none; user-select:none; container-type:inline-size;
}
.stage-viewport { width:100%; }
/* Fullscreen's UA rules force the outer element to fill the display.
   Keep the actual touch surface inside it, uniformly scaled and letterboxed. */
.stage-viewport:fullscreen { display:grid; place-items:center; background:#101010; overflow:hidden; }
.stage-viewport:fullscreen .stage {
  width:min(100vw,var(--stage-width-at-full-height));
  height:min(100vh,var(--stage-height-at-full-width));
}
.stage-viewport::backdrop { background:#101010; }
.stage > canvas { position:absolute; inset:0; width:100%; height:100%; pointer-events:none; }
#fx { z-index:4; }
.content {
  position:absolute; z-index:5; top:6%; right:5%; width:25%; padding:1.4cqw; display:grid;
  grid-template-columns:1.15fr 1fr; gap:1.1cqw; border-radius:.5cqw;
  border:1px solid #aaa; background:#f7f7f7; pointer-events:none;
}
.content.left { right:auto; left:5%; }
.placeholder-copy,.placeholder-caption { display:grid; align-content:center; gap:.58cqw; }
.placeholder-copy i,.placeholder-caption i { width:91%; height:.32cqw; min-height:1px; border-radius:1px; background:#bbb; }
.placeholder-copy i:first-child { width:59%; height:.59cqw; margin-bottom:.41cqw; background:#969696; }
.placeholder-copy i:last-child,.placeholder-caption i:last-child { width:74%; }
.placeholder-figure { aspect-ratio:1.6; border-radius:.25cqw; background:#d0d0d0; }
.placeholder-caption { grid-column:1 / -1; }
.drag-ghost {
  position:fixed; z-index:30; pointer-events:none; aspect-ratio:1; border-radius:50%;
  transform:translate(-50%,-50%); background:rgba(255,255,255,.62);
  border:1px solid rgba(45,45,45,.38);
  box-shadow:0 6px 20px #2223,inset 0 0 0 3px #fff7;
  backdrop-filter:blur(2px);
}
.drag-ghost .puck-art { width:100%; height:100%; rotate:var(--ghost-angle); opacity:.72; }
.telemetry { min-width:0; color:#3c3c3c; font-size:12px; flex-wrap:wrap; }
.switch { width:22px; height:13px; display:inline-block; position:relative; border-radius:10px; border:1px solid #777; vertical-align:middle; margin-right:2px; background:#ddd; }
.switch::after { content:""; position:absolute; width:7px; height:7px; border-radius:50%; top:2px; left:2px; background:#666; }
#debug[aria-pressed=true] .switch { background:#4c4c4c; border-color:#4c4c4c; }
#debug[aria-pressed=true] .switch::after { left:11px; background:#fff; }

@media (max-width: 950px) {
  .shell { padding:19px 14px; }
  .workspace { grid-template-columns:190px minmax(0,1fr); gap:9px; }
  .dock { padding:12px 8px; }
  .desk-head,.desk-foot { padding-left:7px; padding-right:7px; }
}
@media (max-width: 730px) {
  .masthead { flex-wrap:wrap; margin-bottom:12px; }
  .workspace { grid-template-columns:minmax(0,1fr); }
  .dock { padding:10px 9px; }
  .token-list { grid-template-columns:repeat(4,minmax(0,1fr)); }
  .inspect { display:flex; align-items:center; justify-content:space-between; gap:6px; margin-top:9px; padding-top:7px; }
  .inspect-head { gap:7px; min-width:85px; }
  .inspect p { display:none; }
  .inspect-buttons { margin:0; }
  .inspect button { min-width:44px; }
}
@media (max-width: 490px) {
  .token { min-height:52px; }
  .token .puck-art { width:49px; }
  .desk-title .spec { font-size:9px; }
  .desk-head button span { display:none; }
  .desk-foot .tools { gap:5px; }
  .desk-foot .tools button { padding:0 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before,*::after { transition-duration:.01ms !important; }
}

.stage[data-pointer-action=slide] { cursor:grabbing; }
.stage[data-pointer-action=rotate] { cursor:ew-resize; }
.stage.noise-tool { cursor:crosshair; }
.inspect kbd { font:inherit; border:1px solid #ccc; border-radius:3px; padding:0 3px; background:#fff; }

/* A calm workbench around the text-free exhibition surface. */
:root { --page:#f7f7f7; --panel:#fff; --stroke:#dedede; --text:#292929; }
.shell { max-width:1880px; padding:30px clamp(18px,3vw,58px) 20px; }
.masthead { margin-bottom:30px; }
.brand { display:flex; align-items:center; gap:15px; }
.brand-mark { width:42px; height:42px; border:1px solid #aaa; border-radius:50%; position:relative; }
.brand-mark i { position:absolute; width:5px; height:5px; background:#333; border-radius:50%; }
.brand-mark i:nth-child(1) { left:16px; top:9px; }
.brand-mark i:nth-child(2) { left:10px; top:25px; }
.brand-mark i:nth-child(3) { right:8px; top:21px; }
.eyebrow { font:9px/1.3 var(--mono); color:#777; letter-spacing:.16em; margin-bottom:6px; }
h1 { font-size:23px; letter-spacing:.02em; font-weight:600; }
h1 span { font-size:13px; font-weight:400; color:#737373; margin-left:15px; padding-left:15px; border-left:1px solid #ccc; }
.toolbar button { font-weight:500; font-size:12px; border-radius:8px; }
.segments { background:#eee; border:0; }
.segments button[aria-pressed=true] { box-shadow:0 1px 5px #0001; }
.workspace { grid-template-columns:196px minmax(0,1fr); gap:24px; }
.dock { padding:18px 13px 14px; background:transparent; border:0; border-radius:0; }
.dock-title h2 { font-size:14px; font-weight:600; }
.dock-hint { font-size:11px; line-height:1.8; margin-top:12px; margin-bottom:18px; }
.token-list { gap:9px; }
.token { height:76px; background:#fff; border-color:#ddd; border-radius:11px; transition:background .18s,box-shadow .18s,border-color .18s; }
.token:hover { background:#fff; border-color:#aaa; box-shadow:0 4px 12px #00000008; }
.token[aria-pressed=true] { box-shadow:0 0 0 1px #555; border-color:#555; }
.puck-art { width:62px; }
.inspect { margin-top:22px; padding-top:15px; }
.inspect-head { font-size:11px; }
.inspect-buttons { margin-top:12px; margin-bottom:10px; }
.inspect button { min-height:38px; font-size:11px; font-weight:400; }
.inspect p { font-size:10px; line-height:1.85; }
.desk { border-radius:16px; box-shadow:0 14px 45px #00000006; }
.scene-tabs { display:grid; grid-template-columns:repeat(3,1fr); gap:5px; background:#f2f2f2; padding:7px; border-bottom:1px solid #ddd; }
.scene-tabs button { display:flex; align-items:center; gap:11px; padding:13px 18px; min-height:52px; border:1px solid transparent; border-radius:10px; background:transparent; font-size:13px; color:#666; transition:background .2s,box-shadow .2s; }
.scene-tabs button span { font:11px var(--mono); color:#909090; }
.scene-tabs button i { font-style:normal; font-size:20px; margin-left:auto; color:#888; }
.scene-tabs button[aria-pressed=true] { background:#fff; border-color:#ddd; color:#252525; box-shadow:0 2px 5px #00000005; }
.scene-tabs button[aria-pressed=true] span,.scene-tabs button[aria-pressed=true] i { color:#333; }
.desk-head { min-height:48px; padding:3px 17px; }
.desk-title h2 { font-size:11px; font-weight:500; }
.desk-title .live-dot { width:4px; height:4px; background:#777; }
.desk-title .spec { font-size:9px; color:#777; }
.desk-head button { border:0; font-size:11px; background:transparent; font-weight:400; }
.stage { background:#eee; }
.stage:focus-visible { outline:2px solid #777; outline-offset:-3px; }
.experience-strip { display:flex; align-items:center; gap:9px; padding:13px 17px; border-top:1px solid #d5d5d5; }
.status-spark { height:5px; width:5px; border-radius:50%; background:#5c5c5c; }
.experience-strip p { font-size:11px; line-height:1.5; color:#555; }
.desk-foot { border-top:1px solid #eee; min-height:45px; padding:2px 15px; }
.telemetry { font-size:10px; gap:6px; color:#666; }
.telemetry .live-dot { width:4px; height:4px; background:#888; }
.tools button { border:0; background:transparent; font-size:10px; font-weight:400; min-height:40px; }
.guide { margin:24px 0 0 220px; display:flex; align-items:center; justify-content:space-between; gap:20px; }
.guide > div { display:flex; gap:20px; align-items:baseline; }
.guide-label { font-size:11px; color:#383838; white-space:nowrap; }
.guide p { color:#666; font-size:11px; line-height:1.8; max-width:640px; }
.guide button { padding:0 14px; min-height:42px; border-radius:8px; border:1px solid #ccc; background:#fff; font-size:11px; white-space:nowrap; }
.guide button span { margin-left:12px; }
.page-foot { margin:36px 0 0 220px; display:flex; gap:20px; justify-content:space-between; color:#777; font-size:10px; border-top:1px solid #e2e2e2; padding-top:17px; }
.page-foot a { color:#666; text-underline-offset:4px; }
.drag-ghost { background:#ffffff9c; box-shadow:0 9px 24px #0002,inset 0 0 0 3px #ffffff70; }
@media(min-width:1600px) { .token { height:86px; } .workspace { grid-template-columns:220px minmax(0,1fr); } .guide,.page-foot { margin-left:244px; } }
@media(max-width:1050px) {
  .shell { padding:20px 18px; }
  .workspace { gap:14px; grid-template-columns:165px minmax(0,1fr); }
  .dock { padding-left:0; padding-right:0; }
  .toolbar { gap:4px; } .toolbar button { padding:0 8px; }
  .brand { gap:10px; } .brand-mark { display:none; } h1 { font-size:20px; }
  h1 span { margin-left:10px; padding-left:10px; }
  .guide,.page-foot { margin-left:179px; } .guide > div { display:block; } .guide p { margin-top:5px; }
}
@media(max-width:730px) {
  .masthead { gap:18px; margin-bottom:15px; } .toolbar { width:100%; }
  .workspace { grid-template-columns:minmax(0,1fr); gap:14px; }
  .dock { padding:0; } .dock-title { margin-bottom:8px; } .dock-hint { margin:4px 0 10px; }
  .token-list { grid-template-columns:repeat(8,minmax(0,1fr)); gap:5px; }
  .token { height:55px; min-height:45px; border-radius:7px; } .puck-art { width:100%; max-width:50px; }
  .inspect { margin-top:10px; padding-top:8px; } .inspect-buttons { margin:0; }
  .scene-tabs button { padding:10px; gap:6px; font-size:12px; } .scene-tabs button i { display:none; }
  .guide,.page-foot { margin-left:0; } .page-foot { gap:10px; flex-wrap:wrap; margin-top:24px; }
  .guide { margin-top:15px; gap:10px; } .guide p { font-size:10px; }
}
@media(max-width:420px) {
  .shell { padding:15px 12px; }
  .toolbar { flex-wrap:wrap; } .toolbar button { min-height:40px; font-size:11px; }
  .token-list { grid-template-columns:repeat(4,minmax(0,1fr)); } .token { height:53px; }
  .scene-tabs button { font-size:11px; padding:8px; }
  .desk-head { padding:2px 10px; }.desk-title .spec { font-size:8px; }
  .guide { flex-wrap:wrap; }.guide button { width:100%; }
}

.diagnostics { margin-top:16px; background:var(--panel); border:1px solid var(--stroke); border-radius:11px; padding:18px; }
.diagnostic-head,.diagnostic-controls { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.diagnostic-head { justify-content:space-between; margin-bottom:12px; }
.diagnostic-head h2 { font-size:20px; margin-bottom:4px; }
.diagnostics p { color:#505050; font-size:12px; line-height:1.55; }
.diagnostic-controls label,.compare label { display:flex; align-items:center; gap:8px; font-size:13px; }
.diagnostics button,.diagnostics select {
  min-height:40px; padding:5px 10px; background:#f5f5f5; border:1px solid #ccc;
  border-radius:6px; color:#252525; font-family:inherit; font-size:13px; font-weight:600;
}
.diagnostics button[aria-pressed=true],.diagnostics .trial-primary { background:#292929; color:#fff; border-color:#292929; }
.trial-note { margin-top:8px; }
.diagnostic-counts { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:8px; margin:13px 0; }
.diagnostic-counts div { padding:10px; border-radius:6px; background:#efefef; }
.diagnostic-counts dt,.compare dt { font-size:12px; color:#525252; }
.diagnostic-counts dd { margin:4px 0 0; font:600 20px var(--mono); }
.diagnostic-detail { display:grid; grid-template-columns:minmax(270px, .8fr) minmax(0,1.4fr); gap:12px; }
.compare,.evidence { min-width:0; border:1px solid var(--stroke); border-radius:8px; padding:12px; }
#triangle-compare { display:block; width:min(100%,360px); margin:8px auto 0; background:#f0f0f0; border-radius:6px; }
.compare dl { margin:7px 0; }
.compare dl div { padding:4px 0; display:flex; gap:8px; justify-content:space-between; border-bottom:1px solid #e4e4e4; }
.compare dd { margin:0; text-align:right; font:12px var(--mono); }
.evidence h3 { margin:0 0 5px; font-size:15px; }
.evidence p { margin-bottom:5px; }
.evidence-scroll { overflow:auto; max-height:280px; }
.diagnostics table { width:100%; border-collapse:collapse; font-size:12px; text-align:left; white-space:nowrap; }
.diagnostics th,.diagnostics td { padding:4px 7px; border-bottom:1px solid #ddd; }
.diagnostics th { position:sticky; z-index:1; top:0; background:#efefef; }
.diagnostics td:first-child { font-family:var(--mono); }
.diagnostics td button { min-height:32px; font-size:12px; }
#evidence-limit { margin:6px 0 0; }
.raw-contacts { margin-top:12px; font-size:13px; }
.raw-contacts summary { cursor:pointer; padding:5px 0; width:fit-content; }
@media(max-width:800px) {
  .diagnostic-detail { grid-template-columns:minmax(0,1fr); }
  .diagnostic-counts { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media(max-width:490px) {
  .diagnostics { padding:10px; }
  .diagnostic-counts { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .diagnostic-controls { gap:5px; }
}

/* Presentation palette: physical proxy / neutral content / interaction feedback. */
.token.is-active { border-color:var(--module-rim); }
.token[aria-pressed=true] { background:#f4f9fc; border-color:var(--module-line); box-shadow:0 0 0 1px var(--module-line); }
.token.is-active::after { background:var(--module-point); }
.token:hover { border-color:var(--module-rim); }
.brand-mark { border-color:var(--module-rim); background:var(--module-fill); }
.brand-mark i { background:var(--module-point); }
.drag-ghost { background:#d9eaf399; border-color:var(--module-rim); box-shadow:0 9px 24px #486b8526,inset 0 0 0 3px #edf6fb88; }
.status-spark { background:var(--effect-accent); }
.color-key { display:flex; align-items:center; gap:12px; margin-left:auto; margin-right:12px; }
.color-key span { display:flex; align-items:center; gap:5px; font-size:10px; color:#666; white-space:nowrap; }
.color-key i { width:9px; height:9px; border-radius:50%; border:1px solid transparent; }
.color-key .key-module { background:var(--module-fill); border-color:var(--module-rim); }
.color-key .key-scene { background:#d3d3d3; border-color:#aaa; }
.color-key .key-effect { background:var(--effect-fill); border-color:var(--effect-line); }
@media(max-width:900px) { .color-key { gap:8px; margin-right:0; } .desk-title .spec { display:none; } }
@media(max-width:420px) { .color-key span { font-size:9px; } .color-key { gap:7px; } }
