/* Inter pour toute l'interface ; Bebas Neue uniquement pour le logotype. */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ===========================================================================
   Jetons de couleur.
   Le thème sombre est la référence ; le thème clair redéfinit les mêmes noms.
   Aucun composant ne cite une couleur en dur, uniquement ces variables.
   =========================================================================== */

:root {
  --bg:            #08080c;
  --bg-elev:       #121219;
  --bg-card:       #17171f;
  --bg-hover:      #1f1f2a;
  --line:          #26262f;
  --line-strong:   #35353f;

  --text:          #f4f4f7;
  --text-muted:    #9b9baa;
  --text-faint:    #6c6c7c;

  --accent:        #e50914;
  --accent-hover:  #ff2b36;
  --accent-soft:   rgba(229, 9, 20, .14);
  --on-accent:     #ffffff;

  --ok:            #3ddc84;
  --ok-soft:       rgba(61, 220, 132, .13);
  --warn:          #ffb020;
  --warn-soft:     rgba(255, 176, 32, .13);
  --danger:        #ff6b72;
  --danger-soft:   rgba(255, 107, 114, .13);

  --radius:        13px;
  --radius-lg:     20px;
  /* Affiches, vignettes et bannieres : plus rond que les boutons et les
     panneaux, et regle ici pour toutes d'un coup. */
  --radius-media:  18px;
  --shadow:        0 10px 40px rgba(0, 0, 0, .55);
  --shadow-soft:   0 2px 12px rgba(0, 0, 0, .3);

  --hero-scrim:    linear-gradient(90deg, rgba(8,8,12,.97) 0%, rgba(8,8,12,.72) 46%, rgba(8,8,12,.15) 100%);
  --hero-fade:     linear-gradient(0deg, var(--bg) 1%, transparent 42%);
  --skeleton:      linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);

  --fast:   140ms;
  --normal: 240ms;
  --slow:   400ms;
  --ease:   cubic-bezier(.22, .61, .36, 1);
}

