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;
  /* 純黑：引擎畫出第一格之前、畫面比例與 16:9 不同時的留邊都是黑色，與啟動畫面一致 */
  background-color: #000;

  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);
}

/* ---- 啟動畫面（index.ejs） ---- */

.splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

/* 淡出回黑幕（0.5 秒）：整個啟動畫面淡出，露出底下同樣是黑色的遊戲畫面 */
.splash.hide {
  opacity: 0;
}

/* 畫面高度的 40%（橫向時即短邊），桌機上限為原圖尺寸，避免放大模糊 */
.splash-author {
  width: 40vmin;
  max-width: 300px;
  height: auto;
  opacity: 0;
  transform: scale(0.7);
}

/* 由黑幕淡入（0.5 秒），同時由 0.7 倍放大到原尺寸（1.5 秒） */
.splash.show .splash-author {
  animation:
    splash-author-fade-in 0.5s ease-out forwards,
    splash-author-grow 1.5s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes splash-author-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes splash-author-grow {
  from {
    transform: scale(0.7);
  }
  to {
    transform: scale(1);
  }
}
