html {
  -ms-touch-action: none;
  width: 100%;
  height: 100%;
}

html.browser-mode,
html.browser-mode body,
html.standalone-mode,
html.standalone-mode body {
  position: fixed;
  width: 100%;
  height: 100%;
  min-height: 100vh;
  overflow: hidden;
}

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

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

body {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  cursor: default;
  color: #888;
  background-color: #000;
  text-align: center;
  font-family: Helvetica, Verdana, Arial, sans-serif;
  overflow: hidden;
}

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

#splash {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  background-color: #000;
  background-image: url("./logo.png"), url("./splash-bg.jpg");
  background-repeat: no-repeat, no-repeat;
  background-position: center center, center center;
  background-size: 45% auto, auto 100%;
  z-index: 1;
  pointer-events: none;
}

#splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

#landscape-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
  touch-action: none;
}

html.force-landscape {
  background: #000;
  overflow: hidden;
}

html.force-landscape body {
  overflow: hidden;
}

/* 竖屏兜底：JS 会用像素 + margin-left 覆盖，避免 translateY 半屏黑 */
html.force-landscape #landscape-wrapper {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vh;
  height: 100vw;
  margin: 0;
  margin-left: 100vw;
  transform: rotate(90deg);
  transform-origin: top left;
  -webkit-transform: rotate(90deg);
  -webkit-transform-origin: top left;
}

html.force-landscape #GameDiv,
html.force-landscape #Cocos3dGameContainer,
html.force-landscape #GameCanvas {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  transform: none !important;
  -webkit-transform: none !important;
}

/* WebView：一出现就铺满宿主（JS 还会像素加固；不依赖 force-landscape） */
#webview-wrapper,
#webview-wrapper iframe,
iframe#webview {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  transform: none !important;
  -webkit-transform: none !important;
  box-sizing: border-box !important;
}

html.force-landscape #webview-wrapper,
html.force-landscape #webview-wrapper iframe,
html.force-landscape iframe#webview {
  position: absolute !important;
  left: 0 !important;
  top: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
}

/* Return/Shop：在 #landscape-wrapper 内，跟随 rotate(90deg) */
html.force-landscape #movableView {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  overflow: hidden !important;
  box-sizing: border-box !important;
  transform: none !important;
  -webkit-transform: none !important;
  z-index: 10001 !important;
}

#rotate-hint {
  display: none;
}

html.force-landscape #rotate-hint {
  display: none;
}
