/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  overflow-y: scroll;
}

body {
  background: var(--bg-body, #0d0b1e);
  color: var(--text, #ffffff);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-y: visible;
  transition: background 0.25s ease, color 0.25s ease;
}

a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; border: none; background: none; }
input, textarea { font: inherit; }
h1, h2, h3, h4 { margin: 0; }
p { margin: 0; }
:focus-visible {
  outline: 2px solid rgba(29,185,84,0.85);
  outline-offset: 3px;
}

/* ── Design tokens ────────────────────────────────────────────────────────── */
:root {
  --green: #1db954;
  --green-light: #1ed760;
  --purple: #7c3aed;
  --bg: #0d0b1e;
  --bg-body: #0d0b1e;
  --bg-1: rgba(255,255,255,0.055);
  --bg-2: rgba(255,255,255,0.095);
  --border: rgba(255,255,255,0.13);
  --border-2: rgba(255,255,255,0.22);
  --muted: rgba(255,255,255,0.72);
  --muted-2: rgba(255,255,255,0.52);
  --text: #f8fafc;
  --nav-bg: rgba(13,11,30,0.88);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-body: #f6f7fb;
  --bg-1: rgba(8,10,18,0.055);
  --bg-2: rgba(8,10,18,0.10);
  --border: rgba(8,10,18,0.15);
  --border-2: rgba(8,10,18,0.25);
  --muted: rgba(8,10,18,0.68);
  --muted-2: rgba(8,10,18,0.48);
  --text: #080a12;
  --nav-bg: rgba(255,255,255,0.94);
}

[data-theme="light"] .spinner {
  border-color: rgba(0,0,0,0.10);
  border-top-color: rgba(0,0,0,0.45);
}
[data-theme="light"] .hero-demo-placeholder,
[data-theme="light"] .hero-trust,
[data-theme="light"] .phase-quote,
[data-theme="light"] .track-num {
  color: var(--muted);
}
[data-theme="light"] .mood-track,
[data-theme="light"] .generating-progress,
[data-theme="light"] .generating-track-art,
[data-theme="light"] .track-art,
[data-theme="light"] .dp-comp-bar-wrap,
[data-theme="light"] .dp-score-bar,
[data-theme="light"] .explain-emotion-bar-wrap,
[data-theme="light"] .explain-lane-bar-wrap {
  background: var(--bg-2);
}
[data-theme="light"] .not-found h2,
[data-theme="light"] .taste-cell-value {
  color: var(--text);
}
[data-theme="light"] .result-safety-row strong,
[data-theme="light"] .generation-safety-chip {
  color: var(--muted);
}
[data-theme="light"] .result-card,
[data-theme="light"] .dp-card,
[data-theme="light"] .debug-waterfall-step {
  background-color: rgba(255,255,255,0.74);
  border-color: rgba(8,10,18,0.18);
}
[data-theme="light"] .result-vibes,
[data-theme="light"] .dp-badge,
[data-theme="light"] .gallery-filter-meta {
  color: var(--muted);
}

[data-theme="dark"] .hero-demo-placeholder,
[data-theme="dark"] .hero-trust,
[data-theme="dark"] .phase-title,
[data-theme="dark"] .phase-quote,
[data-theme="dark"] .phase-meta,
[data-theme="dark"] .mood-alt-chip,
[data-theme="dark"] .generation-safety-chip {
  color: var(--muted);
}

[data-theme="dark"] .section-label,
[data-theme="dark"] .prompt-guide-label,
[data-theme="dark"] .prompt-guide-example,
[data-theme="dark"] .vibe-hint,
[data-theme="dark"] .length-icon,
[data-theme="dark"] .mood-axis-labels,
[data-theme="dark"] .dj-build-step {
  color: var(--muted-2);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  font-size: 14px;
  padding: 9px 20px;
  transition: opacity 0.15s, transform 0.1s, background 0.15s;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  line-height: 1.4;
}

.btn:active { transform: scale(0.97); }

.btn-green  { background: var(--green); color: #000; }
.btn-green:hover { background: var(--green-light); }

.btn-ghost  { background: var(--bg-2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg-2); }

.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border-2); }
.btn-outline:hover { background: var(--bg-1); }

.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 15px 34px; font-size: 16px; font-weight: 700; }

.btn-arrow { display: inline-block; transition: transform 0.15s; }
.btn:hover .btn-arrow { transform: translateX(3px); }

/* ── Spotify icon ─────────────────────────────────────────────────────────── */
.spi {
  width: 18px;
  height: 18px;
  background: #000;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.spi svg { display: block; }

/* ── Nav ──────────────────────────────────────────────────────────────────── */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--nav-bg);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.4px;
}

.nav-logo-mark {
  width: 30px;
  height: 30px;
  background: var(--purple);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 15px;
  color: #fff;
  flex-shrink: 0;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-link {
  font-size: 13px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 3px;
  transition: color 0.15s;
}
.nav-link:hover { color: var(--text); }
.nav-link-arrow { transition: transform 0.15s; display: inline-block; }
.nav-link:hover .nav-link-arrow { transform: translateX(2px); }

.nav-sync-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 4px 12px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}
.nav-sync-chip small {
  color: var(--muted-2);
  font-size: 11px;
}
.nav-sync-progress {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 3px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255,255,255,0.10);
  overflow: hidden;
}
.nav-sync-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #1db954);
  transition: width 0.9s ease;
}
.nav-library-panel {
  display: flex;
  align-items: center;
  gap: 7px;
}
.nav-library-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}
.nav-sync-action {
  padding: 5px 9px;
  font-size: 11px;
}
@media (max-width: 820px) {
  .nav-library-actions,
  .nav-sync-chip small {
    display: none;
  }
}
@media (max-width: 560px) {
  .nav-sync-chip {
    max-width: 130px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  flex-shrink: 0;
}
.sync-dot--live {
  background: var(--green);
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* ── Profile dropdown ─────────────────────────────────────────────────────── */
.nav-profile-wrap {
  position: relative;
}

.nav-avatar-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.nav-avatar-btn:hover { background: var(--bg-2); }

.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 190px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0,0,0,0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 200;
}
.profile-dropdown.open { display: flex; }

.profile-dropdown-header {
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
}
.profile-dropdown-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text, #fff);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
  text-align: left;
  width: 100%;
}
.profile-dropdown-item:hover { background: var(--bg-2); }

