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

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(circle at 50% 15%, rgba(50, 210, 228, .18), transparent 36%),
    linear-gradient(155deg, #142b3d, #08121d 72%);
}

.page {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 8px 8px 32px;
}

.game-shell {
  position: relative;
  width: min(calc(100vw - 16px), calc((100dvh - 42px) * 420 / 760), 497px);
  height: auto;
  aspect-ratio: 420 / 760;
  max-width: 100%;
  max-height: calc(100dvh - 42px);
  border-radius: 20px;
  overflow: hidden;
  background: #20bfd8;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .46), 0 0 0 2px rgba(255,255,255,.1);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 14px;
  text-align: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .06em;
  background: linear-gradient(#1abed8, #a9edf0);
  transition: opacity .25s ease;
}

.loading span {
  justify-self: center;
  width: 44px;
  height: 44px;
  border: 6px solid rgba(255,255,255,.34);
  border-top-color: #ffe029;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

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

.desktop-hint {
  position: fixed;
  bottom: 8px;
  margin: 0;
  color: rgba(255,255,255,.55);
  font-size: 12px;
  white-space: nowrap;
}

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 520px), (pointer: coarse) {
  .page { padding: 0; }
  .game-shell {
    width: min(100vw, calc(100dvh * 420 / 760));
    height: auto;
    max-width: 100vw;
    max-height: 100dvh;
    border-radius: 0;
    box-shadow: none;
  }
  .desktop-hint { display: none; }
}
