:root {
  color-scheme: dark;
  --bg-top: #07111d;
  --bg-bottom: #04070d;
  --panel: rgba(7, 17, 29, 0.72);
  --panel-border: rgba(148, 163, 184, 0.22);
  --text-main: #eff6ff;
  --text-muted: #bfd3ea;
  --accent: #7dd3fc;
  --accent-strong: #38bdf8;
  --accent-warm: #fde68a;
  --shadow: 0 18px 60px rgba(2, 8, 23, 0.38);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "Avenir Next", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background:
    radial-gradient(circle at top, rgba(29, 78, 216, 0.2), transparent 34%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  color: var(--text-main);
  overflow: hidden;
  touch-action: manipulation;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(125, 211, 252, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(125, 211, 252, 0.06) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at center, black 42%, transparent 78%);
  pointer-events: none;
  opacity: 0.55;
}

body.vr-box-mode {
  background: #02050b;
}

#handVideo {
  position: fixed;
  width: 1px;
  height: 1px;
  top: 0;
  left: 0;
  opacity: 0;
  pointer-events: none;
}

.app-shell,
.stage {
  width: 100vw;
  width: 100dvw;
  height: 100vh;
  height: 100dvh;
}

.app-shell {
  position: relative;
}

.hud {
  position: absolute;
  z-index: 10;
  top: calc(var(--safe-top) + 1rem);
  left: calc(var(--safe-left) + 1rem);
  right: calc(var(--safe-right) + 1rem);
  display: grid;
  gap: 0.9rem;
  padding: 1rem 1.05rem;
  max-width: 34rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 1.1rem;
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.hud h1 {
  margin: 0;
  font-size: clamp(1.5rem, 4vw, 2.35rem);
  line-height: 1.02;
}

.intro,
.status,
.scene-note {
  margin: 0;
  color: var(--text-muted);
  line-height: 1.45;
}

.hud-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 0.88rem 1.2rem;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: #04111d;
  background: linear-gradient(135deg, var(--accent-warm), #fb923c);
  box-shadow: 0 12px 30px rgba(251, 146, 60, 0.28);
}

button + button {
  background: linear-gradient(135deg, #dbeafe, var(--accent-strong));
  box-shadow: 0 12px 30px rgba(56, 189, 248, 0.24);
}

button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.2);
  opacity: 0.58;
  box-shadow: none;
}

.stage {
  position: relative;
  isolation: isolate;
}

.eye {
  position: absolute;
  top: 0;
  bottom: 0;
  overflow: hidden;
}

.eye-left {
  left: 0;
  width: 50%;
  opacity: 0;
  visibility: hidden;
}

.eye-right {
  left: 0;
  width: 100%;
}

body.vr-box-mode .eye-left {
  opacity: 1;
  visibility: visible;
}

body.vr-box-mode .eye-right {
  left: 50%;
  width: 50%;
}

a-scene {
  display: block;
  width: 100%;
  height: 100%;
}

.scene-note {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 1rem);
  transform: translateX(-50%);
  width: min(32rem, calc(100% - 2rem));
  text-align: center;
  padding: 0.85rem 1rem;
  background: rgba(3, 7, 18, 0.52);
  border: 1px solid rgba(125, 211, 252, 0.14);
  border-radius: 999px;
  backdrop-filter: blur(14px);
}

body.vr-box-mode .hud {
  max-width: none;
  left: 50%;
  right: auto;
  top: auto;
  bottom: calc(var(--safe-bottom) + 0.75rem);
  width: min(30rem, calc(100% - 1.5rem));
  transform: translateX(-50%);
  gap: 0.65rem;
}

body.vr-box-mode .hud h1,
body.vr-box-mode .intro {
  display: none;
}

body.vr-box-mode .scene-note {
  bottom: calc(var(--safe-bottom) + 9.8rem);
  font-size: 0.92rem;
}

@media (max-width: 720px) {
  .hud {
    max-width: none;
  }

  .hud h1 {
    font-size: clamp(1.35rem, 7vw, 1.8rem);
  }

  .scene-note {
    width: calc(100% - 1.2rem);
    border-radius: 1rem;
  }
}