.profile-dropdown-logout { color: #f87171; }
.profile-dropdown-logout:hover { background: rgba(248,113,113,0.08); }

.profile-dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 3px 0;
}

.nav-avatar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-2);
  border: 1px solid var(--border-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.nav-avatar img { width: 100%; height: 100%; object-fit: cover; }

.nav-logout {
  color: var(--muted-2);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.nav-logout:hover { color: var(--text, #fff); }

/* ── No-library mode toggle ───────────────────────────────────────────────── */
.no-library-row {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.no-library-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}

.toggle-switch {
  width: 36px;
  height: 20px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.14);
  border: 1px solid var(--border-2);
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s;
  cursor: pointer;
}
.toggle-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255,255,255,0.5);
  transition: transform 0.2s, background 0.2s;
}
.toggle-switch.on {
  background: var(--purple);
  border-color: var(--purple);
}
.toggle-switch.on::after {
  transform: translateX(16px);
  background: #fff;
}

.no-library-text { display: flex; flex-direction: column; gap: 2px; }
.no-library-label { font-size: 13px; font-weight: 600; color: var(--text, #fff); }
.no-library-sub { font-size: 11px; color: var(--muted-2); }

/* ── Unified activity feed ────────────────────────────────────────────────── */
.activity-feed {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  transition: background 0.12s;
}
.activity-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.activity-item:hover { background: var(--bg-2); }

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.activity-dot--green { background: var(--green); opacity: 0.75; }
.activity-dot--purple { background: #a78bfa; opacity: 0.75; }

.activity-body { flex: 1; min-width: 0; }
.activity-label {
  font-size: 13px;
  color: var(--text, rgba(255,255,255,0.8));
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-meta { font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.activity-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

/* ── Shared states ────────────────────────────────────────────────────────── */
.loading-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 100px 24px;
  gap: 16px;
  color: var(--muted);
  font-size: 14px;
}

.spinner {
  width: 28px;
  height: 28px;
  border: 2.5px solid rgba(255,255,255,0.1);
  border-top-color: rgba(255,255,255,0.5);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}
.spinner--sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
  border-top-color: #000;
}
.spinner--purple { border-top-color: var(--purple); }

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

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
}
.empty-state h3 { font-size: 18px; color: var(--text); margin-bottom: 8px; }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.5;
}
.alert-error { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); color: #fca5a5; }
.alert-warn { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.22); color: #fcd34d; }
.alert-success { background: rgba(29,185,84,0.08); border: 1px solid rgba(29,185,84,0.2); color: #6ee7b7; }
.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 6px;
}
.error-hint {
  display: block;
  margin-top: 6px;
  opacity: 0.85;
}
.error-diagnostics {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 7px 0 2px;
}
.error-diagnostics span {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: rgba(239,68,68,0.10);
  border: 1px solid rgba(239,68,68,0.18);
  color: var(--text);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.badge-green { background: rgba(29,185,84,0.15); color: var(--green); }
.badge-amber { background: rgba(245,158,11,0.16); color: #f59e0b; }
.badge-purple { background: rgba(124,58,237,0.15); color: #c4b5fd; }
.badge-muted { background: var(--bg-2); color: var(--muted); }

/* ── Section label ────────────────────────────────────────────────────────── */
.label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* ── LANDING ──────────────────────────────────────────────────────────────── */
.landing-page {
  display: flex;
  flex-direction: column;
}

/* Hero */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 24px 72px;
  background: radial-gradient(ellipse 100% 60% at 50% 0%, rgba(124,58,237,0.10) 0%, transparent 60%);
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius-full);
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin-bottom: 28px;
}

.hero-eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--purple);
  flex-shrink: 0;
}

.hero h1 {
  font-size: clamp(46px, 9vw, 76px);
  font-weight: 800;
  letter-spacing: -2.5px;
  line-height: 1.02;
  margin-bottom: 20px;
}

.hero h1 em {
  font-style: normal;
  color: var(--purple);
}

.hero-sub {
  font-size: 18px;
  color: var(--muted);
  max-width: 400px;
  line-height: 1.65;
  margin-bottom: 48px;
}

.hero-demo {
  width: 100%;
  max-width: 540px;
  margin-bottom: 32px;
}

.hero-demo-box {
  background: var(--bg-1);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-lg);
  padding: 20px 22px 16px;
  margin-bottom: 12px;
  text-align: left;
  position: relative;
}

.hero-demo-placeholder {
  font-size: 17px;
  color: rgba(255,255,255,0.2);
  font-style: italic;
  margin-bottom: 10px;
}

.hero-demo-cursor {
  display: inline-block;
  width: 2px;
  height: 18px;
  background: var(--purple);
  border-radius: 1px;
  animation: blink 1.1s step-end infinite;
  vertical-align: middle;
}

@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }

.hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: center;
}

.hero-chip {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  font-style: italic;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 12px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  font-family: inherit;
}

.hero-chip:hover {
  color: var(--text);
  border-color: var(--green);
  background: rgba(29, 185, 84, 0.08);
}

.landing-beta-note {
  max-width: 520px;
  margin: 14px auto 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted-2);
  text-align: center;
  opacity: 0.85;
}

.generate-gate-msg {
  font-size: 13px;
  color: var(--muted-2);
  margin: 0 0 10px;
}

