/* 牌友圈 Web 启动页：背景 + 品牌/标题 + 立绘 + 进度条 + 底部网址 */
html {
  -ms-touch-action: none;
  touch-action: none;
}

body, canvas, div {
  display: block;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
}

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

body {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  cursor: default;
  color: #888;
  /* 与登录页清屏色一致，避免启动页关掉后闪黑 */
  background-color: #f3f4f6;
  text-align: center;
  font-family: Helvetica, Verdana, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

#GameDiv,
#Cocos3dGameContainer,
#GameCanvas {
  width: 100%;
  height: 100%;
  /* 与登录/大厅清屏色一致，避免启动页揭开后先闪引擎默认黑底 */
  background-color: #f3f4f6;
}

/* 画布始终可见并由 #splash 盖住；hidden 会导致部分浏览器不渲染，揭开后黑屏 */
#GameCanvas {
  visibility: visible;
}

#splash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #031711;
  z-index: 500;
}

body:not(.allow-engine-hide) #splash {
  display: block !important;
}

.splash-page-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #031711;
}

.splash-stage {
  position: absolute;
  inset: 0;
  width: min(100vw, calc(100vh * 0.5625)); /* 720/1280 */
  max-width: 720px;
  height: 100%;
  margin: 0 auto;
  left: 50%;
  transform: translateX(-50%);
  overflow: hidden;
  z-index: 1001;
  background: #031711 url("./splash/splash-background.jpg") center / cover no-repeat;
}

.splash-brand {
  position: absolute;
  z-index: 1003;
  left: 50%;
  top: 6.25%;
  width: min(22%, 160px);
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
  display: block;
}

.splash-title {
  position: absolute;
  z-index: 1003;
  left: 50%;
  top: 12.5%;
  width: min(81%, 585px);
  height: auto;
  transform: translateX(-50%);
  pointer-events: none;
  display: block;
}

.splash-main {
  position: absolute;
  inset: 0;
  z-index: 1002;
  background-color: transparent;
  overflow: hidden;
  pointer-events: none;
}

.splash-main > img {
  position: absolute;
  display: block;
  border: 0;
  pointer-events: none;
  visibility: hidden;
}

.splash-main.is-ready > img {
  visibility: visible;
}

/* 默认立绘（637×757）：叠在背景上，禁止整页拉伸 */
.splash-main:not(.is-fullpage) > img {
  inset: auto;
  top: auto;
  right: auto;
  left: 50%;
  bottom: 27%;
  width: 85%;
  max-width: 610px;
  height: auto;
  transform: translateX(-50%);
  object-fit: contain;
}

/* 仅当后台配置接近 720×1280 整页图时铺满 */
.splash-main.is-fullpage > img {
  inset: 0;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  transform: none;
  object-fit: cover;
}

.loading-bg-phone-text-copyright {
  position: absolute;
  z-index: 1004;
  left: 50%;
  bottom: max(72px, calc(env(safe-area-inset-bottom) + 50px));
  transform: translateX(-50%);
  width: 86%;
  text-align: center;
  font-size: clamp(16px, 4vw, 26px);
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.28);
  pointer-events: none;
  letter-spacing: 0.02em;
}

#progresscontainer {
  position: absolute;
  width: min(82.5%, 594px);
  height: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: url("./splash/progress-track.png") center / 100% 100% no-repeat;
  bottom: 18.8%;
  overflow: visible;
  z-index: 10000;
  opacity: 0;
}

#progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  border-radius: 999px;
  background: url("./splash/progress-fill.png") left center / 100% 100% no-repeat;
  transition: none;
}

#first-text {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  pointer-events: none;
  display: none !important;
  bottom: calc(100% + 36px);
  font-size: clamp(13px, 3.2vw, 18px);
}

#p-v {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  white-space: nowrap;
  pointer-events: none;
  display: block;
  bottom: calc(100% + 10px);
  font-size: clamp(14px, 3.4vw, 20px);
  font-weight: 600;
  letter-spacing: 0.04em;
}

#first-text {
  bottom: calc(100% + 36px);
  font-size: clamp(13px, 3.2vw, 18px);
}

body.game-booted #progresscontainer {
  opacity: 1;
}

body.game-ready #splash {
  transition: opacity 0.2s ease;
  pointer-events: none !important;
}

body.allow-engine-hide #splash {
  display: none !important;
  pointer-events: none !important;
}
