:root {
  color-scheme: dark;
  --cyan: #51f7ff;
  --blue: #1838ff;
  --violet: #7e3bff;
  --pink: #ff4fd8;
  --bg: #050716;
  --panel: rgba(10, 16, 42, 0.72);
  --text: #eaf7ff;
  --muted: #93a6d8;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: Inter, "Microsoft YaHei", system-ui, sans-serif;
  background:
    radial-gradient(circle at 20% 20%, rgba(126, 59, 255, 0.34), transparent 30%),
    radial-gradient(circle at 80% 10%, rgba(81, 247, 255, 0.22), transparent 26%),
    linear-gradient(145deg, #030511 0%, #07123a 45%, #16072f 100%);
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.4px),
    radial-gradient(circle, rgba(81, 247, 255, 0.55) 0 1px, transparent 1.6px);
  background-position: 0 0, 38px 54px;
  background-size: 86px 86px, 132px 132px;
  animation: starDrift 18s linear infinite;
}

body::after {
  opacity: 0.45;
  filter: blur(1px);
  animation-duration: 28s;
}

.game-shell {
  width: min(1120px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 300px minmax(300px, 720px);
  gap: 22px;
  align-items: center;
  justify-content: center;
}

.hud {
  padding: 20px;
  border: 1px solid rgba(81, 247, 255, 0.24);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 0 38px rgba(24, 56, 255, 0.2);
  backdrop-filter: blur(14px);
}

.brand {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: conic-gradient(from 180deg, var(--cyan), var(--violet), var(--pink), var(--cyan));
  box-shadow: 0 0 22px rgba(81, 247, 255, 0.8);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  line-height: 1.08;
}

.brand p,
.panel p {
  margin-top: 10px;
  color: var(--muted);
  line-height: 1.6;
}

.stats {
  margin-top: 28px;
  display: grid;
  gap: 12px;
}

.stats div {
  min-height: 76px;
  padding: 14px;
  border: 1px solid rgba(147, 166, 216, 0.22);
  border-radius: 8px;
  background: rgba(4, 8, 24, 0.56);
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.stats strong {
  display: block;
  margin-top: 6px;
  color: var(--cyan);
  font-size: 2rem;
  line-height: 1;
  text-shadow: 0 0 16px rgba(81, 247, 255, 0.75);
}

.stage-wrap {
  position: relative;
  width: min(100%, 720px);
  aspect-ratio: 3 / 4;
  border: 1px solid rgba(81, 247, 255, 0.36);
  border-radius: 8px;
  overflow: hidden;
  background: #050716;
  box-shadow: 0 0 60px rgba(126, 59, 255, 0.28), inset 0 0 38px rgba(81, 247, 255, 0.1);
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 5, 17, 0.58);
}

.overlay.hidden {
  display: none;
}

.panel {
  width: min(360px, 100%);
  padding: 24px;
  border: 1px solid rgba(81, 247, 255, 0.38);
  border-radius: 8px;
  text-align: center;
  background: rgba(8, 13, 35, 0.86);
  box-shadow: 0 0 34px rgba(81, 247, 255, 0.2);
}

.panel h2 {
  font-size: 1.8rem;
}

button {
  width: 100%;
  margin-top: 20px;
  padding: 13px 18px;
  border: 0;
  border-radius: 8px;
  color: #020616;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(90deg, var(--cyan), #92f8ff 48%, var(--pink));
  box-shadow: 0 0 24px rgba(81, 247, 255, 0.38);
}

button:active {
  transform: translateY(1px);
}

@keyframes starDrift {
  from { transform: translateY(0); }
  to { transform: translateY(86px); }
}

@media (max-width: 860px) {
  body {
    overflow-y: auto;
  }

  .game-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .hud {
    padding: 14px;
  }

  .stats {
    margin-top: 16px;
    grid-template-columns: repeat(3, 1fr);
  }

  .stats div {
    min-height: 64px;
    padding: 10px;
  }

  .stats strong {
    font-size: 1.45rem;
  }
}

@media (max-width: 520px) {
  .brand {
    align-items: center;
  }

  .brand p {
    display: none;
  }

  .stage-wrap {
    aspect-ratio: 9 / 14;
  }
}
