:root {
  --bg-primary: #030407;
  --bg-panel: rgba(10, 13, 20, 0.82);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(255, 255, 255, 0.16);
  --accent-cyan: #93c5fd;
  --accent-blue: #60a5fa;
  --accent-amber: #fde047;
  --accent-emerald: #34d399;
  --text-main: #f1f5f9;
  --text-muted: #64748b;
  --font-mono: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-primary);
  font-family: var(--font-sans);
  color: var(--text-main);
}

#canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

/* Glassmorphism Panels */
.hud-panel {
  position: absolute;
  z-index: 10;
  background: var(--bg-panel);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: all 0.2s ease;
}

/* Top Header Bar */
#top-bar {
  top: 16px;
  left: 16px;
  right: 16px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-symbol {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(226, 232, 240, 0.7);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-symbol::after {
  content: '';
  width: 6px;
  height: 6px;
  background: #f8fafc;
  border-radius: 50%;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #f8fafc;
}

.brand-sub {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-left: 4px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Primary and Ghost Buttons */
button, select {
  font-family: var(--font-mono);
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  outline: none;
}

button:hover, select:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

button:active {
  transform: scale(0.98);
}

button.active {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 600;
  border-color: #f1f5f9;
}

/* Audio Status Wave */
.audio-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-glass);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-muted);
  cursor: pointer;
}

.wave-bar {
  width: 2.5px;
  height: 10px;
  background: var(--text-main);
  border-radius: 1px;
  animation: waveAnim 1.2s infinite ease-in-out;
}
.wave-bar:nth-child(2) { animation-delay: 0.2s; height: 14px; }
.wave-bar:nth-child(3) { animation-delay: 0.4s; height: 8px; }

@keyframes waveAnim {
  0%, 100% { transform: scaleY(0.4); opacity: 0.4; }
  50% { transform: scaleY(1.1); opacity: 0.9; }
}

.audio-muted .wave-bar {
  animation: none;
  transform: scaleY(0.2);
  background: var(--text-muted);
}

/* Telemetry HUD Top Right */
#telemetry-hud {
  top: 80px;
  right: 16px;
  width: 220px;
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 10.5px;
}

.hud-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 7px;
  color: var(--text-muted);
}

.hud-row:last-child {
  margin-bottom: 0;
}

.hud-val {
  color: var(--text-main);
  font-weight: 500;
}

/* Floating Bottom Control Deck */
#control-deck {
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-label {
  font-size: 9.5px;
  font-family: var(--font-mono);
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}

/* Mass Selector Pills */
.mass-pills {
  display: flex;
  gap: 4px;
}

.mass-btn {
  padding: 5px 9px;
  font-size: 11px;
  border-radius: 5px;
}

/* Sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 95px;
  height: 3px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 2px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f8fafc;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  transition: transform 0.1s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

/* Helper Tooltip overlay */
#interaction-hint {
  position: absolute;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(5, 7, 12, 0.75);
  padding: 5px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0.85;
  transition: opacity 0.5s ease;
}

/* Mobile responsiveness */
@media (max-width: 840px) {
  #top-bar { height: auto; flex-wrap: wrap; padding: 10px; gap: 8px; }
  #telemetry-hud { display: none; }
  #control-deck {
    width: calc(100% - 32px);
    overflow-x: auto;
    bottom: 12px;
    padding: 8px 12px;
    justify-content: flex-start;
  }
}