.track-why {
  font-size: 11px;
  color: var(--muted-2);
  margin-top: 3px;
  line-height: 1.35;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 1000;
  padding: 10px 14px;
  background: var(--green);
  color: #0d0b1e;
  font-weight: 700;
  border-radius: 8px;
}

.skip-link:focus-visible {
  left: 12px;
  top: 12px;
}

.kwalify-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 9999;
  max-width: min(92vw, 420px);
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.kwalify-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.kwalify-toast--success { border-color: rgba(29, 185, 84, 0.35); }
.kwalify-toast--error { border-color: rgba(239, 68, 68, 0.35); }

.profile-dropdown-danger { color: var(--muted-2); font-size: 13px; }
.profile-dropdown-danger:hover { color: #f87171; background: rgba(248,113,113,0.08); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .hero-demo-cursor { display: none; }
}

.hero-cta { margin-bottom: 14px; }

.landing-auth-alert {
  width: min(100%, 520px);
  margin: 0 auto 16px;
}

.hero-trust {
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.hero-trust-sep { opacity: 0.3; }

/* How it works */
.how-section {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 80px;
  text-align: center;
}

.how-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 16px;
}

.how-title {
  font-size: clamp(26px, 4.5vw, 40px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 14px;
}

.how-sub {
  font-size: 16px;
  color: var(--muted);
  max-width: 520px;
  margin: 0 auto 52px;
  line-height: 1.7;
}

.how-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 680px) { .how-steps { grid-template-columns: 1fr; } }

.how-step {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 22px;
  text-align: left;
  position: relative;
}

.how-step-num {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--purple);
  opacity: 0.85;
  margin-bottom: 14px;
}

.how-step-icon {
  font-size: 28px;
  margin-bottom: 14px;
}

.how-step h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}

.how-step p {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
}

/* Features */
.features-section {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

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

.feature-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.feature-icon {
  font-size: 24px;
  margin-bottom: 12px;
}

.feature-card h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 7px;
}

.feature-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* Bottom CTA */
.cta-section {
  text-align: center;
  padding: 64px 24px 100px;
  background: radial-gradient(ellipse 80% 70% at 50% 0%, rgba(124,58,237,0.1) 0%, transparent 70%);
}

.cta-section h2 {
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: -1.2px;
  margin-bottom: 12px;
}

.cta-section p {
  font-size: 16px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* ── APP PAGE (logged in) ────────────────────────────────────────────────── */
.app-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 44px 24px 80px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

/* Two-column hero grid */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  align-items: start;
}

.input-grid--single { grid-template-columns: 1fr; }

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

/* Vibe input column */
.library-chapters {
  margin-bottom: 8px;
}

.library-chapters .section-title {
  margin-bottom: 14px;
}

.vibe-heading {
  font-size: clamp(34px, 5vw, 50px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.05;
  margin-bottom: 8px;
}

.vibe-sub {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
}

.vibe-input-wrap {
  position: relative;
}

.vibe-glow {
  position: absolute;
  inset: -6px;
  border-radius: 22px;
  background: rgba(124,58,237,0.15);
  filter: blur(24px);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.vibe-input-wrap:focus-within .vibe-glow { opacity: 1; }

.vibe-inner {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s;
}

.vibe-input-wrap:focus-within .vibe-inner { border-color: rgba(124,58,237,0.45); }

.vibe-textarea {
  display: block;
  width: 100%;
  min-height: 72px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 18px;
  padding: 14px 16px 40px;
  resize: none;
  outline: none;
  line-height: 1.45;
}

.vibe-textarea::placeholder { color: var(--muted-2); }

.prompt-guide {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: -6px;
  color: var(--muted);
  font-size: 12px;
}
.prompt-guide-label {
  color: var(--muted-2);
  font-weight: 600;
}
.prompt-guide-chip {
  padding: 3px 8px;
  border-radius: var(--radius-full);
  background: var(--bg-1);
  border: 1px solid var(--border);
  color: var(--muted);
}
.prompt-guide-example {
  color: var(--muted-2);
  font-style: italic;
}

.vibe-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 10px;
  pointer-events: none;
}

.vibe-hint {
  font-size: 11px;
  color: var(--muted-2);
}

.vibe-count {
  font-size: 11px;
  font-family: monospace;
  color: var(--muted);
}

/* Controls row */
.controls-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
}

.controls-row--length {
  justify-content: space-between;
}

.length-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.mode-group {
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.mode-btn {
  padding: 6px 13px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}

.mode-btn:hover { color: var(--text); background: var(--bg-1); }
.mode-btn.active { background: rgba(124,58,237,0.15); color: #a78bfa; }
.mode-helper {
  margin: -6px 0 10px;
  color: var(--muted);
  font-size: 12px;
}

.length-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 140px;
}

.familiarity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  margin-top: -4px;
}

.familiarity-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
}

.familiarity-group {
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}

.familiarity-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  transition: background 0.15s, color 0.15s;
}

.familiarity-btn:hover { color: var(--text); background: var(--bg-1); }
.familiarity-btn.active { background: rgba(8,145,178,0.15); color: #22d3ee; }

.segment-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 8px 0 10px;
}

.segment-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(124,58,237,0.12);
  color: #c4b5fd;
  border: 1px solid rgba(124,58,237,0.22);
}

.coherence-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0 10px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
}