:root[data-theme='light'] {
  --bg:            #f7f7fa;
  --bg-elev:       #ffffff;
  --bg-card:       #ffffff;
  --bg-hover:      #ececeF;
  --line:          #e0e0e6;
  --line-strong:   #c9c9d2;

  /* Contrastes vérifiés à 4.5:1 minimum sur --bg et --bg-card. */
  --text:          #14141a;
  --text-muted:    #5a5a68;
  --text-faint:    #74748a;

  --accent:        #c40812;
  --accent-hover:  #a3060f;
  --accent-soft:   rgba(196, 8, 18, .09);

  --ok:            #10814a;
  --ok-soft:       rgba(16, 129, 74, .1);
  --warn:          #8a5a00;
  --warn-soft:     rgba(138, 90, 0, .1);
  --danger:        #b3121b;
  --danger-soft:   rgba(179, 18, 27, .09);

  --shadow:        0 10px 40px rgba(20, 20, 30, .13);
  --shadow-soft:   0 2px 10px rgba(20, 20, 30, .08);

  --hero-scrim:    linear-gradient(90deg, rgba(247,247,250,.97) 0%, rgba(247,247,250,.78) 46%, rgba(247,247,250,.2) 100%);
  --hero-fade:     linear-gradient(0deg, var(--bg) 1%, transparent 42%);
  --skeleton:      linear-gradient(90deg, #ececf1 25%, #f6f6f9 50%, #ececf1 75%);
}

* { box-sizing: border-box; }

/* Une regle d'auteur comme « .season { display: grid } » bat le
   « [hidden] { display: none } » du navigateur : l'element reste visible malgre
   l'attribut. On impose donc le masquage une fois pour toutes. */
[hidden] { display: none !important; }

html { color-scheme: dark; }
:root[data-theme='light'] { color-scheme: light; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background var(--normal) var(--ease), color var(--normal) var(--ease);
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; }

/* Anneau de focus visible partout : jamais supprimé, seulement redessiné. */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

::selection { background: var(--accent); color: var(--on-accent); }

/* ------------------------------- animations -------------------------------- */

@keyframes fade-up   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade-in   { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in    { from { opacity: 0; transform: scale(.94) translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes shimmer   { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin      { to { transform: rotate(360deg); } }

.anim-fade-up { animation: fade-up var(--slow) var(--ease) both; }
.anim-fade-in { animation: fade-in var(--normal) var(--ease) both; }

/* Cascade : chaque carte entre légèrement après la précédente. */
.stagger > * { animation: pop-in 420ms var(--ease) both; }
.stagger > *:nth-child(1)  { animation-delay: 0ms; }
.stagger > *:nth-child(2)  { animation-delay: 45ms; }
.stagger > *:nth-child(3)  { animation-delay: 90ms; }
.stagger > *:nth-child(4)  { animation-delay: 135ms; }
.stagger > *:nth-child(5)  { animation-delay: 180ms; }
.stagger > *:nth-child(6)  { animation-delay: 225ms; }
.stagger > *:nth-child(7)  { animation-delay: 270ms; }
.stagger > *:nth-child(n+8) { animation-delay: 310ms; }

/* Exigence d'accessibilité : personne ne doit subir le mouvement. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --------------------------------- icônes ---------------------------------- */

.icon {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-lg { width: 1.5em; height: 1.5em; }

/* -------------------------------- navigation ------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 26px;
  padding: 14px 4vw;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border-bottom: 1px solid transparent;
  backdrop-filter: saturate(1.4) blur(14px);
  transition: border-color var(--normal) var(--ease), background var(--normal) var(--ease);
}
.nav.scrolled { border-bottom-color: var(--line); }

/* Le logotype seul change de police : condense et tout en capitales, il se
   distingue du reste de l'interface sans en alourdir le chargement. */
.logo {
  font-family: 'Bebas Neue', 'Inter', sans-serif;
  font-weight: 400;
  font-size: 30px;
  line-height: 1;
  letter-spacing: .06em;
  color: var(--accent);
  transition: opacity var(--fast) var(--ease);
}
.logo:hover { opacity: .82; }

.nav-links { display: flex; gap: 6px; }
.nav-links a {
  position: relative;
  padding: 8px 15px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.nav-links a:hover { color: var(--text); background: var(--bg-hover); }
/* Onglet actif : une pastille pleine plutot qu'un trait sous le mot. */
.nav-links a.active {
  color: var(--on-accent);
  background: var(--accent);
}
.nav-links a.active:hover { background: var(--accent-hover); color: var(--on-accent); }

.nav-spacer { flex: 1; }
.nav-right { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  background: linear-gradient(140deg, var(--accent), #7a0610);
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  flex: none;
}

/* Bouton icône seul : il lui faut un nom accessible (aria-label). */
.icon-btn {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease),
              border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.icon-btn:hover { color: var(--text); background: var(--bg-hover); border-color: var(--line-strong); }
.icon-btn:active { transform: scale(.94); }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;              /* cible tactile confortable */
  padding: 11px 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn:hover { background: var(--bg-hover); border-color: var(--line-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  box-shadow: 0 4px 16px var(--accent-soft);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { min-height: 36px; padding: 7px 13px; font-size: 13px; border-radius: 10px; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-block { width: 100%; }

/* ----------------------------------- héros --------------------------------- */

/* Les diapositives sont empilees dans une seule cellule de grille : la hauteur
   du carrousel suit la plus haute, sans positionnement absolu ni calcul. */
.hero {
  position: relative;
  display: grid;
  margin-top: -66px;
  isolation: isolate;
}

.hero-slide {
  grid-area: 1 / 1;
  position: relative;
  min-height: 62vh;
  display: flex;
  align-items: flex-end;
  padding: 130px 4vw 54px;
  background-size: cover;
  background-position: center 22%;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--slow) var(--ease), visibility var(--slow) var(--ease);
}
.hero-slide.on { opacity: 1; visibility: visible; }

.hero-slide::after {
  content: '';
  position: absolute; inset: 0;
  background: var(--hero-scrim), var(--hero-fade);
}

/* Sans affiche, la banniere serait un grand aplat vide : on la remplit d'une
   lueur coloree et d'une trame discrete plutot que de laisser un trou. */
.hero-slide.no-poster {
  min-height: 46vh;
  background-image:
    radial-gradient(680px 320px at 12% 18%, var(--accent-soft), transparent 70%),
    radial-gradient(520px 300px at 78% 8%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 72%),
    repeating-linear-gradient(115deg, transparent 0 22px, color-mix(in srgb, var(--text) 3%, transparent) 22px 23px);
}
.hero-inner { position: relative; z-index: 1; max-width: 620px; }
.hero-meta {
  display: flex; align-items: center; gap: 9px;
  color: var(--text-muted);
  font-size: 13px; font-weight: 500;
  text-transform: uppercase; letter-spacing: .09em;
  margin-bottom: 12px;
}
.hero-slide h1 { font-size: clamp(32px, 5.4vw, 82px); margin: 0 0 14px; font-weight: 800; }
.hero-slide p {
  color: var(--text-muted);
  font-size: 17px;
  margin: 0 0 26px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; gap: 11px; flex-wrap: wrap; align-items: center; }

/* Le bouton principal du héros est une pastille, plus marquée que les autres. */
.hero-actions .btn-primary {
  border-radius: 99px;
  padding: 12px 26px;
  font-size: 15px;
}

/* Les boutons d'icône vivent dans un cadre commun, separes d'un trait. */
.groupe-icones {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
}
.groupe-icones .btn-icone {
  border: 0;
  border-radius: 0;
  background: none;
}
.groupe-icones .btn-icone + .btn-icone { border-left: 1px solid var(--line); }

/* Mention de langue : discrete, en majuscules, sous le titre. */
.langue {
  display: inline-block;
  margin-top: 5px;
  color: var(--text-faint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.ep-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.btn-icone {
  width: 44px;
  padding: 0;
  display: grid; place-items: center;
}
.btn-icone.on { color: var(--accent); border-color: var(--accent); }
.btn-icone.on svg { fill: currentColor; }

/* --------------------------------- rangées --------------------------------- */

.row { padding: 0 4vw; margin-bottom: 52px; }
.row-head { display: flex; align-items: center; gap: 11px; margin-bottom: 4px; }
.row-head h2 { font-size: 23px; margin: 0; font-weight: 700; }
.row-head h2 a { color: inherit; text-decoration: none; }
.row-head h2 a:hover { color: var(--accent); }
.row-count { color: var(--text-faint); font-size: 13px; font-weight: 500; }

/* Barre verticale d'accent devant le titre de chaque rangee. */
.row-head::before {
  content: '';
  flex: none;
  width: 4px; height: 21px;
  border-radius: 2px;
  background: var(--accent);
}
.row-sub { color: var(--text-muted); font-size: 14px; margin: 0 0 16px; }

.row-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(190px, calc((92vw - 5.15 * 18px) / 6.15), 560px);
  gap: 18px;
  overflow-x: auto;
  padding: 4px 4px 16px;
  margin: -4px -4px -16px;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.row-scroll > * { scroll-snap-align: start; }
.row-scroll::-webkit-scrollbar { height: 8px; }
.row-scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }
.row-scroll::-webkit-scrollbar-thumb:hover { background: var(--line-strong); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 18px;
}

/* --------------------------------- cartes ---------------------------------- */

.card {
  position: relative;
  background: none;
  border: 0;
  border-radius: 0;
  cursor: pointer;
  transition: transform var(--normal) var(--ease);
}
.card:hover, .card:focus-visible { transform: translateY(-6px); }
/* L'affiche porte le relief, pas la carte : c'est elle qu'on voit. */
.card .card-img {
  border-radius: var(--radius-media);
  overflow: hidden;
  transition: box-shadow var(--normal) var(--ease);
}
.card:hover .card-img { box-shadow: var(--shadow); }

.card-img {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--bg-hover);
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  color: var(--text-faint);
}
.card-img::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(0deg, rgba(0,0,0,.5), transparent 44%);
  opacity: 0;
  transition: opacity var(--normal) var(--ease);
}
.card:hover .card-img::after { opacity: 1; }

.card-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(.8);
  transition: opacity var(--normal) var(--ease), transform var(--normal) var(--ease);
  z-index: 1;
}
.card:hover .card-play { opacity: 1; transform: none; }
.card-play span {
  display: grid; place-items: center;
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 20px rgba(0,0,0,.45);
}

.card-body { padding: 11px 12px 13px; }
.card-title {
  font-size: 14px; font-weight: 600;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.card-fav {
  position: absolute;
  top: 8px; right: 8px;
  z-index: 2;
  width: 32px; height: 32px;
  border-radius: 10px;
  border: 0;
  display: grid; place-items: center;
  background: rgba(0, 0, 0, .55);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  backdrop-filter: blur(4px);
  transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease), color var(--fast) var(--ease);
}
.card:hover .card-fav, .card-fav:focus-visible, .card-fav.on { opacity: 1; }
.card-fav:hover { transform: scale(1.12); }
.card-fav.on { color: var(--accent-hover); }
.card-fav.on .icon { fill: currentColor; }

/* -------------------------------- squelettes ------------------------------- */

.skeleton {
  border-radius: var(--radius);
  background: var(--skeleton);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
.skeleton-card { aspect-ratio: 2 / 3.35; }

/* --------------------------------- badges ---------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--bg-hover);
  color: var(--text-muted);
  white-space: nowrap;
}
.badge.admin  { background: var(--accent-soft); color: var(--accent-hover); }
.badge.ban    { background: var(--warn-soft);   color: var(--warn); }
.badge.ok     { background: var(--ok-soft);     color: var(--ok); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }

/* ------------------------------ champs de saisie --------------------------- */

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-muted); margin-bottom: 7px; }

input, select, textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
:root[data-theme='light'] input,
:root[data-theme='light'] select,
:root[data-theme='light'] textarea { background: var(--bg-elev); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { resize: vertical; min-height: 84px; line-height: 1.5; }

.hint { display: block; color: var(--text-muted); font-size: 12px; margin-top: 7px; line-height: 1.5; }

.search-wrap { position: relative; flex: 1; max-width: 340px; }
.search-wrap .icon {
  position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-faint);
  pointer-events: none;
}
.search-wrap input { padding-left: 38px; }

/* --------------------------- messages et états ----------------------------- */

.msg {
  padding: 11px 13px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  animation: fade-up var(--fast) var(--ease) both;
}
.msg.show { display: block; }
.msg.error   { background: var(--danger-soft); color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent); }
.msg.success { background: var(--ok-soft);     color: var(--ok);     border: 1px solid color-mix(in srgb, var(--ok) 30%, transparent); }
.msg.warn    { background: var(--warn-soft);   color: var(--warn);   border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }

.empty {
  color: var(--text-muted);
  padding: 70px 4vw;
  text-align: center;
  animation: fade-up var(--slow) var(--ease) both;
}
.empty .icon { width: 42px; height: 42px; color: var(--text-faint); margin: 0 auto 16px; }
.empty h2 { color: var(--text); font-size: 20px; margin: 0 0 8px; }
.empty p { margin: 0 0 20px; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ------------------------------ authentification --------------------------- */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 480px at 50% -8%, var(--accent-soft), transparent 62%),
    var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 410px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 38px 34px;
  box-shadow: var(--shadow);
  animation: pop-in var(--slow) var(--ease) both;
}
.auth-card h1 {
  margin: 0 0 6px;
  font-family: 'Bebas Neue', 'Inter', sans-serif;
  font-weight: 400;
  font-size: 42px;
  line-height: 1;
  letter-spacing: .07em;
  color: var(--accent);
}
.auth-card .sub { color: var(--text-muted); font-size: 14px; margin: 0 0 26px; }
.switch-line { text-align: center; font-size: 13px; color: var(--text-muted); margin-top: 20px; }
.switch-line a { color: var(--text); font-weight: 600; }
.switch-line a:hover { color: var(--accent); }

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

.player-wrap { max-width: 1120px; margin: 0 auto; padding: 26px 4vw 70px; animation: fade-up var(--normal) var(--ease) both; }
.player {
  aspect-ratio: 16 / 9;
  width: 100%;
  /* Le contenu est positionne en absolu plutot que dimensionne en pourcentage :
     une hauteur en % doit se resoudre contre une hauteur definie, et Safari ne
     la deduit pas toujours d'aspect-ratio. Le lecteur demarrait alors dans une
     boite de hauteur nulle et abandonnait. */
  position: relative;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.player iframe, .player video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.player-meta { margin-top: 26px; }
.player-meta h1 { margin: 0 0 8px; font-size: 30px; font-weight: 700; }
.player-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.player-desc { color: var(--text-muted); line-height: 1.65; margin-top: 14px; max-width: 70ch; }

/* --------------------------- fichiers et pièces jointes -------------------- */

.files { margin: 30px 0; }
.files h2 { font-size: 18px; margin: 0 0 13px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 15px;
  margin-bottom: 9px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease);
}
a.file-row:hover { background: var(--bg-hover); border-color: var(--line-strong); transform: translateX(3px); }
.file-row .icon { color: var(--accent); }
.file-name { flex: 1; font-weight: 600; word-break: break-word; }
.file-size { color: var(--text-muted); font-size: 12px; white-space: nowrap; }

.poster-preview {
  width: 116px;
  aspect-ratio: 2 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  display: grid;
  place-items: center;
  overflow: hidden;
  margin-bottom: 11px;
}
.poster-preview img { width: 100%; height: 100%; object-fit: cover; }

input[type='file'] { padding: 9px; font-size: 13px; cursor: pointer; }
input[type='file']::file-selector-button {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 7px 13px;
  margin-right: 11px;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
}
input[type='file']::file-selector-button:hover { border-color: var(--line-strong); }

/* --------------------------------- page jeu -------------------------------- */

.game-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 34px 4vw 70px;
  display: grid;
  grid-template-columns: 250px 1fr;
  gap: 38px;
  align-items: start;
  animation: fade-up var(--normal) var(--ease) both;
}
.game-cover {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.game-cover.placeholder { display: grid; place-items: center; background: var(--bg-hover); color: var(--text-faint); }
.game-cover.placeholder .icon { width: 54px; height: 54px; }
.game-info h1 { margin: 8px 0 12px; font-size: 32px; font-weight: 700; }
.game-desc { color: var(--text-muted); line-height: 1.65; }

/* ------------------------------ boîte à idées ------------------------------ */

.page { max-width: 940px; margin: 0 auto; padding: 30px 4vw 70px; animation: fade-up var(--normal) var(--ease) both; }
.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 32px; margin: 0 0 8px; font-weight: 800; }
.page-head p { color: var(--text-muted); margin: 0; max-width: 62ch; }

.idea-form {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 30px;
}
.idea-form .row-inline { display: flex; gap: 12px; flex-wrap: wrap; }
.idea-form .row-inline .field { flex: 1; min-width: 160px; margin-bottom: 0; }

.filters { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--bg-elev);
  color: var(--text-muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--fast) var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.idea {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  padding: 17px;
  margin-bottom: 11px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.idea:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.idea.refuse { opacity: .58; }

.vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 52px;
  padding: 7px 4px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font: inherit;
  transition: all var(--fast) var(--ease);
}
.vote:hover { border-color: var(--accent); color: var(--accent); }
.vote.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-hover); }
.vote.on .icon { fill: currentColor; }
.vote b { font-size: 16px; font-weight: 700; line-height: 1.1; }
.vote small { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }

.idea-body { flex: 1; min-width: 0; }
.idea-title { font-weight: 600; font-size: 15px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.idea-note { color: var(--text-muted); font-size: 14px; margin-top: 6px; word-break: break-word; }
.idea-meta { color: var(--text-faint); font-size: 12px; margin-top: 9px; }
.idea-admin-note {
  margin-top: 10px; padding: 9px 12px;
  background: var(--bg); border-left: 2px solid var(--accent);
  border-radius: 0 7px 7px 0;
  font-size: 13px; color: var(--text-muted);
}
.idea-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }

/* ------------------------------ administration ----------------------------- */

.admin-wrap { padding: 0 4vw 70px; animation: fade-in var(--normal) var(--ease) both; }
.admin-wrap > h1 { margin: 24px 0; font-size: 30px; font-weight: 800; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; overflow-x: auto; }
.tab {
  padding: 12px 18px;
  color: var(--text-muted);
  cursor: pointer;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transition: color var(--fast) var(--ease);
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 13px; margin-bottom: 28px; }
.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 17px;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.stat:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.stat .n { font-size: 27px; font-weight: 700; letter-spacing: -.03em; }
.stat .l { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 800px; }
th, td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--line); }
th {
  background: var(--bg-elev);
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 700;
}
tbody tr { transition: background var(--fast) var(--ease); }
tbody tr:hover { background: var(--bg-elev); }
tbody tr:last-child td { border-bottom: 0; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.toolbar { display: flex; gap: 11px; margin-bottom: 18px; flex-wrap: wrap; align-items: center; }

.log-list { padding: 0; margin: 0; font-size: 13px; }
.log-list li {
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  list-style: none;
  color: var(--text-muted);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.log-list b { color: var(--text); }
.log-list time { margin-left: auto; color: var(--text-faint); font-variant-numeric: tabular-nums; }

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

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .7);
  display: none;
  place-items: center;
  z-index: 100;
  padding: 20px;
  backdrop-filter: blur(3px);
}
.modal-backdrop.show { display: grid; animation: fade-in var(--fast) var(--ease) both; }
.modal {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 28px;
  width: 100%;
  max-width: 470px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  animation: pop-in var(--normal) var(--ease) both;
}
.modal h3 { margin: 0 0 20px; font-size: 20px; font-weight: 700; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; flex-wrap: wrap; }

