:root {
  --bg-main: #121212;
  --bg-card: rgba(24, 24, 24, 0.85);
  --bg-card-hover: rgba(40, 40, 40, 0.95);
  --bg-input: #2a2a2a;
  --spotify-green: #1db954;
  --spotify-green-hover: #1ed760;
  --text-main: #ffffff;
  --text-muted: #b3b3b3;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --glass-border: rgba(255, 255, 255, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --shadow-main: 0 10px 30px rgba(0, 0, 0, 0.5);
  --font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

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

body {
  background-color: var(--bg-main);
  background-image: radial-gradient(circle at 10% 20%, rgba(29, 185, 84, 0.08) 0%, transparent 40%),
                    radial-gradient(circle at 90% 80%, rgba(29, 185, 84, 0.05) 0%, transparent 40%);
  color: var(--text-main);
  font-family: var(--font-family);
  min-height: 100vh;
  padding: 20px;
  display: flex;
  justify-content: center;
}

.app-container {
  width: 100%;
  max-width: 1100px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-main);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-left: auto;
  margin-right: 8px;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-links a:hover {
  color: var(--text-main, #fff);
  border-bottom-color: var(--spotify-green);
}

.spotify-icon {
  width: 34px;
  height: 34px;
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(90deg, #ffffff, var(--text-muted));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.app-version {
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--spotify-green);
}

.user-name {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Cards & Layout */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-main);
}

/* Auth Card */
.auth-card {
  max-width: 500px;
  margin: 40px auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.auth-header h2 {
  font-size: 1.5rem;
  margin-bottom: 8px;
}

.auth-header p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

input[type="text"],
textarea.form-select,
.form-select {
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

textarea.form-select {
  resize: vertical;
  min-height: 180px;
  line-height: 1.45;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
  font-size: 0.85rem;
}

input[type="text"]:focus,
textarea.form-select:focus,
.form-select:focus {
  outline: none;
  border-color: var(--spotify-green);
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.2);
}

/* Buttons */
.btn-primary {
  background-color: var(--spotify-green);
  color: #000;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 24px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background-color: var(--spotify-green-hover);
  transform: scale(1.02);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  border: 1px solid var(--border-subtle);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 8px 16px;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.15);
}

.btn-secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-create-playlist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--spotify-green);
  color: #000;
  border: 1px solid transparent;
  font-weight: 700;
}

.btn-create-playlist:hover:not(:disabled) {
  background: var(--spotify-green-hover);
  color: #000;
}

.btn-create-playlist:disabled {
  opacity: 0.45;
  background: var(--spotify-green);
  color: #000;
}

.btn-create-playlist-icon {
  flex-shrink: 0;
  display: block;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

/* Streaming History Import */
.history-import-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.history-help {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.history-help a {
  color: var(--spotify-green);
  font-weight: 600;
  text-decoration: none;
}

.history-help a:hover {
  text-decoration: underline;
}

.history-help code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.82rem;
}

.history-import-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.history-file-label {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.history-import-status {
  font-size: 0.88rem;
  color: var(--text-muted);
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

.history-import-status.ready {
  color: #d4f5df;
  border-color: rgba(29, 185, 84, 0.35);
  background: rgba(29, 185, 84, 0.1);
}

.disk-cache-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.disk-cache-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.disk-cache-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.disk-cache-item-title {
  font-weight: 700;
  font-size: 0.9rem;
}

.disk-cache-item-sub {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.disk-cache-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  justify-content: flex-end;
}

.play-count-badge {
  background: rgba(29, 185, 84, 0.15) !important;
  border-color: rgba(29, 185, 84, 0.4) !important;
  color: var(--spotify-green) !important;
  font-weight: 700 !important;
}

.play-count-missing {
  opacity: 0.55;
  font-style: italic;
}

.history-warning {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #f0c674;
}

/* Control Panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.panel-header h3 {
  font-size: 1.2rem;
  font-weight: 700;
}

.badge {
  background: rgba(29, 185, 84, 0.15);
  color: var(--spotify-green);
  border: 1px solid rgba(29, 185, 84, 0.3);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.report-controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.report-criteria-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.genre-search-group {
  min-width: 280px;
  flex: 1;
}

.market-select-group {
  min-width: 200px;
}

.market-select-group .form-select {
  min-width: 200px;
  max-width: 280px;
}

.genre-autocomplete {
  position: relative;
  width: 100%;
}

.genre-search-input {
  width: 100%;
}

.genre-suggestions {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 6px 0;
  list-style: none;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.genre-suggestion-item {
  padding: 8px 14px;
  cursor: pointer;
  color: var(--text-main);
  font-size: 0.92rem;
}

.genre-suggestion-item:hover,
.genre-suggestion-item.is-active {
  background: rgba(29, 185, 84, 0.16);
  color: #fff;
}

/* Children join the parent 3-column grid (type + range + limit) */
.dynamic-params {
  display: contents;
}

@media (max-width: 800px) {
  .report-criteria-row {
    grid-template-columns: 1fr;
  }
}

.control-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
}

.export-dropdown-wrapper {
  display: flex;
  gap: 8px;
}

/* Loader & Status */
.status-container {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  padding: 30px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  color: var(--text-muted);
}

.status-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
  max-width: 52rem;
  width: 100%;
}

.status-timer {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.status-timer.status-timer--warn {
  color: #ffb020;
}

.status-timer.status-timer--hot {
  color: #ff6b6b;
}

.status-pipeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.status-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--text-muted);
  opacity: 0.55;
}

