:root{--game-safe-top:env(safe-area-inset-top,0px);--game-safe-right:env(safe-area-inset-right,0px);--game-safe-bottom:env(safe-area-inset-bottom,0px);--game-safe-left:env(safe-area-inset-left,0px)}
body{min-height:calc(100vh / var(--page-zoom,1));background-size:calc(1280px / var(--page-zoom,1)) auto}
#game-shell{margin-top:30px}
#page-zoom-controls{position:absolute;right:0;bottom:calc(100% + 8px);display:flex;gap:4px}
#page-zoom-controls[hidden]{display:none}
#game-shell #page-zoom-controls button{display:grid;place-items:center;width:40px;min-width:40px;padding:0;font:400 14px/20px Arial,sans-serif;outline:none}
:is(html,body,#game-shell,#arena-stage,#screen,#screen canvas):focus{outline:none}
#game-shell:is(:fullscreen,.expanded-tab) #page-zoom-controls{display:none}
#game-shell.expanded-tab,#game-shell:fullscreen{width:calc(100vw / var(--page-zoom,1));height:calc(100vh / var(--page-zoom,1));margin:0}
/* One 800x520 layout for the arena, HUD, lobby and dialogs */
html.game-fit,html.game-fit body{min-width:0;width:100%;height:100%;min-height:0;overflow:hidden;overscroll-behavior:none}
.game-fit #game-shell,.game-fit #game-shell.expanded-tab,.game-fit #game-shell:fullscreen{position:fixed;inset:auto;left:var(--game-left);top:var(--game-top);width:var(--game-width);height:var(--game-height);margin:0;padding:0;box-shadow:none;display:block}
.game-fit #arena-stage{position:absolute;inset:0 auto auto 0;width:800px;height:520px;transform:scale(var(--game-scale));transform-origin:0 0}
/* Fullscreen keeps its host at the viewport origin, so center the inner arena */
.game-fit #game-shell:is(:fullscreen,.expanded-tab){left:var(--game-viewport-left);top:var(--game-viewport-top);width:var(--game-viewport-width);height:var(--game-viewport-height);background:#000}
.game-fit #game-shell:is(:fullscreen,.expanded-tab) #arena-stage{left:calc(var(--game-left) - var(--game-viewport-left));top:calc(var(--game-top) - var(--game-viewport-top));width:800px;height:520px}
#game-shell::backdrop{background:#000}
.game-fit #screen{position:absolute;inset:0;width:100%;height:100%;transform:none}
.game-fit #arena-stage #crosshair-overlay{inset:0;left:0;top:0;width:100%;height:100%;transform:none}
.game-fit #boot-overlay{left:var(--game-left);top:var(--game-top);width:800px;height:520px;transform:scale(var(--game-scale));transform-origin:0 0}
.touch-enabled #screen canvas{touch-action:none;-webkit-touch-callout:none}
.touch-enabled #game-shell :is(button,a,[role=option],summary){touch-action:manipulation}
.touch-enabled .lobby-player .lobby-message-btn{opacity:1;pointer-events:auto}
.touch-enabled #game-shell button:disabled{opacity:.4!important}
#chat-close{display:none!important}
.touch-enabled #game-shell #chat-close{display:block!important;flex:0 0 30px}
