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

* {
  box-sizing: border-box;
}

html,
body,
.game-root {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.game-root {
  position: relative;
  background:
    radial-gradient(circle at 50% 18%, rgb(66 157 199 / 25%), transparent 44%),
    #101826;
}

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

.game-home-button {
  position: absolute;
  z-index: 4;
  top: max(18px, env(safe-area-inset-top));
  left: calc(50% + min(50vw, 28.11vh) - 58px);
  width: 100px;
  min-height: 38px;
  padding: 0.45em 0.72em;
  transform: translateX(-50%);
  border: 1px solid rgb(167 211 255 / 46%);
  border-radius: 999px;
  color: #eaf6ff;
  background: linear-gradient(180deg, rgb(31 61 119 / 82%), rgb(14 30 70 / 86%));
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 18%),
    0 4px 12px rgb(3 8 24 / 26%);
  font: 700 15px/1 "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgb(8 20 58 / 70%);
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
}

.game-home-button[hidden] { display: none; }
.game-home-button:hover { background: linear-gradient(180deg, rgb(42 78 148 / 92%), rgb(20 42 94 / 94%)); }
.game-home-button:active { transform: translate(-50%, 1px); }
.game-home-button:focus-visible { outline: 4px solid #fff7a7; outline-offset: 3px; }

.game-share-status {
  position: absolute;
  z-index: 9;
  bottom: max(15.5%, env(safe-area-inset-bottom));
  left: 50%;
  width: max-content;
  max-width: 78%;
  padding: 0.65em 1.1em;
  margin: 0;
  transform: translate(-50%, 8px) scale(0.96);
  border: 1px solid rgb(161 211 255 / 26%);
  border-radius: 999px;
  color: #fff;
  background: rgb(8 20 48 / 88%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 32%);
  text-align: center;
  font-size: clamp(12px, 2.7vmin, 18px);
  font-weight: 800;
  line-height: 1.25;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 180ms ease;
  backdrop-filter: blur(9px);
}

.game-share-status:empty { display: none; }
.game-share-status.is-visible {
  transform: translate(-50%, 0) scale(1);
  opacity: 1;
}

.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(8 20 35 / 98%), rgb(18 42 55 / 96%));
  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(139 218 239 / 36%);
  border-radius: 1.35rem;
  background: rgb(48 139 173 / 28%);
  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: #a7c5d1;
  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, #5ec5e6, #c1e76d);
  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: #8edff0;
  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;
  }
}