.status-step--done {
  opacity: 0.85;
  color: var(--spotify-green);
}

.status-step--active {
  opacity: 1;
  color: var(--text-main);
  font-weight: 600;
}

.status-step--pending {
  opacity: 0.45;
}

.status-step-mark {
  flex: 0 0 1.25rem;
  text-align: center;
}

#status-message {
  white-space: pre-line;
  text-align: left;
  line-height: 1.45;
  font-size: 0.92rem;
  color: var(--text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--spotify-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* Results Section Header & Filter Bar */
.results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  gap: 12px;
  flex-wrap: wrap;
}

.report-playlist-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.report-playlist-actions + .report-edit-actions {
  margin-left: 0;
}

.btn-open-spotify-playlist {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--spotify-green);
  color: #000 !important;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none !important;
  border: none;
  white-space: nowrap;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-open-spotify-playlist:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  color: #000 !important;
}

.report-edit-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.report-output-container.is-editing .filter-sort-bar {
  opacity: 0.45;
  pointer-events: none;
  user-select: none;
}

.edit-row-tools {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.report-output-container.is-editing .edit-row-tools {
  display: flex;
}

.edit-move-btn {
  width: 32px;
  min-width: 32px;
  height: 28px;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  font-weight: 700;
}

.edit-move-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.edit-delete-btn {
  white-space: nowrap;
  font-size: 0.75rem;
  padding: 4px 8px;
  color: #ff8a8a;
  border-color: rgba(255, 100, 100, 0.35);
}

.track-row.is-edit-focused,
.artist-card-row.is-edit-focused,
.album-row.is-edit-focused,
.timeline-item.is-edit-focused {
  outline: 2px solid var(--spotify-green, #1db954);
  outline-offset: 2px;
}

.report-output-container.is-editing .track-row,
.report-output-container.is-editing .artist-card-row,
.report-output-container.is-editing .album-row,
.report-output-container.is-editing .timeline-item {
  cursor: default;
}

.results-title {
  font-size: 1.3rem;
  font-weight: 700;
}

.results-title.is-title-editing {
  width: 100%;
  max-width: min(720px, 100%);
}

.report-title-input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid rgba(29, 185, 84, 0.55);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-main);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
  outline: none;
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.15);
}

.report-title-input:focus {
  border-color: var(--spotify-green);
  box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.28);
}

.results-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Filter & Sort Bar */
.filter-sort-bar {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(24, 24, 24, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
}

/* Collapsible genres (same UX as share pages): chips under All genres */
.filter-sort-bar .genre-filter-header {
  display: none;
}

.filter-sort-bar .sort-controls {
  display: none;
}

#track-all-genres-chip::after,
#artist-all-genres-chip::after {
  content: " ▾";
  font-size: 0.85em;
  opacity: 0.85;
}

.filter-sort-bar:not(.is-collapsed) #track-all-genres-chip::after,
.filter-sort-bar:not(.is-collapsed) #artist-all-genres-chip::after {
  content: " ▴";
}

.filter-sort-bar.is-collapsed .genre-filter-wrapper,
.filter-sort-bar.is-collapsed .genre-chips-container {
  display: none !important;
}

.filter-sort-bar.is-collapsed {
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border-color: transparent;
}

