/* Echofy — design system : gris sombre + accent violet, zéro framework.
   Tokens dans :root, accent unique = violet, polices système (CSP).
   NE JAMAIS renommer les IDs / data-* utilisés par app.js & player.js. */

:root {
  /* Gris (fond -> surfaces) */
  --bg:          #0d0d11;
  --surface:     #16161c;
  --surface-2:   #1e1e26;   /* élevé / hover */
  --border:      #2a2a34;
  --text:        #ececf1;
  --text-muted:  #a1a1ad;

  /* Violet (accent) */
  --accent:        #8b5cf6;
  --accent-hover:  #a78bfa;
  --accent-strong: #7c3aed;
  --accent-subtle: rgba(139, 92, 246, 0.12);
  --accent-ring:   rgba(139, 92, 246, 0.55);

  /* Sémantique */
  --danger:  #ef4444;
  --success: #22c55e;

  /* Rayons / ombres / espacements */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-full: 999px;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-2: 0 8px 24px rgba(0, 0, 0, 0.45);
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;

  /* Typo système (aucun CDN — respecte le CSP) */
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  --player-h: 76px;
}

/* --- Reset léger + gotchas [hidden] --------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
img { max-width: 100%; display: block; }
img[hidden] { display: none; } /* le display:block ci-dessus écraserait [hidden] */
button { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent-hover); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent); text-decoration: underline; }

/* Focus clavier visible sur TOUT l'interactif (accessibilité) */
:focus-visible {
  outline: 2px solid var(--accent-ring);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

::selection { background: var(--accent-subtle); }

/* --- Header ----------------------------------------------------------------- */
#app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: 10px 20px;
  background: rgba(22, 22, 28, 0.92); /* --surface + transparence */
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

#logo {
  font-weight: 800;
  font-size: 1.25rem;
  color: var(--text);
  letter-spacing: 0.3px;
  white-space: nowrap;
}
#logo:hover { text-decoration: none; color: var(--text); }
#logo .logo-fy { color: var(--accent); }
#logo:hover .logo-fy { color: var(--accent-hover); }

#search-box {
  flex: 1;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
#search-input {
  flex: 1;
  min-width: 0;
  border-radius: var(--r-full);
  padding: 8px 16px;
}
#search-box .btn-icon { flex-shrink: 0; }

#auth-zone {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  white-space: nowrap;
  font-size: 0.92rem;
}
#auth-zone a { color: var(--text-muted); }
#auth-zone a:hover { color: var(--text); text-decoration: none; }
#header-me { font-weight: 600; color: var(--text); }

/* --- Vue principale ------------------------------------------------------------ */
#view {
  max-width: 1024px;
  margin: 0 auto;
  padding: var(--sp-5) 20px calc(var(--player-h) + 48px);
}

/* --- Écran d'authentification (épuré, une colonne centrée) ---------------------- */
.auth-screen {
  min-height: calc(100vh - 140px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-5) 0;
  background: radial-gradient(460px 300px at 50% 2%, var(--accent-subtle), transparent 72%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-1);
}
.auth-brand-name {
  font-size: 1.9rem;
  font-weight: 800;
  text-align: center;
  letter-spacing: 0.3px;
}
.auth-brand-name span { color: var(--accent); }
.auth-subtitle { text-align: center; margin: 4px 0 var(--sp-5); font-size: 0.9rem; }

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-1);
  background: var(--surface-2);
  border-radius: var(--r-full);
  padding: 4px;
  margin-bottom: var(--sp-5);
}
.auth-tab {
  text-align: center;
  padding: 8px 0;
  border-radius: var(--r-full);
  color: var(--text-muted);
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.auth-tab:hover { color: var(--text); text-decoration: none; }
.auth-tab.active { background: var(--accent); color: #fff; }
.auth-tab.active:hover { color: #fff; }

/* --- Boutons ---------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:hover { background: var(--accent-hover); text-decoration: none; }
.btn:active { background: var(--accent-strong); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn[hidden] { display: none; } /* le display:inline-flex écraserait [hidden] */

/* Ghost (contour) — .btn-secondary est l'alias historique conservé */
.btn-ghost,
.btn-secondary {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover,
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border); }
.btn-ghost:active,
.btn-secondary:active { background: var(--surface-2); }

.btn-danger { background: transparent; border-color: rgba(239, 68, 68, 0.45); color: var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.12); border-color: var(--danger); }
.btn-danger:active { background: rgba(239, 68, 68, 0.2); }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  font-size: 1rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-icon:hover { background: var(--surface-2); }
.btn-icon:disabled { opacity: 0.35; cursor: default; }
.btn-icon:disabled:hover { background: transparent; }

.btn-block { width: 100%; }
.btn-small { padding: 4px 10px; font-size: 0.8rem; border-radius: var(--r-sm); }

/* --- Champs ------------------------------------------------------------------------- */
.input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input::placeholder { color: var(--text-muted); opacity: 0.7; }
.input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
select.input { cursor: pointer; }
textarea.input { resize: vertical; }

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--sp-4);
}
.field label { font-size: 0.88rem; color: var(--text-muted); font-weight: 500; }

.muted { color: var(--text-muted); }

.form-error {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--r-md);
  padding: 8px 12px;
  margin: 0 0 var(--sp-4);
  font-size: 0.92rem;
}
.form-error[hidden] { display: none; }

.auth-form { max-width: 460px; }

/* --- États de chargement & vides ------------------------------------------------------ */
.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  padding: var(--sp-4) 0;
}
.spinner {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid var(--surface-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(1turn); } }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--sp-6) var(--sp-4);
  color: var(--text-muted);
  border: 1px dashed var(--border);
  border-radius: var(--r-md);
}
.empty-state p { margin: 0; }
.empty-icon { font-size: 1.9rem; margin-bottom: var(--sp-2); opacity: 0.75; }

/* --- Cartes & grilles ------------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
  padding: var(--sp-4);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(164px, 1fr));
  gap: var(--sp-4);
}

/* Cartes morceau */
.track-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.track-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--surface-2);
}
.track-cover-wrap { position: relative; }
.track-cover {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.track-cover-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--text-muted);
}
.play-overlay {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-1);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.15s, transform 0.15s, background 0.15s;
}
.track-card:hover .play-overlay,
.play-overlay:focus-visible { opacity: 1; transform: translateY(0); }
.play-overlay:hover { background: var(--accent-hover); }

.add-overlay {
  position: absolute;
  left: 8px;
  bottom: 8px;
  background: rgba(13, 13, 17, 0.78);
  color: #fff;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.track-card:hover .add-overlay,
.add-overlay:focus-visible { opacity: 1; }
.add-overlay:hover { background: var(--accent); }

/* État « en lecture » (classe .playing posée par player.syncMarkers) */
.track-card.playing {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-ring), var(--shadow-1);
}
.track-card.playing .play-overlay { opacity: 1; transform: translateY(0); }
.btn-icon[data-action="play"].playing { background: var(--accent); color: #fff; }
.btn[data-action="play"].playing { box-shadow: 0 0 0 2px var(--accent-ring); }

.track-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.track-artist { font-size: 0.85rem; color: var(--text-muted); }
.track-artist:hover { color: var(--accent-hover); }
.track-meta { font-size: 0.8rem; }

/* Brouillons (profil self : morceau incomplet, hors queue) */
.track-card.draft { opacity: 0.6; }
.track-card.draft .play-overlay { display: none; }
.track-card.draft .track-cover-wrap::after {
  content: 'brouillon';
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.7rem;
  color: var(--text);
  background: rgba(13, 13, 17, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 2px 8px;
}

/* --- Accueil découverte ---------------------------------------------------------------- */
.home-section { margin-bottom: var(--sp-6); }
.home-section h1, .home-section h2 { margin: 0 0 var(--sp-4); }

.genre-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.genre-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.genre-chip:hover {
  background: var(--accent-subtle);
  border-color: var(--accent);
  color: var(--accent-hover);
  text-decoration: none;
}
.genre-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: var(--r-full);
  padding: 1px 8px;
}

/* --- Recherche --------------------------------------------------------------------------- */
.load-more-wrap { margin-top: var(--sp-5); text-align: center; }

/* --- Pages avec en-tête d'action (bibliothèque, playlist) ---------------------------------- */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.page-head h1 { margin-top: 0; }

/* Cartes playlist (bibliothèque) */
.playlist-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.playlist-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--accent);
}

