/* Persistent scene frame + independently scrolling scenes + top-layer dialogs.
 * The frame follows document coordinates only for keyboard compensation.
 * Dialogs use offsetTop once. Keep the scrollport ancestors untransformed.
 */
#gen-viewport-probe{position:absolute;inset:0 auto auto 0;width:0;height:100%;height:100lvh;visibility:hidden;pointer-events:none}
:root[data-vovry-material] body[data-gen-conversations],
:root[data-vovry-material] body[data-gen-conversations].gen-keyboard-open{
 position:relative;inset:auto;top:auto;height:100%;min-height:0;overflow:hidden;
 overscroll-behavior:none;
}
/* Keep a non-fixed transcript ancestor for iOS compositing. With the keyboard
 * closed, clip the body without creating another scroll container for
 * WebKit's selection auto-scroll. */
:root[data-vovry-material] body[data-gen-conversations]:not(.gen-keyboard-open){overflow:clip}
:root:has(>body[data-gen-conversations]:not(.gen-keyboard-open)){overscroll-behavior:none}
#gen-app-shell{
 position:absolute;inset:var(--gen-app-page-top,var(--gen-viewport-page-top,0px)) 0 auto;
 display:flex;flex-direction:column;width:100%;height:var(--gen-app-height,var(--gen-viewport-height,100dvh));
 min-width:0;min-height:0;overflow:clip;transform:none;filter:none;contain:none;
}
[data-gen-conversations] #gen-app-shell :is(.gen-main,#gen-create-view,.gen-chat-panel){
 min-height:0;min-width:0;overflow:visible;isolation:auto;transform:none;filter:none;contain:none;
}
[data-gen-conversations] #gen-app-shell #gen-chat-thread{
 overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;touch-action:pan-y;
}
[data-gen-conversations] #gen-app-shell .gen-chat-form{
 /* Keep all controls reachable in short landscape/large text configurations. */
 max-height:calc(100% - var(--gen-top-clearance,76px) - 8px);
}
[data-gen-conversations] #gen-app-shell .gen-destination{
 min-height:0;overflow-x:hidden;overflow-y:auto;overscroll-behavior-y:contain;
}
/* One safe-area owner per control edge. The software keyboard replaces the
 * home-indicator inset; WebKit does not reliably update env() for that case. */
[data-gen-conversations]{--gen-safe-top:env(safe-area-inset-top,0px);--gen-safe-bottom:env(safe-area-inset-bottom,0px)}
[data-gen-conversations].gen-keyboard-open{--gen-safe-bottom:0px}
[data-gen-conversations] #gen-app-shell .gen-chat-form{margin-bottom:calc(10px + var(--gen-safe-bottom))}
[data-gen-conversations].gen-keyboard-open #gen-app-shell .gen-chat-form{margin-bottom:8px}
/* All full-screen tools share the same visible frame. Their native dialogs
 * remain outside the shell, avoiding transformed/scrolling containing blocks. */
[data-gen-conversations] .gen-sidebar{
 inset:var(--gen-app-top,var(--gen-viewport-top,0px)) auto auto 0;height:var(--gen-app-height,var(--gen-viewport-height,100dvh));
 max-height:var(--gen-app-height,var(--gen-viewport-height,100dvh));padding-bottom:calc(18px + var(--gen-safe-bottom));
}
[data-gen-conversations].gen-keyboard-open #gen-settings-dialog{
 bottom:max(0px,calc(100% - var(--gen-app-top,0px) - var(--gen-app-height,100dvh)));
 max-height:calc(var(--gen-app-height,100dvh) - 8px);padding-bottom:0;
}
/* Center login/account/browser dialogs inside the visible region, rather than
 * the obscured layout viewport. Their own contents remain scrollable. */
[data-gen-conversations] :is(.gen-login-dialog,.gen-user-settings-dialog,.gen-browser-dialog,.gen-baby-dialog){
 position:fixed;
 inset-block:calc(var(--gen-app-top,0px) + 12px) calc(100% - var(--gen-app-top,0px) - var(--gen-app-height,100dvh) + 12px);
 margin-block:auto;max-height:calc(var(--gen-app-height,100dvh) - 24px);overflow-y:auto;
}
@media(max-width:1000px){
 [data-gen-conversations] :is(.vn-workspace,.gen-study-dialog,.gen-discussion,.gen-model3d-library){
  position:fixed;inset:var(--gen-app-top,var(--gen-viewport-top,0px)) 0 auto;margin:0;
  width:100%;max-width:100%;height:var(--gen-app-height,var(--gen-viewport-height,100dvh));max-height:var(--gen-app-height,var(--gen-viewport-height,100dvh));
  border-radius:0;
 }
 [data-gen-conversations] :is(.gen-study-dialog,.gen-discussion,.gen-model3d-library){padding-bottom:max(8px,var(--gen-safe-bottom))}
 [data-gen-conversations] .vn-workspace :is(.vn-header,.vn-editor-head){padding-top:calc(8px + var(--gen-safe-top))}
 [data-gen-conversations] .vn-toolbar{padding-bottom:calc(8px + var(--gen-safe-bottom))}
}
@media(max-width:600px){
 [data-gen-conversations] .gen-user-settings-dialog{
  inset:var(--gen-app-top,0px) 0 auto;margin:0;width:100%;
  height:var(--gen-app-height,100dvh);max-height:var(--gen-app-height,100dvh);border-radius:0;overflow:hidden;
 }
}
@media(prefers-reduced-motion:reduce){
 #gen-app-shell{scroll-behavior:auto}
}
