:root {
  color-scheme: dark;
  background: #090d12;
  font-family: "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  overflow: hidden;
  background: #090d12;
}

body {
  display: grid;
  place-items: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

.game-frame {
  position: relative;
  overflow: hidden;
  background: #101820;
  box-shadow: 0 0 48px rgb(0 0 0 / 55%);
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: 0;
  background: #101820;
  touch-action: none;
}

.loading-screen {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: end center;
  overflow: hidden;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.loading-screen.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.loading-background,
.loading-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.loading-background {
  object-fit: cover;
}

.loading-shade {
  background: linear-gradient(180deg, transparent 50%, rgb(3 7 10 / 74%) 100%);
}

.loading-content {
  position: relative;
  z-index: 1;
  display: grid;
  width: min(72%, 420px);
  gap: 12px;
  padding-bottom: max(9%, 48px);
  text-align: center;
}

.loading-track {
  height: 10px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 52%);
  border-radius: 999px;
  background: rgb(0 0 0 / 45%);
}

.loading-progress {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffb21c, #ffe27a);
  transition: width 100ms linear;
}

.loading-status {
  color: #fff;
  font-size: 14px;
  text-shadow: 0 1px 3px #000;
}

.error-panel {
  position: absolute;
  z-index: 10;
  inset: 50% auto auto 50%;
  width: min(82%, 420px);
  padding: 22px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 14px;
  background: rgb(10 15 20 / 94%);
  color: #fff;
  text-align: center;
  transform: translate(-50%, -50%);
}

.error-panel p {
  max-height: 38vh;
  overflow: auto;
  color: #ffd9ca;
  line-height: 1.55;
  word-break: break-word;
}

.error-panel button {
  min-width: 120px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: #f0a820;
  color: #17100a;
  font-weight: 700;
}

@media (max-width: 520px) {
  .game-frame {
    box-shadow: none;
  }
}

/* 窗口提供实际可用高度，原游戏决定内容缩放；不再用设计比例限制竖屏高度。 */

:root { --game-viewport-height: 100vh; }

@supports (height: 100dvh) { :root { --game-viewport-height: 100dvh; } }

html { width: 100%; height: 100%; }

body { width: 100%; height: var(--game-viewport-height); min-height: 0; }

.game-frame {
  /* 高度保持动态；宽度不超过原750×1334设计比例，避免桌面短宽视口放大战斗UI。
     百分比高度使用扣除安全区后的内容区，长屏仍可使用全部高度。 */
  width: auto;
  height: 100%;
  aspect-ratio: 750 / 1334;
  min-width: 0;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
}
