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;
  -khtml-user-select: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* Remove spin of input type number */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    /* display: none; <- Crashes Chrome on hover */
    -webkit-appearance: none;
    margin: 0; /* <-- Apparently some margin are still there even though it's hidden */
}

body {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  margin: 0;

  cursor: default;
  color: #888;
  background-color: #f5d98f;

  text-align: center;
  font-family: Helvetica, Verdana, Arial, sans-serif;

  display: flex;
  flex-direction: column;
}

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

#GameDiv, #Cocos3dGameContainer, #GameCanvas {
  width: 100%;
  height: 100%;
}

:root {
  --safe-top: env(safe-area-inset-top);
  --safe-right: env(safe-area-inset-right);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
}

/* 装箱小达人 boot screen (index.ejs), drawn to match the game's own loading screen (TidyGame.showLoad) exactly, so
   one hands over to the other without a jump. --u is one design pixel: the game is 750 wide and at least 1334 tall,
   fitted to the screen's width, or to its height on a wide screen. The logo sits halfway between the top of the
   screen and the bar, as in the game. */
#Boot {
  --u: min(calc(100vw / 750), calc(100vh / 1334));
  position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 10;
  --bar: max(calc(140 * var(--u)), 16vh);   /* the bar's middle, above the bottom */
  display: flex; align-items: center; justify-content: center;
  padding-bottom: var(--bar); box-sizing: border-box;   /* so the logo sits halfway between the top and the bar */
  background-image: radial-gradient(ellipse 65% 45% at 50% calc((100vh - var(--bar)) / 2), #fbe9bb 0%, #f5d98f 100%);
}
/* the white silhouettes, as on the game's home page and loading screens: the tile repeated from the game area's
   top-left corner over the upper half, fading out in its last 160 design px (TidyGame: decoSpots, DECO_FADE).
   --tile is set from index.ejs: the build renames the picture (md5Cache) and only fixes addresses in the page's tags. */
#Boot::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 50vh; pointer-events: none;
  background-image: var(--tile, none);
  background-position: calc((100vw - 750 * var(--u)) / 2) 0;
  background-size: calc(600 * var(--u)) calc(520 * var(--u));
  background-repeat: repeat;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 160 * var(--u)), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 160 * var(--u)), transparent);
}
/* the sticker's visible part: 400 design px across its inside (TidyGame: lw = 400 less the sticker's padding) */
#BootLogo { position: relative; width: calc(428 * var(--u)); margin-top: calc(9 * var(--u)); animation: boot-bob 3.6s ease-in-out infinite; }
/* the bar: a 480 x 52 pill, its middle max(140, 16% of the height) above the bottom, with what is loading on it */
#BootBar {
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--bar) - 26 * var(--u));
  width: calc(480 * var(--u)); height: calc(52 * var(--u)); box-sizing: border-box;
  border: calc(3 * var(--u)) solid #e2d3b7; border-radius: calc(26 * var(--u)); background: #fffaf0; overflow: hidden;
}
#BootFill {
  position: absolute; left: 0; top: 0; width: 35%; height: 100%; border-radius: calc(23 * var(--u)); background: #ee7d3b;
  animation: boot-slide 1.4s ease-in-out infinite;
}
#BootText {
  position: absolute; left: 0; right: 0; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center;
  color: #4b3322; font-weight: bold; font-size: calc(24 * var(--u));
  font-family: "Arial Rounded MT Bold", "SF Pro Rounded", "Yuanti SC", "YouYuan", "Hiragino Maru Gothic ProN", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
@keyframes boot-bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(calc(-8 * var(--u))); } }
@keyframes boot-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }

/* ICP filing number (index.ejs): small and faint at the bottom centre, above the game and the boot screen */
#Icp {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(2px + env(safe-area-inset-bottom, 0px)); z-index: 20;
  font: 10px/1.4 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: #6b4a2e; text-decoration: none; white-space: nowrap;
  background: rgba(255, 248, 230, 0.72); padding: 0 8px; border-radius: 8px;
}
