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

* {
  box-sizing: border-box;
}

html,
body,
.game-root {
  margin: 0;
  overflow: hidden;
}

.game-root {
  position: relative;
  background:
    radial-gradient(circle at 50% 20%, rgb(48 137 149 / 28%), transparent 45%),
    #111827;
}

#GameCanvas {
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.game-home-button {
  position: absolute;
  z-index: 4;
  top: 84.9%;
  left: 50%;
  width: 41%;
  height: 7.5%;
  min-height: 44px;
  transform: translate(-50%, -50%);
  border: 3px solid #8b4b17;
  border-radius: 999px;
  color: #fff9e8;
  background: linear-gradient(#ffc95c, #ee972b);
  box-shadow:
    inset 0 3px 0 rgb(255 255 255 / 48%),
    0 6px 0 #8b4b17,
    0 9px 18px rgb(74 35 9 / 28%);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  font-size: clamp(18px, 4.5vmin, 40px);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 2px 1px rgb(100 49 10 / 55%);
  cursor: pointer;
  touch-action: manipulation;
}

.game-home-button[hidden] {
  display: none;
}

.game-home-button:active {
  transform: translate(-50%, calc(-50% + 4px));
  box-shadow:
    inset 0 2px 0 rgb(255 255 255 / 34%),
    0 2px 0 #8b4b17,
    0 5px 10px rgb(74 35 9 / 22%);
}

.game-home-button:focus-visible {
  outline: 4px solid #fff8bf;
  outline-offset: 3px;
}

.game-splash,
.game-error {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 0.8rem;
  padding: 2rem;
  text-align: center;
  background: linear-gradient(155deg, rgb(10 23 36 / 97%), rgb(18 36 49 / 95%));
  transition: opacity 240ms ease;
}

.game-splash[hidden],
.game-error[hidden] {
  display: none;
}

.game-splash.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.game-splash__mark {
  display: grid;
  width: 5rem;
  height: 5rem;
  place-items: center;
  border: 1px solid rgb(153 225 206 / 38%);
  border-radius: 1.35rem;
  background: rgb(41 113 93 / 30%);
  font-size: 2.6rem;
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 28%);
}

.game-splash h1,
.game-error h2,
.game-splash p,
.game-error p {
  margin: 0;
}

.game-splash h1 {
  font-size: 1.45rem;
}

.game-splash p,
.game-error p {
  color: #9fbdc9;
  font-size: 0.86rem;
}

.game-splash__progress {
  width: min(15rem, 70vw);
  height: 0.3rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgb(255 255 255 / 9%);
}

.game-splash__progress span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4bbda5, #c6e06e);
  animation: game-loading 1.25s ease-in-out infinite alternate;
}

.game-error {
  z-index: 10;
  background: #161b25;
}

.game-error button {
  margin-top: 0.5rem;
  padding: 0.65rem 1rem;
  border: 0;
  border-radius: 0.65rem;
  color: #0b1a1c;
  background: #8ee2cc;
  font: inherit;
  cursor: pointer;
}

@keyframes game-loading {
  from {
    transform: translateX(-12%);
  }
  to {
    transform: translateX(150%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .game-splash__progress span {
    animation: none;
    transform: 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-root { width: 100%; height: 100%; min-height: 0; max-width: 100%; max-height: 100%; }
