:root {
  --bg: #0f0f10;
  --surface: #1c1c1f;
  --surface-hover: #26262b;
  --text: #ffffff;
  --text-dim: #b3b3b3;
  --accent: #1db954;
  --accent-dark: #169c46;
  --warn-bg: #3a2a00;
  --warn-text: #ffcf5c;
  --radius: 14px;
  --maxw: 720px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------------- Hero ---------------- */
.hero {
  display: flex;
  gap: 20px;
  align-items: center;
  padding: 28px 20px;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
}
.hero-cover {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  color: var(--text-dim);
  margin: 0 0 6px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  line-height: 1.1;
}
.subtitle {
  color: var(--text-dim);
  margin: 10px 0 0;
  font-size: 0.95rem;
}
.hero-link {
  display: inline-block;
  margin-top: 12px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

/* ---------------- Main ---------------- */
main {
  flex: 1;
  max-width: var(--maxw);
  width: 100%;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.banner {
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 0.9rem;
  margin-bottom: 18px;
  line-height: 1.4;
}
.banner-warn { background: var(--warn-bg); color: var(--warn-text); }
.banner code, main code {
  background: rgba(255, 255, 255, 0.1);
  padding: 1px 6px;
  border-radius: 5px;
}

.search-bar { position: sticky; top: 0; padding: 12px 0; background: var(--bg); z-index: 5; }
#search {
  width: 100%;
  padding: 15px 18px;
  font-size: 1rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid transparent;
  border-radius: 999px;
  outline: none;
  transition: border-color 0.15s;
}
#search:focus { border-color: var(--accent); }
#search:disabled { opacity: 0.5; cursor: not-allowed; }

.status { color: var(--text-dim); font-size: 0.88rem; min-height: 20px; padding: 4px 2px; }

/* ---------------- Résultats ---------------- */
.results { list-style: none; padding: 0; margin: 8px 0 0; }
.track {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  transition: background 0.12s;
}
.track:hover { background: var(--surface-hover); }
.track-cover {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface);
}
.track-info { flex: 1; min-width: 0; }
.track-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-sub {
  color: var(--text-dim);
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.add-btn {
  flex-shrink: 0;
  border: none;
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 0.85rem;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 0.1s, background 0.15s;
}
.add-btn:hover { background: var(--accent-dark); }
.add-btn:active { transform: scale(0.94); }
.add-btn:disabled { opacity: 0.6; cursor: default; }
.add-btn.done { background: #333; color: var(--text-dim); }

/* ---------------- Playlist temps réel ---------------- */
.playlist-section { margin-top: 34px; }
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 2px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.section-head h2 { margin: 0; font-size: 1.15rem; }
.count { color: var(--text-dim); font-size: 0.85rem; }
.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: auto;
  box-shadow: 0 0 0 0 rgba(29, 185, 84, 0.6);
}
.live-dot.pulse { animation: pulse 0.6s ease-out; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(29, 185, 84, 0.6); }
  100% { box-shadow: 0 0 0 10px rgba(29, 185, 84, 0); }
}
.playlist-list { margin-top: 6px; }
.track-index {
  width: 22px;
  flex-shrink: 0;
  text-align: right;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

/* ---------------- Toast ---------------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(120%);
  background: #fff;
  color: #000;
  padding: 13px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.9rem;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 20;
  max-width: 90vw;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.error { background: #e0384a; color: #fff; }

footer {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 20px;
}

/* ---------------- Mobile ---------------- */
@media (max-width: 560px) {
  .hero { flex-direction: column; text-align: center; padding: 22px 16px; }
  .hero-cover { width: 140px; height: 140px; }
  main { padding: 0 14px 40px; }
  .add-btn { padding: 9px 14px; }
  .track-cover { width: 48px; height: 48px; }
}
