/* While an enlarged/native-fullscreen gameplay session owns the viewport, lock the
   document itself: on iOS 12 `touch-action` alone does not stop rubber-banding or
   pinch-zoom of the page behind the playfield. */
html.playExpandedRoot,body.playExpandedRoot{overflow:hidden!important;overscroll-behavior:none!important;touch-action:none!important;height:100%!important}
body.playExpandedRoot{position:fixed!important;inset:0!important;width:100%!important}
/* Keep the :has() selector alone: Safari 12 drops an entire selector list that
   contains one unknown pseudo-class, which would also disable the JS-driven
   playFullscreenLocked rule below. */
body[data-mode="play"]:has(.stageWrap.nativePlayFullscreen){overflow:hidden!important;overscroll-behavior:none!important;touch-action:none!important}
html.playFullscreenLocked,body.playFullscreenLocked{overflow:hidden!important;overscroll-behavior:none!important;touch-action:none!important}
/* Use the whole display unless the player explicitly selected a stage ratio. */
.stageWrap.nativePlayFullscreen,.stageWrap:fullscreen,.stageWrap:-webkit-full-screen{
  position:fixed!important;inset:0!important;z-index:2147483000!important;
  width:100vw!important;height:100vh!important;height:100dvh!important;
  margin:0!important;padding:0!important;border:0!important;border-radius:0!important;
  background:#05070c!important;overflow:hidden!important;touch-action:none!important;
}
.stageWrap.nativePlayFullscreen .stageInner,.stageWrap:fullscreen .stageInner,.stageWrap:-webkit-full-screen .stageInner{
  position:absolute!important;inset:auto!important;left:50%!important;top:50%!important;
  width:100vw!important;height:100vh!important;height:100dvh!important;
  max-width:none!important;max-height:none!important;aspect-ratio:auto!important;transform:translate(-50%,-50%)!important;
}
.stageWrap.customStageRatio.nativePlayFullscreen .stageInner,.stageWrap.customStageRatio:fullscreen .stageInner,.stageWrap.customStageRatio:-webkit-full-screen .stageInner{
  inset:auto!important;left:50%!important;top:50%!important;
  width:min(100vw,calc(100dvh * var(--mil-stage-ratio,16/9)))!important;
  height:min(100dvh,calc(100vw / var(--mil-stage-ratio,16/9)))!important;
  transform:translate(-50%,-50%)!important;aspect-ratio:var(--mil-stage-ratio,16/9)!important;
}
.stageWrap.customStageRatio.nativePlayFullscreen::before,.stageWrap.customStageRatio:fullscreen::before,.stageWrap.customStageRatio:-webkit-full-screen::before{content:"";position:absolute;inset:-24px;background:#05070c var(--mil-stage-art) center/cover no-repeat;filter:blur(24px);opacity:.72;transform:scale(1.08);pointer-events:none}
.stageWrap.customStageRatio.nativePlayFullscreen .stageInner,.stageWrap.customStageRatio:fullscreen .stageInner,.stageWrap.customStageRatio:-webkit-full-screen .stageInner{z-index:1}
.stageWrap.nativePlayFullscreen::before,.stageWrap:fullscreen::before,.stageWrap:-webkit-full-screen::before{content:"";position:absolute;inset:-24px;background:#05070c var(--mil-stage-art) center/cover no-repeat;filter:blur(24px);opacity:.72;transform:scale(1.08);pointer-events:none}
.stageWrap.nativePlayFullscreen #stage,.stageWrap:fullscreen #stage,.stageWrap:-webkit-full-screen #stage{
  display:block!important;width:100%!important;height:100%!important;max-width:none!important;max-height:none!important;
  aspect-ratio:auto!important;object-fit:fill!important;transform:none!important;
}
.stageWrap.nativePlayFullscreen .fsLeft,.stageWrap.nativePlayFullscreen .corner,
.stageWrap:fullscreen .fsLeft,.stageWrap:fullscreen .corner,
.stageWrap:-webkit-full-screen .fsLeft,.stageWrap:-webkit-full-screen .corner,
.stageWrap.nativePlayFullscreen .playExpandedSeek,
.stageWrap:fullscreen .playExpandedSeek,
.stageWrap:-webkit-full-screen .playExpandedSeek{
   display:none!important;
 }
.stageWrap.nativePlayFullscreen .hudPause,.stageWrap:fullscreen .hudPause,.stageWrap:-webkit-full-screen .hudPause{position:fixed!important;z-index:2147483003!important;left:8px!important;top:8px!important}
.stageWrap.nativePlayFullscreen .corner,.stageWrap:fullscreen .corner,.stageWrap:-webkit-full-screen .corner{display:flex!important;position:fixed!important;z-index:2147483002!important;top:8px!important;right:8px!important}
@media (orientation:portrait){
  body[data-mode="play"] .stageWrap.nativeLandscapeFallback .stageInner{
    left:50%!important;top:50%!important;right:auto!important;bottom:auto!important;
    width:100dvh!important;height:100vw!important;transform:translate(-50%,-50%) rotate(90deg)!important;
    transform-origin:50% 50%!important;
  }
  body[data-mode="play"] .stageWrap.nativeLandscapeFallback #stage{width:100%!important;height:100%!important;transform:none!important}
}
/* Installed (Home Screen) web app: Safari's chrome is gone, but iOS still reserves the
   notch / home-indicator insets. black-translucent lets the playfield run edge to edge;
   keep HUD controls clear of the sensor housing. */
html.is-ios-standalone body[data-mode="play"] .stageWrap.nativePlayFullscreen,
html.is-ios-standalone body[data-mode="play"] .stageWrap.playExpanded{
  width:100%!important;height:100%!important;
}
html.is-ios-standalone body[data-mode="play"] .stageWrap.nativePlayFullscreen .stageInner,
html.is-ios-standalone body[data-mode="play"] .stageWrap.playExpanded .stageInner{
  width:100%!important;height:100%!important;
}
html.is-ios-standalone body[data-mode="play"] .stageWrap.nativePlayFullscreen .hudPause{
  left:calc(8px + env(safe-area-inset-left,0px))!important;
  top:calc(8px + env(safe-area-inset-top,0px))!important;
}
html.is-ios-standalone body[data-mode="play"] .stageWrap.nativePlayFullscreen .corner,
html.is-ios-standalone body[data-mode="play"] .stageWrap.playExpanded .corner{
  top:calc(8px + env(safe-area-inset-top,0px))!important;
  right:calc(8px + env(safe-area-inset-right,0px))!important;
}
