:root {
  color-scheme: dark;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  --bg: #05070d;
  --panel: rgba(7, 11, 20, 0.72);
  --line: rgba(255, 255, 255, 0.16);
  --text: #f8fbff;
  --muted: #aeb8c8;
  --cyan: #38e8ff;
  --hot: #ff477e;
  --lime: #9cff3b;
  --gold: #ffd166;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 12%, rgba(56, 232, 255, 0.2), transparent 28%),
    radial-gradient(circle at 78% 18%, rgba(255, 71, 126, 0.16), transparent 30%),
    linear-gradient(145deg, #04050a 0%, #111420 58%, #05070d 100%);
  color: var(--text);
}

button,
a {
  font: inherit;
}

.vr-shell {
  position: fixed;
  inset: 0;
  overflow: hidden;
}

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

.status-message {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  color: var(--text);
  font-size: clamp(34px, 9vw, 104px);
  font-weight: 950;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
  text-shadow:
    0 0 20px rgba(255, 255, 255, 0.72),
    0 0 56px rgba(56, 232, 255, 0.42),
    0 0 80px rgba(255, 71, 126, 0.34);
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

.status-message.is-visible {
  animation: statusPulse 1.6s ease-in-out infinite;
  opacity: 1;
}

@keyframes statusPulse {
  0%,
  100% {
    opacity: 0.55;
    transform: translate(-50%, -50%) scale(0.98);
  }

  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.02);
  }
}

.hud {
  position: fixed;
  top: max(18px, env(safe-area-inset-top));
  left: max(18px, env(safe-area-inset-left));
  right: max(18px, env(safe-area-inset-right));
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 16px;
  pointer-events: none;
}

.eyebrow,
.version,
.stats span,
.control-help {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
}

h1 {
  max-width: 560px;
  margin: 0;
  color: var(--text);
  font-size: clamp(32px, 5vw, 72px);
  line-height: 0.92;
  letter-spacing: 0;
  text-shadow:
    0 0 24px rgba(56, 232, 255, 0.44),
    0 0 48px rgba(255, 71, 126, 0.28);
}

.version {
  display: inline-flex;
  margin: 12px 0 0;
  padding: 5px 9px;
  border: 1px solid rgba(255, 209, 102, 0.34);
  border-radius: 999px;
  background: rgba(255, 209, 102, 0.08);
  color: var(--gold);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(86px, 1fr));
  gap: 8px;
}

.stats div,
.control-help {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(14px);
}

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

.stats span {
  display: block;
  margin-bottom: 6px;
}

.stats strong {
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.actions {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  pointer-events: auto;
}

button,
.actions a {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-weight: 900;
  text-decoration: none;
}

button:disabled {
  opacity: 0.52;
}

#enterVrButton,
#enterArButton,
#recenterButton,
#dropButton {
  border-color: transparent;
  background: linear-gradient(135deg, var(--cyan), var(--lime));
  color: #071018;
}

#enterArButton {
  background: linear-gradient(135deg, var(--hot), var(--gold));
}

#pauseButton,
#soundButton {
  background: rgba(7, 11, 20, 0.78);
}

.control-help {
  position: fixed;
  left: max(18px, env(safe-area-inset-left));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 2;
  max-width: min(500px, calc(100vw - 36px));
  padding: 12px 14px;
  line-height: 1.45;
}

.control-help p {
  margin: 0;
}

.control-help p + p {
  margin-top: 4px;
}

body.is-xr .hud,
body.is-xr .actions,
body.is-xr .status-message,
body.is-xr .control-help {
  display: none;
}

@media (max-width: 820px) {
  .hud {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions {
    left: max(18px, env(safe-area-inset-left));
  }

  .actions > * {
    flex: 1 1 120px;
  }

  .actions {
    max-height: 42vh;
    overflow: auto;
  }

  .control-help {
    display: none;
  }
}
