/* =========================================================
   Écoute YT — feuille de style unique, mode sombre par défaut
   ========================================================= */

:root {
  --fond:        #0b0d12;
  --fond-2:      #12161f;
  --panneau:     #161b26;
  --panneau-2:   #1d2432;
  --bord:        #262f40;
  --texte:       #e8edf6;
  --doux:        #8d97ab;
  --accent:      #8b5cf6;
  --accent-2:    #c084fc;
  --danger:      #f2555a;
  --rayon:       14px;
  --ombre:       0 10px 30px rgba(0,0,0,.35);
}

html[data-theme="clair"] {
  --fond:        #f4f6fb;
  --fond-2:      #e9edf6;
  --panneau:     #ffffff;
  --panneau-2:   #f2f4fa;
  --bord:        #dfe4ef;
  --texte:       #141922;
  --doux:        #5f6b80;
  --ombre:       0 10px 30px rgba(20,25,34,.10);
}

* { box-sizing: border-box; }
/* display:flex/grid l'emporte sur l'attribut hidden : on remet les pendules à l'heure */
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 600px at 80% -10%, rgba(139,92,246,.18), transparent 60%),
    var(--fond);
  color: var(--texte);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ------------------------- en-tête ------------------------- */

.entete {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 14px clamp(12px, 3vw, 28px);
  border-bottom: 1px solid var(--bord);
  background: color-mix(in srgb, var(--fond) 80%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.titre-appli { margin: 0; font-size: 18px; letter-spacing: .2px; display: flex; align-items: center; gap: 10px; }
.pastille {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 17px;
}
.entete-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.badge-hors-ligne {
  font-size: 11px; letter-spacing: .3px; text-transform: uppercase;
  padding: 4px 9px; border-radius: 99px; margin-left: 10px;
  background: color-mix(in srgb, var(--danger) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 50%, var(--bord));
  color: var(--danger);
}

/* ------------------------- boutons ------------------------- */

.bouton {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 11px;
  border: 1px solid var(--bord); background: var(--panneau); color: var(--texte);
  font: inherit; font-size: 14px; cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.bouton:hover { background: var(--panneau-2); border-color: color-mix(in srgb, var(--accent) 45%, var(--bord)); }
.bouton:active { transform: translateY(1px); }
.bouton.principal { background: linear-gradient(140deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; font-weight: 600; }
.bouton.petit { padding: 6px 10px; font-size: 13px; }
.bouton.fantome { background: transparent; }
.bouton[aria-pressed="true"] { border-color: var(--accent); color: var(--accent-2); }

.icone {
  border: 1px solid var(--bord); background: var(--panneau); color: var(--texte);
  width: 34px; height: 34px; border-radius: 10px; cursor: pointer; font-size: 15px; line-height: 1;
}
.icone:hover { background: var(--panneau-2); }

.lien { background: none; border: 0; color: var(--doux); cursor: pointer; font: inherit; font-size: 13px; text-decoration: underline; padding: 4px; }
.lien:hover { color: var(--texte); }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico.plein { fill: currentColor; stroke: currentColor; stroke-width: 1.6; }
@media (max-width: 620px) { .mot { display: none; } .bouton { padding: 9px 11px; } }

/* ------------------------- mise en page ------------------------- */

.grille {
  display: grid; gap: 18px;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .85fr);
  align-items: start;
  padding: 18px clamp(12px, 3vw, 28px) 60px;
  max-width: 1400px; margin: 0 auto;
}
@media (max-width: 900px) { .grille { grid-template-columns: 1fr; } }

.scene, .file-zone {
  background: var(--panneau); border: 1px solid var(--bord);
  border-radius: var(--rayon); box-shadow: var(--ombre); padding: 16px;
}
.file-zone { position: sticky; top: 76px; }
@media (max-width: 900px) { .file-zone { position: static; } }

/* ------------------------- lecteur ------------------------- */

.cadre {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  background: #000; border-radius: 12px; overflow: hidden; border: 1px solid var(--bord);
}
.cadre iframe, #lecteur { width: 100%; height: 100%; border: 0; display: block; }
.cadre.audio #lecteur { opacity: 0; pointer-events: none; }

.pochette { position: absolute; inset: 0; display: grid; place-items: center; background: #000; overflow: hidden; }
.pochette .fond {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: blur(22px) brightness(.4); transform: scale(1.2);
}
.pochette .disque {
  position: relative; width: min(38%, 190px); aspect-ratio: 1; object-fit: cover;
  border-radius: 14px; box-shadow: 0 18px 40px rgba(0,0,0,.6);
}
.ondes { position: absolute; bottom: 16px; display: flex; gap: 4px; align-items: flex-end; height: 26px; }
.ondes i { width: 4px; height: 8px; border-radius: 3px; background: var(--accent-2); animation: onde 1s ease-in-out infinite; }
.ondes i:nth-child(2n) { animation-duration: .78s; }
.ondes i:nth-child(3n) { animation-duration: 1.25s; }
.ondes.pause i { animation-play-state: paused; opacity: .35; }
/* quand l'égaliseur tourne, les barres suivent le vrai spectre : plus d'animation en boucle */
.ondes.reel i { animation: none; transition: height .07s linear; }
@keyframes onde { 0%,100% { height: 7px; } 50% { height: 24px; } }
@media (prefers-reduced-motion: reduce) { .ondes i { animation: none; height: 14px; } }

.vide { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--doux); text-align: center; padding: 20px; background: var(--fond-2); }

.piste-courante { margin-top: 14px; min-height: 44px; }
.piste-titre { margin: 0; font-size: 17px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.piste-auteur { margin: 2px 0 0; color: var(--doux); font-size: 13px; }

.progression { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.temps { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--doux); min-width: 40px; text-align: center; }

.glissiere { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
.glissiere::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: var(--panneau-2); border: 1px solid var(--bord); }
.glissiere::-moz-range-track { height: 6px; border-radius: 99px; background: var(--panneau-2); border: 1px solid var(--bord); }
.glissiere::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: var(--accent-2); border: 0; box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.glissiere::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--accent-2); border: 0; }

.commandes { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 8px; flex-wrap: wrap; }
.rond {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid var(--bord); background: var(--panneau-2); color: var(--texte); cursor: pointer;
  transition: transform .08s, background .15s;
}
.rond:hover { background: color-mix(in srgb, var(--accent) 22%, var(--panneau-2)); }
.rond:active { transform: scale(.94); }
.rond.gros { width: 58px; height: 58px; background: linear-gradient(140deg, var(--accent), var(--accent-2)); border-color: transparent; color: #fff; }
.rond .ico { width: 22px; height: 22px; }
.rond.gros .ico { width: 26px; height: 26px; }
.volume { display: flex; align-items: center; gap: 8px; width: 150px; color: var(--doux); }
.son { border: 0; background: none; color: inherit; cursor: pointer; padding: 2px; display: grid; place-items: center; }
.son:hover { color: var(--texte); }
.son[aria-pressed="true"] { color: var(--danger); }

.message { margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; font-size: 13px;
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); }
.message.info { background: color-mix(in srgb, var(--accent) 16%, transparent);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent); }

/* ------------------------- file d'attente ------------------------- */

.ajout { display: flex; gap: 8px; }
.ajout input {
  flex: 1; min-width: 0; padding: 11px 13px; border-radius: 11px;
  border: 1px solid var(--bord); background: var(--fond-2); color: var(--texte); font: inherit;
}
.ajout input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; border-color: var(--accent); }