.coherence-badge--good { border-color: rgba(34,197,94,0.35); color: #86efac; }
.coherence-badge--ok { border-color: rgba(234,179,8,0.35); color: #fde047; }
.coherence-badge--low { border-color: rgba(248,113,113,0.35); color: #fca5a5; }

.coherence-badge-score {
  font-weight: 800;
  font-size: 13px;
}

.coherence-badge-label {
  color: var(--muted);
  font-weight: 500;
}

.length-icon { color: var(--muted-2); flex-shrink: 0; }

.length-slider {
  flex: 1;
  accent-color: var(--green);
  cursor: pointer;
  height: 3px;
  appearance: none;
  background: var(--bg-2);
  border-radius: var(--radius-full);
  outline: none;
}

.length-slider::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--text);
  border-radius: 50%;
  cursor: pointer;
}

.length-val {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  min-width: 58px;
  white-space: nowrap;
}

/* Generate button */
.gen-btn {
  width: 100%;
  padding: 17px 24px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.2s, transform 0.1s, box-shadow 0.2s;
  background: var(--purple);
  color: #fff;
  box-shadow: 0 0 28px rgba(124,58,237,0.28);
  border: none;
}

.gen-btn:hover:not(:disabled) { background: #8b5cf6; transform: scale(1.01); }
.gen-btn:active:not(:disabled) { transform: scale(0.99); }

.gen-btn:disabled, .gen-btn.loading {
  background: var(--bg-2);
  color: var(--muted-2);
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

/* Mood interpreter panel */
.mood-col { width: 100%; }

.mood-panel {
  background: linear-gradient(160deg, rgba(255,255,255,0.035) 0%, transparent 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.mood-glow {
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(124,58,237,0.14);
  filter: blur(60px);
  transition: opacity 0.8s ease, transform 0.8s ease;
  opacity: 0;
  pointer-events: none;
}

.mood-glow.active { opacity: 1; transform: scale(1.3); }

.mood-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 500;
  color: #a78bfa;
  position: relative;
  z-index: 1;
}

.mood-bars {
  display: flex;
  flex-direction: column;
  gap: 11px;
  position: relative;
  z-index: 1;
}

.mood-bar-row { display: flex; flex-direction: column; gap: 5px; }

.mood-bar-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted-2);
}

.mood-bar-level { font-size: 11px; }

.mood-track {
  height: 3px;
  background: rgba(255,255,255,0.07);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.mood-fill {
  height: 100%;
  border-radius: var(--radius-full);
  width: 0%;
  transition: width 0.9s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 0.8;
}

.fill-blue   { background: #60a5fa; }
.fill-purple { background: #c084fc; }
.fill-indigo { background: #818cf8; }
.fill-teal   { background: #2dd4bf; }
.fill-amber  { background: #fbbf24; }

.mood-tags-wrap { position: relative; z-index: 1; }

.mood-tags-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  margin-bottom: 8px;
}

.mood-tags-row { display: flex; flex-wrap: wrap; gap: 5px; }

.mood-tag {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.6);
  transition: opacity 0.5s ease;
}

.mood-style {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  position: relative;
  z-index: 1;
}

.mood-style-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  margin-bottom: 5px;
}

.mood-style-text {
  font-size: 13px;
  font-style: italic;
  color: rgba(255,255,255,0.7);
  transition: opacity 0.5s ease;
}

/* ── Live scene preview panel ──────────────────────────────────────────────── */
.mood-scene-divider {
  height: 1px;
  background: var(--border);
  margin: 14px 0 12px;
}

.mood-scene-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.25);
  margin-bottom: 6px;
}

.mood-scene-name {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255,255,255,0.88);
  margin-bottom: 7px;
}

.mood-scene-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 2px;
}

.mood-scene-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  letter-spacing: 0.4px;
}

.mood-scene-badge--era {
  background: rgba(167,139,250,0.12);
  color: #a78bfa;
  border: 1px solid rgba(167,139,250,0.28);
}

.mood-scene-badge--genre {
  background: rgba(29,185,84,0.10);
  color: #1db954;
  border: 1px solid rgba(29,185,84,0.24);
}

.mood-alts-row {
  margin-top: 10px;
}

.mood-alts-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.22);
  margin-bottom: 6px;
}

.mood-alts {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.mood-alt-chip {
  font-size: 11px;
  color: rgba(255,255,255,0.45);
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 99px;
  padding: 2px 9px;
  cursor: default;
  transition: color 0.2s, border-color 0.2s;
}

.mood-alt-chip:hover {
  color: rgba(255,255,255,0.7);
  border-color: rgba(255,255,255,0.22);
}

/* Generating state */
.generation-top-wrap {
  position: sticky;
  top: 62px;
  z-index: 120;
  max-width: 760px;
  margin: 14px auto 0;
  padding: 0 18px;
}
.generating-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(124,58,237,0.06);
  border: 1px solid rgba(124,58,237,0.18);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  animation: fadein 0.3s ease;
  box-shadow: 0 14px 40px rgba(0,0,0,0.22);
  backdrop-filter: blur(14px);
}

