/* Selected references stay in a compact bottom strip; the gallery never narrows. */
#workspaceDock {
  position: fixed; inset: auto auto calc(18px + env(safe-area-inset-bottom)) 50%; transform: translateX(-50%);
  width: min(880px, calc(100vw - 40px)); max-width: none; display: flex; align-items: center; gap: 10px;
  padding: 7px; border: 1px solid var(--line); border-radius: 16px;
  background: color-mix(in srgb, var(--bg2) 94%, transparent);
  box-shadow: 0 10px 32px rgba(29, 33, 41, .12), 0 0 0 1px var(--line);
  backdrop-filter: blur(12px) saturate(1.1);
  -webkit-backdrop-filter: blur(12px) saturate(1.1);
  --rail-bg: var(--bg2); --rail-text: var(--tx); --rail-muted: var(--mu); --rail-hover: var(--sf); --rail-line: var(--line2);
}
#workspaceDock:not(:has(> :not([hidden]))) { display: none; }
#trayFab { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 10px; width: auto; min-width: 0; min-height: 44px; height: auto; padding: 4px 10px; border: 0; border-radius: 7px; color: var(--tx); background: transparent; box-shadow: none; font-size: 12px; }
#workspaceDock > #trayFab { flex: 1; }
#trayFab:hover { background: var(--sf); }
#trayFab .dock-chevron { display: none; }
#workspaceDock .dock-mark, #trayFab .dock-mark { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--acs); color: var(--ac); flex: none; }
#trayFab svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tools #trayFab { min-height: 34px; width: 32px; padding: 0; justify-content: center; }
.tools #trayFab .dock-mark { background: transparent; color: var(--tx2); }
.tools #trayFab :is(.dock-launch-name, #trayFilm, #trayFabN) { display: none; }
#trayFilm { flex-direction: row; gap: 4px; padding: 0; max-width: 160px; overflow: hidden; }
#trayFilm img { width: 25px; height: 34px; transform: none !important; border-color: var(--line2); border-radius: 4px; }
#trayFilm img:not(:first-child) { margin: 0; }
#trayFab #trayFabN { min-width: 22px; background: var(--sf); color: var(--tx); }
#composeFab {
  pointer-events: auto; min-width: 120px; min-height: 44px; margin: 0; padding: 9px 18px;
  border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 10px rgba(255, 36, 66, .25);
}
body.tray #workspaceDock { padding: 0; display: block; }
#workspaceDock #tray {
  width: 100%; max-width: none; height: auto; max-height: min(72dvh, 650px); display: flex;
  flex-direction: column; align-items: stretch; gap: 0; overflow: hidden; border-radius: 12px;
  background: var(--bg2); pointer-events: auto; transform: none; animation: none;
}
body #workspaceDock[data-anchor=header] {
  top: var(--tray-anchor-top, calc(var(--hdr) + 8px)); left: var(--tray-anchor-left, 12px);
  right: auto; bottom: auto; width: min(440px, calc(100vw - 24px));
  max-width: calc(100vw - 24px); transform: none; z-index: 43;
}
body #workspaceDock[data-anchor=header] #tray { width: 100%; max-height: min(650px, var(--tray-anchor-height)); }
.tools #trayFab[aria-expanded=true] { background: var(--sf); }
#tray .dock-foot { order: -1; display: block; flex: none; width: 100%; padding: 12px 18px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; color: var(--tx); background: var(--bg2); box-shadow: none; }
#tray .dock-title { width: 100%; min-width: 0; }
#trayMin { width: 100%; min-height: 30px; padding: 0; justify-content: flex-start; background: transparent; color: var(--tx); }
#trayMin .dock-chevron { margin-left: auto; transform: rotate(180deg); }
#tray .tray-b { flex: 0 1 auto; display: flex; flex-direction: column; min-height: 0; overflow-y: auto; gap: 12px; padding: 14px 18px; border: 0; border-radius: 0; box-shadow: none; }
#tray .dock-materials { display: block; border: 0; padding: 0; }
#tray .dock-block { display: block; }
#tray .dock-heading { min-height: 28px; }
#tray .tray-items { display: flex; flex-direction: row; flex-wrap: nowrap; max-height: none; padding: 8px 6px 8px 1px; gap: 9px; overflow-x: auto; overflow-y: hidden; }
#tray .tray-items:empty { display: none; }
#tray .tray-items img { width: 64px; height: 82px; }
#tray .tg-add { margin-top: 6px; gap: 6px; }
#tray .tg-add :is(button, summary) { min-height: 34px; }
#tray .dock-combo { margin-top: 10px; }
#tray .quick-workflow { flex: none; border-top: 1px solid var(--line); padding-top: 8px; }
.quick-workflow > summary { min-height: 30px; cursor: pointer; color: var(--tx2); font-size: 12px; }
.quick-help { margin: 8px 0; color: var(--mu); font-size: 11px; line-height: 1.6; }
#tray .tgen { display: flex; flex-direction: column; min-height: 0; padding: 0; border: 0; gap: 8px; }
#tray #tgPrompt { flex: none; width: 100%; min-height: 90px; height: 100px; max-height: 220px; border: 1px solid var(--line2); border-radius: 8px; background: var(--sf); }
#tray .tgen-row { margin: 0; justify-content: flex-start; gap: 18px; }
#tray .dock-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
#tray .dock-actions button { min-height: 36px; border-radius: 7px; }
#tray #tgCfg { min-width: 0; gap: 5px; padding: 6px 10px; }
#tray #tgProv { font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
#tray #tgGo { background: var(--ac); color: #fff; }
.basket-next { flex: none; order: 2; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 18px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--sf) 45%, var(--bg2)); }
.basket-next p { margin: 0; color: var(--tx2); font-size: 12px; line-height: 1.5; }
#tgStudio { width: auto; min-width: 140px; min-height: 40px; flex: none; border-radius: 10px; font-weight: 650; box-shadow: 0 4px 14px rgba(255, 36, 66, .2); }
/* Canvas first: a full-width preview above one compact creation composer. */
body.studio { padding: 0; background: var(--bg); }
body.studio #studio { max-width: var(--w); height: calc(100dvh - var(--hdr)); padding: 0 var(--gutter) 20px; }
.studio-head { flex: none; max-width: none; min-height: 58px; padding: 12px 0; margin-bottom: 12px; gap: 16px; border-bottom: 1px solid var(--line); }
.studio-title { display: flex; align-items: baseline; gap: 14px; }
.studio-head h1 { font-size: 20px; font-weight: 680; letter-spacing: -.03em; color: var(--tx); }
.studio-title > span { color: var(--mu); font-size: 12.5px; }
.studio-head-act { gap: 8px; }
.studio-head-act button {
  min-height: 34px; padding: 6px 14px; border-radius: 8px; font-size: 12.5px;
  background: var(--bg2); border: 1px solid var(--line); color: var(--tx2);
  transition: background-color 150ms var(--out), border-color 150ms var(--out), color 150ms var(--out);
}
.studio-head-act button:hover { background: var(--sf); border-color: var(--line2); color: var(--tx); }
.st-app { display: flex; flex: 1; flex-direction: column; min-height: 0; gap: 0; max-width: none; }
#studioPreview {
  order: -1; flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--sh1);
  background-color: var(--bg2);
  background-image: radial-gradient(color-mix(in srgb, var(--line2) 80%, transparent) 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: center;
}
#studioPreview .canvas-head { position: relative; flex: none; min-height: 42px; padding: 10px 16px 0; border: 0; background: transparent; }
.studio-recent > summary { min-height: 28px; padding: 6px 0; color: var(--mu); cursor: pointer; font-size: 11px; }
.studio-recent:has(.hl:empty) { display: none; }
.studio-recent .hist { position: absolute; z-index: 8; top: calc(100% + 8px); right: 0; width: min(320px, 100%); max-height: 300px; overflow-y: auto; padding: 14px; border: 1px solid var(--line2); border-radius: 12px; background: var(--bg2); box-shadow: var(--sh2); }
.studio-recent .sh { margin-bottom: 10px; }
.studio-recent .sh b { font-size: 12px; }
.studio-recent .hl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.studio-recent .hl button { min-width: 0; }
.studio-recent .hl img { width: 100%; height: 70px; object-fit: cover; border-radius: 6px; }
.studio-recent .hl span { display: none; }
#studioPreview .canvas-head h2 { color: var(--mu); font-size: 12px; font-weight: 500; }
#studioPreview #wbStage { flex: 1; min-height: 0; background: transparent; background-image: none; }
#studioPreview #wbPh0 { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; height: 100%; max-height: none; padding: 24px; overflow-y: auto; }
#studioPreview #wbPh0:has(#wbExamples[open]) { gap: 10px; padding: 12px; overflow-y: hidden; }
.preview-placeholder { flex: none; padding: 12px 0; text-align: center; }
.preview-placeholder > svg {
  display: block; width: 52px; height: 52px; padding: 14px; box-sizing: content-box; margin: 0 auto 20px;
  border: 1px solid var(--line); border-radius: 18px; color: var(--ac);
  fill: none; stroke: currentColor; stroke-width: 1.4; background: var(--acs);
  box-shadow: var(--sh1);
}
.preview-placeholder h3 { color: var(--tx); font-size: clamp(22px, 2.4vw, 30px); font-weight: 680; letter-spacing: -.04em; }
.preview-placeholder p { margin: 10px auto 22px; max-width: 420px; color: var(--tx2); font-size: 13.5px; line-height: 1.75; }
.preview-placeholder button {
  min-height: 40px; padding: 10px 24px; border: 1px solid var(--ac); border-radius: 12px;
  background: var(--ac); color: #fff; font-size: 13.5px; font-weight: 650;
  box-shadow: 0 4px 14px rgba(255, 36, 66, .24);
  transition: background-color 150ms var(--out), border-color 150ms var(--out), transform 150ms var(--out);
}
.preview-placeholder button:hover { background: var(--ac2); border-color: var(--ac2); color: #fff; box-shadow: 0 4px 14px rgba(255, 36, 66, .3); }
#wbBoardCards { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); align-items: start; justify-content: center; width: 100%; max-width: 660px; gap: 24px; padding: 0; }
#wbBoardCards:empty { display: none; }
#wbBoardCards > .board-card, #wbBoardCards > .board-card:only-child { width: 100%; max-width: 220px; min-width: 0; padding: 0; margin: 0; justify-self: center; transform: none; border: 0; border-radius: 10px; box-shadow: none; background: transparent; }
#wbBoardCards > .board-card img { aspect-ratio: 3 / 4; max-height: min(280px, 30dvh); object-fit: contain; border: 1px solid var(--line2); border-radius: 10px; background: var(--bg2); }
#wbBoardCards .board-card > span { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 12px 0 0; color: var(--tx2); font-size: 12px; }
#wbBoardCards .board-label { font-weight: 500; }
#wbBoardCards .board-idx { position: static; min-width: 16px; width: auto; height: 16px; padding: 0; border-radius: 0; background: transparent; color: var(--mu); font-size: 10px; line-height: 16px; }
#wbBoardCards .board-ang { position: static; margin-left: 5px; padding: 0; background: transparent; color: var(--mu); font-size: 10px; }
#wbBoardCards.many { grid-template-columns: repeat(auto-fit, minmax(70px, 100px)); gap: 14px; }
#wbBoardCards.many .board-card img { max-height: 130px; }
#studioPreview .out-act { flex: none; flex-wrap: wrap; margin: 6px 0 12px; padding: 0; gap: 6px; }
#studioPreview .out-act #wbMeta { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
#studioPreview .cmp { max-height: 100%; }
#studioPreview .res { flex: none; margin: 4px 0; }
#studioPreview .warn { flex: none; max-height: 70px; overflow-y: auto; }
/* The composer owns the whole action, from references to the submit button. */
#studioEditor {
  position: relative; display: grid; flex: none;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: 'head head head' 'prompt prompt prompt' 'quick advanced go';
  align-items: center; column-gap: 14px; row-gap: 2px; width: min(100%, 1040px); margin: 14px auto 0;
  padding: 0 22px 16px; border: 1px solid var(--line2); border-radius: 16px;
  background: var(--bg2); box-shadow: 0 12px 36px rgba(29, 33, 41, .08), 0 0 0 1px var(--line);
}
[data-theme=dark] #studioEditor {
  box-shadow: 0 14px 36px rgba(0, 0, 0, .42);
}
.studio-editor-head { grid-area: head; display: flex; align-items: center; gap: 12px; min-height: 50px; border-bottom: 1px solid var(--line); }
.studio-editor-head .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.editor-scroll, #studioSettings { display: contents; }
.studio-editor-head #wbCfg {
  display: flex; align-items: center; margin-left: auto; min-width: 0; max-width: 220px;
  min-height: 30px; padding: 4px 10px; gap: 6px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--sf); font-size: 11.5px;
  transition: background-color 150ms var(--out), border-color 150ms var(--out);
}
.studio-editor-head #wbCfg:hover { background: var(--sf2); border-color: var(--line2); }
#wbCfg #wbProv { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#wbCfg b { color: var(--ac); font-size: 11px; flex: none; }
.composer-references > summary { display: flex; align-items: center; gap: 7px; min-height: 32px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.composer-references > summary b { display: grid; place-items: center; min-width: 19px; height: 19px; padding: 0 4px; border-radius: 5px; background: var(--sf); color: var(--mu); font-size: 10px; font-weight: 500; }
.composer-references[open] > summary { color: var(--ac); }
.composer-add { display: flex; gap: 4px; }
.composer-add button {
  min-height: 30px; gap: 6px; padding: 5px 10px; border-radius: 7px;
  color: var(--tx2); font-size: 11.5px; background: var(--sf);
  transition: background-color 150ms var(--out), color 150ms var(--out);
}
.composer-add button:hover { background: var(--sf2); color: var(--tx); }
.composer-add button span { color: var(--mu); font-size: 14px; }
.reference-panel { position: absolute; z-index: 10; left: 0; bottom: calc(100% + 12px); width: 430px; max-width: 100%; max-height: min(520px, var(--studio-popover-height, 400px)); overflow-y: auto; overscroll-behavior: contain; padding: 16px 20px; border: 1px solid var(--line2); border-radius: 14px; background: var(--bg2); box-shadow: var(--sh2); }
.reference-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.reference-panel-head button { min-height: 30px; font-size: 12px; }
#studioRefs { display: block; max-height: none; padding: 0; overflow: visible; }
.editor-label { display: none; }
#studioRefs .primary-materials { display: block; padding: 0; border: 0; background: transparent; }
#studioRefs .primary-materials .step { padding: 10px 0; border: 0; border-radius: 0; background: transparent; }
#studioRefs .primary-materials .step + .step { border-top: 1px solid var(--line); }
#studioRefs .sh { min-height: 24px; margin-bottom: 6px; }
#studioRefs .sh b { font-size: 12px; }
#studioRefs .material-icon { width: 15px; height: 15px; }
#studioRefs .lnk { min-height: 28px; padding: 3px 5px; font-size: 11px; }
#studioRefs .empty0 { min-height: 36px; padding: 7px 10px; border: 1px dashed var(--line2); border-radius: 7px; font-size: 12px; }
#studioRefs .pick { padding: 5px; border-radius: 7px; margin-top: 5px; }
#studioRefs .pick > img { width: 35px; height: 44px; }
#studioRefs .persons { margin: 0; gap: 7px; }
#studioRefs .persons .pp { width: 54px; height: 66px; border-radius: 7px; }
#studioRefs .persons .pp img { width: 100%; height: 100%; object-fit: contain; }
#studioRefs .persons .pp .x { width: 22px; height: 22px; right: 2px; top: 2px; }
#studioRefs .material-extras { padding: 0; margin-top: 4px; border: 0; border-radius: 0; background: transparent; }
#studioRefs .material-extras > summary { min-height: 34px; padding: 7px 0; font-size: 12px; }
#studioEditor .prompt-panel { grid-area: prompt; padding: 12px 0 10px; margin-bottom: 10px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; }
#studioEditor .prompt-panel .sh { justify-content: space-between; margin: 0 0 5px; }
#studioEditor .prompt-panel .sh > b { font-size: 12px; color: var(--mu); font-weight: 500; }
#studioEditor .modes { margin-left: auto; padding: 2px; border: 0; border-radius: 7px; background: var(--sf); }
#studioEditor .modes { padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--sf); }
#studioEditor .modes button { min-height: 26px; padding: 4px 12px; border-radius: 6px; font-size: 11.5px; }
#studioEditor #wbPrompt { display: block; width: 100%; height: 72px; min-height: 58px; max-height: 160px; margin: 0; padding: 8px 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; font-size: 14px; line-height: 1.7; resize: vertical; }
#studioEditor #wbPrompt:focus { outline: none; }
#studioEditor .prompt-panel:focus-within { box-shadow: inset 2.5px 0 var(--ac); padding-left: 12px; }
#studioEditor .prompt-tools { min-height: 26px; margin-top: 6px; gap: 4px; }
#studioEditor .prompt-tools .seg { padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: var(--sf); gap: 2px; }
#studioEditor .prompt-tools button { min-height: 24px; padding: 3px 8px; border-radius: 5px; color: var(--mu); font-size: 11px; }
#studioEditor .prompt-tools button.on { color: var(--tx); background: var(--bg2); box-shadow: var(--sh1); }
#studioEditor .quick { grid-area: quick; display: flex; align-items: center; gap: 12px; padding: 0; border: 0; border-radius: 0; background: transparent; }
.studio-style { position: relative; }
.studio-style > summary {
  display: flex; align-items: center; gap: 8px; min-height: 30px; padding: 4px 10px;
  border-radius: 7px; background: var(--sf); cursor: pointer; font-size: 11.5px; white-space: nowrap;
  transition: background-color 150ms var(--out);
}
.studio-style > summary:hover { background: var(--sf2); }
.studio-style > summary > span { display: none; }
.studio-style > summary b { font-weight: 550; color: var(--tx2); }
.studio-style > summary::after { content: ''; width: 5px; height: 5px; margin-top: -3px; border-right: 1px solid var(--mu); border-bottom: 1px solid var(--mu); transform: rotate(45deg); }
.studio-style .chips { position: absolute; z-index: 11; bottom: calc(100% + 12px); left: 0; width: 280px; max-width: calc(100vw - 50px); gap: 7px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg2); box-shadow: var(--sh2); }
#studioEditor .quick .q2 { margin: 0; }
#studioEditor .q2 > .row { gap: 10px; }
#studioEditor .q2 .lab { display: flex; align-items: center; gap: 6px; color: var(--mu); font-size: 11.5px; white-space: nowrap; }
#studioEditor .q2 select { min-height: 30px; max-width: 100px; padding: 4px 20px 4px 8px; border: 0; border-radius: 7px; background-color: var(--sf); color: var(--tx2); font-size: 11.5px; }
#studioEditor .adv { grid-area: advanced; justify-self: start; padding: 0; border: 0; border-radius: 0; background: transparent; }
#studioEditor .adv > summary { min-height: 30px; padding: 5px 10px; border-radius: 7px; color: var(--tx2); cursor: pointer; font-size: 11.5px; white-space: nowrap; transition: background-color 150ms var(--out); }
#studioEditor .adv > summary:hover { background: var(--sf); color: var(--tx); }
#studioEditor .adv-b { position: absolute; z-index: 10; right: 0; bottom: calc(100% + 12px); width: 360px; max-width: 100%; max-height: min(480px, var(--studio-popover-height, 400px)); padding: 18px; border: 1px solid var(--line2); border-radius: 14px; overflow-y: auto; background: var(--bg2); box-shadow: var(--sh2); }
#studioEditor #wbExtra { margin-top: 14px; border-radius: 8px; background: var(--sf); }
#studioEditor .gobar { grid-area: go; display: flex; align-items: center; gap: 14px; position: static; padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; }
#studioEditor .gb-i { display: block; padding: 0; color: var(--mu); }
#studioEditor .gb-i b { font-size: 10px; font-weight: 400; white-space: nowrap; }
#studioEditor #wbCfg2 { display: none; }
#wbGo {
  width: auto; min-width: 126px; min-height: 42px; padding: 10px 24px;
  border-radius: 12px; font-size: 13.5px; font-weight: 650;
}
#wbGo:not(:disabled) {
  box-shadow: 0 2px 10px rgba(255, 36, 66, .24);
}
#wbGo:disabled {
  box-shadow: none;
}
.example-presets { flex: none; width: min(100%, 540px); text-align: center; }
.example-presets > summary { padding: 8px; cursor: pointer; font-size: 12px; color: var(--mu); }
.example-presets[open] { padding: 18px 22px; border: 1px solid var(--line2); border-radius: 14px; background: var(--bg2); }
.example-presets[open] > summary { color: var(--tx); font-weight: 600; }
.example-caption, #wbExampleStatus { margin: 4px 0 16px; color: var(--mu); font-size: 11px; line-height: 1.7; }
.example-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.example-card { margin: 0; min-width: 0; }
.example-card img { display: block; width: 100%; height: min(155px, 20dvh); object-fit: contain; border-radius: 7px; background: var(--sf); }
.example-card figcaption { margin-top: 9px; color: var(--tx2); font-size: 11px; }
.example-presets .board-actions { margin-top: 18px; gap: 8px; }
.example-presets .board-use { min-height: 34px; padding: 7px 12px; border-radius: 7px; font-size: 11px; }
#wbPh0:has(#wbExamples[open]) .preview-placeholder { display: none; }
.studio-mobile-tabs { display: none; }
@media (max-height: 820px) and (min-width: 1024px) {
  #studioEditor #wbPrompt { height: 58px; }
  #studioPreview #wbPh0:has(#wbExamples[open]) { padding: 6px; gap: 6px; }
  .example-presets[open] { padding: 10px 12px; }
  .example-card img { height: 88px; }
  .example-presets .board-actions { margin-top: 8px; }
  .example-caption, #wbExampleStatus { margin-bottom: 8px; }
  .example-card figcaption { margin-top: 4px; }
}
@media (max-width: 1100px) and (min-width: 1024px) {
  body.studio #studio { padding-inline: 24px; }
  #studioEditor .gb-i { display: none; }
}
@media (max-width: 1023px) {
  body.studio { overflow-y: auto; }
  body.studio #studio { height: auto; min-height: calc(100dvh - var(--hdr)); padding: 0 20px 24px; }
  .studio-head { margin-bottom: 16px; }
  .studio-mobile-tabs { display: flex; flex: none; align-self: center; gap: 4px; padding: 3px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg2); }
  .studio-mobile-tabs button { min-width: 110px; min-height: 34px; padding: 7px 14px; border-radius: 7px; background: transparent; color: var(--mu); font-size: 12px; }
  .studio-mobile-tabs [aria-selected=true] { color: var(--tx); background: var(--sf); font-weight: 600; }
  .st-app { flex: none; }
  #studioEditor { margin-top: 0; }
  #studio:not([data-view=preview]) #studioPreview, #studio[data-view=preview] #studioEditor { display: none; }
  #studioPreview { min-height: 420px; }
  #studioPreview #wbStage { min-height: 360px; flex: none; }
  #studioPreview #wbPh0 { min-height: 360px; height: auto; overflow: visible; padding: 20px 0; }
  #studioPreview #wbAfter, #studioPreview #wbBefore { max-height: 70dvh; object-fit: contain; }
  .reference-panel, #studioEditor .adv-b { position: fixed; left: 20px; right: 20px; top: calc(var(--hdr) + 100px); bottom: auto; width: auto; max-height: calc(100dvh - var(--hdr) - 125px); }
  .studio-style .chips { bottom: auto; top: calc(100% + 12px); }
}