.choix { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--doux); }

.barre-listes { display: flex; align-items: center; gap: 6px; margin: 14px 0 10px; }
.barre-listes select {
  flex: 1; min-width: 0; padding: 8px 10px; border-radius: 10px;
  border: 1px solid var(--bord); background: var(--fond-2); color: var(--texte); font: inherit; font-size: 14px;
}
.compteur { font-size: 12px; color: var(--doux); white-space: nowrap; }

.file { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow: auto; }
@media (max-width: 900px) { .file { max-height: none; } }

.piste {
  display: grid; grid-template-columns: auto 64px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 7px; border-radius: 11px; border: 1px solid transparent; background: var(--panneau-2);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.piste:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--bord)); }
.piste.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--panneau-2)); }
.piste.glisse { opacity: .35; }
.piste.cible-haut { box-shadow: inset 0 3px 0 var(--accent-2); }
.piste.cible-bas { box-shadow: inset 0 -3px 0 var(--accent-2); }

.poignee { color: var(--doux); cursor: grab; padding: 0 2px; font-size: 14px; line-height: 1; user-select: none; }
.vignette { position: relative; width: 64px; aspect-ratio: 16/9; border-radius: 7px; overflow: hidden; background: var(--fond-2); flex: none; }
.vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vignette .badge { position: absolute; inset: 0; display: grid; place-items: center; font-size: 17px; color: var(--accent-2); }