.generating-body { flex: 1; min-width: 0; }
.generating-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}
.generating-title { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.generating-sub { font-size: 13px; color: var(--muted); }
.generation-cancel-btn {
  flex: 0 0 auto;
  border: 1px solid rgba(239,68,68,0.28);
  background: rgba(239,68,68,0.08);
  color: #fca5a5;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.generation-cancel-btn:hover:not(:disabled) {
  border-color: rgba(239,68,68,0.48);
  background: rgba(239,68,68,0.14);
}
.generation-cancel-btn:disabled {
  opacity: 0.65;
  cursor: wait;
}
.dj-live-stage {
  margin-top: 13px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-full);
  background: rgba(124,58,237,0.12);
  border: 1px solid rgba(124,58,237,0.20);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.dj-live-icon {
  color: #1db954;
  animation: pulse 1.1s ease-in-out infinite;
}
.dj-live-label {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dj-live-count {
  color: var(--muted);
  font-weight: 600;
}
.dj-build-bar {
  margin-top: 13px;
  display: grid;
  gap: 6px;
}
.dj-build-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted-2);
}
.dj-build-step.done { color: #4ade80; }
.dj-build-step.active { color: var(--text); font-weight: 700; }
.dj-build-icon {
  width: 16px;
  text-align: center;
  font-size: 11px;
  line-height: 1;
}
.dj-build-step.active .dj-build-icon {
  color: #1db954;
  animation: pulse 1.1s ease-in-out infinite;
}
.generation-safety-chip {
  display: inline-flex;
  width: fit-content;
  margin-top: 10px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(29,185,84,0.18);
  background: rgba(29,185,84,0.08);
  color: rgba(255,255,255,0.62);
  font-size: 11px;
}
.generating-progress {
  height: 4px;
  margin-top: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
}
.generating-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7c3aed, #1db954);
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.generation-details-toggle {
  width: fit-content;
  margin-top: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.generation-details-toggle:hover {
  border-color: rgba(29,185,84,0.34);
  background: rgba(29,185,84,0.10);
}
.generation-details-panel {
  margin-top: 10px;
  display: grid;
  gap: 7px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(255,255,255,0.04);
}
.generation-details-panel div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
}
.generation-details-panel strong {
  color: var(--text);
  font-weight: 700;
}
.generation-details-panel span {
  color: var(--muted);
  text-align: right;
}
@media (max-width: 560px) {
  .generation-top-wrap {
    top: 58px;
    padding: 0 10px;
  }
  .generating-card {
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
  }
  .generating-head {
    flex-direction: column;
  }
  .generation-cancel-btn {
    width: 100%;
  }
  .generation-details-panel div {
    flex-direction: column;
    gap: 2px;
  }
  .generation-details-panel span {
    text-align: left;
  }
}
.generating-partials {
  margin-top: 14px;
  display: grid;
  gap: 7px;
}
.generating-partials-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.adding-tracks {
  color: #1db954;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}
.generating-track {
  display: grid;
  grid-template-columns: 22px 32px 1fr;
  gap: 9px;
  align-items: center;
  min-width: 0;
}
.generating-track-num {
  font-size: 12px;
  color: var(--muted-2);
  text-align: right;
}
.generating-track-art {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  overflow: hidden;
  background: rgba(255,255,255,0.08);
}
.generating-track-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.generating-track-meta { min-width: 0; }
.generating-track-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.generating-track-artist {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.result-safety-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(29,185,84,0.08);
  border: 1px solid rgba(29,185,84,0.16);
  color: var(--muted);
  font-size: 11px;
}
.result-safety-row strong {
  color: rgba(255,255,255,0.76);
  font-weight: 600;
}

/* Result card */
.result-card {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  background: linear-gradient(140deg, rgba(124,58,237,0.08) 0%, transparent 70%);
  border: 1px solid rgba(124,58,237,0.22);
  border-radius: var(--radius-xl);
  padding: 26px;
  animation: slide-up 0.4s ease;
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}

.result-art {
  width: 100px;
  height: 100px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(124,58,237,0.18), rgba(167,139,250,0.10));
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 560px) {
  .result-card { flex-direction: column; }
  .result-art { width: 100%; height: 90px; border-radius: var(--radius-md) var(--radius-md) 0 0; }
}

.result-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.result-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
}
.result-meta { font-size: 12px; color: var(--muted); }

.result-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1.15;
  text-align: center;
}

.result-insight { font-size: 13px; color: var(--muted); text-align: center; }
.result-insight--notice {
  width: fit-content;
  align-self: center;
  padding: 5px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245,158,11,0.28);
  background: rgba(245,158,11,0.10);
  color: var(--text);
}

.result-confidence {
  width: fit-content;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(29,185,84,0.28);
  background: rgba(29,185,84,0.10);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
}
.result-confidence strong {
  color: #6ee7b7;
}
.result-confidence--recovered {
  border-color: rgba(245,158,11,0.34);
  background: rgba(245,158,11,0.12);
}
.result-confidence--recovered strong {
  color: #fbbf24;
}
.result-trust-chips {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.result-trust-chips span {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: var(--bg-1);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.intent-preview-strip,
.intent-understanding-card {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(167, 139, 250, 0.22);
  background: rgba(124, 58, 237, 0.08);
  font-size: 12px;
  line-height: 1.45;
}
.intent-understanding-card {
  margin-top: 12px;
  text-align: left;
}
.intent-understanding-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #c4b5fd;
  margin-bottom: 6px;
}
.intent-understanding-line {
  color: var(--text);
  margin-top: 4px;
}
.intent-understanding-line--warn strong {
  color: #fbbf24;
}
.intent-understanding-muted {
  color: var(--muted);
  font-size: 11px;
}
.intent-preview-strip[hidden] {
  display: none !important;
}

.result-vibes {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255,255,255,0.55);
}

.vibe-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.vd-purple { background: #c084fc; }
.vd-indigo { background: #818cf8; }
.vd-blue   { background: #60a5fa; }

.result-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

/* Quick moments */
.quick-section { display: flex; flex-direction: column; gap: 10px; }

.chips-row {
  display: flex;
  overflow-x: auto;
  gap: 7px;
  padding-bottom: 4px;
  mask-image: linear-gradient(to right, black 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 88%, transparent 100%);
}

.hide-scrollbar::-webkit-scrollbar { display: none; }
.hide-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.quick-chip {
  flex-shrink: 0;
  padding: 7px 15px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 13px;
  color: rgba(255,255,255,0.6);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}

.quick-chip:hover {
  background: var(--bg-2);
  color: #fff;
  transform: translateY(-1px);
}

/* Taste strip */
.taste-strip {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-1);
}

.taste-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: transparent;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s;
}

.taste-toggle:hover { background: var(--bg-2); }

.taste-toggle-left { display: flex; align-items: center; gap: 8px; }

.taste-chevron {
  color: var(--muted-2);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}
.taste-chevron.open { transform: rotate(180deg); }

.taste-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.25s ease;
  opacity: 0;
}
.taste-body.open { max-height: 200px; opacity: 1; }

