:root {
  --ink: #f3f1ec;
  --muted: #98979a;
  --dim: #5f5e64;
  --line: rgba(243, 241, 236, .14);
  --accent: #c5ff62;
  --violet: #8f7bff;
  --bg: #101015;
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--bg);
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 46%, rgba(83, 71, 150, .2), transparent 28rem),
    radial-gradient(circle at 8% 92%, rgba(197, 255, 98, .05), transparent 22rem),
    var(--bg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; }
.mono { font-family: var(--mono); letter-spacing: .06em; }

.noise {
  position: fixed;
  z-index: 10;
  inset: 0;
  pointer-events: none;
  opacity: .04;
  background-image: repeating-radial-gradient(circle at 10% 20%, transparent 0, transparent 1px, rgba(255,255,255,.8) 1px, rgba(255,255,255,.8) 2px);
  background-size: 5px 5px;
  mix-blend-mode: soft-light;
}

.game-page {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 1.25rem;
}

.game-stage {
  position: relative;
  display: flex;
  width: min(100%, 900px);
  flex-direction: column;
  align-items: center;
}

.game-label {
  align-self: center;
  margin-bottom: .8rem;
  color: var(--dim);
  font-size: .58rem;
  text-transform: uppercase;
}

.game-hud {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1.4rem, 8vw, 4.5rem);
  width: 100%;
  margin-bottom: .65rem;
  opacity: .7;
  pointer-events: none;
  transition: opacity 240ms ease;
}

.game-hud.is-active { opacity: 1; }

.hud-item {
  display: flex;
  align-items: baseline;
  gap: .42rem;
}

.hud-label {
  color: var(--dim);
  font-size: .52rem;
}

.hud-item strong {
  min-width: 2.7rem;
  color: var(--ink);
  font-family: var(--mono);
  font-size: .78rem;
  font-weight: 400;
  letter-spacing: .06em;
}

.hud-best strong { color: var(--accent); }

.orbit-scene {
  position: relative;
  width: min(92vw, 680px);
  aspect-ratio: 1;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid rgba(243, 241, 236, .06);
  border-radius: 50%;
  background:
    linear-gradient(rgba(243, 241, 236, .045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243, 241, 236, .045) 1px, transparent 1px);
  background-size: 18px 18px;
  box-shadow:
    inset 0 0 50px rgba(16, 16, 21, .9),
    0 0 0 1px rgba(243, 241, 236, .04),
    0 0 100px rgba(143, 123, 255, .08);
  transform: rotate(-12deg);
  transition: transform 700ms cubic-bezier(.2, .8, .2, 1);
}

.orbit-scene:hover { transform: rotate(-4deg) scale(1.012); }

.scene-glow {
  position: absolute;
  inset: 25%;
  border-radius: 50%;
  background: var(--violet);
  filter: blur(80px);
  opacity: .18;
  animation: glow 5s ease-in-out infinite;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(243, 241, 236, .18);
  border-radius: 50%;
  pointer-events: none;
}

.orbit-outer {
  inset: 4%;
  border-style: dashed;
  border-color: rgba(197, 255, 98, .33);
  animation: spin 24s linear infinite;
}

.orbit-middle {
  inset: 17%;
  border-color: rgba(143, 123, 255, .55);
  transform: rotate(58deg) scaleY(.48);
  animation: spin-reverse 18s linear infinite;
}

.orbit-inner {
  inset: 29%;
  border-color: rgba(243, 241, 236, .26);
  transform: rotate(-18deg) scaleY(.64);
}

.crosshair {
  position: absolute;
  background: rgba(243, 241, 236, .12);
  pointer-events: none;
}

.crosshair-horizontal { top: 50%; right: 6%; left: 6%; height: 1px; }
.crosshair-vertical { top: 6%; bottom: 6%; left: 50%; width: 1px; }

.core {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: flex;
  width: 39%;
  aspect-ratio: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  border: 1px solid rgba(197, 255, 98, .55);
  border-radius: 50%;
  background: rgba(16, 16, 21, .78);
  box-shadow: 0 0 0 9px rgba(197, 255, 98, .03), 0 0 55px rgba(197, 255, 98, .12);
  transform: translate(-50%, -50%) rotate(12deg);
  pointer-events: none;
}