.artist-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.artist-controls-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.year-range-control {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  flex: 0 1 360px;
  min-width: 220px;
  max-width: 420px;
  margin-left: auto;
}

.year-range-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  line-height: 1.2;
}

.year-range-control[hidden] {
  display: none !important;
}

.year-range-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.year-range-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  min-width: 2.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.year-range-slider {
  position: relative;
  flex: 1;
  height: 28px;
  display: flex;
  align-items: center;
  direction: rtl; /* recent (max) left, oldest (min) right */
}

.year-range-track {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  pointer-events: none;
  transform: translateY(-50%);
}

.year-range-fill {
  position: absolute;
  top: 50%;
  height: 4px;
  border-radius: 999px;
  background: var(--spotify-green);
  pointer-events: none;
  transform: translateY(-50%);
}

.year-range-slider input[type="range"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 28px;
  margin: 0;
  padding: 0;
  appearance: none;
  background: transparent;
  pointer-events: none;
}

.year-range-slider input[type="range"]::-webkit-slider-runnable-track {
  height: 28px;
  background: transparent;
}

.year-range-slider input[type="range"]::-moz-range-track {
  height: 28px;
  background: transparent;
  border: 0;
}

.year-range-slider input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 16px;
  height: 16px;
  margin-top: 6px; /* center in 28px track area: (28-16)/2 */
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--spotify-green);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.year-range-slider input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid var(--spotify-green);
  border-radius: 50%;
  background: #fff;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 2;
}

.year-range-slider input[data-year-range="min"] {
  z-index: 3;
}

.year-range-slider input[data-year-range="max"] {
  z-index: 4;
}

.filter-chip.sort-chip {
  border-color: rgba(29, 185, 84, 0.35);
}

.filter-chip.sort-dir-chip {
  min-width: 2.4em;
  padding-left: 10px;
  padding-right: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  border-color: rgba(29, 185, 84, 0.35);
}

.sort-dropdown {
  position: relative;
  display: inline-flex;
}

.sort-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 180px;
  padding: 6px;
  border-radius: 12px;
  background: #181818;
  border: 1px solid var(--border-subtle);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sort-menu[hidden] {
  display: none !important;
}

.sort-menu-item {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-main);
  text-align: left;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.sort-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sort-menu-item.is-active {
  color: #fff;
  background: rgba(29, 185, 84, 0.18);
}

.sort-menu-sep {
  height: 1px;
  margin: 4px 6px;
  background: rgba(255, 255, 255, 0.08);
}

.sort-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.genre-filter-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.genre-filter-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.active-filters-count {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--spotify-green);
}

.genre-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-height: 140px;
  overflow-y: auto;
  padding-right: 4px;
}

.genre-chips-container::-webkit-scrollbar {
  width: 4px;
}

.genre-chips-container::-webkit-scrollbar-thumb {
  background: var(--bg-input);
  border-radius: 4px;
}

.filter-chip {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border-subtle);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.filter-chip:hover {
  background: rgba(255, 255, 255, 0.14);
  color: var(--text-main);
}

.filter-chip.active {
  background: var(--spotify-green);
  color: #000;
  font-weight: 700;
  border-color: var(--spotify-green);
  box-shadow: 0 0 12px rgba(29, 185, 84, 0.35);
}

.genre-tag.active-tag {
  background: var(--spotify-green);
  color: #000;
  font-weight: 700;
}

/* Albums list (Top Albume) */
.albums-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.album-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  transition: all 0.25s ease;
}