.taste-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  border-top: 1px solid var(--border);
  padding: 16px;
}

@media (max-width: 700px) { .taste-grid { grid-template-columns: repeat(2, 1fr); } }

.taste-cell { display: flex; flex-direction: column; gap: 4px; }

.taste-cell-label {
  font-size: 11px;
  color: var(--muted-2);
  font-weight: 500;
}

.taste-cell-value {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.home-utility-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-1);
}
.home-utility-row--compact {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
}
.home-utility-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}
.home-utility-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.home-utility-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Recent section */
.recent-section { display: flex; flex-direction: column; gap: 16px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-title { font-size: 16px; font-weight: 700; }

.section-action {
  font-size: 13px;
  color: var(--muted);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  padding: 5px 14px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.section-action:hover { background: var(--bg-2); color: var(--text); }
.section-action:disabled { cursor: not-allowed; opacity: 0.5; }

.phases-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.phase-group {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.phase-group-head {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.phase-head-green { color: var(--green); }
.phase-head-purple { color: #a78bfa; }

.phase-items { display: flex; flex-direction: column; }

.phase-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 16px;
  transition: background 0.12s;
}
.phase-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.phase-item:hover { background: var(--bg-2); }

.phase-quote {
  font-size: 13px;
  color: rgba(255,255,255,0.8);
  font-style: italic;
  line-height: 1.4;
  flex: 1;
}

.phase-meta { font-size: 11px; color: var(--muted-2); white-space: nowrap; flex-shrink: 0; margin-top: 2px; }

.phase-item-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.phase-open {
  display: flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 5px;
  background: rgba(124,58,237,0.12);
  transition: background 0.15s;
}
.phase-open:hover { background: rgba(124,58,237,0.22); }

.delete-btn {
  background: transparent;
  color: var(--muted-2);
  width: 24px;
  height: 24px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  transition: background 0.12s, color 0.12s;
  cursor: pointer;
  flex-shrink: 0;
}
.delete-btn:hover { background: rgba(255,60,60,0.14); color: #f87171; }

/* App footer */
.app-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px 44px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  font-size: 13px;
  color: var(--muted-2);
}

.footer-link { transition: color 0.15s; }
.footer-link:hover { color: var(--text); }

.footer-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }

.site-footer { justify-content: space-between; gap: 12px; }
.footer-left { font-size: 13px; color: var(--muted-2); }
.footer-brand { white-space: nowrap; }

/* Legal pages */
.legal-page {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 64px;
  color: var(--text);
  line-height: 1.65;
}
.legal-page h1 {
  font-size: clamp(28px, 5vw, 36px);
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.legal-page h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 28px 0 10px;
}
.legal-page p,
.legal-page li { color: var(--muted); font-size: 15px; }
.legal-page ul { padding-left: 1.25rem; margin: 8px 0 0; }
.legal-page li { margin-bottom: 6px; }
.legal-page a { color: var(--green); text-decoration: underline; text-underline-offset: 2px; }
.legal-updated { font-size: 13px; color: var(--muted-2); margin-bottom: 24px; }
.legal-page code {
  font-size: 0.9em;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ── GALLERY PAGE ─────────────────────────────────────────────────────────── */
.gallery-wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 44px 24px 80px;
}

.gallery-header { margin-bottom: 32px; }

.gallery-title {
  font-size: clamp(26px, 5vw, 38px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.gallery-sub {
  font-size: 15px;
  color: var(--muted);
}

.gallery-filter-panel {
  display: grid;
  gap: 10px;
  margin: -14px 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-1);
}
.gallery-search-wrap { min-width: 0; }
.gallery-search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg);
  color: var(--text);
  padding: 8px 12px;
  outline: none;
}
.gallery-search-input::placeholder { color: var(--muted-2); }
.gallery-search-input:focus { border-color: rgba(124,58,237,0.45); }
.gallery-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.gallery-filter-chips {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.gallery-filter-chip,
.gallery-sort-select {
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-1);
  color: var(--muted);
  padding: 6px 11px;
  font-size: 12px;
}
.gallery-filter-chip.active {
  border-color: rgba(124,58,237,0.35);
  background: rgba(124,58,237,0.13);
  color: #a78bfa;
}
.gallery-sort-select {
  cursor: pointer;
  outline: none;
}
.gallery-filter-meta {
  color: var(--muted-2);
  font-size: 12px;
}

.gallery-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 24px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-1);
}
.gallery-tools-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.gallery-tools-copy strong {
  color: var(--text);
  font-size: 13px;
}
.gallery-tools-copy span {
  color: var(--muted);
  font-size: 12px;
}
.gallery-tools-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.gallery-danger-action {
  color: #f87171;
  border-color: rgba(248,113,113,0.26);
}
.gallery-danger-action:hover {
  color: #ef4444;
  background: rgba(248,113,113,0.10);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

@media (max-width: 760px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .gallery-grid { grid-template-columns: 1fr; } }

.gallery-card {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
}
.gallery-card:hover { transform: translateY(-2px); border-color: var(--border-2); }
.gallery-card--selectable {
  cursor: pointer;
  user-select: none;
}
.gallery-card--selectable.selected {
  border-color: rgba(29,185,84,0.55);
  box-shadow: 0 0 0 2px rgba(29,185,84,0.12);
}
.gallery-select-check {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  color: #03180b;
  background: rgba(255,255,255,0.86);
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0,0,0,0.18);
}
.gallery-card.selected .gallery-select-check {
  background: var(--green);
  border-color: rgba(29,185,84,0.55);
}

.gallery-card-mosaic {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-2);
  overflow: hidden;
}

.mosaic-img { width: 100%; height: 100%; object-fit: cover; background: var(--bg-2); }

.mosaic-empty {
  width: 100%;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  background: linear-gradient(135deg, var(--bg-2), var(--bg-1));
  grid-column: span 2;
}

