/* =====================================================================
   Sélecteur de sources
   Une ligne = une source. La qualité se lit en premier (colonne de gauche),
   puis le nom de la release, les badges techniques, la taille ; à droite,
   seulement ce qui pose problème (son converti, incompatible…).
   ===================================================================== */
.sources__controls {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 12px;
  padding: 6px 0 14px;
  margin: 0 calc(clamp(20px, calc(3vw / var(--ui)), 36px) * -1) 6px;
  padding-inline: clamp(20px, calc(3vw / var(--ui)), 36px);
  /* Opaque jusque sous les puces : la liste ne transparaît qu'au tout dernier bord */
  background: linear-gradient(180deg, rgba(22, 22, 25, .98) calc(100% - 12px), rgba(22, 22, 25, 0));
}
.sources__row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.sources__row .chips { padding: 0; margin: 0; flex-wrap: wrap; overflow: visible; }
.sources__label { color: var(--label-3); font-size: var(--fs-caption); font-weight: 600; }
/* Barre d'outils : regroupement, tri, filtres, sur une ligne quand ça tient */
.sources__tools { gap: 10px 18px; }
.sources__field { display: inline-flex; align-items: center; gap: 8px; }
/* En bas : la langue de ce titre */
.sources__pref { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 28px; }
.sources__status { display: flex; align-items: center; gap: 12px; color: var(--label-2); padding: 18px 0; }
.sources__sort { width: auto; height: 38px; border-radius: var(--r-pill); padding: 0 40px 0 16px; background-position: calc(100% - 22px) 16px, calc(100% - 16px) 16px; }

.src-group { margin-top: 22px; }
.src-group__head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 8px; padding: 0 4px; }
.src-group__title { font-size: var(--fs-title3); font-weight: 700; font-stretch: 85%; letter-spacing: -.01em; }
.src-group__count { color: var(--label-3); font-size: var(--fs-body); font-variant-numeric: tabular-nums; }
.src-list { display: grid; gap: 4px; }