/* Page playlist : liste ordonnée */
.playlist-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin: 0; }
.playlist-tracks {
  list-style: none;
  margin: var(--sp-4) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pl-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; }
.pl-row.playing { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-ring); }
.pl-row.unavailable { opacity: 0.55; }
.pl-pos { width: 22px; text-align: right; font-size: 0.85rem; flex-shrink: 0; }
.pl-noplay { cursor: default; }
.pl-noplay:hover { background: transparent; }
.pl-cover {
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-2);
  flex-shrink: 0;
}
div.pl-cover { font-size: 1.1rem; }
.pl-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pl-title {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pl-title:hover { color: var(--accent-hover); }
.pl-artist { font-size: 0.85rem; }
.pl-duration { font-size: 0.85rem; flex-shrink: 0; }
.pl-row-actions { display: flex; gap: 2px; flex-shrink: 0; }
.unavail-tag {
  font-size: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 0 8px;
  margin-left: 6px;
}

/* --- Popover « Ajouter à une playlist » ------------------------------------------------------ */
.popover {
  position: absolute;
  z-index: 25; /* sous le player (30) */
  width: 250px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-2);
}
.popover-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 10px;
  cursor: pointer;
  transition: background 0.15s;
}
.popover-item:hover,
.popover-item:focus-visible { background: var(--surface-2); }
.popover-item-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.popover-new { color: var(--accent-hover); font-weight: 600; }
.popover-empty { margin: 6px 10px; }

/* --- Toast ------------------------------------------------------------------------------------ */
#toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--player-h) + 20px);
  z-index: 40;
  padding: 9px 18px;
  max-width: min(92vw, 480px);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  box-shadow: var(--shadow-2);
  font-size: 0.92rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
#toast.show { opacity: 1; }
#toast.error { color: var(--danger); border-color: rgba(239, 68, 68, 0.45); }

/* --- Profil (page artist) ----------------------------------------------------------------------- */
.profile-head {
  display: flex;
  gap: var(--sp-5);
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: var(--sp-6);
}
.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.profile-avatar-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--accent-hover);
  background: var(--accent-subtle);
}
.profile-info { flex: 1; min-width: 240px; }
.profile-info h1 { margin: 0 0 6px; }
.role-badge {
  font-size: 0.68rem;
  font-weight: 700;
  vertical-align: middle;
  color: var(--accent-hover);
  background: var(--accent-subtle);
  border: 1px solid transparent;
  border-radius: var(--r-full);
  padding: 3px 10px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}
.profile-bio { margin: 6px 0; max-width: 60ch; }
.profile-counts { display: flex; gap: var(--sp-4); flex-wrap: wrap; margin: 8px 0 12px; }
.profile-counts strong { color: var(--text); }

/* Bouton cœur (page morceau) */
.like-btn .like-icon { font-size: 1.05rem; line-height: 1; }
.like-btn.liked { border-color: var(--accent); background: var(--accent-subtle); }
.like-btn.liked .like-icon { color: var(--accent-hover); }

/* Settings : aperçu avatar */
#set-avatar-preview { width: 72px; height: 72px; margin-bottom: var(--sp-2); }

/* --- Page morceau -------------------------------------------------------------------------------- */
.track-page {
  display: flex;
  gap: var(--sp-5);
  align-items: flex-start;
  flex-wrap: wrap;
}
.track-page-cover {
  width: 280px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
  flex-shrink: 0;
}
div.track-page-cover { font-size: 3.5rem; }
.track-page-info { flex: 1; min-width: 240px; }
.track-page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

