body {
    margin: 0;
    padding-bottom: 120px;
    color: #17233b;
    background: #ffffff;
}
.world-shell-placeholder { color: white; }
/* The hit bands belong to panel chrome, never the scrolling content. */
.panel-resize-edge { position:absolute;z-index:8;touch-action:none;user-select:none;-webkit-user-select:none; }
.panel-resize-n,.panel-resize-s { left:28px;right:28px;height:18px;cursor:ns-resize; }
.panel-resize-n { top:0; }.panel-resize-s { bottom:0; }
.panel-resize-e,.panel-resize-w { top:28px;bottom:28px;width:18px;cursor:ew-resize; }
.panel-resize-e { right:0; }.panel-resize-w { left:0; }
.panel-resize-ne,.panel-resize-nw,.panel-resize-se,.panel-resize-sw { width:28px;height:28px; }
.panel-resize-ne { top:0;right:0;cursor:nesw-resize; }.panel-resize-nw { top:0;left:0;cursor:nwse-resize; }
.panel-resize-se { bottom:0;right:0;cursor:nwse-resize; }.panel-resize-sw { bottom:0;left:0;cursor:nesw-resize; }
[data-collapsed="true"] > .panel-resize-edge { display:none; }
[data-resizing="true"] { outline:2px solid #ffd54a;box-shadow:0 0 24px #ffd54a55; }
#flowchart-canvas .box[data-focus="true"] { outline:5px solid var(--focus-color,#ffd54a);outline-offset:5px;animation:flowchart-focus 1.8s ease-in-out infinite; }
#flowchart-svg .arrow[data-focus="true"] { stroke-width:4;filter:drop-shadow(0 0 4px var(--focus-color,#ffd54a)); }
#flowchart-canvas .box { white-space:pre-wrap;text-align:left;line-height:1.45; }
#flowchart-canvas .box::first-line { font-weight:750;color:#204962; }
@keyframes flowchart-focus { 0%,100% { filter:drop-shadow(0 0 5px #ffd54a66); } 50% { filter:drop-shadow(0 0 14px #ffd54aaa); } }
@media(prefers-reduced-motion:reduce) { #flowchart-canvas .box[data-focus="true"] { animation:none; } }
.cinematic-panel { --cinematic-accent:#91dbff;position:fixed;z-index:1200;top:max(12px,env(safe-area-inset-top));right:12px;width:min(440px,calc(100vw - 24px));max-height:calc(100dvh - 24px - env(safe-area-inset-top));display:flex;flex-direction:column;overflow:hidden;box-sizing:border-box;padding:14px;color:#eaf4ff;background:linear-gradient(145deg,#142e46fa,#091a2afa);border:1px solid #74cdf755;border-top:4px solid var(--cinematic-accent);border-radius:18px;box-shadow:0 12px 40px #0005;font:14px/1.5 system-ui;overscroll-behavior:contain; }
.cinematic-panel[hidden] { display:none; }
.cinematic-panel { right:calc(98px + max(12px,env(safe-area-inset-right)));max-width:calc(100% - 110px - max(12px,env(safe-area-inset-right))); }
.in-world > .cinematic-panel { top:env(safe-area-inset-top,0px);max-height:calc(100dvh - 12px - env(safe-area-inset-top)); }
.cinematic-scroll { display:flex;flex-direction:column;min-height:0;min-width:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y; }
.cinematic-panel strong { color:#91dbff;display:block; }
.cinematic-header { display:grid;grid-template-columns:minmax(0,1fr) auto;grid-template-areas:"title title" "stop size" "play hide";gap:8px;align-items:center;flex-shrink:0; }
.cinematic-header button { min-height:44px;background:#19344e;color:#f1f8ff;border:1px solid #6297be;border-radius:10px;padding:6px 10px;font:inherit;cursor:pointer;box-sizing:border-box; }
#cinematic-disclosure { grid-area:title;min-width:0;text-align:left;touch-action:none;user-select:none;-webkit-user-select:none;cursor:grab; }
.cinematic-panel[data-dragging="true"] #cinematic-disclosure { cursor:grabbing; }
#cinematic-stop { grid-area:stop; }
#cinematic-size { grid-area:size; }
#cinematic-play { grid-area:play; }
#cinematic-hide-panel { grid-area:hide; }
.cinematic-disclosure-hint { display:block;font-size:11px;color:#bddef0; }
.cinematic-panel [hidden] { display:none; }
.cinematic-panel[data-collapsed="true"] { padding:6px 10px;border-radius:14px; }
.cinematic-expanded { min-height:0;flex-shrink:0;overflow:visible;overscroll-behavior:contain;touch-action:pan-y; }
.cinematic-body { overflow:visible; }
.cinematic-detail { margin:8px 0;white-space:pre-wrap;overflow-wrap:anywhere;user-select:text; }
.cinematic-controls { display:flex;gap:6px;flex-wrap:wrap;align-items:center;flex-shrink:0; }
.cinematic-controls button,.cinematic-controls select,.cinematic-navigator select,.cinematic-branches button { min-height:44px;background:#19344e;color:#f1f8ff;border:1px solid #6297be;border-radius:10px;padding:6px 10px;font:inherit;box-sizing:border-box; }
.cinematic-controls button:disabled { opacity:.5; }
.cinematic-panel :focus-visible { outline:3px solid #ffda8b;outline-offset:2px; }
.cinematic-panel progress { width:100%;height:6px;accent-color:#91dbff;display:block;margin:8px 0 12px;flex-shrink:0; }
.cinematic-navigator { display:block;margin-top:8px; }
.cinematic-navigator select { display:block;width:100%;min-width:0; }
.cinematic-branches { display:flex;flex-direction:column;gap:5px; }
.cinematic-branches button { text-align:left;white-space:normal;overflow-wrap:anywhere;flex-shrink:0; }
#cinematic-stop { background:#693343;border-color:#d88ba0; }
.cinematic-panel small { display:block;color:#adbdce;font-size:11px;margin-top:8px; }
.cinematic-transport { display:flex;flex-wrap:wrap;gap:8px;margin-top:8px;flex-shrink:0;min-width:0; }
.cinematic-holds { position:fixed;z-index:1201;right:max(8px,env(safe-area-inset-right));top:max(8px,env(safe-area-inset-top));bottom:max(156px,calc(148px + env(safe-area-inset-bottom)));width:84px;padding:5px;box-sizing:border-box;display:flex;flex-direction:column;gap:4px;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y; }
.cinematic-persistent { position:fixed;z-index:1220;right:max(8px,env(safe-area-inset-right));bottom:max(8px,env(safe-area-inset-bottom));width:84px;display:flex;flex-direction:column;gap:4px; }
.cinematic-persistent button { min-height:44px;padding:6px 3px;font:600 12px/1.2 system-ui;background:#19344e;color:#edf8ff;border:1px solid #76b4cf;border-radius:10px;cursor:pointer; }
.cinematic-persistent #cinematic-right-stop { background:#693343;border-color:#d88ba0; }
.cinematic-holds[hidden],.cinematic-persistent[hidden],.cinematic-persistent [hidden] { display:none; }
.cinematic-persistent button:disabled { opacity:.5; }
.cinematic-rates { display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:5px;flex:1 1 145px;min-width:0; }
.cinematic-transport button,.cinematic-holds button,.cinematic-tempo-actions button { min-height:44px;border:1px solid #76b4cf66;border-radius:10px;background:#19344e;color:#edf8ff;font:600 13px/1.2 system-ui;cursor:pointer; }
.cinematic-holds button { box-sizing:border-box;min-height:64px;padding:8px 5px;touch-action:none;user-select:none;-webkit-user-select:none;box-shadow:0 5px 18px #0006; }
.cinematic-transport button[aria-pressed="true"],.cinematic-holds button[aria-pressed="true"],#cinematic-tempo-save { color:#073a32;background:#b2f5d8;border-color:#d1ffe9;box-shadow:0 0 14px #62dfa32b; }
.cinematic-transport button:disabled,.cinematic-holds button:disabled { opacity:.5; }
@media(max-height:500px) { .cinematic-holds { top:max(12px,env(safe-area-inset-top));transform:none; } }
.cinematic-transport .cinematic-rate-status { flex-basis:100%;margin:0;min-height:16px;overflow-wrap:anywhere; }
.cinematic-tempo-dialog { box-sizing:border-box;width:min(470px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;margin:auto;padding:24px;border:1px solid #a1dbcd66;border-radius:24px;color:#eaf8ff;background:linear-gradient(145deg,#193b4d,#0b1c2f);box-shadow:0 24px 100px #0009;font:15px/1.5 system-ui; }
.cinematic-tempo-dialog::backdrop { background:#020b18bb;backdrop-filter:blur(5px); }
.cinematic-tempo-dialog h2 { margin:0;color:#b2f5d8;font-size:25px; }
.cinematic-tempo-dialog p { color:#c1d7e3; }
.cinematic-tempo-tiles { display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;border:0;padding:12px 0;margin:0; }
.cinematic-tempo-tiles legend { padding:0;font-weight:600; }
.cinematic-tempo-tiles label { position:relative;cursor:pointer; }
.cinematic-tempo-tiles input { position:absolute;opacity:0;width:1px;height:1px; }
.cinematic-tempo-tiles span { display:flex;align-items:center;justify-content:center;min-height:64px;border:1px solid #7fa4bd77;border-radius:14px;background:#203e55;font-weight:700; }
.cinematic-tempo-tiles input:checked + span { background:#b2f5d8;color:#073a32;border-color:#dcffed;box-shadow:0 0 0 2px #b2f5d82b; }
.cinematic-tempo-dialog :focus-visible,.cinematic-tempo-tiles input:focus-visible + span { outline:3px solid #ffd54a;outline-offset:3px; }
.cinematic-tempo-actions { display:flex;justify-content:flex-end;gap:10px;margin-top:12px; }
.cinematic-tempo-actions button { min-width:94px;min-height:48px; }
.cinematic-tempo-dialog .cinematic-tempo-error { color:#ffc2c2;min-height:1em; }
@media(max-width:360px) { .cinematic-tempo-tiles { grid-template-columns:repeat(2,1fr); } }
@media(max-width:600px) { .cinematic-panel { padding:10px;font-size:12px;max-height:60dvh; } .cinematic-controls button { min-height:44px; } }
.cinematic-panel[data-collapsed="true"] { max-height:calc(100dvh - 24px - env(safe-area-inset-top)); }
.cinematic-panel:not([data-collapsed="true"]) { padding:22px;font-size:14px; }
.cinematic-panel { max-height:calc(100dvh - 24px - env(safe-area-inset-top)); }
.cinematic-panel[data-size="compact"] { width:220px;padding:11px;font-size:7px;border-radius:9px;border-top-width:2px; }
.cinematic-panel[data-size="compact"][data-collapsed="true"] { padding:3px 5px;border-radius:7px; }
.cinematic-panel[data-size="compact"] .cinematic-header { gap:4px; }
.cinematic-panel[data-size="compact"] #cinematic-disclosure { grid-area:title;align-self:stretch;overflow-wrap:normal; }
.cinematic-panel[data-size="compact"] #cinematic-size { grid-area:size; }
.cinematic-panel[data-size="compact"] #cinematic-stop { grid-area:stop; }
.cinematic-panel[data-size="compact"] .cinematic-header button { position:relative;z-index:9; }
.cinematic-panel[data-size="compact"] .cinematic-header button,.cinematic-panel[data-size="compact"] .cinematic-controls button,.cinematic-panel[data-size="compact"] .cinematic-navigator select,.cinematic-panel[data-size="compact"] .cinematic-branches button { min-height:22px;padding:3px 5px;border-radius:5px; }
.cinematic-panel[data-size="compact"] .cinematic-transport button { min-height:22px;font-size:6.5px;border-radius:5px; }
.cinematic-panel[data-size="compact"] small,.cinematic-panel[data-size="compact"] .cinematic-disclosure-hint { font-size:5.5px; }
.cinematic-panel[data-size="compact"] .cinematic-transport,.cinematic-panel[data-size="compact"] .cinematic-controls { gap:3px;margin-top:4px; }
#cinematic-size { font-size:9px;min-height:22px;padding:3px;align-self:flex-start; }
.cinematic-holds > button { min-height:36px;padding:4px;font-size:10px;flex-shrink:0; }
.cinematic-live-pads { font:10px/1.2 system-ui; }
.cinematic-live-pads fieldset { padding:4px 0;margin:3px 0;border:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:3px; }
.cinematic-live-pads legend { color:#c9e7fa;font-weight:bold;padding:3px 0; }
.cinematic-live-pads button { min-height:26px;padding:3px 0;font-size:10px;touch-action:manipulation; }
.cinematic-thickness { display:block;margin:8px 0; }
.cinematic-thickness input { display:block;width:100%;accent-color:#ffd54a; }
.cinematic-thickness output { color:#ffd54a; }
.world-scatter-controls label input { width:100%; }
#world-shell { position:fixed;inset:0;z-index:1000;background:#081426;touch-action:pan-y; }
#world-shell[hidden] { display:none; }
#world-shell canvas { display:block;width:100%;height:100%;touch-action:none; }
.world-toast { position:absolute;z-index:5;top:max(68px,env(safe-area-inset-top));left:50%;transform:translateX(-50%);box-sizing:border-box;width:max-content;max-width:min(420px,calc(100% - 32px));padding:10px 16px;border:1px solid #91dbff45;border-radius:14px;background:#15364bf5;color:#e7f8ff;box-shadow:0 6px 24px #0004;font:500 14px/1.45 system-ui;text-align:center;overflow-wrap:anywhere;pointer-events:none; }
.world-toast[hidden] { display:none; }
.world-toast-transient { animation:world-toast-fade .8s ease-out both; }
@keyframes world-toast-fade { 0%,55% { opacity:1; } 100% { opacity:0; } }
.world-panel { --panel-width:calc(100vw - 24px);--panel-height:calc(100dvh - 24px);position:fixed;inset:auto;margin:0;transform:translateX(-50%);box-sizing:border-box;width:min(600px,var(--panel-width));max-width:var(--panel-width);max-height:var(--panel-height);padding:0;border:1px solid #97b7d936;border-radius:22px;background:linear-gradient(145deg,#172c42,#102034);color:#eaf3ff;font:15px/1.45 system-ui;box-shadow:0 24px 80px #0008;overflow:hidden; }
.world-panel[open] { display:flex;flex-direction:column; }
.world-panel { padding:18px; }
.world-panel::backdrop { background:#04101bae; }
.world-panel header { position:relative;flex:none;padding:18px 92px 14px 20px;border-bottom:1px solid #b7d6f21a; }
.world-panel h2 { padding:0;margin:3px 0 0;font:650 22px/1.2 system-ui;overflow-wrap:anywhere; }
.world-panel .world-eyebrow { margin:0;color:#8ec9e7;font-size:10px;font-weight:700;letter-spacing:.15em; }
.world-panel button,.world-panel select { box-sizing:border-box;min-height:44px;max-width:100%;border:1px solid #9cbedc38;border-radius:11px;background:#294057;color:#eaf3ff;padding:9px 13px;font:600 14px/1.3 system-ui;cursor:pointer;overflow-wrap:anywhere;touch-action:manipulation; }
.world-panel button:hover { background:#344f6a; }
.world-panel :focus-visible { outline:2px solid #86d9ff;outline-offset:2px; }
.world-panel button:disabled { opacity:.55;cursor:wait; }
.world-panel .world-panel-close { position:absolute;right:14px;top:14px;border-color:transparent;background:transparent;color:#b3c5da; }
.world-panel-body { min-height:0;overflow:auto;overscroll-behavior:contain;touch-action:pan-y;padding:16px 20px;scroll-padding:12px; }
.world-panel-preview { max-width:320px;margin:0 auto 12px; }
#world-shell .world-panel-preview canvas { display:block;width:100%;height:auto;touch-action:pan-y; }
.world-field-heading { display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px;margin:0 0 10px;color:#c4dcf1;font-size:13px;font-weight:600; }
.world-field-heading select { max-width:65%;font-size:13px; }
.world-panel .world-text-input { position:static;display:block;box-sizing:border-box;width:100%;height:auto;min-height:48px;max-height:150px;clip-path:none;white-space:pre-wrap;resize:vertical;overflow:auto;border:1px solid #829eb95e;border-radius:12px;padding:12px;background:#081828;color:#f2f7ff;font:16px/1.45 system-ui;touch-action:pan-y; }
.world-panel-chips,.world-panel-options { display:flex;flex-wrap:wrap;gap:8px;margin:12px 0 0; }
.world-panel-options .world-option { flex:1 1 140px; }
.world-panel-options .world-panel-copy { flex:1 0 100%;margin:6px 0;color:#b8cde2;font-size:14px; }
.world-panel .is-chosen { border-color:#8ee3d393;background:#23584f;color:#d7fff3; }
.world-panel footer { display:flex;flex:none;gap:8px;justify-content:flex-end;padding:12px 16px max(12px,env(safe-area-inset-bottom));border-top:1px solid #b7d6f21a;background:#102034; }
.world-panel .world-delete { margin-right:auto;border-color:#ff9aaa40;background:#5b293440;color:#ffb5be; }
.world-panel .world-apply { background:#3b8b78;border-color:#93dfc966;color:#fff; }
.world-panel [role=alert] { color:#ffbac3;overflow-wrap:anywhere; }
.world-panel section { padding:0 0 8px; }
.world-panel h3 { margin:4px 0 10px;color:#8ed5eb;font-size:13px;letter-spacing:.04em;text-transform:uppercase; }
.world-panel dl { display:grid;grid-template-columns:minmax(100px,1fr) minmax(140px,1.4fr);gap:12px 18px;margin:0 0 18px; }
.world-panel dt { font-weight:600;color:#f3f8ff; }
.world-panel dd { margin:0;color:#b3c7dc; }
.world-panel-short header { padding:10px 82px 10px 16px; }
.world-panel-short h2 { font-size:18px; }
.world-panel-short .world-panel-close { top:6px;right:10px; }
.world-panel-short .world-panel-preview { display:none; }
.world-panel-short .world-panel-body { padding:10px 16px; }
.world-panel-short .world-text-input { max-height:88px; }
@media(max-width:400px) { .world-panel dl { grid-template-columns:1fr;gap:4px; }.world-panel dd { margin-bottom:12px; }.world-panel footer { padding-left:10px;padding-right:10px;gap:6px; }.world-panel footer button { padding:9px; } }
@media(prefers-reduced-motion:reduce) { .world-toast-transient { animation:none; } }
.drone-settings-dialog { box-sizing:border-box;width:min(620px,calc(100vw - 24px));max-height:calc(100dvh - 24px);overflow:auto;overscroll-behavior:contain;padding:20px;border:1px solid #5bb9db;border-radius:18px;background:#102538;color:#e4f6ff;font:15px/1.5 system-ui;box-shadow:0 12px 60px #0009; }
.drone-settings-dialog::backdrop { background:#04101bcc; }
.drone-settings-dialog h2 { font-size:22px;margin:0 0 8px; }
.drone-settings-dialog fieldset { display:grid;gap:16px;border:0;padding:0;margin:16px 0;min-width:0; }
.drone-settings-dialog label { display:block;border-bottom:1px solid #42647d;padding-bottom:10px; }
.drone-settings-dialog output { float:right;margin-left:12px;color:#8fdef8;font-variant-numeric:tabular-nums; }
.drone-settings-dialog input[type=range] { display:block;box-sizing:border-box;width:100%;height:40px;margin:0;accent-color:#6cdbfa;touch-action:pan-y; }
.drone-settings-dialog input[type=checkbox] { margin-left:12px;width:20px;height:20px;vertical-align:middle;accent-color:#6cdbfa; }
.drone-settings-actions { position:sticky;bottom:-20px;display:flex;flex-wrap:wrap;gap:8px;padding:12px 0;background:#102538; }
.drone-settings-actions button { flex:1 1 100px;min-height:44px;border:1px solid #5bb9db;border-radius:10px;background:#21485e;color:#e4f6ff;padding:8px;font:inherit; }
.drone-settings-actions button[type=submit] { background:#25604b; }
.drone-settings-dialog button:disabled { opacity:.5; }
.drone-settings-status { min-height:2em;color:#b6eafa; }
.drone-hud { position:fixed;z-index:1210;inset:0;pointer-events:none;font:13px/1.3 system-ui;color:#e4f6ff; }
.drone-hud [hidden] { display:none!important; }
.drone-toggle,.drone-tools { position:absolute;left:max(12px,env(safe-area-inset-left));pointer-events:auto; }
.drone-toggle { top:max(8px,env(safe-area-inset-top));min-height:44px;padding:6px 12px;border:1px solid #58819c;border-radius:18px;color:#e4f6ff;background:#142d40e8;font:600 12px system-ui; }
.drone-tools { top:calc(max(8px,env(safe-area-inset-top)) + 48px);width:min(270px,calc(100% - 24px));max-height:calc(100% - 220px);overflow:auto;overscroll-behavior:contain;touch-action:pan-y;display:grid;grid-template-columns:1fr 1fr;gap:4px;padding:6px;box-sizing:border-box;border:1px solid #58819c;border-radius:12px;background:#102538f5; }
.drone-tools button { min-height:40px;padding:5px;border:1px solid #42647d;border-radius:8px;background:#1b394f;color:#e4f6ff;font:12px system-ui;overflow-wrap:anywhere; }
.world-scatter-controls { grid-column:1/-1;display:grid;gap:6px;border-top:1px solid #42647d;margin-top:5px;padding-top:8px; }
.world-scatter-controls label { display:flex;justify-content:space-between;gap:8px;font-size:12px; }
.world-scatter-controls output { color:#a4efd3;white-space:nowrap; }
.cinematic-layout-controls label { display:grid;grid-template-columns:1fr auto;align-items:center; }
.cinematic-layout-controls label input { grid-column:1/-1;width:100%;min-width:0; }
.cinematic-layout-controls[hidden] { display:none; }
.string-theory-toggle[aria-pressed="false"] { background:#743348!important;border-color:#cb7189!important;color:#fff!important; }
.string-theory-toggle[aria-pressed="true"] { background:#246c50!important;border-color:#85e8b9!important;color:#fff!important; }
.string-theory-toggle:focus-visible { outline:3px solid #fff;outline-offset:2px; }
.world-scatter-controls input { width:100%;margin:0;min-height:32px;accent-color:#8be2bc; }
.world-scatter-controls button[data-action=scatter] { background:#245445;border-color:#83dcb4; }
.world-scatter-controls :focus-visible { outline:2px solid #a4efd3;outline-offset:2px; }
.drone-pad { position:absolute;bottom:max(16px,env(safe-area-inset-bottom));width:clamp(90px,23vw,124px);height:clamp(90px,23vw,124px);border:1px solid #80cbe577;border-radius:50%;background:radial-gradient(circle,#284e6977,#13334755);box-shadow:inset 0 0 0 24px #69cced0b;pointer-events:auto;touch-action:none;user-select:none; }
.drone-pad-move { left:max(14px,env(safe-area-inset-left)); }
.drone-pad-look { right:max(14px,env(safe-area-inset-right)); }
.cinematic-ui-active .drone-pad-look { right:calc(104px + env(safe-area-inset-right)); }
.drone-knob { position:absolute;width:44px;height:44px;left:calc(50% - 22px);top:calc(50% - 22px);border-radius:50%;background:#92dcff77;border:1px solid #cef1ff;box-sizing:border-box;pointer-events:none; }
.drone-pad-label { position:absolute;left:0;right:0;bottom:4px;text-align:center;font-size:11px;text-shadow:0 1px 3px #001;pointer-events:none; }
.drone-fast { border-color:#ffcf69;background:#80602288; }
.drone-status { position:absolute;right:12px;top:max(12px,env(safe-area-inset-top));max-width:calc(100% - 160px);text-align:right;font-size:12px;pointer-events:none;text-shadow:0 1px 3px #001; }
@media(max-height:400px) { .drone-pad { width:90px;height:90px;bottom:max(8px,env(safe-area-inset-bottom)); }.drone-tools { max-height:calc(100% - 160px); } }
.in-world { overflow:hidden; }
.in-world > :not(#world-shell):not(.drone-hud):not(#library-dialog):not(.cinematic-panel):not(.cinematic-holds):not(.cinematic-persistent):not(#cinematic-tempo-dialog):not(#cinematic-library-dialog):not(#cinematic-delete-dialog):not(#cinematic-ui-toggle):not(#cinematic-view):not(#cinematic-gallery):not(.comic-library):not(#comic-status-chip):not(#comic-exit):not(.comic-viewer):not(#comic-transport):not(#comic-stage):not(#narration-toggle):not(#narration-dialog):not(#narration-transport):not(script) { visibility:hidden; }
#comic-transport { position:fixed;z-index:1305;left:max(8px,env(safe-area-inset-left));bottom:max(8px,env(safe-area-inset-bottom));max-width:min(580px,calc(100vw - 16px));max-height:42dvh;overflow:auto;padding:10px;border:1px solid #e3cb60;border-radius:12px;background:#10243af2;color:#f7f4dd;display:flex;flex-wrap:wrap;gap:8px;font:14px/1.3 system-ui; }
#comic-transport[hidden],#comic-stage[hidden] { display:none; }
#comic-transport strong,#comic-transport span { flex-basis:100%; }
#comic-transport button,#comic-transport select { min-height:36px;padding:6px;background:#244760;color:white;border:1px solid #708c9d;border-radius:7px; }
#comic-transport > div { display:flex;gap:6px;flex-wrap:wrap; }
#comic-transport label { display:flex;gap:6px;align-items:center; }
#comic-stage { position:fixed;z-index:1304;inset:6vh 3vw 45vh;overflow:hidden;background:#071426;border:1px solid #e3cb60; }
#comic-stage img { position:absolute;max-width:none;object-fit:fill; }
#cinematic-ui-toggle,#cinematic-view { position:fixed;z-index:1203;top:max(8px,env(safe-area-inset-top));min-height:44px;padding:8px;border:1px solid #76b4cf;border-radius:10px;background:#19344e;color:#edf8ff;font:600 13px/1.2 system-ui;cursor:pointer; }
#cinematic-ui-toggle { left:max(12px,env(safe-area-inset-left));max-width:calc(100vw - 122px); }
#cinematic-view { right:max(8px,env(safe-area-inset-right));width:94px; }
#cinematic-ui-toggle[hidden] { display:none; }
.cinematic-holds { padding-top:54px; }
.cinematic-ui-active .cinematic-panel { top:env(safe-area-inset-top,0px);max-height:calc(100dvh - 12px - env(safe-area-inset-top)); }
@media(max-width:600px) { .cinematic-ui-active:not(.cinematic-ui-hidden):not(.cinematic-panel-hidden) #cinematic-ui-toggle { visibility:hidden; } }
.cinematic-ui-available .drone-toggle { top:max(62px,calc(env(safe-area-inset-top) + 54px)); }
.cinematic-ui-available .drone-tools { top:max(110px,calc(env(safe-area-inset-top) + 102px)); }
.cinematic-ui-hidden .cinematic-panel,.cinematic-ui-hidden #cinematic-view,.cinematic-ui-hidden .drone-hud { display:none !important; }
.cinematic-ui-hidden #cinematic-tour,.cinematic-ui-hidden #cinematic-record,.cinematic-ui-hidden #cinematic-library { display:none !important; }
#cinematic-gallery { width:min(720px,calc(100vw - 24px)); }
#cinematic-gallery input,#cinematic-gallery select { font:inherit;max-width:100%;box-sizing:border-box; }
#cinematic-gallery input[type=checkbox] { width:22px;height:22px;vertical-align:middle;margin:10px; }
.cinematic-pattern-list { display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:8px;margin:12px 0; }
.cinematic-pattern-list > div { display:flex;align-items:center;justify-content:space-between;border:1px solid #91dbff44;border-radius:8px; }
.cinematic-pattern-list label { flex:1; }
.cinematic-gallery-actions { display:flex;gap:8px;flex-wrap:wrap;margin:12px 0; }
#cinematic-gallery button { min-height:44px; }
#cinematic-preview { display:block;width:100%;aspect-ratio:16/9;background:#071524;border-radius:8px;margin:8px 0 16px; }
#cinematic-collection-name { width:100%;min-height:44px;margin-top:12px; }
.cinematic-recording-row { padding:12px 0;border-bottom:1px solid #91dbff44; }
.cinematic-recording-row strong,.cinematic-recording-row small { display:block;overflow-wrap:anywhere; }
.cinematic-recording-row button { margin:8px 8px 0 0; }
#cinematic-recording-name { width:100%;box-sizing:border-box;font:inherit; }
#library-dialog { position:fixed;inset:0;margin:auto;box-sizing:border-box;width:min(680px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto;padding:20px;border:1px solid #94b9d0;border-radius:18px;background:#f7faff;color:#18365f;font:16px/1.5 system-ui; }
#library-dialog::backdrop { background:#081426a0; }
.library-header { display:flex;align-items:center;justify-content:space-between;gap:16px; }
#library-title { font:650 24px/1.2 system-ui;padding:0;margin:0; }
#library-content form { display:grid;gap:16px; }
#chart-save-name { box-sizing:border-box;width:100%;min-height:44px;border:1px solid #a9bcda;border-radius:8px;padding:10px;font:16px system-ui; }
.library-check { display:flex;align-items:center;gap:12px;min-height:48px; }
.library-check input { width:22px;height:22px;flex:none; }
.chart-library-list { display:grid;gap:10px;margin:16px 0; }
.chart-library-list button { display:block;text-align:left;overflow-wrap:anywhere; }
.chart-library-meta { display:block;margin-top:6px;font-weight:400; }
#library-error { color:#9e2334;overflow-wrap:anywhere; }
.world-accessibility,.world-text-input { position:fixed;left:0;top:0;width:1px;height:1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap; }
#names-dialog { box-sizing:border-box;width:min(620px,calc(100% - 24px));max-height:calc(100dvh - 24px);overflow:auto;border:1px solid #51bdd9;border-radius:24px;padding:24px;color:#d9efff;background:#0d2138;font:16px/1.5 system-ui; }
#names-dialog::backdrop { background:#081426b0; }
#names-title { font-size:28px;padding:0; }
.name-cloud { display:flex;flex-wrap:wrap;gap:12px;margin:24px 0; }
.name-cloud span { border:1px solid #51bdd9;border-radius:16px;padding:10px 16px;animation:world-float 5s ease-in-out infinite alternate; }
.name-cloud span:nth-child(2n) { animation-delay:-2s; }
.world-icon { animation:world-float 5s ease-in-out infinite alternate; }
@keyframes world-float { to { transform:translateY(-3px) rotate(3deg); } }
@media(prefers-reduced-motion:reduce) { .name-cloud span,.world-icon { animation:none; } }
.video-heading { text-align: center; font: 650 clamp(24px, 5vw, 64px)/1.2 system-ui; overflow-wrap: anywhere; }
#video-container video { max-width: 100%; }
#password-container input { box-sizing: border-box; max-width: 100%; }
#flowchart-svg { overflow: visible; }
.arrow-halo { stroke: #f9f9f9; stroke-width: 8; fill: none; pointer-events: none; }
.arrow-hit { stroke: transparent; stroke-width: 18; fill: none; pointer-events: stroke; cursor: pointer; }
#routing-status { color: #8a4405; padding: 0 16px; overflow-wrap: anywhere; }
.toolbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
    width: 100%;
    padding: 10px clamp(10px, 2vw, 24px);
    border-bottom: 1px solid rgba(74, 111, 165, 0.28);
    background: rgba(247, 250, 255, 0.97);
    box-shadow: 0 8px 24px rgba(25, 54, 93, 0.12);
}

.flow-tool {
    min-block-size: 44px;
    min-inline-size: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid #a9bcda;
    border-radius: 12px;
    color: #18365f;
    background: linear-gradient(145deg, #ffffff, #e9f1fd);
    box-shadow: 0 3px 8px rgba(38, 73, 119, 0.13);
    font: 600 14px/1.15 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    cursor: pointer;
    touch-action: manipulation;
    transition: transform 150ms ease, border-color 150ms ease, background-color 150ms ease, box-shadow 150ms ease;
}

.flow-tool[hidden] { display: none; }

.flow-tool:hover {
    border-color: #5b8dcc;
    background: linear-gradient(145deg, #ffffff, #dbeaff);
    box-shadow: 0 6px 14px rgba(38, 73, 119, 0.2);
    transform: translateY(-1px);
}

.flow-tool:active {
    transform: translateY(1px) scale(0.98);
}

.flow-tool:focus {
    outline: 3px solid #ffb000;
    outline-offset: 2px;
}

.flow-tool:focus:not(:focus-visible) {
    outline-color: transparent;
}

.flow-tool:focus-visible {
    outline: 3px solid #ffb000;
    outline-offset: 2px;
}

.flow-tool[aria-pressed="true"] {
    color: #ffffff;
    border-color: #154d92;
    background: linear-gradient(145deg, #2f75c8, #174c8d);
    box-shadow: 0 0 0 3px rgba(47, 117, 200, 0.22), 0 6px 14px rgba(17, 58, 108, 0.24);
}

.flow-tool__icon {
    inline-size: 22px;
    block-size: 22px;
    flex: 0 0 22px;
    overflow: visible;
    pointer-events: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 180ms ease, opacity 180ms ease;
}

.flow-tool__label,
.flow-tool__icon * {
    pointer-events: none;
}

.flow-tool:hover .flow-tool__icon {
    opacity: 0.86;
    transform: translateY(-1px) scale(1.06);
}

.flow-tool--sequence {
    border-color: #6f65c2;
    color: #40348d;
}



#flowchart-canvas {
    width: 3200px;
    height: 1600px;
    border: 1px solid #000;
    position: relative;
    z-index: 1; /* Lower than SVG */
    background-color: #f9f9f9;
    background-size: 50px 50px;
    background-image:
        linear-gradient(to right, lightgray 1px, transparent 1px),
        linear-gradient(to bottom, lightgray 1px, transparent 1px);
    margin-top: 32px;
    overflow: hidden; /* Ensure nothing overflows when resizing */
}


#flowchart-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3; /* Higher than boxes */
    pointer-events: none; /* Allow clicks to pass through the SVG */
}

#flowchart-canvas .box {
    position: absolute;
    z-index: 2;
}


.box {
    width: 600px;
    height: 150px;
    background-color: lightblue;
    border: 2px solid black;
    position: absolute;
    z-index: 2; /* lower than svg */
    text-align: center;
    line-height: 50px;
    font-size: 48px;
    cursor: pointer;
    padding: 25px;
    overflow: hidden;
}
.editable-box {
    line-height: normal;
    padding: 10px;
}
.arrow {
    stroke: black;
    stroke-width: 2;
    marker-end: url(#arrowhead);
    cursor: pointer;
}
#json-output {
    margin-top: 20px;
    background-color: #f0f0f0;
    padding: 10px;
    border: 1px solid #ccc;
    max-height: 1000px;
    overflow-y: auto;
    font-family: monospace;
}
#style-panel {
    position: fixed;
    inset: 0;
    margin: auto;
    box-sizing: border-box;
    width: min(580px, calc(100% - 24px));
    max-width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scroll-padding-block: 90px;
    color: #18365f;
    background: #f7faff;
    border: 1px solid #96b8dd;
    border-radius: 22px;
    box-shadow: 0 24px 80px #10274766;
    font: 16px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

#style-panel:not([open]) { display: none; }
#style-panel::backdrop { background: rgba(12, 27, 48, 0.58); }
#style-form { margin: 0; }
.style-header, .style-actions {
    position: sticky;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 22px;
    background: #f7faff;
}
.style-header { top: 0; border-bottom: 1px solid #d9e4f2; }
.style-actions { bottom: 0; justify-content: flex-end; border-top: 1px solid #d9e4f2; }
.style-eyebrow { margin: 0 0 3px; font-size: 11px; font-weight: 750; letter-spacing: 0.15em; color: #37679d; }
#style-title { margin: 0; font-size: 24px; font-weight: 750; line-height: 1.2; }
.style-header .style-close { flex: 0 0 44px; }
.style-body { padding: 18px 22px 8px; }
.style-selection { margin: 0 0 4px; font-weight: 650; overflow-wrap: anywhere; }
#style-help { margin: 0 0 16px; font-size: 14px; color: #4b607b; }
.style-preview-stage {
    display: grid;
    place-items: center;
    height: 144px;
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid #d9e4f2;
    border-radius: 12px;
    background: repeating-linear-gradient(0deg, transparent 0 23px, #dce6f3 23px 24px), repeating-linear-gradient(90deg, #edf3fb 0 23px, #dce6f3 23px 24px);
}
#style-preview {
    box-sizing: border-box;
    width: 80%;
    max-height: 124px;
    min-height: 64px;
    padding: 12px;
    overflow: hidden;
    overflow-wrap: anywhere;
    text-align: center;
    line-height: 1.2;
    border: 2px solid black;
    background: lightblue;
    color: #17233b;
}
.style-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
#style-panel label { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 14px; font-weight: 600; min-width: 0; }
.style-unit { font-size: 12px; font-weight: 400; color: #4b607b; }
.style-fields label:not(.style-check) { justify-content: flex-end; }
.style-wide { grid-column: 1 / -1; }
#style-panel input:not([type="checkbox"]), #style-panel select {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    border: 1px solid #91a9c8;
    border-radius: 9px;
    background: white;
    color: #18365f;
    padding: 8px 10px;
    font: 16px/1.2 system-ui, sans-serif;
}
#style-panel input[type="color"] { padding: 4px; cursor: pointer; }
#style-panel .style-check { flex-direction: row; align-items: center; align-self: end; min-height: 44px; cursor: pointer; }
#style-panel input[type="checkbox"] { width: 22px; height: 22px; accent-color: #225fae; flex-shrink: 0; }
#style-panel input:focus-visible, #style-panel select:focus-visible { outline: 3px solid #ffb000; outline-offset: 2px; }
#style-error { min-height: 24px; margin: 12px 0 0; font-size: 14px; color: #a21a29; overflow-wrap: anywhere; }
#style-panel .style-apply { color: white; background: #225fae; border-color: #174a8c; }
#flowchart-canvas .box[data-selected="true"] { outline: 3px solid #226bc3; outline-offset: 4px; }
#flowchart-canvas .box[data-focus="true"] { outline-color:color-mix(in srgb,var(--focus-color,#ffd54a) calc(var(--focus-alpha,1)*100%),transparent);outline-width:5px;animation:none;filter:none;box-shadow:0 0 12px color-mix(in srgb,var(--focus-color,#ffd54a) calc(var(--focus-alpha,1)*65%),transparent); }
#flowchart-svg .arrow[data-focus="true"] { stroke-width:calc(2px + var(--focus-alpha,1)*(4px * var(--cinematic-line-scale,5) - 2px));filter:none; }
#flowchart-svg .arrow-halo[data-focus="true"] { stroke:color-mix(in srgb,var(--focus-color,#ffd54a) calc(var(--focus-alpha,1)*32%),#f9f9f9); }
@media (max-width: 400px) {
    .style-fields { gap: 12px; }
    .style-header, .style-actions { padding: 12px; }
    .style-body { padding: 12px; }
    #style-title { font-size: 21px; }
}
@media (max-height: 480px) {
    .style-preview-stage { height: 80px; }
    .style-header, .style-actions { padding-block: 8px; }
}
.highlight {
    border: 2px dashed red;
}
#box-areas-output {
    margin-top: 20px;
    background-color: #f0f0f0;
    padding: 10px;
    border: 1px solid #ccc;
    max-height: 1000px;
    overflow-y: auto;
    font-family: monospace;
}

#popup-alert {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    padding: 20px;
    border-radius: 10px;
    background: linear-gradient(to bottom, yellow, white);
    border: 3px solid black;
    box-shadow: 0px 4px 10px rgba(0, 0, 0, 0.5);
    font-family: 'Helvetica', sans-serif;
    font-size: 40px;
    color: black;
    text-align: center;
    z-index: 1000;
    display: none;
}

@media (max-width: 760px) {
    .toolbar {
        gap: 6px;
        padding: 8px;
    }

    .flow-tool {
        flex: 1 1 auto;
        padding-inline: 10px;
        font-size: 13px;
    }

    .flow-tool--sequence {
        flex-basis: 100%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .flow-tool,
    .flow-tool__icon,
    .flow-tool:hover,
    .flow-tool:active,
    .flow-tool:hover .flow-tool__icon {
        animation: none;
        transition: none;
        transform: none;
    }
}
.save-strip {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    background: #f4f8ff;
    color: #153956;
    border-bottom: 1px solid #bdd2e9;
    font: 14px/1.5 system-ui, sans-serif;
}
.save-strip #start-new-chart { margin-left: auto; }
.save-strip [hidden] { display: none; }
#autosave-status[data-state="error"] { color: #a32424; }
#autosave-status[data-state="saved"] { color: #18633c; }
.save-strip a { text-decoration: underline; }
.product-title { width: 100%; box-sizing: border-box; }
body .product-title { font: 650 clamp(18px, 2vw, 28px)/1.2 system-ui; padding: 12px 16px; margin: 0; text-align: left; }
.version-strip { display:flex; flex-wrap:wrap; align-items:center; gap:8px; padding:6px 16px; background:#eaf2fd; color:#18365f; font:12px/1.4 system-ui; overflow-wrap:anywhere; }
.version-strip .flow-tool { min-block-size:32px; font-size:12px; }
.diagnostic-details { margin:12px; border:1px solid #bdcce0; border-radius:10px; overflow:hidden; }
.diagnostic-details summary { padding:12px 16px; cursor:pointer; color:#18365f; background:#f4f8ff; font:600 15px/1.4 system-ui; }
.diagnostic-details summary:focus-visible { outline:3px solid #ffb000; outline-offset:-3px; }
.diagnostic-details #json-output { margin:0; max-height:60vh; }
#chart-viewport {
    position: relative; box-sizing: border-box; width: 100%; height: max(180px, calc(100dvh - var(--workspace-header-height, 300px) - 12px));
    overflow: hidden; touch-action: none; background-color: #f9f9f9;
    --grid-line-width: 1px; --grid-alpha: 1;
    background-origin: padding-box; background-clip: padding-box;
    background-size: 50px 50px; background-repeat: repeat;
    background-image:
        linear-gradient(to right, rgba(211, 211, 211, var(--grid-alpha)) var(--grid-line-width), transparent var(--grid-line-width)),
        linear-gradient(to bottom, rgba(211, 211, 211, var(--grid-alpha)) var(--grid-line-width), transparent var(--grid-line-width));
    border-block: 1px solid #bdcce0; isolation: isolate;
}
#chart-viewport #flowchart-canvas {
    margin: 0; transform-origin: 0 0; overflow: visible;
    background-image: none; background-color: transparent;
    border-color: transparent;
}
#chart-viewport[data-pan="true"] { cursor: grab; }
#chart-viewport[data-pan="true"] .box { cursor: grab; }
.view-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 16px; font: 13px system-ui; }
.view-tools output { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
@media (max-width: 700px) {
    .toolbar { flex-wrap:nowrap; overflow-x:auto; overscroll-behavior-x:contain; }
    .toolbar .flow-tool { flex:none; white-space:nowrap; }
}
#json-output, #box-areas-output { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
.style-quick { display:flex; flex-wrap:wrap; gap:0.4rem; align-items:center; grid-column:1 / -1; padding:0.45rem; border:1px solid #45617b; border-radius:0.8rem; }
.style-quick button,.style-quick select { min-height:40px; max-width:100%; padding:0.35rem 0.6rem; border-radius:999px; border:1px solid #6487a8; background:#18334c; color:#f3f9ff; }
.style-quick .style-chip { border-width:3px; }
.style-chip[aria-pressed="true"] { outline:2px solid #5fe2b4; outline-offset:2px; }
#style-presets { display:flex; flex-wrap:wrap; gap:0.5rem; padding-top:1rem; border-top:1px solid #6487a8; }
#style-presets h4 { flex-basis:100%; margin:0.25rem 0; }
#style-presets input,#style-presets select { min-height:44px; max-width:100%; flex:1 1 180px; }
#style-confirm { max-width:min(32rem,90vw); padding:1.3rem; border-radius:1rem; background:#142a3d; color:#f3f9ff; border:2px solid #5fe2b4; }
/* Shared comic jobs stay outside the disposable 3D world. */
#comic-status-chip{position:fixed;z-index:10014;top:max(var(--comic-chip-top,0px),calc(max(8px,env(safe-area-inset-top)) + 56px));left:max(10px,env(safe-area-inset-left));right:calc(104px + env(safe-area-inset-right));max-width:620px;display:grid;gap:6px;pointer-events:none}
#comic-status-chip[hidden]{display:none}
#comic-status-chip button{box-sizing:border-box;width:100%;min-height:48px;padding:9px 12px;white-space:normal;overflow-wrap:anywhere;text-align:left;font:600 20px/1.3 system-ui,sans-serif;color:#f2fbff;background:#17374ef2;border:1px solid #85bdd6;border-radius:12px;box-shadow:0 4px 16px #0007;pointer-events:auto;touch-action:manipulation}
#comic-status-chip button[data-status=complete]{justify-self:start;width:auto;max-width:100%;display:flex;align-items:center;gap:9px;border-radius:999px;border-color:#a3ffd0;background:#103c2ff5;box-shadow:0 0 10px #78fbb077,0 0 26px #49eaaa55,0 4px 16px #0007}
#comic-status-chip button[data-status=complete]::before{content:"";flex:0 0 12px;width:12px;height:12px;border-radius:50%;background:#beffd7;box-shadow:0 0 7px #9affbf,0 0 18px #66e39c;pointer-events:none}
#comic-exit{position:fixed;z-index:10015;top:calc(max(8px,env(safe-area-inset-top)) + 56px);right:max(8px,env(safe-area-inset-right));box-sizing:border-box;max-width:92px;min-height:48px;padding:8px;border:1px solid #ffe3a0;border-radius:16px;background:#493417f5;color:#fff8de;font:600 17px/1.2 system-ui,sans-serif;touch-action:manipulation;box-shadow:0 3px 14px #0008;cursor:pointer}
#comic-exit[hidden]{display:none}
#comic-exit:focus-visible{outline:3px solid #ffd54a;outline-offset:3px}
#comic-status-chip button[data-status=failed],#comic-status-chip button[data-status=uncertain]{border-color:#ffb084;background:#542e20f5}
#comic-status-chip button:focus-visible{outline:3px solid #ffd54a;outline-offset:3px}
.comic-status-announcement{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.comic-library{position:fixed;left:max(8px,env(safe-area-inset-left));bottom:max(8px,env(safe-area-inset-bottom));z-index:10012;max-width:min(360px,calc(100vw - 120px));color:#e6f4fa;background:#101d2bf2;border:1px solid #6da0b7;border-radius:10px;box-shadow:0 4px 20px #0006;font:14px/1.35 system-ui,sans-serif}
.comic-library summary{cursor:pointer;padding:9px 12px;font-weight:700}.comic-library-body{display:grid;gap:8px;padding:10px;max-height:55dvh;overflow:auto}.comic-library select{max-width:100%;color:inherit;background:#203346;padding:5px}.comic-library button,.comic-viewer button{padding:7px;border:1px solid #7692a5;border-radius:5px;background:#20384f;color:#f5fcff;cursor:pointer}.comic-library p{margin:0}.comic-library small{font-size:12px;color:#b9d2df}.comic-entry{display:flex;flex-wrap:wrap;gap:7px;border-top:1px solid #456;padding:9px 0}.comic-entry strong,.comic-entry p{flex-basis:100%;overflow-wrap:anywhere}.comic-viewer{background:#0b1522;color:#eaf6ff;border:1px solid #8ab7ce;border-radius:10px;padding:10px;width:min(96vw,1556px);max-height:94dvh}.comic-viewer::backdrop{background:#000b}.comic-viewer-bar{display:flex;align-items:center;gap:12px;margin-bottom:8px}.comic-viewer-bar strong{flex:1;overflow-wrap:anywhere}.comic-viewer img{display:block;max-width:100%;max-height:82dvh;margin:auto;object-fit:contain}
#comic-transport,.comic-library { font-size:28px;box-sizing:border-box; }
.comic-library { max-width:min(760px,calc(100vw - 16px));max-height:calc(100dvh - max(8px,env(safe-area-inset-top)) - max(8px,env(safe-area-inset-bottom)));overflow-y:auto;overscroll-behavior:contain; }
.comic-library small { font-size:24px; }
.comic-entry { display:block;min-width:0;border:1px solid #52758a;border-radius:9px;padding:0;margin:10px 0; }
.comic-entry > summary { min-height:48px;box-sizing:border-box;overflow-wrap:anywhere; }
.comic-entry > summary strong,.comic-entry > summary span { display:block; }
.comic-entry > summary span { font-size:.8em;font-weight:400;color:#c4e5f3; }
.comic-job-body { display:grid;gap:10px;padding:10px;min-width:0; }
.comic-job-body :is(p,small,li) { min-width:0;overflow-wrap:anywhere; }
.comic-submitted-settings { padding:8px;background:#18374a;border-radius:6px; }
.comic-stages { margin:0;padding-left:1.4em; }
.comic-stages li { padding:5px 0; }
.comic-stages [data-state=complete] { color:#adf5c8; }
.comic-stages [data-state=running] { color:#ffe6a1;font-weight:700; }
.comic-job-error,#comic-projection-warning { color:#ffd1b3; }
.comic-library-body { overscroll-behavior:contain; }
.comic-job-body .comic-inspection { margin:0; }
.comic-viewer { font:32px/1.35 system-ui,sans-serif;box-sizing:border-box; }
.comic-viewer-bar { flex-wrap:wrap; }
:is(#comic-transport,.comic-library,.comic-viewer) :is(button,select,input,output) { font:inherit;min-width:0; }
:is(#comic-transport,.comic-library,.comic-viewer) button { min-height:48px; }
#comic-transport { max-width:min(960px,calc(100vw - 16px));max-height:42dvh;z-index:10013; }
#comic-transport label,.comic-library label { flex-wrap:wrap;overflow-wrap:anywhere; }
.comic-active .comic-library { display:none; }
#comic-transport { display:block; }
#comic-transport .comic-transport-header,#comic-transport-content,#comic-transport-content > div { display:flex;flex-wrap:wrap;gap:6px; }
#comic-transport .comic-transport-header { position:sticky;top:-10px;padding:4px 0 8px;background:#10243a;z-index:1; }
#comic-transport-content[hidden] { display:none; }
.comic-library > summary > button { margin-left:12px; }
:is(#comic-transport,.comic-library).comic-compact { zoom:.4;left:max(20px,calc(env(safe-area-inset-left)*2.5));bottom:max(20px,calc(env(safe-area-inset-bottom)*2.5)); }
.comic-library.comic-compact { max-height:calc((100dvh - max(8px,env(safe-area-inset-top)) - max(8px,env(safe-area-inset-bottom))) * 2.5); }
.drone-hud .drone-tools { --drone-tools-top:max(var(--comic-tools-top,0px),calc(max(8px,env(safe-area-inset-top)) + 48px));top:var(--drone-tools-top);max-height:max(44px,calc(100dvh - var(--drone-tools-top) - 150px)); }
.cinematic-ui-available .drone-hud .drone-tools { --drone-tools-top:max(var(--comic-tools-top,0px),110px,calc(env(safe-area-inset-top) + 102px)); }
.comic-settings { margin:12px 0;padding:8px;border:1px solid #7493a7;border-radius:8px; }
.comic-settings label { display:flex;flex-wrap:wrap;gap:8px;margin:12px 0; }
.comic-inspection { margin:16px 0; }
.comic-inspection label { display:block;margin:18px 0; }
.comic-inspection textarea { display:block;box-sizing:border-box;width:100%;min-height:160px;margin-top:8px;background:#112739;color:#fff;border:1px solid #7493a7;border-radius:6px;padding:10px;font:24px/1.4 monospace;white-space:pre-wrap;overflow-wrap:anywhere; }
.comic-viewer-bar { position:sticky;top:0;background:#0c1d2b;z-index:1;padding-bottom:8px; }
.comic-viewer-bar strong { flex:1 1 100%;min-width:0; }
.comic-viewer-bar span { flex:1 1 16rem;min-width:0;overflow-wrap:anywhere; }
.comic-viewer-bar button { flex:0 0 auto; }

#narration-toggle { position:fixed;right:max(8px,env(safe-area-inset-right));top:max(9px,env(safe-area-inset-top));z-index:1310;width:84px;box-sizing:border-box;min-height:44px;padding:5px 3px;font-size:60%;line-height:1.2;white-space:pre-line;text-align:center;border-radius:9px;background:#193749;color:#fff;border:1px solid #71a5ae; }
#narration-transport { position:fixed;right:8px;top:54px;z-index:1320;max-width:min(400px,calc(100vw - 16px));max-height:45dvh;overflow:auto;display:flex;gap:8px;flex-wrap:wrap;background:#102b39f5;color:#fff;padding:12px;border-radius:12px; }
#narration-transport[hidden] { display:none; }
#narration-transport strong,#narration-transport span,#narration-captions { flex-basis:100%; }
#narration-transport audio { max-width:100%; }
#narration-transport button,#narration-transport select { min-height:36px; }

/* Measured control stacks share displayed coordinates, including Compact. */
body:not(.in-world) .toolbar { top:var(--comic-main-top,64px);margin-top:var(--comic-main-top,64px); }
body:not(.in-world) .flow-tool { scroll-margin-top:calc(var(--comic-main-top,64px) + 8px); }
.video-password-notice { pointer-events:none; }
#comic-status-chip { top:var(--comic-chip-top,64px);right:auto;width:var(--comic-chip-width,150px);max-width:calc(100vw - 120px); }
#comic-status-chip button,#comic-status-chip button[data-status=complete] { width:100%;font:600 13px/1.2 system-ui;min-height:44px;padding:8px;border-radius:10px;gap:5px; }
#comic-status-chip button[data-status=complete]::before { flex-basis:7px;width:7px;height:7px; }
.cinematic-ui-active:not(.cinematic-ui-hidden):not(.cinematic-panel-hidden) #cinematic-ui-toggle { visibility:visible; }
.drone-hud .drone-toggle,.cinematic-ui-available .drone-toggle { top:var(--comic-toggle-top,62px); }
.drone-hud .drone-tools,.cinematic-ui-available .drone-hud .drone-tools { --drone-tools-top:var(--comic-tools-top,110px); }
#cinematic-view,#narration-transport,#comic-exit { top:var(--comic-right-top,64px); }
.cinematic-holds { top:var(--comic-right-top,116px);bottom:var(--comic-right-bottom,156px);padding-top:0; }
.cinematic-panel,.cinematic-ui-active .cinematic-panel { max-height:calc(100dvh - var(--comic-right-top,64px) - 12px); }
.comic-library:not(.comic-compact) { font-size:16px;max-width:min(560px,calc(100vw - 16px)); }
.comic-library:not(.comic-compact) > summary { font:600 13px/1.2 system-ui;padding:6px 8px; }
.comic-library:not(.comic-compact) > summary > button { font:inherit;min-height:32px;margin-left:5px;padding:5px 7px; }
.comic-library:not(.comic-compact) small { font-size:13px; }
.comic-library:not(.comic-compact) .comic-inspection textarea { font-size:13px;min-height:100px; }
.comic-library:not(.comic-compact) .comic-settings { margin:6px 0;padding:5px; }
.comic-library:not(.comic-compact) .comic-settings label { margin:6px 0;gap:5px; }
.comic-library:not(.comic-compact) .comic-library-body { max-height:42dvh; }
.comic-create-setup { border:1px solid #52758a;border-radius:7px;padding:5px; }
.comic-create-setup { display:grid;gap:9px;padding:12px;background:linear-gradient(135deg,#19364b,#102333); }
.comic-brief-label { display:grid;gap:7px;font-weight:650; }
#comic-user-prompt { box-sizing:border-box;width:100%;min-height:100px;resize:vertical;padding:12px;border:1px solid #6796b0;border-radius:9px;background:#091a29;color:#effaff;font:inherit;line-height:1.45; }
#comic-user-prompt::placeholder { color:#a5c0d0;opacity:1; }
#comic-user-prompt:focus { outline:2px solid #9eead5;outline-offset:2px;box-shadow:0 0 0 5px #7ee8d016; }
#comic-run { justify-self:start; }
.comic-create-setup > :not(summary) { margin-bottom:8px; }
#comic-quick-target { display:block;max-width:100%;margin-top:3px;font-size:.85em;color:#c8e3ee;white-space:nowrap;text-overflow:ellipsis;overflow:hidden; }
#comic-quick-progress { display:flex;flex-wrap:wrap;align-items:center;gap:5px;padding-top:5px;margin-top:4px;border-top:1px solid #52758a;font-size:.85em; }
#comic-quick-progress[hidden] { display:none; }
.comic-progress-label,.comic-progress-steps { flex-basis:100%;min-width:0;max-width:100%;overflow-wrap:anywhere; }
.comic-progress-steps { display:flex;flex-wrap:wrap;gap:4px; }
.comic-progress-steps > span { box-sizing:border-box;min-width:0;max-width:100%;white-space:normal;overflow-wrap:anywhere;background:#244257;border-radius:6px;padding:4px; }
.comic-progress-steps > [data-state=complete] { color:#adf5c8; }
.comic-progress-steps > [data-state=running] { color:#ffe6a1; }
.comic-library:not(.comic-compact) #comic-quick-progress button { min-height:28px;font-size:12px;padding:4px 7px; }
#comic-transport:not(.comic-compact) { font-size:14px;max-width:min(960px,calc(100vw - 16px));padding:5px; }
#comic-transport:not(.comic-compact) .comic-transport-header { flex-wrap:nowrap;align-items:center;padding:2px 0 5px;gap:5px; }
#comic-transport:not(.comic-compact) .comic-transport-header strong { flex:1 1 auto;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; }
#comic-transport:not(.comic-compact) .comic-transport-header span { flex:0 1 auto;font-size:12px; }
#comic-transport:not(.comic-compact) :is(button,select) { min-height:32px;padding:5px;white-space:nowrap; }
#comic-transport:not(.comic-compact) #comic-transport-content { flex-wrap:nowrap;overflow-x:auto;align-items:center;gap:5px; }
#comic-transport:not(.comic-compact) #comic-transport-content > div { flex-wrap:nowrap;flex-shrink:0;gap:4px; }
#comic-transport:not(.comic-compact) label { flex-wrap:nowrap;flex-shrink:0;white-space:nowrap; }
#comic-transport:not(.comic-compact) input[type=range] { width:100px; }

/* boxSwap owns its typography; comic art dialogs keep their existing scale. */
#boxswap-dialog {font:16px/1.5 system-ui,sans-serif;padding:20px;border:1px solid #48738b;border-radius:18px;box-shadow:0 20px 80px #0009;}
#boxswap-dialog h2 {font:700 22px/1.25 system-ui;text-align:left;letter-spacing:normal;margin:0 0 12px;padding:0 0 12px;color:#c2edff;overflow-wrap:anywhere;}
#boxswap-dialog p {margin:8px 0 14px;color:#c6dbe7;}
#boxswap-dialog button {font:600 16px/1.3 system-ui;min-height:44px;padding:10px 14px;margin:4px;border-radius:9px;}
#boxswap-dialog details {margin-top:12px;border:1px solid #36576e;border-radius:10px;background:#112c40;}
#boxswap-dialog summary {font-size:17px;min-height:44px;box-sizing:border-box;}
#boxswap-dialog .boxswap-keep {display:flex;align-items:center;gap:12px;min-height:48px;margin:10px 0;}
#boxswap-dialog input[type=checkbox] {width:22px;height:22px;accent-color:#78dbc1;}
#boxswap-dialog .boxswap-card {padding:12px;border-top:1px solid #36576e;overflow-wrap:anywhere;}
#boxswap-dialog .boxswap-card video {display:block;width:100%;aspect-ratio:16/9;object-fit:contain;background:#050d14;border-radius:8px;}
#boxswap-dialog .boxswap-card button {display:block;width:calc(100% - 8px);background:#236b73;}

#comic-exit {top:auto;bottom:max(18px,env(safe-area-inset-bottom));right:max(18px,env(safe-area-inset-right));max-width:150px;}
