/* Safe areas are zero on ordinary screens. Preserve zoom and adapt to viewport size. */
:root{--app-safe-top:env(safe-area-inset-top,0px);--app-safe-right:env(safe-area-inset-right,0px);--app-safe-bottom:env(safe-area-inset-bottom,0px);--app-safe-left:env(safe-area-inset-left,0px)}
@media(max-width:1024px) and (any-pointer:coarse){
 html{-webkit-text-size-adjust:100%;text-size-adjust:100%;scroll-padding-top:max(16px,var(--app-safe-top));scroll-padding-bottom:max(24px,var(--app-safe-bottom))}
 :root body .shell>.main{padding-left:max(12px,var(--app-safe-left))!important;padding-right:max(12px,var(--app-safe-right))!important}
 :root body :is(.topbar,.workspace-ui-topbar){padding-top:max(0px,var(--app-safe-top));padding-left:max(0px,var(--app-safe-left));padding-right:max(0px,var(--app-safe-right))}
 :root body :is(.workspace-ui-rail,.workspace-sidebar,.sidebar){padding-top:max(20px,var(--app-safe-top))!important;padding-bottom:max(14px,var(--app-safe-bottom))!important}
 :root body .mobile-studio-tabs{padding-left:max(12px,var(--app-safe-left));padding-right:max(12px,var(--app-safe-right));padding-bottom:max(8px,var(--app-safe-bottom))}
 :root body :is(dialog,.photo-edit-dialog){max-width:calc(100vw - max(16px,var(--app-safe-left)) - max(16px,var(--app-safe-right)))}
 html.apple-mobile body :is(input:not([type=range]):not([type=color]):not([type=checkbox]):not([type=radio]),textarea,select){font-size:16px!important}
 html.apple-mobile body :is(input,textarea,select){scroll-margin-block:24px}
 html.apple-mobile body :is(.primary,.tool-library-close,.tool-library-trigger,.vector-dialog [data-close],.mobile-studio-tabs button){min-height:44px!important}
 html.apple-keyboard-open .mobile-studio-tabs{display:none!important}
 html.apple-keyboard-open body.agent-workspace[data-agent-state=project][data-workspace-section=chat] .creator-workbench:has(#chat-form.compact-project-composer){height:calc(var(--app-visible-height) - 94px - var(--app-safe-top))!important}
 html.apple-keyboard-open dialog[open]{position:fixed;top:calc(var(--app-visible-top) + 12px);bottom:auto;margin:0 auto;max-height:calc(var(--app-visible-height) - 24px);overflow-y:auto}
 html.apple-mobile body.mobile-film-ui>.topbar{padding-left:max(8px,var(--app-safe-left));padding-right:max(8px,var(--app-safe-right))}
 html.apple-mobile body.mobile-film-ui .film-tool-nav{padding-left:max(3px,var(--app-safe-left));padding-right:max(3px,var(--app-safe-right))}
}
/* Small landscape and folded windows keep dialogs usable without locking orientation. */
@media(max-height:500px) and (any-pointer:coarse){:root body dialog[open]{max-height:calc(100dvh - max(16px,var(--app-safe-top)) - max(16px,var(--app-safe-bottom)));overflow-y:auto}}
