:root {
  --bg: #0e0b1a;
  --surface: #1a1530;
  --surface-hover: #241d42;
  --text: #f3f0ff;
  --muted: #a39cc4;
  --accent: #ff4f8b;
  --accent-2: #8a5cff;
  --radius: 16px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #2a1850 0%, var(--bg) 60%) fixed;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
}

main {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 40px 16px 24px;
  flex: 1;
}

header { text-align: center; }
h1 {
  margin: 0;
  font-size: 2.4rem;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tagline { color: var(--muted); margin: 8px 0 0; }

/* ---------- Listen button ---------- */
.listen { display: flex; flex-direction: column; align-items: center; margin-top: 40px; }

.listen-button {
  position: relative;
  width: 140px;
  height: 140px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  cursor: pointer;
  box-shadow: 0 10px 40px rgba(255, 79, 139, 0.35);
  transition: transform 0.15s;
}
.listen-button:hover { transform: scale(1.04); }
.listen-button:disabled { cursor: default; }
.listen-button svg { width: 56px; height: 56px; fill: white; position: relative; }

.ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 3px solid var(--accent);
  opacity: 0;
}
.listening .ring { animation: pulse 1.4s ease-out infinite; }
@keyframes pulse {
  from { transform: scale(1); opacity: 0.8; }
  to { transform: scale(1.6); opacity: 0; }
}

.status { color: var(--muted); min-height: 1.4em; margin: 20px 0 0; text-align: center; }
.status.error { color: #ff8fa3; }

/* ---------- Search box ---------- */
.search { display: flex; gap: 8px; width: 100%; max-width: 420px; margin-top: 24px; }
.search input {
  flex: 1;
  min-width: 0;
  padding: 12px 16px;
  border-radius: 999px;
  border: 1px solid #3a3160;
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}
.search input:focus { outline: 2px solid var(--accent-2); border-color: transparent; }
.search button {
  padding: 12px 20px;
  border-radius: 999px;
  border: none;
  background: var(--accent-2);
  color: white;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

/* ---------- Results ---------- */
.now-playing {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
  padding: 16px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(255, 79, 139, 0.18), rgba(138, 92, 255, 0.18));
}
.now-playing .label { color: var(--muted); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.08em; }
.now-playing .title { font-size: 1.3rem; font-weight: 700; }

.results-heading { margin: 32px 0 12px; }
h2 { margin: 0; font-size: 1.1rem; color: var(--muted); font-weight: 600; }
.vibe-status { margin: 6px 0 0; color: var(--muted); font-size: 0.85rem; min-height: 1.2em; }

.vibe-progress {
  width: 100%;
  height: 4px;
  margin-top: 8px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  appearance: none;
}
.vibe-progress::-webkit-progress-bar { background: var(--surface); border-radius: 999px; }
.vibe-progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }
.vibe-progress::-moz-progress-bar { background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }

.results { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  background: var(--surface);
  transition: background 0.15s;
}
.card:hover { background: var(--surface-hover); }

.cover {
  position: relative;
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  background: #2c2450 center / cover no-repeat;
}
.now-playing .cover { width: 72px; height: 72px; }

.play {
  position: absolute;
  inset: 0;
  border: none;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.45);
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.card:hover .play, .play.playing, .play:focus-visible { opacity: 1; }
@media (hover: none) { .play { opacity: 1; } }

.info { flex: 1; min-width: 0; }
.title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.song-title, .song-artist { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.vibe {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.vibe.pending { color: var(--muted); background: #2c2450; }
.vibe.high { color: #0e0b1a; background: #7cf2b0; }
.vibe.mid { color: #0e0b1a; background: #ffd166; }
.vibe.low { color: var(--muted); background: #2c2450; }
.vibe.none { color: var(--muted); background: transparent; border: 1px solid #3a3160; }

.show-more {
  display: block;
  margin: 16px auto 0;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid #3a3160;
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}
.show-more:hover { background: var(--surface); }
.song-title { font-weight: 600; }
.song-artist { color: var(--muted); font-size: 0.9rem; }

.links { display: flex; gap: 6px; flex: none; }
.links a {
  padding: 6px 10px;
  border-radius: 999px;
  background: #2c2450;
  color: var(--text);
  font-size: 0.8rem;
  text-decoration: none;
}
.links a:hover { background: var(--accent-2); }

@media (max-width: 520px) {
  .card { flex-wrap: wrap; }
  .links { width: 100%; padding-left: 68px; }
}

footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 24px 16px; }
