:root {
  --bg-glass: rgba(20, 24, 38, 0.62);
  --bg-glass-strong: rgba(20, 24, 38, 0.78);
  --border-glass: rgba(255, 255, 255, 0.18);
  --text-main: #f9fafb;
  --text-muted: rgba(249, 250, 251, 0.72);
  --accent-pink: #ff6b9d;
  --accent-mint: #4de6b8;
  --accent-gold: #ffd166;
  --shadow-soft: 0 12px 32px rgba(10, 14, 26, 0.35);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a2238;
  font-family: ui-rounded, "SF Pro Rounded", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--text-main);
  user-select: none;
}

#gl-canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: grab;
  touch-action: none;
}

#gl-canvas:active {
  cursor: grabbing;
}

#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
  z-index: 10;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.title-badge {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
}

.badge-icon {
  font-size: 26px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.25));
}

.title-badge h1 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.title-badge .subtitle {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.top-actions {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border-glass);
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text-main);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.14s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.pill-btn:hover {
  transform: translateY(-1px);
  background: var(--bg-glass-strong);
}

.pill-btn:active {
  transform: translateY(1px) scale(0.98);
}

.pill-btn.primary {
  background: linear-gradient(135deg, #ff6b9d, #ff8e53);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.pill-btn.primary.playing {
  background: linear-gradient(135deg, #2ec4b6, #3a86ff);
}

.pill-btn.primary.pulse {
  animation: soft-pulse 2s infinite;
}

.pill-btn.icon-only {
  padding: 10px 12px;
}

@keyframes soft-pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(255, 107, 157, 0.55), var(--shadow-soft);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 107, 157, 0), var(--shadow-soft);
  }
}

.control-panel {
  pointer-events: auto;
  position: fixed;
  top: 76px;
  right: 18px;
  width: 268px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-glass);
  border-radius: 18px;
  box-shadow: var(--shadow-soft);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.control-panel.collapsed {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
}

.panel-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.group-label {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.btn-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.btn-row:has(:nth-child(3):last-child) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chip-btn,
.action-btn {
  padding: 7px 8px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
  white-space: nowrap;
}

.chip-btn:hover,
.action-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.chip-btn:active,
.action-btn:active {
  transform: scale(0.96);
}

.chip-btn.active {
  background: rgba(77, 230, 184, 0.24);
  border-color: var(--accent-mint);
  color: #ffffff;
  box-shadow: inset 0 0 0 1px rgba(77, 230, 184, 0.35);
}

.action-btn.accent {
  background: rgba(255, 209, 102, 0.2);
  border-color: rgba(255, 209, 102, 0.55);
}

.action-btn.accent:hover {
  background: rgba(255, 209, 102, 0.34);
}

.compact-row {
  gap: 4px;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent-pink);
  cursor: pointer;
  height: 5px;
}

.hud-hint {
  align-self: center;
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(15, 19, 32, 0.52);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 12px;
  color: var(--text-muted);
  transition: opacity 0.4s ease;
}

.hud-hint strong {
  color: var(--accent-gold);
}

@media (max-width: 680px) {
  .control-panel {
    top: auto;
    bottom: 54px;
    right: 12px;
    left: 12px;
    width: auto;
  }
  .hud-hint {
    font-size: 11px;
    text-align: center;
  }
}
