:root[data-theme=pink],:root[data-theme=violet],:root[data-theme=ocean],:root[data-theme=forest]{color-scheme:dark;--bg:#18151a;--panel:#241f27;--surface:#302935;--line:#514657;--text:#f8f1f6;--muted:#c9b9c6;--accent:#f4a9ce;--inverse:#271521;--warm:#f0bc83;--tint:#493144;--glass:#241f27eb;--stage:#302935;--shadow:#0006;--mint:var(--accent);--orange:var(--warm)}
:root[data-theme=violet]{--accent:#c4b3ff;--tint:#39304f;--panel:#211e2c;--surface:#302b3d;--bg:#15131d;--inverse:#211835}
:root[data-theme=ocean]{--accent:#99d1ef;--tint:#253f4c;--panel:#1d2a31;--surface:#293b43;--bg:#141e24;--inverse:#152b37}
:root[data-theme=forest]{--accent:#b4d7a0;--tint:#354634;--panel:#222c23;--surface:#303e31;--bg:#161e18;--inverse:#1a2b1c}
.theme-picker,select,select option{background:var(--panel);color:var(--text);border:1px solid var(--line)}
.theme-picker{border-radius:9px;padding:9px;max-width:115px;font:inherit;font-size:13px}
.builder,.panel-scroll,#catalog,.part-copy{min-width:0}.panel-scroll{overflow-x:hidden}.part-card{max-width:100%;gap:10px}.part-card img{flex:0 0 76px;max-width:29%;height:76px}.part-card strong,.part-card small,.part-card .tag{white-space:normal;overflow-wrap:anywhere}.part-card .part-copy{min-width:0}.frame-grid .part-card img{max-width:100%;width:100%;height:108px}.part-card .check{flex:0 0 16px}.section-head{flex-wrap:wrap;gap:5px}
.environment-control{display:flex;align-items:center;gap:8px;padding:8px;background:var(--bg);border:1px solid var(--line);border-radius:9px;max-width:240px}.environment-control select{min-width:0;padding:7px;border-radius:6px}
.editor-tools{position:absolute;left:24px;top:140px;z-index:3;display:flex;gap:5px;flex-wrap:wrap;max-width:calc(100% - 48px)}.editor-tools button{background:var(--panel);border:1px solid var(--line);border-radius:7px;padding:8px 10px;font-size:12px}.editor-tools button[aria-pressed=true]{background:var(--accent);color:var(--inverse)}
.power-legend{position:absolute;left:24px;top:225px;background:var(--panel);border:1px solid var(--line);border-radius:9px;padding:12px;max-width:330px;z-index:3}.power-legend>*{display:block;margin:4px 0}.power-legend span,.power-legend small{font-size:12px}.power-legend button{text-decoration:underline}
#editorSettings{width:min(760px,95vw);max-height:90dvh;padding:0;border:1px solid var(--line);border-radius:16px;background:var(--panel);color:var(--text)}#editorSettings::backdrop{background:#0009}.settings-heading{display:flex;justify-content:space-between;align-items:center;padding:18px 24px;border-bottom:1px solid var(--line)}.settings-heading h2{font-size:23px;margin:0}.settings-heading button,#settingsBody button{padding:9px 12px;border:1px solid var(--line);border-radius:7px;background:var(--surface)}#settingsBody{padding:20px 24px;max-height:72dvh;overflow:auto;font-size:14px;line-height:1.5}#settingsBody details{margin-top:20px;padding-top:16px;border-top:1px solid var(--line)}#settingsBody summary{font-size:17px;font-weight:600;cursor:pointer}#settingsBody label{display:block;margin:10px 0}#settingsBody select{display:block;width:100%;padding:9px;border-radius:7px}.palette-grid{display:grid;grid-template-columns:1fr 1fr;gap:14px;margin-bottom:20px}.palette-grid>div{padding:10px;border:1px solid var(--line);border-radius:9px}.palette-grid>div>div{display:flex;align-items:center;justify-content:space-between;gap:10px}.palette-grid input{height:40px;width:60px;padding:0;background:none;border:0}.connection-fields{display:grid;grid-template-columns:1fr 1fr;gap:10px}.connection-fields button{grid-column:1/-1}
.tree-node details{margin:4px 0 12px 8px;font-size:12px;color:var(--muted)}.tree-node .active-tray{border-left:3px solid var(--accent);background:var(--tint)}
.phone-drawer-grid button{border:1px solid var(--line);border-radius:8px;background:var(--surface);color:var(--text);min-height:105px;padding:12px;cursor:pointer}.phone-drawer-grid button.is-located{outline:3px solid var(--accent);outline-offset:3px;background:var(--tint)}.phone-drawer-grid button small{display:block;margin-top:15px}.phone-low{color:var(--warm);font-weight:600}.phone-manage input,.phone-manage textarea{width:100%;padding:9px;background:var(--surface);color:var(--text);border:1px solid var(--line);border-radius:6px}.phone-module{margin:20px 0}.phone-stock-actions{display:flex;gap:8px;flex-wrap:wrap}.phone-stock-actions input{width:70px}.phone-module h4{margin:10px 0}.phone-filter{display:flex;gap:8px;align-items:center;margin:12px 0}.phone-filter input{width:auto}
.catalogue-browser{padding:24px;max-height:70vh;overflow:auto}.catalogue-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:14px}.catalogue-entry{border:1px solid var(--line);padding:14px;border-radius:10px}.catalogue-entry img{width:100%;max-height:180px;object-fit:contain}.catalogue-entry h3{font-size:17px}.catalogue-entry p{font-size:13px;line-height:1.5}.catalogue-filters{display:flex;gap:10px;flex-wrap:wrap;margin-bottom:18px}.catalogue-filters select,.catalogue-filters input{padding:10px;background:var(--panel);color:var(--text);border:1px solid var(--line)}
@media(max-width:1100px){.view-controls{top:80px;right:16px}.editor-tools{top:150px;left:16px}.environment-control{top:30px;right:16px}.stage-heading{max-width:50%}.stage-heading p{font-size:12px}.stage-bottom .hint{display:none}}
@media(max-width:700px){.palette-grid{grid-template-columns:1fr}.editor-tools{top:135px;gap:4px}.editor-tools button{font-size:11px;padding:7px}.power-legend{top:220px;max-width:270px}.stage-heading{top:22px}.view-controls{top:80px;right:8px}.view-controls button{padding:6px 7px}.environment-control{top:12px;max-width:180px}.header-right{gap:8px}.theme-picker{max-width:85px}.phone-module .phone-drawer-grid{grid-template-columns:1fr 1fr}}

.full-bin-action{display:flex;align-items:center;gap:1rem;padding:1rem;flex-wrap:wrap}.inventory-apply{position:sticky;bottom:0;z-index:3;background:var(--panel,#252625);padding:.7rem;border-top:1px solid var(--line,#555)}.inventory-apply>strong{flex-basis:100%;font-size:.8rem}.tray-choice-header{position:sticky;top:0;z-index:2;background:var(--panel,#252625)}

.phone-preview{align-items:start}.phone-shell{background:var(--panel);border-color:var(--line)}.phone-screen{color:var(--text)}#phoneResults{max-height:245px;overflow:auto;padding:0 4px 4px 0;scrollbar-gutter:stable}.inventory-result,.phone-screen input,.phone-stock-actions button,.phone-manage button,.phone-metrics div{background:var(--surface,var(--panel));color:var(--text);border-color:var(--line)}.phone-screen label,.phone-kicker,.phone-location,.phone-manage,.phone-metrics dt,.inventory-result span{color:var(--muted)}.phone-metrics dd{color:var(--text)}.phone-screen .button{background:var(--accent);color:var(--inverse,#171917)}.inventory-result[aria-pressed=true]{border-color:var(--accent)}.phone-stock-actions input{width:70px}.phone-filter{display:flex!important}.phone-filter input{width:18px;min-height:18px;padding:0}.phone-drawer-grid{background:var(--panel);border-color:var(--line)}.phone-modules{display:grid;gap:12px}.phone-module{margin:0}.phone-module .phone-drawer-grid{margin:8px 0 18px}.phone-module h4{font-size:14px;letter-spacing:.08em}.phone-drawer-grid button{transition:background .15s}.phone-drawer-grid button[aria-pressed=true]{border-color:var(--accent)}.module-card .text-link{background:none;border:0;padding:0;color:var(--text);cursor:pointer;text-decoration:underline}.module-render{aspect-ratio:auto}.catalogue-entry .button{font-size:13px;padding:8px 12px}
#trayEditor[open]{display:flex;flex-direction:column}.tray-editor-header,.tray-tabs{flex-shrink:0}#trayEditorContent{height:auto;min-height:0;flex:1;display:flex;flex-direction:column;overflow:hidden}#trayEditorContent>.tray-layout{flex:1;height:auto;min-height:0}.full-bin-action{flex-shrink:0;border-top:1px solid var(--line)}@media(max-width:720px){#trayEditorContent{overflow:auto}#trayEditorContent>.tray-layout{flex:none;overflow:visible;display:flex;flex-direction:column}.full-bin-action{position:sticky;bottom:0;background:var(--panel);z-index:5}}

.theme-accent{position:relative;font-size:12px}.theme-accent summary{cursor:pointer;padding:9px;border:1px solid var(--line);border-radius:8px;list-style:none}.theme-accent>div{position:absolute;right:0;top:40px;width:230px;padding:16px;background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:10px;z-index:100;box-shadow:0 8px 30px #0006}.theme-accent label,.theme-accent small{display:block;margin-bottom:10px}.theme-accent input{display:block;margin-top:8px;width:100%;height:36px}.theme-accent button{padding:8px;border:1px solid var(--line);border-radius:5px;background:var(--surface);color:var(--text)}

.module-viewer{background:var(--panel);color:var(--text);border-color:var(--line)}.module-viewer-bar{background:var(--panel)}.module-viewer-bar button{background:var(--surface);color:var(--text);border-color:var(--line)}.catalogue-entry{background:var(--surface)}.phone-screen input:focus{outline-color:var(--accent)}.phone-empty{color:var(--muted)}
@media(max-width:500px){.site-header .brand span{display:none}.site-header .header-actions{gap:7px}.site-header .theme-picker{max-width:78px}.site-header .theme-accent summary{padding:9px 7px}}
.view-controls{bottom:auto}
@media(max-width:720px){body:has(.workspace)>header{height:92px;flex-wrap:wrap;gap:4px;padding:7px 12px}.workspace~.builder{min-height:0}body:has(.workspace) .brand{width:100%;font-size:17px}body:has(.workspace) .brandmark{width:18px;height:18px;margin-right:4px}body:has(.workspace) .brandmark .ui-icon{width:18px;height:18px}body:has(.workspace) .header-right{width:100%;justify-content:space-between;gap:5px}body:has(.workspace) main{height:calc(100dvh - 146px)}.workspace{height:46dvh;min-height:340px}.workspace .stage-heading{display:none}.workspace .environment-control{top:10px;left:12px;right:auto;max-width:195px}.workspace .view-controls{top:64px;bottom:auto;left:12px;right:12px;height:46px;justify-content:center;align-items:center}.workspace .editor-tools{top:auto;bottom:62px;left:12px;right:12px;gap:5px;display:flex;flex-wrap:wrap;max-width:none}.workspace .editor-tools button{min-height:32px}.workspace .stage-bottom{bottom:140px;right:12px}.workspace .stage-bottom .pill{padding:7px 10px;font-size:11px}.workspace .power-legend{top:116px;max-width:280px;font-size:12px}.workspace .power-legend span{display:none}.workspace .history{top:10px;right:12px}.workspace .explode-controls{top:115px;left:12px}.workspace #stage{bottom:55px}}

#trayEditorFooter{flex-shrink:0;border-top:1px solid var(--line);background:var(--panel);display:grid;grid-template-columns:1fr 1fr;align-items:center;padding:8px 16px;gap:12px}#trayEditorFooter .inventory-apply{position:static;border:0;padding:0;display:flex;gap:8px;flex-wrap:wrap}#trayEditorFooter .full-bin-action{position:static;border:0;padding:0;gap:5px;justify-content:end}#trayEditorFooter small{font-size:11px}#trayEditorFooter button{padding:8px 10px;border:1px solid var(--line);border-radius:6px;font-size:12px}#trayEditorFooter .inventory-primary{background:var(--accent);color:var(--inverse)}@media(max-width:720px){#trayEditorFooter{display:flex;flex-direction:column;align-items:stretch;gap:7px;padding:10px 12px}#trayEditorFooter .inventory-apply strong{font-size:12px}#trayEditorFooter .full-bin-action{justify-content:start}#trayEditorFooter .full-bin-action small{display:none}#trayEditorContent .tray-live-stage{height:280px;min-height:280px}#trayEditorContent .tray-workbench{flex-shrink:0}}

.module-card-copy .text-link{display:inline-block;margin:14px 16px 0 0}.catalogue-entry .button{margin-top:auto}.catalogue-entry{display:flex;flex-direction:column;gap:8px}.catalogue-entry p{margin:0}

.motion-figure video{display:block;width:100%;height:auto;object-fit:contain}.motion-figure [hidden]{display:none!important}
