:root {
  --bg: #0b0d10;
  --surface: #14171c;
  --surface-2: #1c2027;
  --border: rgba(255, 255, 255, 0.08);
  --text: #f5f6f8;
  --text-muted: #8a8f99;
  --accent: #1db954; /* Spotify green */
  --accent-hover: #1ed760;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --keep: #22c55e;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 15px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text);
  transition: background 0.15s, transform 0.05s;
}
button:hover { background: #252a33; }
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface); }

/* ---------- Welcome / Login ---------- */
.center-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 24px;
}
.center-screen h1 {
  font-size: 36px;
  margin: 0;
  font-weight: 700;
}
.center-screen p {
  font-size: 17px;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.5;
  margin: 0;
}

/* ---------- Loading ---------- */
.progress-bar {
  width: 100%;
  max-width: 400px;
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}
.topbar h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.topbar-stats {
  font-size: 13px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.topbar-stats .stat-kept    { color: var(--keep); font-weight: 600; }
.topbar-stats .stat-unliked { color: var(--danger); font-weight: 600; }
.topbar-stats .stat-remaining { color: var(--text); font-weight: 600; }
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pending-pill {
  background: var(--warning);
  color: #000;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Filters ---------- */
.filters {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
  align-items: center;
}
.filters label {
  font-size: 13px;
  color: var(--text-muted);
}
.filters select, .filters input {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  font-family: inherit;
}

/* ---------- Review card ---------- */
.review-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 24px;
}

.track-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  max-width: 520px;
  width: 100%;
}

.album-art {
  width: 320px;
  height: 320px;
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.album-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.track-info {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.track-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}
.track-artist {
  font-size: 17px;
  color: var(--text-muted);
  margin: 0;
}
.track-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}
.track-meta a {
  color: var(--accent);
  text-decoration: none;
}
.track-meta a:hover { text-decoration: underline; }

.preview-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}
.play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  padding: 0;
  flex-shrink: 0;
}
.preview-progress {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
}
.preview-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.1s linear;
}
.no-preview {
  font-size: 13px;
  color: var(--text-muted);
  font-style: italic;
}

/* ---------- Filmstrip (prev / current / next1 / next2) ----------
   3-column grid: equal-width side columns flank the album art so the art
   is anchored to true page center, regardless of how many cards are on
   either side. Prev card hugs the right edge of the left column; next
   cards stack left-to-right starting from the left edge of the right
   column. */
.filmstrip {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  width: 100%;
  max-width: 920px;
  padding: 0 16px;
  margin-bottom: 4px;
}
.filmstrip > .album-art {
  flex-shrink: 0;
  grid-column: 2;
}
.filmstrip-left {
  grid-column: 1;
  display: flex;
  justify-content: flex-end;
  padding-right: 24px;
}
.filmstrip-right {
  grid-column: 3;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 24px;
  padding-left: 24px;
}

.side-card {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.side-card .label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.side-card .thumb {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.side-card .thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.side-card .thumb-meta {
  width: 100%;
  text-align: center;
}
.side-card .thumb-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.side-card .thumb-artist {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Sizes & opacities per slot */
.side-card.prev    { opacity: 0.78; }
.side-card.next-1  { opacity: 0.65; }
.side-card.next-2  { opacity: 0.38; }

.side-card.prev    .thumb { width: 110px; height: 110px; }
.side-card.next-1  .thumb { width: 110px; height: 110px; }
.side-card.next-2  .thumb { width: 78px;  height: 78px;  }

.side-card.prev    .thumb-meta,
.side-card.next-1  .thumb-meta { max-width: 110px; }
.side-card.next-2  .thumb-meta { max-width: 78px; }

/* Decision badge (only on prev) */
.decision-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.decision-badge.kept    { background: var(--keep); color: #000; }
.decision-badge.unliked { background: var(--danger); color: #fff; }

/* Slide-in animation when track changes */
.side-card.animate-enter.prev {
  animation: slideInFromLeft 0.32s ease-out;
}
.side-card.animate-enter.next-1,
.side-card.animate-enter.next-2 {
  animation: slideInFromRight 0.32s ease-out;
}
@keyframes slideInFromRight {
  from { transform: translateX(28px); }
  to   { transform: translateX(0); }
}
@keyframes slideInFromLeft {
  from { transform: translateX(-28px); }
  to   { transform: translateX(0); }
}

@media (max-width: 900px) {
  .filmstrip { gap: 12px; }
  .side-card.prev .thumb,
  .side-card.next-1 .thumb { width: 80px; height: 80px; }
  .side-card.next-2 .thumb { width: 60px; height: 60px; }
}
@media (max-width: 700px) {
  /* On narrow screens, hide the second-next card */
  .side-card.next-2 { display: none; }
}

/* Spotify embed — persistent, slotted into review screen */
#spotify-embed-wrap {
  width: 100%;
  max-width: 360px;
  display: none;
  border-radius: 12px;
  overflow: hidden;
}
#spotify-embed-wrap.visible {
  display: block;
}
#spotify-embed-target iframe {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 12px;
}

.actions {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 320px;
}
.actions button {
  flex: 1;
  padding: 14px 20px;
  font-size: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.actions .kbd {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.7;
}

.btn-keep {
  background: var(--keep);
  color: #000;
}
.btn-keep:hover { background: #4ade80; }

.btn-unlike {
  background: var(--danger);
  color: #fff;
}
.btn-unlike:hover { background: var(--danger-hover); }

/* ---------- Done state ---------- */
.done-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
}
.done-screen h1 { font-size: 32px; margin: 0; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}
.toast.show { opacity: 1; }

/* ---------- Helpers ---------- */
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--text-muted); }
.small { font-size: 13px; }

.shortcuts-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 12px;
  text-align: center;
}
.shortcuts-help kbd {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, monospace;
  margin: 0 2px;
}

@media (max-width: 600px) {
  .album-art { width: 260px; height: 260px; }
  .track-title { font-size: 20px; }
}
