:root {
  --bg: #0a0a0f;
  --bg-card: #13131a;
  --bg-card-hover: #1a1a24;
  --bg-elevated: #1e1e2a;
  --text: #e8e8f0;
  --text-muted: #8888a0;
  --text-dim: #555570;
  --accent: #6c5ce7;
  --accent-light: #a29bfe;
  --accent-glow: rgba(108, 92, 231, 0.3);
  --spotify: #1DB954;
  --apple: #fc3c44;
  --border: #2a2a3a;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.page { display: none; min-height: 100vh; }
.page.active { display: block; }

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
}
.logo-icon { width: 28px; height: 28px; color: var(--accent); }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-user { color: var(--text-muted); font-size: 14px; }

/* Buttons */
.btn {
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  padding: 10px 20px;
}
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 28px; font-size: 16px; }
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #7c6cf7; box-shadow: 0 0 20px var(--accent-glow); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-spotify { background: var(--spotify); color: white; width: 100%; justify-content: center; padding: 14px; font-size: 15px; border-radius: var(--radius); }
.btn-spotify:hover { background: #1ed760; }
.btn-spotify svg { width: 22px; height: 22px; }
.btn-apple { background: var(--apple); color: white; width: 100%; justify-content: center; padding: 14px; font-size: 15px; border-radius: var(--radius); }
.btn-apple:hover { background: #ff5058; }
.btn-apple svg { width: 22px; height: 22px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Hero */
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  padding: 80px 60px;
  max-width: 1200px;
  margin: 0 auto;
}
.hero h1 { font-size: 52px; font-weight: 800; line-height: 1.1; letter-spacing: -1px; }
.gradient-text {
  background: linear-gradient(135deg, var(--accent), #e056a0, #f0a040);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero-sub { color: var(--text-muted); font-size: 18px; line-height: 1.6; margin-top: 20px; max-width: 500px; }
.hero-actions { display: flex; gap: 12px; margin-top: 32px; }

.hero-visual { display: flex; justify-content: center; }
.playlist-card-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.playlist-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 280px;
  transition: transform 0.3s;
}
.playlist-card:hover { transform: translateX(4px); }
.pc-genre { font-weight: 600; }
.pc-count { color: var(--text-muted); font-size: 13px; }
.pc-arrow { justify-content: center; background: none; border: none; width: auto; }
.pc-arrow svg { width: 32px; height: 32px; color: var(--accent); }
.pc-result {
  flex-direction: column;
  gap: 8px;
  padding: 20px 24px;
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(108,92,231,0.1), rgba(108,92,231,0.05));
}
.pc-mini { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-blue { background: #4facfe; }
.dot-purple { background: #a29bfe; }
.dot-pink { background: #fd79a8; }
.dot-green { background: #00b894; }

/* Features / Templates */
.features, .modes-section {
  padding: 80px 60px;
  max-width: 1200px;
  margin: 0 auto;
}
.features h2, .modes-section h2 { font-size: 36px; font-weight: 800; text-align: center; }
.section-sub { color: var(--text-muted); text-align: center; margin-top: 12px; margin-bottom: 48px; font-size: 16px; }

.template-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 40px;
}
.tpl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.2s;
}
.tpl-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.tpl-icon { font-size: 28px; margin-bottom: 12px; }
.tpl-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.tpl-card p { color: var(--text-muted); font-size: 13px; line-height: 1.5; }

/* Modes */
.modes-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 40px;
}
.mode-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  text-align: center;
}
.mode-card h3 { margin: 16px 0 12px; font-size: 20px; }
.mode-card p { color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.mode-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-light);
  background: rgba(108,92,231,0.15);
  padding: 4px 12px;
  border-radius: 20px;
}
.mode-featured { border-color: var(--accent); background: linear-gradient(180deg, rgba(108,92,231,0.08), var(--bg-card)); }

/* Login */
.login-container {
  max-width: 420px;
  margin: 120px auto 0;
  text-align: center;
  padding: 0 20px;
}
.login-container h2 { font-size: 32px; margin-bottom: 12px; }
.login-sub { color: var(--text-muted); font-size: 15px; line-height: 1.5; margin-bottom: 40px; }
.login-buttons { display: flex; flex-direction: column; gap: 12px; }
.login-note { color: var(--text-dim); font-size: 12px; margin-top: 24px; }

/* Dashboard */
.dashboard { padding: 32px 40px; max-width: 1200px; margin: 0 auto; }
.dash-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; }
.dash-header h2 { font-size: 28px; }
.dash-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.playlist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.pl-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: all 0.2s;
  cursor: default;
}
.pl-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.pl-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.pl-card-title { font-weight: 600; font-size: 15px; }
.pl-card-count { color: var(--text-muted); font-size: 12px; }
.pl-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.pl-tag {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(108,92,231,0.12);
  color: var(--accent-light);
}
.pl-tag-genre { background: rgba(0,184,148,0.12); color: #55efc4; }
.pl-tag-decade { background: rgba(253,121,168,0.12); color: #fd79a8; }
.pl-tag-mood { background: rgba(79,172,254,0.12); color: #74b9ff; }

/* Organize Steps */
.organize-container { max-width: 900px; margin: 0 auto; padding: 32px 20px; }
.step { display: none; }
.step.active { display: block; animation: fadeIn 0.3s; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.step-header { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 32px; }
.step-num {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.step-header h2 { font-size: 24px; margin-bottom: 4px; }
.step-header p { color: var(--text-muted); font-size: 14px; }
.step-footer { display: flex; justify-content: space-between; margin-top: 32px; }

/* Mode Selection */
.mode-select-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.mode-select-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-family: inherit;
  color: var(--text);
}
.mode-select-card:hover { border-color: var(--accent); }
.mode-select-card.featured { border-color: rgba(108,92,231,0.5); }
.mode-select-card h3 { font-size: 18px; margin-bottom: 8px; }
.mode-select-card p { color: var(--text-muted); font-size: 13px; line-height: 1.4; }
.mode-tag {
  display: inline-block;
  margin-top: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--accent-light);
}

/* Template Selection */
.template-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.tpl-select-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}
.tpl-select-card:hover { border-color: var(--text-dim); }
.tpl-select-card.selected { border-color: var(--accent); background: rgba(108,92,231,0.08); }
.tpl-select-card .tpl-icon { font-size: 24px; margin-bottom: 8px; }
.tpl-select-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.tpl-select-card p { color: var(--text-muted); font-size: 11px; line-height: 1.3; }

/* Options */
.options-grid { display: flex; flex-direction: column; gap: 12px; }
.option-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.option-card:has(input:checked) { border-color: var(--accent); background: rgba(108,92,231,0.06); }
.option-card input { margin-top: 4px; accent-color: var(--accent); }
.option-content h4 { font-size: 15px; margin-bottom: 4px; }
.option-content p { color: var(--text-muted); font-size: 13px; }

.naming-section { margin-top: 28px; }
.naming-section h4 { margin-bottom: 12px; font-size: 15px; }
.naming-options { display: flex; flex-direction: column; gap: 10px; }
.naming-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
}
.naming-option input[type="radio"] { accent-color: var(--accent); }
.input-inline {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  padding: 4px 8px;
  font-size: 13px;
  width: 80px;
  font-family: inherit;
}

/* Preview */
.preview-container { display: flex; flex-direction: column; gap: 24px; }
.preview-group h3 {
  font-size: 16px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.preview-playlists { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.preview-pl {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.preview-pl-name { font-size: 14px; font-weight: 500; }
.preview-pl-count { color: var(--text-muted); font-size: 12px; }
.preview-pl.new { border-color: rgba(0,184,148,0.4); background: rgba(0,184,148,0.06); }
.preview-pl.kept { opacity: 0.6; }
.preview-pl.removed { opacity: 0.35; text-decoration: line-through; }

.preview-legend {
  display: flex; gap: 20px; margin-bottom: 16px;
  font-size: 13px; color: var(--text-muted);
}
.preview-legend span { display: flex; align-items: center; gap: 6px; }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; }
.legend-new { background: rgba(0,184,148,0.4); border: 1px solid rgba(0,184,148,0.6); }
.legend-kept { background: var(--bg-card); border: 1px solid var(--border); }
.legend-removed { background: var(--bg-card); border: 1px solid var(--border); opacity: 0.4; }

/* Done */
.done-content { text-align: center; padding: 80px 20px; }
.done-icon { margin-bottom: 24px; }
.done-icon svg { width: 80px; height: 80px; }
.done-content h2 { font-size: 32px; margin-bottom: 12px; }
.done-content > p { color: var(--text-muted); margin-bottom: 32px; }
.done-actions { display: flex; gap: 12px; justify-content: center; margin-top: 32px; }
#done-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: left;
  max-width: 500px;
  margin: 0 auto;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}
.summary-row + .summary-row { border-top: 1px solid var(--border); }
.summary-label { color: var(--text-muted); }
.summary-value { font-weight: 600; }

/* Loading animation */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10,10,15,0.85);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.3s;
}
.spinner {
  width: 48px; height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: var(--text-muted); margin-top: 16px; font-size: 14px; }

/* Responsive */
@media (max-width: 768px) {
  .hero { grid-template-columns: 1fr; padding: 40px 20px; gap: 40px; }
  .hero h1 { font-size: 36px; }
  .features, .modes-section { padding: 40px 20px; }
  .modes-grid { grid-template-columns: 1fr; }
  .mode-select-grid { grid-template-columns: 1fr; }
  .dashboard { padding: 20px; }
  .dash-header { flex-direction: column; gap: 16px; }
  .nav { padding: 12px 16px; }
  .hero-visual { display: none; }
}