.credential-box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 15px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  word-break: break-all;
  margin: 14px 0;
  color: var(--ok);
}

/* --------------------------------- responsive ------------------------------ */

@media (max-width: 900px) {
  .game-wrap { grid-template-columns: 1fr; gap: 24px; }
  .game-cover { max-width: 200px; }
}

@media (max-width: 680px) {
  /* La barre passe sur deux lignes : logo et commandes en haut, les liens en
     dessous sur une rangée qui défile.
     Ils étaient simplement masqués sous cette largeur, sans rien pour les
     remplacer : Films, Séries, Jeux, la boîte à idées et l'historique
     devenaient inatteignables depuis un téléphone. */
  .nav { gap: 12px 14px; padding: 12px 4vw; flex-wrap: wrap; }
  .nav-spacer { display: none; }
  .nav-right { margin-left: auto; }

  .nav-links {
    order: 3;
    width: 100%;
    gap: 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Les liens débordent du padding horizontal pour que le défilement aille
       d'un bord à l'autre, sans donner l'impression d'être coupé. */
    margin: 0 -4vw;
    padding: 0 4vw 2px;
  }
  .nav-links::-webkit-scrollbar { display: none; }
  .nav-links a { white-space: nowrap; padding: 6px 10px; }
  .hero { min-height: 54vh; padding-top: 110px; }
  .row-scroll { grid-auto-columns: calc((92vw - 1.5 * 12px) / 2.5); gap: 12px; }
  .row-scroll-paysage { grid-auto-columns: calc((92vw - 0.35 * 12px) / 1.35); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 13px; }
  .auth-card { padding: 30px 22px; }
  .idea { flex-direction: column; }
  .idea-actions { width: 100%; }
  .page-head h1, .admin-wrap > h1 { font-size: 25px; }
  /* Le survol n'existe pas au doigt : les commandes restent visibles. */
  .card-fav { opacity: 1; }
}

