:root {
  color-scheme: dark;
  --void: #020606;
  --ink: #effff9;
  --muted: rgba(219, 246, 239, 0.68);
  --panel: rgba(4, 18, 18, 0.58);
  --panel-strong: rgba(4, 18, 18, 0.82);
  --line: rgba(126, 255, 215, 0.22);
  --green: #6dff9e;
  --green-deep: #0f8f55;
  --blue: #68c7ff;
  --violet: #9b7cff;
  --danger: #ff6f9a;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--void);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
}

button {
  border: 0;
  border-radius: 8px;
  color: inherit;
  font: inherit;
}

.game-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 20%, rgba(61, 255, 166, 0.12), transparent 28%),
    radial-gradient(circle at 18% 70%, rgba(104, 199, 255, 0.14), transparent 24%),
    #020606;
}

.stage {
  position: absolute;
  inset: 0;
}

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hud {
  position: absolute;
  z-index: 3;
  pointer-events: none;
}

.hud-top {
  top: calc(14px + var(--safe-top));
  left: 14px;
  right: 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(3, 14, 13, 0.88), rgba(3, 9, 16, 0.76));
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(16px);
}

.signal-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 18px var(--green), 0 0 48px rgba(109, 255, 158, 0.58);
  animation: signalPulse 1.9s ease-in-out infinite;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--green);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.35rem, 6vw, 2.25rem);
  line-height: 0.92;
  letter-spacing: 0;
}

.icon-button {
  pointer-events: auto;
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font-size: 1.24rem;
  font-weight: 900;
  box-shadow: 0 14px 42px rgba(0, 0, 0, 0.24);
  backdrop-filter: blur(14px);
}

.hud-status {
  left: 14px;
  right: 14px;
  bottom: calc(150px + var(--safe-bottom));
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
  padding: 10px 12px;
  border: 1px solid rgba(104, 199, 255, 0.2);
  border-radius: 8px;
  background: linear-gradient(90deg, rgba(3, 12, 13, 0.88), rgba(4, 14, 22, 0.8));
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  box-shadow: 0 18px 56px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.hud-status strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.interaction-prompt {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: calc(76px + var(--safe-top));
  width: min(78vw, 420px);
  transform: translateX(-50%);
  padding: 9px 12px;
  border: 1px solid rgba(109, 255, 158, 0.2);
  border-radius: 8px;
  background: rgba(2, 9, 9, 0.68);
  color: rgba(239, 255, 249, 0.82);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 12px 42px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(14px);
  pointer-events: none;
  transition: opacity 240ms ease, transform 240ms ease;
}

.interaction-prompt.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-6px);
}

.control-layer {
  position: absolute;
  z-index: 4;
  left: 14px;
  right: 14px;
  bottom: calc(18px + var(--safe-bottom));
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  max-width: 520px;
  margin: 0 auto;
}

.move-pad {
  position: relative;
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 1px solid rgba(126, 255, 215, 0.24);
  border-radius: 999px;
  background:
    radial-gradient(circle, rgba(109, 255, 158, 0.18), transparent 43%),
    rgba(2, 10, 10, 0.58);
  box-shadow: inset 0 0 32px rgba(109, 255, 158, 0.12), 0 20px 70px rgba(0, 0, 0, 0.46);
  color: rgba(239, 255, 249, 0.62);
  font-size: 0.64rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
  touch-action: none;
  backdrop-filter: blur(18px);
}

.move-stick {
  position: absolute;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(239, 255, 249, 0.28);
  border-radius: 999px;
  background: radial-gradient(circle at 36% 30%, #ffffff, var(--green) 28%, rgba(15, 143, 85, 0.72));
  box-shadow: 0 0 28px rgba(109, 255, 158, 0.42);
  transform: translate3d(0, 0, 0);
  pointer-events: none;
}

.action-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  width: 132px;
}

.action-button {
  min-height: 46px;
  border: 1px solid rgba(239, 255, 249, 0.1);
  background: linear-gradient(180deg, rgba(3, 12, 13, 0.86), rgba(3, 8, 12, 0.78));
  color: rgba(239, 255, 249, 0.78);
  font-size: 0.82rem;
  font-weight: 950;
  letter-spacing: 0;
  text-transform: uppercase;
  box-shadow: 0 20px 70px rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(18px);
}

.action-button.primary {
  border-color: rgba(109, 255, 158, 0.54);
  background: linear-gradient(180deg, rgba(109, 255, 158, 0.28), rgba(24, 120, 78, 0.26));
  color: #ffffff;
  box-shadow: inset 0 0 24px rgba(109, 255, 158, 0.18), 0 0 28px rgba(109, 255, 158, 0.14);
}

.toast {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 50%;
  width: min(76vw, 360px);
  transform: translate(-50%, -50%) scale(0.96);
  padding: 14px 16px;
  border: 1px solid rgba(104, 199, 255, 0.28);
  border-radius: 8px;
  background: rgba(2, 9, 12, 0.78);
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
  line-height: 1.3;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(18px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

@keyframes signalPulse {
  0%,
  100% {
    transform: scale(0.9);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.18);
    opacity: 1;
  }
}

@media (min-width: 760px) {
  .hud-top {
    top: 24px;
    left: 24px;
    right: 24px;
  }

  .brand-lockup {
    padding: 12px 14px;
  }

  .hud-status {
    bottom: 24px;
    left: 24px;
    right: auto;
    width: min(520px, calc(100vw - 48px));
  }

  .control-layer {
    right: 24px;
    bottom: 24px;
    left: auto;
    width: 380px;
  }

  .move-pad {
    width: 122px;
    height: 122px;
  }

  .interaction-prompt {
    top: auto;
    bottom: 96px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .signal-dot {
    animation: none;
  }

  .interaction-prompt,
  .toast {
    transition: none;
  }
}
