:root {
  --bg: #121212;
  --bg-elevated: #181818;
  --bg-panel: #1f1f1f;
  --bg-hover: #2a2a2a;
  --bg-input: #2a2a2a;
  --border: #333;
  --text: #fff;
  --text-muted: #a7a7a7;
  /* Couleurs du logo : barres jaunes sur fond de nuit. */
  --accent: #ffd166;
  --accent-hover: #ffdd85;
  --on-accent: #141a33;
  --accent-soft: rgba(255,209,102,.08);
  --danger: #f15e6c;
  --radius: 8px;
  --player-height: 88px;
  --nav-width: 240px;
  --mobile-nav-height: 60px;
  /* Zones réservées au système (barre d'état, encoche, barre de navigation). Android 15+ dessine les applis
     bord à bord et la webview les expose ici (viewport-fit=cover) ; elles valent 0 sur ordinateur. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --on-text: #000;
  --chrome: #000;
  --line: #282828;
  --header: #222;
  --surface: #282828;
  --surface-hover: #3e3e3e;
  --btn-border: #727272;
  --input-focus: #777;
  --track: #4d4d4d;
  --subtle: #555;
  --tint-1: rgba(255,255,255,.04);
  --tint-2: rgba(255,255,255,.08);
  --tint-3: rgba(255,255,255,.16);
  --cover-bg: #282828;
  --cover-ink: rgba(255,255,255,.55);
  --np-top: #3a3a3a;
  --log-bg: #0b0b0b;
  --mobile-player: #2b2b2b;
  --auth-from: #2a2a2a;
  --auth-to: #000;
  --search-bg: #fff;
  --search-ink: #000;
  --search-icon: #555;
  --ok-text: #3ddc78;
  --warn-text: #f0b84a;
  --info-text: #8bb8f0;
  --shadow: rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 2rem; margin: 0 0 .5rem; letter-spacing: -.02em; }
h2 { font-size: 1.25rem; margin: 1.5rem 0 .75rem; }
code { background: var(--bg-input); padding: .1em .35em; border-radius: 4px; }
button { font: inherit; color: inherit; }
.muted { color: var(--text-muted); }
@media (min-width: 769px) { .mobile-only { display: none !important; } }
.small { font-size: .85rem; }
.strong { font-weight: 600; }
.sep { margin: 0 .4em; color: var(--text-muted); }
.hidden-input { display: none; }
.icon { flex-shrink: 0; display: block; }

/* ---------- Boutons et champs ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.1rem; border-radius: 999px; border: 1px solid var(--btn-border);
  background: transparent; cursor: pointer; font-weight: 600; white-space: nowrap;
  transition: transform .1s, border-color .1s, background .1s;
}
.btn:hover { border-color: var(--text); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.wide { width: 100%; }
.btn.compact { padding: .3rem .7rem; font-size: .85rem; }
.preview-btn.on { border-color: var(--accent); color: var(--accent); }
.request-mode { margin-bottom: .6rem; }
.request-artist { display: flex; align-items: center; gap: .3rem; font-size: .9rem; color: var(--text); margin: .1rem 0; }
.request-artist svg { color: var(--text-muted); flex: none; }
.yt-thumb.placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--bg-hover); color: var(--text-muted); }
/* Découvrir : une rangée de cartes par artiste (défilement horizontal sur mobile, grille sur grand écran). */
.discover-artist { margin: 1.6rem 0 0; }
.discover-artist-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .6rem; }
.discover-artist-head h2 { margin: 0; font-size: 1.35rem; }
.discover-because { margin: .25rem 0 .8rem; }
.discover-more { margin-top: .75rem; gap: .5rem; min-height: 2rem; }
.disc-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; max-width: 1100px; }
.disc-card { display: flex; flex-direction: column; gap: .55rem; min-width: 0; background: var(--bg-elevated); border-radius: var(--radius); padding: .55rem .55rem .65rem; }
.disc-card.known { opacity: .7; }
.disc-thumb { position: relative; aspect-ratio: 16 / 9; border-radius: calc(var(--radius) - 2px); overflow: hidden; background: var(--bg-hover); }
.disc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.disc-placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.disc-dur { position: absolute; right: .4rem; bottom: .4rem; background: rgba(0,0,0,.78); color: #fff; font-size: .72rem; font-weight: 600; padding: .1rem .35rem; border-radius: 4px; pointer-events: none; }
.disc-badge { position: absolute; left: .4rem; top: .4rem; }
.disc-body { display: flex; flex-direction: column; min-width: 0; padding: 0 .15rem; }
.disc-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Titre d'une parution : ouvre le détail de ses titres. */
.disc-title-btn { border: 0; padding: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-align: left; cursor: pointer; }
.disc-title-btn:hover, .disc-title-btn:focus-visible { text-decoration: underline; }
/* Détail d'une parution : ses titres, un par ligne. */
.release-songs { list-style: none; margin: .5rem 0 0; padding: 0; display: flex; flex-direction: column; }
.release-songs li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr) auto auto auto; align-items: center; gap: .6rem; padding: .4rem 0; border-top: 1px solid var(--border, rgba(128,128,128,.2)); }
.release-songs li:first-child { border-top: 0; }
.release-songs .rs-n { text-align: right; font-variant-numeric: tabular-nums; }
.release-songs .rs-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.release-all-hint { margin-right: auto; align-self: center; }
@media (max-width: 520px) {
  .release-songs li { grid-template-columns: 1.4rem minmax(0, 1fr) auto auto; }
  .release-songs .rs-dur { display: none; }
}
/* Carrousel : une ligne de tuiles qui défile sur place, flèches aux bords. */
.carousel { position: relative; }
.carousel-track { overflow-x: auto; scrollbar-width: none; scroll-snap-type: x proximity; }
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > .grid { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(150px, 170px); }
.carousel-track > .grid > * { scroll-snap-align: start; }
.carousel-arrow {
  position: absolute; top: 38%; transform: translateY(-50%); display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: var(--bg-elevated); color: var(--text); box-shadow: 0 4px 14px var(--shadow); cursor: pointer; z-index: 1;
}
.carousel-arrow:hover { background: var(--accent); color: var(--on-accent, #111); }
.carousel-arrow.next { right: -.5rem; }
.carousel-arrow.prev { left: -.5rem; }
.carousel-arrow.prev svg { transform: rotate(180deg); }
.carousel[data-start="true"] .carousel-arrow.prev, .carousel[data-end="true"] .carousel-arrow.next { display: none; }
.disc-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disc-actions { display: flex; align-items: center; gap: .4rem; margin-top: auto; }
.disc-actions .btn { flex: 1; justify-content: center; }
.disc-state { pointer-events: none; color: var(--text-muted); }
.disc-actions .disc-album { flex: 0 0 auto; }
.disc-album.on { border-color: var(--accent); color: var(--accent); }
/* Nouveautés des artistes : cartes carrées, plus petites que celles de la découverte. */
.disc-thumb.square { aspect-ratio: 1; }
.release-row { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); max-width: none; }
.release-filters { margin: .4rem 0 1rem; flex-wrap: wrap; }
.discover-section { margin-top: 2rem; }
@media (max-width: 640px) {
  .disc-row { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: .75rem; margin: 0 -1rem; padding: 0 1rem .4rem; scrollbar-width: none; }
  .disc-row::-webkit-scrollbar { display: none; }
  .disc-card { flex: 0 0 78%; scroll-snap-align: start; }
  .release-card { flex-basis: 46%; }
}
/* Extrait posé sur la miniature : toute la miniature est cliquable, le bouton rond reste visible. */
.preview-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border: 0; padding: 0; margin: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0) 45%, rgba(0,0,0,.55)); color: #fff; cursor: pointer; font: inherit; }
.preview-overlay .po-btn { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.62); color: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.45); transition: transform .15s ease, background .15s ease; }
.preview-overlay:hover .po-btn, .preview-overlay:focus-visible .po-btn { transform: scale(1.08); background: var(--accent); color: var(--on-accent); }
.preview-overlay:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.preview-overlay.on .po-btn, .preview-overlay.po-loading .po-btn { background: var(--accent); color: var(--on-accent); }
.preview-overlay .po-label { position: absolute; left: .5rem; bottom: .4rem; font-size: .75rem; font-weight: 700; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.preview-overlay.on::after { content: ""; position: absolute; left: 0; bottom: 0; height: 3px; width: 0; background: var(--accent); animation: po-progress 30s linear forwards; }
@keyframes po-progress { to { width: 100%; } }
@media (prefers-reduced-motion: reduce) { .preview-overlay .po-btn { transition: none; } }
.match-summary { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin: .6rem 0 0; }
.good-text { color: var(--ok-text); }
.link { background: none; border: 0; padding: 0; color: var(--text-muted); cursor: pointer; text-decoration: underline; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  color: var(--text-muted); cursor: pointer; transition: color .1s, transform .1s;
}
.icon-btn:hover { color: var(--text); text-decoration: none; }
.icon-btn:active { transform: scale(.92); }
.icon-btn:disabled { opacity: .3; cursor: default; }
.icon-btn.on { color: var(--accent); }
.icon-btn.danger:hover { color: var(--danger); }
.fav.on { color: var(--accent); }
.stars { display: inline-flex; align-items: center; gap: 0; }
.star {
  display: inline-flex; padding: 3px; border: 0; background: transparent; border-radius: 4px;
  color: var(--text-muted); cursor: pointer; transition: color .1s, transform .1s;
}
.star:hover, .star:focus-visible { color: var(--text); }
.star:active { transform: scale(.88); }
.star.on { color: var(--accent); }
.np-meta .stars { margin: .2rem 0 0 -3px; }

.play-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--text); color: var(--on-text); cursor: pointer; transition: transform .1s;
}
.play-btn:hover { transform: scale(1.06); }
.play-btn.large { width: 56px; height: 56px; background: var(--accent); color: var(--on-accent); }
.play-btn:disabled { opacity: .4; }
.play-btn.buffering { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

.input {
  width: 100%; padding: .65rem .8rem; border-radius: 6px; border: 1px solid transparent;
  background: var(--bg-input); color: var(--text); font: inherit; outline: none;
}
.input:focus { border-color: var(--input-focus); }
.input.large { font-size: 1.6rem; font-weight: 700; }
.input.compact { padding: .3rem .5rem; width: auto; }
select.input { cursor: pointer; }

.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: .9rem; }
.field > span { font-size: .85rem; color: var(--text-muted); font-weight: 600; }
/* Case à cocher : la case puis son libellé, sur une ligne. */
.field.check { flex-direction: row; align-items: center; gap: .6rem; cursor: pointer; margin-bottom: 0; }
.field.check > input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--accent); flex: none; }
.field.check > span { font-size: .95rem; color: var(--text); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; }
.form-grid .wide { grid-column: 1 / -1; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.inline-form .input { flex: 1 1 180px; width: auto; }
.inline-form .input.compact { flex: 0 0 auto; }
.stack { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 1rem; }
.row { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.form-error { color: var(--danger); }
.badge {
  font-size: .65rem; font-weight: 700; letter-spacing: .04em; padding: .1rem .35rem;
  border-radius: 3px; background: var(--bg-hover); color: var(--text-muted); margin-left: .4rem; white-space: nowrap;
}

/* Curseurs : la partie jouée (jusqu'au pouce, --pct) est remplie. Au survol elle passe à l'accent et le pouce apparaît. */
.slider {
  --pct: 0%; --fill: var(--text);
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px; cursor: pointer;
  background: linear-gradient(to right, var(--fill) var(--pct), var(--track) var(--pct));
  accent-color: var(--accent);
}
.slider:hover, .slider:focus-visible, .slider:active { --fill: var(--accent); }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 12px; border-radius: 50%; background: var(--text); opacity: 0; transition: opacity .1s; }
.slider::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: var(--text); opacity: 0; transition: opacity .1s; }
.slider:hover::-webkit-slider-thumb, .slider:focus-visible::-webkit-slider-thumb, .slider:active::-webkit-slider-thumb { opacity: 1; }
.slider:hover::-moz-range-thumb, .slider:focus-visible::-moz-range-thumb, .slider:active::-moz-range-thumb { opacity: 1; }
@media (hover: none) { .slider::-webkit-slider-thumb { opacity: 1; } .slider::-moz-range-thumb { opacity: 1; } }
.slider.volume { width: 100px; }

