/* 网页宿主登录层样式，与 Cocos 游戏画布完全隔离。 */
html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: #f4f5f8;
  color: #1f2430;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

#GameDiv {
  display: none;
}

.web-game-started #GameDiv {
  display: block;
}

.web-game-started .web-login-host {
  display: none;
}

/* iframe 嵌入模式：不显示测试登录层与水印，等待父页面传入会话 */
.web-embed .web-login-host,
.web-embed .web-build-watermark {
  display: none;
}

.web-embed {
  background: #000;
}

/* 进入游戏加载遮罩：引擎启动期间显示与游戏加载页相同的背景，加载页首帧绘制后淡出，避免黑屏 */
.web-loading-cover {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: none;
  background: #110c23 url("game_loading_background.jpg") center / cover no-repeat;
  transition: opacity 0.2s ease-out;
}

@media (orientation: portrait) {
  .web-loading-cover {
    background-image: url("game_loading_background_portrait.jpg");
  }
}

.web-embed .web-loading-cover,
.web-game-started .web-loading-cover {
  display: block;
}

.web-game-shown .web-loading-cover {
  opacity: 0;
  pointer-events: none;
}

/* 嵌入启动失败：在加载遮罩上居中显示原因与重试按钮 */
.web-embed-error {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(16, 20, 28, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  box-sizing: border-box;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13px;
  text-align: center;
}

.web-embed-error[hidden] {
  display: none;
}

.web-embed-error-text {
  margin: 0;
}

.web-embed-error-retry {
  padding: 6px 20px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 16px;
  background: transparent;
  color: #fff;
  font-size: 13px;
}

.web-login-host {
  display: flex;
  min-height: 100vh;
  box-sizing: border-box;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(145deg, #eef8f6 0%, #f7f4ed 100%);
}

.web-login-card {
  width: min(100%, 360px);
  box-sizing: border-box;
  padding: 30px 26px;
  border: 1px solid rgba(16, 94, 81, 0.12);
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 18px 52px rgba(20, 45, 41, 0.12);
}

.web-login-title {
  margin: 0 0 8px;
  color: #173d37;
  font-size: 26px;
  line-height: 1.3;
}

.web-login-description {
  margin: 0 0 24px;
  color: #78847f;
  font-size: 14px;
}

.web-login-tabs {
  display: flex;
  padding: 4px;
  border-radius: 12px;
  background: #edf3f1;
}

.web-login-tab {
  flex: 1;
  height: 38px;
  border: 0;
  border-radius: 9px;
  color: #697671;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
}

.web-login-tab.is-active {
  color: #176f60;
  background: #ffffff;
  box-shadow: 0 3px 10px rgba(28, 85, 75, 0.12);
  font-weight: 600;
}

.web-login-fields-hidden {
  display: none;
}

.web-login-label {
  display: block;
  margin-top: 16px;
  color: #44514d;
  font-size: 14px;
}

.web-login-input {
  width: 100%;
  height: 46px;
  box-sizing: border-box;
  margin-top: 7px;
  padding: 0 13px;
  border: 1px solid #d7dfdc;
  border-radius: 10px;
  outline: none;
  color: #1f2a27;
  background: #fbfcfc;
  font-size: 16px;
}

.web-login-input:focus {
  border-color: #2b9d88;
  box-shadow: 0 0 0 3px rgba(43, 157, 136, 0.12);
}

.web-login-button {
  width: 100%;
  height: 46px;
  margin-top: 24px;
  border: 0;
  border-radius: 23px;
  color: #ffffff;
  background: #248f7c;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.web-login-button:active {
  background: #1c7566;
  transform: scale(0.99);
}

.web-login-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.web-login-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: #60706b;
  font-size: 13px;
  line-height: 20px;
  text-align: center;
}

.web-login-status.is-error {
  color: #c33d45;
}

/* 测试版水印：仅提示构建版本，不拦截任何点击 */
.web-build-watermark {
  position: fixed;
  left: calc(6px + env(safe-area-inset-left));
  bottom: calc(4px + env(safe-area-inset-bottom));
  z-index: 2147483000;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.35);
  color: rgba(255, 255, 255, 0.8);
  font: 10px/16px -apple-system, "PingFang SC", sans-serif;
  pointer-events: none;
  user-select: none;
}
