/* 撑满可视区域：否则 body 默认高度按内容算，#GameDiv height:100% 无效，底部会露出背景色（像留白） */
html {
  width: 100%;
  height: 100%;
  min-height: 100%;
  /* 与浏览器可视高度对齐（避免仅 height:100% 时折叠导致底下露底色） */
  min-height: 100vh;
  min-height: -webkit-fill-available;
  margin: 0;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
}

body {
  cursor: pointer;
  padding: 0;
  border: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  min-height: 100vh;
  min-height: -webkit-fill-available;

  text-align: center;
  background-color: #04090a;
  font-family: Helvetica, Verdana, Arial, sans-serif;
  overflow: hidden !important;
}

body, canvas, div {
  outline: 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);
}

#LoadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #04090a;
  color: #fff;
  font-family: Helvetica, Verdana, Arial, sans-serif;
  cursor: pointer;
}

/* 不使用淡出：淡出时画布会先露出来，看起来像进度条与主界面重叠 */

#LoadingPanel {
  width: min(680px, calc(100vw - 40px));
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

#SplashLogo {
  display: none;
  width: min(360px, 72vw);
  height: auto;
  image-rendering: auto;
  flex-shrink: 0;
  margin-bottom: 50px;
}

#LoadingBar {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(15, 42, 52, 0.95) 0%, rgba(8, 28, 36, 0.98) 100%);
  border: 1px solid rgba(52, 180, 140, 0.35);
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

#LoadingBarFill {
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    #1fa67a 0%,
    #2dcc9a 38%,
    #3ae8c4 72%,
    #7cffec 100%
  );
  box-shadow:
    0 0 12px rgba(46, 214, 168, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: width 120ms linear;
}

#LoadingText {
  margin-top: 10px;
  font-size: 13px;
  opacity: 0.85;
  width: 100%;
}

/* 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 */
}

/* Cocos EditBox 多行模式下的 textarea：去掉滚动条与拉伸，更接近单行 input */
body textarea {
  overflow: hidden !important;
  resize: none !important;
}

/*
 * Cocos EditBox 在 Web 上会挂原生 input（常在 body 下，不一定在 #GameDiv 内）；
 * 聚焦时浏览器默认 outline 与游戏内自绘圆角框叠在一起，去掉后聚焦/失焦一致。
 */
body input:focus,
body input:focus-visible,
body textarea:focus,
body textarea:focus-visible {
  outline: none !important;
  box-shadow: none !important;
  font-size: 14px !important;
}

canvas {
  background-color: rgba(0, 0, 0, 0);
}

/* 游戏区域默认使用手势光标（可点击/可交互） */
#GameDiv,
#Cocos3dGameContainer,
#GameCanvas,
#GameDiv canvas {
  cursor: pointer;
}

/* 铺满可视区域：fixed 不依赖 body 百分比高度链，避免底部留白 */
#GameDiv {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
}

/* 加载结束前不显示游戏画布，避免与加载层同时可见 */
#GameDiv.cc-game-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

#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);
}
