:root {
  --bg: #020204;
  --text: rgba(248, 248, 252, 0.94);
  --text-muted: rgba(255, 255, 255, 0.50);
  --glass: rgba(16, 16, 24, 0.64);
  --glass-border: rgba(255, 255, 255, 0.12);
  --active-bg: rgba(255, 255, 255, 0.95);
  --active-text: #08080c;
  --mood-glow: rgba(244, 114, 182, 0.18);
  --mood-secondary: rgba(56, 189, 248, 0.14);
}

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

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #020205;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.ambient-aura {
  position: fixed;
  inset: -10%;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 50% 44%, var(--mood-glow) 0%, transparent 48%),
    radial-gradient(circle at 56% 58%, var(--mood-secondary) 0%, transparent 56%),
    radial-gradient(circle at 50% 50%, #090912 0%, #020205 74%);
  transition: background 1.2s ease, opacity 0.8s ease;
}

#gl-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  z-index: 1;
}

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

.top-hud {
  position: fixed;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
  padding: 0 16px;
}

.title-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(14, 14, 22, 0.56);
  border: 1px solid rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  transition: opacity 0.35s ease, border-color 0.6s ease;
  white-space: nowrap;
}

.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f472b6;
  box-shadow: 0 0 10px #f472b6;
  transition: background 0.8s ease, box-shadow 0.8s ease;
  animation: pulseDot 2.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.35); opacity: 1; }
}

.title-pill #flower-label {
  color: rgba(255, 255, 255, 0.88);
}

.title-pill .stats-text {
  color: rgba(125, 211, 252, 0.90);
  letter-spacing: 0.14em;
}

.title-pill .sep {
  opacity: 0.42;
}

/* Left Butterfly Controls */
.left-controls {
  position: fixed;
  top: 18px;
  left: 20px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  z-index: 12;
}

.control-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.group-label {
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.56);
  padding: 0 6px 0 10px;
}

.seg-pills {
  display: inline-flex;
  gap: 2px;
}

.seg-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.seg-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
}

.seg-btn.active {
  background: rgba(255, 255, 255, 0.92);
  color: #090910;
}

.pill-action {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease;
}

.pill-action svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.pill-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.pill-action:active {
  transform: scale(0.96);
}

.pill-action.flash {
  background: rgba(125, 211, 252, 0.24);
  color: #e0f2fe;
}

.species-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: conic-gradient(#38bdf8, #fb923c, #34d399, #e879f9, #facc15, #f472b6, #38bdf8);
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.4);
  flex: none;
}

/* Right Icon Controls */
.hint-controls {
  position: fixed;
  top: 18px;
  right: 20px;
  display: flex;
  gap: 7px;
  z-index: 12;
  opacity: 0.74;
  transition: opacity 0.25s ease;
}

.hint-controls:hover {
  opacity: 1;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: var(--glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: rgba(255, 255, 255, 0.78);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.18s ease, background 0.2s ease, color 0.2s ease, border-color 0.2s ease, box-shadow 0.25s ease;
}

.icon-btn svg {
  width: 15px;
  height: 15px;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  transform: translateY(-1px);
}

.icon-btn.active {
  border-color: rgba(255, 255, 255, 0.45);
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.15);
}

.gesture-hint {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.46);
  pointer-events: none;
  z-index: 9;
  white-space: nowrap;
  transition: opacity 0.8s ease;
}

.gesture-hint.hidden {
  opacity: 0;
}

/* Bottom Flower Dock */
.dock-wrap {
  position: fixed;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  padding: 0 16px;
  z-index: 10;
  pointer-events: none;
}

.dock {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.dock::-webkit-scrollbar {
  display: none;
}

.dock-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.66);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: background 0.25s ease, color 0.25s ease, transform 0.18s ease, box-shadow 0.25s ease;
}

.dock-btn .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c, #fff);
  box-shadow: 0 0 8px var(--c, #fff);
  opacity: 0.78;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.dock-btn:hover {
  color: rgba(255, 255, 255, 0.94);
  background: rgba(255, 255, 255, 0.07);
}

.dock-btn.active {
  background: var(--active-bg);
  color: var(--active-text);
  box-shadow: 0 4px 18px rgba(255, 255, 255, 0.18);
}

.dock-btn.active .dot {
  opacity: 1;
  transform: scale(1.12);
}

@media (max-width: 900px) {
  .top-hud {
    top: 12px;
  }
  .left-controls {
    top: 56px;
    left: 12px;
    flex-direction: row;
    flex-wrap: wrap;
    max-width: calc(100vw - 24px);
  }
  .hint-controls {
    top: auto;
    bottom: 76px;
    right: 12px;
  }
  .gesture-hint {
    display: none;
  }
  .hide-sm {
    display: none;
  }
}

@media (max-width: 640px) {
  .title-pill {
    font-size: 10px;
    letter-spacing: 0.12em;
    padding: 6px 12px;
  }
  .dock-btn {
    font-size: 11.5px;
    padding: 7px 11px;
  }
  .icon-btn {
    width: 30px;
    height: 30px;
  }
}
