/* Only the comic canvas scrolls; tools occupy their own space instead of covering the page. */
body.studio-active.studio-layout-active{height:100dvh;overflow:hidden!important}
body.studio-layout-active .rac-studio{position:fixed;inset:0;height:100dvh;min-height:0!important;display:flex;flex-direction:column;overflow:hidden!important}
body.studio-layout-active .studio-head,body.studio-layout-active .studio-pagebar{position:relative;flex:0 0 auto;z-index:55}
body.studio-layout-active .studio-guide{display:none!important}
body.studio-layout-active .studio-workspace{display:grid!important;grid-template-columns:minmax(0,1fr)!important;grid-template-rows:minmax(0,1fr) auto;flex:1 1 auto;height:auto!important;min-height:0!important;overflow:hidden!important}
body.studio-layout-active .studio-stage,body.studio-tools-open.studio-layout-active .studio-stage{height:100%!important;min-height:0!important;padding:0!important;box-sizing:border-box!important;display:block!important;overflow:hidden!important;scroll-padding-bottom:0!important;touch-action:pan-y!important}
body.studio-layout-active .studio-paper-wrap.editing{display:flex!important;align-items:stretch;width:100%!important;max-width:none!important;height:100%!important;min-height:0!important;margin:0!important;overflow:hidden!important}
body.studio-layout-active .studio-paper-wrap #canvasViewport,body.studio-tools-open.studio-layout-active .studio-paper-wrap #canvasViewport{flex:1 1 auto;width:100%!important;min-height:0!important;height:100%!important;max-height:100%!important;padding:0!important;box-sizing:border-box!important;border:0!important;border-radius:0!important;overflow:auto!important;overscroll-behavior:contain!important;scrollbar-gutter:auto;-webkit-overflow-scrolling:touch}
body.studio-layout-active .studio-paper-wrap #layoutCanvas{flex:none;max-height:none!important;aspect-ratio:auto!important;height:auto!important;touch-action:none!important}
body.studio-layout-active .studio-dock,body.studio-tools-open.studio-layout-active .studio-dock{position:relative!important;inset:auto!important;width:100%!important;min-height:0!important;height:auto!important;max-height:45dvh!important;overflow:hidden!important;grid-row:2;box-sizing:border-box}
body.studio-layout-active .studio-dock.calm-collapsed{max-height:140px!important}
body.studio-layout-active .studio-dock-content{min-height:0!important;overflow:auto!important;flex:1 1 auto;overscroll-behavior:contain}
@media(min-width:1100px) and (orientation:landscape){body.studio-layout-active .studio-workspace{grid-template-columns:minmax(0,1fr) 360px!important;grid-template-rows:minmax(0,1fr)}body.studio-layout-active .studio-dock{grid-column:2;grid-row:1;max-height:100%!important;border-radius:0!important}body.studio-layout-active .studio-dock.calm-collapsed{max-height:100%!important}}

body.studio-layout-active .studio-page-actions,body.studio-tools-open.studio-layout-active .studio-page-actions{display:flex!important;flex:0 0 auto}
body.studio-layout-active .studio-page-actions[hidden]{display:none!important}

#studioTextOverflowSummary{display:block;flex:0 0 auto;padding:5px 10px;background:#44240f;color:#ffd19d;font-weight:800;font-size:.85rem}#studioOverflowWarning{padding:10px;border:2px solid #ff8a2b;border-radius:8px;color:#ffe0bd;background:#44240f}

/* The open tool panel owns its area on phones, tablets and desktop. */
body.studio-layout-active .calm-tools-toggle{display:block!important;order:-3!important;position:relative!important;top:auto!important;flex:0 0 auto;min-height:44px;border:0;border-bottom:1px solid #555866;background:#202127;color:#f5d77a;padding:9px;font-weight:800}
body.studio-layout-active .studio-dock:not(.calm-collapsed) .studio-page-actions{display:flex!important}
body.studio-layout-active .studio-dock:not(.calm-collapsed) #studioDockContent>.studio-note:not([role]),
body.studio-layout-active .studio-dock:not(.calm-collapsed) .studio-editor-tools>.studio-note{display:none!important}
body.studio-layout-active .studio-dock.calm-collapsed{height:auto!important;max-height:140px!important;align-self:end}
body.studio-layout-active .studio-dock.calm-collapsed .studio-handle,
body.studio-layout-active .studio-dock.calm-collapsed .studio-dock-title,
body.studio-layout-active .studio-dock.calm-collapsed .studio-tabs,
body.studio-layout-active .studio-dock.calm-collapsed .studio-dock-content{display:none!important}
body.studio-layout-active .studio-dock.calm-collapsed .studio-page-actions:not([hidden]){display:flex!important;order:1}
body.studio-layout-active .studio-dock:not(.calm-collapsed) .studio-dock-content{display:flex!important;flex-direction:column;overflow-y:auto!important;min-height:0!important}
body.studio-layout-active .studio-dock-content>.pro-groups{flex:0 0 auto;width:100%;grid-column:1/-1}
@media(max-width:1099px){body.studio-layout-active .studio-dock:not(.calm-collapsed){max-height:60dvh!important}}

/* One full-width row per element; global button flex rules must never squeeze text. */
body.studio-layout-active .studio-element-list{width:100%;min-width:0}
body.studio-layout-active .studio-element-list>div{display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:6px;max-height:220px;overflow-y:auto;overflow-x:hidden}
body.studio-layout-active .studio-element-list button{display:grid!important;grid-template-columns:28px 110px minmax(0,1fr);width:100%!important;max-width:none!important;min-width:0!important;min-height:44px;height:auto!important;flex:none!important;gap:8px;padding:9px 10px;white-space:nowrap!important;text-align:left;align-items:center}
body.studio-layout-active .studio-element-list .studio-element-kind{font-size:.85rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
body.studio-layout-active .studio-element-list button .studio-element-snippet{display:block;min-width:0;height:auto;border-radius:0;background:transparent;color:inherit;font-size:.95rem;white-space:nowrap!important;overflow:hidden;text-overflow:ellipsis}
.studio-sfx-picker{width:min(640px,calc(100vw - 24px));max-height:85dvh;overflow:auto;padding:18px;border:1px solid #70604a;border-radius:14px;background:#202127;color:#fff}.studio-sfx-picker::backdrop{background:#080b12b8}.studio-sfx-picker header{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:10px}.studio-sfx-picker h2{font-size:1.15rem;margin:0}.studio-sfx-picker header button{min-height:44px}.studio-sfx-picker .studio-sfx-presets{gap:10px}.studio-sfx-picker .studio-sfx-presets button{min-height:76px;min-width:0;max-width:100%;flex:none}.studio-sfx-picker .studio-sfx-presets button small{font-size:.9rem}.studio-sfx-picker .studio-sfx-presets button span{font-size:1.3rem}
@media(max-width:440px){body.studio-layout-active .studio-element-list button{grid-template-columns:26px 90px minmax(0,1fr);gap:6px}.studio-sfx-picker{padding:12px}}