.album-row:hover {
  background: var(--bg-card-hover);
  transform: translateX(4px);
  border-color: rgba(29, 185, 84, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.album-cover-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  font-size: 1.4rem;
  font-weight: 800;
}

.track-row {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
  transition: all 0.25s ease;
}

.track-row:hover {
  background: var(--bg-card-hover);
  transform: translateX(4px);
  border-color: rgba(29, 185, 84, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.track-row.is-filter-hidden,
.artist-card-row.is-filter-hidden {
  display: none !important;
}

.track-row > .rank-badge {
  order: 1;
}

.track-row > .cover-art-link,
.track-row > .cover-art-large {
  order: 2;
}

.track-row > .track-details {
  order: 3;
}

.track-row > .track-meta-side {
  order: 4;
}

.track-row > .album-mates {
  order: 5;
  flex: 1 1 100%;
  flex-basis: 100%;
  max-width: none;
  width: 100%;
  min-width: 100%;
  margin-top: 0;
}

.cover-art-large {
  width: 68px;
  height: 68px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.track-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.track-header-line {
  display: flex;
  align-items: center;
  gap: 10px;
}

.track-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.artist-name {
  color: #e0e0e0;
  font-weight: 600;
}

a.artist-link,
a.album-link,
a.album-mate-artist-link {
  color: inherit;
  font-weight: inherit;
  text-decoration: none;
}

a.artist-link:hover,
a.album-link:hover,
a.album-mate-artist-link:hover {
  color: var(--spotify-green);
  text-decoration: none;
}

a.cover-art-link {
  display: block;
  flex-shrink: 0;
  line-height: 0;
  border-radius: 6px;
  overflow: hidden;
}

a.cover-art-link:hover {
  opacity: 0.92;
}

.meta-dot {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.8rem;
}

.album-info strong {
  color: var(--text-main);
}

.explicit-badge {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.track-meta-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 200px;
  flex-shrink: 0;
}

.meta-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.info-badge {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 500;
}

.heat-score-badge {
  color: #1ed760;
  border-color: rgba(30, 215, 96, 0.35);
  background: rgba(30, 215, 96, 0.1);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.bb-badge {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}
.bb-badge-new {
  color: #fff;
  background: #1db954;
  border-color: #1db954;
}
.bb-badge-reentry {
  color: #fff;
  background: #1db954;
  border-color: #1db954;
}
.bb-badge-up {
  color: #1ed760;
  border-color: rgba(30, 215, 96, 0.45);
  background: rgba(30, 215, 96, 0.12);
}
.bb-badge-down {
  color: #ff6b6b;
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.12);
}
.bb-badge-same {
  color: var(--text-muted);
}
.bb-badge-weeks {
  color: #9bb7ff;
  border-color: rgba(155, 183, 255, 0.4);
  background: rgba(155, 183, 255, 0.1);
}
.bb-badge-peak {
  color: #f0c14b;
  border-color: rgba(240, 193, 75, 0.45);
  background: rgba(240, 193, 75, 0.12);
}
.track-row.is-bb-unresolved {
  opacity: 1;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.12);
}
.bb-cover-fallback,
.bb-cover-fallback-img {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #2a2a2a, #121212);
  color: #b3b3b3;
  font-size: 1.6rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.bb-cover-fallback-img {
  object-fit: cover;
}
.bb-week-picker {
  position: relative;
}
.bb-week-trigger {
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.bb-week-panel {
  position: absolute;
  z-index: 40;
  top: calc(100% - 4px);
  left: 0;
  right: 0;
  min-width: 280px;
  max-width: 340px;
  background: #1a1a1a;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-main);
  padding: 12px;
  margin-top: 6px;
}
.bb-week-panel.hidden {
  display: none;
}
.bb-cal-header {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  gap: 6px;
  align-items: center;
  margin-bottom: 10px;
}
.bb-cal-nav,
.bb-cal-title,
.bb-cal-today,
.bb-cal-day,
.bb-cal-cell {
  font: inherit;
  color: var(--text-main);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.bb-cal-nav {
  height: 36px;
  font-size: 1.35rem;
  line-height: 1;
}
.bb-cal-nav:hover:not(:disabled),
.bb-cal-title:hover:not(:disabled),
.bb-cal-today:hover,
.bb-cal-cell:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.08);
}
.bb-cal-nav:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}
.bb-cal-title {
  font-weight: 700;
  padding: 8px 6px;
}
.bb-cal-title:disabled {
  opacity: 0.85;
  cursor: default;
}
.bb-cal-dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}
.bb-cal-grid {
  display: grid;
  gap: 4px;
}
.bb-cal-weeks {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.bb-cal-week-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  width: 100%;
}
.bb-cal-week-row:not(.is-disabled-week):hover {
  background: rgba(255, 255, 255, 0.1);
}
.bb-cal-week-row.is-selected {
  background: rgba(29, 185, 84, 0.22);
  border-color: rgba(29, 185, 84, 0.55);
}
.bb-cal-week-row.is-selected:hover {
  background: rgba(29, 185, 84, 0.3);
}
.bb-cal-week-row.is-today-week:not(.is-selected) {
  box-shadow: inset 0 0 0 1px rgba(29, 185, 84, 0.45);
}
.bb-cal-week-row.is-disabled-week {
  opacity: 0.28;
  cursor: not-allowed;
}
.bb-cal-week-row.is-disabled-week:hover {
  background: transparent;
}
.bb-cal-months,
.bb-cal-years {
  grid-template-columns: repeat(3, 1fr);
}
.bb-cal-decades {
  grid-template-columns: repeat(2, 1fr);
}
.bb-cal-day,
.bb-cal-cell {
  min-height: 34px;
  padding: 6px 4px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
}
.bb-cal-day.is-outside {
  opacity: 0.38;
}
.bb-cal-day.is-saturday {
  font-weight: 700;
  color: var(--spotify-green);
}
.bb-cal-week-row.is-selected .bb-cal-day {
  color: #fff;
  font-weight: 600;
}
.bb-cal-week-row.is-selected .bb-cal-day.is-saturday {
  color: #1ed760;
}
.bb-cal-cell.is-selected {
  background: rgba(29, 185, 84, 0.25);
  border-color: rgba(29, 185, 84, 0.55);
  color: #fff;
  font-weight: 700;
}
.bb-cal-cell.is-disabled {
  opacity: 0.28;
  cursor: not-allowed;
}
.bb-cal-footer {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.bb-tracks-count-badge {
  display: inline-flex;
  align-items: center;
  width: auto;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(29, 185, 84, 0.16);
  border: 1px solid rgba(29, 185, 84, 0.4);
  color: var(--spotify-green);
  font-weight: 700;
  font-size: 0.8rem;
}
.bb-album-tracklist[open] .bb-tracks-count-badge {
  background: rgba(29, 185, 84, 0.22);
}
.track-row.is-bb-album .item-title {
  font-weight: 700;
}

/* Album charts: “N tracks” under the cover column (aligned with artwork) */
.track-row.is-bb-album {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  grid-template-areas:
    "rank cover details meta"
    ". tracks-sum tracks-sum tracks-sum"
    ". tracks-list tracks-list tracks-list";
  align-items: start;
  column-gap: 20px;
  row-gap: 6px;
}
.track-row.is-bb-album > .rank-badge {
  grid-area: rank;
  align-self: start;
  padding-top: 2px;
}
.track-row.is-bb-album > .cover-art-link,
.track-row.is-bb-album > .cover-art-large,
.track-row.is-bb-album > .bb-cover-fallback {
  grid-area: cover;
  align-self: start;
}
.track-row.is-bb-album > .track-details {
  grid-area: details;
  min-width: 0;
}
.track-row.is-bb-album > .track-meta-side {
  grid-area: meta;
  align-self: start;
}
.track-row.is-bb-album > .album-mates.bb-album-tracklist {
  display: contents;
  order: unset;
  flex: unset;
  width: auto;
  min-width: 0;
  max-width: none;
  margin: 0;
}
.track-row.is-bb-album > .bb-album-tracklist > .bb-tracks-count {
  grid-area: tracks-sum;
  grid-column: 2 / -1;
  justify-self: start;
  align-self: start;
  width: max-content;
  max-width: none;
  margin: 0;
  padding: 2px 0 0;
  box-sizing: border-box;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--spotify-green);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
  white-space: nowrap;
}
.track-row.is-bb-album > .bb-album-tracklist > .bb-tracks-count::before {
  margin-top: 0;
}
.track-row.is-bb-album > .bb-album-tracklist > .album-mates-list {
  grid-area: tracks-list;
  grid-column: 2 / -1;
  margin-top: 2px;
}

.bb-manual-match {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.btn-bb-manual-match {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-bb-manual-match:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(29, 185, 84, 0.55);
  color: #fff;
}
.bb-manual-match-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 520px;
}
.bb-manual-match-form.hidden {
  display: none;
}
.bb-manual-match-input {
  flex: 1 1 220px;
  min-width: 160px;
  font: inherit;
  font-size: 0.82rem;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-main);
}
.bb-manual-match-input:focus {
  outline: none;
  border-color: rgba(29, 185, 84, 0.65);
}
.btn-bb-manual-apply,
.btn-bb-manual-cancel {
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid transparent;
}
.btn-bb-manual-apply {
  background: var(--spotify-green);
  color: #000;
}
.btn-bb-manual-apply:hover:not(:disabled) {
  background: var(--spotify-green-hover);
}
.btn-bb-manual-apply:disabled {
  opacity: 0.55;
  cursor: wait;
}
.btn-bb-manual-cancel {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border-subtle);
}
.btn-bb-manual-cancel:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.06);
}
.bb-manual-match-status {
  flex: 1 1 100%;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.bb-manual-match-status.is-error {
  color: #ff6b6b;
}

.track-row.is-bb-unresolved .item-title {
  color: var(--text-main, #fff);
  cursor: default;
  text-decoration: none;
}

/* Artists — full-width fluid release strip */
.artists-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.artist-card-row {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px 20px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.artist-card-row:hover {
  background: var(--bg-card-hover);
  border-color: rgba(29, 185, 84, 0.3);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.artist-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.artist-avatar-large {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  flex-shrink: 0;
}

.artist-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.artist-details .item-title {
  font-size: 1.05rem;
}

.artist-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

.artist-albums-slot {
  width: 100%;
  min-width: 0;
  /* Thumb size must come from slot width — never from row content count */
  container-type: inline-size;
  container-name: artist-albums;
  --album-slots: 10;
  --album-gap: 8px;
  --single-gap: 6px;
  --album-size: calc((100cqw - (var(--album-slots) - 1) * var(--album-gap) - 1px) / var(--album-slots));
  --single-size: calc(var(--album-size) / 2);
}

.artist-refresh-btn {
  position: absolute;
  right: 10px;
  left: auto;
  bottom: 8px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-muted);
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s ease, color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.artist-card-row:hover .artist-refresh-btn,
.artist-refresh-btn:focus-visible {
  opacity: 1;
}

.artist-refresh-btn:hover {
  color: var(--spotify-green);
  border-color: rgba(29, 185, 84, 0.45);
  background: rgba(29, 185, 84, 0.12);
}

.artist-refresh-btn:disabled {
  cursor: wait;
  opacity: 0.7;
}

.artist-refresh-btn.is-spinning svg {
  animation: artist-refresh-spin 0.8s linear infinite;
}

@keyframes artist-refresh-spin {
  to { transform: rotate(360deg); }
}

/* Album/single thumbs inherit fixed sizes from .artist-albums-slot */
.artist-releases {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.artist-releases.loading,
.artist-releases.empty {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  min-height: 48px;
  justify-content: flex-start;
}

.release-scroll {
  position: relative;
  display: block;
  width: 100%;
}

.release-scroll-viewport {
  min-width: 0;
  width: 100%;
  overflow-x: hidden;
  overflow-y: hidden;
  scroll-behavior: smooth;
  padding: 4px 0 6px;
}

/* Scrollbar + overflow only when more icons than fit on one row */
.release-scroll.is-scrollable .release-scroll-viewport {
  overflow-x: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(29, 185, 84, 0.45) transparent;
}

.release-scroll.is-scrollable .release-scroll-viewport::-webkit-scrollbar {
  height: 5px;
}

.release-scroll.is-scrollable .release-scroll-viewport::-webkit-scrollbar-thumb {
  background: rgba(29, 185, 84, 0.4);
  border-radius: 999px;
}

.release-scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-55%);
  z-index: 4;
  width: 30px;
  height: 54px;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: rgba(18, 18, 18, 0.88);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.45);
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.release-scroll.is-scrollable .release-scroll-btn:not([hidden]) {
  display: inline-flex;
}

.release-scroll-btn.is-prev {
  left: 0;
}

.release-scroll-btn.is-next {
  right: 0;
}

.release-scroll-btn:hover:not(:disabled) {
  color: var(--spotify-green);
  border-color: rgba(29, 185, 84, 0.45);
  background: rgba(20, 40, 28, 0.95);
}

.release-scroll-btn:disabled {
  opacity: 0.28;
  cursor: default;
}

.release-scroll-btn[hidden] {
  display: none !important;
}

.link-retry {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--spotify-green);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link-retry:hover {
  color: #1ed760;
}

.link-retry:disabled {
  opacity: 0.5;
  cursor: wait;
}

.release-row {
  display: flex;
  flex-wrap: nowrap;
  width: max-content;
  max-width: none;
  align-items: flex-start;
}

.release-row-albums {
  gap: var(--album-gap);
}

.release-row-singles {
  gap: var(--single-gap);
}

.release-row-albums .album-thumb {
  flex: 0 0 var(--album-size);
  width: var(--album-size);
  min-width: var(--album-size);
  max-width: var(--album-size);
  height: var(--album-size);
}

.release-row-singles .album-thumb {
  flex: 0 0 var(--single-size);
  width: var(--single-size);
  min-width: var(--single-size);
  max-width: var(--single-size);
  height: var(--single-size);
}

.album-thumb {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  text-decoration: none;
  color: inherit;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

a.album-thumb:hover {
  transform: translateY(-3px) scale(1.04);
  border-color: rgba(29, 185, 84, 0.55);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.45);
  z-index: 2;
}

.album-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.album-thumb-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.06);
}

.album-year {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  font-size: 0.65rem;
  font-weight: 700;
  text-align: center;
  padding: 3px 0;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  letter-spacing: 0.02em;
}

.release-row-singles .album-year {
  font-size: 0.5rem;
  padding: 2px 0;
}

.album-type-chip {
  position: absolute;
  top: 4px;
  left: 4px;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(29, 185, 84, 0.9);
  color: #000;
  line-height: 1.2;
}

/* Legacy artist grid kept for unused styles */
.artists-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.track-card, .artist-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.25s ease;
  position: relative;
  overflow: hidden;
}