.core-number {
  color: var(--ink);
  font-size: clamp(2.4rem, 9vw, 5rem);
  font-weight: 700;
  letter-spacing: -.1em;
  line-height: .9;
  text-indent: -.1em;
}

.core-caption {
  margin-top: .9rem;
  color: var(--accent);
  font-size: .52rem;
  letter-spacing: .15em;
}

#game-canvas {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  cursor: crosshair;
  touch-action: none;
}

#game-canvas:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -5px;
}

.game-message {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 7;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .52rem;
  letter-spacing: .14em;
  opacity: .8;
  pointer-events: none;
  transform: translate(-50%, 4.7rem) rotate(12deg);
  white-space: nowrap;
}

.game-message.is-record { color: var(--accent); }
.game-message.is-ended { color: var(--violet); }

.satellite {
  position: absolute;
  z-index: 3;
  display: block;
  width: .65rem;
  height: .65rem;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(197, 255, 98, .1), 0 0 18px var(--accent);
  pointer-events: none;
}

.satellite-one { top: 10%; right: 22%; animation: float-one 7s ease-in-out infinite; }

.satellite-two {
  bottom: 18%;
  left: 11%;
  width: .42rem;
  height: .42rem;
  background: var(--violet);
  box-shadow: 0 0 0 5px rgba(143, 123, 255, .1), 0 0 18px var(--violet);
  animation: float-two 9s ease-in-out infinite;
}

.satellite-three {
  top: 35%;
  left: 3%;
  width: .26rem;
  height: .26rem;
  opacity: .7;
  animation: blink 3s ease-in-out infinite;
}

.scan-line {
  position: absolute;
  z-index: 4;
  top: 12%;
  right: 8%;
  left: 8%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: .55;
  box-shadow: 0 0 11px var(--accent);
  animation: scan 5s ease-in-out infinite;
  pointer-events: none;
}

.game-controls {
  display: flex;
  width: min(92vw, 680px);
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

.game-status {
  max-width: 15rem;
  margin: 0;
  color: var(--muted);
  font-size: .66rem;
  line-height: 1.45;
  text-align: center;
}

.button-game {
  display: inline-flex;
  min-height: 2.7rem;
  align-items: center;
  justify-content: space-between;
  padding: .65rem .85rem .65rem 1rem;
  border: 0;
  border-radius: 999px;
  color: #11120d;
  background: var(--accent);
  font-size: .65rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.button-game:hover { background: #d9ff97; transform: translateY(-3px); }
.button-game:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.button-arrow { margin-left: 1.4rem; font-size: 1.1rem; line-height: 1; }

.game-footer {
  display: flex;
  width: min(92vw, 680px);
  align-items: center;
  justify-content: space-between;
  margin-top: .8rem;
  color: var(--dim);
  font-size: .55rem;
}

.visual-progress {
  width: 40%;
  height: 2px;
  overflow: hidden;
  background: var(--line);
}

.visual-progress span {
  display: block;
  width: 12%;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
  animation: progress 3.5s ease-in-out infinite;
}

.game-instruction {
  margin: .9rem 0 0;
  color: rgba(95, 94, 100, .7);
  font-size: .5rem;
  text-align: center;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes spin-reverse { to { transform: rotate(-360deg) scaleY(.48); } }
@keyframes scan {
  0%, 100% { top: 12%; opacity: 0; }
  15%, 85% { opacity: .55; }
  50% { top: 88%; opacity: .35; }
}
@keyframes blink { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
@keyframes glow { 0%, 100% { transform: scale(.85); opacity: .13; } 50% { transform: scale(1.1); opacity: .24; } }
@keyframes progress { 0%, 100% { transform: translateX(-100%); } 50% { transform: translateX(340%); } }
@keyframes float-one { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(-12px, 16px); } }
@keyframes float-two { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(17px, -10px); } }

@media (min-width: 700px) {
  .game-page { padding: 2rem; }
  .game-label { margin-bottom: 1rem; }
  .game-hud { margin-bottom: 1rem; }
  .game-controls { margin-top: 1.35rem; }
  .game-footer { margin-top: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