/* --- Back-office admin ----------------------------------------------------------------------------- */
.admin-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--sp-5);
}
.admin-tab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 8px 14px;
  color: var(--text-muted);
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active {
  color: var(--accent-hover);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-6);
}
.stat-card { padding: 14px 16px; }
.stat-value { font-size: 1.7rem; font-weight: 800; line-height: 1.2; color: var(--accent-hover); }
.stat-sub { font-size: 0.78rem; margin-top: 4px; }

.admin-cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--sp-5);
}

.admin-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.admin-toolbar .adm-q { max-width: 340px; border-radius: var(--r-full); }

.table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th {
  text-align: left;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.admin-table tbody tr { transition: background 0.15s; }
.admin-table tbody tr:hover { background: var(--surface-2); }
.adm-strong { font-weight: 600; }
.adm-actions { text-align: right; }
.adm-cover {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-2);
}
div.adm-cover {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}
.admin-table .adm-role { width: auto; padding: 4px 8px; font-size: 0.85rem; }

.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--r-full);
  padding: 2px 10px;
  color: var(--text-muted);
}
.status-badge.ok { color: var(--success); border-color: rgba(34, 197, 94, 0.4); }

/* --- Publication : segmented control + dropzones ------------------------------------------------------- */
.upload-switch { max-width: 300px; margin-bottom: var(--sp-4); }
/* Panneau plus large que .auth-form (460px) pour loger la liste de pistes. */
#upload-panel.auth-form { max-width: 640px; }
.field-label { font-size: 0.88rem; color: var(--text-muted); font-weight: 500; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--sp-5) var(--sp-4);
  text-align: center;
  border: 1.5px dashed var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.dropzone[hidden] { display: none; } /* display:flex écraserait [hidden] */
.dropzone:hover { border-color: var(--accent); color: var(--text); }
.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-subtle);
  color: var(--accent-hover);
}
.dz-icon { font-size: 1.5rem; line-height: 1; }
.dz-label { font-size: 0.9rem; }
.up-audio-name { margin: 6px 0 0; font-size: 0.88rem; color: var(--success); }

/* Aperçu de cover (data: URL) */
.cover-preview[hidden] { display: none; }
.cover-preview {
  display: flex;
  align-items: flex-end;
  gap: var(--sp-3);
}
.cover-preview img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

/* Liste de pistes (mode album) réordonnable */
.album-track-list {
  list-style: none;
  margin: var(--sp-3) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.album-track-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
}
.album-track-row.atr-done { border-color: rgba(34, 197, 94, 0.4); }
.album-track-row.atr-error { border-color: rgba(239, 68, 68, 0.5); }
.atr-no { width: 20px; text-align: right; flex-shrink: 0; font-size: 0.85rem; }
.atr-title { flex: 1 1 40%; min-width: 120px; padding: 6px 10px; }
.atr-file { flex: 1 1 25%; min-width: 0; font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.atr-dur { flex-shrink: 0; font-size: 0.82rem; width: 42px; text-align: right; }
.atr-status { flex-shrink: 0; font-size: 0.8rem; min-width: 70px; }
.atr-done .atr-status { color: var(--success); }
.atr-error .atr-status { color: var(--danger); }
.atr-uploading .atr-status { color: var(--accent-hover); }
.atr-actions { display: flex; gap: 2px; flex-shrink: 0; }
.atr-actions .btn-icon { width: 30px; height: 30px; }

/* --- Cartes album (profil) ----------------------------------------------------------------------------- */
.album-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.album-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-2);
  border-color: var(--accent);
}
.album-cover-wrap { position: relative; }
.album-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fff;
  background: rgba(124, 58, 237, 0.85);
  border-radius: var(--r-full);
  padding: 2px 8px;
}

/* --- Page album ---------------------------------------------------------------------------------------- */
.album-head {
  display: flex;
  gap: var(--sp-5);
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: var(--sp-5);
}
.album-page-cover {
  width: 220px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: var(--r-md);
  background: var(--surface-2);
  box-shadow: var(--shadow-2);
  flex-shrink: 0;
}
div.album-page-cover { display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.album-head-info { flex: 1; min-width: 240px; }
.album-head-info h1 { margin: 4px 0 8px; font-size: 2rem; }
.album-kicker { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.6px; text-transform: uppercase; }

.album-tracks {
  list-style: none;
  margin: var(--sp-4) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.album-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.album-row:hover { background: var(--surface-2); }
.album-row.playing { background: var(--accent-subtle); }
.album-row.unavailable { opacity: 0.55; }
.al-no { width: 22px; text-align: right; flex-shrink: 0; font-size: 0.9rem; }
.al-title { flex: 1; min-width: 0; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al-title:hover { color: var(--accent-hover); }
.al-plays { flex-shrink: 0; font-size: 0.82rem; }
.al-dur { flex-shrink: 0; font-size: 0.85rem; width: 42px; text-align: right; }
.al-row-actions { display: flex; gap: 2px; flex-shrink: 0; }
.al-row-actions .like-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  width: auto;
  padding: 0 8px;
  border-radius: var(--r-full);
  font-size: 0.82rem;
}
.al-row-actions .like-btn.liked .like-icon { color: var(--accent-hover); }

/* --- Barre lecteur ----------------------------------------------------------------------------------- */
#player {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  height: var(--player-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 var(--sp-4);
  background: rgba(22, 22, 28, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.35);
}
#player[hidden] { display: none; }

#player-cover {
  width: 48px;
  height: 48px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-2);
}
.player-meta { min-width: 100px; max-width: 220px; overflow: hidden; }
#player-title {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#player-artist {
  font-size: 0.85rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.player-controls { display: flex; align-items: center; gap: 6px; }
#btn-play {
  width: 42px;
  height: 42px;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
}
#btn-play:hover { background: var(--accent-hover); }

.player-seek {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Range avec remplissage violet : --seek-fill (pourcentage) est posé par
   player.js sur input/timeupdate ; le gradient peint la portion écoulée. */
#seek {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  margin: 0;
  border-radius: var(--r-full);
  background: linear-gradient(
    to right,
    var(--accent) var(--seek-fill, 0%),
    var(--surface-2) var(--seek-fill, 0%)
  );
  cursor: pointer;
}
#seek::-webkit-slider-runnable-track { background: transparent; }
#seek::-moz-range-track { background: transparent; }
#seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -3px;
  border: none;
  border-radius: 50%;
  background: var(--accent-hover);
  transition: transform 0.15s;
}
#seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--accent-hover);
  transition: transform 0.15s;
}
#seek:hover::-webkit-slider-thumb { transform: scale(1.25); }
#seek:hover::-moz-range-thumb { transform: scale(1.25); }

#player-notice {
  color: var(--danger);
  font-size: 0.8rem;
  margin-left: 8px;
  white-space: nowrap;
}
#player-notice[hidden] { display: none; }

/* --- Responsive ----------------------------------------------------------------------------------------- */
@media (max-width: 640px) {
  #app-header { gap: 10px; padding: 10px 12px; flex-wrap: wrap; }
  /* La recherche passe en pleine largeur sous logo + zone auth */
  #search-box { order: 3; flex-basis: 100%; max-width: none; }
  #view { padding-left: 12px; padding-right: 12px; }
  .player-meta { max-width: 130px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: var(--sp-3); }
  /* Player compact : cover + contrôles + seek */
  #time-cur, #time-dur, #player-notice { display: none; }
  #player { gap: 10px; padding: 0 10px; }
  /* Lignes de playlist compactes */
  .pl-duration { display: none; }
  .pl-row { gap: 6px; padding: 8px 6px; }
  .pl-row .btn-icon { width: 30px; height: 30px; }
  .pl-cover { width: 32px; height: 32px; }
  /* Auth : carte seule, padding réduit */
  .auth-card { padding: var(--sp-5); }
  /* Page album compacte */
  .album-page-cover { width: 160px; }
  .album-head-info h1 { font-size: 1.5rem; }
  .al-plays { display: none; }
  .album-row { gap: 8px; padding: 8px 4px; }
  /* Liste de pistes upload : le nom de fichier saute, titre priorisé */
  .atr-file { display: none; }
}
