/* The original desk dock and physical controller are the interaction baseline. */
.studio-tools{position:absolute;z-index:5;left:24px;top:24px;display:flex;gap:10px;align-items:center;font-family:Inter,system-ui,sans-serif}
.environment-options{display:flex;gap:3px;padding:4px;border:1px solid #ffffff20;background:#151b19a8;border-radius:25px;backdrop-filter:blur(20px)}
.environment-options button,.ao-toggle{border:0;background:transparent;color:#b2bfb5;padding:9px 14px;font-size:11px;border-radius:20px;cursor:pointer;letter-spacing:.02em}
.environment-options button.is-active{background:#ffffff16;color:#f4f5ee}.environment-options button:hover{color:#fff}
.ao-toggle{display:flex;align-items:center;gap:8px;border:1px solid #ffffff20;background:#151b19a8;padding:12px;backdrop-filter:blur(20px)}
.ao-toggle[hidden]{display:none}
.ao-toggle span{width:5px;height:5px;border-radius:50%;background:#758577}.ao-toggle[aria-pressed=true] span{background:#bed497;box-shadow:0 0 8px #bed49766}
.resetView{background:#151b1988!important;backdrop-filter:blur(16px);border-color:#ffffff25!important}
@media(min-width:761px){
  :root{--config-widget-width:min(660px,calc(100vw - var(--dock-edge)*2));--widget-height:280px;--controller-widget-width:min(580px,calc(100vw - var(--config-widget-width) - var(--dock-edge)*2 - var(--dock-gap)));--dock-width:calc(var(--config-widget-width) + var(--dock-gap) + var(--controller-widget-width));--dock-left:calc((100vw - var(--dock-width))/2)}
  .controls,body[data-closeup-open=true] .controls{padding:22px;grid-template-columns:minmax(220px,.92fr) minmax(0,1.08fr);border-radius:20px}
  .controls>.configSection:first-child{padding-right:22px}.controls>.configSection:last-child{padding-left:22px}
  .sectionHeader,.controls>.configSection:last-child .sectionHeader{min-height:34px;margin-bottom:14px}
  .sizeSummary{font-size:31px!important}.label,.rangeMeta label,.frameLabel{font-size:11px}
  .sizeGrid{gap:22px!important}.rangeField{gap:6px!important}.directRange{height:29px}
  .directRange::-webkit-slider-runnable-track{height:5px}.directRange::-webkit-slider-thumb{width:25px;height:25px;margin-top:-10px;border-width:5px}
  .materialsLayout{gap:11px}.materialOptions{gap:8px}.materialButton,body[data-closeup-open=true] .materialButton{height:55px;border-radius:10px}
  .materialButton span{font-size:11px;bottom:7px}.frameControl{top:0;gap:5px}.frameOptions{top:0;gap:10px}.frameButton{width:34px!important;height:34px!important}
}
@media(max-width:760px){.studio-tools{top:14px;left:12px;gap:7px}.environment-options button{padding:8px 11px;font-size:10px}.ao-toggle{font-size:10px;padding:11px 10px}.resetView{left:auto!important;right:14px!important;top:14px!important;transform:none!important;width:39px;min-width:39px;height:39px;min-height:39px}.resetView:hover{transform:none!important}.controls>.configSection:last-child .sectionHeader{min-height:34px!important;margin-bottom:8px!important}.frameControl{top:0!important}.frameOptions{top:0!important}}

/* The physical controller, rebuilt as sharp DOM controls. One WebGL canvas. */
@media(min-width:761px){.controls .sizeSummary{font-size:31px!important}}
.controllerCloseup,.controllerCloseup.is-open{height:min(var(--widget-height),260px);padding:24px!important;overflow:visible;grid-template-columns:minmax(0,1fr);grid-template-rows:auto 1fr auto;gap:14px;align-items:center}
.controllerCloseup:not(.is-open){display:none}
.controllerCloseup .closeupHeader{position:static;inset:auto;display:flex;flex-direction:row;justify-content:space-between;align-items:center;padding:0;pointer-events:auto}
.controller-label{font-size:10px;font-weight:600;letter-spacing:.15em;color:#8e9898;display:flex;gap:10px;align-items:center}
.controller-label span{font-weight:400;color:#657172}
.controllerCloseup .closeupDismiss{position:static;inset:auto;width:28px;height:28px;min-width:28px;min-height:28px;border:0;background:transparent;color:#929c9c;font:22px/1 system-ui;box-shadow:none}
.controllerCloseup .closeupDismiss:hover{color:#fff;background:#ffffff0a}
.controller-body{width:100%;padding:7px 14px 10px 7px;border-radius:28px;background:linear-gradient(168deg,#454b4c 0%,#1c2223 8%,#080c0d 38%,#030506 86%,#161d1f 100%);box-shadow:inset 0 1px 1px #b6c7c54d,inset -7px -4px 5px #000,0 8px 13px #0006}
.controller-glass{position:relative;display:grid;grid-template-columns:minmax(56px,1.5fr) repeat(2,minmax(32px,.85fr)) 12px repeat(4,minmax(32px,.85fr));align-items:center;min-height:75px;padding:6px 11px;border:1px solid #000;border-radius:20px;background:linear-gradient(174deg,#36484d 0%,#203238 45%,#17282c 100%);box-shadow:inset 0 2px 5px #071013, inset 0 -1px 1px #9bbaba1a,0 1px 1px #5860624d}
.controller-digits,.controller-glass button{font-family:'Loisto Display',monospace;font-weight:400;font-size:clamp(25px,2.65vw,42px);line-height:1;color:#eff7f5;text-shadow:0 0 4px #d5f9ef55;text-align:center}
.controller-digits{display:block;min-width:0;letter-spacing:.04em;font-variant-numeric:tabular-nums}
.controller-glass button{position:relative;z-index:1;display:grid;place-items:center;min-width:0;min-height:54px;padding:0;border:0;border-radius:9px;background:transparent;cursor:pointer;touch-action:none;user-select:none;-webkit-user-select:none;-webkit-touch-callout:none;transition:background .15s,color .15s,transform .15s}
.controller-glass button:hover{background:#ddfff20c;color:#fff}
.controller-glass button:active,.controller-glass button.is-held{transform:translateY(1px);background:#dcfff219;box-shadow:inset 0 1px 5px #0005}
.controller-glass button:focus-visible{outline:1px solid #c5e6d7;outline-offset:-3px;background:#ddfff212}
.controller-glass button[aria-pressed=true]{color:#cee3ae;background:#bfe28b19}
.controller-glass button:disabled{opacity:.3;cursor:default}
.controller-divider{width:1px;height:24px;background:#e2eeeb70;justify-self:center;box-shadow:0 0 2px #e2eeeb44}
.controller-help{display:flex;justify-content:space-between;gap:8px;color:#738080;font-size:10px;line-height:1.5;letter-spacing:.01em}
.controller-help span:last-child{color:#a8b8b3;white-space:normal}.controller-help:has(>span[hidden]){display:none}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(min-width:761px) and (max-width:1050px){
  body[data-closeup-open=true] .controls{left:calc((100vw - var(--config-widget-width))/2)}
  .controllerCloseup,.controllerCloseup.is-open{left:50%;bottom:calc(var(--widget-height) + var(--dock-edge) + 16px);width:440px;height:210px;transform:translateX(-50%);animation:controllerFadeIn .2s ease}
}
@media(max-width:760px){
  .controllerCloseup,.controllerCloseup.is-open{padding:16px!important;gap:8px;border-radius:20px}
  .controller-body{padding:6px 10px 8px 6px;border-radius:23px}
  .controller-glass{min-height:72px;grid-template-columns:minmax(42px,1.4fr) repeat(2,minmax(28px,.85fr)) 6px repeat(4,minmax(28px,.85fr));padding:5px;border-radius:17px}
  .controller-digits,.controller-glass button{font-size:30px}
  .controller-help{font-size:9px;flex-wrap:wrap}
}
@media(prefers-reduced-motion:reduce){.controller-glass button{transition:none}}
@keyframes controllerFadeIn{from{opacity:0}to{opacity:1}}

.render-stats{position:fixed;z-index:12;top:78px;left:24px;width:260px;max-height:calc(100svh - var(--widget-height) - var(--dock-edge) - 96px);overflow:auto;padding:18px;border:1px solid #ffffff1a;border-radius:14px;background:#0e1415ed;color:#e0e7e5;font:11px/1.5 ui-monospace,SFMono-Regular,monospace;box-shadow:0 12px 40px #0002}
.render-stats[hidden]{display:none}
.stats-heading{display:flex;justify-content:space-between;color:#758381;font-size:9px;letter-spacing:.12em}
.stats-heading [data-active=true]{color:#c1d49c}
.stats-fps{display:flex;align-items:baseline;gap:8px;margin-top:7px}
.stats-fps strong{font:400 34px/1.2 ui-monospace,monospace;color:#edf3ea}
.stats-fps>span{font-size:10px;color:#8e9a98}.stats-fps small{margin-left:auto;color:#a2aeab}
.stats-graph{display:block;width:100%;height:38px;margin:10px 0;overflow:visible}
.stats-graph polyline{fill:none;stroke:#bed497;stroke-width:1.4}.stats-budget{stroke:#ffffff12;stroke-dasharray:3 4}
.render-stats dl{margin:0 0 12px}.render-stats dl>div{display:flex;justify-content:space-between;gap:8px;padding:3px 0}
.render-stats dt{color:#85918f;font-size:10px}.render-stats dd{margin:0;color:#c9d2cf;font-size:10px}
.render-stats button{width:100%;padding:9px;background:#c5d4bc0f;border:1px solid #c5d4bc25;border-radius:6px;color:#c5d4bc;font:inherit;cursor:pointer}
.render-stats button:hover{background:#c5d4bc1a}.render-stats button:disabled{opacity:.5;cursor:wait}
.stats-live{display:flex;align-items:center;gap:6px;margin-bottom:10px;color:#a9b9af;font-size:10px;cursor:pointer}.stats-live input{accent-color:#bed497}
.stats-quality{display:flex;justify-content:space-between;align-items:center;margin:8px 0 12px;color:#85918f;font-size:10px}.stats-quality select{background:#1a2321;border:1px solid #ffffff20;color:#c9d2cf;padding:3px 8px;border-radius:5px;font:inherit}
.stats-result{display:block;margin-top:9px;font-size:9px;color:#778781;line-height:1.6}
@media(max-width:760px){.render-stats{left:12px;top:64px;width:240px;padding:14px}}
@media(max-height:650px){.render-stats{max-height:calc(100svh - 94px)}}
.materialButton[aria-busy=true]{cursor:progress}
.materialButton[aria-busy=true]::after{content:'';position:absolute;right:8px;top:8px;width:6px;height:6px;border:1px solid #ffffffb3;border-top-color:transparent;border-radius:50%;animation:finishLoading .65s linear infinite}
@keyframes finishLoading{to{transform:rotate(360deg)}}
@media(prefers-reduced-motion:reduce){.materialButton[aria-busy=true]::after{animation:none;background:#ffffff88}}
/* Leave the product more room; controls remain the same desk-only controls. */
@media(max-width:760px){.controls .sizeSummary{font-size:22px!important;letter-spacing:-.04em}}
@media(min-width:761px){
  :root{--config-widget-width:min(580px,calc(100vw - var(--dock-edge)*2));--widget-height:220px}
  .controls,body[data-closeup-open=true] .controls{padding:18px;grid-template-columns:minmax(200px,.92fr) minmax(0,1.08fr)}
  .controls>.configSection:first-child{padding-right:18px}.controls>.configSection:last-child{padding-left:18px}
  .sectionHeader,.controls>.configSection:last-child .sectionHeader{min-height:28px;margin-bottom:8px}
  .controls .sizeSummary{font-size:24px!important}.sizeGrid{gap:14px!important}
  .materialButton,body[data-closeup-open=true] .materialButton{height:44px}
  .frameButton{width:30px!important;height:30px!important}
}
.studio-tools .viewer-theme-toggle{width:44px;height:44px;min-width:44px;padding:11px;justify-content:center;border-radius:50%;color:#dce3db}
.viewer-theme-toggle svg{display:block;width:20px;height:20px;flex:none}
.viewer-theme-toggle:hover{background:#26332dc9}
.viewer-theme-toggle:focus-visible{outline:2px solid #c4d1b7;outline-offset:3px}
@media(max-width:760px){
 .controls,body[data-closeup-open=true] .controls{padding:12px!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:0!important}
 .controls>.configSection{min-width:0}
 .controls>.configSection:first-child{padding-right:12px!important}
 .controls>.configSection:last-child{padding-left:12px!important}
 .controls>.configSection:first-child .sectionHeader{min-height:34px!important;margin-bottom:10px!important;flex-wrap:wrap;gap:4px}
 .controls .sizeSummary{font-size:21px!important;white-space:nowrap}
 .controls .materialOptions{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px}
 .controls .materialButton{min-width:0;height:40px!important}
 .controls .materialButton span{font-size:10px!important}
 .controls .frameOptions{gap:7px!important}
 .controls .frameButton{width:34px!important;height:34px!important}
}
.viewer-notices{position:fixed;z-index:80;top:76px;left:12px;display:grid;gap:8px;max-width:min(420px,calc(100vw - 24px));pointer-events:none}
.viewer-notice{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid #e5c3a750;border-radius:12px;background:#202724f5;color:#f3f4ef;font:13px/1.4 Inter,system-ui,sans-serif;box-shadow:0 8px 24px #0003;pointer-events:auto}
.viewer-notice button{flex:none;min-height:40px;padding:8px 12px;border:1px solid #ffffff44;border-radius:9px;background:#c4d1b7;color:#202724;font:600 12px Inter,system-ui,sans-serif;cursor:pointer}
.viewer-notice button:focus-visible{outline:2px solid white;outline-offset:2px}
/* Keep global actions in the same corners at every viewport size. */
.resetView{left:auto!important;right:24px!important;top:24px!important;transform:none!important;width:44px!important;min-width:44px!important;height:44px!important;min-height:44px!important}
.resetView:hover{transform:none!important}
.ao-toggle{min-height:44px}
.controllerCloseup .closeupDismiss{width:44px;height:44px;min-width:44px;min-height:44px}
.desk-size-hint{font-size:10px;line-height:1.4;color:#b7c0ba;margin:8px 0 0;max-width:28em}
.desk-size-hint[hidden]{display:none}
@media(max-width:760px){
 .resetView{right:12px!important;top:14px!important}
 .controls .materialButton{height:44px!important}
 .controls .frameOptions{gap:2px!important}
 .controls .frameButton{width:44px!important;height:44px!important}
}
@media(max-width:359px){.controls .frameButton{width:40px!important}}
/* Content-sized docks and contained range thumbs avoid label/handle overlap. */
.controls,body[data-closeup-open=true] .controls{height:auto}
@media(max-width:760px){
 .controls .sizeGrid{gap:10px!important}
 .controls .rangeField{gap:6px!important}
 .controls .directRange{height:40px!important;min-height:40px;margin:0;padding:0}
 .controls .directRange::-webkit-slider-runnable-track{height:5px!important}
 .controls .directRange::-webkit-slider-thumb{width:32px!important;height:32px!important;margin-top:-13.5px!important;border-width:6px!important}
 .controls .directRange::-moz-range-track{height:5px}
 .controls .directRange::-moz-range-thumb{width:20px;height:20px;border:6px solid #f5f5f2;border-radius:50%;background:#17201e}
}
/* One coordinated landscape layout, including wider modern phones. */
@media(max-width:1024px) and (max-height:480px) and (min-aspect-ratio:6/5){
 .controls,body[data-closeup-open=true] .controls{top:68px;bottom:12px;left:auto;right:max(12px,env(safe-area-inset-right));width:280px;height:auto;max-height:none;transform:none;display:block;overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin;padding:10px!important}
 .controls>.configSection:first-child{padding:0!important}
 .controls>.configSection:first-child .sectionHeader{min-height:22px!important;margin-bottom:4px!important}
 .controls>.configSection:last-child{border-left:0;border-top:1px solid #ffffff18;padding:8px 0 0!important;margin-top:8px}
 .controls>.configSection:last-child .sectionHeader{display:none}
 .controls .sizeSummary{font-size:21px!important}
 .controls .sizeGrid{display:grid;grid-template-columns:1fr 1fr;grid-template-rows:auto!important;gap:12px!important}
 .controls .rangeField{gap:6px!important}
 .controls .rangeMeta{min-height:14px;line-height:14px}
 .controls .directRange{height:36px!important;min-height:36px;margin:0;padding:0}
 .controls .directRange::-webkit-slider-runnable-track{height:6px!important}
 .controls .directRange::-webkit-slider-thumb{width:28px!important;height:28px!important;margin-top:-11px!important;border-width:5px!important}
 .controls .directRange::-moz-range-track{height:6px}
 .controls .directRange::-moz-range-thumb{width:18px;height:18px;border:5px solid #f5f5f2;border-radius:50%;background:#17201e}
 .controls .materialOptions{grid-template-columns:repeat(4,minmax(0,1fr));gap:4px}
 .controls .materialButton{height:44px!important}
 .controls .materialButton span{font-size:9px!important;left:5px}
 .controls .frameOptions{gap:2px!important}
 .controls .frameButton{width:44px!important;height:44px!important}
 .controls .frameControl{display:flex;flex-direction:row;align-items:center;justify-content:space-between;gap:8px!important}
 .controls .materialsLayout{gap:6px}
 .controllerCloseup,.controllerCloseup.is-open{left:max(12px,env(safe-area-inset-left));right:auto;top:auto;bottom:12px;width:calc(100vw - 320px - env(safe-area-inset-left));height:180px;transform:none}
 .resetView{right:max(12px,env(safe-area-inset-right))!important;top:14px!important}
 .studio-tools{left:max(12px,env(safe-area-inset-left))}
}
/* Resize geometry must settle immediately; animating dock position makes the
   measured action anchor stale when rotating between portrait and landscape. */
.controls,body[data-closeup-open=true] .controls{transition:opacity .2s ease!important}
