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: #333;

  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%;
}

/* body是display:flex+flex-direction:column(見上)，#GameDiv是唯一的flex item，預設flex-shrink:1——
   手機軟體鍵盤彈出時，body的實際box高度會被瀏覽器/WebView真的壓小(這是原生layout viewport變化，
   跟JS的window.innerHeight是否被蓋掉無關)，flexbox預設行為會把#GameDiv連帶往下壓縮，導致遊戲畫面
   看起來只有上下被「壓扁」(不是等比例縮小)。加flex-shrink:0讓#GameDiv維持自己inline style設定的
   高度，改成讓內容被鍵盤蓋住溢出，而不是整個被壓扁變形。 */
/* 2026-09-25：改成只在EditBox編輯中(JS加上.editing-no-shrink)才生效——無條件套用會讓#GameDiv舊高度撐住
   body.scrollHeight，Cocos引擎在Android上把它誤判成虛擬鍵盤，直式拉成橫式時#GameDiv高度卡住(見event.ts) */
#GameDiv.editing-no-shrink {
  flex-shrink: 0;
}

/* 引擎JS下載期間的載入畫面(index.ejs的#htmlLoading)，蓋在GameDiv上面，index.js.ejs在application.init()完成後移除 */
#htmlLoading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #333;
}
.html-loading-spinner {
  width: 48px;
  height: 48px;
  border: 5px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: html-loading-spin 0.9s linear infinite;
}
.html-loading-text {
  margin-top: 16px;
  color: #fff;
  font-size: 18px;
  letter-spacing: 2px;
}
.html-loading-hint {
  margin-top: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-size: 14px;
  min-height: 20px;
}
@keyframes html-loading-spin {
  to { transform: rotate(360deg); }
}

: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);
}
