.story-edge {display:none}
@media(max-width:650px){
 .story-edge {display:block;position:fixed;top:46%;z-index:6;height:52px;width:32px;padding:0;background:#211c20df;color:#ffcd87;border:1px solid #d79a57;font-size:24px}
 .story-edge.left {left:0;border-radius:0 24px 24px 0}
 .story-edge.right {right:0;border-radius:24px 0 0 24px}
 body.focus-mode .story-edge {display:none}
 #storyRoutes {position:fixed;inset:auto 0 max(12px,env(safe-area-inset-bottom));margin:0 auto;width:min(92vw,440px);max-width:92vw;padding:16px;color:#fff5e7;background:#211e22f7;border:1px solid #b68751;border-radius:22px;box-shadow:0 8px 36px #0008}
 #storyRoutes::backdrop {background:#0e101440}
 #storyRoutes form,#storyRoutes nav {display:flex;align-items:center;justify-content:space-between;gap:6px}
 #storyRoutes nav button {flex:1;min-height:44px}
}
@media(max-width:650px) and (orientation:portrait){
 body.workspace-studio .workspace.has-panel:has(#inspector[data-side]) {grid-template-rows:minmax(0,1fr) auto}
 #workspace #inspector[data-side]:not([hidden]) {position:fixed;inset:15% auto auto 0;width:min(72vw,320px);max-height:60dvh;background:#221e23f5;z-index:7;border-radius:0 18px 18px 0;overflow:auto}
 #workspace #inspector[data-side=right]:not([hidden]) {inset:15% 0 auto auto;border-radius:18px 0 0 18px}
}

@media(max-width:650px) and (orientation:portrait){
 body.workspace-studio #stage {position:fixed;inset:0;width:100%;height:100dvh;border:0;border-radius:0;z-index:0;scrollbar-width:none}
 body.workspace-studio #workspace {background:transparent}
 body.workspace-studio .studio-header,body.workspace-studio .timeline-dock,body.workspace-studio .studio-status,body.workspace-studio .tool-rail {position:relative;z-index:3;background:rgba(20,18,25,.66)!important}
 body.workspace-studio .canvas-toolbar,body.workspace-studio .canvas-bottom {position:relative;z-index:2;pointer-events:none}
 body.workspace-studio :is(.canvas-toolbar,.canvas-bottom)>* {pointer-events:auto}
 body.workspace-studio #workspace.has-panel {grid-template-rows:minmax(0,1fr) auto}
 body.workspace-studio #inspector:not([hidden]):not([data-side]) {position:absolute;z-index:7;bottom:64px;left:8px;right:8px;height:min(33dvh,300px);width:auto;max-height:100%;background:#211e24ed}
}

#bottomTrayToggle {display:none}
@media(max-width:650px) and (orientation:portrait){
 body.workspace-studio:not(.focus-mode) #bottomTrayToggle {display:block;position:absolute;bottom:100%;right:6px;min-height:36px;border-radius:14px 14px 0 0;background:#201d24df;color:#ffe4b9;z-index:6}
 body.workspace-studio.tray-down:not(.focus-mode) :is(#storyTools,#timelineDock,.studio-status,.canvas-bottom) {display:none!important}
 body.workspace-studio.tray-down:not(.focus-mode) .tool-rail {position:fixed;bottom:env(safe-area-inset-bottom,0px);left:0;right:0;height:0;padding:0;border:0;overflow:visible}
 body.workspace-studio.tray-down:not(.focus-mode) #workspace {grid-template-rows:minmax(0,1fr)}
}

@media(max-width:650px) and (orientation:portrait){
 body.workspace-studio #workspace.has-panel #inspector:not([hidden]):not([data-side]) {position:fixed;inset:auto 8px 24dvh;height:min(33dvh,300px);z-index:8}
}
