/* Reserve hardware insets once, around the game rather than over the board. */
:root{--game-safe-left:env(safe-area-inset-left,0px);--game-safe-right:env(safe-area-inset-right,0px);--game-safe-top:env(safe-area-inset-top,0px);--game-safe-bottom:env(safe-area-inset-bottom,0px);--game-safe-vw:100vw;--game-safe-vh:100dvh;}
html body[data-game-safe-area]:not([data-game="pyramid"]):not([data-game="tripeaks"]){--game-safe-max-width:960px;--game-safe-width:calc(var(--game-safe-vw) - var(--game-safe-left) - var(--game-safe-right));box-sizing:border-box!important;position:relative;inset:auto!important;width:min(var(--game-safe-width),var(--game-safe-max-width))!important;max-width:none!important;margin-left:calc(var(--game-safe-left) + max(0px,(var(--game-safe-width) - var(--game-safe-max-width))/2))!important;margin-right:0!important;padding-inline:0!important;}
html body[data-game-safe-area="find-ball"]{--game-safe-max-width:100vw!important;}
html body[data-game-safe-area][data-game-frame]{--safe-bottom:0px!important;--game-frame-height:calc(min(var(--game-frame-visible-height,100dvh),var(--game-safe-vh)) - var(--game-safe-bottom))!important;height:var(--game-frame-height)!important;min-height:var(--game-frame-height)!important;}
html body[data-game-safe-area][data-game-navigation="unified"]>#game-navigation{padding-left:10px!important;padding-right:10px!important;z-index:40;touch-action:manipulation;}
html body[data-game-safe-area][data-game-frame][data-game][data-game-navigation="unified"]>main.shell{padding-left:8px!important;padding-right:8px!important;}
html body[data-game-safe-area="link-match"]>main{padding-top:4px!important;padding-bottom:4px!important;}
html body[data-game-safe-area="find-ball"]{--game-height:calc(var(--game-safe-vh) - var(--game-safe-top) - var(--game-safe-bottom))!important;height:var(--game-safe-vh)!important;min-height:var(--game-safe-vh)!important;padding-top:var(--game-safe-top)!important;}
html body[data-game-safe-area="find-ball"]>main{box-sizing:border-box;height:var(--game-height)!important;min-height:0!important;padding:8px 12px!important;}
/* The original card-table layouts already own their safe-area padding. */
html body[data-game-safe-area="pyramid"],html body[data-game-safe-area="tripeaks"]{--pyramid-safe-top:var(--game-safe-top);--pyramid-safe-right:var(--game-safe-right);--pyramid-safe-bottom:var(--game-safe-bottom);--pyramid-safe-left:var(--game-safe-left);}
/* Keep the pixel game's full-window camera below interactive chrome. */
html body[data-game-safe-area="pixel-clear"]>main{position:relative!important;isolation:isolate;z-index:0;}
html body[data-game-safe-area="pixel-clear"][data-screen="battle"] #board{clip-path:inset(var(--game-navigation-height,52px) var(--game-safe-right) var(--game-safe-bottom) var(--game-safe-left));}
html body[data-game-safe-area="pixel-clear"][data-screen="home"] #board{display:none!important;pointer-events:none!important;}
html body[data-game-safe-area="pixel-clear"][data-screen="battle"] #pause-cover{position:absolute!important;inset:0!important;width:100%!important;height:100%!important;max-width:100%;max-height:100%;}
html body[data-game-safe-area="pixel-clear"] #pause-cover[hidden]{display:none!important;}
html body[data-game-safe-area="bridge-keeper"] #game:has(>#overlay.pause-screen:not([hidden])) #hud>#pause,
html body[data-game-safe-area="bridge-keeper"] #game:has(>#overlay.pause-screen:not([hidden]))>footer{visibility:hidden;}
@media(orientation:landscape) and (max-height:600px){
 html body[data-game-safe-area="link-match"][data-board-layout="landscape"] .controls{grid-template-rows:44px!important;gap:4px 8px;}
 html body[data-game-safe-area="link-match"][data-board-layout="landscape"] #message,html body[data-game-safe-area="link-match"][data-board-layout="landscape"] .above{display:none!important;}
 html body[data-game-safe-area="link-match"][data-board-layout="landscape"] .extras{grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:44px;gap:4px;padding-top:2px;}
 html body[data-game-safe-area="link-match"][data-board-layout="landscape"] .extras>button{flex-direction:column;justify-content:center;gap:2px;white-space:normal;font-size:9px;line-height:1.15;}
 html body[data-game-safe-area="find-ball"]>main{padding-top:5px!important;padding-bottom:5px!important;}
 html body[data-game-safe-area="find-ball"] #home:not([hidden]){grid-template-rows:28px minmax(0,1fr) 56px 44px 44px!important;}
 html body[data-game-safe-area="find-ball"] #home>.footer{height:44px!important;min-height:44px!important;}
 html body[data-game-safe-area="find-ball"] #home>.footer button{height:44px;min-height:44px;}
 html body[data-game-safe-area="find-ball"] #game>.game-bottom{right:max(15px,var(--game-safe-right))!important;}
}
@media(max-width:600px){
 html body[data-game-safe-area="pvz"] #home .chapters{gap:4px!important;}
 html body[data-game-safe-area="pvz"] #home .chapters>button{flex:1 1 0;min-width:0!important;max-width:100%;padding-inline:3px;font-size:11px;}
}
