:root {
  --bg: #14121a;
  --panel: #1e1b26;
  --panel-2: #262231;
  --text: #f2eefc;
  --muted: #a79fc0;
  --accent: #ffb703;
  --error: #ff6b6b;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #241f30, var(--bg) 60%);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.app {
  max-width: 720px;
  margin: 0 auto;
  padding: clamp(16px, 5vw, 24px) clamp(12px, 4vw, 16px) 64px;
}

.app-header {
  text-align: center;
  margin-bottom: 24px;
}

.app-header h1 {
  margin: 0 0 4px;
  font-size: clamp(1.4rem, 5vw, 1.8rem);
}

.subtitle {
  margin: 0;
  color: var(--muted);
}

/* ---------- Now playing ---------- */

.now-playing {
  margin-bottom: 32px;
}

.now-playing-empty {
  text-align: center;
  color: var(--muted);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 32px 16px;
}

.now-playing-empty p {
  margin: 4px 0;
}

.now-playing-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  text-align: left;
  gap: 16px;
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.now-playing-info {
  min-width: 0;
}

.now-playing-info h2 {
  margin: 2px 0 4px;
  font-size: 1.4rem;
  overflow-wrap: anywhere;
}

.eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
}

.artist {
  margin: 0;
  color: var(--muted);
}

/* ---------- Cover art + cassette reel overlay ----------
   .cover-wrap holds either a real cover photo (.cover-image) or the
   generated cassette shell (.cassette-shell) — either way, .reel-window
   sits on top of it as an overlay, so the spinning-reels animation is
   always visible regardless of whether real cover art is set. */

.cover-wrap {
  position: relative;
  width: clamp(72px, 29vw, 130px);
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--panel-2);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cassette-shell {
  width: 100%;
  height: 100%;
  padding: 12%;
  background: linear-gradient(
    145deg,
    hsl(var(--hue), 65%, 42%),
    hsl(var(--hue), 65%, 22%)
  );
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.cassette-label {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.cassette-number {
  font-size: 0.62rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.9);
}

.cassette-title {
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.75);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reel-window {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 8%;
  height: 26%;
  min-height: 32px;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(1px);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: space-around;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.reel {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: repeating-conic-gradient(
    rgba(255, 255, 255, 0.85) 0deg 10deg,
    rgba(0, 0, 0, 0.6) 10deg 40deg
  );
  border: 2px solid rgba(255, 255, 255, 0.4);
  flex-shrink: 0;
}

.playing .reel {
  animation: spin 3s linear infinite;
}

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

/* ---------- Picker grid ---------- */

.picker h2 {
  font-size: 1rem;
  color: var(--muted);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.tile {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(
    145deg,
    hsl(var(--hue), 55%, 38%),
    hsl(var(--hue), 55%, 20%)
  );
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.tile-label {
  font-size: clamp(0.6rem, 2.6vw, 0.8rem);
  line-height: 1.15;
  text-align: center;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.tile:hover {
  transform: translateY(-2px);
}

.tile:active {
  transform: translateY(0);
}

.tile.selected {
  box-shadow: 0 0 0 3px var(--accent);
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  max-width: min(90vw, 360px);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 14px;
  padding: 18px 26px;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.toast.error {
  background: var(--error);
  color: #2a0e0e;
}

/* ---------- Login gate ---------- */

.login-gate {
  max-width: 420px;
  margin: 15vh auto 0;
  text-align: center;
  padding: 0 16px;
}

.login-gate h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

.login-gate p {
  color: var(--muted);
}