/* ------------------------------ fiche de lecture --------------------------- */

.watch-wrap {
  padding: 24px 4vw 80px;
  animation: fade-up var(--normal) var(--ease) both;
}

/* Le texte reste dans une colonne lisible : une description etalee sur deux
   metres de large ne se lit pas. Seules les grilles prennent toute la place. */
.watch-head, .player, .player-fallback, #episodeSocial, .ep-nav, #seenHint,
.watch-wrap > .section:not(.section-large) {
  max-width: 1120px;
  margin-left: auto;
  margin-right: auto;
}

.player-empty {
  display: grid;
  place-items: center;
  gap: 12px;
  background: var(--bg-elev);
  color: var(--text-muted);
  text-align: center;
}
.player-empty p { margin: 0; }

.watch-head {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 30px;
  margin: 30px 0 8px;
  align-items: start;
}
.watch-poster {
  aspect-ratio: 2 / 3;
  border-radius: var(--radius-lg);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.watch-poster.placeholder {
  display: grid;
  place-items: center;
  background: var(--bg-hover);
  color: var(--text-faint);
}
.watch-meta h1 { margin: 6px 0 10px; font-size: clamp(26px, 3.4vw, 36px); font-weight: 800; }

.now-playing {
  display: flex; align-items: center; gap: 9px;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  margin-bottom: 12px; min-height: 0;
}
.now-playing:empty { display: none; }

/* Fiche technique : deux colonnes qui se replient sur mobile. */
.info {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px 24px;
  margin: 26px 0 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.info div { min-width: 0; }
.info dt {
  font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-faint); font-weight: 700; margin-bottom: 3px;
}
.info dd { margin: 0; font-size: 15px; font-weight: 500; }

.section { margin-top: 44px; }
.section > h2 {
  font-size: 20px; margin: 0 0 16px; font-weight: 700;
  display: flex; align-items: center; gap: 10px;
}

/* --------------------------------- épisodes -------------------------------- */

.season { display: grid; gap: 9px; }

.ep {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  padding: 13px 15px;
  text-align: left;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease);
}
.ep:hover { background: var(--bg-hover); border-color: var(--line-strong); transform: translateX(3px); }
.ep.on { border-color: var(--accent); background: var(--accent-soft); }

