/* Shared Safari/iOS treatment; safe-area content remains clear of screen hardware. */
:root{--codex-viewport-height:100vh;--codex-safe-top:env(safe-area-inset-top,0px);--codex-safe-right:env(safe-area-inset-right,0px);--codex-safe-bottom:env(safe-area-inset-bottom,0px);--codex-safe-left:env(safe-area-inset-left,0px)}
@supports(height:100dvh){:root{--codex-viewport-height:100dvh}}
:is(.dgrid,.md,.info,.side,.fc-study-scroll,.sheet){-webkit-overflow-scrolling:touch}
.codex-touch-surface{clip-path:inset(0 var(--codex-edge-right,0px) 0 var(--codex-edge-left,0px));-webkit-clip-path:inset(0 var(--codex-edge-right,0px) 0 var(--codex-edge-left,0px))}
.codex-touch-media{-webkit-touch-callout:none}
.codex-touch-zoomed .codex-touch-media{will-change:transform}
@media(max-width:800px),(pointer:coarse){
 :is(input:not([type='checkbox']):not([type='radio']),select,textarea){font-size:16px!important}
 header.codex-safe-header{padding-top:calc(var(--codex-header-padding,0px) + var(--codex-safe-top))!important;min-height:calc(var(--codex-header-height,0px) + var(--codex-safe-top))}
 :is(.barin,.topbar,.codex-tool-header){padding-left:max(16px,var(--codex-safe-left));padding-right:max(16px,var(--codex-safe-right))}
 :is(main.plate-shell,main.index-shell,main.shell){padding-left:max(16px,var(--codex-safe-left));padding-right:max(16px,var(--codex-safe-right))}
 :is(footer,.foot,.codex-resources){padding-bottom:max(24px,var(--codex-safe-bottom))}
}
@media(max-width:800px),(pointer:coarse) and (orientation:portrait),(pointer:coarse) and (max-height:600px){
 body[data-codex-family='library'] dialog.detail{position:fixed;inset:0;width:100%;max-width:100%;height:var(--codex-viewport-height);max-height:var(--codex-viewport-height);margin:0}
 body[data-codex-family='library'] .dgrid{display:block;height:100%;max-height:100%;overflow-y:auto}
 body[data-codex-family='library'] .viewer{height:auto}
 body[data-codex-family='library'] .viewer-tools{padding-top:calc(10px + var(--codex-safe-top));padding-left:calc(16px + var(--codex-safe-left));padding-right:calc(68px + var(--codex-safe-right))}
 body[data-codex-family='library'] .stage{padding-left:calc(16px + var(--codex-safe-left));padding-right:calc(16px + var(--codex-safe-right))}
 body[data-codex-family='library'] .info{height:auto;overflow:visible;padding-left:calc(18px + var(--codex-safe-left));padding-right:calc(18px + var(--codex-safe-right));padding-bottom:calc(24px + var(--codex-safe-bottom))}
 body[data-codex-family='library'] .info .top{position:static}
 body[data-codex-family='library'] .info .x,body[data-codex-family='step1'] .md>.x{top:calc(12px + var(--codex-safe-top));right:calc(14px + var(--codex-safe-right));min-width:44px;min-height:44px}
 body[data-codex-family='step1'] .mb{height:var(--codex-viewport-height);max-height:var(--codex-viewport-height);bottom:auto}
 body[data-codex-family='step1'] .md,body[data-codex-family='step1'] .md.dg,body[data-codex-family='step1'] .md.dg.focus{display:flex;flex-direction:column;overflow-y:auto;width:100%;max-width:100%;height:var(--codex-viewport-height);max-height:var(--codex-viewport-height)}
 body[data-codex-family='step1'] .md::before{flex-basis:calc(60px + var(--codex-safe-top))}
 body[data-codex-family='step1'] .view{padding-left:var(--codex-safe-left);padding-right:var(--codex-safe-right)}
 body[data-codex-family='step1'] .sbar{padding-left:calc(10px + var(--codex-safe-left));padding-right:calc(10px + var(--codex-safe-right))}
 body[data-codex-family='step1'] .side{height:auto;overflow:visible;padding-left:calc(20px + var(--codex-safe-left));padding-right:calc(20px + var(--codex-safe-right));padding-bottom:calc(24px + var(--codex-safe-bottom))}
 body[data-codex-family='step1'] .md .sheet{left:calc(10px + var(--codex-safe-left));right:calc(10px + var(--codex-safe-right))}
 .fc-study-modal{height:var(--codex-viewport-height);bottom:auto;padding:0}
 .fc-study-shell{height:var(--codex-viewport-height);max-height:var(--codex-viewport-height);border-radius:0}
 .fc-study-top{padding-top:calc(13px + var(--codex-safe-top));padding-left:calc(16px + var(--codex-safe-left));padding-right:calc(16px + var(--codex-safe-right))}
 .fc-study-scroll{padding-left:calc(14px + var(--codex-safe-left));padding-right:calc(14px + var(--codex-safe-right));padding-bottom:calc(24px + var(--codex-safe-bottom))}
}
@media print{.codex-touch-surface{-webkit-clip-path:none;clip-path:none}.codex-touch-media{will-change:auto}}
