/* DriveIn — feuille unique du front. Même langage visuel que SimpleDownload
   (fond sombre, accent ambre, cartes), mais tourné vers la lecture : pochettes
   plus hautes, grille dense, fiche avec lecteur. */
:root {
  --fond: #0e1013;
  --carte: #161a20;
  --carte-haute: #1d232c;
  --bord: #262d38;
  --texte: #eceae6;
  --doux: #98a0ad;
  --accent: #f0b429;
  --accent-sombre: #b8830f;
  --ok: #58b368;
  --rayon: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-anchor: none;
}

body.fige { position: fixed; left: 0; right: 0; width: 100%; overflow: hidden; }

button, input, select { font: inherit; color: inherit; }

/* ------------------------------------------------------------------ en-tête */
.bandeau {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: rgba(14, 16, 19, 0.94);
  border-bottom: 1px solid var(--bord);
  backdrop-filter: blur(12px);
}

.haut { display: flex; align-items: baseline; gap: 10px; }

.marque {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.marque span { color: var(--accent); }

.compte { font-size: 12px; color: var(--doux); }
.compte.vol-no { margin-left: auto; opacity: 0.55; font-variant-numeric: tabular-nums; }

.recherche { margin: 10px 0 8px; }

.recherche input {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--bord);
  border-radius: 11px;
  background: var(--carte);
  font-size: 15px;
  outline: none;
}
.recherche input:focus { border-color: var(--accent-sombre); }
.recherche input::-webkit-search-cancel-button { filter: invert(0.6); }

.onglets {
  display: flex;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
  scrollbar-width: none;
}
.onglets::-webkit-scrollbar { display: none; }

.onglet {
  flex: none;
  padding: 7px 14px;
  border: 1px solid var(--bord);
  border-radius: 999px;
  background: var(--carte);
  color: var(--doux);
  font-size: 13px;
  cursor: pointer;
}
.onglet.actif {
  background: var(--accent);
  border-color: var(--accent);
  color: #16130a;
  font-weight: 600;
}

.puce {
  flex: none;
  margin-left: auto;
  padding: 7px 10px;
  border: 1px solid var(--bord);
  border-radius: 999px;
  background: var(--carte);
  font-size: 13px;
  color: var(--doux);
}

/* ------------------------------------------------------------------- grille */
main { padding: 14px 14px max(28px, env(safe-area-inset-bottom)); }

.grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 14px 12px;
}

@media (min-width: 700px) {
  .grille { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 20px 16px; }
  main { padding: 20px 26px 40px; }
  .bandeau { padding-left: 26px; padding-right: 26px; }
}

.carte {
  display: block;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  cursor: pointer;
}

