:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  background: #201a17;
}

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

html,
body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 8%, rgba(255, 223, 116, 0.24), transparent 38%),
    #201a17;
}

button {
  font: inherit;
}

.game-frame {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: #fff8d6;
  box-shadow: 0 0 3rem rgba(0, 0, 0, 0.45);
}

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

.loading-screen,
.error-panel {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  color: #5f2d20;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 255, 0.88), transparent 20%),
    linear-gradient(180deg, #fff8cf, #f5bd54);
  text-align: center;
  transition: opacity 220ms ease, visibility 220ms ease;
}

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

.loading-icon {
  width: clamp(5.5rem, 25vw, 8.5rem);
  height: auto;
  border: 0.35rem solid rgba(255, 255, 255, 0.72);
  border-radius: 26%;
  box-shadow: 0 0.7rem 1.6rem rgba(107, 56, 23, 0.24);
}

.loading-title {
  margin-top: 1.5rem;
  font-size: clamp(1.7rem, 8vw, 2.7rem);
  letter-spacing: 0.08em;
}

.loading-track {
  width: min(76%, 19rem);
  height: 0.85rem;
  margin-top: 1.5rem;
  overflow: hidden;
  border: 0.18rem solid #873f27;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
}

.loading-progress {
  display: block;
  width: 4%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f35141, #ff9e32);
  transition: width 180ms ease;
}

.loading-status {
  min-height: 1.5em;
  margin-top: 0.9rem;
  font-size: clamp(0.82rem, 3.5vw, 1rem);
  font-weight: 700;
}

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

.error-panel {
  z-index: 30;
  gap: 0.85rem;
  background: rgba(255, 247, 222, 0.98);
}

.error-panel strong {
  color: #b42d29;
  font-size: 1.5rem;
}

.error-panel p {
  max-width: 25rem;
  margin: 0;
  color: #684139;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.error-panel button {
  padding: 0.72rem 1.45rem;
  border: 0.16rem solid #843f27;
  border-radius: 999px;
  color: #fff;
  background: #ef5145;
  box-shadow: 0 0.3rem 0 #843f27;
  font-weight: 800;
  cursor: pointer;
}

@media (display-mode: fullscreen) {
  .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 { width: 100%; height: 100%; min-height: 0; max-width: 100%; max-height: 100%; }
