/* Test-only mobile presentation. No scene geometry, story or save changes. */
@media(max-width:900px){
 :root{--mobile-dock-height:110px;--mobile-camera-height:50px;--mobile-top-edge:140px;--mobile-message-bottom:180px}
 #mobile-heading{box-sizing:border-box;padding:12px 16px 10px;min-height:66px}
 #mobile-room-title{font-size:21px;line-height:1.25;overflow-wrap:anywhere;max-width:calc(100vw - 92px)}
 #controls:not([hidden]),#controls:not([hidden]).clinical-controls{box-sizing:border-box;max-width:calc(100vw - 16px);gap:6px}
 #controls:not([hidden]) #back{white-space:normal;overflow-wrap:anywhere;min-width:0}
 #controls:not([hidden]) .control-right{min-width:0;flex-wrap:wrap;gap:5px}
 #controls:not([hidden]) #host-reset{grid-column:auto;grid-row:1;min-width:0;white-space:normal}
 #mobile-camera{bottom:calc(var(--mobile-dock-height) + 18px + env(safe-area-inset-bottom,0px))!important;box-sizing:border-box;max-width:calc(100vw - 32px);margin:0;padding:4px 8px;border-radius:24px;background:#16130ff0;gap:12px}
 .daylight-public #mobile-camera{background:#f5ead8f5}
 #world[data-scene]{padding-top:var(--mobile-top-edge);padding-bottom:calc(var(--mobile-dock-height) + var(--mobile-camera-height) + 30px)}
 :is(#greeting,#chapter-ribbon,#seating-room-navigation,#daylight-room-navigation,#chapter-street-exchange,#staff-view-context,#basement-canvas-notice,#simple-leaving-caption,#window-caption,#host-reset-status,#kindness-scene-note,#bathroom-choices,.owner-quiet-thought){position:fixed!important;box-sizing:border-box;left:12px!important;right:12px!important;top:auto!important;bottom:calc(var(--mobile-message-bottom) + var(--mobile-stack-offset,0px))!important;transform:none!important;width:auto!important;max-width:none!important;margin:0!important;max-height:var(--mobile-message-limit,35dvh);overflow:auto;overscroll-behavior:contain;overflow-wrap:anywhere;white-space:normal}
 #chapter-ribbon{gap:6px;flex-wrap:wrap}
 #chapter-ribbon:empty{display:none}
 :is(#seating-room-navigation,#daylight-room-navigation) button{width:100%;white-space:normal;min-height:44px}
 #staff-view-context,#window-caption,#basement-canvas-notice{padding:10px 14px;font-size:14px;line-height:1.5}
 #greeting{padding:16px}
 #greeting .seating-choices{grid-template-columns:1fr}
 :is(#greeting,#chapter-ribbon,#chapter-street-exchange) button{white-space:normal;overflow-wrap:anywhere;min-width:0;min-height:44px;height:auto}
 #lab-guide,#experiment-notice{box-sizing:border-box;top:calc(var(--mobile-top-edge) + 8px);margin-top:0!important;max-height:25dvh;overflow:auto;overscroll-behavior:contain}
 /* A single predictable bottom sheet replaces conflicting per-scene widths. */
 #clue[open],#clue[open][class]{box-sizing:border-box;inset:auto 0 0!important;transform:none!important;width:100%!important;max-width:100%!important;margin:0!important;padding:10px 18px calc(22px + env(safe-area-inset-bottom,0px))!important;max-height:calc(100dvh - 12px - env(safe-area-inset-top,0px))!important;overflow:auto;overflow-x:hidden;overscroll-behavior:contain;border-radius:16px 16px 0 0}
 #clue *,#friends-test-dialog *,#owner-dialogue *,#daytime-host-dialog *,#street-kids-dialog *,#street-delivery-dialog *,#street-greeter-dialog *{box-sizing:border-box;min-width:0}
 #clue #close{position:sticky;top:0;margin:0 0 10px auto;flex-shrink:0;min-width:44px;min-height:44px}
 #clue-content{width:100%;max-width:100%}
 #clue :is(h2,h3,p,figcaption,dd,summary,label,li),#friends-test-dialog :is(h2,p,label){overflow-wrap:anywhere;word-break:normal}
 #clue h2{font-size:clamp(23px,6vw,29px);line-height:1.25}
 #clue :is(button,input,select,textarea,audio,video,canvas){max-width:100%}
 #clue :is(button,summary){white-space:normal;overflow-wrap:anywhere;min-height:44px;height:auto;line-height:1.45}
 #clue :is(input,select,textarea){font-size:16px}
 #clue :is(.choices,.chapter-choices,.subject-actions,.bs-actions,.resistance-actions,.lane-actions,.archive-pagination){gap:8px;flex-wrap:wrap}
 #clue .archive-content{display:block}
 #clue .archive-prose{font-size:16px;line-height:1.75}
 #clue .archive-figure{width:100%;margin:0 0 18px}
 #clue .archive-pagination{position:static;display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);align-items:center}
 #clue .archive-pagination>span{grid-row:1;grid-column:1/-1;text-align:center}
 #clue .report-meta{gap:12px;flex-wrap:wrap}
 #clue .inspection-view{max-width:100%;max-height:32dvh}
 #clue .sci-conversation-line{overflow-wrap:anywhere}
 #friends-test-dialog{box-sizing:border-box;width:calc(100vw - 20px);max-height:calc(100dvh - 20px);padding:32px 18px 20px}
 #friends-test-dialog .friends-test-row{flex-wrap:wrap}
 /* Long conversations scroll inside their panel, keeping the scene visible. */
 #daytime-host-dialog[open]{align-items:flex-end}
 #daytime-host-dialog .host-panel{max-height:68dvh!important;overflow:auto;overscroll-behavior:contain;margin:0 10px max(10px,env(safe-area-inset-bottom,0px));width:calc(100% - 20px);padding:18px}
 :is(#street-kids-dialog,#street-delivery-dialog,#street-greeter-dialog)[open]{grid-template-rows:minmax(0,1fr) auto;overflow:hidden}
 :is(.kids-panel,.delivery-panel,.greeter-panel){width:calc(100% - 20px)!important;margin:0 10px max(10px,env(safe-area-inset-bottom,0px))!important;padding:18px!important;max-height:68dvh;overflow:auto;overscroll-behavior:contain}
 :is(.kids-actions,.delivery-actions,.greeter-actions){flex-direction:column;gap:8px}
 :is(.kids-actions,.delivery-actions,.greeter-actions) button{flex:none!important;width:100%;white-space:normal;overflow-wrap:anywhere}
 :is(.host-panel,.kids-panel,.delivery-panel,.greeter-panel,.owner-panel) :is(p,h2,button){overflow-wrap:anywhere}
 .owner-stage{height:32dvh;min-height:120px}
 .owner-panel{width:calc(100% - 20px);margin:0 10px;padding:18px 18px max(12px,env(safe-area-inset-bottom,0px))}
 #owner-line{font-size:20px;line-height:1.5}
 .owner-panel footer,.owner-panel footer>div{flex-wrap:wrap;gap:8px 16px}
 .owner-panel footer button{min-height:44px;white-space:normal}
}
@media(max-width:600px){
 #controls:not([hidden]):has(> #test-time-switch){grid-template-columns:minmax(0,1fr) minmax(0,.8fr) minmax(0,.8fr)}
 #controls:not([hidden]):has(> #test-time-switch) #host-reset{grid-column:3;grid-row:1;font-size:12px!important;padding:6px!important}
 #controls:not([hidden]) .control-right{width:100%;justify-content:flex-end}
 #controls:not([hidden]) .control-right #sound{min-width:84px;width:84px;max-width:84px;flex-basis:84px}
 #controls:not([hidden]):has(> #test-time-switch) .control-right{grid-row:2;grid-column:1/-1}
 #controls:not([hidden]) .control-right>button{min-height:44px}
 #greeting .greeting-line{font-size:17px}
}
@media(max-width:900px) and (max-height:500px){
 #mobile-heading{padding:5px 12px;min-height:42px}.mobile-brand{display:none}#mobile-room-title{font-size:17px;margin:2px 0}
 #controls:not([hidden]):has(> #test-time-switch){display:flex;flex-wrap:wrap;min-height:0}
 #controls:not([hidden]) #back{flex:1;max-width:24%}
 #controls:not([hidden]) .control-right{width:auto;flex:1;justify-content:flex-end}
 #controls:not([hidden]) #host-reset,#controls:not([hidden]) #test-time-switch{font-size:11px!important;min-height:44px}
 #controls:not([hidden]) #notebook-toggle::after{content:none}
 #controls:not([hidden]) #member-card-toggle,#controls:not([hidden]) #translation-glasses-toggle{font-size:11px!important;padding:6px!important;min-width:44px}
 #mobile-camera{left:12px;transform:none;width:260px;gap:8px}
 #lab-guide,#experiment-notice{max-width:48vw;left:auto;right:12px;font-size:11px;max-height:25dvh}
 #clue .inspection-view{max-height:28dvh}
 .owner-stage{height:28dvh;min-height:80px}
 :is(.kids-panel,.delivery-panel,.greeter-panel),#daytime-host-dialog .host-panel{max-height:75dvh!important}
}

@media(max-width:900px){#entrance-clock .clock-caption{white-space:normal;overflow-wrap:anywhere;line-height:1.35}#clue .subject-actions{display:grid;grid-template-columns:1fr}#clue .report-meta>div{min-width:0}#clue .report-meta dd{margin-left:0}}

@media(max-width:900px){
 #kindness-scene-note{flex-wrap:wrap;gap:8px;font-size:14px}#kindness-scene-note button{min-width:0;white-space:normal;overflow-wrap:anywhere}
 #bathroom-choices{flex-wrap:wrap}#bathroom-choices button{min-width:0;white-space:normal;overflow-wrap:anywhere}
 #kindness-dialog,#kindness-dialog *{box-sizing:border-box;min-width:0}#kindness-dialog{max-width:calc(100vw - 16px);max-height:calc(100dvh - 16px)}
 #kindness-dialog :is(button,p,h2){white-space:normal;overflow-wrap:anywhere}#kindness-dialog .kindness-panel{padding:18px}#kindness-dialog #kindness-line{font-size:19px;line-height:1.55}
 #notebook-update{box-sizing:border-box;max-width:calc(100vw - 24px);white-space:normal;overflow-wrap:anywhere}
 .bb-copy,.bt-scene,.bt-scene *{box-sizing:border-box;min-width:0}.bb-copy{overflow:auto;overscroll-behavior:contain}.bb-copy :is(h1,p,button){overflow-wrap:anywhere;white-space:normal}
 .bt-header{flex-wrap:wrap;gap:8px}.bt-header-tools{min-width:0;flex-wrap:wrap}.bt-replies{flex-wrap:wrap}.bt-replies button{white-space:normal}
}
@media(max-width:900px){
 #notebook-update{bottom:calc(var(--mobile-message-bottom) + 8px);font-size:11px;padding:9px 12px}
 dialog #notebook-update{top:auto;bottom:calc(12px + env(safe-area-inset-bottom,0px))}
}
/* Public controls use one row without the test-only mode/reset row. */
@media(max-width:600px){
 body:not(:has(#friends-test-toolbar)) #controls:not([hidden]) .control-right{width:auto;flex:1 1 0;min-width:0}
}