.track-card:hover, .artist-card:hover {
  background: var(--bg-card-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  border-color: rgba(29, 185, 84, 0.3);
}

.rank-badge {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--spotify-green);
  min-width: 28px;
  text-align: center;
}

.cover-art, .artist-avatar {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.artist-avatar {
  border-radius: 50%;
}

.item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.item-title {
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-main);
  text-decoration: none;
}

.item-title:hover {
  color: var(--spotify-green);
}

.item-sub {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.audio-preview {
  margin-top: 6px;
  width: 100%;
  height: 28px;
}

/* Timeline / Table view for Recently Played */
.timeline-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.timeline-time {
  font-size: 0.8rem;
  color: var(--spotify-green);
  font-weight: 600;
  min-width: 130px;
}

/* Genres tags */
.genre-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.genre-tag {
  background: rgba(255, 255, 255, 0.08);
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-muted);
}

/* Same-album collapse (Popular Tracks by Genre) */
.album-mates {
  margin-top: 8px;
  max-width: 100%;
}

.album-mates-summary {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  margin: 0;
  padding: 8px 0;
  box-sizing: border-box;
  cursor: pointer;
  list-style: none;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--spotify-green);
  user-select: none;
  -webkit-tap-highlight-color: rgba(29, 185, 84, 0.2);
}

.album-mates-summary::-webkit-details-marker {
  display: none;
}

.album-mates-summary::before {
  content: '▸';
  display: inline-block;
  flex-shrink: 0;
  transition: transform 0.15s ease;
  font-size: 0.7rem;
  line-height: 1.4;
  margin-top: 1px;
}

.album-mates[open] .album-mates-summary::before {
  transform: rotate(90deg);
}

.album-mates-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 2px solid rgba(29, 185, 84, 0.35);
  padding-left: 10px;
}

.album-mate-item {
  display: grid;
  grid-template-columns: 1.4em minmax(0, 1fr);
  gap: 2px 8px;
  align-items: baseline;
  font-size: 0.82rem;
}

.album-mate-rank {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
}

.album-mate-title {
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.album-mate-title:hover {
  color: var(--spotify-green);
}

.album-mate-sub {
  grid-column: 2;
  font-size: 0.72rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Artist search suggestions */
.artist-suggestion-item {
  display: flex;
  align-items: center;
  gap: 10px;
}

.artist-suggestion-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
}

.artist-suggestion-thumb--empty {
  display: inline-block;
}

.artist-suggestion-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.artist-suggestion-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.artist-suggestion-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Artist Profile report */
.artist-profile {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin-top: 8px;
}

.artist-profile-hero {
  display: flex;
  gap: 22px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.artist-profile-avatar {
  width: 168px;
  height: 168px;
  border-radius: 12px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.artist-profile-avatar--empty {
  background: rgba(255, 255, 255, 0.08);
}

.artist-profile-hero-text {
  flex: 1;
  min-width: 220px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.artist-profile-name {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 800;
  color: var(--text-main);
  text-decoration: none;
  line-height: 1.15;
}

.artist-profile-name:hover {
  color: var(--accent, #1db954);
}

.artist-profile-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.artist-profile-meta-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px 16px;
  margin: 0;
}

.artist-profile-meta-list > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.artist-profile-meta-list dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.artist-profile-meta-list dd {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text-main);
  word-break: break-all;
}

.artist-profile-meta-list code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
}

.artist-profile-section-title {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 700;
}

.artist-profile-section-hint {
  margin: 0 0 12px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.genre-tags--profile {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.genre-tags--profile .genre-tag {
  font-size: 0.82rem;
  padding: 4px 10px;
}

.artist-albums-slot--profile {
  width: 100%;
}

.profile-top-tracks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.profile-top-track {
  display: grid;
  grid-template-columns: 36px 40px minmax(0, 1fr) 52px 48px;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.profile-top-track:hover {
  background: rgba(255, 255, 255, 0.06);
}

.profile-top-rank {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.profile-top-cover {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}

.profile-top-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 2px;
}

.profile-top-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-top-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-top-pop,
.profile-top-dur {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.profile-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}

.profile-related-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  transition: background 0.15s ease;
}

.profile-related-card:hover {
  background: rgba(255, 255, 255, 0.07);
}

.profile-related-card img,
.profile-related-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-related-placeholder {
  display: block;
  background: rgba(255, 255, 255, 0.08);
}

.profile-related-name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
}

.profile-related-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .artist-profile-avatar {
    width: 120px;
    height: 120px;
  }

  .profile-top-track {
    grid-template-columns: 28px 36px minmax(0, 1fr);
  }

  .profile-top-pop,
  .profile-top-dur {
    display: none;
  }
}

/* —— Track rows (Top Tracks / Genre heat): stack meta under details on narrow screens —— */
@media (max-width: 700px) {
  .track-row {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "rank cover details"
      "meta meta meta"
      "mates mates mates";
    gap: 8px 12px;
    padding: 12px 14px;
    align-items: start;
  }

  .track-row:hover {
    transform: none;
  }

  .track-row > .rank-badge {
    grid-area: rank;
    align-self: start;
    font-size: 1.15rem;
    line-height: 1.2;
    padding-top: 2px;
  }

  .track-row > .cover-art-link,
  .track-row > .cover-art-large {
    grid-area: cover;
    align-self: start;
  }

  .track-row .cover-art-large {
    width: 56px;
    height: 56px;
  }

  .track-row > .track-details {
    grid-area: details;
    min-width: 0;
  }

  .track-row > .album-mates {
    grid-area: mates;
    grid-column: 1 / -1;
    max-width: none;
    width: 100%;
    min-width: 0;
    margin-top: 0;
  }

  .track-row.is-bb-album {
    grid-template-columns: auto auto minmax(0, 1fr);
    grid-template-areas:
      "rank cover details"
      "meta meta meta"
      ". tracks-sum tracks-sum"
      ". tracks-list tracks-list";
    column-gap: 12px;
    row-gap: 6px;
  }

  .track-row.is-bb-album > .track-meta-side {
    grid-area: meta;
  }

  .track-row.is-bb-album > .bb-album-tracklist > .bb-tracks-count {
    grid-column: 2 / -1;
    max-width: none;
  }

  .track-row.is-bb-album > .bb-album-tracklist > .album-mates-list {
    grid-column: 2 / -1;
  }

  /* Old share HTML still nests mates inside details — break out once hoisted;
     until then, at least stretch the summary hit area */
  .track-row .track-details > .album-mates {
    width: 100%;
  }

  .track-row > .track-meta-side {
    grid-area: meta;
    min-width: 0;
    width: 100%;
    max-width: 100%;
    align-items: flex-start;
  }

  .track-row .meta-badges {
    justify-content: flex-start;
    width: 100%;
  }

  .track-row .track-header-line {
    flex-wrap: wrap;
    gap: 6px;
  }

  .track-row .track-header-line .item-title {
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
    font-size: 0.92rem;
    line-height: 1.25;
  }

  .track-row .track-subtitle {
    align-items: flex-start;
    gap: 4px 6px;
    font-size: 0.8rem;
    line-height: 1.35;
  }

  .track-row .album-info {
    display: inline;
  }

  .track-row .audio-preview {
    width: 100%;
    max-width: 100%;
  }

  .track-row .album-mates-summary {
    white-space: normal;
  }

  .results-header {
    flex-direction: column;
    align-items: stretch;
  }

  .report-playlist-actions {
    margin-left: 0;
    width: 100%;
  }

  .report-playlist-actions .btn-open-spotify-playlist {
    width: 100%;
  }
}

/* Utilities */
.hidden {
  display: none !important;
}
