:root{--top:64px;--dock:78px;--side:300px;--shelf:82px;--bg:#303a46;--panel:#354150;--raised:#425063;--ink:#f3f6fa;--muted:#b1bfce;--accent:#9ce4d1;--accent-ink:#153e38;--line:#536174;--danger:#ffb1a7}
*{box-sizing:border-box}html,body{margin:0;height:100%;overflow:hidden;background:var(--bg);color:var(--ink);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;-webkit-font-smoothing:antialiased}body{overscroll-behavior:none}button,input,select{font:inherit}button{color:inherit;cursor:pointer;touch-action:manipulation;-webkit-tap-highlight-color:transparent}button:disabled{opacity:.32;cursor:default}button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:3px}button{border:1px solid transparent;background:transparent;border-radius:10px;min-height:48px;font-size:13px;font-weight:550}button:hover:not(:disabled){background-color:#ffffff10}button:active:not(:disabled){background-color:#ffffff18}.hidden,[hidden]{display:none!important}svg{width:22px;height:22px;display:block;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}.fill{fill:currentColor;stroke:none}
#app{position:fixed;inset:0;display:grid;grid-template-columns:var(--dock) minmax(0,1fr) var(--side);grid-template-rows:var(--top) minmax(0,1fr) var(--shelf);isolation:isolate}#app.inspector-closed{grid-template-columns:var(--dock) minmax(0,1fr) 0}#app.inspector-closed .inspector{display:none}
.topbar{grid-column:1/-1;grid-row:1;display:flex;align-items:center;gap:8px;padding:8px 16px;background:#252e39;border-bottom:1px solid #566477;z-index:50;box-shadow:0 2px 8px #14202c28}.brandBlock{display:flex;align-items:center;gap:10px;min-width:180px}.mark{width:28px;color:var(--accent)}.mark svg{width:27px;height:27px}.projectName{max-width:204px;width:17vw;min-width:110px;border:1px solid transparent;border-radius:8px;background:transparent;color:var(--ink);font-size:16px;font-weight:650;padding:10px 6px;height:48px}.projectName:focus{background:#ffffff0c}.topHistory{display:flex;gap:4px;padding-left:8px;border-left:1px solid #506071}.topIcon{width:48px;display:grid;place-items:center}.topText{padding:0 15px;color:#dce5ed;white-space:nowrap}.topSpacer{flex:1}.topText.strong{border-color:#657587;background:#405064}#imageBtn{background:var(--accent);border-color:var(--accent);color:var(--accent-ink)}.saveState{font-size:12px;color:var(--muted);display:flex;align-items:center;gap:6px;white-space:nowrap;margin-right:10px}.saveState span{width:6px;height:6px;border-radius:50%;background:#9ed8ae}.saveState.dirty span{background:#f1c486}.saveState.error span{background:var(--danger)}
.toolDock{grid-column:1;grid-row:2/-1;display:flex;flex-direction:column;align-items:center;gap:5px;padding:12px 5px calc(12px + env(safe-area-inset-bottom));background:#28323e;border-right:1px solid #5c6d7e;z-index:20;overflow-y:auto;scrollbar-width:thin;touch-action:pan-y}.tool{width:66px;min-height:58px;flex-shrink:0;display:flex;flex-direction:column;justify-content:center;align-items:center;gap:5px;color:#bac8d6;border-radius:9px}.tool span{font-size:11px;white-space:nowrap;letter-spacing:.015em}.tool.active{background:#9ce4d1;color:#153e38;box-shadow:0 3px 12px #14232f33}.tool.active svg{stroke-width:2}.dockRule{height:1px;background:#576475;width:38px;margin:6px 0;flex-shrink:0}
.stageShell{grid-column:2;grid-row:2;position:relative;min-width:0;min-height:0;overflow:hidden;background:#404d5c}#glCanvas{width:100%;height:100%;display:block;touch-action:none;outline:none;cursor:crosshair}.canvasFallback{position:absolute;inset:30px;display:grid;place-content:center;background:var(--panel);border:1px solid var(--danger);border-radius:12px;padding:24px;text-align:center}
.stageToolbar{position:absolute;left:14px;right:14px;top:14px;display:flex;justify-content:space-between;align-items:flex-start;gap:10px;pointer-events:none;z-index:15}.viewBar,.displayBar{display:flex;align-items:center;gap:3px;pointer-events:auto}.viewBar{padding:3px;background:#293440e8;border:1px solid #677a8b77;border-radius:12px;box-shadow:0 5px 16px #15212d22}.viewButton{display:flex;align-items:center;justify-content:center;gap:5px;padding:0 10px;min-width:48px;color:#becbd8}.viewButton span{font-size:12px}.viewButton.active{background:#536477;color:#fff}.viewButton b{font-size:22px}.displayBar{padding:3px;background:#293440ed;border:1px solid #677a8b77;border-radius:12px;box-shadow:0 5px 16px #15212d22}.modeSwitch{display:flex;gap:2px}.modeSwitch button{padding:0 12px;font-size:12px;color:#c2cddb}.modeSwitch button.active{background:#dae4ed;color:#243745;box-shadow:0 1px 3px #091e3820}.modeSwitch button[data-render-mode=quality].active{background:#c5d9f2;color:#1e3854}.lightingButton{border-left:1px solid #61728455;display:flex;align-items:center;gap:6px;padding:0 9px;border-radius:4px 9px 9px 4px}.lightingButton span{font-size:12px}.viewRule{display:none}
.viewportStatus{position:absolute;left:16px;bottom:12px;display:flex;gap:12px;color:#d0dbe5;font-size:11px;padding:5px 8px;background:#24313d96;border-radius:6px;pointer-events:none}.interactionHint{position:absolute;right:12px;bottom:12px;font-size:11px;color:#c0cddb;pointer-events:none;max-width:54%;text-align:right}.toast{position:absolute;left:50%;bottom:112px;transform:translate(-50%,6px);max-width:90%;padding:13px 18px;background:#eff5fa;color:#253947;border-radius:10px;font-size:13px;font-weight:600;box-shadow:0 8px 32px #16263840;opacity:0;pointer-events:none;transition:opacity .15s,transform .15s;z-index:80}.toast.show{opacity:1;transform:translate(-50%,0)}
.planeBar{position:absolute;left:16px;bottom:46px;display:flex;align-items:center;background:#283745ed;border:1px solid #75879a99;border-radius:11px;padding:3px;box-shadow:0 3px 12px #17233222;z-index:12}.planeBar button{height:48px;min-width:48px}.planeBar #planePopoverBtn{display:flex;gap:8px;align-items:center;padding:0 10px}.axisDot{width:9px;height:9px;background:#9ce4d1;border-radius:2px;display:block}.smallArrow{margin-left:7px;color:#b7c4d2}.planeGizmo{position:absolute;width:64px;min-height:48px;padding:5px;background:#c5ece2;color:#19473e;border:1px solid #e8fff8;border-radius:9px;z-index:10;touch-action:none;cursor:ns-resize;box-shadow:0 3px 16px #14293722}.planeGizmo span{font-size:22px;margin-right:5px}.planeGizmo b{font-size:11px}
.inspector{grid-column:3;grid-row:2;min-height:0;background:#333f4f;overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;border-left:1px solid #67788b;z-index:22;scrollbar-width:thin}.inspectorSection{padding:19px 18px;border-bottom:1px solid #5d708455}.sectionHeading,.compactHeading{display:flex;align-items:center;justify-content:space-between;gap:8px}.sectionHeading{padding-bottom:15px;border-bottom:1px solid #62778b55}.sectionHeading small{font-size:11px;color:#c1cede;letter-spacing:.1em}.sectionHeading h2{font-size:21px;letter-spacing:.015em;margin:4px 0 0}.collapseInspector{width:48px;flex-shrink:0;font-size:28px;color:#cbd8e5;border:1px solid #74869c66;background:#425166}.inspector h3{font-size:14px;margin:0 0 15px}.fieldGroup{margin-top:20px}.fieldGroup.tight{margin-top:14px}.fieldGroup>label,.fieldLabel label{font-size:13px;color:#d4dfeb}.fieldLabel{display:flex;justify-content:space-between;align-items:center;gap:6px}.fieldLabel output{font-size:14px;color:#e6eff7;font-variant-numeric:tabular-nums;background:#263343;padding:4px 9px;border-radius:6px}.segmented{display:grid;grid-template-columns:repeat(2,1fr);gap:4px;margin-top:8px;padding:4px;background:#243140;border:1px solid #56697e77;border-radius:11px}.segmented.three,.segmented.axis{grid-template-columns:repeat(3,1fr)}.segmented button{font-size:13px;color:#b9c8d9;min-width:0;padding:0 6px}.segmented button.active{background:#536b82;color:#fff;box-shadow:0 2px 5px #0f243233}.scopeGrid{display:grid;grid-template-columns:1fr 1fr;gap:6px;margin-top:9px}.scopeGrid button{border:1px solid #65788d;background:#344456;font-size:12px}.scopeGrid button.active{background:#9ce4d1;color:#153e38;border-color:#9ce4d1}.checkRow{display:flex!important;align-items:center;gap:10px;min-height:52px;font-size:13px!important;color:#d2dfed;margin-top:8px}.checkRow input{width:22px;height:22px;accent-color:var(--accent);margin:0;flex-shrink:0}.subtle{font-size:12px;line-height:1.75;color:#b5c5d6;margin:12px 0}.row{display:flex;gap:8px;flex-wrap:wrap}.actionButton,.selectionButtons button,.projectActions button{border:1px solid #708298;background:#465b70;padding:0 14px}.danger{color:var(--danger)!important}.selectionButtons{display:grid;grid-template-columns:1fr 1fr;gap:8px}
input[type=range]{appearance:none;-webkit-appearance:none;width:100%;height:48px;background:transparent;margin:2px 0 0;cursor:pointer;touch-action:none}input[type=range]::-webkit-slider-runnable-track{height:5px;background:#798fa5;border-radius:4px}input[type=range]::-webkit-slider-thumb{appearance:none;width:25px;height:25px;border-radius:50%;margin-top:-10px;background:#e6f5f1;border:3px solid #718896;box-shadow:0 2px 4px #091c3733}input[type=range]::-moz-range-track{height:5px;background:#798fa5;border-radius:4px}input[type=range]::-moz-range-thumb{width:22px;height:22px;border-radius:50%;background:#e6f5f1;border:2px solid #718896}input[type=number],input[type=text],#hexColor{height:48px;min-width:0;background:#243343;color:#f1f6fa;border:1px solid #72879d;border-radius:8px;padding:0 10px}
.brushShelf{grid-row:3;grid-column:2/-1;display:flex;align-items:center;gap:20px;padding:8px 18px calc(8px + env(safe-area-inset-bottom));border-top:1px solid #77899c77;background:#2c3847;z-index:25;min-width:0}.shelfPaint{display:flex;gap:10px;align-items:center;min-width:0}.paintCard{display:flex;align-items:center;gap:10px;height:62px;background:#3f5063;border:1px solid #8194a666;border-radius:11px;padding:6px 11px;min-width:153px;text-align:left;box-shadow:inset 0 1px #ffffff0a}.paintCard small{display:block;color:#c2d0dd;font-size:11px;margin-bottom:4px}.paintCard b{font-size:13px;display:block;color:#fff;white-space:nowrap}.colorSwatch{width:38px;height:38px;border-radius:7px;flex-shrink:0;border:1px solid #ffffff66}.materialCard{min-width:188px}.paintCard canvas{width:48px;height:48px;border-radius:7px;flex-shrink:0}.chevron{margin-left:auto;font-size:23px;color:#bdccd9}.shelfBrush{display:flex;align-items:center;gap:12px;flex:1;max-width:230px;min-width:115px}.shelfBrush label{font-size:12px;white-space:nowrap}.shelfBrush output{display:block;font-size:18px;font-weight:650;margin-top:4px}.shelfBrush input{min-width:45px}.shelfSettings{margin-left:auto;border:1px solid #71869d;background:#42576c;padding:0 14px;white-space:nowrap}.inspectorHandle{position:absolute;right:0;top:calc(var(--top) + 108px);min-height:56px;padding:0 12px;color:#dae9f4;background:#35485b;border:1px solid #91a6b9;border-radius:10px 0 0 10px;z-index:25}
.drawer{position:absolute;z-index:65;padding:22px;background:#3d4c5e;border:1px solid #9aafc177;border-radius:16px;box-shadow:0 20px 72px #10233355;max-height:calc(100% - 112px);overflow-y:auto;overscroll-behavior:contain;touch-action:pan-y;scrollbar-width:thin}.drawerHeader,.modalHeader{display:flex;align-items:center;justify-content:space-between;gap:20px;padding-bottom:16px;margin-bottom:15px;border-bottom:1px solid #8da3b544}.drawerHeader h2,.modalHeader h2{font-size:21px;font-weight:650;margin:0;color:#f1f7fb}.drawerHeader small,.modalHeader small{font-size:11px;color:#b8c9d8;display:block;margin-bottom:6px}.drawerClose,.modalClose{width:48px;min-width:48px;font-size:27px;line-height:1;background:#263b4d70;border:1px solid #7e96ab55;color:#dbe9f4}.drawerSubhead{font-size:13px;color:#c9d9e7;margin:18px 0 12px}#colorDrawer{width:380px;left:calc(var(--dock) + 16px);bottom:calc(var(--shelf) + 12px)}.colorMain{display:grid;grid-template-columns:1fr 1fr;gap:10px}#nativeColor{width:100%;height:80px;background:none;border:1px solid #8ca1b677;border-radius:9px;padding:4px}.colorHex{display:flex;flex-direction:column;gap:7px;font-size:12px}.colorSliders{margin-top:12px}.colorSliders label{display:grid;grid-template-columns:44px 1fr 48px;align-items:center;gap:7px;min-height:58px;font-size:13px}.colorSliders output{text-align:right;font-size:12px}.recentColors{display:grid;grid-template-columns:repeat(6,1fr);gap:8px}.recentColors button{height:48px;min-width:44px;border:1px solid #adc2d366;border-radius:8px}.primaryButton{background:var(--accent);color:var(--accent-ink);font-weight:650;width:100%;margin-top:18px;border-radius:9px}
.materialDrawer{left:50%;bottom:calc(var(--shelf) + 12px);transform:translateX(-50%);width:min(920px,calc(100% - 110px))}.materialDrawerBody{display:block}.selectedMaterial{display:flex;align-items:center;gap:18px;min-height:154px}.selectedMaterial canvas{width:142px;height:142px;flex-shrink:0;border-radius:9px}.selectedMaterial small{font-size:12px;color:#c4d5e4}.selectedMaterial h3{font-size:19px;margin:7px 0}.selectedMaterial p{font-size:13px;line-height:1.7;color:#c7d7e6;max-width:400px}.materialFilters{display:flex;gap:6px;flex-wrap:wrap;margin:18px 0 12px}.materialFilters button{min-height:48px;font-size:12px;color:#c6d6e6;padding:0 13px;border:1px solid #7891a555}.materialFilters button.active{background:#d0e3e9;color:#203c46;border-color:#d0e3e9}.materialGrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:10px}.materialTile{padding:6px;border:1px solid #748a9e88;background:#273b4f;border-radius:11px;text-align:left;min-width:0}.materialTile canvas{display:block;width:100%;height:auto;aspect-ratio:1;border-radius:7px}.materialTile span{font-size:12px;display:block;padding:9px 5px 5px;color:#e1edf4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.materialTile.active{border:2px solid var(--accent);padding:5px;background:#365951}.materialTile:hover{border-color:#d9eaf6}
.lightingDrawer{width:354px;right:20px;top:calc(var(--top) + 84px)}.planeDrawer{width:440px;left:calc(var(--dock) + 16px);bottom:calc(var(--shelf) + 106px)}.planeControls{display:grid;grid-template-columns:48px 1fr 48px;gap:8px;margin-bottom:14px}.planeControls .axis{grid-column:1/-1;margin-bottom:10px}.planeControls input{text-align:center;font-size:17px}.stepButton{border:1px solid #8298ad;background:#40596f;font-size:22px}.viewDrawer{left:calc(var(--dock) + 16px);top:calc(var(--top) + 84px);width:420px}.viewPresetGrid{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}.viewPresetGrid button{font-size:13px;border:1px solid #8295a855;min-width:48px;padding:0 6px}.viewToggleGrid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;margin:16px 0 23px}.viewToggleGrid .viewButton{border:1px solid #8295a855}.viewDrawer h3{font-size:14px;border-top:1px solid #ffffff22;padding-top:16px}
.modal{position:fixed;inset:0;z-index:90;background:#111d2da8;display:flex;align-items:center;justify-content:center;padding:24px;backdrop-filter:blur(5px);touch-action:pan-y}.modalCard{width:min(760px,100%);max-height:90vh;overflow-y:auto;background:#3d4e61;border:1px solid #99afc377;border-radius:18px;padding:24px;box-shadow:0 20px 90px #10203866;overscroll-behavior:contain}.samplesCard{width:min(1060px,100%)}.sampleGrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:14px}.sampleItem{padding:0;overflow:hidden;background:#283d50;border:1px solid #88a0b166;position:relative;text-align:left}.sampleItem img{width:100%;aspect-ratio:1.45;object-fit:cover;display:block}.sampleBadge{position:absolute;top:10px;left:10px;background:#192e40db;border:1px solid #d4edff33;border-radius:5px;font-size:11px;padding:5px 8px}.sampleInfo{padding:15px}.sampleInfo b{font-size:15px}.sampleInfo p{font-size:12px;line-height:1.65;color:#bdcede;margin:8px 0 0}.projectActions{display:flex;gap:8px;flex-wrap:wrap;margin-bottom:20px}.projectItem{display:flex;align-items:center;gap:8px;padding:12px 0;border-bottom:1px solid #ffffff22}.projectItem>div{flex:1;min-width:0}.projectItem b{font-size:15px;display:block}.projectItem small{font-size:12px;color:#beccdb;display:block;margin-top:6px}.projectItem button{padding:0 14px;background:#536d86;border:1px solid #7c96ac66}.popover{position:absolute;z-index:80;right:16px;top:calc(var(--top) + 8px);width:250px;background:#3d5065;border:1px solid #8aa0b688;padding:10px;border-radius:12px;box-shadow:0 12px 36px #112b4355}.popover button{display:block;width:100%;padding:0 12px;text-align:left}.popoverRule{height:1px;background:#ffffff22;margin:8px}.helpColumns{display:grid;grid-template-columns:repeat(3,1fr);gap:20px}.helpColumns h3{font-size:15px}.helpColumns p{font-size:13px;line-height:1.7;color:#c7d8e6}.helpColumns b{display:block;color:#f4f8fa}
@media(max-height:860px){.toolDock{gap:3px;padding-top:6px}.tool{min-height:52px;gap:3px}.dockRule{margin:4px 0}.inspectorSection{padding:16px}.fieldGroup{margin-top:16px}}
@media(max-width:1200px){.saveState{display:none}.topbar{gap:5px}.topText{padding:0 12px}.interactionHint{display:none}.shelfSettings{font-size:12px;padding:0 10px}.brushShelf{gap:14px}.viewBar .viewButton{padding:0 7px}.modeSwitch button{padding:0 9px}.lightingButton span{display:none}}
@media(max-width:1000px){:root{--dock:76px;--side:0px}.inspector{position:absolute;top:var(--top);bottom:var(--shelf);right:0;width:294px;box-shadow:-15px 0 50px #132a4266;border-left:1px solid #96adbe99;display:none}.inspector.mobileOpen{display:block!important}.inspectorHandle{top:calc(var(--top) + 104px)}.topbar{padding-left:12px;padding-right:12px}.brandBlock{min-width:150px}.projectName{width:150px;max-width:150px;font-size:15px}.topHistory{padding-left:4px}.topText{padding:0 10px}.topbar .topIcon{width:46px;min-width:46px}.brushShelf{gap:12px;padding-left:14px;padding-right:14px}.materialCard{min-width:170px}.paintCard{min-width:146px}.shelfPaint{gap:8px}.stageToolbar{left:12px;right:12px}.materialGrid{grid-template-columns:repeat(auto-fill,minmax(113px,1fr))}.sampleGrid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){:root{--top:60px;--dock:64px;--shelf:78px}.tool{width:56px}.tool span{font-size:10px}.topbar{gap:2px;padding:6px}.brandBlock{min-width:98px;gap:3px}.mark{display:none}.projectName{min-width:88px;width:88px;font-size:13px}.topText{padding:0 7px;font-size:12px}.topHistory{gap:0;border:none}.topbar .topIcon{width:44px;min-width:44px}#openBtn{display:none}.stageToolbar{flex-wrap:wrap;gap:5px}.displayBar{margin-left:auto}.viewBar .viewButton span{display:none}.viewBar{gap:0}.modeSwitch button{font-size:11px;padding:0 7px}.lightingButton{padding:0 6px}.brushShelf{padding:8px;gap:8px;overflow-x:auto}.shelfSettings{min-width:68px;white-space:normal;font-size:11px;line-height:1.5}.paintCard{min-width:120px;padding:6px;gap:6px}.paintCard b{font-size:11px}.materialCard{min-width:150px}.colorSwatch{width:30px;height:34px}.paintCard canvas{width:38px;height:38px}.chevron{display:none}.drawer{padding:16px;max-width:calc(100% - 80px);max-height:calc(100% - 100px)}.lightingDrawer{right:8px}.viewDrawer{left:72px}.planeDrawer{left:72px}.materialDrawer{width:calc(100% - 80px);left:calc(50% + 26px)}.selectedMaterial canvas{width:100px;height:100px}.selectedMaterial{gap:12px}.selectedMaterial h3{font-size:17px}.selectedMaterial p{font-size:11px;line-height:1.5}.materialGrid{grid-template-columns:repeat(2,minmax(0,1fr))}.planeBar{left:9px;bottom:45px}.planeBar #planePopoverBtn{font-size:11px;padding:0 6px}.planeBar button{min-width:44px}.viewportStatus{left:9px;font-size:10px;gap:7px}.helpColumns{grid-template-columns:1fr}.sampleGrid{grid-template-columns:1fr}.modal{padding:12px}.modalCard{padding:16px}.planeGizmo{width:58px}}

/* Overlay height always respects the fixed title bar and brush shelf. */
.drawer{max-height:calc(100% - var(--top) - var(--shelf) - 32px)}
.lightingDrawer,.viewDrawer{max-height:calc(100% - var(--top) - var(--shelf) - 100px)}

/* Keep the close action reachable while scrolling a tall material collection. */
.drawerHeader{position:sticky;top:-22px;z-index:4;background:#3d4c5e;padding-top:12px;margin-top:-12px;box-shadow:0 3px 0 #3d4c5e}
.materialDrawer{overflow-anchor:none}
.materialFilters{position:relative;z-index:1}
@media(min-width:681px){.lightingButton span{display:inline}.lightingButton{padding:0 10px}}
@media(max-width:680px){.drawerHeader{top:-16px}}

[data-render-mode="quality"][aria-busy="true"]{outline:1px solid #b7d887;outline-offset:2px;}

/* Tool groups, a stable viewport, and explicit rendering controls. */
:root{--dock:84px;--bg:#323b45;--panel:#414e5d;--accent:#b8df91}
.toolDock{gap:0;padding:8px 8px 14px;overflow:auto;scrollbar-width:thin;background:#303b47}
.toolGroup{display:flex;flex-direction:column;gap:3px;width:100%;border-top:1px solid #a8bfce28;margin-top:9px;padding-top:7px}
.toolGroup:first-child{margin-top:0;padding-top:0;border-top:0}
.toolGroup h3{font-size:10px;font-weight:600;letter-spacing:.08em;color:#b7c9d9;margin:0 0 3px 8px;line-height:16px}
.tool{width:100%;min-height:48px;gap:2px;border-radius:9px;flex:none}
.tool span{font-size:11px;font-weight:550;line-height:14px;white-space:nowrap}
.tool svg{width:21px;height:21px}
.tool.active{background:#c5e4a6;color:#233c28;border-color:#d6eeca;box-shadow:inset 3px 0 0 #f0ffd9}
.tool:hover:not(.active){background:#516274}
.stageShell{container-type:inline-size}
.stageToolbar{display:flex;align-items:flex-start;flex-wrap:wrap;gap:7px;left:14px;right:14px;top:12px;pointer-events:none}
.stageToolbar>nav,.stageToolbar>div{pointer-events:auto}
.viewBar{margin:0;padding:3px;border:1px solid #a6bfce4d;background:#303d4ce8;box-shadow:0 2px 8px #1424321f}
.viewBar .viewButton{min-width:48px;min-height:48px;font-size:11px}
.cameraPresets{display:flex;padding:3px;border:1px solid #a6bfce4d;border-radius:11px;background:#303d4ce8;gap:2px}
.cameraPresets button{min-width:48px;min-height:48px;width:48px;border-radius:8px;background:transparent;color:#dae8f2;border:0;font-size:12px}
.cameraPresets button:hover{background:#566b7e}.cameraPresets button:last-child{width:58px}
.displayBar{margin-left:auto;min-height:54px;background:#303d4ce8;border-color:#a6bfce4d}
.modeSwitch button{font-size:12px;min-height:48px;padding:0 12px}.lightingButton{min-height:48px}
.modeSwitch button.active{background:#d3e4ea;color:#213d4a}.modeSwitch button[data-render-mode=render].active{background:#e1c797;color:#40311b}
.lightingButton span{display:inline;font-size:11px}
.inspector{background:#3d4b5a}.inspectorSection{border-color:#9db3c02b}.sectionHeading{border-bottom:1px solid #a9b9c838;padding-bottom:16px}
.sectionHeading small{font-size:11px;color:#bed1e1}.sectionHeading h2{color:#f4f8fb}
.fieldGroup>label,.fieldLabel label{color:#e0eaf2;font-size:13px}.fieldGroup{margin-top:20px}
.segmented button{min-height:48px;font-size:12px}.segmented button.active{background:#d3e4ea;color:#1e3b4b;border-color:#e3f5fb}
input[type=range]{min-height:44px;touch-action:none}
#selectionMarquee{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;z-index:10}
#marqueePath{fill:#52cfff25;stroke:#8bdcff;stroke-width:1.5;stroke-dasharray:6 4;stroke-linejoin:round}
.selectionHeading{display:flex;align-items:center;justify-content:space-between;gap:4px}.selectionHeading output{color:#a4ddf1;font-size:12px}
.selectionButtons{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:12px}.selectionButtons button{min-height:48px;padding:6px;font-size:12px;background:#51667b;border:1px solid #a2bacf4d;border-radius:8px;color:#f2f7fa}
.selectionButtons button:disabled{opacity:.35}.selectionButtons button.confirm{background:#bedf9f;color:#1e3626;font-weight:650}
.transformFields p{font-size:12px;line-height:1.6;color:#cfdfec}.offsetFields{display:grid;grid-template-columns:repeat(3,1fr);gap:8px}.offsetFields label{font-size:12px}.offsetFields input{width:100%;min-height:48px;padding:0 7px}
#overlapCount{font-size:12px;color:#e8c791;display:block;margin-top:12px}
#selectionGizmo{position:absolute;z-index:12;width:0;height:0;pointer-events:none}
#gizmoLines{position:absolute;left:-120px;top:-120px;width:240px;height:240px;overflow:visible;pointer-events:none}
#gizmoLines line{stroke-width:3;stroke-linecap:round}.line0{stroke:#f08b77}.line1{stroke:#a7df9b}.line2{stroke:#89baff}
.moveHandle{position:absolute;width:48px;height:48px;min-width:48px;min-height:48px;border-radius:50%;border:2px solid #ffffff9c;pointer-events:auto;touch-action:none;font-weight:700;box-shadow:0 3px 12px #14253466}
.axisX{background:#bb564b;color:#fff}.axisY{background:#42754b;color:#fff}.axisZ{background:#446fa7;color:#fff}.moveCenter{background:#3b718e;color:white;left:-24px;top:-24px;font-size:27px}
#selectionFloat{position:absolute;z-index:13;bottom:78px;left:50%;transform:translateX(-50%);display:flex;align-items:center;gap:9px;max-width:90%;padding:7px;background:#2e4559f5;border:1px solid #82bfd5;border-radius:11px;box-shadow:0 8px 25px #10232d55}
#selectionFloat span{font-size:12px;white-space:nowrap;padding-left:5px}#selectionFloat button{min-width:58px;min-height:48px;padding:0 10px;background:#496276;border:1px solid #82acc255;color:#e9f2fa;border-radius:8px}#floatConfirm{background:#bede9d!important;color:#263822!important}
#selectionSection.hidden{display:none!important}
#planeDrawer select,#lightingDrawer select{width:100%;height:48px;border:1px solid #9aaec355;border-radius:8px;background:#314357;color:#e7f1f9;padding:0 12px;font-size:13px}
.planeBar{border-color:#80d4cf88;background:#234b53f2;bottom:40px;left:14px;box-shadow:0 5px 18px #122b3840}
.planeBar #planePopoverBtn{color:#e2fff8;min-height:48px}.planeBar button{min-width:48px;min-height:48px}.axisDot{background:#76efcc!important}
#planePopoverBtn:before{content:'作業面';font-size:10px;color:#9fe8db;display:inline;margin-right:8px}
.planeGizmo{min-height:48px;min-width:64px;touch-action:none;background:#244f56;border-color:#82e8d7;color:#e5fff9}
.wideButton{width:100%;min-height:48px;border:1px solid #b3cada4d;background:#51697d;color:#f3f8fc;border-radius:9px;margin-top:12px;padding:8px;font-size:12px}
.lightingDrawer{width:370px;max-height:calc(100% - var(--top) - var(--shelf) - 28px);top:calc(var(--top) + 10px);right:14px}
.renderNote{font-size:12px;line-height:1.7;color:#c7d8e6}.renderActions{display:flex;gap:8px}.renderActions button{min-height:48px;flex:1;background:#506980;border:1px solid #a3bacf4d;border-radius:8px}
.controlGroupTitle{font-size:13px;border-top:1px solid #a4b8ca44;padding-top:18px;margin-top:24px;color:#dce8f3}
.renderProgress{position:absolute;z-index:14;bottom:12px;left:50%;transform:translateX(-50%);padding:5px 6px 5px 13px;display:flex;align-items:center;gap:10px;border:1px solid #cdbb9866;border-radius:10px;background:#344453ee;color:#f0e4cd;font-size:12px;white-space:nowrap;max-width:95%}
.renderProgress button{min-width:48px;min-height:44px;padding:0 9px;border:1px solid #cdbb9866;border-radius:7px;background:#5b626a}.progressDot{width:6px;height:6px;border-radius:50%;background:#ead3a8;flex-shrink:0}
body:has([data-render-mode=render].active) .viewportStatus,body:has([data-render-mode=render].active) .planeBar,body:has([data-render-mode=render].active) .planeGizmo,body:has([data-render-mode=render].active) #selectionGizmo,body:has([data-render-mode=render].active) .interactionHint{display:none!important}
@container (max-width:870px){.stageToolbar .displayBar{margin-left:0}.stageToolbar{gap:6px}.cameraPresets{order:3}.cameraPresets button{height:48px}.viewBar .viewButton span{display:none}.viewBar .viewButton{padding:0 10px}.displayBar{margin-left:auto!important}}
@media(max-height:860px){.toolGroup{margin-top:6px;padding-top:5px}.toolGroup h3{font-size:9px;line-height:13px;margin-bottom:1px}.tool{min-height:48px}}
@media(max-width:1000px){:root{--dock:78px}.toolDock{padding:8px 6px}.tool span{font-size:10px}.tool{min-height:48px}.cameraPresets button{width:48px}}
@media(max-width:680px){:root{--dock:72px}.toolDock{padding:7px 4px}.tool span{font-size:10px}.toolGroup h3{font-size:9px;margin-left:4px}.lightingButton span{display:none}#viewOptionsBtn span{display:none}.cameraPresets button{width:48px;min-width:48px}.cameraPresets{gap:0}#selectionFloat{flex-wrap:wrap;width:90%;justify-content:center}#selectionFloat span{flex-basis:100%;text-align:center}.planeBar{bottom:38px;left:8px}#planePopoverBtn:before{display:none}.renderProgress{font-size:10px;gap:5px}.renderProgress button{min-height:44px}.materialDrawer{max-width:calc(100% - 90px)}}

/* Frequently changed size stays in the fixed shelf, including narrow windows.
   Less frequent options remain in the inspector. Its visibility does not affect this shelf. */
:root{--shelf:calc(82px + env(safe-area-inset-bottom,0px))}
.brushShelf{display:grid;grid-template-areas:"paint size settings";grid-template-columns:auto minmax(260px,1fr) 124px;gap:16px;padding:8px 18px calc(8px + env(safe-area-inset-bottom,0px));overflow:visible}
.shelfPaint{grid-area:paint}
.shelfSizeSlot{grid-area:size;min-width:0}
.shelfBrush{display:grid;grid-template-columns:64px 48px minmax(0,1fr) 48px;align-items:center;gap:8px;min-width:0;max-width:none;width:100%;height:62px;padding:6px 10px;border:1px solid #8198aa99;border-radius:11px;background:#3d5265}
.shelfBrush label{font-size:12px;line-height:16px;color:#e5eef5;white-space:nowrap}
.shelfBrush output{font-size:19px;line-height:22px;margin-top:1px;color:#fff;font-variant-numeric:tabular-nums}
.shelfBrush input{width:100%;min-width:0;height:48px;margin:0}
.sizeStep{width:48px;height:48px;min-height:48px;padding:0;background:#283e50;border:1px solid #8faabc77;border-radius:8px;font-size:22px;line-height:1}
.shelfToolHint{display:flex;align-items:center;min-height:62px;margin:0;padding:8px 12px;color:#d3e2ed;font-size:12px;line-height:1.6}
.shelfSettings{grid-area:settings;width:124px;min-height:48px;margin:0;padding:0 8px}
@media(max-width:960px){
 :root{--shelf:calc(134px + env(safe-area-inset-bottom,0px))}
 .brushShelf{grid-template-areas:"paint settings" "size size";grid-template-columns:minmax(0,1fr) 124px;grid-template-rows:56px 56px;gap:6px 12px;padding:8px 12px calc(8px + env(safe-area-inset-bottom,0px));overflow:visible}
 .shelfPaint{min-width:0;gap:8px}
 .paintCard,.materialCard{flex:1;min-width:0;height:56px;padding:4px 9px;gap:8px}
 .paintCard>span:not(.colorSwatch):not(.chevron){min-width:0}
 .paintCard b{overflow:hidden;text-overflow:ellipsis}
 .shelfBrush{height:56px;padding:3px 8px;grid-template-columns:64px 48px minmax(0,1fr) 48px}
 .shelfToolHint{min-height:56px}
}
@media(max-width:680px){
 .brushShelf{grid-template-columns:minmax(0,1fr) 48px;gap:6px 8px;padding-left:8px;padding-right:8px}
 .paintCard,.materialCard{padding:4px 6px;gap:6px}
 .paintCard b{font-size:11px}
 .paintCard canvas{width:38px;height:38px}
 .shelfSettings{width:48px;min-width:48px;height:48px;padding:0;font-size:0;line-height:1}
 .shelfSettings:before{content:'⚙';font-size:24px}
 .shelfBrush{grid-template-columns:48px 48px minmax(0,1fr) 48px;gap:6px}
 .shelfToolHint{font-size:11px}
}

/* Frequently used actions stay beside the current color and material.
   The inspector remains for less frequent tool-specific details. */
#app{grid-template-rows:var(--top) minmax(0,1fr) auto}
.toolDock{min-height:0}
.brushShelf{grid-template-areas:"paint size settings" "options options options";grid-template-columns:minmax(250px,310px) minmax(248px,1fr) 104px;grid-template-rows:62px auto;gap:6px 14px;padding:8px 16px calc(8px + env(safe-area-inset-bottom,0px));overflow:visible;align-self:end;min-width:0}
.shelfPaint{gap:8px}.paintCard,.materialCard{flex:1;min-width:0;max-width:100%;height:62px;padding:6px 8px;gap:8px}.paintCard>span:not(.colorSwatch):not(.chevron){min-width:0}.paintCard b{overflow:hidden;text-overflow:ellipsis}.paintCard .chevron{font-size:18px}.paintCard canvas{width:42px;height:42px}.colorSwatch{width:34px;height:38px}
.shelfBrush{grid-template-columns:48px 48px minmax(0,1fr) 48px;gap:8px;height:62px;padding:6px 8px;min-width:0}.shelfBrush label{white-space:normal}.shelfSettings{width:104px;height:48px;min-width:48px;padding:0 8px;font-size:12px}.shelfSettings[aria-expanded=true]{border-color:#bbd4e6;background:#506d85}
.shelfSizeSlot{min-width:0}.shelfToolHint{min-height:62px;font-size:12px;line-height:1.6;padding:4px 8px}
.quickOptions{grid-area:options;display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;min-height:50px;min-width:0;padding-top:5px;border-top:1px solid #8198aa38}
.quickOption{display:flex;align-items:center;gap:6px;min-height:48px;min-width:0;margin:0;font-size:12px;color:#d3e0ea;flex:0 0 auto}.quickOption>span{font-size:11px;color:#b8cbd9;white-space:nowrap}
.quickOption select{min-height:48px;min-width:96px;max-width:156px;border:1px solid #8198aa99;border-radius:8px;padding:0 22px 0 8px;background:#344b60;color:#f3f7fa;font-size:12px}.quickScope select{max-width:160px}
.quickSegment{display:flex;gap:3px;background:#263e51;border:1px solid #7f9bb066;border-radius:9px;padding:2px}.quickSegment button{min-width:48px;height:48px;min-height:48px;padding:0 8px;border-radius:6px;color:#cbdce9;font-size:12px;white-space:nowrap}.quickSegment button.active{background:#c7e0ea;color:#1e3b49;box-shadow:inset 0 0 0 1px #eaf6fa;font-weight:650}
.quickDensity{flex:1 1 155px;max-width:250px;min-width:155px}.quickDensity input{min-width:56px;width:100%;flex:1;height:48px;margin:0}.quickDensity output{min-width:36px;text-align:right;font-size:12px;color:#f1f6fa;font-variant-numeric:tabular-nums}
.quickAction{padding:0 12px;min-height:48px;border:1px solid #859cae99;background:#466279;font-size:12px}.quickState{font-size:11px;color:#c1d4e3;line-height:1.5;min-width:0}.quickState:empty{display:none}
.shelfSelection{display:flex;gap:6px;align-items:center;min-height:62px}.shelfSelection button{flex:1;min-width:48px;height:48px;padding:0 6px;font-size:12px;border:1px solid #95adc399;background:#43627b;white-space:nowrap}
#colorDrawer{display:flex;flex-direction:column;overflow:hidden;padding:18px;width:404px;max-width:calc(100% - var(--dock) - 24px);max-height:calc(100% - var(--top) - var(--shelf) - 24px);left:calc(var(--dock) + 12px);bottom:calc(var(--shelf) + 12px)}
#colorDrawer .drawerHeader{position:static;flex-shrink:0;margin:0;padding:0 0 12px;background:none;box-shadow:none}
.colorEditorBody{overflow-y:auto;overscroll-behavior:contain;min-height:0;padding:12px 2px 8px;scrollbar-width:thin}
.colorComparison{display:grid;grid-template-columns:1fr 1fr;gap:10px;padding-bottom:12px;margin-bottom:12px;border-bottom:1px solid #9db5c044}.colorComparison>div{display:flex;align-items:center;gap:8px;min-width:0}.comparisonSwatch{width:38px;height:38px;border:1px solid #bed2df77;border-radius:6px;flex-shrink:0}.colorComparison small{display:block;font-size:11px;color:#c6d9e7}.colorComparison b{font-size:12px;display:block;margin-top:4px;font-variant-numeric:tabular-nums}
.colorMain{grid-template-columns:1fr 1fr}.nativeColorLabel,.hexField>label{font-size:12px;color:#dae8f1;display:block}.hexField{min-width:0}.hexField input{width:100%;margin-top:6px}#nativeColor{height:58px;margin-top:6px;padding:3px;touch-action:manipulation}.inputError{font-size:11px;line-height:1.5;color:#ffb1a7;display:block;margin-top:5px}#hexColor[aria-invalid=true]{border-color:#ffb1a7;outline:1px solid #ffb1a7}
.colorSliders{margin-top:4px}.colorSliders label{min-height:52px}.colorSliders input{height:48px}.drawerSubhead small{display:block;font-size:11px;margin-top:4px;color:#bccfdd;font-weight:400}.recentColors{grid-template-columns:repeat(6,minmax(0,1fr));gap:8px}.recentColors button{min-width:0;min-height:48px;height:48px}
.colorActions{display:grid;grid-template-columns:96px 1fr;gap:8px;flex-shrink:0;padding-top:10px;border-top:1px solid #9db5c044}.colorActions>span{grid-column:1/-1;font-size:11px;color:#d1e3ef}.colorActions button{margin:0;min-height:48px}#colorCancel{background:#2f4659;border:1px solid #91a9bd88}.colorActions .primaryButton{background:#c5e4a6;color:#263c2d}
.drawer select:focus-visible,.quickOption select:focus-visible{outline:2px solid #c5e4a6;outline-offset:2px}
@media(max-width:1050px){
 .brushShelf{grid-template-columns:252px minmax(236px,1fr) 56px;gap:6px 10px;padding-left:12px;padding-right:12px}
 .paintCard b{font-size:11px}.paintCard small{font-size:10px}.paintCard canvas{width:36px;height:36px}.colorSwatch{width:30px;height:36px}.paintCard .chevron{display:none}
 .shelfSettings{width:56px;padding:4px;font-size:11px;white-space:normal;line-height:1.45}.shelfSettings:before{content:none}
 .shelfBrush{grid-template-columns:40px 48px minmax(0,1fr) 48px;gap:6px}.shelfBrush label{font-size:11px}.quickOptions{gap:6px 8px}.quickOption{gap:5px}.quickState{font-size:10px}
 .shelfSelection{gap:4px}.shelfSelection button{font-size:11px;padding:0 4px}
}
@media(max-width:720px){
 .brushShelf{grid-template-areas:"paint settings" "size size" "options options";grid-template-columns:minmax(0,1fr) 56px;grid-template-rows:56px 56px auto;gap:6px 8px;padding:8px 8px calc(8px + env(safe-area-inset-bottom,0px))}
 .paintCard,.materialCard{height:56px}.shelfBrush,.shelfToolHint,.shelfSelection{height:56px;min-height:56px}.shelfBrush{grid-template-columns:48px 48px minmax(0,1fr) 48px;padding:3px 8px}
 .quickOptions{gap:6px}.quickOption select{max-width:140px}.quickDensity{max-width:240px}.quickState{flex-basis:100%}
 #colorDrawer{padding:14px;left:calc(var(--dock) + 8px);max-width:calc(100% - var(--dock) - 16px)}
 #colorDrawer .drawerHeader h2{font-size:18px}.colorActions{grid-template-columns:88px 1fr}.recentColors{gap:6px;grid-template-columns:repeat(4,minmax(0,1fr))}
}

.shelfSettings span{display:inline}
@media(max-width:1050px){.shelfSettings span{display:block;white-space:nowrap}.shelfSettings{line-height:1.45}}

/* A picked, fixed rotation pivot; never an interactive control. */
#orbitPivot{position:absolute;z-index:12;width:17px;height:17px;transform:translate(-50%,-50%);border:1.5px solid #e7f0d2;border-radius:50%;background:#1e2c3666;box-shadow:0 0 0 2px #18263255;pointer-events:none}#orbitPivot:after{content:"";position:absolute;width:3px;height:3px;background:#e7f0d2;border-radius:50%;top:5.5px;left:5.5px}

.renderDevice{margin:10px 0 16px;border:1px solid var(--line);border-radius:10px;padding:8px 12px;font-size:12px}.renderDevice summary{min-height:40px;display:flex;align-items:center;cursor:pointer}.renderDevice p{line-height:1.6;overflow-wrap:anywhere;color:#b7c3ce}.renderDevice .softwareDevice{color:#ffc48b}

/* Primitives reuse one dock position; dimensions remain within reach. */
.primitiveDrawer{left:calc(var(--dock) + 12px);top:calc(var(--top) + 16px);bottom:auto;width:350px;max-height:calc(100% - var(--top) - var(--shelf) - 28px);overflow:auto}
#primitiveGrid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}#primitiveGrid h3{grid-column:1/-1;font-size:11px;letter-spacing:.08em;color:var(--muted);margin:8px 0 3px}#primitiveGrid button{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:76px;gap:8px;border:1px solid #8da2b744;background:#334657}#primitiveGrid button.active{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}#primitiveGrid span{font-size:12px}#primitiveGrid svg{width:28px;height:28px}
#primitiveSettings>div{margin-top:12px}#primitiveSettings label{font-size:12px;display:block;margin-bottom:6px}#primitiveSettings input[type=number]{width:100%;height:48px;background:#283b4b;border:1px solid #859aaf;border-radius:8px;color:var(--ink);padding:8px 12px}#primitiveMeasure{font-size:12px;line-height:1.6;color:var(--accent);display:block;overflow-wrap:anywhere}#quickPrimitive{display:flex;align-items:center;gap:10px}#quickPrimitiveName{min-height:48px;border:1px solid #8ba3b966;padding:0 12px}#quickPrimitiveHeightField{display:flex;align-items:center;gap:8px;font-size:12px}#quickPrimitiveHeight{width:76px;height:48px;background:#293f50;border:1px solid #8ba3b9;border-radius:8px;color:var(--ink);text-align:center}
@media(max-width:680px){.primitiveDrawer{left:calc(var(--dock) + 6px);width:calc(100% - var(--dock) - 14px);max-width:350px}#primitiveGrid button{min-height:68px}}

.exchangeCard{width:min(600px,96vw)}.exchangeFields{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin:8px 0 18px}.exchangeFields label{font-size:12px;color:var(--muted);display:flex;flex-direction:column;gap:8px}.exchangeFields select,.exchangeFields input{height:48px;min-width:0;width:100%;padding:8px 10px;border:1px solid #91a6b7;border-radius:8px;background:#293c4d;color:var(--ink);font-size:14px}.exchangeStatus{display:block;background:#283e4f;border-radius:8px;padding:14px;font-size:13px;line-height:1.7;overflow-wrap:anywhere;min-height:48px}.exchangeActions{display:flex;gap:10px;justify-content:flex-end;flex-wrap:wrap;margin-top:16px}.exchangeActions button{border:1px solid #8eaabd88;padding:0 16px;min-height:48px}.exchangeActions .primaryButton{background:var(--accent);color:var(--accent-ink)}.importWarnings{white-space:pre-line;padding:12px 14px;border-left:3px solid #d6bc8a;background:#d6bc8a0d;color:#e6dac4;font-size:13px;line-height:1.8}@media(max-width:680px){.exchangeFields{grid-template-columns:1fr}.exchangeActions button{flex:1}}

.primitiveDrawer{scrollbar-width:thin;scrollbar-color:#7b91a3 #344657}
