html {
  -ms-touch-action: none;
  touch-action: none;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: #000000;
}

body {
  cursor: default;
  padding: 0;
  border: 0;
  margin: 0;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  text-align: center;
  background-color: #000000;
  font-family: Helvetica, Verdana, Arial, sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  box-sizing: border-box;
}

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);
}

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

canvas {
  background-color: rgba(0, 0, 0, 0);
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  vertical-align: top;
  display: block;
}

/* splash 存在时 canvas 不可见，避免 Cocos 引擎启动画面透出 */
#splash:not([style*="display: none"]) ~ #GameDiv #GameCanvas {
  visibility: hidden;
}

#splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #f5ead1;
  z-index: 10000;
  overflow: hidden;
}

#splash-bg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  pointer-events: none;
  user-select: none;
}

#splash-logo {
  position: absolute;
  left: 50%;
  top: 43%;
  transform: translate(-50%, -50%);
  width: min(540px, 45vw, 65vh);
  max-width: 72vw;
  pointer-events: none;
  user-select: none;
  z-index: 2;
  filter: drop-shadow(0 4px 24px rgba(57, 66, 19, 0.28));
  animation: splash-logo-float 2.8s ease-in-out infinite;
}

@media (orientation: portrait) {
  #splash-logo {
    width: min(84vw, 65vh);
    max-width: 84vw;
  }
}

#splash-legal {
  position: absolute;
  bottom: max(16px, env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  z-index: 3;
  font-size: clamp(12px, 1.8vh, 16px);
  color: #69441e;
  text-shadow: 0 1px 4px #fff8e8;
}

#splash-legal a {
  display: inline-block;
  padding: 10px 8px;
  color: inherit;
  text-underline-offset: 3px;
}

@keyframes splash-logo-float {
  0%   { transform: translate(-50%, -50%); }
  50%  { transform: translate(-50%, calc(-50% - 8px)); }
  100% { transform: translate(-50%, -50%); }
}

#splash .progress-bar {
  background: #fff3d2;
  border: 2px solid #98713d;
  box-shadow: 0 2px 4px #80552633, inset 0 1px 3px #6b472426;
  padding: 2px;
  overflow: hidden;
  box-sizing: border-box;
  position: absolute;
  left: 50%;
  bottom: 13%;
  height: 30px;
  width: min(520px, 62vw);
  margin: 0;
  transform: translateX(-50%);
  border-radius: 24px;
  z-index: 2;
}

#splash .progress-bar span {
  display: block;
  height: 100%;
  border-radius: 24px;
  transition: width 0.35s ease-out;
  background: linear-gradient(180deg, #a9d85b 0%, #75b638 50%, #55952c 100%);
  box-shadow: inset 0 2px 1px #ffffff88;
}

#GameDiv {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  max-width: 100vw;
  max-height: 100vh;
  margin: 0 !important;
  padding: 0;
  background: transparent;
  z-index: 1;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  box-sizing: border-box;
  overflow: hidden;
}

#Cocos3dGameContainer {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: none !important;
  box-shadow: none !important;
}

#Cocos3dGameContainer,
#GameCanvas {
  width: 100%;
  height: 100%;
}

h1.header,
h1,
p.footer,
.header,
.footer {
  display: none !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  visibility: hidden !important;
}

: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-progress-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff9e7; font-size: 15px; line-height: 1; font-weight: bold; font-variant-numeric: tabular-nums; text-shadow: 0 1px 2px #534323; -webkit-text-stroke: 0.5px #66502e; pointer-events: none; z-index: 2; }
#splash-error { position: absolute; left: 5%; bottom: 7.5%; width: 90%; color: #534323; font-size: 14px; text-shadow: 0 1px 3px #fff6d9; z-index: 2; }
@media (prefers-reduced-motion: reduce) { #splash-logo { animation: none; } #splash .progress-bar span { transition: none; } }

#splash-retry { position:absolute; left:50%; bottom:18%; transform:translateX(-50%); padding:12px 28px; border:2px solid #ffd778; border-radius:24px; background:#e99120; color:#fff; font:bold 18px sans-serif; cursor:pointer; }
