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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #6498db;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Inter, sans-serif;
  color: #f6f4ec;
  user-select: none;
}

#app {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
}

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

/* Loading screen */
#loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, rgba(132, 178, 224, 0.96), rgba(38, 72, 68, 0.98));
  transition: opacity 0.7s ease, visibility 0.7s ease;
}

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

.loading-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px 34px;
  border-radius: 18px;
  background: rgba(20, 36, 34, 0.42);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 246, 230, 0.18);
  box-shadow: 0 18px 42px rgba(10, 22, 20, 0.35);
}

.loading-spinner {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 246, 230, 0.25);
  border-top-color: #d9e87a;
  animation: spin 0.9s linear infinite;
}

.loading-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #fff8eb;
}

.loading-sub {
  font-size: 12px;
  color: rgba(240, 244, 235, 0.75);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Glassmorphic HUD */
.hud {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 20;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.hud.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.hud-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(18, 34, 32, 0.48);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 248, 232, 0.16);
  box-shadow: 0 8px 28px rgba(8, 18, 16, 0.28);
}

.hud-btn {
  appearance: none;
  border: 1px solid rgba(255, 248, 232, 0.2);
  background: rgba(255, 250, 240, 0.1);
  color: #f8f6ee;
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}

.hud-btn:hover {
  background: rgba(255, 250, 240, 0.2);
  border-color: rgba(255, 248, 232, 0.36);
}

.hud-btn:active {
  transform: scale(0.97);
}

.hud-btn.active {
  background: rgba(164, 214, 92, 0.26);
  border-color: rgba(196, 238, 122, 0.55);
  color: #f7ffe6;
}

.hud-btn-ghost {
  background: transparent;
  border-color: transparent;
  color: rgba(246, 244, 236, 0.78);
}

.hud-control {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px;
  font-size: 12px;
  color: rgba(248, 246, 238, 0.9);
}

.hud-control input[type='range'] {
  width: 78px;
  height: 4px;
  accent-color: #b8dc63;
  cursor: pointer;
}

.hud-restore {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 20;
  appearance: none;
  border: 1px solid rgba(255, 248, 232, 0.22);
  background: rgba(18, 34, 32, 0.46);
  backdrop-filter: blur(12px);
  color: #f8f6ee;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.hud-restore.hidden {
  opacity: 0;
  pointer-events: none;
}