.ep-num {
  flex: none;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 700; font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.ep.on .ep-num { background: var(--accent); color: var(--on-accent); }

.ep-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ep-title { font-weight: 600; font-size: 15px; }
.ep-synopsis {
  color: var(--text-muted); font-size: 13px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ep-play { flex: none; color: var(--text-faint); }
.ep:hover .ep-play, .ep.on .ep-play { color: var(--accent); }

/* Ligne d'épisode dans le panneau d'administration. */
.ep-admin {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 13px; margin-bottom: 8px;
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 14px;
}
.ep-admin .badge { font-variant-numeric: tabular-nums; }
.ep-admin .grow { flex: 1; min-width: 0; }
.ep-admin .missing { color: var(--warn); font-size: 12px; }

@media (max-width: 760px) {
  .watch-head { grid-template-columns: 1fr; gap: 20px; }
  .watch-poster { max-width: 160px; }
}

/* ------------------------- suivi de visionnage ----------------------------- */

.chip-count {
  margin-left: 7px;
  padding: 1px 6px;
  border-radius: 99px;
  background: color-mix(in srgb, currentColor 14%, transparent);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

/* Un episode : le corps ouvre le lecteur, le bouton a droite bascule « vu ». */
.ep { display: flex; align-items: stretch; gap: 0; }

.ep-open {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: 13px 15px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.ep-seen {
  flex: none;
  width: 46px;
  border: 0;
  border-left: 1px solid var(--line);
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: color var(--fast) var(--ease), background var(--fast) var(--ease);
}
.ep-seen:hover { color: var(--text); background: var(--bg-hover); }
.ep.seen .ep-seen { color: var(--ok); }
.ep.seen .ep-title { color: var(--text-muted); }
.ep.seen .ep-num {
  background: color-mix(in srgb, var(--ok) 18%, transparent);
  color: var(--ok);
}

.ep-nav {
  display: flex;
  gap: 9px;
  justify-content: flex-end;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* Pastille de progression sur les cartes du catalogue. */
.card-seen {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  min-width: 26px; height: 26px;
  padding: 0 7px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--ok) 88%, black);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.card-seen.partial { background: color-mix(in srgb, var(--accent) 88%, black); }

/* Barre de progression au bas de l'affiche, rangee « Reprendre ». */
.resume-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 4px;
  background: rgba(255, 255, 255, .22);
  z-index: 2;
}
.resume-bar span { display: block; height: 100%; background: var(--accent); }

/* Le bouton « vu » d'un episode porte desormais un libelle : une coche seule
   passait inapercue, et on ne devinait pas qu'elle etait cliquable. */
.ep-seen {
  width: auto;
  min-width: 74px;
  padding: 0 12px;
  gap: 6px;
  flex-direction: column;
  font-size: 10px;
  font-weight: 600;
}
.ep-seen-label { text-transform: uppercase; letter-spacing: .05em; }
.ep.seen .ep-seen { background: color-mix(in srgb, var(--ok) 10%, transparent); }

#seenHint { max-width: 70ch; margin: 8px 0 0; }

/* ------------------------ profil, photo et historique ---------------------- */

.profile { position: relative; }

.avatar {
  width: 34px; height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  background: none;
  display: grid;
  place-items: center;
  flex: none;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.avatar:hover { border-color: var(--line-strong); }
.avatar:active { transform: scale(.94); }

.avatar-img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initial {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  background: linear-gradient(140deg, var(--accent), #7a0610);
  color: #fff; font-weight: 700; font-size: 14px;
}

.menu {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  min-width: 232px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 7px;
  z-index: 70;
  animation: pop-in var(--fast) var(--ease) both;
}
.menu-head {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 6px;
}
.menu-head b { display: block; font-size: 14px; }
.menu-head small { color: var(--text-muted); font-size: 12px; word-break: break-all; }
.menu-avatar { width: 38px; height: 38px; border-radius: var(--radius); flex: none; }

.menu-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%;
  padding: 10px 11px;
  border: 0; border-radius: 10px;
  background: none;
  color: var(--text);
  font: inherit; font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}
.menu-item:hover { background: var(--bg-hover); }
.menu-item.danger { color: var(--danger); }

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 11px;
}
.avatar-choice {
  aspect-ratio: 1;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  background: none;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.avatar-choice:hover { transform: scale(1.06); border-color: var(--line-strong); }
.avatar-choice.on { border-color: var(--accent); }
.avatar-choice img { width: 100%; height: 100%; object-fit: cover; display: block; }

.hist {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 14px;
  margin-bottom: 9px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color var(--fast) var(--ease);
}
.hist:hover { border-color: var(--line-strong); }
.hist-main { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.hist-poster {
  width: 44px; height: 62px;
  border-radius: 8px;
  background: var(--bg-hover);
  background-size: cover; background-position: center;
  flex: none;
  display: grid; place-items: center;
  color: var(--text-faint);
}
.hist-body { min-width: 0; }
.hist-title { display: block; font-weight: 600; font-size: 14px; }
.hist-sub { display: block; color: var(--text-muted); font-size: 13px; margin-top: 3px; }
.hist-when {
  color: var(--text-faint);
  font-size: 12px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 620px) {
  .hist { flex-wrap: wrap; }
  .hist-when { order: 3; margin-left: 58px; }
}

/* ------------------- edition d'un episode dans l'administration ------------ */

.ep-admin { display: block; padding: 0; overflow: hidden; }
.ep-admin-head { display: flex; align-items: stretch; }

.ep-admin-open {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 11px 13px;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background var(--fast) var(--ease);
}
.ep-admin-open:hover { background: var(--bg-hover); }
.ep-admin-open .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ep-admin-chevron {
  color: var(--text-faint);
  display: grid;
  place-items: center;
  transform: rotate(180deg);
  transition: transform var(--normal) var(--ease);
}
.ep-admin-open[aria-expanded='true'] .ep-admin-chevron { transform: none; }

.ep-admin-edit {
  padding: 4px 13px 15px;
  border-top: 1px solid var(--line);
  animation: fade-up var(--fast) var(--ease) both;
}
.ep-admin-edit textarea {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px;
}

.missing { color: var(--warn); font-size: 12px; }

.avatar-admin { position: relative; aspect-ratio: 1; }
.avatar-admin img {
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.avatar-admin .icon-btn {
  position: absolute;
  top: 5px; right: 5px;
  width: 28px; height: 28px;
  background: rgba(0, 0, 0, .6);
  border-color: transparent;
  color: #fff;
}
.avatar-admin .icon-btn:hover { background: var(--danger); }

/* Vignette d'affiche dans le tableau du contenu. */
.cell-poster {
  display: block;
  width: 34px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--bg-hover);
}
.cell-poster.placeholder { background: var(--bg-hover); }

/* Barre d'action au sommet d'une saison. */
.season-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.season-bar .hint { margin: 0; }

/* Lien de secours sous le lecteur : Safari iOS prive parfois un lecteur tiers
   de son stockage et il reste noir dans le cadre. */
.player-fallback {
  margin: 9px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}
.player-fallback a { color: var(--accent); }

/* Sélecteur de lecteur, au-dessus de la vidéo. */
#sourceTabs { margin-bottom: 10px; }
#sourceTabs:empty { display: none; }

/* Avancement du remplissage des lecteurs, dans le tableau du contenu. */
.fill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.fill.ok      { background: color-mix(in srgb, var(--ok) 18%, transparent);     color: var(--ok); }
.fill.partiel { background: color-mix(in srgb, var(--warn) 18%, transparent);   color: var(--warn); }
.fill.vide    { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }

/* Invisible à l'œil mais toujours rendu, contrairement à display:none.
   Un champ de fichier en display:none n'ouvre pas le sélecteur quand on clique
   son étiquette, en particulier sur iOS : le bouton ne faisait rien. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Suppression d'une photo : confirmation en deux temps, dans la page. */
.avatar-admin .icon-btn.confirmer {
  width: auto;
  padding: 0 10px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* -------------------------- notes et commentaires -------------------------- */

/* L'etoile des administrateurs, partout ou un pseudo s'affiche. */
.admin-star {
  color: var(--accent);
  font-size: 0.85em;
  vertical-align: 1px;
}

#episodeSocial {
  display: grid;
  gap: 18px;
  margin: 22px 0 6px;
}

.note-bloc {
  padding: 16px 18px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.note-tete {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.note-tete h3 { margin: 0; font-size: 15px; }
.note-moyenne { font-size: 14px; font-variant-numeric: tabular-nums; }
.note-moyenne b { color: var(--accent); font-size: 18px; }

/* Dix boutons qui doivent tenir sur une ligne d'ecran de telephone :
   ils se partagent la largeur au lieu d'avoir une taille fixe. */
.note-echelle { display: flex; gap: 6px; }
.note-echelle.occupe { opacity: 0.5; pointer-events: none; }

.note-btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 9px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text-muted);
  font: inherit;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease),
              border-color var(--fast) var(--ease);
}
.note-btn:hover { border-color: var(--accent); color: var(--text); }
.note-btn.on {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
#noteRetirer { margin-top: 10px; }

.commentaires h3 { margin: 0 0 12px; font-size: 15px; }

#comForm { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
#comBody {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
#comBody:focus { outline: none; border-color: var(--accent); }

/* La photo a gauche, le message a droite. */
.commentaire {
  display: flex;
  gap: 11px;
  padding: 12px 14px;
  margin-bottom: 9px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.commentaire-corps { flex: 1; min-width: 0; }

.com-avatar {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  object-fit: cover;
}
/* Sans photo choisie : l'initiale, dans le meme gabarit rond. */
span.com-avatar {
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700; font-size: 15px;
}

.commentaire-tete {
  display: flex; align-items: center; gap: 9px;
  margin-bottom: 5px; font-size: 13px;
}
.commentaire-tete time { color: var(--text-faint); }
/* Le bouton de suppression se pousse a droite sans marge codee en dur. */
.commentaire-tete .icon-btn { margin-left: auto; width: 28px; height: 28px; }
.commentaire p { margin: 0; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

.commentaire-actions {
  display: flex; align-items: center; gap: 14px;
  margin-top: 7px;
}
.com-like, .com-lien {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0;
  border: 0; background: none;
  color: var(--text-faint);
  font: inherit; font-size: 13px;
  cursor: pointer;
  transition: color var(--fast) var(--ease);
}
.com-like:hover, .com-lien:hover { color: var(--text); }
.com-like svg { width: 15px; height: 15px; }
.com-like.on { color: var(--accent); }
.com-like.on svg { fill: currentColor; }
.com-like-n { font-variant-numeric: tabular-nums; }

/* Un seul niveau de reponses : un liseré suffit à montrer le rattachement,
   sans empiler les décalages. */
.com-reponses:not(:empty) {
  margin-top: 10px;
  padding-left: 12px;
  border-left: 2px solid var(--line);
}
.commentaire.reponse {
  padding: 10px 12px;
  background: var(--bg);
}
.commentaire.reponse .com-avatar { width: 28px; height: 28px; font-size: 13px; }

.reponse-form { margin-top: 8px; }
.reponse-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
.reponse-form textarea:focus { outline: none; border-color: var(--accent); }
.reponse-actions { display: flex; gap: 8px; margin-top: 7px; }

/* Pastilles de la liste des episodes : moyenne et nombre d'avis. */
.ep-note { flex: none; display: flex; gap: 8px; align-items: center; font-size: 12px; }
.ep-score {
  padding: 2px 7px; border-radius: 99px;
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.ep-coms { display: inline-flex; align-items: center; gap: 3px; color: var(--text-faint); }
.ep-coms svg { width: 13px; height: 13px; }

@media (max-width: 520px) {
  .note-echelle { flex-wrap: wrap; }
  .note-btn { flex: 1 1 17%; }
  #comForm { flex-direction: column; align-items: stretch; }
}

/* ====================== carrousel, genres, vignettes ======================== */

/* Flèches du carrousel : discrètes au repos, franches au survol. */
.hero-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 42px; height: 42px;
  display: grid; place-items: center;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 50%;
  background: color-mix(in srgb, var(--bg) 62%, transparent);
  color: var(--text);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease),
              opacity var(--fast) var(--ease);
  opacity: .55;
}
.hero:hover .hero-arrow, .hero-arrow:focus-visible { opacity: 1; }
.hero-arrow:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.hero-arrow.prev { left: 2vw; }
.hero-arrow.next { right: 2vw; }
/* La même icône sert aux deux sens : la flèche « suivant » est retournée. */
.hero-arrow.next svg { transform: scaleX(-1); }

/* Carte « Reprendre » : format paysage, c'est l'image de l'épisode. */
/* Les cartes « Reprendre » sont en paysage : elles ont besoin de colonnes plus
   larges que les affiches. C'est la rangee qui les dimensionne — une largeur
   posee sur la carte elle-meme deborde de la colonne et chevauche la voisine. */
.row-scroll-paysage {
  grid-auto-columns: clamp(240px, calc((92vw - 3.3 * 18px) / 4.3), 520px);
}
.resume-img {
  position: relative;
  aspect-ratio: 16 / 9;
  display: grid; place-items: center;
  border-radius: var(--radius-media);
  background: var(--bg-card) center / cover no-repeat;
  color: var(--text-faint);
  overflow: hidden;
}
.resume-serie {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 3px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.resume-ep {
  font-weight: 600; font-size: 15px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* Grille des épisodes : l'image d'abord, le titre dessous. */
/* Six par ligne sur ordinateur, comme demande. En dessous on reduit le nombre
   de colonnes plutot que la taille des cartes, qui deviendraient illisibles. */
.ep-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 24px 18px;
}
@media (max-width: 1250px) { .ep-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 900px)  { .ep-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px)  { .ep-grid { grid-template-columns: repeat(2, 1fr); gap: 16px 12px; } }

/* Titre des episodes, puis les outils a droite. */
.ep-tete {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  margin-bottom: 18px;
}
.ep-tete h2 { margin: 0; }

.ep-outils { display: flex; align-items: center; gap: 10px; }

/* La fleche est dessinee par-dessus : le chevron natif differe d'un
   navigateur a l'autre et jure avec le reste. */
.ep-select-wrap { position: relative; display: flex; align-items: center; }
.ep-select-wrap select {
  appearance: none;
  min-width: 220px;
  padding: 10px 40px 10px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ep-select-wrap select:hover { border-color: var(--line-strong); }
.ep-select-wrap select:focus { outline: none; border-color: var(--accent); }
.ep-select-wrap svg {
  position: absolute; right: 13px;
  pointer-events: none;
  color: var(--text-muted);
  width: 17px; height: 17px;
}

#epSens {
  width: 42px; height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
#epSens:hover { border-color: var(--line-strong); }
#epSens.on { border-color: var(--accent); color: var(--accent); }

/* La carte remplace l'ancienne ligne : les règles de liste ne s'appliquent
   plus, on repart d'une colonne image + légende. */
.ep-grid .ep {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
}
.ep-grid .ep:hover { background: none; border: 0; transform: none; }

.ep-grid .ep-open {
  flex: 1;
  display: block;
  padding: 0;
  gap: 0;
}

.ep-vignette {
  position: relative;
  display: grid; place-items: center;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-media);
  border: 1px solid var(--line);
  background: var(--bg-card) center / cover no-repeat;
  color: var(--text-faint);
  overflow: hidden;
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.ep-grid .ep:hover .ep-vignette { border-color: var(--accent); transform: translateY(-3px); }
.ep-grid .ep.on .ep-vignette { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.ep-grid .ep.seen .ep-vignette { opacity: .55; }

/* Sans image, la vignette serait un rectangle presque noir. Une lueur et une
   trame valent mieux qu'un trou : on voit qu'il manque l'image, pas que le
   lecteur est casse. */
.ep-vignette.vide {
  background-image:
    radial-gradient(150% 100% at 50% 0%, var(--accent-soft), transparent 62%),
    repeating-linear-gradient(115deg, transparent 0 14px,
      color-mix(in srgb, var(--text) 3%, transparent) 14px 15px);
}
.ep-vide { color: var(--text-faint); }

/* Le bouton de lecture n'apparait qu'au survol, pour ne pas masquer l'image. */
.ep-grid .ep-play {
  position: absolute;
  inset: 0;
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 45%, transparent);
  color: var(--text);
  opacity: 0;
  transition: opacity var(--fast) var(--ease);
}
.ep-grid .ep:hover .ep-play, .ep-grid .ep-open:focus-visible .ep-play { opacity: 1; }

.ep-vu {
  position: absolute;
  top: 8px; right: 8px;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
}
.ep-vu svg { width: 14px; height: 14px; }

.ep-legende {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 9px 2px 0;
}
.ep-grid .ep-title {
  flex: 1;
  font-weight: 600; font-size: 14px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.ep-grid .ep-note { flex: none; padding-top: 1px; }

/* Le bouton « vu » passe sous la légende, en pleine largeur. */
.ep-grid .ep-seen {
  width: 100%;
  margin-top: 7px;
  padding: 5px 0;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 10px;
  font-size: 12px;
}
.ep-grid .ep.seen .ep-seen { border-color: var(--accent); color: var(--accent); }
.ep-grid .ep-seen svg { width: 14px; height: 14px; }

@media (max-width: 560px) {
  .hero-arrow { display: none; }
}

/* ============================ héros, mise en page ========================== */

/* Affiche à gauche, texte à droite, bandeau de vignettes dessous. */
.hero-body {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  gap: 36px;
  width: 100%;
}

.hero-affiche {
  flex: none;
  width: clamp(150px, 14vw, 340px);
  aspect-ratio: 2 / 3;
  border-radius: calc(var(--radius-media) + 4px);
  border: 1px solid var(--line-strong);
  background: var(--bg-card) center / cover no-repeat;
  box-shadow: var(--shadow);
}

/* Compteur « 01 / 06 », précédé d'un tiret comme repère visuel. */
.hero-compteur {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-muted);
  font-size: 13px; font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: .12em;
  margin-bottom: 14px;
}
.hero-compteur::before {
  content: '';
  width: 34px; height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

.hero-badge {
  display: inline-block;
  padding: 4px 11px;
  margin: 0 7px 16px 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg) 55%, transparent);
  color: var(--text-muted);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .11em;
}

/* Bandeau de vignettes : il sert de navigation dans le carrousel. */
.hero-vignettes {
  display: flex; gap: 10px;
  margin-top: 26px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: none;
}
.hero-vignettes::-webkit-scrollbar { display: none; }

.hero-vignette {
  flex: none;
  width: clamp(48px, 4.2vw, 104px);
  aspect-ratio: 2 / 3;
  padding: 0;
  border: 2px solid transparent;
  border-radius: calc(var(--radius-media) - 4px);
  background: var(--bg-card) center / cover no-repeat;
  cursor: pointer;
  opacity: .5;
  transition: opacity var(--fast) var(--ease), border-color var(--fast) var(--ease),
              transform var(--fast) var(--ease);
}
.hero-vignette:hover { opacity: .85; transform: translateY(-2px); }
.hero-vignette.on { opacity: 1; border-color: var(--accent); }

@media (max-width: 900px) {
  .hero-affiche { display: none; }
  .hero-body { gap: 0; }
}
@media (max-width: 560px) {
  .hero-vignette { width: 46px; }
  .hero-compteur { margin-bottom: 10px; }
}

/* Aperçu de l'image d'un épisode, dans l'éditeur d'administration. */
.ep-apercu {
  display: block;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  margin-bottom: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-media);
}

/* ========================= recherche en surimpression ====================== */

/* Declencheur dans la barre : une pastille large, reduite a son icone quand la
   place manque. */
.nav-search {
  display: inline-flex; align-items: center; gap: 9px;
  min-width: 210px;
  padding: 8px 13px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg-elev);
  color: var(--text-faint);
  font: inherit; font-size: 13px;
  cursor: pointer;
  transition: border-color var(--fast) var(--ease), color var(--fast) var(--ease);
}
.nav-search:hover { border-color: var(--line-strong); color: var(--text-muted); }
.nav-search svg { width: 16px; height: 16px; flex: none; }
.nav-search span { flex: 1; text-align: left; }
.nav-search kbd {
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  font: inherit; font-size: 11px;
  color: var(--text-faint);
}

#rechercheBoite {
  position: fixed; inset: 0;
  z-index: 90;
  display: grid;
  place-items: start center;
  padding: 14vh 20px 20px;
}

/* Le fond assombri et floute : la page reste visible derriere, en retrait. */
.recherche-fond {
  position: fixed; inset: 0;
  background: color-mix(in srgb, #000 66%, transparent);
  backdrop-filter: blur(7px);
  animation: fade-in var(--fast) var(--ease) both;
}

.recherche-panneau {
  position: relative;
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: fade-up var(--fast) var(--ease) both;
}

.recherche-champ {
  display: flex; align-items: center; gap: 11px;
  padding: 6px 8px 6px 16px;
  border-bottom: 1px solid var(--line);
}
.recherche-champ > svg { width: 18px; height: 18px; color: var(--text-faint); flex: none; }
.recherche-champ input {
  flex: 1;
  min-height: 46px;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit; font-size: 16px;
}
.recherche-champ input:focus { outline: none; }
.recherche-champ input::-webkit-search-cancel-button { display: none; }

.recherche-liste { max-height: 46vh; overflow-y: auto; padding: 7px; }
.recherche-vide { color: var(--text-faint); font-size: 14px; padding: 20px 12px; margin: 0; text-align: center; }

.resultat {
  display: flex; align-items: center; gap: 13px;
  padding: 9px 11px;
  border-radius: var(--radius);
  color: inherit; text-decoration: none;
}
.resultat.on, .resultat:hover { background: var(--bg-hover); }
.resultat-img {
  flex: none;
  width: 44px; height: 62px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-faint);
  overflow: hidden;
}
.resultat-img img { width: 100%; height: 100%; object-fit: cover; }
.resultat-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.resultat-texte b { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.resultat-texte small { color: var(--text-muted); font-size: 13px; }
/* La fleche pointe vers la droite : le chevron descend par defaut. */
.resultat-fleche { flex: none; color: var(--text-faint); transform: rotate(-90deg); width: 17px; height: 17px; }
.resultat.on .resultat-fleche { color: var(--accent); }

.recherche-pied {
  padding: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.recherche-pied a { color: var(--accent); font-weight: 700; text-decoration: none; margin-left: 6px; }
.recherche-pied a:hover { text-decoration: underline; }

/* Pendant la recherche, la page derriere ne doit pas defiler. */
body.sans-defilement { overflow: hidden; }

@media (max-width: 900px) {
  .nav-search { min-width: 0; padding: 8px; }
  .nav-search span, .nav-search kbd { display: none; }
}

/* -------------------- discussion des agents, panneau admin ----------------- */

#agentsFil {
  max-height: 55vh;
  overflow-y: auto;
  margin-bottom: 14px;
  padding-right: 4px;
}

.msg-agent {
  padding: 12px 14px;
  margin-bottom: 9px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.msg-agent-tete {
  display: flex; align-items: baseline; gap: 10px;
  margin-bottom: 6px; font-size: 13px;
}
.msg-agent-tete b { color: var(--accent); }
.msg-agent-tete time { color: var(--text-faint); }
/* Les agents écrivent des messages multilignes : les retours comptent. */
.msg-agent p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#agentsForm { display: flex; gap: 10px; align-items: flex-end; }
#agentsForm textarea {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  color: var(--text);
  font: inherit;
  resize: vertical;
}
#agentsForm textarea:focus { outline: none; border-color: var(--accent); }