.gallery-card-body { padding: 14px; }

.gallery-card-name {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 7px; }

.gallery-tag {
  font-size: 11px;
  background: var(--bg-2);
  border-radius: var(--radius-full);
  padding: 2px 8px;
  color: var(--muted);
}

.gallery-card-quote {
  font-size: 12px;
  color: var(--muted-2);
  font-style: italic;
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gallery-generator-note {
  margin-bottom: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(29,185,84,0.18);
  background: rgba(29,185,84,0.07);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.gallery-card-meta { font-size: 11px; color: var(--muted-2); margin-bottom: 10px; }
.gallery-card-actions { display: flex; gap: 7px; }

@media (max-width: 700px) {
  .gallery-tools {
    align-items: flex-start;
    flex-direction: column;
  }
  .gallery-tools-actions { justify-content: flex-start; }
}

/* ── PLAYLIST SHARE PAGE ──────────────────────────────────────────────────── */
.playlist-page {
  max-width: 640px;
  margin: 0 auto;
  padding: 44px 24px 80px;
}

.playlist-title {
  font-size: clamp(22px, 5vw, 34px);
  font-weight: 800;
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.playlist-vibe {
  font-size: 14px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 6px;
}

.playlist-meta {
  font-size: 13px;
  color: var(--muted-2);
  margin-bottom: 22px;
}

.playlist-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 28px; }

.tracks-list { display: flex; flex-direction: column; gap: 3px; }

.track-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.track-row:hover { background: var(--bg-1); }
.track-row[data-feedback-note]::after {
  content: attr(data-feedback-note);
  color: var(--muted);
  font-size: 11px;
  margin-left: auto;
  white-space: nowrap;
}

.track-num { font-size: 12px; color: rgba(255,255,255,0.2); width: 20px; text-align: right; flex-shrink: 0; }

.track-art {
  width: 38px;
  height: 38px;
  border-radius: 5px;
  background: #14141e;
  flex-shrink: 0;
  overflow: hidden;
}
.track-art img { width: 100%; height: 100%; object-fit: cover; }

.track-info { flex: 1; min-width: 0; }

.track-name {
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-artist {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 220px;
}
@media (max-width: 620px) {
  .track-row {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .track-info {
    flex-basis: calc(100% - 82px);
  }
  .track-actions {
    width: 100%;
    max-width: none;
    justify-content: flex-start;
    padding-left: 70px;
  }
  .track-row[data-feedback-note]::after {
    width: 100%;
    margin-left: 70px;
    white-space: normal;
  }
}

/* Not found */
.not-found {
  text-align: center;
  padding: 80px 24px;
  color: var(--muted);
}
.not-found h2 { font-size: 20px; color: #fff; margin-bottom: 10px; }

/* ── Admin Debug Panel ────────────────────────────────────────────────────── */
.dp-toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 0 2px;
}

.dp-toggle-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(124,58,237,0.35);
  background: rgba(124,58,237,0.10);
  color: #a78bfa;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.dp-toggle-btn:hover {
  background: rgba(124,58,237,0.18);
  border-color: rgba(124,58,237,0.55);
}

.dp-chevron {
  transition: transform 0.2s;
}
.dp-chevron.open {
  transform: rotate(180deg);
}

.dp-admin-badge {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #f59e0b;
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-full);
  padding: 2px 8px;
}

.dp-panel {
  margin-top: 10px;
  border: 1px solid rgba(124,58,237,0.22);
  border-radius: var(--radius-lg);
  background: rgba(124,58,237,0.04);
  overflow: hidden;
}

.dp-header {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(124,58,237,0.08);
  font-size: 0.8rem;
  font-weight: 600;
  color: #a78bfa;
}

.dp-model-tag {
  margin-left: auto;
  font-size: 0.68rem;
  font-weight: 500;
  font-family: monospace;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
}

.dp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: rgba(255,255,255,0.05);
}

.dp-card {
  background: var(--bg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dp-card--wide {
  background: var(--bg);
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,0.05);
}

.dp-card-title {
  font-size: 0.73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.dp-scene-name {
  font-size: 1.05rem;
  font-weight: 700;
  color: #e0d7ff;
  text-transform: capitalize;
}

.dp-scene-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dp-badge {
  font-size: 0.71rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}
.dp-badge--green {
  background: rgba(29,185,84,0.12);
  color: #1db954;
  border-color: rgba(29,185,84,0.3);
}
.dp-badge--muted {
  background: rgba(255,255,255,0.04);
  color: var(--muted-2);
  border-color: var(--border);
}
.dp-badge--purple {
  background: rgba(124,58,237,0.15);
  color: #a78bfa;
  border-color: rgba(124,58,237,0.3);
}
.dp-badge--amber {
  background: rgba(245,158,11,0.14);
  color: #f59e0b;
  border-color: rgba(245,158,11,0.32);
}

.debug-waterfall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.debug-waterfall-step {
  padding: 8px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
}
.debug-waterfall-step span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.debug-waterfall-step strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 15px;
}

.dp-none {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

/* Weight bars */
.dp-weights {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.dp-weight-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dp-weight-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
  width: 68px;
  flex-shrink: 0;
}
.dp-weight-bar-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  overflow: hidden;
}
.dp-weight-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.dp-weight-pct {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  width: 28px;
  text-align: right;
  flex-shrink: 0;
}

/* Pool breakdown */
.dp-pool-grid {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.dp-pool-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dp-pool-num {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.dp-pool-lbl {
  font-size: 0.68rem;
  color: var(--muted);
  font-weight: 500;
}
.dp-pool-arrow {
  color: var(--muted-2);
  font-size: 1rem;
}

.dp-note {
  font-size: 0.72rem;
  color: var(--muted);
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
}
.dp-note--green {
  background: rgba(29,185,84,0.06);
  border-color: rgba(29,185,84,0.2);
  color: #6ee7a0;
}
.dp-note--amber {
  background: rgba(245,158,11,0.06);
  border-color: rgba(245,158,11,0.2);
  color: #fcd34d;
}

.dp-sub-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  margin-top: 4px;
}

.dp-exclusions {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dp-excl-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--muted);
}
.dp-excl-count {
  font-weight: 700;
  color: #ef4444;
}

/* Genre chips */
.dp-genre-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dp-genre-chip {
  font-size: 0.73rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  text-transform: capitalize;
}

/* Top scored tracks table */
.dp-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.dp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  min-width: 560px;
}
.dp-table th {
  text-align: left;
  padding: 8px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.dp-table td {
  padding: 7px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}
.dp-track-row { transition: background 0.1s; }
.dp-track-row:hover { background: rgba(255,255,255,0.03); }
.dp-row-even { background: rgba(255,255,255,0.015); }
.dp-track-num { color: var(--muted-2); font-weight: 600; width: 28px; }
.dp-track-id { font-family: monospace; font-size: 0.68rem; color: var(--muted); }
.dp-track-genre { }
.dp-genre-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  text-transform: capitalize;
}

.dp-score-bar-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 70px;
}
.dp-score-bar-wrap span {
  font-size: 0.7rem;
  color: var(--muted);
  width: 22px;
  text-align: right;
  flex-shrink: 0;
}
.dp-score-bar {
  height: 5px;
  border-radius: 3px;
  flex: 1;
  min-width: 0;
}

