:root {
  --bg: #0f1115;
  --card: #171a21;
  --accent: #3ddc84;
  --text: #eef0f3;
  --muted: #8a8f98;
  --border: #262a33;
}

* { box-sizing: border-box; }

.yt-player {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

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

.topbar {
  display: flex;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.card {
  max-width: 420px;
  margin: 3rem auto;
  padding: 2rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.play-btn {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #08150d;
  font-size: 1.8rem;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.play-btn:disabled { opacity: 0.5; cursor: default; }
.play-btn:active { transform: scale(0.92); }

.play-btn.playing {
  animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(61, 220, 132, 0.5); }
  50% { box-shadow: 0 0 0 10px rgba(61, 220, 132, 0); }
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  transition: opacity 0.32s ease;
}

.progress-bar.leaving {
  opacity: 0;
}

.progress-target {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0%;
  background: rgba(255, 255, 255, 0.1);
}

.progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  background: var(--accent);
}

.progress-fill.smooth {
  transition: width 0.15s linear;
}

.progress-fill.full {
  border-top-right-radius: 999px;
  border-bottom-right-radius: 999px;
}

.progress-ticks {
  position: absolute;
  inset: 0;
}

.progress-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--card);
  transform: translateX(-1px);
}

.guess-row {
  width: 100%;
  display: flex;
  gap: 0.5rem;
}

.guess-field {
  position: relative;
  flex: 1;
}

input[type="text"] {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #0f1115;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="text"]::placeholder {
  color: var(--muted);
  font-weight: 400;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(61, 220, 132, 0.15);
}

.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  list-style: none;
  margin: 0;
  padding: 0.25rem;
  max-height: 220px;
  overflow-y: auto;
  z-index: 10;
}

.suggestions li {
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.1s ease;
}

.suggestions li:hover { background: var(--border); }

.hidden { display: none !important; }

.primary-btn, .secondary-btn {
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  border: none;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease, transform 0.1s ease;
}

.primary-btn { background: var(--accent); color: #08150d; width: 100%; }
.primary-btn:hover { filter: brightness(1.08); }
.secondary-btn { background: var(--border); color: var(--text); }
.secondary-btn:hover { background: #323744; }
.primary-btn:active, .secondary-btn:active { transform: scale(0.97); }

.reveal {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
}

.reveal img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
}

.reveal-title { font-weight: 600; font-size: 1.02rem; }
.reveal-artist { color: var(--muted); font-size: 0.9rem; font-weight: 500; }

/* The reveal + next-song button used to just display:none in and out, which
   snapped the whole card's height instantly. Wrapping them in a grid row
   that animates between 0fr and 1fr lets the actual box height (not just
   opacity) collapse and expand smoothly — the standard trick for animating
   "auto" height in CSS. overflow:hidden clips the content while collapsed;
   min-height:0 on the inner wrapper is what lets the row actually reach 0. */
.reveal-section {
  width: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.36s cubic-bezier(0.4, 0, 0.2, 1);
}

.reveal-section.expanded {
  grid-template-rows: 1fr;
}

.reveal-section-inner {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  min-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.reveal-section.expanded .reveal-section-inner {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.08s;
}

@keyframes revealPopIn {
  0% { opacity: 0; transform: scale(0.55) rotate(-8deg); }
  65% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  100% { opacity: 1; transform: scale(1) rotate(0deg); }
}

/* The cover art gets an extra little bounce on top of the section's own
   fade-in, so the correct answer feels like a small reward, not just a
   panel sliding open. */
.reveal-section.expanded .reveal img {
  animation: revealPopIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  animation-delay: 0.16s;
}

.remove-btn {
  margin-left: auto;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.remove-btn:hover { background: #3a1f24; color: #ff8a8a; }
.remove-btn:disabled { opacity: 0.5; cursor: default; }