.affiche {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  border-radius: 11px;
  overflow: hidden;
  background: var(--carte-haute);
  border: 1px solid var(--bord);
}
.affiche img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Sans pochette : le titre sur un dégradé, jamais une case vide. */
.affiche .sans {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 10px;
  background: linear-gradient(160deg, #232a34 0%, #14181e 100%);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: #d9dde3;
  overflow: hidden;
}

.nb {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(10, 12, 15, 0.82);
  font-size: 11px;
  font-weight: 600;
  color: var(--texte);
}

.carte-titre {
  margin: 7px 2px 0;
  font-size: 13px;
  line-height: 1.3;
  font-weight: 600;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.carte-meta {
  margin: 3px 2px 0;
  font-size: 11.5px;
  color: var(--doux);
}

/* --------------------------------------------------------------- aucun titre */
.vide {
  margin: 60px auto;
  max-width: 460px;
  text-align: center;
  color: var(--doux);
  font-size: 14px;
  line-height: 1.6;
}
.vide b { color: var(--texte); display: block; font-size: 16px; margin-bottom: 6px; }
.vide code {
  display: inline-block;
  margin: 2px 0;
  padding: 2px 7px;
  border-radius: 7px;
  background: var(--carte);
  border: 1px solid var(--bord);
  font-size: 12.5px;
  color: #cfd5dd;
}

/* -------------------------------------------------------------------- fiche */
.voile {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(6, 8, 10, 0.72);
  backdrop-filter: blur(3px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  padding: max(12px, env(safe-area-inset-top)) 12px max(20px, env(safe-area-inset-bottom));
}

.fiche {
  max-width: 760px;
  margin: 0 auto;
  background: var(--carte);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 14px;
}

.fiche-tete { display: flex; gap: 14px; }

.fiche-affiche {
  flex: none;
  width: 104px;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--carte-haute);
  border: 1px solid var(--bord);
}
.fiche-affiche img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fiche-affiche .sans {
  display: flex;
  align-items: flex-end;
  height: 100%;
  padding: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: #d9dde3;
  background: linear-gradient(160deg, #232a34 0%, #14181e 100%);
}

.fiche-titre { margin: 0 0 4px; font-size: 18px; line-height: 1.25; }
.fiche-meta { margin: 0; font-size: 12.5px; color: var(--doux); line-height: 1.5; }

.fermer {
  margin-left: auto;
  flex: none;
  width: 34px;
  height: 34px;
  border: 1px solid var(--bord);
  border-radius: 50%;
  background: var(--carte-haute);
  color: var(--doux);
  cursor: pointer;
  line-height: 1;
  font-size: 17px;
}

/* ------------------------------------------------------------------ lecteur */
.lecteur { margin: 14px 0 0; }

/* cadre qui porte la vidéo et le calque des sous-titres */
.cadre-video { position: relative; }

.cadre-video .sous-titre {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 58px;
  margin: 0;
  text-align: center;
  font-size: 20px;              /* la taille réelle est posée par le script */
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  white-space: pre-line;
  pointer-events: none;
  text-shadow: 0 2px 6px rgba(0, 0, 0, .95), 0 0 3px #000, 0 0 12px rgba(0, 0, 0, .7);
}

.lecteur video {
  width: 100%;
  max-height: 62vh;
  border-radius: 10px;
  background: #000;
  display: block;
}

.avertir {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: #e8b34a;
  line-height: 1.5;
}

/* ------------------------------------------------------------ liste fichiers */
.saisons { margin: 16px 0 0; }

.saison-titre {
  margin: 14px 0 6px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--doux);
}

.fichier {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--bord);
  border-radius: 10px;
  background: var(--carte-haute);
  text-align: left;
  cursor: pointer;
}
.fichier.actif { border-color: var(--accent-sombre); }

.fichier i {   /* icône lecture, dessinée en CSS : pas d'emoji */
  flex: none;
  width: 0;
  height: 0;
  margin-left: 3px;
  border-left: 9px solid var(--accent);
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
}

.fichier .nom {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fichier .poids { flex: none; font-size: 11.5px; color: var(--doux); }
.fichier .ext {
  flex: none;
  padding: 1px 6px;
  border-radius: 5px;
  background: #0d1014;
  border: 1px solid var(--bord);
  font-size: 10.5px;
  color: var(--doux);
  text-transform: uppercase;
}

/* Un lecteur vide ne doit pas laisser de trou dans la fiche. */
.lecteur:empty { display: none; }

/* --------------------------------------------------- deux sections du haut */
.sections { display: flex; gap: 8px; margin: 10px 0 0; }

.section {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--bord);
  border-radius: 11px;
  background: var(--carte);
  color: var(--doux);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.section.actif {
  background: var(--accent);
  border-color: var(--accent);
  color: #16130a;
}
.pastille-nb { font-weight: 500; opacity: 0.75; }
.pastille-nb:empty { display: none; }

/* état d'un travail, sous la carte */
.carte-etat {
  margin: 4px 2px 0;
  font-size: 11.5px;
  color: var(--accent);
  line-height: 1.3;
}
.carte-etat.echec { color: #e0554f; }

/* le bouton « + » posé sur la pochette, pour préparer sans ouvrir la fiche */
.carte { position: relative; }
.plus {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(10, 12, 15, 0.78);
  border: 1px solid var(--bord);
  color: var(--accent);
  font-size: 17px;
  line-height: 24px;
  text-align: center;
  cursor: pointer;
}
.plus:hover { background: var(--accent); color: #16130a; }

/* avancement d'un encodage : 0 → 100 %, barre fine sous la carte */
.progres {
  margin: 6px 2px 0;
  height: 3px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.10);
  overflow: hidden;
}
.progres > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s linear;
}
/* sans pourcentage connu (transcription), la barre bat doucement */
.progres.indecis > span {
  animation: bat 1.6s ease-in-out infinite;
  opacity: 0.55;
}
@keyframes bat {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.65; }
}

/* pause, reprise, annulation */
.commandes {
  display: flex;
  gap: 8px;
  margin: 6px 2px 0;
}
.cmd {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--bord);
  background: rgba(10, 12, 15, 0.78);
  color: var(--accent);
  font-size: 13px;
  line-height: 30px;
  text-align: center;
  cursor: pointer;
  user-select: none;
}
.cmd:hover { background: var(--accent); color: #16130a; }
.cmd.annuler { color: #e0554f; }
.cmd.annuler:hover { background: #e0554f; color: #16130a; }

/* la barre d'action de la fiche */
.fiche-actions { margin: 14px 0 0; }

.bouton {
  padding: 10px 16px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: var(--accent);
  color: #16130a;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.bouton[disabled] {
  background: var(--carte-haute);
  border-color: var(--bord);
  color: var(--doux);
  cursor: default;
}

.fiche-synopsis {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: #c6ccd4;
}

/* Choix des sous-titres, sous le lecteur ------------------------------- */
.soustitres {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0 2px;
  font-size: 13px;
  color: var(--doux);
}

.soustitres > span {
  margin-right: 2px;
}

.soustitres button {
  padding: 5px 11px;
  border: 1px solid var(--bord);
  border-radius: 999px;
  background: var(--carte);
  color: var(--texte);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.soustitres button.actif {
  border-color: var(--accent);
  background: var(--accent);
  color: #16130a;
  font-weight: 600;
}
