:root {
  color-scheme: light;
  --surface-1: #fcfcfb;
  --page: #f9f9f7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);
  --seq-100: #cde2fb;
  --seq-200: #9ec5f4;
  --seq-300: #6da7ec;
  --seq-400: #3987e5;
  --seq-500: #256abf;
  --seq-600: #184f95;
  --seq-700: #0d366b;
  --other-fill: #e1e0d9;
  --other-text: #898781;
}

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --surface-1: #1a1a19;
    --page: #0d0d0d;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #898781;
    --gridline: #2c2c2a;
    --baseline: #383835;
    --border: rgba(255, 255, 255, 0.10);
    --other-fill: #383835;
    --other-text: #c3c2b7;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1: #1a1a19;
  --page: #0d0d0d;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);
  --other-fill: #383835;
  --other-text: #c3c2b7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
}

.page {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 20px 64px;
}

nav.topnav {
  display: flex;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-1);
  font-size: 14px;
}
nav.topnav a {
  color: var(--text-secondary);
  text-decoration: none;
}
nav.topnav a:hover, nav.topnav a.active {
  color: var(--text-primary);
  font-weight: 600;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
p.subtitle { color: var(--text-secondary); margin: 0 0 24px; font-size: 14px; }

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.filter-bar {
  border-bottom: 1px solid var(--border);
  padding: 6px 0;
  margin-bottom: 14px;
  font-size: 12px;
}
.filter-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.filter-presets button {
  padding: 3px 9px;
  font-size: 12px;
  border-radius: 6px;
}
.advanced-link {
  margin-left: auto;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}
.advanced-link:hover { color: var(--text-primary); }
/* .filter-advanced sets its own display, so the plain [hidden] UA rule (which this
   selector would otherwise outrank) needs to be reinstated explicitly here. */
.filter-advanced[hidden] { display: none; }
.filter-advanced {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--gridline);
}
.filter-advanced label { font-size: 12px; color: var(--text-secondary); }
.filter-advanced select, .filter-advanced button { padding: 3px 8px; font-size: 12px; }

.size-slider-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.size-slider-row input[type="range"] { width: 140px; }

.bubble-field-packed {
  position: relative;
  margin: 12px auto;
}

.bubble {
  position: absolute;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  border: none;
  font-family: inherit;
  color: white;
  padding: 8px;
  transition: transform 0.15s ease;
  z-index: 1;
}
.bubble:hover { transform: scale(1.04); z-index: 2; }
.bubble .bubble-label { font-weight: 600; line-height: 1.15; word-break: break-word; overflow-wrap: break-word; }
.bubble .bubble-count { opacity: 0.85; margin-top: 2px; word-break: break-word; }
.bubble.other {
  background: var(--other-fill) !important;
  color: var(--other-text) !important;
}

.view-toggle.active {
  background: var(--seq-400);
  color: white;
  border-color: transparent;
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--gridline);
}
th { color: var(--text-muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.artist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-bottom: 1px solid var(--gridline);
}
.artist-row img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--gridline); }
.artist-row .name { font-weight: 600; flex: 1; }
.artist-row .count { color: var(--text-secondary); font-size: 13px; }

button, .btn {
  background: var(--seq-400);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
button:hover, .btn:hover { background: var(--seq-500); }
button.secondary { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }

input, select {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-primary);
}

.mapping-row { display: flex; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--gridline); }
.mapping-row .genre-name { flex: 1; font-size: 14px; }
.mapping-row .genre-count { color: var(--text-muted); font-size: 12px; width: 70px; }

.empty-state { color: var(--text-muted); font-size: 14px; padding: 24px 0; text-align: center; }
.error-banner { background: #e34948; color: white; padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { width: 320px; text-align: center; }
.login-card input { width: 100%; margin: 12px 0; }
.login-card button { width: 100%; }
