*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0a0a0f;
  --accent: #7c6af7;
  --accent2: #a78bfa;
  --text: #e8e8f0;
  --muted: #6b7280;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--text);
}

#xr-canvas {
  position: fixed;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* ── Overlay ── */
#overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at center, #111122 0%, #0a0a0f 100%);
  transition: opacity 0.8s ease;
}

#overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

#overlay-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  text-align: center;
  padding: 40px;
}

#logo svg {
  animation: spin 12s linear infinite;
  opacity: 0.85;
}

@keyframes spin {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(360deg); }
}

#overlay-inner h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 300;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: linear-gradient(135deg, #e8e8f0 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#overlay-status {
  font-size: 0.9rem;
  color: var(--muted);
  letter-spacing: 0.05em;
  min-height: 1.4em;
}

/* Enter VR button */
#enter-vr-btn {
  margin-top: 10px;
  padding: 18px 56px;
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(135deg, var(--accent) 0%, #5b4ed8 100%);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 0 30px rgba(124, 106, 247, 0.4);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#enter-vr-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0 45px rgba(124, 106, 247, 0.6);
}

#enter-vr-btn:active {
  transform: scale(0.97);
}

/* Error message */
#error-msg {
  margin-top: 8px;
  padding: 14px 24px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 10px;
  color: #fca5a5;
  font-size: 0.85rem;
  max-width: 420px;
  line-height: 1.6;
}

/* ── HUD buttons (fullscreen + gyro) ── */
#hud {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 60;
  display: flex;
  gap: 10px;
  align-items: center;
}

#hud button {
  width: 42px;
  height: 42px;
  padding: 9px;
  background: rgba(6, 10, 22, 0.75);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

#hud button:hover {
  background: rgba(0, 180, 220, 0.18);
  border-color: rgba(0, 204, 238, 0.5);
  color: #00ccee;
}

#hud button.active {
  background: rgba(0, 180, 220, 0.25);
  border-color: #00ccee;
  color: #00ccee;
}

#hud button svg {
  width: 100%;
  height: 100%;
}

/* Desktop hint bar (shown when overlay fades out) */
#desktop-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  background: rgba(12, 10, 25, 0.75);
  border: 1px solid rgba(124, 106, 247, 0.3);
  border-radius: 30px;
  padding: 8px 22px;
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.04em;
  pointer-events: none;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

/* Dot-pulse loading indicator */
#overlay-status::after {
  content: '';
  display: inline-block;
  animation: dots 1.4s infinite;
}

@keyframes dots {
  0%   { content: ''; }
  25%  { content: '.'; }
  50%  { content: '..'; }
  75%  { content: '...'; }
  100% { content: ''; }
}
