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

body {
  font-family: 'Inter', sans-serif;
  background: #0a0a1a;
  color: #e0e0e0;
  overflow: hidden;
  height: 100vh;
}

/* ── Top bar ─────────────────────────────────── */

#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(10, 10, 26, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  padding: 0 20px;
  z-index: 100;
  gap: 20px;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-shrink: 0;
}

.topbar-left h1 {
  font-size: 16px;
  font-weight: 700;
  color: #1DB954;
}

.subtitle {
  font-size: 11px;
  color: #666;
  font-weight: 400;
}

.topbar-center {
  flex: 1;
  max-width: 400px;
}

#searchInput {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #e0e0e0;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}

#searchInput:focus {
  border-color: #1DB954;
  background: rgba(255, 255, 255, 0.08);
}

#searchInput::placeholder { color: #555; }

.topbar-right {
  flex-shrink: 0;
}

.filter-toggles {
  display: flex;
  gap: 6px;
}

.filter-btn {
  padding: 5px 12px;
  border: 1px solid var(--cat-color);
  border-radius: 20px;
  background: transparent;
  color: var(--cat-color);
  font-size: 11px;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-btn.active {
  background: var(--cat-color);
  color: #0a0a1a;
}

.filter-btn:hover { opacity: 0.8; }

/* ── Graph container ─────────────────────────── */

#graphContainer {
  position: fixed;
  top: 56px;
  left: 0;
  right: 0;
  bottom: 36px;
}

/* ── Side panel ──────────────────────────────── */

#sidePanel {
  position: fixed;
  top: 56px;
  right: 0;
  width: 380px;
  bottom: 36px;
  background: rgba(15, 15, 30, 0.95);
  backdrop-filter: blur(12px);
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  padding: 20px;
  z-index: 50;
  transition: transform 0.3s ease;
}

#sidePanel.hidden {
  transform: translateX(100%);
}

#closePanel {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  color: #888;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

#closePanel:hover { color: #fff; }

/* Panel content */

.panel-title {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.panel-artist {
  font-size: 14px;
  color: #1DB954;
  margin-bottom: 16px;
}

.panel-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
  font-size: 12px;
  color: #888;
}

.panel-meta span { display: flex; align-items: center; gap: 4px; }

/* Fingerprint section */

.fp-section {
  margin-bottom: 20px;
}

.fp-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.fp-section-title.tonal { color: #4A90D9; }
.fp-section-title.rhythmic { color: #F39C12; }
.fp-section-title.emotional { color: #8E44AD; }
.fp-section-title.compositional { color: #27AE60; }

/* Connections list */

.connections-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  margin: 24px 0 12px;
}

.connection-item {
  padding: 10px 12px;
  margin-bottom: 6px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.2s;
}

.connection-item:hover {
  background: rgba(255, 255, 255, 0.06);
}

.connection-item .conn-song {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.connection-item .conn-artist {
  font-size: 11px;
  color: #888;
  margin-bottom: 4px;
}

.connection-item .conn-dimension {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 3px;
}

.connection-item .conn-note {
  font-size: 12px;
  color: #aaa;
  line-height: 1.4;
}

.connection-item[data-category="tonal"] { border-left-color: #4A90D9; }
.connection-item[data-category="tonal"] .conn-dimension { color: #4A90D9; }
.connection-item[data-category="rhythmic"] { border-left-color: #F39C12; }
.connection-item[data-category="rhythmic"] .conn-dimension { color: #F39C12; }
.connection-item[data-category="emotional"] { border-left-color: #8E44AD; }
.connection-item[data-category="emotional"] .conn-dimension { color: #8E44AD; }
.connection-item[data-category="compositional"] { border-left-color: #27AE60; }
.connection-item[data-category="compositional"] .conn-dimension { color: #27AE60; }

/* ── Bottom legend ───────────────────────────── */

#legend {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 36px;
  background: rgba(10, 10, 26, 0.92);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 0 20px;
  z-index: 100;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: #888;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.line {
  width: 16px;
  height: 2px;
  border-radius: 1px;
  display: inline-block;
}

.legend-sep {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.1);
}

/* ── Stats overlay ───────────────────────────── */

#statsOverlay {
  position: fixed;
  bottom: 44px;
  left: 12px;
  font-size: 11px;
  color: #444;
  z-index: 50;
}

/* ── Nav buttons ─────────────────────────────── */

.nav-btn {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #ccc;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.nav-btn:hover {
  background: rgba(29, 185, 84, 0.15);
  border-color: #1DB954;
  color: #1DB954;
}

/* ── Preference buttons ─────────────────────── */

.pref-buttons {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.pref-btn {
  flex: 1;
  padding: 6px 8px;
  border: 1px solid var(--pref-color);
  border-radius: 6px;
  background: transparent;
  color: var(--pref-color);
  font-size: 11px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}
.pref-btn.active {
  background: var(--pref-color);
  color: #0a0a1a;
}
.pref-btn:hover { opacity: 0.8; }

/* ── Scrollbar ───────────────────────────────── */

#sidePanel::-webkit-scrollbar { width: 4px; }
#sidePanel::-webkit-scrollbar-track { background: transparent; }
#sidePanel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }
