/* ===== Design Tokens ===== */
:root {
  --bg: #080f16;
  --surface: #0d1a26;
  --surface-2: #111f2e;
  --surface-3: #172840;
  --accent: #4aafbe;
  --accent-dim: #2d7a87;
  --accent-glow: rgba(74, 175, 190, 0.15);
  --text: #cde4ef;
  --text-muted: #5a9eae;
  --text-dim: #3a6a7a;
  --border: #1a2e40;
  --border-light: #223d52;
  --danger: #e05c6e;
  --success: #3ec98a;

  --sidebar-w: 340px;
  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.18s ease;
}

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: 'Outfit', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.5;
}

/* ===== App body (sidebar + main row below header) ===== */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== Top header ===== */
.app-header {
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 1.4rem;
  gap: 2rem;
  flex-shrink: 0;
  z-index: 10;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 99px; }

/* ===== Sidebar ===== */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 2rem;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0;
  user-select: none;
  flex-shrink: 0;
}

.logo-icon {
  font-size: 1.4rem;
  color: var(--accent);
  line-height: 1;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}

/* ===== Auth bar ===== */
.auth-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1.4rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.auth-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: background var(--transition);
  flex-shrink: 0;
}
.auth-dot.ok { background: var(--success); }
.auth-dot.error { background: var(--danger); }

.auth-link {
  margin-left: auto;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.8rem;
  padding: 0.25rem 0.6rem;
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.auth-link:hover { background: var(--accent-glow); }

/* ===== Sidebar sections ===== */
.sidebar-section {
  padding: 1rem 1.4rem;
  border-bottom: 1px solid var(--border);
}

.section-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

/* ===== Mode tabs ===== */
.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
}

.mode-tab {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.mode-tab:hover { border-color: var(--accent-dim); color: var(--text); }
.mode-tab.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== Form fields ===== */
.form-group { display: flex; flex-direction: column; gap: 0.75rem; }

.field { display: flex; flex-direction: column; gap: 0.3rem; }

.field-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.field-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.field-input::placeholder { color: var(--text-dim); }
.field-input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== Aggregation ===== */
.agg-options { display: flex; flex-direction: column; gap: 0.5rem; }

.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  cursor: pointer;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  transition: border-color var(--transition), background var(--transition);
}

.radio-option:has(input:checked) {
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}

.radio-option input { margin-top: 2px; accent-color: var(--accent); flex-shrink: 0; }

.radio-label { display: flex; flex-direction: column; gap: 0.1rem; }
.radio-label strong { font-size: 0.85rem; font-weight: 600; color: var(--text); }
.radio-label small { font-size: 0.75rem; color: var(--text-muted); }

/* ===== Options ===== */
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.85rem;
}

.option-label { font-size: 0.83rem; color: var(--text-muted); }

.option-stack {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-top: 0.85rem;
}

.slider-wrap { display: flex; align-items: center; gap: 0.6rem; }
.slider-wrap-wide .slider { width: 100%; }

.slider {
  -webkit-appearance: none;
  appearance: none;
  width: 110px;
  height: 4px;
  border-radius: 99px;
  background: var(--border-light);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 0 6px var(--accent-glow);
}

.slider-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  min-width: 1.8rem;
  text-align: right;
}

/* ===== Toggle ===== */
.toggle-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  cursor: pointer;
  user-select: none;
}

.toggle-option input { display: none; }

.toggle-track {
  width: 34px; height: 18px;
  background: var(--border-light);
  border-radius: 99px;
  position: relative;
  flex-shrink: 0;
  transition: background var(--transition);
}

.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform var(--transition), background var(--transition);
}

.toggle-option input:checked + .toggle-track { background: var(--accent-dim); }
.toggle-option input:checked + .toggle-track .toggle-thumb {
  transform: translateX(16px);
  background: var(--accent);
}

.toggle-label { font-size: 0.83rem; color: var(--text-muted); }

/* ===== Generate button ===== */
.btn-generate {
  margin: 1rem 1.4rem 0;
  width: calc(100% - 2.8rem);
  padding: 0.75rem;
  background: var(--accent);
  color: #050c12;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.03em;
  transition: opacity var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: 0 4px 20px rgba(74,175,190,0.3);
}

.btn-generate:hover { opacity: 0.9; transform: translateY(-1px); box-shadow: 0 6px 24px rgba(74,175,190,0.4); }
.btn-generate:active { transform: translateY(0); }
.btn-generate:disabled { opacity: 0.7; cursor: not-allowed; transform: none; animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 0.7; } 50% { opacity: 0.4; } }

/* ===== History ===== */
.history-section { border-bottom: none; }

.sidebar-privacy-link {
  display: block;
  padding: 0.75rem 1rem;
  font-size: 0.72rem;
  color: var(--text-dim);
  text-decoration: none;
  margin-top: auto;
}
.sidebar-privacy-link:hover { color: var(--text-muted); }

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.history-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: border-color var(--transition);
}
.history-item:hover { border-color: var(--accent-dim); }

.history-item-info { flex: 1; min-width: 0; }
.history-item-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item-meta { font-size: 0.72rem; color: var(--text-dim); }
.history-item a { color: var(--accent); text-decoration: none; font-size: 0.75rem; flex-shrink: 0; }

/* ===== Main area ===== */
.main {
  flex: 1;
  height: 100%;
  overflow-y: auto;
  padding: 2rem;
  display: flex;
  flex-direction: column;
}

/* ===== Empty state ===== */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
  max-width: 480px;
  margin: 0 auto;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3.5rem;
  color: var(--border-light);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.empty-state h2 { font-size: 1.4rem; font-weight: 600; color: var(--text); }
.empty-state p { font-size: 0.9rem; line-height: 1.7; }
.empty-hints { display: flex; flex-direction: column; gap: 0.4rem; margin-top: 1rem; }
.empty-hint { font-size: 0.82rem; color: var(--text-muted); }

/* ===== Skeleton ===== */
@keyframes shimmer {
  0% { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s infinite linear;
}

.skeleton-title { height: 28px; width: 260px; margin-bottom: 0.5rem; }
.skeleton-sub { height: 16px; width: 160px; }

.loading-header { margin-bottom: 1.5rem; }

.skeleton-list { display: flex; flex-direction: column; gap: 0.5rem; }

.skeleton-row {
  height: 64px;
  border-radius: var(--radius);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 600px 100%;
  animation: shimmer 1.5s infinite linear;
}

/* ===== Results ===== */
.results-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1rem;
  gap: 1rem;
}

.results-title { font-size: 1.3rem; font-weight: 700; color: var(--text); }
.results-sub { font-size: 0.83rem; color: var(--text-muted); margin-top: 0.2rem; }

.header-actions { display: flex; gap: 0.5rem; flex-shrink: 0; }

.status-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.9rem 1rem;
  background: linear-gradient(180deg, rgba(74,175,190,0.08), rgba(17,31,46,0.92));
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.status-stage-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.stage-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stage-chip.active {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}

.stage-chip.complete {
  color: var(--success);
  border-color: rgba(62,201,138,0.35);
}

.status-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.status-hint {
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.78rem;
  color: var(--text-dim);
}

/* ===== Tag bar ===== */
.tag-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.tag-pill {
  padding: 0.3rem 0.75rem;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  user-select: none;
}

.tag-pill:hover { border-color: var(--accent-dim); color: var(--text); }
.tag-pill.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

/* ===== Track list ===== */
.track-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 5rem; /* space for push bar */
}

.track-row {
  display: grid;
  grid-template-columns: 32px 48px 1fr auto 80px 32px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color var(--transition), background var(--transition), opacity var(--transition);
}

.track-row:hover { border-color: var(--border-light); background: var(--surface-2); }
.track-row.deselected { opacity: 0.4; }
.track-row.filtered-out { display: none; }
.track-row.pending-resolve { border-style: dashed; }

/* Preview button */
.btn-preview {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.btn-preview:hover { border-color: var(--accent-dim); color: var(--accent); }
.btn-preview.playing { border-color: var(--accent); color: var(--accent); background: var(--accent-glow); }
.btn-preview.no-preview { opacity: 0.2; cursor: default; }

/* Album art */
.track-art {
  width: 48px; height: 48px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}

.track-art-placeholder {
  width: 48px; height: 48px;
  border-radius: 4px;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* Track info */
.track-info { min-width: 0; }
.track-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-artist {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-explanation {
  font-size: 0.7rem;
  color: var(--text-dim);
  margin-top: 0.18rem;
}

.track-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.35rem;
}

.track-badge {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  border: 1px solid var(--border);
  color: var(--text-dim);
  background: var(--surface-3);
}

.track-badge.pending {
  color: var(--accent);
  border-color: var(--accent-dim);
  background: var(--accent-glow);
}

/* Tags on track */
.track-tags { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.25rem; }
.track-tag {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
  background: var(--surface-3);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* Similarity bar */
.sim-bar-wrap { display: flex; align-items: center; gap: 0.5rem; }
.sim-bar-bg {
  height: 4px;
  width: 60px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.sim-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.sim-score { font-size: 0.72rem; color: var(--text-dim); min-width: 2.2rem; text-align: right; }

/* Checkbox */
.track-checkbox { accent-color: var(--accent); width: 16px; height: 16px; cursor: pointer; }

/* ===== Buttons ===== */
.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--accent-dim); color: var(--text); }

/* ===== Push bar ===== */
.push-bar {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 2rem 1rem;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  z-index: 10;
}

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

.btn-push {
  background: var(--accent);
  color: #050c12;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  padding: 0.65rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  box-shadow: 0 4px 20px rgba(74,175,190,0.35);
  letter-spacing: 0.02em;
}
.btn-push:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-push:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* ===== Success state ===== */
.success-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.75rem 2rem;
  background: var(--surface);
  border: 1px solid var(--success);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: 0 0 30px rgba(62,201,138,0.08);
}

.success-check {
  font-size: 2rem;
  color: var(--success);
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(62,201,138,0.12);
  border-radius: 50%;
  flex-shrink: 0;
}

.success-banner h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.35rem; }

.playlist-link {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}
.playlist-link:hover { text-decoration: underline; }

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1rem;
  text-align: center;
}

.stat-number { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.25rem; }

/* ===== Page nav (Home / Stats / Discover) — lives in header ===== */
.page-nav {
  display: flex;
  gap: 0;
  height: 100%;
  align-items: stretch;
}

.page-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0 1.1rem;
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
}

.page-tab:hover { color: var(--text-muted); }
.page-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ===== Stats panel ===== */
.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-bottom: 4rem;
}

.stats-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.stats-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.stats-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.stats-user-img {
  width: 40px; height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border-light);
}

.stats-user-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.stats-user-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Period tabs */
.period-tabs {
  display: flex;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
}

.period-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.period-tab:hover { color: var(--text); }
.period-tab.active { background: var(--accent-glow); color: var(--accent); border: 1px solid var(--accent-dim); }

/* Two-col layout */
.stats-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}


.stats-section { display: flex; flex-direction: column; gap: 0.75rem; }

.stats-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* Stats skeleton */
.stats-skeleton-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

/* Top tracks list */
.stats-track-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  counter-reset: track-counter;
}

.stats-track-item {
  display: grid;
  grid-template-columns: 1.5rem 40px 1fr auto 36px;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
  counter-increment: track-counter;
}

.stats-track-item:hover { background: var(--surface-2); border-color: var(--border); }

.stats-track-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-dim);
  text-align: right;
}

.art-wrap {
  position: relative;
  width: 40px; height: 40px;
  flex-shrink: 0;
}
.art-wrap:not(.no-preview) { cursor: pointer; }

.art-play-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.55);
  opacity: 0;
  transition: opacity var(--transition);
  border-radius: 4px;
  font-size: 0.75rem;
  color: #fff;
  pointer-events: none;
}
.art-wrap:not(.no-preview):hover .art-play-overlay { opacity: 1; }
.stats-track-item.playing .art-play-overlay,
.stats-recent-item.playing .art-play-overlay { opacity: 1; }

.stats-track-item.playing,
.stats-recent-item.playing {
  background: var(--accent-glow);
  border-color: var(--accent-dim);
}

.stats-track-art {
  width: 40px; height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface-3);
}

.stats-track-art-placeholder {
  width: 40px; height: 40px;
  border-radius: 4px;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--text-dim);
}

.stats-track-info { min-width: 0; }
.stats-track-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-track-artist { font-size: 0.75rem; color: var(--text-muted); }

/* Recently played */
.stats-recent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.stats-recent-item {
  display: grid;
  grid-template-columns: 1.5rem 40px 1fr;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.6rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: border-color var(--transition), background var(--transition);
}

.stats-recent-item:hover { background: var(--surface-2); border-color: var(--border); }

.stats-recent-art,
.stats-artist-art {
  width: 40px; height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text-dim);
}

.stats-artist-art { border-radius: 50%; }

.stats-recent-name { font-size: 0.85rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-recent-artist { font-size: 0.75rem; color: var(--text-muted); }

/* Music DNA stat cards */
.stats-info-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}

.stat-info-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem 0.8rem;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  user-select: none;
}
.stat-info-card:hover {
  border-color: var(--accent-dim);
  background: var(--surface-3);
}
.stat-info-card--open {
  border-color: var(--accent);
}

.stat-info-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}
.stat-info-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.stat-info-help {
  font-size: 0.6rem;
  font-weight: 700;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 1.5px solid var(--text-muted);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition);
}
.stat-info-card:hover .stat-info-help,
.stat-info-card--open .stat-info-help {
  border-color: var(--accent);
  color: var(--accent);
}

.stat-info-value {
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.stat-info-desc {
  font-size: 0.73rem;
  color: var(--text-dim);
  line-height: 1.5;
  margin-top: 0.55rem;
  border-top: 1px solid var(--border);
  padding-top: 0.55rem;
}


/* ===== Home page ===== */
.home-pl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.sort-tabs {
  display: flex;
  gap: 0.3rem;
}
.sort-tab {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.sort-tab:hover { border-color: var(--accent-dim); color: var(--text); }
.sort-tab.active { background: var(--accent-glow); border-color: var(--accent); color: var(--accent); }

.home-playlist-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.home-playlist-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 0.65rem;
  padding: 0.45rem 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}

.home-playlist-item:hover { background: var(--surface-2); border-color: var(--border); }
.home-playlist-item.active { background: var(--accent-glow); border-color: var(--accent-dim); }

.home-cover {
  width: 40px; height: 40px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}

.home-cover-placeholder {
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  color: var(--text-dim);
}

.home-cover-skeleton {
  width: 40px; height: 40px;
  border-radius: 4px;
}

.home-pl-info { min-width: 0; }
.home-pl-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.home-pl-meta { font-size: 0.72rem; color: var(--text-dim); }

.skeleton-item {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.5rem;
}
.skeleton-text { display: flex; flex-direction: column; gap: 4px; }

/* Home detail hero */
.home-detail-hero {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.home-detail-loading {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.home-detail-cover {
  width: 110px; height: 110px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}

.home-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.15rem;
  min-width: 0;
}

.home-detail-name {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.home-detail-sub {
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* Genre tag pills (in playlist hero) */
.genre-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.genre-tag-pill {
  font-size: 0.68rem;
  font-weight: 500;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  text-transform: capitalize;
  white-space: nowrap;
}

/* Two-column playlist detail layout */
.home-detail-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.home-detail-col {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}


.btn-get-reco {
  padding: 0.45rem 1rem;
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.btn-get-reco:hover { background: var(--accent); color: #050c12; border-color: var(--accent); }

.push-bar-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.playlist-name-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.playlist-name-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.playlist-name-input {
  flex: 1;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.playlist-name-input:focus {
  border-color: var(--accent-dim);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ===== Audio feature filters ===== */
.feature-filters {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.8rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}

.feature-filter-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.feature-filter-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 500;
  min-width: 120px;
  flex-shrink: 0;
}

.feature-range-val {
  color: var(--accent);
  font-size: 0.72rem;
  margin-left: 0.3rem;
}

.feature-slider-pair {
  display: flex;
  gap: 0.4rem;
  flex: 1;
}

.feature-slider-pair input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--border-light);
  outline: none;
  cursor: pointer;
}

.feature-slider-pair input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}

/* ===== Mini player bar ===== */
.mini-player {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 56px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  z-index: 200;
}

.mini-player.hidden { display: none; }

.mini-player-art {
  width: 38px; height: 38px;
  border-radius: 4px;
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}

.mini-player-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.mini-player-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-artist {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-btn {
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 1rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.mini-player-btn:hover { border-color: var(--accent-dim); color: var(--accent); }

/* Push bar shifts up when mini player is visible */
.mini-player-open .push-bar {
  bottom: 56px;
}

/* ===== Track detail modal ===== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
  padding: 1rem;
}

.modal-card {
  background: var(--surface-2);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 1.5rem;
  width: 100%;
  max-width: 460px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 0.9rem; right: 0.9rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  width: 28px; height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}

.modal-close:hover { color: var(--text); border-color: var(--accent-dim); }

.modal-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.modal-art {
  width: 72px; height: 72px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}

.modal-header-info { min-width: 0; }

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  word-break: break-word;
}

.modal-artist {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.modal-features { display: flex; flex-direction: column; gap: 0.5rem; }

.modal-feature-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.modal-feature-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  min-width: 90px;
  flex-shrink: 0;
}

.modal-feature-bar-bg {
  flex: 1;
  height: 5px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.modal-feature-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 99px;
  transition: width 0.4s ease;
}

.modal-feature-val {
  font-size: 0.72rem;
  color: var(--text-dim);
  min-width: 2.5rem;
  text-align: right;
}

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.toast-stack {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  z-index: 400;
  max-width: 360px;
}

.toast {
  padding: 0.8rem 0.95rem;
  border-radius: var(--radius);
  border: 1px solid var(--border-light);
  background: rgba(13, 26, 38, 0.96);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0,0,0,0.28);
  animation: toast-in 0.18s ease;
}

.toast.info { border-color: var(--accent-dim); }
.toast.success { border-color: rgba(62,201,138,0.45); }
.toast.error { border-color: rgba(224,92,110,0.45); }

.toast-title {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.toast-body {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Track list alignment (no-number contexts) ===== */
.home-detail-col .stats-recent-item,
#statsRecentList .stats-recent-item {
  grid-template-columns: 40px 1fr;
  gap: 0.55rem;
}
.home-detail-col .stats-recent-item > span:first-child,
#statsRecentList .stats-recent-item > span:first-child {
  display: none;
}


/* ===== Taste Profile ===== */
.stats-taste-sub {
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-dim);
  margin-left: 0.4rem;
}

.taste-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 2.5rem;
  margin-top: 0.5rem;
}

.taste-feat { display: flex; flex-direction: column; gap: 0.25rem; }

.taste-feat-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 500;
}

.taste-feat-val {
  font-size: 0.75rem;
  color: var(--accent);
  font-weight: 600;
}

.taste-bar-bg {
  height: 5px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}

.taste-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
  border-radius: 99px;
  transition: width 0.7s ease;
}

.taste-feat-desc { font-size: 0.68rem; color: var(--text-dim); }

/* popularity in top tracks */
.stats-track-pop-bar {
  width: 36px;
  height: 3px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
  align-self: center;
}
.stats-track-pop-fill {
  height: 100%;
  background: var(--accent-dim);
  border-radius: 99px;
}


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

/* ===== Spotify Wrapped ===== */
.wrapped-years {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.wrapped-year-btn {
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0.28rem 0.7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  letter-spacing: 0.02em;
}

.wrapped-year-btn:hover { border-color: var(--accent-dim); color: var(--text); }
.wrapped-year-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.wrapped-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-glow);
  border: 1px solid var(--accent-dim);
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  margin-top: 0.2rem;
  align-self: flex-start;
}

.wrapped-artist-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.wrapped-artist-row:last-child { border-bottom: none; }
.wrapped-artist-name { color: var(--text); font-weight: 500; }
.wrapped-artist-count { color: var(--text-dim); font-size: 0.72rem; }

/* ===== Clickable track info ===== */
.track-info:hover .track-name,
.stats-track-info:hover .stats-track-name,
.stats-recent-info:hover .stats-recent-name {
  color: var(--accent);
  cursor: pointer;
}
.track-info, .stats-track-info, .stats-recent-info { cursor: pointer; }

/* ===== Field hint ===== */
.field-hint {
  color: var(--text-dim);
  font-size: 0.75rem;
  margin-top: 0.45rem;
  line-height: 1.35;
}

/* ===== Listening range tabs ===== */
.listening-range-tabs {
  display: flex;
  gap: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.25rem;
}

.range-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}

.range-tab:hover { color: var(--text); }
.range-tab.active { background: var(--accent-glow); color: var(--accent); border: 1px solid var(--accent-dim); }

/* ===== Mode tabs wrap for 6 items ===== */
.mode-tabs {
  flex-wrap: wrap;
}

/* ===== Shared playlist view ===== */
.shared-view {
  max-width: 640px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

.shared-logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.shared-logo .logo-icon {
  font-size: 1.5rem;
  color: var(--accent);
}

.shared-logo .logo-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text);
}

.shared-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.35rem;
}

.shared-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 0 0 1rem;
}

.shared-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
}

.shared-track-num {
  color: var(--text-dim);
  font-size: 0.78rem;
  font-weight: 500;
  min-width: 1.75rem;
  text-align: right;
  flex-shrink: 0;
}

.shared-actions {
  margin-top: 1.5rem;
  text-align: center;
}

.shared-actions .btn-push {
  display: inline-block;
  text-decoration: none;
}

/* ===== Browse templates page ===== */
.browse-panel {
  padding-bottom: 2rem;
}

.browse-header {
  text-align: center;
  margin-bottom: 2rem;
}

.browse-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.browse-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.35rem;
}

.browse-search-wrap {
  max-width: 400px;
  margin: 1.25rem auto 0;
}

.browse-category {
  margin-bottom: 1.75rem;
}

.browse-category-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin: 0 0 0.75rem;
}

.browse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
  gap: 0.65rem;
}

.browse-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.browse-card:hover {
  border-color: var(--accent-dim);
  background: var(--surface-2);
  transform: translateY(-1px);
}

.browse-card-emoji {
  font-size: 1.35rem;
  line-height: 1;
  margin-bottom: 0.3rem;
}

.browse-card-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.85rem;
}

.browse-card-desc {
  color: var(--text-muted);
  font-size: 0.74rem;
  line-height: 1.4;
}

.browse-card.filtered-out {
  display: none;
}

.browse-category.filtered-out {
  display: none;
}

.browse-card-active {
  border-color: var(--accent) !important;
  background: var(--accent-glow) !important;
}

/* ===== Preview loading pulse ===== */
.art-wrap.loading-preview {
  position: relative;
}

.art-wrap.loading-preview::after {
  content: '♪';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-dim);
  background: rgba(0, 0, 0, 0.35);
  border-radius: inherit;
  animation: pulse-preview 1.5s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse-preview {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* ===== Genre loading hint ===== */
.genre-loading-hint {
  color: var(--text-dim);
  font-size: 0.75rem;
  font-style: italic;
  animation: pulse-preview 1.5s ease-in-out infinite;
}

/* ===== Sidebar toggle (mobile) ===== */
.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

/* ===== Auth disconnect link ===== */
.auth-disconnect {
  color: var(--text-dim);
  font-size: 0.75rem;
}
.auth-disconnect:hover { color: var(--danger); }

/* ===== Responsive — Tablet (≤900px) ===== */
@media (max-width: 900px) {
  :root { --sidebar-w: 260px; }
  .stats-two-col { grid-template-columns: 1fr; }
  .browse-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
}

/* ===== Responsive — Phone (≤600px) ===== */
@media (max-width: 600px) {
  :root { --sidebar-w: 100%; }

  .sidebar-toggle { display: block; }

  .app-header {
    padding: 0 0.75rem;
    gap: 0.75rem;
  }

  .app-header .sidebar-logo .logo-text { display: none; }

  .page-nav { gap: 0; }
  .page-tab { font-size: 0.75rem; padding: 0 0.6rem; }

  .app-body {
    flex-direction: column;
  }

  .sidebar {
    position: fixed;
    top: 52px;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    min-width: 100%;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    border-right: none;
    border-top: 1px solid var(--border);
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar.hidden { transform: translateX(-100%); }

  .main {
    width: 100%;
    padding: 1rem;
  }

  /* Track row — simplified for mobile */
  .track-row {
    grid-template-columns: 28px 40px 1fr 28px;
    gap: 0.5rem;
    padding: 0.5rem 0.6rem;
  }

  .track-row .sim-bar-wrap,
  .track-row .track-explanation {
    display: none;
  }

  .track-name { font-size: 0.82rem; }
  .track-artist { font-size: 0.72rem; }

  /* Push bar */
  .push-bar {
    left: 0;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
  }

  .push-bar-actions {
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
  }

  .push-bar-actions .btn-push { width: 100%; }

  .playlist-name-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .playlist-name-input { width: 100%; }

  /* Stats */
  .stats-two-col { grid-template-columns: 1fr; }
  .stats-info-cards { grid-template-columns: repeat(2, 1fr); }
  .stats-header { flex-direction: column; gap: 0.75rem; align-items: flex-start; }
  .stats-actions { flex-wrap: wrap; gap: 0.5rem; }

  /* Modal */
  .modal-card {
    width: 95vw;
    max-width: 95vw;
    max-height: min(85vh, calc(100dvh - 60px));
  }

  .modal-hero { flex-direction: column; text-align: center; }
  .modal-art { width: 120px; height: 120px; }

  /* Browse */
  .browse-grid { grid-template-columns: 1fr 1fr; }
  .browse-card { padding: 0.75rem; }
  .browse-header { padding: 0 0.5rem; }
  .browse-title { font-size: 1.2rem; }

  /* Shared view */
  .shared-view { padding: 0 0.75rem; margin: 1rem auto; }
  .shared-title { font-size: 1.2rem; }

  /* Mini player */
  .mini-player { padding: 0.5rem 0.75rem; }

  /* Home detail */
  .home-detail-loading { flex-direction: column; align-items: center; }
  .home-detail-hero { flex-direction: column; align-items: center; text-align: center; }

  /* Stat cards */
  .stat-cards { grid-template-columns: repeat(2, 1fr); }

  /* Mode tabs — 3 columns on mobile */
  .mode-tabs { grid-template-columns: repeat(3, 1fr); }

  /* Results header */
  .results-header { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
  .header-actions { width: 100%; }
}

@media (max-width: 380px) {
  .browse-grid { grid-template-columns: 1fr; }
}
