:root {
  /* Major-genre palette — chosen to be distinguishable side by side. */
  --c-rock: #d94f4f;
  --c-punk: #ff7a3d;
  --c-metal: #4a4a4a;
  --c-pop: #ec6fb4;
  --c-hiphop: #f2c84b;
  --c-electronic: #4ec6e0;
  --c-jazz: #8a5cd6;
  --c-folkcountry: #c89c5a;
  --c-soul: #b86b3a;
  --c-global: #4ab37a;
  --c-experimental: #a0a0a0;
  --c-other: #6b6b6b;

  --bg: #f7f4ec;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --rule: #d8d4c6;
  --card-bg: #ffffff;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 2px 6px rgba(0, 0, 0, 0.08), 0 10px 24px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv02";
}

/* Header */
.site-header {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 16px;
}

.title-block h1 {
  font-size: clamp(28px, 4vw, 44px);
  margin: 0;
  letter-spacing: -0.02em;
  font-weight: 800;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.subtitle a {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--rule);
}
.subtitle a:hover {
  text-decoration-color: var(--fg);
}

.filter-bar {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 32px;
}

.reset-btn {
  font: inherit;
  font-size: 13px;
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--fg);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.reset-btn:hover {
  background: #fff;
}

.filter-trail {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--muted);
}
.filter-trail .crumb {
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  color: var(--fg);
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--rule);
  cursor: default;
}
button.crumb {
  cursor: pointer;
  transition: filter 0.15s ease;
}
button.crumb:hover {
  filter: brightness(1.08);
}
.filter-trail .crumb.major {
  color: #fff;
  border-color: transparent;
}
.filter-trail .sep {
  opacity: 0.5;
}

/* Map */
.map-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 12px;
}

.genre-map {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 620px;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
}

.genre-map svg {
  display: block;
  width: 100%;
  height: 100%;
  font-family: inherit;
}

.bubble {
  cursor: pointer;
  transition: filter 0.2s ease;
}
.bubble:hover {
  filter: brightness(1.06);
}
.bubble.major > circle {
  stroke: rgba(0, 0, 0, 0.07);
  stroke-width: 1;
}
.bubble.sub > circle {
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 1;
}

.bubble-label {
  font-weight: 700;
  fill: #fff;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}
.bubble-count {
  font-weight: 500;
  fill: rgba(255, 255, 255, 0.85);
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.map-hint {
  margin: 10px 4px 0;
  font-size: 13px;
  color: var(--muted);
}

/* Grid */
.grid-section {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 24px 80px;
}

.grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.grid-header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.grid-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.grid-header h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.grid-count {
  color: var(--muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.sort-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.sort-control select {
  font: inherit;
  font-size: 13px;
  color: var(--fg);
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 6px 28px 6px 12px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10'><path fill='%236b6b6b' d='M2 3h6L5 7z'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.sort-control select:focus {
  outline: 2px solid rgba(26, 26, 26, 0.3);
  outline-offset: 1px;
}
.sort-dir {
  font: inherit;
  font-size: 14px;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.sort-dir:hover {
  background: var(--bg);
}

.album-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 22px 18px;
}

.album-grid.only-missing > .album-card[data-has-art="true"] {
  display: none;
}

@media (max-width: 600px) {
  .album-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 18px 14px;
  }
}

.album-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

a.album-cover {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: var(--card-bg);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease;
}

a.album-cover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.album-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.album-cover img.loaded {
  opacity: 1;
}

.album-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 2px;
}

.album-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  line-height: 1.25;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.album-artist {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.album-year {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 0 0;
  font-variant-numeric: tabular-nums;
}

.album-subgenres {
  margin: 4px 0 0;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.album-subgenres .tag {
  font-size: 10.5px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s ease;
}
.album-subgenres .tag:hover {
  background: rgba(0, 0, 0, 0.08);
  color: var(--fg);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
  font-size: 14px;
}

/* Footer + scan status */
.site-footer {
  max-width: 1280px;
  margin: 0 auto;
  padding: 8px 24px 32px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}
.site-footer p {
  margin: 0;
}

.scan-status {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
  font-size: 12px;
}

.scan-status-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.scan-status-title {
  font-weight: 600;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.scan-equation {
  font-size: 13px;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}
.scan-equation .eq-total {
  font-weight: 600;
}
.scan-equation .eq-retrieved {
  color: #2f8a5b;
  font-weight: 600;
}
.scan-equation .eq-remaining {
  font-weight: 600;
}
.scan-equation.zero-remaining .eq-remaining {
  color: #2f8a5b;
}
.scan-equation.has-remaining .eq-remaining {
  color: #b8580c;
}

.scan-rows {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
}

.missing-filter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--fg);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  padding: 2px 0;
}
.missing-filter input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: var(--c-rock);
}

.scan-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: #fff;
  cursor: default;
  transition:
    background 0.2s ease,
    border-color 0.2s ease;
}

.scan-row input[type="checkbox"] {
  width: 13px;
  height: 13px;
  cursor: default;
  accent-color: var(--c-global);
  margin: 0;
}

.scan-name {
  font-weight: 500;
  color: var(--fg);
}

.scan-detail {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 11px;
}

.scan-row.done {
  background: #eaf6ef;
  border-color: #b8dec5;
}
.scan-row.done .scan-detail {
  color: #2f8a5b;
}

.scan-row.disabled {
  opacity: 0.55;
  background: #f3f1ea;
  border-color: var(--rule);
}
.scan-row.disabled .scan-detail {
  color: var(--muted);
  font-style: italic;
}
.scan-row.disabled.done {
  background: #f3f1ea;
}
.scan-row.disabled.done .scan-detail {
  color: var(--muted);
}