.src {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--label);
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast), transform var(--t-fast) var(--ease), box-shadow var(--t-med) var(--ease);
}
@media (hover: hover) { .src:hover { background: var(--fill); } }
.is-kb .src:focus {
  outline: none;
  background: var(--focus);
  color: var(--on-focus);
  transform: scale(1.015);
  box-shadow: 0 20px 40px -18px rgba(0, 0, 0, .8);
}
.is-kb .src:focus .badge { color: rgba(0, 0, 0, .72); }
.is-kb .src:focus .badge--solid { background: #000; border-color: #000; color: #fff; }
.is-kb .src:focus .src__meta, .is-kb .src:focus .src__compat { color: rgba(0, 0, 0, .62); }
.src[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }

/* Colonne qualité */
.src__res { display: grid; justify-items: center; gap: 6px; }
.src__res-main {
  min-width: 70px;
  padding: 7px 8px;
  border: 1.5px solid currentColor;
  border-radius: 8px;
  text-align: center;
  font-size: 1.05rem;
  font-weight: 700;
  font-stretch: 85%;
  letter-spacing: -.01em;
  line-height: 1;
}
.src__res-main--4k { background: var(--label); color: var(--on-focus); border-color: var(--label); }
.is-kb .src:focus .src__res-main--4k { background: #000; color: #fff; border-color: #000; }
.src__res-hdr { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; opacity: .75; }
.src__res-hdr--dim { opacity: .45; text-decoration: line-through; text-decoration-thickness: 1px; }
/* Une technologie du fichier qui n'arrive pas jusqu'ici (son converti, relief perdu) : barrée, comme le HDR */
/* La note expliquée : image, son, et ce qui la retient ici */
.src__why { color: var(--label-2); font-size: var(--fs-footnote, .85rem); }
.src .badge--off { opacity: .45; text-decoration: line-through; text-decoration-thickness: 1px; }

.src__main { min-width: 0; display: grid; gap: 7px; }
.src__title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.src__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; color: var(--label-2); font-size: var(--fs-caption); font-variant-numeric: tabular-nums; }
.src__meta-item { display: inline-flex; align-items: center; gap: 5px; }
.src__meta-item .ico { width: 14px; height: 14px; }
.src__instant { color: var(--warn); }
.src__instant .ico { width: 15px; height: 15px; }
.is-kb .src:focus .src__instant { color: #8a6d00; }
/* Nom du fichier : le détail, en petit, sous le nom lisible (picker.js sourceName) */
.src__file { color: var(--label-3); font-size: var(--fs-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.is-kb .src:focus .src__file { color: rgba(0, 0, 0, .5); }
/* Note de qualité (grade.js) : le texte reste neutre, une pastille dit le palier */
.src__grade { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.src__grade::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--tier, var(--label-3)); flex: none; }
.src__grade--top { --tier: var(--ok); }
.src__grade--good { --tier: #64d2ff; }
.src__grade--mid { --tier: var(--warn); }
.src__grade--low { --tier: var(--danger); }

.src__side { display: grid; justify-items: end; gap: 8px; }
.src__compat { display: inline-flex; align-items: center; gap: 7px; font-size: var(--fs-caption); color: var(--label-2); white-space: nowrap; }
.src__compat--no { color: var(--danger); }
.is-kb .src:focus .src__compat--no { color: #a3140b; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--label-3); }
.dot--ok { background: var(--ok); }
.dot--maybe { background: var(--warn); }
.dot--no { background: var(--danger); }
.src__play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--fill);
  transition: background var(--t-fast);
}
.src__play .ico { width: 16px; height: 16px; }
.is-kb .src:focus .src__play { background: #000; color: #fff; }

/* Meilleur choix : la même ligne, mise en avant */
.src-best { margin-top: 6px; padding: 6px; border-radius: 22px; background: linear-gradient(135deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .04)); }
.src-best__label { display: flex; align-items: center; gap: 8px; padding: 8px 12px 2px; font-weight: 600; color: var(--label-2); font-size: var(--fs-body); }
.src-best__label .ico { width: 16px; height: 16px; color: var(--warn); }
/* Pourquoi une source mieux notée passe derrière (picker.js bestReason) */
.src-best__why { margin: 0; padding: 4px 14px 10px; color: var(--label-2); font-size: var(--fs-caption); line-height: 1.45; }
/* Ce que mesure la note affichée (recommandation ou qualité du fichier) */
.sources__score-hint { margin: 0; color: var(--label-3); font-size: var(--fs-caption); }

.sources__foot { display: grid; gap: 6px; margin-top: 18px; color: var(--label-3); font-size: var(--fs-caption); line-height: 1.5; }
/* « Comprendre les sources » : types de release, débit, notes */
.sources__help { margin-top: 6px; color: var(--label-2); }
.sources__help summary { cursor: pointer; width: fit-content; padding: 6px 12px; border-radius: 999px; background: var(--fill); color: var(--label); font-weight: 600; }
.sources__help summary:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--focus); }
.sources__help dl { display: grid; gap: 4px 0; margin: 12px 0 0; }
.sources__help dt { margin-top: 8px; color: var(--label); }
.sources__help dd { margin: 0; }
.sources__help p { margin-top: 10px; }
.sources__help-short { color: var(--label-3); font-weight: 400; }

@media (max-width: 620px) {
  /* Téléphone : outils compacts, et pas fixés en haut (ils cacheraient la liste) */
  .sources__controls { position: static; padding-bottom: 6px; background: none; }
  .sources__tools .sources__label, .sources__row > .sources__label { display: none; }
  .sources__tools { gap: 8px; }
  .sources__row .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; min-width: 0; max-width: 100%; }
  .sources__row .chips::-webkit-scrollbar { display: none; }
  .src { grid-template-columns: 62px minmax(0, 1fr); padding: 12px; gap: 12px; }
  .src__side { grid-column: 2; justify-items: start; grid-auto-flow: column; align-items: center; }
  .src__side:not(:has(.src__compat)) { display: none; } /* rien à signaler : pas de ligne vide */
  .src__play { display: none; }
  .src__res-main { min-width: 56px; font-size: .95rem; }
}