@media (max-width: 767px) {
  body.studio #studio { padding-inline: 12px; }
  .studio-head { min-height: 66px; flex-wrap: wrap; row-gap: 6px; margin-bottom: 14px; padding: 14px 0; }
  .studio-head h1 { font-size: 17px; }
  .studio-title > span { display: none; }
  .studio-head-act { gap: 3px; }
  .studio-head-act button { min-height: 30px; padding: 5px 6px; font-size: 10px; }
  #studioEditor { grid-template-columns: 1fr auto; grid-template-areas: 'head head' 'prompt prompt' 'quick quick' 'advanced go'; row-gap: 10px; margin-bottom: 70px; padding: 0 14px 14px; border-radius: 14px; }
  .studio-editor-head { flex-wrap: wrap; min-height: 46px; gap: 4px 8px; padding: 8px 0; }
  .composer-add { order: 3; flex-basis: 100%; border-top: 1px solid var(--line); padding-top: 5px; margin-top: 3px; }
  .composer-add button { flex: 1; min-height: 34px; font-size: 12px; }
  .studio-editor-head #wbCfg { max-width: 160px; }
  #studioEditor .prompt-panel { padding-top: 0; margin-bottom: 4px; }
  #studioEditor #wbPrompt { height: 132px; min-height: 100px; font-size: 16px; }
  #studioEditor .prompt-panel:focus-within { padding-left: 0; box-shadow: none; }
  #studioEditor .quick { flex-wrap: wrap; gap: 8px 14px; }
  #studioEditor .q2 > .row { gap: 10px; }
  #studioEditor .q2 .lab { font-size: 11px; }
  #studioEditor .gb-i { display: none; }
  #studioEditor .gobar { position: fixed; z-index: 6; left: 12px; right: 12px; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border: 1px solid var(--line2); border-radius: 12px 12px 0 0; background: var(--bg2); }
  #wbGo { width: 100%; min-width: 118px; min-height: 42px; }
  .reference-panel, #studioEditor .adv-b { left: 12px; right: 12px; padding: 16px; }
  #wbBoardCards { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  #wbBoardCards > .board-card img { max-height: 165px; }
  #wbBoardCards .board-card > span { font-size: 11px; gap: 3px; }
  #wbBoardCards .board-ang { display: none; }
  #studioPreview .canvas-head { flex-wrap: wrap; gap: 7px; }
  .example-presets[open] { padding: 12px; }
  .example-card img { height: 110px; }
}

@media (max-height: 720px) and (min-width: 1024px) {
  body.studio #studio { overflow-y: auto; }
  .st-app { flex: none; min-height: 560px; }
  #studioPreview { min-height: 280px; }
}
@media (max-width: 767px) and (max-height: 700px) {
  .studio-head { min-height: 56px; margin-bottom: 10px; padding-block: 10px; }
  .studio-mobile-tabs { margin-bottom: 12px; }
  #studioEditor { row-gap: 6px; }
  #studioEditor #wbPrompt { height: 72px; min-height: 58px; }
}
@media (max-width: 767px) {
  #workspaceDock { left: 10px; right: 10px; bottom: calc(12px + env(safe-area-inset-bottom)); width: auto; transform: none; padding: 6px; gap: 6px; }
  #trayFab { min-height: 40px; padding: 4px 5px; gap: 6px; font-size: 11px; }
  .tools #trayFab { width: 28px; }
  #trayFab .dock-mark { width: 24px; height: 24px; }
  #trayFilm { max-width: 70px; }
  #trayFilm img { width: 21px; height: 28px; }
  #composeFab { min-width: 82px; min-height: 40px; padding: 8px 12px; font-size: 12px; }
  #workspaceDock #tray { max-height: min(75dvh, 600px); }
  #tray .dock-foot { padding: 10px 12px; }
  #tray .tray-b { padding: 12px; gap: 10px; }
  #tray .tray-items img { width: 58px; height: 76px; }
  #tray .tg-add :is(button, summary) { min-height: 36px; }
  #tray .tg-add svg { display: block; }
  #tray .dock-combo { margin-top: 8px; }
  .basket-next { padding: 10px 12px; gap: 10px; }
  .basket-next p { font-size: 11px; }
  #tgStudio { min-width: 92px; min-height: 40px; padding-inline: 12px; }
  body:has(#composeFab:not([hidden])) #toast, body:has(#tray:not([hidden])) #toast { top: calc(var(--hdr) + 10px); bottom: auto; }
}