.dp-table-legend {
  font-size: 0.68rem;
  color: var(--muted-2);
  margin-top: 8px;
  padding: 0 2px;
}

/* Composition bars */
.dp-composition {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dp-comp-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dp-comp-genre {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  width: 80px;
  flex-shrink: 0;
}
.dp-comp-bar-wrap {
  flex: 1;
  height: 7px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.dp-comp-bar {
  height: 100%;
  border-radius: 4px;
  opacity: 0.85;
  transition: width 0.5s ease;
}
.dp-comp-pct {
  font-size: 0.7rem;
  color: var(--muted);
  width: 100px;
  flex-shrink: 0;
  text-align: right;
}

@media (max-width: 600px) {
  .dp-grid {
    grid-template-columns: 1fr;
  }
  .dp-pool-grid {
    gap: 8px;
  }
  .dp-toggle-row {
    flex-wrap: wrap;
  }
}

/* ── Explain This Playlist ───────────────────────────────────────────────────── */
.result-view-tabs {
  display: flex;
  gap: 4px;
  margin: 14px 0 0;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  padding-bottom: 0;
}
.result-tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 7px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
  letter-spacing: 0.01em;
}
.result-tab-btn:hover { color: var(--text); }
.result-tab-btn.active {
  color: #a78bfa;
  border-bottom-color: #a78bfa;
}
.result-tab-btn .tab-icon { margin-right: 5px; font-style: normal; }

.explain-panel {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.explain-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 14px 16px;
}
.explain-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 10px;
}
.explain-intent-primary {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  text-transform: capitalize;
}
.explain-secondary-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}
.explain-tag {
  font-size: 0.72rem;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid rgba(167,139,250,0.25);
  background: rgba(167,139,250,0.08);
  color: #c4b5fd;
  text-transform: capitalize;
}
.explain-emotion-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.explain-emotion-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.explain-emotion-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: capitalize;
  font-weight: 600;
}
.explain-emotion-bar-wrap {
  height: 5px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.explain-emotion-bar {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease;
}
.explain-emotion-val {
  font-size: 0.68rem;
  color: var(--muted-2);
}

.explain-lane-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.explain-lane-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.explain-lane-label {
  font-size: 0.73rem;
  font-weight: 600;
  width: 120px;
  flex-shrink: 0;
  text-transform: capitalize;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.explain-lane-bar-wrap {
  flex: 1;
  height: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.explain-lane-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.explain-lane-pct {
  font-size: 0.7rem;
  color: var(--muted);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}
.explain-lane-count {
  font-size: 0.66rem;
  color: var(--muted-2);
  width: 60px;
  text-align: right;
  flex-shrink: 0;
}

.explain-cluster-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.explain-cluster-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.025);
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.05);
}
.explain-cluster-id {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text);
  width: 120px;
  flex-shrink: 0;
  text-transform: capitalize;
}
.explain-cluster-genres {
  flex: 1;
  font-size: 0.66rem;
  color: var(--muted);
}
.explain-cluster-tracks {
  font-size: 0.68rem;
  color: #4ade80;
  flex-shrink: 0;
}
.explain-cluster-weight {
  font-size: 0.66rem;
  color: var(--muted-2);
  width: 50px;
  text-align: right;
  flex-shrink: 0;
}

.explain-entropy-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.explain-entropy-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.explain-entropy-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.explain-entropy-name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text);
}
.explain-entropy-val {
  font-size: 0.68rem;
  color: var(--muted);
}
.explain-entropy-bar-wrap {
  height: 7px;
  background: rgba(255,255,255,0.06);
  border-radius: 4px;
  overflow: hidden;
}
.explain-entropy-bar {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s ease;
}
.explain-entropy-note {
  font-size: 0.65rem;
  color: var(--muted-2);
}

.explain-sel-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}
.explain-sel-stat {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.explain-sel-num {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.explain-sel-lbl {
  font-size: 0.65rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}
.explain-rejection-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.explain-rejection-item {
  font-size: 0.72rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.explain-rejection-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f87171;
  flex-shrink: 0;
}

@media (max-width: 600px) {
  .explain-sel-stats { grid-template-columns: repeat(2, 1fr); }
  .explain-emotion-grid { grid-template-columns: repeat(2, 1fr); }
  .explain-lane-label { width: 80px; }
}
