/* Pearl studio: the sidebar and portfolio-style selector share one material. */
:root {
  color-scheme: light;
  --panel-radius: 18px;
  --studio-bg: #ffffff;
  --ink: #202833;
  --muted: #3e4857;
  --line: #62768e2b;
  --surface: #ffffff62;
  --field: #ffffff9e;
  --selected: #ffffffc7;
  --rim: #ffffffd6;
  --glass: linear-gradient(125deg, #ffffffa8, #ffffff47 45%, #e5edf66b 78%, #ffffff94);
  --glass-shadow: inset 0 1px 1px #fff, inset 0 -1px 1px #8a9bb133, 0 16px 48px #425b7e12, 0 2px 6px #425b7e0a;
  --pool-blue: #fbfcfd;
  --pool-violet: #f3f5f7;
  --pool-peach: #ffffff;
  --pool-mint: #f7f8fa;
  --focus: #355e8e;
  color: var(--ink);
  background: var(--studio-bg);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --studio-bg: #08090a;
  --ink: #eff2f7;
  --muted: #ced7e4;
  --line: #c2d6ee29;
  --surface: #24303f73;
  --field: #101925b3;
  --selected: #53677d70;
  --rim: #d6e8ff38;
  --glass: linear-gradient(125deg, #a7c7eb24, #1b253566 45%, #40577338 78%, #bcd7f21a);
  --glass-shadow: inset 0 1px 1px #e4efff33, inset 0 -1px 1px #0007, 0 16px 48px #0003, 0 2px 6px #0002;
  --pool-blue: #111315;
  --pool-violet: #0d0e10;
  --pool-peach: #171819;
  --pool-mint: #101112;
  --focus: #a4d1ff;
}
body { background: var(--studio-bg); color: var(--ink); }
#app { position: relative; isolation: isolate; min-height: 100dvh; }
#app::before {
  content: ""; position: fixed; inset: -5%; z-index: -2; pointer-events: none;
  background: radial-gradient(ellipse 38% 32% at 92% 28%, var(--pool-blue) 0%, transparent 100%), radial-gradient(ellipse 39% 33% at 76% 82%, var(--pool-violet) 0%, transparent 100%), radial-gradient(ellipse 38% 33% at 12% 8%, var(--pool-peach) 0%, transparent 100%), radial-gradient(ellipse 28% 25% at 45% 64%, var(--pool-mint) 0%, transparent 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%;
  background-position: 50% 50%, 50% 50%, 50% 50%, 50% 50%;
  animation: studio-drift 21.76s ease-in-out infinite alternate;
}
#app::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Cpath fill='%23808080' filter='url(%23n)' d='M0 0h180v180H0z'/%3E%3C/svg%3E");
}
@keyframes studio-drift {
  0% { transform: translate(0, 0) rotate(0deg); background-size: 100% 100%, 100% 100%, 100% 100%, 100% 100%; background-position: 50% 50%, 50% 50%, 50% 50%, 50% 50%; }
  35% { transform: translate(-3%, 2%) rotate(3deg); background-size: 170% 125%, 125% 170%, 150% 135%, 140% 170%; background-position: 100% 10%, 0% 100%, 85% 80%, 10% 25%; }
  70% { transform: translate(2%, -3%) rotate(-3deg); background-size: 130% 175%, 175% 130%, 130% 170%, 170% 130%; background-position: 0% 90%, 100% 5%, 0% 100%, 90% 10%; }
  100% { transform: translate(-2%, 1%) rotate(2deg); background-size: 160% 140%, 135% 160%, 165% 125%, 125% 165%; background-position: 70% 0%, 5% 75%, 100% 0%, 25% 90%; }
}

.app-header { background: var(--surface); border-color: var(--line); backdrop-filter: blur(18px) saturate(1.12); }
.header-actions { display: flex; align-items: center; gap: 22px; }
.editor, .theme-track {
  background: var(--glass); border: 1px solid var(--rim); box-shadow: var(--glass-shadow);
  backdrop-filter: blur(28px) saturate(1.22); -webkit-backdrop-filter: blur(28px) saturate(1.22);
}
.editor {
  position: relative;
  border-radius: var(--panel-radius);
  background: var(--sidebar-tint, #ffffff1f);
  backdrop-filter: blur(var(--sidebar-blur, 3px)) saturate(var(--sidebar-saturation, 1.25));
  -webkit-backdrop-filter: blur(var(--sidebar-blur, 3px)) saturate(var(--sidebar-saturation, 1.25));
  box-shadow: inset 0 1px 1px #ffffffb0, inset 0 -1px 1px #536f9140, 0 12px var(--sidebar-shadow, 24px) #253e6430;
}
.editor::before {
  content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; pointer-events: none;
  padding: 1px;
  opacity: var(--sidebar-rim, .61);
  background: conic-gradient(from 225deg, #ffffff0a, #ffffffc9 12%, #ffffff18 24%, #ffffff0a 40%, #ffffffed 53%, #ffffff25 65%, #ffffff0a 80%, #ffffffa0 94%, #ffffff0a);
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
}
.editor::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(ellipse 85% 35% at var(--sidebar-light-x, 18%) var(--sidebar-light-y, 0%), rgb(255 255 255 / var(--sidebar-reflection, .09)), transparent 78%);
  box-shadow: inset 6px 0 12px #ffffff0d, inset -6px 0 12px #ffffff0d;
}
.editor > * { position: relative; z-index: 1; }
[data-theme="dark"] .editor {
  --muted: #e0e8f4;
  background: var(--sidebar-tint, #ffffff1f);
  box-shadow: inset 0 1px 1px #dbedff77, inset 0 -1px 1px #0008, 0 12px var(--sidebar-shadow, 24px) #0005;
}
[data-theme="dark"] .editor::before { opacity: var(--sidebar-rim, .61); }
[data-theme="dark"] .editor::after { opacity: 1; }

.theme-toggle { width: 86px; height: 46px; padding: 0; flex: none; border-radius: 999px; position: relative; }
.theme-track { position: absolute; inset: 0; border-radius: inherit; display: flex; align-items: center; justify-content: space-between; padding: 0 13px; }
.theme-toggle svg { display: block; width: 17px; height: 17px; }
.theme-track-icon { color: var(--muted); }
.theme-thumb { position: absolute; top: 3px; left: 3px; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #fffffff2; color: #202833; box-shadow: inset 0 1px 1px #fff, 0 2px 8px #26395233; transition: transform .5s cubic-bezier(.34,1.56,.64,1), background .3s; }
.theme-thumb::after { content: ""; position: absolute; top: 5px; left: 8px; width: 12px; height: 4px; border-radius: 50%; background: #ffffff80; transform: rotate(-25deg); }
.theme-toggle.is-dark .theme-thumb { transform: translateX(40px); background: #283342; color: #f6f9ff; box-shadow: inset 0 1px 1px #ffffff38, 0 2px 8px #0006; }
.theme-toggle:hover .theme-track { border-color: var(--focus); }
:is(button, a, input, textarea, select, summary, [tabindex]):focus-visible, .import-label:focus-within { outline-color: var(--focus); }
.eyebrow, .quiet, .preview-note, .section-label, .field-note, .editor-index, .editor-footer, .color-row small, .range-field small, .range-field output, .export-intro p, .export-tabs button, .dialog-close, dialog p, .app-header nav > button:first-child { color: var(--muted); }
.segmented, .subtle, .wide-button, .preset-options button, .text-effects button, .finish-options button, .shape-grid button, .scene-grid button, .media-actions button {
  border-color: var(--line); background: var(--surface); color: var(--ink);
}
.segmented { box-shadow: inset 0 1px #ffffff30; }
.segmented button { color: var(--muted); }
.segmented [aria-pressed="true"] { background: var(--selected); color: var(--ink); box-shadow: inset 0 1px #ffffff55, 0 2px 6px #18344b15; }
.editor-tabs { gap: 3px; padding: 4px 12px 10px; }
.editor-tabs button { border-radius: 8px; padding: 10px 0; color: var(--muted); }
.editor-tabs [aria-selected="true"] { color: var(--ink); background: var(--glass); box-shadow: inset 0 1px #ffffff70, inset 0 0 0 1px var(--rim), 0 3px 8px #263b5912; }
.editor-tabs [aria-selected="true"]::after { display: none; }
:is(.shape-grid, .scene-grid, .finish-options, .text-effects, .media-actions) [aria-pressed="true"] { background: var(--selected); border-color: var(--muted); color: var(--ink); }
.text-field :is(input, select, textarea), #code-output { background: var(--field); border-color: var(--line); color: var(--ink); }
.text-field select option { background: var(--studio-bg); color: var(--ink); }
.color-row input[type="color"] { background: var(--field); border-color: var(--line); }
.control-group { border-color: var(--line); }
.control-group summary::after { color: var(--muted); }
.range-field input { background: var(--line); accent-color: var(--ink); }
.range-field input::-webkit-slider-thumb { background: var(--ink); border-color: var(--studio-bg); box-shadow: 0 0 0 1px var(--muted); }
.range-field input::-moz-range-thumb { background: var(--ink); border-color: var(--studio-bg); }
.check-field input { accent-color: var(--focus); }
.media-upload { background: var(--field); }
.media-upload.drop-active { background: var(--selected); border-color: var(--focus); outline-color: var(--focus); }
.export-tabs [aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
.control-panel { scrollbar-color: var(--line) transparent; }
.primary, .wide-button.primary { background: #263342; border-color: #263342; color: #fff; box-shadow: inset 0 1px #ffffff20; }
.primary:hover { background: #394b60; }
[data-theme="dark"] .primary { background: #d9e6f4; border-color: #d9e6f4; color: #172130; }
[data-theme="dark"] .primary:hover { background: #f2f7fc; }
.stage { box-shadow: 0 0 0 1px var(--rim), 0 16px 40px #152e4b1a; }
dialog { background: var(--studio-bg); border-color: var(--rim); color: var(--ink); }
@media (max-width: 1100px) { .header-actions { gap: 14px; } }
@media (min-width: 761px) and (max-width: 900px) { #about { display: none; } }
@media (max-width: 760px) {
  .header-actions { gap: 8px; }
  .app-header { height: 88px; padding: 12px; }
  .theme-toggle { width: 70px; height: 38px; }
  .theme-track { padding: 0 9px; }
  .theme-thumb { width: 30px; height: 30px; }
  .theme-toggle.is-dark .theme-thumb { transform: translateX(32px); }
  .theme-toggle svg { width: 15px; height: 15px; }
  .app-header nav .primary { padding: 10px 8px; }
  .app-header .primary span { margin-left: 4px; }
  .brand { gap: 7px; }
  .brand-icon { width: 25px; height: 30px; }
  .brand h1 { font-size: 21px; }
  .brand .eyebrow { font-size: 7px; }
  .editor-tabs { padding-top: 7px; padding-bottom: 7px; }
}
@media (max-width: 370px) { .brand-icon { display: none; } .header-actions { gap: 6px; } }
@media (prefers-reduced-motion: reduce) { #app::before { animation: none; } .theme-thumb { transition: none; } }

/* Actual shared-scene WebGL slab; CSS above stays ready underneath. */
.studio-webgl { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -2; pointer-events: none; }
html[data-studio-renderer="webgl"] #app::before { opacity: 0; }
html[data-studio-renderer="webgl"] .editor {
  background: transparent;
  border: 1px solid #ffffff30;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
}
html[data-studio-renderer="webgl"] .editor::before,
html[data-studio-renderer="webgl"] .editor::after { display: none; }

html[data-theme="light"] .editor { --muted: #344151; }

.stage { border-radius: var(--panel-radius); }
@media (max-width: 760px) { :root { --panel-radius: 12px; } }

/* A continuous, square-edged header slab with theme-specific glass tint. */
.app-header {
  width: 100%; border-radius: 0;
  background: rgb(255 255 255 / .40);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  box-shadow: inset 0 1px #ffffffb3, inset 0 -1px #ffffff70, 0 4px 16px #18293e0c;
}
[data-theme="dark"] .app-header {
  background: rgb(3 3 3 / .55);
  box-shadow: inset 0 1px #ffffff26, inset 0 -1px #ffffff1f, 0 4px 16px #0003;
}
html[data-studio-renderer="webgl"] .app-header {
  background: transparent;
  backdrop-filter: none; -webkit-backdrop-filter: none;
  border-bottom-color: var(--line);
}

.app-header .version { color: var(--muted); font-weight: 500; border-left-color: var(--line); }

/* Stable logo footprint, continuously reshaped glass surface. */
.brand-icon { transform: none; animation: none; }
html[data-studio-renderer="webgl"] .brand-icon { background: none; box-shadow: none; animation: none; }
@media (prefers-reduced-motion: reduce) { .brand-icon { animation: none; } }
.brand { gap: 2px; }
.brand-icon { width: 72px; height: 76px; flex: none; }
@media (max-width: 760px) { .brand-icon { width: 40px; height: 46px; } }

/* Let the morphing lens cross the lettering; only the covered glyphs are refracted. */
.brand > div { margin-left: -30px; }
html[data-studio-renderer="webgl"] .brand > div {
  mask-image: var(--brand-lens-mask, none);
  -webkit-mask-image: var(--brand-lens-mask, none);
  mask-size: 100% 100%; -webkit-mask-size: 100% 100%;
  mask-repeat: no-repeat; -webkit-mask-repeat: no-repeat;
}
@media (max-width: 760px) { .brand > div { margin-left: -16px; } }
@media (max-width: 370px) { .brand > div { margin-left: 0; } }
/* One organic glass badge around the entire brand, rather than a separate icon. */
.brand { position: relative; gap: 0; padding: 0 10px; min-height: 76px; }
.brand > div { margin-left: 0; }
.brand .brand-icon {
  position: absolute; left: -52px; top: 50%;
  width: calc(100% + 28px); height: 94px;
  transform: translateY(-50%); display: block;
}
html:not([data-studio-renderer="webgl"]) .brand .brand-icon { position: absolute; }
@media (max-width: 760px) {
  .brand { min-height: 56px; padding: 0 4px; }
  .brand .brand-icon { left: -29px; width: calc(100% + 18px); height: 72px; }
  .brand > div { margin-left: 0; }
}

/* Keep mobile lettering on a single sharp layer while the glass moves below. */
html[data-brand-text="stable"] .brand > div {
  position: relative; z-index: 1;
  mask-image: none; -webkit-mask-image: none;
}

/* The ribbon lettering is the glass surface; its outline stays stationary. */
.brand { padding:0; min-height:0; flex:0 1 auto; }
.brand .brand-wordmark { position:relative; display:block; margin:0; width:280px; height:94px; flex:none; }
@media(max-width:760px){.brand .brand-wordmark{width:156px;height:52px;}}
@media(max-width:370px){.brand .brand-wordmark{width:136px;height:46px;}}

/* Open header: the identity and utilities float directly on the studio pools. */
html[data-theme] .app-header{background:none;border:0;box-shadow:none;backdrop-filter:none;-webkit-backdrop-filter:none;}
.app-header nav #about{display:grid;place-items:center;width:40px;height:40px;padding:9px;color:var(--ink);border:1px solid var(--rim);border-radius:50%;background:var(--surface);}
.about-icon svg{width:20px;height:20px;}
.export-actions{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:20px;}
.export-actions .wide-button{margin:0;}
#motion[hidden],.preview-note[hidden]{display:none!important;}

.editor-tabs button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;min-height:52px;}
.editor-tabs .tab-icon{display:block;width:18px;height:18px;flex:none;pointer-events:none;}

/* Sibling controls keep scene selection and playback separate for keyboard use. */
.scene-tile { position:relative; min-width:0; }
.scene-tile > [data-scene] { width:100%; height:100%; }
.scene-grid .scene-playback {
  position:absolute; top:12px; right:12px; width:32px; height:32px;
  display:grid; place-items:center; padding:7px; border-radius:50%;
  background:#1b1714b8; color:#fff5df; border:1px solid #fff5df80;
  backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px);
  box-shadow:0 2px 7px #0003;
}
.scene-playback svg { display:block; width:16px; height:16px; }
.scene-playback:hover { background:#1b1714eb; }
.scene-playback:disabled { opacity:.5; }
@media(pointer:coarse) {
  .scene-grid .scene-playback { width:44px; height:44px; top:9px; right:9px; }
}

/* Identity belongs to the editor; utilities share the preview toolbar. */
.workspace { height:100dvh; }
.preview-toolbar .header-actions { margin-left:auto; gap:16px; flex:none; }
.preview-toolbar .header-actions nav { display:flex; align-items:center; }
.preview-toolbar #about { display:grid; place-items:center; width:40px; height:40px; padding:9px; color:var(--ink); border:1px solid var(--rim); border-radius:50%; background:var(--surface); }
.editor-heading { display:flex; padding:12px 20px; justify-content:center; flex:none; }
.editor-heading .brand { width:100%; justify-content:center; }
.editor-heading .brand-wordmark { width:100%; max-width:280px; height:86px; }
@media(max-width:760px) {
  .workspace { height:100dvh; }
  .preview-toolbar .header-actions { gap:8px; }
  .preview-toolbar #about { width:34px; height:34px; padding:7px; }
  .editor-heading { display:flex; padding:4px 16px; }
  .editor-heading .brand-wordmark { width:190px; height:58px; }
  .preview-toolbar .segmented button { padding:7px 8px; }
}

/* Immersive workspace with a dismissible glass control overlay. */
html, body { overflow:hidden; }
.workspace { display:block; position:relative; width:100%; max-width:none; height:100dvh; margin:0; padding:0; }
.preview-panel { position:absolute; inset:0; display:block; }
.stage { position:absolute; inset:0; width:100%; height:100%; min-height:0; margin:0; border:0; border-radius:0; }
.preview-toolbar[hidden], .preset-bar[hidden], #panel-open[hidden], .editor[hidden], .stage-meta, .stage-caption { display:none!important; }
.editor { position:fixed; z-index:11; top:16px; right:16px; bottom:16px; width:360px; margin:0; }
.studio-webgl { z-index:10; }
#app::before, #app::after { display:none; }
#app[data-panel-closed="true"] .studio-webgl { display:none; }
.editor-heading { position:relative; padding:4px 40px 4px 16px; }
.editor-heading .brand-wordmark { height:76px; }
.panel-close { position:absolute; right:8px; top:8px; width:32px; height:32px; font-size:24px; line-height:1; color:var(--ink); }
.panel-open { position:fixed; top:16px; right:16px; z-index:12; display:flex; align-items:center; gap:8px; padding:12px 16px; color:#fff; background:#08090ac9; border:1px solid #ffffff70; border-radius:999px; backdrop-filter:blur(12px); box-shadow:0 4px 18px #0003; }
.panel-open svg { width:20px; height:20px; }
@media(max-width:760px) {
  .workspace { display:block; height:100dvh; padding:0; }
  .editor { top:auto; bottom:12px; right:12px; width:min(360px,calc(100% - 24px)); height:min(68dvh,620px); max-height:calc(100dvh - 24px); }
  .editor-heading { display:flex; padding:0 40px 0 16px; }
  .editor-heading .brand-wordmark { width:190px; height:58px; }
  .panel-close { width:40px; height:40px; top:4px; right:4px; }
  .panel-open { top:12px; right:12px; }
}
#toast { z-index:20; }
/* A small text shadow protects unbacked labels on bright moving details. */
.editor :is(.field-note,.section-label,.range-field > span,.check-field,.editor-footer,.media-summary strong,.media-summary span) {
  text-shadow:0 1px 2px #000b,0 0 1px #0009;
}
/* Keep the current background's identity/status to one compact row. */
.media-summary {
  display:flex; align-items:baseline; gap:8px; padding:0; margin-top:8px;
  background:none; border:0; border-radius:0; min-width:0; color:var(--ink);
}
.media-summary strong { flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.media-summary span { flex:0 1 auto; max-width:55%; margin:0; color:var(--muted); text-align:right; line-height:1.4; }


/* Touch workspace: keep the scene visible until controls are needed. */
.sheet-bar{display:none}
.upload-help{margin-top:10px;font-size:11px;color:var(--muted)}
.upload-help summary{cursor:pointer;padding:8px 0}
.range-field output[data-numeric]{cursor:pointer;min-width:44px;text-align:right;border-radius:5px;padding:4px}
.range-field output[data-numeric]:focus-visible{outline:2px solid #fff;outline-offset:2px}
.number-dialog{width:min(320px,calc(100% - 32px));border:1px solid #ffffff50;border-radius:16px;background:#121b20;color:#fff;padding:24px}
.number-dialog::backdrop{background:#0008;backdrop-filter:blur(4px)}
.number-dialog label{display:grid;gap:12px;font-size:14px}
.number-dialog input{width:100%;font-size:20px;padding:12px;border-radius:8px;border:1px solid #ffffff60;color:#fff;background:#ffffff0d}
.number-dialog form>div{display:flex;justify-content:flex-end;gap:8px;margin-top:20px}
.number-dialog button{min-height:44px;padding:10px 16px;border:1px solid #ffffff40;border-radius:8px;color:#fff;background:#ffffff12}
@media(pointer:coarse){
 .range-field input[type=range]{height:44px;margin-top:0;background:transparent}
 .range-field input[type=range]::-webkit-slider-runnable-track{height:3px;background:#ffffff35;border-radius:3px}
 .range-field input[type=range]::-webkit-slider-thumb{margin-top:-8px}
 .range-field input[type=range]::-moz-range-track{height:3px;background:#ffffff35}
 .editor :is(.wide-button,.check-field,.editor-tools button){min-height:44px}
 .editor input[type=checkbox]{width:20px;height:20px}
 .editor :is(textarea,select){font-size:16px}
}
@media(min-width:761px) and (max-width:1200px) and (orientation:landscape){
 .editor{width:320px}
 .editor-heading .brand-wordmark{height:58px}
}
@media(max-width:1100px) and (orientation:portrait){
 :root{--panel-radius:18px}
 .editor{left:12px;right:12px;top:auto;bottom:calc(var(--keyboard-inset,0px) + max(10px,env(safe-area-inset-bottom)));width:auto;height:calc(var(--sheet-space,100dvh)*.52);max-height:calc(var(--sheet-space,100dvh) - 24px - env(safe-area-inset-top));}
 .editor[data-sheet=compact]{height:124px}
 .editor[data-sheet=expanded]{height:calc(var(--sheet-space,100dvh)*.84)}
 .sheet-bar{display:flex;align-items:center;justify-content:space-between;flex:none;height:44px;padding:0 12px}
 .sheet-bar button{min-height:44px;color:var(--ink);font-size:11px;background:none;border:0;padding:0 8px}
 .sheet-handle{display:flex;align-items:center;gap:8px;touch-action:none;cursor:ns-resize}
 .sheet-handle>.sheet-direction{display:grid;place-items:center;width:20px;height:20px;background:none}
 .sheet-handle b{font-weight:500}
 .editor[data-sheet=compact] :is(.editor-heading,.editor-tools,.control-panel,.editor-footer){display:none}
 .editor[data-sheet=compact] .editor-tabs{flex:1;padding:0 8px 8px}
 .editor[data-sheet=compact] .sheet-view{display:none}
 .editor-heading{display:flex;padding:0 44px 0 16px}
 .editor-heading .brand-wordmark{height:38px;width:170px}
 .editor-tabs{padding:2px 8px 6px}
 .editor-tabs button{min-height:48px;padding:5px 0}
 .panel-close{top:0;right:4px;width:40px;height:38px}
 .control-panel{padding:0 18px 16px;overscroll-behavior:contain;scroll-padding:16px}
 .control-panel .section-label{margin-top:18px}
 .scene-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:6px}
 .scene-grid button{font-size:10px;padding:5px}
 .scene-swatch{height:54px}
 .editor-footer{padding:8px 18px;font-size:9px}
 .editor textarea,.editor select{font-size:16px}
}
@media(max-height:500px) and (min-width:761px){.editor{width:280px}.editor-heading .brand-wordmark{height:38px}}

@media(max-height:500px) and (orientation:landscape){
 .editor{top:8px;right:8px;bottom:8px;left:auto;width:min(280px,48vw);height:auto;max-height:none}
 .editor-heading .brand-wordmark{height:32px}
 .editor-heading{padding:0 38px 0 10px}
 .editor-tabs{padding:0 6px 4px}
 .editor-tabs button{min-height:44px;gap:3px;padding:4px 0}
 .control-panel{padding:0 12px 12px}
 .editor-footer{display:none}
 .sheet-bar{display:none}
}

.sheet-bar .sheet-view{display:flex;align-items:center;gap:6px}
.sheet-bar svg{width:18px;height:18px;flex:none;pointer-events:none}

/* Edge-attached controls: show only the rim facing into the canvas. */
.editor-footer{display:none!important}
@media(max-width:1100px) and (orientation:portrait){
 :root{--panel-radius:0px}
 .editor,html[data-studio-renderer="webgl"] .editor,html #editor{
  left:0;right:0;bottom:var(--keyboard-inset,0px);width:100%;
  border-radius:0;border-width:1px 0 0;border-style:solid;border-color:#ffffff50;box-shadow:none;
  padding-bottom:env(safe-area-inset-bottom);
 }
 .editor[data-sheet=compact]{height:calc(124px + env(safe-area-inset-bottom))}
}
@media(max-width:1200px) and (orientation:landscape){
 :root{--panel-radius:0px}
 .editor,html[data-studio-renderer="webgl"] .editor,html #editor{
  top:0;right:0;bottom:0;left:auto;height:auto;max-height:none;
  border-radius:0;border-width:0 0 0 1px;border-style:solid;border-color:#ffffff50;box-shadow:none;
  padding-top:env(safe-area-inset-top);padding-right:env(safe-area-inset-right);padding-bottom:env(safe-area-inset-bottom);
 }
 .panel-close{right:max(4px,env(safe-area-inset-right))}
}
@media(max-width:1100px) and (orientation:portrait), (max-width:1200px) and (orientation:landscape){
 html:not([data-studio-renderer="webgl"]) #editor::before,
 html:not([data-studio-renderer="webgl"]) #editor::after{display:none!important}
}

.sheet-bar .sheet-view{margin-left:auto}
.sheet-bar .panel-close{position:static;display:grid;place-items:center;flex:none;width:44px;height:44px;min-height:44px;margin-left:4px;padding:0;font-size:24px;line-height:1}

.material-renderer .segmented{display:flex;width:100%;margin:10px 0 20px}
.material-renderer .segmented button{flex:1;min-width:0;min-height:44px;padding:9px 6px;font-size:11px}
.reset-defaults{margin-top:20px}

.reset-dialog{width:min(360px,calc(100% - 32px));padding:24px;border:1px solid #ffffff50;border-radius:18px;background:#101d22f5;color:#fff;box-shadow:0 20px 70px #0008}
.reset-dialog::backdrop{background:#0008;backdrop-filter:blur(5px)}
.reset-dialog h2{font-size:21px;line-height:1.2;margin:0 0 12px}
.reset-dialog p{font-size:13px;line-height:1.6;color:#d6e2e8;margin:0 0 20px}
.reset-dialog button{min-height:44px;color:#fff;border:1px solid #ffffff40;background:#ffffff10}
.reset-dialog button.primary{background:#e4f4f5;color:#102126}
.reset-dialog button:focus-visible{outline:2px solid #fff;outline-offset:3px}
/* Compact workspaces keep the tab dock available instead of dismissing it. */
@media(max-width:1200px){#editor #panel-close{display:none}}
/* Collapsed sheet: one compact tab row, with an icon-only expand handle. */
@media(max-width:1100px) and (orientation:portrait){
 #editor[data-sheet=compact]{height:calc(72px + env(safe-area-inset-bottom))}
 #editor[data-sheet=compact] .sheet-bar{z-index:2;position:absolute;left:0;top:0;width:44px;height:72px;padding:0;justify-content:center}
 #editor[data-sheet=compact] .sheet-handle{display:grid;place-items:center;width:44px;height:72px;padding:0}
 #editor[data-sheet=compact] .sheet-handle b{display:none}
 #editor[data-sheet=compact] .editor-tabs{padding:4px 8px 4px 44px;min-height:0}
 #editor[data-sheet=compact] .editor-tabs button{min-height:60px;padding:4px 0}
}

/* Half-height editing retains the same compact navigation density. */
@media(max-width:1100px) and (orientation:portrait){
 #editor[data-sheet=half] .editor-heading{display:none}
 #editor[data-sheet=half] .sheet-bar{position:absolute;inset:0 0 auto;height:72px;padding:0;z-index:2;pointer-events:none}
 #editor[data-sheet=half] .sheet-bar button{pointer-events:auto;display:grid;place-items:center;width:44px;height:72px;padding:0;margin:0;flex:none}
 #editor[data-sheet=half] .sheet-handle b,
 #editor[data-sheet=half] .sheet-view span{display:none}
 #editor[data-sheet=half] .editor-tabs{height:72px;min-height:72px;flex:none;padding:4px 44px}
 #editor[data-sheet=half] .editor-tabs button{min-height:60px;padding:4px 0}
}
/* Compact navigation: restrained app chrome, with emphasis on the active icon. */
@media(max-width:1100px) and (orientation:portrait){
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .editor-tabs{gap:2px;align-items:center}
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .editor-tabs button{
  min-height:60px;gap:5px;padding:5px 0;border:0;border-radius:14px;
  background:transparent;box-shadow:none;color:#e5f0f0b8;
  font-size:10px;font-weight:500;line-height:1.15;letter-spacing:.015em;
  transition:color .18s ease,background .18s ease;
 }
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .editor-tabs .tab-icon{
  width:18px;height:18px;padding:5px;box-sizing:content-box;border-radius:10px;
  stroke-width:1.6;transition:background .18s ease,box-shadow .18s ease;
 }
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .editor-tabs [aria-selected=true]{
  color:#fff;background:none;box-shadow:none;
 }
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .editor-tabs [aria-selected=true] .tab-icon{
  background:#ffffff16;box-shadow:inset 0 1px 0 #ffffff30,0 2px 5px #00000018;stroke-width:2;
 }
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .editor-tabs button:focus-visible{
  outline:2px solid #ffffffa6;outline-offset:-3px;
 }
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .sheet-bar button{
  color:#e5f0f0b8;transition:color .18s ease;
 }
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .sheet-bar button:active,
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .editor-tabs button:active{color:#fff;background:#ffffff0a}
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .sheet-bar svg{width:16px;height:16px}
}
@media(prefers-reduced-motion:reduce){#editor .editor-tabs button,#editor .editor-tabs .tab-icon,#editor .sheet-bar button{transition:none!important}}

/* Expanded editing uses the compact controls, retaining the wordmark above. */
@media(max-width:1100px) and (orientation:portrait){
 #editor[data-sheet=expanded] .editor-heading{height:38px;min-height:38px;padding:0 16px;justify-content:center}
 #editor[data-sheet=expanded] .editor-heading .brand-wordmark{height:38px;width:170px}
 #editor[data-sheet=expanded] .sheet-bar{position:absolute;inset:38px 0 auto;height:72px;padding:0;z-index:2;pointer-events:none}
 #editor[data-sheet=expanded] .sheet-bar button{pointer-events:auto;display:grid;place-items:center;width:44px;height:72px;padding:0;margin:0;flex:none}
 #editor[data-sheet=expanded] .sheet-handle b,
 #editor[data-sheet=expanded] .sheet-view span{display:none}
 #editor[data-sheet=expanded] .editor-tabs{height:72px;min-height:72px;flex:none;padding:4px 44px}
 #editor[data-sheet=expanded] .editor-tabs button{min-height:60px;padding:5px 0}
}
/* Keep workspace actions together, separate from the editing tabs. */
@media(max-width:1100px) and (orientation:portrait){
 #editor:is([data-sheet=half],[data-sheet=expanded]) .sheet-bar{left:auto;right:0;width:88px;justify-content:flex-end}
 #editor:is([data-sheet=half],[data-sheet=expanded]) .sheet-bar button{width:44px}
 #editor:is([data-sheet=half],[data-sheet=expanded]) .editor-tabs{padding-left:6px;padding-right:92px}
 #editor[data-sheet=compact] .sheet-bar{left:auto;right:0;width:44px}
 #editor[data-sheet=compact] .editor-tabs{padding-left:6px;padding-right:48px}
}
@media(max-width:1100px) and (orientation:portrait){
 #editor[data-sheet=expanded] .editor-heading{display:none}
 #editor[data-sheet=expanded] .sheet-bar{top:0}
}
/* Frosted section bars keep accordion headings readable over busy scenes. */
#editor .control-group{border-top:0;margin-top:12px}
#editor .control-group>summary{
 align-items:center;min-height:44px;padding:12px 14px;border-radius:10px;
 border:1px solid #ffffff26;background:#14242b38;
 background:linear-gradient(120deg,#ffffff13,#ffffff08),#14242b38;
 -webkit-backdrop-filter:blur(12px) saturate(110%);backdrop-filter:blur(12px) saturate(110%);
 box-shadow:inset 0 1px 0 #ffffff10;color:#f4fafb;
 font-size:12px;font-weight:600;letter-spacing:.005em;text-shadow:0 1px 2px #0004;
}
#editor .control-group[open]>summary{background:linear-gradient(120deg,#ffffff1c,#ffffff0a),#14242b38;border-color:#ffffff38}
#editor .control-group>summary::after{color:#eaf7f9;font-size:16px;line-height:1;margin-left:12px}
#editor .control-group>summary:focus-visible{outline:2px solid #ffffffc0;outline-offset:3px}
/* Inset section contents beneath full-width frosted headings. */
#editor .control-group> :not(summary){margin-left:14px;margin-right:14px}
#editor .control-group>.color-row{width:auto}
#editor .control-group>.text-effects{width:auto}

/* One continuous glass surface hands selection from tab to tab. */
#editor .editor-tabs.liquid-tabs-ready{position:relative;isolation:isolate}
#editor .editor-tabs.liquid-tabs-ready>[role=tab]{position:relative;z-index:1}
#editor .editor-tabs.liquid-tabs-ready .nav-liquid{
 position:absolute;top:0;left:0;z-index:0;pointer-events:none;box-sizing:border-box;
 background:linear-gradient(145deg,#ffffff30,#ffffff08 48%,#ffffff1a);
 border:1px solid #ffffff38;
 box-shadow:inset 0 1px 1px #ffffff66,inset 0 -1px 2px #ffffff18,0 3px 10px #00000014;
 -webkit-backdrop-filter:blur(3px) saturate(140%);backdrop-filter:blur(3px) saturate(140%);
 will-change:transform,width;
}
#editor .editor-tabs.liquid-tabs-ready [role=tab][aria-selected=true],
#editor .editor-tabs.liquid-tabs-ready [role=tab][aria-selected=true] .tab-icon{background:none!important;box-shadow:none!important}
#editor .editor-tabs.liquid-tabs-ready [role=tab][aria-selected=true]::after{display:none}
@media(prefers-reduced-motion:reduce){#editor .nav-liquid{will-change:auto}}
/* Keep tablet navigation clustered rather than spreading across the sheet. */
@media(max-width:1100px) and (orientation:portrait){
 #editor:is([data-sheet=compact],[data-sheet=half],[data-sheet=expanded]) .editor-tabs{
  grid-template-columns:repeat(4,minmax(0,88px));justify-content:start;gap:6px;
 }
 #editor:is([data-sheet=half],[data-sheet=expanded]) .sheet-bar{
  right:8px;width:88px;gap:0;
 }
 #editor[data-sheet=compact] .sheet-bar{right:8px}
}
@media(max-width:1100px) and (orientation:portrait){
 #editor:is([data-sheet=half],[data-sheet=expanded]) .editor-tabs{padding-right:106px}
 #editor:is([data-sheet=half],[data-sheet=expanded]) .sheet-bar{
  top:13px;height:46px;width:90px;border:1px solid #ffffff24;border-radius:22px;background:#ffffff08;
 }
 #editor:is([data-sheet=half],[data-sheet=expanded]) .sheet-bar button{height:44px;min-height:44px;width:44px}
}
@media(max-width:1100px) and (orientation:portrait){
 #editor[data-sheet=compact] .editor-tabs{padding-right:56px}
}

/* Each navigation icon has the same quiet glass shell as the canvas actions. */
#editor .editor-tabs [role=tab]{background:none!important;box-shadow:none!important;border:0}
#editor .editor-tabs [role=tab] .tab-icon{
 width:18px;height:18px;padding:6px;box-sizing:content-box;border:1px solid #ffffff24;
 border-radius:999px;background:#ffffff08;box-shadow:none;stroke-width:1.6;
}
#editor .editor-tabs [role=tab][aria-selected=true] .tab-icon{border-color:transparent}
#editor .editor-tabs.liquid-tabs-ready .nav-liquid{
 z-index:1;border-color:#ffffff38;border-radius:999px;
}
#editor .editor-tabs.liquid-tabs-ready>[role=tab]{z-index:2}
@media(max-height:500px) and (max-width:1200px) and (orientation:landscape){
 #editor .editor-heading .brand{display:none}
 #editor .editor-heading{height:0;min-height:0;padding:0}
}
/* Reopen control shares the navigation's glass icon and label treatment. */
#panel-open{
 flex-direction:column;justify-content:center;gap:5px;min-width:60px;min-height:60px;padding:5px 8px;
 background:none;border:0;border-radius:14px;box-shadow:none;color:#e5f0f0;
 backdrop-filter:none;-webkit-backdrop-filter:none;font-size:10px;font-weight:500;line-height:1.15;letter-spacing:.015em;
}
#panel-open svg{
 width:18px;height:18px;padding:6px;box-sizing:content-box;
 border:1px solid #ffffff24;border-radius:999px;background:#ffffff08;stroke-width:1.6;
 backdrop-filter:blur(3px) saturate(140%);-webkit-backdrop-filter:blur(3px) saturate(140%);
}
#panel-open span{text-shadow:0 1px 3px #0006}
#panel-open:focus-visible{outline:2px solid #ffffffa6;outline-offset:3px}
#panel-open:active{color:#fff}
#panel-open:active svg{background:#ffffff16}
