html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  cursor: default;
  padding: 0;
  border: 0;
  margin: 0;

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

  /* 游戏底图：铺满整个视口，玩家看到的黑边区域由底图填充 */
  background-color: #2b2b3a;
  background-image: url('./assets/htmlbg.png');
  background-position: center center;
  background-repeat: no-repeat;
  background-size: cover;

  /* 让游戏区在视口内居中 */
  display: flex;
  align-items: center;
  justify-content: center;
}

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);
}

/* 默认模板自带的标题/页脚不参与布局，避免挤压游戏区 */
.header, .footer {
  display: none;
}

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

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

/*
 * 游戏区：始终保持 9:16（与设计分辨率 720x1280 一致），
 * 在任意分辨率下最大化铺满视口；多余区域交给 body 底图填充，玩家看不到黑边。
 * 用 !important 覆盖 index.html 中 GameDiv 写死的 width/height 内联尺寸
 * （构建重新生成 index.html 时会带出该内联尺寸，这里强制盖掉）。
 * 引擎会读取此处的实时尺寸按比例缩放内部画布。
 */
#GameDiv {
  position: relative;
  margin: 0 auto;
  width: min(100vw, 56.25vh) !important;    /* 100vh * 9 / 16 */
  height: min(177.78vw, 100vh) !important;  /* 100vw * 16 / 9 */
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: transparent !important;
}

#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);
}
