/* Basic full-screen mobile layout for Cocos Creator web builds.
 *
 * Layout follows the v.hitclub.pl pattern so iPhone Safari is able to
 * collapse its URL bar / tab bar:
 *   - body is position: absolute (not fixed) so it participates in the
 *     scroll context and can grow taller than the viewport.
 *   - body has touch-action: pan-x pan-y so the browser handles native
 *     pan gestures (this is what triggers Safari's chrome-hide animation).
 *   - canvas and #Cocos2dGameContainer are position: absolute too, so
 *     they live in the same scroll context as body. The Cocos engine
 *     repositions them on resize.
 *   - JS swaps body height between 100% (fullscreen) and 110vh
 *     (chrome-visible) at runtime.
 */

html {
  -ms-touch-action: none;
}

body, canvas, div {
  display: block;
  outline: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

/* Remove spin of input type number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

body {
  margin: 0;
  padding: 0;
  position: absolute;
  top: 0;
  left: 0;
  width: 100lvw;
  width: 100vw;
  height: 100lvh;
  height: 100vh;
  background-color: #000;
  text-align: center;
  font-family: Helvetica, Verdana, Arial, sans-serif;
  touch-action: pan-x pan-y;
}

#game-shell {
  position: absolute;
  left: var(--app-offset-left, 0);
  top: var(--app-offset-top, 0);
  width: var(--app-width, 100vw);
  height: var(--app-height, 100vh);
  height: var(--app-height, 100dvh);
  box-sizing: border-box;
}

/* Canvas is always sized to the viewport (NOT 100% of body) so the body
 * can grow taller than the viewport for the iPhone Safari scroll trick
 * without the canvas stretching and leaving a black gap below it.
 * mobile-fullscreen.eb122.js updates --app-* from visualViewport on iOS Safari. */
#GameCanvas,
#Cocos2dGameContainer,
#play-root {
  position: absolute;
  left: var(--app-offset-left, 0);
  top: var(--app-offset-top, 0);
  width: var(--app-width, 100vw);
  height: var(--app-height, 100vh);
  height: var(--app-height, 100dvh);
  box-sizing: border-box;
}

#game-shell #GameCanvas,
#game-shell #Cocos2dGameContainer,
#game-shell #play-root {
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

canvas {
  background-color: rgba(0, 0, 0, 0);
}

/* Splash screen covers the whole viewport as well */
#splash {
  position: fixed;
  left: var(--app-offset-left, 0);
  top: var(--app-offset-top, 0);
  width: var(--app-width, 100vw);
  height: var(--app-height, 100dvh);
  margin: 0;
  padding: 0;
}

/* HitClub #mask: absolute so the page can still scroll (Safari chrome-hide).
 * Only shown on iOS < 15; iOS 15+ uses invisible 110vh + scrollTo(-100). */
#mobile-fs-mask {
  background-color: rgb(19, 19, 19);
  box-sizing: border-box;
  display: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  height: 100%;
  left: 0;
  opacity: 0.5;
  position: absolute;
  top: 0;
  width: 100%;
  z-index: 9999;
}

#mobile-fs-tip {
  color: #ff3b3b;
  font-size: 18px;
  font-weight: 700;
  left: 0;
  letter-spacing: 0.02em;
  margin: 0;
  padding: 0 16px;
  pointer-events: none;
  position: absolute;
  right: 0;
  text-align: center;
  text-shadow: 0 1px 8px #000;
  top: 10%;
  z-index: 1;
}

#mobile-fs-swipe {
  background: #000 url(fsc/swipe.gif) no-repeat center;
  background-size: min(42vmin, 220px);
  height: 100%;
  left: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  width: 100%;
}

.mobile-fs-mask-close {
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
  pointer-events: auto;
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 2;
}

.mobile-fs-mask-close img {
  display: block;
  height: 40px;
  width: 40px;
}

/* PWA standalone: lock body scroll; game uses full viewport (no safe-area inset). */
html.pwa-standalone body {
  overflow: hidden;
  position: fixed;
  height: 100%;
  width: 100%;
}
