#viz-legend {
  position: fixed;
  top: 102px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 15px;
  background: rgba(16, 18, 23, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  z-index: 900;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.78);
  pointer-events: none;
  white-space: nowrap;
}

.vl-bar {
  width: 120px;
  height: 8px;
  border-radius: 4px;
}
.vl-density {
  background: linear-gradient(90deg, #0d3b66, #2a9d8f, #e76f9e, #ffd1e8);
}
.vl-item {
  display: flex;
  align-items: center;
  gap: 5px;
}
.vl-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}
.vl-label { color: rgba(255, 255, 255, 0.6); }

/* Compact layout: the metrics row takes the space under the title, so the legend moves
   down to sit just above the timeline. */
@media (max-width: 820px) {
  #viz-legend { top: auto; bottom: 114px; font-size: 10.5px; padding: 6px 12px; gap: 8px; }
  .vl-bar { width: 90px; }
}