/* ---------- Structure ---------- */

.boot, .loading { display: flex; align-items: center; justify-content: center; min-height: 40vh; }
.boot { min-height: 100vh; }

/* Logo (composant Logo et écran de démarrage) : les barres dansent pendant la lecture et le chargement. */
.logo { flex: none; vertical-align: middle; }
.logo .lb { transform-box: fill-box; transform-origin: 50% 100%; }
.logo.playing .lb { animation: logo-eq 1s ease-in-out infinite alternate; }
@keyframes logo-eq { from { transform: scaleY(.35); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { .logo.playing .lb { animation: none; } }

.shell {
  display: grid; grid-template-columns: var(--nav-width) 1fr; grid-template-rows: 1fr auto; height: 100vh; height: 100dvh;
  /* Sous la barre d'état : la couleur de l'en-tête des pages, pour qu'elle s'y fonde. */
  padding: var(--safe-top) var(--safe-right) 0 var(--safe-left);
  background: linear-gradient(var(--header) 0 var(--safe-top), var(--bg) 0);
}
.sidebar { grid-row: 1; background: var(--chrome); padding: 1rem .75rem; display: flex; flex-direction: column; gap: .15rem; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; font-size: 1.3rem; padding: .25rem .75rem 1.25rem; }
.brand:hover { text-decoration: none; }
.nav-item { display: flex; align-items: center; gap: 1rem; padding: .6rem .75rem; border-radius: 6px; color: var(--text-muted); font-weight: 600; }
.nav-item:hover { color: var(--text); text-decoration: none; }
.nav-item.active { color: var(--text); background: var(--bg-elevated); }
.sidebar-playlists { margin-top: 1rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 .25rem 0 .75rem; color: var(--text-muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; }
.nav-sub { display: flex; align-items: center; gap: .5rem; padding: .4rem .75rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-radius: 4px; }
.nav-sub:hover, .nav-sub.active { color: var(--text); text-decoration: none; }
.sidebar-playlists { flex: 1 1 auto; min-height: 0; overflow-y: auto; }

/* Menu d'administration : groupes discrets, retour à la musique en tête. */
.nav-group { padding: 1rem .75rem .35rem; color: var(--text-muted); font-weight: 700; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.admin-back { margin-bottom: .25rem; }
.sidebar.admin .nav-item { padding: .5rem .75rem; }
.sidebar.admin .account-badge { margin-top: auto; }
.todo { display: grid; gap: .5rem; margin-bottom: 1.25rem; }
.todo .notice { margin: 0; color: var(--text); }
.todo .notice:hover { text-decoration: none; background: var(--bg-hover); }
.todo .notice .icon { color: var(--text-muted); }

/* À propos */
.about-hero { display: flex; align-items: center; gap: 1rem; }
.about-hero h2 { margin: 0; font-size: 1.5rem; }
.about-hero p { margin: .2rem 0 0; }
.section-hint { margin: -.5rem 0 .75rem; font-size: .9rem; }
.help details { border-top: 1px solid var(--line); padding: .75rem 0; }
.help details:first-of-type { border-top: 0; }
.help summary { cursor: pointer; font-weight: 600; }
.help details p { margin: .5rem 0 0; color: var(--text-muted); line-height: 1.5; }
.help h3 { margin: 1.25rem 0 .25rem; font-size: 1rem; }
.versions { margin: .75rem 0 0; }
.account-menu .versions { margin: .35rem .75rem .25rem; font-size: .75rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.5rem; margin: 0; }
.facts dt { color: var(--text-muted); }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.credits { margin: 0; padding-left: 1.1rem; line-height: 1.9; }
.credits a { text-decoration: underline; }

/* Pastille du compte, en bas du menu. Son menu s'ouvre vers le haut. */
.account-badge { position: relative; margin-top: .75rem; border-top: 1px solid var(--line); padding-top: .75rem; }
.account-trigger {
  display: flex; align-items: center; gap: .65rem; width: 100%; padding: .45rem .6rem; border: 0; border-radius: 8px;
  background: none; cursor: pointer; text-align: left;
}
.account-trigger:hover, .account-trigger.open { background: var(--bg-elevated); }
.avatar {
  flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-weight: 800; text-transform: uppercase;
}
.account-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.account-who strong, .account-who span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account-who span { color: var(--text-muted); font-size: .8rem; }
.account-trigger .icon { margin-left: auto; color: var(--text-muted); }
.account-menu {
  position: absolute; left: 0; right: 0; bottom: calc(100% + .25rem); z-index: 40; padding: .35rem;
  background: var(--surface); border-radius: 8px; box-shadow: 0 8px 24px var(--shadow);
}
.account-menu a, .account-menu button {
  display: flex; align-items: center; gap: .65rem; width: 100%; padding: .55rem .65rem; border: 0; border-radius: 4px;
  background: none; cursor: pointer; text-align: left; color: var(--text);
}
.account-menu a:hover, .account-menu button:hover { background: var(--surface-hover); text-decoration: none; }
.account-menu hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }
.account-menu .muted { padding: .35rem .65rem; font-size: .8rem; }
.theme-switch { display: flex; width: 100%; margin: .15rem 0 .35rem; }
.theme-switch button { flex: 1; }
.account-menu .theme-switch button { justify-content: center; padding: .3rem .4rem; border-radius: 999px; color: var(--text-muted); }
.account-menu .theme-switch button.on { background: var(--text); color: var(--on-text); }
.account-menu .lang { width: 100%; margin-bottom: .2rem; padding: .4rem .55rem; }
.avatar.small { width: 22px; height: 22px; font-size: .7rem; }
.menu-backdrop { position: fixed; inset: 0; z-index: 39; }

/* Nouvelle version déployée : bandeau discret en haut, au-dessus de tout. */
.update-notice {
  position: fixed; top: calc(.75rem + var(--safe-top)); left: 50%; transform: translateX(-50%); z-index: 60; display: flex; align-items: center; gap: .9rem;
  padding: .55rem .6rem .55rem 1rem; border-radius: 999px; background: var(--text); color: var(--on-text); font-weight: 600;
  box-shadow: 0 8px 24px var(--shadow);
}
.update-notice .btn { padding: .35rem .9rem; }

.content { grid-row: 1; position: relative; display: flex; flex-direction: column; min-height: 0; overflow: hidden; background: var(--bg); }
.content-scroll { flex: 1; min-height: 0; overflow-y: auto; background: linear-gradient(var(--header) 0, var(--bg) 320px); }

/* En-tête : recherche toujours à portée. Ses résultats s'ouvrent par-dessus la page, fermés par la croix ou Échap. */
.topbar { display: flex; align-items: center; padding: .75rem 2rem; background: var(--header); }
.topbar-search {
  display: flex; align-items: center; gap: .6rem; width: min(100%, 420px); padding: .55rem .9rem;
  border: 1px solid transparent; border-radius: 999px; background: var(--bg-input); color: var(--text-muted); cursor: text; text-align: left;
}
.topbar-search:hover { border-color: var(--subtle); color: var(--text); }
.topbar-search span { flex: 1; }
.topbar-search kbd { font: inherit; font-size: .75rem; padding: 0 .4rem; border: 1px solid var(--subtle); border-radius: 4px; }
.search-overlay { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--bg); }
.search-overlay-head { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem .75rem 2rem; border-bottom: 1px solid var(--border); }
.search-overlay-head .search-box { flex: 1; margin: 0; }
.search-overlay-close { margin-left: auto; }
.search-overlay-body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 2rem 2rem; }
.page { padding: 1.5rem 2rem 3rem; max-width: 1600px; }
.page.narrow { max-width: 720px; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; }
.search-ambiance .section-head { align-items: center; gap: 1rem; }
.empty { text-align: center; color: var(--text-muted); padding: 3rem 1rem; }
.empty.error { color: var(--danger); }
.more { display: flex; justify-content: center; margin: 1.5rem 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
.toolbar .input { flex: 1 1 200px; width: auto; max-width: 420px; }
.panel { background: var(--bg-elevated); border-radius: var(--radius); padding: 1.25rem 1.5rem; margin-bottom: 1.25rem; }
.panel h2 { margin-top: 0; }

.tabs { display: flex; gap: .5rem; margin-bottom: 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tab { padding: .45rem 1rem; border-radius: 999px; background: var(--bg-hover); font-weight: 600; white-space: nowrap; }
.tab:hover { text-decoration: none; background: var(--tint-3); }
.tab.active { background: var(--text); color: var(--on-text); }

/* ---------- Pochettes, cartes ---------- */

.cover { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; background: var(--cover-bg); }
.cover-placeholder { display: flex; align-items: center; justify-content: center; color: var(--cover-ink); }
.cover-xs { width: 40px; height: 40px; border-radius: 4px; flex-shrink: 0; }
.cover-xs .icon, .cover-sm .icon { width: 20px; height: 20px; }
.cover-sm { width: 56px; height: 56px; border-radius: 4px; flex-shrink: 0; }
.cover-md { width: 180px; height: 180px; flex-shrink: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 1.25rem; }
.card { display: flex; flex-direction: column; gap: .35rem; padding: .75rem; border-radius: var(--radius); background: var(--bg-elevated); transition: background .2s; min-width: 0; }
.card:hover { background: var(--bg-hover); text-decoration: none; }
.card-cover { position: relative; margin-bottom: .4rem; box-shadow: 0 8px 24px var(--shadow); border-radius: 6px; }
.card-cover.round .cover { border-radius: 50%; }
.card-play {
  position: absolute; right: 8px; bottom: 8px; width: 48px; height: 48px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; cursor: pointer;
  opacity: 0; transform: translateY(8px); transition: opacity .2s, transform .2s; box-shadow: 0 8px 8px rgba(0,0,0,.3);
}
.card:hover .card-play { opacity: 1; transform: none; }
/* Radios thématiques : vignettes colorées, pochettes en mosaïque. */
.radio-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(150px, 180px); gap: 1rem; overflow-x: auto; padding-bottom: .5rem; scrollbar-width: thin; }
.radio-card {
  display: flex; flex-direction: column; gap: .3rem; padding: .75rem; border: 0; border-radius: var(--radius); text-align: left; color: var(--text);
  background: linear-gradient(160deg, color-mix(in srgb, var(--station) 45%, var(--bg-elevated)), var(--bg-elevated) 75%);
  transition: filter .15s; min-width: 0;
}
.radio-card:hover { filter: brightness(1.12); }
/* Vignette et texte : liens vers la page de la radio. Seul le bouton rond lance la lecture. */
.radio-open { display: contents; }
.radio-text { display: flex; flex-direction: column; gap: .3rem; min-width: 0; color: inherit; text-decoration: none; }
.radio-text:hover .radio-name { text-decoration: underline; }
.radio-covers {
  position: relative; display: grid; aspect-ratio: 1; border-radius: 6px; overflow: hidden; margin-bottom: .35rem;
  background: var(--station); box-shadow: 0 8px 24px var(--shadow);
}
.radio-covers.n4 { grid-template-columns: 1fr 1fr; }
.radio-covers .cover { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }
.radio-covers.n2, .radio-covers.n3 { grid-template-columns: 1fr 1fr; }
.radio-covers.n3 .cover:first-child { grid-row: span 2; }
.radio-play {
  position: absolute; right: .5rem; bottom: .5rem; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent, #111); box-shadow: 0 4px 12px var(--shadow);
  border: 0; padding: 0; cursor: pointer; transition: transform .15s;
}
.radio-play:hover { transform: scale(1.08); }
.radio-play:active { transform: scale(.95); }
.radio-play:disabled { cursor: progress; }
.hero-cover.radio-covers { margin-bottom: 0; }
.radio-name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.radio-desc { color: var(--text-muted); font-size: .85rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.card-title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { color: var(--text-muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 1.2em; }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .6rem; }
.chip { display: flex; align-items: center; gap: .8rem; background: var(--tint-2); border-radius: 4px; overflow: hidden; font-weight: 700; padding-right: .8rem; }
.chip:hover { background: var(--tint-3); text-decoration: none; }
.chip .cover-xs { width: 56px; height: 56px; border-radius: 0; }
.chip-icon { width: 56px; height: 56px; display: flex; align-items: center; justify-content: center; background: var(--bg-hover); flex-shrink: 0; }
.chip-icon.liked, .liked-cover { background: linear-gradient(135deg, #450af5, #8e8ee5); color: #fff; }
.chip-icon.large { border-radius: 4px; }

.hero { display: flex; align-items: flex-end; gap: 1.5rem; margin: .5rem 0 1.5rem; }
.hero-cover { width: 220px; height: 220px; flex-shrink: 0; box-shadow: 0 8px 40px var(--shadow); border-radius: 6px; }
.hero-cover.round, .hero-cover.round .cover { border-radius: 50%; }
.liked-cover { display: flex; align-items: center; justify-content: center; }
.hero-meta { min-width: 0; }
.hero-meta h1 { font-size: clamp(1.8rem, 5vw, 4rem); line-height: 1.05; word-break: break-word; }
.hero-meta p { margin: .3rem 0; }
.eyebrow { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.editable { cursor: text; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-bottom: 1rem; }

/* ---------- Listes de titres ---------- */

.tracklist { list-style: none; margin: 0; padding: 0; }
.track-row {
  display: grid; grid-template-columns: 40px auto 1fr auto 56px 40px; align-items: center; gap: .75rem;
  padding: .35rem .5rem; border-radius: 4px; min-height: 56px;
}
.track-row:not(:has(.cover-xs)) { grid-template-columns: 40px 1fr auto 56px 40px; }
.track-row:hover { background: var(--bg-hover); }
.track-row.playing .track-title { color: var(--accent); }
.track-num { width: 40px; height: 40px; border: 0; background: none; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.track-num .hover-play { display: none; color: var(--text); }
.track-row:hover .track-num .num { display: none; }
.track-row:hover .track-num .hover-play { display: block; }
.track-main { display: flex; flex-direction: column; min-width: 0; cursor: default; }
.track-main.as-button { border: 0; background: none; text-align: left; cursor: pointer; padding: 0; }
.track-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-sub { color: var(--text-muted); font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-dur { color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; font-size: .9rem; }
.track-row .fav { opacity: 0; }
.track-row:hover .fav, .track-row .fav.on { opacity: 1; }
.eq { display: flex; gap: 2px; align-items: flex-end; height: 14px; }
.eq i { width: 3px; background: var(--accent); animation: eq .9s ease-in-out infinite; }
.eq i:nth-child(2) { animation-delay: .2s; }
.eq i:nth-child(3) { animation-delay: .4s; }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }

.menu-anchor { position: relative; }
.avatar.small { width: 22px; height: 22px; font-size: .7rem; }
.menu-backdrop { position: fixed; inset: 0; z-index: 40; }
.menu {
  position: absolute; right: 0; top: 100%; z-index: 41; min-width: 230px; padding: .25rem;
  background: var(--surface); border-radius: 6px; box-shadow: 0 16px 24px var(--shadow);
}
.menu button { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .65rem .75rem; border: 0; background: none; text-align: left; cursor: pointer; border-radius: 3px; }
.menu button:hover { background: var(--surface-hover); }
.menu button.danger { color: var(--danger); }

.list { display: flex; flex-direction: column; gap: .25rem; }
.list-item { display: flex; align-items: center; gap: .9rem; padding: .5rem; border-radius: 6px; border: 0; background: none; text-align: left; cursor: pointer; width: 100%; }
.list-item:hover { background: var(--bg-hover); text-decoration: none; }
.list-item > div { display: flex; flex-direction: column; min-width: 0; }
.list-title { font-weight: 600; }
.list-sub { color: var(--text-muted); font-size: .88rem; }

.queue-list, .reorder-list { list-style: none; padding: 0; margin: 0; }
.queue-item, .reorder-list li { display: flex; align-items: center; gap: .75rem; padding: .4rem .5rem; border-radius: 4px; }
.queue-item:hover, .reorder-list li:hover { background: var(--bg-hover); }
.queue-item .track-main { flex: 1; }
.queue-item.playing .track-title { color: var(--accent); }
.reorder-list li { display: grid; grid-template-columns: 1fr auto auto; }
.reorder-list .track-sub { grid-row: 2; }
.reorder-list .icon-btn { grid-row: 1 / 3; }

.picker-list { list-style: none; padding: 0; margin: 0; max-height: 50vh; overflow-y: auto; }
.picker-item { display: flex; align-items: center; gap: .75rem; width: 100%; padding: .5rem; border: 0; border-radius: 4px; background: none; cursor: pointer; text-align: left; }
.picker-item:hover { background: var(--bg-hover); }
.picker-item span { flex: 1; font-weight: 600; }
.picker-item small { color: var(--text-muted); }

.search-box { position: relative; max-width: 480px; margin-bottom: 1.5rem; color: var(--search-ink); }
.search-box .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--search-icon); }
.search-box .input { padding-left: 2.6rem; border-radius: 999px; background: var(--search-bg); color: var(--search-ink); }

/* ---------- Barre de lecture ---------- */

.player-bar {
  grid-column: 1 / -1; grid-row: 2; height: var(--player-height); background: var(--chrome); border-top: 1px solid var(--line);
  display: grid; grid-template-columns: minmax(180px, 30%) 1fr minmax(180px, 30%); align-items: center; gap: 1rem; padding: 0 1rem;
  position: relative;
}
.pb-track { display: flex; align-items: center; gap: .8rem; min-width: 0; cursor: pointer; touch-action: pan-y; transition: transform .2s ease; }
.pb-track.dragging { transition: none; }
.pb-meta { display: flex; flex-direction: column; min-width: 0; }
.pb-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-artist { color: var(--text-muted); font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-center { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.pb-controls { display: flex; align-items: center; gap: .6rem; }
.pb-seek { display: flex; align-items: center; gap: .6rem; width: 100%; max-width: 640px; }
.time { font-size: .75rem; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 40px; text-align: center; }
.pb-right { display: flex; align-items: center; justify-content: flex-end; gap: .3rem; }
.pb-error { color: var(--danger); font-size: .8rem; }
.pb-remote {
  display: inline-flex; align-items: center; gap: .35rem; border: 0; background: none; padding: 0;
  color: var(--accent); font: inherit; font-size: .75rem; cursor: pointer;
}
.pb-remote:hover .strong { text-decoration: underline; }
.pb-progress-mobile { display: none; }

/* ---------- Plein écran (mobile) ---------- */

.now-playing {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; gap: 1.25rem;
  padding: calc(1rem + var(--safe-top)) calc(1.5rem + var(--safe-right)) calc(2rem + var(--safe-bottom)) calc(1.5rem + var(--safe-left));
  background: linear-gradient(var(--np-top), var(--bg) 70%); overflow-y: auto;
  animation: slide-up .25s ease-out;
}
@keyframes slide-up { from { transform: translateY(100%); } }
.np-header { display: flex; align-items: center; justify-content: space-between; }
.np-context { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.np-cover { width: min(100%, 60vh, 520px); align-self: center; box-shadow: 0 16px 48px var(--shadow); border-radius: 8px; }
.np-meta { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: min(100%, 520px); align-self: center; }
.np-meta > div:first-child { display: flex; flex-direction: column; min-width: 0; }
.np-title { font-size: 1.4rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-artist { color: var(--text-muted); }
.np-seek { width: min(100%, 520px); align-self: center; }
.np-times { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-muted); margin-top: .4rem; font-variant-numeric: tabular-nums; }
.np-controls { display: flex; align-items: center; justify-content: space-between; width: min(100%, 420px); align-self: center; }
.np-controls .icon-btn { width: 56px; height: 56px; color: var(--text); }
.np-controls .icon-btn.on { color: var(--accent); }
.play-btn.large { width: 64px; height: 64px; }
.np-actions { display: flex; flex-direction: row; align-items: center; gap: .25rem; flex-shrink: 0; }

/* Paroles à la place de la pochette : elles seules défilent, les commandes restent en place. */
.now-playing.with-lyrics { overflow: hidden; }
.lyrics {
  position: relative; flex: 1 1 0; min-height: 0; overflow-y: auto; width: min(100%, 720px); align-self: center;
  display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; padding: 30vh 0;
  mask-image: linear-gradient(transparent, #000 12%, #000 88%, transparent);
}
.lyrics .loading { align-self: center; }
.lyric {
  border: 0; background: none; padding: .15rem 0; margin: 0; text-align: left; font: inherit; color: var(--text-muted);
  font-size: clamp(1.15rem, 2.6vw, 1.75rem); font-weight: 700; line-height: 1.35; transition: color .2s, opacity .2s;
}
button.lyric { cursor: pointer; }
button.lyric:hover { color: var(--text); }
.lyric.past { opacity: .55; }
.lyric.current { color: var(--text); opacity: 1; }
.lyric.gap { min-height: .8rem; }
.lyrics:not(:has(button.lyric)) { padding: 1rem 0; }
.lyrics-empty { align-self: center; margin: auto; color: var(--text-muted); }
.lyrics-source { font-size: .75rem; color: var(--text-muted); margin-top: 1.5rem; }

/* ---------- Modales, toasts ---------- */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center;
  padding: calc(1rem + var(--safe-top)) calc(1rem + var(--safe-right)) calc(1rem + var(--safe-bottom)) calc(1rem + var(--safe-left));
}
.modal { width: min(560px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); box-shadow: 0 16px 48px var(--shadow); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1rem 0 1.5rem; }
.modal-header h2 { margin: 0; }
.modal-body { padding: 1rem 1.5rem; overflow-y: auto; }
.modal-footer { display: flex; justify-content: flex-end; gap: .6rem; padding: 0 1.5rem 1.25rem; }

.toasts { position: fixed; left: 50%; bottom: calc(var(--player-height) + 1rem); transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: .5rem; align-items: center; pointer-events: none; }
.toast { background: #2e77d0; color: #fff; padding: .7rem 1.2rem; border-radius: 8px; font-weight: 600; box-shadow: 0 8px 24px rgba(0,0,0,.4); animation: fade-in .2s; max-width: 90vw; }
.toast.error { background: #b42b38; }
@keyframes fade-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Connexion ---------- */

.auth-page { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.5rem; background: linear-gradient(var(--auth-from), var(--auth-to)); }
.auth-card { width: min(420px, 100%); background: var(--bg); border-radius: 12px; padding: 2.5rem 2rem; display: flex; flex-direction: column; gap: 1rem; align-items: stretch; text-align: center; }
.auth-card svg { align-self: center; }
.auth-card label { display: flex; flex-direction: column; gap: .35rem; text-align: left; font-weight: 600; font-size: .9rem; }

/* ---------- Admin ---------- */

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat { background: var(--bg-elevated); border-radius: var(--radius); padding: 1rem 1.25rem; display: flex; flex-direction: column; }
.stat-value { font-size: 1.6rem; font-weight: 800; }
.stat-label { color: var(--text-muted); font-size: .85rem; }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 2.5rem 1rem;
  border: 2px dashed var(--subtle); border-radius: var(--radius); color: var(--text-muted); text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.dropzone.disabled { opacity: .5; pointer-events: none; }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

.upload-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .6rem; }
.upload-item { display: grid; grid-template-columns: 1fr 200px; gap: .25rem 1rem; align-items: center; }
.upload-name { display: flex; flex-direction: column; min-width: 0; }
.upload-name span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-name small { color: var(--text-muted); }
.upload-item.error small { color: var(--danger); }
.upload-item.done small { color: var(--accent); }
.upload-item progress { width: 100%; accent-color: var(--accent); }
.upload-item a { grid-column: 1 / -1; font-size: .85rem; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); padding: .5rem; }
.table td { padding: .45rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:hover td { background: var(--bg-elevated); }
.table .path { color: var(--text-muted); max-width: 280px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; direction: rtl; text-align: left; }
.row-actions { white-space: nowrap; text-align: right; }
.album-editor { display: flex; gap: 1.5rem; align-items: flex-start; }
.album-editor form { flex: 1; }

#blazor-error-ui { position: fixed; bottom: 0; left: 0; right: 0; z-index: 100; padding: .75rem 1.25rem; background: #b42b38; color: #fff; }
#blazor-error-ui .reload { color: #fff; text-decoration: underline; margin-left: .5rem; }

/* ---------- Mobile ---------- */

@media (max-width: 768px) {
  .desktop-only { display: none !important; }
  .shell { grid-template-columns: 1fr; grid-template-rows: 1fr auto auto; }
  .content { grid-row: 1; }
  .search-overlay-head { padding: .75rem 1rem; }
  .search-overlay-body { padding: 0 1rem 1.5rem; }
  .sidebar {
    grid-row: 3; flex-direction: row; justify-content: space-around; align-items: stretch;
    padding: .25rem 0 calc(.25rem + var(--safe-bottom)); height: calc(var(--mobile-nav-height) + var(--safe-bottom)); overflow: visible;
    background: linear-gradient(transparent, var(--chrome) 30%);
  }
  .brand { display: none; }
  .sidebar.admin { justify-content: flex-start; overflow-x: auto; scrollbar-width: none; }
  .sidebar.admin .nav-group { display: none; }
  .sidebar.admin .nav-item { flex: 0 0 auto; min-width: 72px; }
  .nav-item { flex-direction: column; gap: .15rem; font-size: .68rem; padding: .3rem .5rem; flex: 1; }
  .nav-item.active { background: none; }
  .player-bar {
    grid-row: 2; grid-template-columns: 1fr auto; height: 60px; margin: 0 .5rem; padding: 0 .5rem;
    border-radius: 8px; background: var(--mobile-player); border: 0; gap: .5rem;
  }
  .pb-center { flex-direction: row; }
  /* Menus d'une piste : en feuille au bas de l'écran, au-dessus du lecteur et de la navigation, plutôt que sous le
     bouton où ils sortaient de l'écran (ou passaient sous le lecteur) en bas de liste. */
  .tracklist .menu-backdrop { z-index: 80; background: rgba(0,0,0,.55); }
  .tracklist .menu {
    position: fixed; top: auto; left: .5rem; right: .5rem; bottom: calc(.5rem + var(--safe-bottom)); z-index: 81;
    padding: .5rem; border-radius: 12px; max-height: 70dvh; overflow-y: auto;
  }
  .tracklist .menu button { padding: .85rem .9rem; font-size: 1rem; }
  .pb-controls { gap: .1rem; }
  .pb-track .fav { display: none; }
  .cover-sm { width: 44px; height: 44px; }
  .pb-progress-mobile { display: block; position: absolute; left: 8px; bottom: 0; height: 2px; background: var(--text); border-radius: 1px; max-width: calc(100% - 16px); }
  .page { padding: 1rem 1rem 2rem; }
  h1 { font-size: 1.6rem; }
  .hero { flex-direction: column; align-items: center; text-align: center; }
  .hero-cover { width: 60vw; height: 60vw; max-width: 260px; max-height: 260px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .75rem; }
  .card { padding: .5rem; background: none; }
  .card-play { display: none; }
  .track-row { grid-template-columns: auto 1fr auto 40px; gap: .6rem; }
  .track-row:not(:has(.cover-xs)) { grid-template-columns: 1fr auto 40px; }
  .track-row .track-num, .track-row .track-dur { display: none; }
  .track-row .fav { opacity: 1; }
  .toasts { bottom: calc(var(--mobile-nav-height) + 80px + var(--safe-bottom)); }
  .upload-item { grid-template-columns: 1fr; }
  .album-editor { flex-direction: column; align-items: center; }
  .chips { grid-template-columns: 1fr 1fr; }
}

/* ---------- Graphiques du tableau de bord ---------- */
/* Palette catégorielle validée (daltonisme, contraste) sur le fond sombre. Le libre et les autres fichiers restent neutres. */
:root {
  --series-library: #3987e5;
  --series-upload: #d95926;
  --series-youtube: #199e70;
  --series-cache: #c98500;
  --series-other: #6b6b6b;
  --series-free: #2e2e2e;
  --viz-grid: #2a2a2a;
}

/* Thème clair : choisi dans le menu du compte, ou celui du système (data-theme absent). */
:root[data-theme="light"] {
  --accent: #3346c4;
  --accent-hover: #2636a8;
  --on-accent: #fff;
  --accent-soft: rgba(51,70,196,.06);
  --bg: #ffffff;
  --bg-elevated: #f6f6f6;
  --bg-panel: #f0f0f0;
  --bg-hover: #ebebeb;
  --bg-input: #f0f0f0;
  --border: #d9d9d9;
  --text: #121212;
  --text-muted: #5e5e5e;
  --on-text: #fff;
  --chrome: #f4f4f4;
  --line: #e2e2e2;
  --header: #f4f4f4;
  --surface: #ffffff;
  --surface-hover: #efefef;
  --btn-border: #a8a8a8;
  --input-focus: #888;
  --track: #cfcfcf;
  --subtle: #bdbdbd;
  --tint-1: rgba(0,0,0,.03);
  --tint-2: rgba(0,0,0,.05);
  --tint-3: rgba(0,0,0,.09);
  --cover-bg: #e6e6e6;
  --cover-ink: rgba(0,0,0,.4);
  --np-top: #e6e6e6;
  --log-bg: #f4f4f4;
  --mobile-player: #ececec;
  --auth-from: #f4f4f4;
  --auth-to: #fff;
  --search-bg: #f0f0f0;
  --search-ink: #121212;
  --search-icon: #5e5e5e;
  --ok-text: #13803d;
  --warn-text: #8a5a00;
  --info-text: #1f5fae;
  --shadow: rgba(0,0,0,.14);
  --series-other: #9e9e9e;
  --series-free: #e3e3e3;
  --viz-grid: #e6e6e6;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --accent: #3346c4;
    --accent-hover: #2636a8;
    --on-accent: #fff;
    --accent-soft: rgba(51,70,196,.06);
    --bg: #ffffff;
    --bg-elevated: #f6f6f6;
    --bg-panel: #f0f0f0;
    --bg-hover: #ebebeb;
    --bg-input: #f0f0f0;
    --border: #d9d9d9;
    --text: #121212;
    --text-muted: #5e5e5e;
    --on-text: #fff;
    --chrome: #f4f4f4;
    --line: #e2e2e2;
    --header: #f4f4f4;
    --surface: #ffffff;
    --surface-hover: #efefef;
    --btn-border: #a8a8a8;
    --input-focus: #888;
    --track: #cfcfcf;
    --subtle: #bdbdbd;
    --tint-1: rgba(0,0,0,.03);
    --tint-2: rgba(0,0,0,.05);
    --tint-3: rgba(0,0,0,.09);
    --cover-bg: #e6e6e6;
    --cover-ink: rgba(0,0,0,.4);
    --np-top: #e6e6e6;
    --log-bg: #f4f4f4;
    --mobile-player: #ececec;
    --auth-from: #f4f4f4;
    --auth-to: #fff;
    --search-bg: #f0f0f0;
    --search-ink: #121212;
    --search-icon: #5e5e5e;
    --ok-text: #13803d;
    --warn-text: #8a5a00;
    --info-text: #1f5fae;
    --shadow: rgba(0,0,0,.14);
    --series-other: #9e9e9e;
    --series-free: #e3e3e3;
    --viz-grid: #e6e6e6;
    color-scheme: light;
  }
}

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 1.25rem; }
.viz h2 { margin-bottom: .25rem; }
.viz-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.viz-head h2 { margin: 0; }
.viz-hero { font-size: 1.8rem; font-weight: 800; margin: .25rem 0 .75rem; }
.viz-hero-sub { font-size: .95rem; font-weight: 400; }

.segbar { display: flex; gap: 2px; height: 14px; border-radius: 4px; overflow: hidden; margin-bottom: 1rem; }
.segbar-part { min-width: 2px; }

.viz-legend { list-style: none; margin: 0 0 .5rem; padding: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; font-size: .88rem; }
.viz-legend li { display: flex; align-items: center; gap: .45rem; }
.viz-legend.rows { flex-direction: column; }
.viz-legend.rows li { display: grid; grid-template-columns: 12px 12.5rem 5.5rem 1fr; gap: .6rem; }
.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

.segmented { display: inline-flex; background: var(--bg-hover); border-radius: 999px; padding: 2px; }
.segmented button { border: 0; background: transparent; padding: .3rem .8rem; border-radius: 999px; cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.segmented button.on { background: var(--text); color: var(--on-text); }

.viz-plot { position: relative; }
.viz-svg { width: 100%; height: auto; display: block; overflow: visible; }
.viz-grid { stroke: var(--viz-grid); stroke-width: 1; }
.viz-baseline { stroke: var(--subtle); stroke-width: 1; }
.viz-axis { fill: var(--text-muted); font-size: 11px; }
.viz-svg path { transition: opacity .15s; }
.viz-svg path.dim { opacity: .35; }
.viz-hit { fill: transparent; cursor: default; }
.viz-tip {
  position: absolute; top: 0; transform: translateX(-50%); pointer-events: none; min-width: 170px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: .5rem .7rem; font-size: .82rem;
  box-shadow: 0 8px 24px var(--shadow); z-index: 2;
}
.viz-tip-row { display: flex; align-items: center; gap: .45rem; margin-top: .2rem; }
.viz-tip-value { margin-left: auto; font-variant-numeric: tabular-nums; padding-left: 1rem; }
.viz-table { margin-top: .75rem; font-size: .88rem; }
.viz-table summary { cursor: pointer; color: var(--text-muted); }
a.stat:hover { text-decoration: none; background: var(--bg-hover); }
@media (max-width: 600px) {
  .viz-legend.rows li { grid-template-columns: 12px 1fr auto; }
  .viz-legend.rows li > :last-child { grid-column: 2 / -1; }
}

/* ---------- Import YouTube ---------- */
.grow { flex: 1 1 auto; min-width: 0; }
.block { display: block; }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .8rem; }
button.tab { border: 0; cursor: pointer; color: inherit; display: inline-flex; align-items: center; }
.tabs.sub .tab { background: transparent; border: 1px solid var(--border); }
.tabs.sub .tab.active { background: var(--text); color: var(--on-text); border-color: var(--text); }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; background: var(--bg-elevated); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.notice.warn { border-left-color: #c98500; }
.notice > span { flex: 1 1 260px; }
.notice progress { flex: 0 1 200px; accent-color: var(--accent); }
.badge.good { background: rgba(29,185,84,.18); color: var(--ok-text); }
.badge.bad { background: rgba(241,94,108,.18); color: var(--danger); }
.badge.info { background: rgba(57,135,229,.2); color: var(--info-text); }
.badge.warn { background: rgba(201,133,0,.22); color: var(--warn-text); }
.badge.clickable { border: 0; cursor: pointer; font-size: .7rem; }
.yt-list { list-style: none; margin: 0; padding: 0; }
.yt-list li { display: flex; align-items: center; gap: .8rem; padding: .5rem .25rem; border-bottom: 1px solid var(--line); }
.yt-list li.known { opacity: .6; }
.yt-list.requests .row-actions { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; justify-content: flex-end; }
.danger-text { color: var(--danger); }
.input.compact.quota { width: 5.5rem; }
.quota-line { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: baseline; }
@media (max-width: 640px) {
    .yt-list.requests li { flex-wrap: wrap; }
    .yt-list.requests .grow { flex: 1 1 calc(100% - 110px); min-width: 0; }
    .yt-list.requests .row-actions { width: 100%; justify-content: flex-start; padding-left: calc(96px + .8rem); }
}
.yt-thumb { width: 96px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: var(--cover-bg); flex-shrink: 0; }
.review-head { display: flex; gap: .8rem; align-items: center; margin-bottom: .5rem; }
.review-head img { object-fit: cover; }
.candidates { list-style: none; margin: 0 0 1rem; padding: 0; max-height: 260px; overflow-y: auto; }
.candidates li { display: flex; gap: .7rem; align-items: center; padding: .45rem .5rem; border-radius: 6px; cursor: pointer; }
.candidates li:hover { background: var(--bg-hover); }
.candidates li.on { background: var(--bg-hover); outline: 1px solid var(--subtle); }
.score { min-width: 2.2rem; text-align: center; font-weight: 800; font-size: .8rem; border-radius: 4px; padding: .15rem 0; }
.score.good { background: rgba(29,185,84,.18); color: var(--ok-text); }
.score.mid { background: rgba(201,133,0,.22); color: var(--warn-text); }
.score.low { background: rgba(241,94,108,.18); color: var(--danger); }
@media (max-width: 600px) {
  .yt-thumb { width: 64px; }
}
.viz-axis-label { position: absolute; color: var(--text-muted); font-size: .72rem; white-space: nowrap; pointer-events: none; font-variant-numeric: tabular-nums; }
.viz-axis-label.y { transform: translateY(-50%); }
.viz-axis-label.x { bottom: 0; transform: translateX(-50%); }

.formats-table {
    max-height: 18rem;
    overflow: auto;
    padding: .6rem .8rem;
    margin: .6rem 0;
    border-radius: 6px;
    background: rgba(127, 127, 127, .1);
    font-size: .78rem;
    line-height: 1.35;
    white-space: pre;
}

/* Comptes (Android) */
.accounts { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .5rem; }
.accounts li { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; justify-content: space-between; padding: .7rem .9rem; border-radius: var(--radius); background: var(--tint-1); border: 1px solid transparent; }
.accounts li.active { border-color: var(--accent); }
.devices { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .4rem; }
.devices li { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; padding: .55rem .8rem; border-radius: var(--radius); background: var(--tint-1); overflow-wrap: anywhere; }
.account-name { display: flex; flex-direction: column; min-width: 0; }
.account-name strong { overflow: hidden; text-overflow: ellipsis; }

/* Applis Subsonic : champ en lecture seule suivi de ses boutons (afficher, copier), le champ rétrécit sur mobile. */
.copy-field { display: flex; align-items: center; gap: .25rem; }
.copy-field .input { flex: 1 1 auto; min-width: 0; }
.copy-field .icon-btn { flex: none; }

/* Tâches */
.lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .6rem; margin-bottom: 1.25rem; }
.lane { display: flex; flex-direction: column; gap: .15rem; background: var(--bg-elevated); border-radius: var(--radius); border-left: 3px solid var(--border); padding: .6rem .9rem; }
.lane.busy { border-left-color: var(--accent); }
.lane.paused { border-left-color: var(--warn-text); }
.lane-head { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.lane-head .icon-btn { margin: -.3rem -.4rem -.3rem 0; }
.jobs-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
@media (min-width: 1100px) { .jobs-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); } }
.yt-list li.clickable { cursor: pointer; border-radius: 4px; }
.yt-list li.clickable:hover { background: var(--bg-hover); }
.yt-list li.selected { background: var(--bg-hover); box-shadow: inset 3px 0 0 var(--accent); }
.yt-list progress { display: block; width: 100%; height: 4px; margin-top: .3rem; }
.job-log { display: flex; flex-direction: column-reverse; max-height: 22rem; overflow: auto; background: var(--log-bg); border-radius: 4px; padding: .6rem .75rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.job-log .warn { color: var(--warn-text); }
.job-log .error { color: var(--danger); }
pre.mono { white-space: pre-wrap; word-break: break-all; background: var(--log-bg); padding: .5rem; border-radius: 4px; }

/* Historique d'écoute */
.history-tops { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.history-top { margin: 0; padding-left: 1.5rem; display: flex; flex-direction: column; gap: .35rem; }
.history-top li { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; min-width: 0; }
.history-top .link, .history-title { color: var(--text); text-decoration: none; font-weight: 600; text-align: left; }
.history-top .link:hover, .history-title:hover { text-decoration: underline; }
.history-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.history-entry { display: flex; align-items: center; gap: .75rem; padding: .4rem 0; border-bottom: 1px solid var(--border); }
.history-time { width: 2.75rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.history-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.history-main > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-meta { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .history-meta > span:not(.badge):not(:last-child) { display: none; } }
/* Demandes, recherche dans le catalogue : pochettes carrées, photos d'artiste rondes. */
.catalog-title { margin: 1rem 0 .2rem; font-size: 1rem; }
.catalog-head { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-top: .6rem; }
.catalog-head h3 { margin: 0; font-size: 1rem; }
.catalog-cover { width: 54px; height: 54px; object-fit: cover; border-radius: 4px; background: var(--cover-bg); flex-shrink: 0; }
.catalog-cover.round { border-radius: 50%; }
.catalog-cover.placeholder { display: inline-flex; align-items: center; justify-content: center; background: var(--bg-hover); color: var(--text-muted); }
@media (max-width: 640px) {
    .yt-list.requests.catalog .row-actions { padding-left: calc(54px + .8rem); }
}
.catalog-filters { display: flex; flex-wrap: wrap; gap: .4rem; margin: .8rem 0 .2rem; }
.check-pill { display: inline-flex; align-items: center; gap: .4rem; padding: .3rem .7rem; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: .9rem; }
.check-pill > input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--accent); }
.check-pill:has(input:checked) { border-color: var(--accent); }
.check-pill.empty { opacity: .55; }
