html,
body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  overflow: hidden;
  background: #111;
  cursor: default;
  font-family: Helvetica, Verdana, Arial, sans-serif;
  -ms-touch-action: none;
  /* ⭐ 二指缩放修复：现代浏览器认 touch-action（-ms- 只对旧 IE/Edge）。
     必须覆盖到 html/body 而不仅是 canvas——双指 pinch-zoom 是 viewport 级手势，
     仅在 canvas 上设 touch-action 时，部分移动 Chromium 仍会把双指当原生页面缩放消费，
     导致 Cocos 收不到多点 touchmove。overscroll-behavior 再堵住滚动链传递。 */
  touch-action: none;
  overscroll-behavior: none;
}

body,
canvas,
div {
  display: block;
  outline: none;
  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);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

#GameDiv {
  position: fixed;
  inset: 0;
}

#GameDiv,
#Cocos3dGameContainer,
#GameCanvas {
  width: 100%;
  height: 100%;
  /* ⭐ 二指缩放修复：touch-action 必须覆盖整个容器链，而不只是 canvas */
  touch-action: none;
}

#GameCanvas {
  background: transparent;
  touch-action: none;
}

#FullscreenToggle {
  position: fixed;
  z-index: 2147483647;
  /* 左侧中部，避开左下角城市/世界切换与聊天入口。 */
  top: 50%;
  transform: translateY(-50%);
  left: max(10px, calc(env(safe-area-inset-left, 0px) + 10px));
  width: 42px;
  height: 42px;
  padding: 0 0 3px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  background: rgba(12, 18, 24, 0.7);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
  color: #fff;
  cursor: pointer;
  font: 30px/38px Helvetica, Arial, sans-serif;
  /* 默认隐藏（透明+放行点击），
     仅在指针/键盘活动时由 index.ejs 加 is-reveal 短暂浮现。 */
  opacity: 0;
  pointer-events: none;
  transition: background-color 120ms ease, opacity 200ms ease, transform 120ms ease;
}

#FullscreenToggle.is-reveal {
  opacity: 0.72;
  pointer-events: auto;
}

#FullscreenToggle.is-reveal:hover,
#FullscreenToggle.is-reveal:focus-visible {
  background: rgba(21, 31, 41, 0.92);
  opacity: 1;
}

#FullscreenToggle:active {
  transform: translateY(-50%) scale(0.94);
}

#FullscreenToggle.is-fullscreen {
  font-size: 32px;
  line-height: 36px;
}

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