.infos { display: block; min-width: 0; overflow: hidden; }
.nom { display: block; font-size: 14px; font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sous { display: block; font-size: 12px; color: var(--doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.actions { display: flex; gap: 2px; align-items: center; }
.mini {
  border: 0; background: transparent; color: var(--doux); cursor: pointer;
  width: 26px; height: 26px; border-radius: 7px; font-size: 13px; line-height: 1;
}
.mini:hover { background: var(--fond-2); color: var(--texte); }
.mini.retirer:hover { color: var(--danger); }
.mini.garde { color: var(--accent-2); }
.marque {
  display: inline-block; margin-left: 7px; padding: 1px 6px; border-radius: 99px;
  font-size: 10px; letter-spacing: .3px; vertical-align: 1px;
  background: color-mix(in srgb, var(--accent) 22%, transparent); color: var(--accent-2);
}
.mini.en-cours { opacity: .5; cursor: progress; }

.file-vide { color: var(--doux); text-align: center; padding: 26px 10px; margin: 0; font-size: 14px; }
.pied { display: flex; justify-content: space-between; margin-top: 12px; border-top: 1px solid var(--bord); padding-top: 8px; }

/* ------------------------- modales ------------------------- */

.modale {
  width: min(620px, 94vw); border: 1px solid var(--bord); border-radius: var(--rayon);
  background: var(--panneau); color: var(--texte); padding: 20px; box-shadow: var(--ombre);
}
.modale::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.modale h2 { margin: 0 0 14px; font-size: 17px; padding-right: 30px; }
.modale-fermer { position: absolute; top: 12px; right: 12px; }
.note { color: var(--doux); font-size: 13px; margin: 12px 0 0; }

.resultats { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 56vh; overflow: auto; }
.resultat { display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--panneau-2); border-radius: 11px; padding: 7px; }
.resultat img { width: 96px; aspect-ratio: 16/9; object-fit: cover; border-radius: 7px; display: block; }

/* ------------------------- réglages ------------------------- */

.modale.large { width: min(720px, 94vw); max-height: 88vh; overflow: auto; }

.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bord); margin-bottom: 4px; }
.onglet {
  border: 0; background: none; color: var(--doux); font: inherit; font-size: 14px;
  padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.onglet:hover { color: var(--texte); }
.onglet.actif { color: var(--texte); border-bottom-color: var(--accent); }

.reglage {
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  padding: 13px 0; border-bottom: 1px solid var(--bord);
}
.reglage:last-child { border-bottom: 0; }
.etiquette { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.etiquette .cle { font-size: 14px; font-weight: 550; }
.aide { color: var(--doux); font-size: 12.5px; line-height: 1.45; }
.aide.centre { text-align: center; margin: 2px 0 0; }
.aide.alerte {
  color: var(--texte); padding: 8px 11px; border-radius: 10px;
  background: color-mix(in srgb, var(--danger) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 40%, var(--bord));
}
.controle { display: flex; align-items: center; gap: 8px; flex: none; }
.controle.etendu { flex: 1 1 260px; max-width: 320px; }
.controle select {
  border: 1px solid var(--bord); background: var(--panneau-2); color: var(--texte);
  border-radius: 10px; padding: 7px 9px; font: inherit; font-size: 13px;
}
.valeur { font-variant-numeric: tabular-nums; font-size: 12.5px; color: var(--doux); min-width: 62px; text-align: right; }

/* segments : un choix parmi trois */
.segments { display: flex; border: 1px solid var(--bord); border-radius: 10px; overflow: hidden; }
.segments button {
  border: 0; background: var(--panneau-2); color: var(--doux); font: inherit; font-size: 13px;
  padding: 7px 11px; cursor: pointer; border-left: 1px solid var(--bord);
}
.segments button:first-child { border-left: 0; }
.segments button:hover { color: var(--texte); }
.segments button.actif { background: linear-gradient(140deg, var(--accent), var(--accent-2)); color: #fff; }

/* interrupteur */
.bascule { display: inline-block; cursor: pointer; }
.bascule input { position: absolute; opacity: 0; width: 0; height: 0; }
.bascule span {
  display: block; width: 44px; height: 25px; border-radius: 99px;
  background: var(--panneau-2); border: 1px solid var(--bord); position: relative; transition: background .15s, border-color .15s;
}
.bascule span::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px; border-radius: 50%;
  background: var(--doux); transition: transform .15s, background .15s;
}
.bascule input:checked + span { background: color-mix(in srgb, var(--accent) 40%, var(--panneau-2)); border-color: var(--accent); }
.bascule input:checked + span::after { transform: translateX(19px); background: #fff; }
.bascule input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.etapes { color: var(--doux); font-size: 13px; margin: 10px 0 14px; padding-left: 20px; line-height: 1.6; }
.eq-barre { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--bord); }

.pastille-etat {
  font-size: 12px; padding: 4px 9px; border-radius: 99px;
  background: var(--panneau-2); border: 1px solid var(--bord); color: var(--doux);
}
.pastille-etat.actif { color: #fff; border-color: transparent; background: linear-gradient(140deg, var(--accent), var(--accent-2)); }

/* les dix bandes */
.eq-bandes {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px;
  padding: 16px 4px 6px; margin-top: 14px;
  background: var(--panneau-2); border: 1px solid var(--bord); border-radius: var(--rayon);
}
.eq-bande { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.eq-bande .valeur { min-width: 0; text-align: center; font-size: 11px; }
.eq-bande .freq { font-size: 10.5px; color: var(--doux); white-space: nowrap; }

.glissiere.verticale {
  writing-mode: vertical-lr; direction: rtl;
  width: 22px; height: 118px; padding: 0;
}
/* le rail porte un trait en son milieu : c'est le zéro décibel */
.glissiere.verticale::-webkit-slider-runnable-track {
  width: 6px; height: 100%;
  background:
    linear-gradient(var(--doux), var(--doux)) center / 100% 1px no-repeat,
    var(--fond);
}
.glissiere.verticale::-moz-range-track {
  width: 6px; height: 100%;
  background:
    linear-gradient(var(--doux), var(--doux)) center / 100% 1px no-repeat,
    var(--fond);
}
.glissiere.verticale::-webkit-slider-thumb { margin-top: 0; margin-left: -5px; }

/* formulaire de connexion */
.formulaire { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.champ { display: flex; flex-direction: column; gap: 5px; }
.champ input {
  border: 1px solid var(--bord); background: var(--panneau-2); color: var(--texte);
  border-radius: 10px; padding: 9px 11px; font: inherit; font-size: 14px;
}
.champ input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 1px; border-color: var(--accent); }

/* bibliothèque */
.fil { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; font-size: 13px; color: var(--doux); }
.fil #fil-texte { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.biblio-vide {
  list-style: none; text-align: center; padding: 34px 20px;
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.biblio-vide p { margin: 0; color: var(--doux); font-size: 14px; max-width: 42ch; line-height: 1.6; }

.sous-titre { margin: -8px 0 14px; color: var(--doux); font-size: 13px; }

.resultat.rangee { cursor: pointer; }
.resultat.rangee:hover { background: color-mix(in srgb, var(--accent) 12%, var(--panneau-2)); }
.resultat .carre { width: 96px; aspect-ratio: 1; object-fit: cover; border-radius: 7px; display: block; background: var(--fond-2); }
.resultat .rang { width: 96px; text-align: center; color: var(--doux); font-variant-numeric: tabular-nums; font-size: 13px; }
.resultat .duree { color: var(--doux); font-size: 12px; font-variant-numeric: tabular-nums; margin-right: 4px; }
.resultat.chanson { grid-template-columns: 44px minmax(0, 1fr) auto; }
.resultat.chanson .rang { width: 44px; }

.raccourcis {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 16px;
  margin: 16px 0 0; align-items: baseline;
}
.raccourcis dt { white-space: nowrap; }
.raccourcis dd { margin: 0; color: var(--doux); font-size: 13.5px; }
kbd {
  font: inherit; font-size: 12px; padding: 2px 7px; border-radius: 6px;
  border: 1px solid var(--bord); border-bottom-width: 2px; background: var(--panneau-2); color: var(--texte);
}

@media (max-width: 620px) {
  .reglage { flex-direction: column; align-items: stretch; }
  .controle.etendu { max-width: none; }
  .eq-bandes { grid-template-columns: repeat(5, 1fr); gap: 10px 4px; }
}

/* ------------------------- divers ------------------------- */

#lecteurs-caches { position: fixed; left: -9999px; top: 0; width: 320px; height: 180px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--bord); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }
