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

:root {
  --navy: #0a0e27;
  --gold: #d4af37;
  --gold-light: #f0d878;
  --text: #f5f7ff;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Montserrat", system-ui, sans-serif;
  background: var(--navy);
  color: var(--text);
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(88, 42, 138, 0.4), transparent 50%),
    var(--navy);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-card {
  width: min(90vw, 420px);
  padding: 2rem;
  text-align: center;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 1rem;
  background: rgba(12, 16, 40, 0.9);
}

.loading-card h1 {
  margin: 0 0 0.5rem;
  color: var(--gold-light);
  font-size: 1.4rem;
}

.loading-card p {
  margin: 0 0 1.25rem;
  opacity: 0.8;
}

.loading-bar {
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.loading-fill {
  width: 30%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  animation: load-pulse 1.2s ease-in-out infinite;
}

@keyframes load-pulse {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(350%);
  }
}

#hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.25rem;
  background: rgba(10, 14, 39, 0.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212, 175, 55, 0.25);
  pointer-events: auto;
}

.hud-brand {
  color: var(--gold-light);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  text-transform: uppercase;
}

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

#hud button,
#info-panel button {
  padding: 0.5rem 1rem;
  border: 1px solid rgba(212, 175, 55, 0.55);
  border-radius: 999px;
  background: rgba(42, 27, 94, 0.65);
  color: var(--gold-light);
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

#hud button:hover,
#info-panel button:hover,
#hud #VRButton:hover {
  background: rgba(58, 38, 120, 0.85);
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.2);
}

#hud #VRButton {
  position: static !important;
  padding: 0.5rem 1rem !important;
  border: 1px solid rgba(212, 175, 55, 0.55) !important;
  border-radius: 999px !important;
  background: rgba(42, 27, 94, 0.65) !important;
  color: var(--gold-light) !important;
  font-family: inherit !important;
  font-weight: 600 !important;
  font-size: 0.85rem !important;
  opacity: 1 !important;
}

#info-panel {
  position: fixed;
  top: 4.5rem;
  right: 1rem;
  z-index: 12;
  width: min(90vw, 340px);
  padding: 1.25rem;
  border: 1px solid rgba(212, 175, 55, 0.35);
  border-radius: 0.85rem;
  background: rgba(12, 16, 40, 0.95);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  pointer-events: auto;
}

#info-panel h2 {
  margin: 0 0 0.75rem;
  color: var(--gold-light);
  font-size: 1.1rem;
}

#info-panel p,
#info-panel li {
  font-size: 0.88rem;
  line-height: 1.5;
  opacity: 0.9;
}

#info-panel ul {
  margin: 0.75rem 0 1rem;
  padding-left: 1.2rem;
}

#controls-help {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  z-index: 10;
  transform: translateX(-50%);
  padding: 0.6rem 1rem;
  border-radius: 999px;
  background: rgba(10, 14, 39, 0.8);
  border: 1px solid rgba(212, 175, 55, 0.25);
  font-size: 0.8rem;
  pointer-events: none;
}

#controls-help kbd {
  padding: 0.15rem 0.4rem;
  border-radius: 0.25rem;
  background: rgba(255, 255, 255, 0.1);
  font-family: inherit;
}

#mobile-pad {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 10;
  display: grid;
  gap: 0.25rem;
  pointer-events: auto;
}

#mobile-pad button {
  width: 3rem;
  height: 3rem;
  border: 1px solid rgba(212, 175, 55, 0.4);
  border-radius: 0.65rem;
  background: rgba(10, 14, 39, 0.8);
  color: var(--gold-light);
  font-size: 1rem;
  cursor: pointer;
}

.pad-row {
  display: flex;
  gap: 0.25rem;
}

body.exploring #hud,
body.exploring #info-panel,
body.exploring #controls-help,
body.exploring #mobile-pad {
  opacity: 0.35;
  transition: opacity 0.2s ease;
}

body.exploring #hud:hover,
body.exploring #info-panel:hover,
body.exploring #controls-help:hover,
body.exploring #mobile-pad:hover {
  opacity: 1;
}
