/* ============================================================
   MES FILMS — interface streaming
   ============================================================ */

:root {
  --page: #050506;
  --page-2: #0b0d12;
  --panel: #12141b;
  --panel-2: #191c25;
  --line: rgba(255, 255, 255, 0.11);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f6f7fb;
  --muted: #a6abb8;
  --soft: #737987;
  --red: #e50914;
  --red-2: #ff3d47;
  --cyan: #2acfd6;
  --gold: #ffd166;
  --green: #39d98a;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.48);
  --header-h: 72px;
  --radius: 8px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
}

body {
  background:
    linear-gradient(180deg, rgba(229, 9, 20, 0.08), transparent 320px),
    linear-gradient(135deg, #050506 0%, #0b0d12 52%, #11121a 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.cache {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

i[data-lucide],
.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
  flex: 0 0 auto;
}

/* ============ CONNEXION ============ */

#ecran-connexion {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
  background: #030304;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(3, 3, 4, 0.92), rgba(3, 3, 4, 0.68) 42%, rgba(3, 3, 4, 0.94)),
    linear-gradient(180deg, transparent 0%, #030304 100%);
  opacity: 0.95;
}

.login-backdrop::before {
  content: "";
  position: absolute;
  inset: -24px;
  background-image: var(--login-image);
  background-size: cover;
  background-position: center;
  filter: blur(10px) saturate(1.2);
  transform: scale(1.04);
  opacity: 0.35;
}

#form-connexion {
  position: relative;
  z-index: 1;
  width: min(100%, 390px);
  display: grid;
  gap: 14px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 11, 15, 0.78);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.logo-mark,
.marque-logo {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 7px;
  background: linear-gradient(135deg, var(--red), #a20b12 58%, #222738);
  color: #fff;
  font-weight: 900;
  line-height: 1;
}

#form-connexion h1 {
  font-size: 32px;
  line-height: 1;
}

.sous-titre {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin-bottom: 4px;
}

.champ-secret,
.recherche {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.075);
  color: var(--muted);
}

.champ-secret {
  height: 48px;
  padding: 0 14px;
}

.champ-secret input,
.recherche input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.champ-secret input::placeholder,
.recherche input::placeholder {
  color: var(--soft);
}

.champ-secret:focus-within,
.recherche:focus-within,
#choix-tri:focus {
  border-color: rgba(42, 207, 214, 0.75);
  box-shadow: 0 0 0 3px rgba(42, 207, 214, 0.15);
}

.btn-principal,
.btn-hero-lire,
.btn-retour,
.btn-icone {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn-principal {
  height: 48px;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--red), var(--red-2));
  color: #fff;
  font-weight: 800;
}

.btn-principal:hover,
.btn-hero-lire:hover {
  transform: translateY(-1px);
}

.btn-principal:active,
.btn-hero-lire:active,
.btn-icone:active,
.btn-retour:active {
  transform: scale(0.98);
}

.erreur {
  min-height: 20px;
  color: #ff8b91;
  font-size: 13px;
}

/* ============ APP HEADER ============ */

#ecran-biblio {
  min-height: 100vh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--header-h);
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto minmax(280px, 1fr);
  align-items: center;
  gap: 18px;
  padding: 12px clamp(16px, 3vw, 44px);
  background: linear-gradient(180deg, rgba(5, 5, 6, 0.94), rgba(5, 5, 6, 0.74));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

.marque {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  font-size: 18px;
}

.marque span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-onglets {
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.onglet {
  min-width: 82px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
}

.onglet:hover {
  color: var(--text);
}

.onglet.actif {
  background: #fff;
  color: #08090d;
}

.outils {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.recherche {
  width: min(28vw, 330px);
  height: 40px;
  padding: 0 12px;
}

#choix-tri {
  height: 40px;
  max-width: 168px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
  padding: 0 10px;
  outline: 0;
  cursor: pointer;
}

#choix-tri option {
  background: #11131a;
  color: var(--text);
}

.btn-icone {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
}

.btn-icone:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: var(--line-strong);
}

/* ============ HERO ============ */

.hero-banner {
  position: relative;
  min-height: min(590px, calc(100vh - var(--header-h) - 96px));
  height: clamp(430px, 58vh, 620px);
  display: flex;
  align-items: flex-end;
  padding: clamp(26px, 5vw, 64px);
  overflow: hidden;
  isolation: isolate;
  background: #0b0c10;
}

.hero-backdrop,
.hero-poster {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 28%;
  transform: scale(1.02);
  transition: background-image 0.35s ease, opacity 0.25s ease;
  z-index: -3;
}

.hero-poster {
  inset: auto clamp(24px, 6vw, 80px) clamp(28px, 6vw, 70px) auto;
  width: min(24vw, 230px);
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.18);
  z-index: 1;
  opacity: 0.92;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 60px;
  font-weight: 950;
}

.hero-banner::before,
.hero-banner::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hero-banner::before {
  z-index: -2;
  background:
    linear-gradient(90deg, rgba(5, 5, 6, 0.98) 0%, rgba(5, 5, 6, 0.76) 34%, rgba(5, 5, 6, 0.18) 68%, rgba(5, 5, 6, 0.78) 100%),
    linear-gradient(180deg, rgba(5, 5, 6, 0.1) 0%, rgba(5, 5, 6, 0.28) 50%, #050506 100%);
}

.hero-banner::after {
  z-index: -1;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 5, 6, 0.92) 100%);
}

.hero-contenu {
  width: min(720px, calc(100% - 280px));
  display: grid;
  gap: 14px;
}

.hero-tag {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(229, 9, 20, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.hero-contenu h1 {
  max-width: 14ch;
  font-size: clamp(42px, 8vw, 88px);
  line-height: 0.95;
  letter-spacing: 0;
  text-wrap: balance;
  text-shadow: 0 16px 36px rgba(0, 0, 0, 0.58);
}

.hero-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.hero-meta span,
.meta-pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.hero-meta span:empty {
  display: none;
}

.hero-meta span:first-child:not(:empty) {
  color: #121212;
  background: var(--gold);
  border-color: transparent;
}

.hero-synopsis {
  max-width: 62ch;
  color: rgba(246, 247, 251, 0.8);
  font-size: 15px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-boutons {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.btn-hero-lire {
  min-width: 120px;
  height: 46px;
  border-radius: var(--radius);
  background: #fff;
  color: #08090d;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.38);
}

.btn-hero-lire:hover {
  background: #eceef4;
}

/* ============ CONTENU ============ */

main {
  width: 100%;
  padding: 18px clamp(16px, 3vw, 44px) 56px;
}

.ligne-biblio {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 28px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 10px;
}

#statut-biblio {
  color: var(--soft);
}

#grille {
  display: grid;
  gap: 28px;
}

.rail {
  min-width: 0;
}

.rail-entete {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 0 0 12px;
}

.rail-entete h2 {
  font-size: clamp(19px, 2.2vw, 25px);
  line-height: 1.1;
  letter-spacing: 0;
}

.rail-entete span {
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
}

.rail-liste {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(148px, 14vw, 206px);
  gap: 14px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 4px 18px;
  scroll-snap-type: x proximity;
  scrollbar-color: rgba(255, 255, 255, 0.26) transparent;
}

.rail-liste.large {
  grid-auto-columns: clamp(220px, 24vw, 360px);
}

.rail-grille {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.carte {
  position: relative;
  min-width: 0;
  width: 100%;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  overflow: hidden;
  cursor: pointer;
  scroll-snap-align: start;
  text-align: left;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.23);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.carte:hover,
.carte:focus-visible {
  transform: translateY(-6px);
  border-color: rgba(255, 255, 255, 0.24);
  box-shadow: var(--shadow);
  outline: 0;
}

.carte-panorama .affiche {
  aspect-ratio: 16 / 9;
}

.affiche {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: linear-gradient(145deg, #262a36, #101216);
}

.image-affiche {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.25s ease, filter 0.25s ease;
}

.carte:hover .image-affiche {
  transform: scale(1.045);
  filter: saturate(1.08);
}

.affiche::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 44%;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.78));
  opacity: 0.82;
}

.initiale {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.92);
  font-size: 58px;
  font-weight: 950;
}

.badge-ligne {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  backdrop-filter: blur(8px);
}

.badge.accent {
  color: #07110c;
  background: var(--green);
  border-color: transparent;
}

.badge.qualite {
  color: #041517;
  background: var(--cyan);
  border-color: transparent;
}

.play-flottant {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.95);
  color: #050506;
  transform: translateY(8px);
  opacity: 0;
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.carte:hover .play-flottant {
  transform: translateY(0);
  opacity: 1;
}

.barre-progression {
  position: absolute;
  left: 0;
  bottom: 0;
  z-index: 3;
  height: 4px;
  max-width: 100%;
  background: var(--red);
  box-shadow: 0 0 12px rgba(229, 9, 20, 0.62);
}

.infos {
  display: grid;
  gap: 5px;
  padding: 10px;
}

.infos .titre {
  min-height: 38px;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  line-height: 1.32;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.infos .detail {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ VIDE ============ */

#biblio-vide {
  width: min(100%, 620px);
  margin: 42px auto;
  padding: 38px 22px;
  text-align: center;
  color: var(--muted);
}

.vide-icone {
  width: 70px;
  height: 70px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
}

.vide-icone .lucide {
  width: 32px;
  height: 32px;
}

#texte-vide {
  color: var(--text);
  font-size: 20px;
  font-weight: 850;
}

#biblio-vide .detail {
  margin-top: 10px;
  color: var(--soft);
  font-size: 14px;
  line-height: 1.6;
}

#biblio-vide b {
  color: var(--text);
}

/* ============ MODALE SERIE ============ */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(12px);
}

.modal-contenu {
  position: relative;
  width: min(960px, 100%);
  max-height: min(86vh, 820px);
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #08090d;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.58);
}

.btn-fermer {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  background: rgba(0, 0, 0, 0.64);
}

.modal-hero {
  position: relative;
  min-height: 260px;
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 22px;
  align-items: end;
  padding: 36px 58px 24px 28px;
  overflow: hidden;
}

.modal-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: 0.42;
  filter: saturate(1.08);
}

.modal-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, #08090d 0%, rgba(8, 9, 13, 0.76) 45%, rgba(8, 9, 13, 0.52) 100%),
    linear-gradient(180deg, transparent, #08090d 92%);
}

.modal-poster {
  position: relative;
  z-index: 1;
  width: 160px;
  aspect-ratio: 2 / 3;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line-strong);
  color: rgba(255, 255, 255, 0.9);
  font-size: 44px;
  font-weight: 950;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

.modal-entete {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.modal-entete h2 {
  font-size: clamp(31px, 5vw, 54px);
  line-height: 0.98;
  letter-spacing: 0;
}

.boutons-saisons {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-saison {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  padding: 0 14px;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.btn-saison:hover {
  color: var(--text);
}

.btn-saison.actif {
  background: #fff;
  border-color: transparent;
  color: #08090d;
}

.liste-episodes {
  display: grid;
  gap: 8px;
  overflow-y: auto;
  padding: 16px 20px 22px;
}

.carte-episode {
  display: grid;
  grid-template-columns: 62px 1fr auto;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.carte-episode:hover {
  transform: translateX(4px);
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.09);
}

.ep-num {
  color: var(--cyan);
  font-size: 18px;
  font-weight: 950;
  text-align: center;
}

.ep-titre {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 850;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.ep-detail {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

/* ============ LECTEUR ============ */

#ecran-lecteur {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #000;
}

.barre-lecteur {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 10px;
  min-height: 62px;
  padding: max(12px, env(safe-area-inset-top)) clamp(12px, 3vw, 24px) 12px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.86), rgba(0, 0, 0, 0.34));
}

.btn-retour {
  height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-weight: 850;
}

.btn-retour:hover {
  background: rgba(255, 255, 255, 0.2);
}

#titre-lecture {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

#choix-qualite {
  height: 40px;
  max-width: 190px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 0 10px;
  outline: 0;
  cursor: pointer;
}

#choix-qualite option {
  color: #101114;
}

google-cast-launcher {
  width: 38px;
  height: 38px;
  --connected-color: var(--cyan);
  --disconnected-color: #fff;
}

#video {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  outline: 0;
}

#info-transcodage {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transform: translate(-50%, -50%);
  padding: 13px 18px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.76);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  pointer-events: none;
  backdrop-filter: blur(10px);
}

#info-transcodage .lucide {
  animation: tourner 1s linear infinite;
}

.tourne .lucide {
  animation: tourner 0.9s linear infinite;
}

@keyframes tourner {
  to {
    transform: rotate(360deg);
  }
}

/* ============ RESPONSIVE ============ */

@media (max-width: 980px) {
  .app-header {
    height: auto;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand tabs"
      "tools tools";
  }

  .marque { grid-area: brand; }
  .nav-onglets { grid-area: tabs; justify-self: end; }
  .outils { grid-area: tools; width: 100%; justify-content: stretch; }
  .recherche { width: 100%; flex: 1 1 auto; }

  .hero-contenu {
    width: 100%;
    padding-right: min(30vw, 210px);
  }

  .hero-poster {
    width: min(28vw, 180px);
    right: 24px;
  }
}

@media (max-width: 680px) {
  :root {
    --header-h: 118px;
  }

  body {
    background: #050506;
  }

  #form-connexion {
    padding: 24px;
  }

  .app-header {
    gap: 10px;
    padding: 10px 12px;
  }

  .marque-logo {
    width: 36px;
    height: 36px;
  }

  .marque span:last-child {
    max-width: 132px;
  }

  .onglet {
    min-width: 70px;
    height: 32px;
    font-size: 13px;
  }

  #choix-tri {
    width: 104px;
    font-size: 12px;
  }

  #choix-tri option {
    color: var(--text);
  }

  .hero-banner {
    min-height: 430px;
    height: 52vh;
    padding: 24px 16px 34px;
  }

  .hero-backdrop {
    background-position: center top;
  }

  .hero-banner::before {
    background:
      linear-gradient(180deg, rgba(5, 5, 6, 0.22) 0%, rgba(5, 5, 6, 0.74) 48%, #050506 100%),
      linear-gradient(90deg, rgba(5, 5, 6, 0.84), rgba(5, 5, 6, 0.22));
  }

  .hero-poster {
    display: none;
  }

  .hero-contenu {
    padding-right: 0;
    gap: 10px;
  }

  .hero-contenu h1 {
    max-width: 12ch;
    font-size: clamp(36px, 13vw, 58px);
  }

  .hero-synopsis {
    font-size: 14px;
    -webkit-line-clamp: 2;
  }

  main {
    padding: 14px 12px 44px;
  }

  .ligne-biblio {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .rail-liste {
    grid-auto-columns: 142px;
    gap: 10px;
    margin-right: -12px;
    padding-right: 12px;
  }

  .rail-liste.large {
    grid-auto-columns: 212px;
  }

  .rail-grille {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .infos .titre {
    font-size: 13px;
  }

  .modal-overlay {
    padding: 0;
    align-items: end;
  }

  .modal-contenu {
    width: 100%;
    max-height: 92vh;
    border-radius: 8px 8px 0 0;
  }

  .modal-hero {
    grid-template-columns: 96px 1fr;
    gap: 14px;
    min-height: 220px;
    padding: 48px 16px 18px;
  }

  .modal-poster {
    width: 96px;
  }

  .modal-entete h2 {
    font-size: 30px;
  }

  .carte-episode {
    grid-template-columns: 44px 1fr;
  }

  .ep-detail {
    grid-column: 2;
    white-space: normal;
  }

  .barre-lecteur {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
  }

  google-cast-launcher,
  #btn-airplay {
    display: none;
  }

  #choix-qualite {
    max-width: 132px;
    font-size: 12px;
  }

  .btn-retour span {
    display: none;
  }

  .btn-retour {
    width: 40px;
    padding: 0;
  }
}

/* ============ PROFILS FAMILIAUX ============ */

.ecran-acces {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: max(22px, env(safe-area-inset-top)) 22px max(22px, env(safe-area-inset-bottom));
  overflow-y: auto;
  background: #07080d;
}

.acces-fond {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(122deg, rgba(229, 9, 20, 0.12), transparent 42%),
    linear-gradient(20deg, rgba(42, 207, 214, 0.09), transparent 48%),
    #07080d;
  pointer-events: none;
}

.acces-contenu,
.form-acces,
.admin-shell {
  position: relative;
  z-index: 1;
}

.acces-contenu {
  width: min(100%, 900px);
  display: grid;
  justify-items: center;
  gap: 18px;
  padding: 42px 0;
  text-align: center;
}

.logo-marque {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
  background: #e50914;
  color: #fff;
  font-size: 18px;
  font-weight: 950;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.36);
}

.logo-marque.grand {
  width: 60px;
  height: 60px;
  font-size: 23px;
}

.sur-titre {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.acces-contenu h1,
.form-acces h1,
.admin-entete h1 {
  color: #fff;
  font-size: clamp(30px, 5vw, 52px);
  line-height: 1.03;
  letter-spacing: 0;
}

.profils-grille {
  width: min(100%, 800px);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(122px, 1fr));
  gap: 20px;
  padding: 12px 0 8px;
}

.carte-profil {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 10px;
  min-height: 160px;
  padding: 10px 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.carte-profil:hover .avatar-profil,
.carte-profil:focus-visible .avatar-profil {
  transform: scale(1.06);
  box-shadow: 0 0 0 3px #fff, 0 18px 38px rgba(0, 0, 0, 0.42);
}

.carte-profil:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
}

.avatar-profil,
.avatar-grand,
.avatar-mini {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  color: rgba(255, 255, 255, 0.96);
  font-weight: 950;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.avatar-profil {
  width: 104px;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 42px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.avatar-grand {
  width: 92px;
  aspect-ratio: 1;
  border-radius: 50%;
  font-size: 38px;
}

.avatar-mini {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 13px;
}

.avatar-bleu { background: #1d5ed8; }
.avatar-rouge { background: #bf2637; }
.avatar-vert { background: #168c62; }
.avatar-orange { background: #c96719; }
.avatar-violet { background: #7442bf; }
.avatar-rose { background: #c22e7a; }
.avatar-cyan { background: #118891; }
.avatar-gris { background: #53606c; }

.nom-profil {
  max-width: 100%;
  overflow: hidden;
  color: #fff;
  font-size: 15px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-proprietaire {
  position: absolute;
  right: 0;
  bottom: 0;
  color: #07110c;
  background: var(--green);
  border-color: transparent;
}

.actions-acces {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.btn-secondaire,
.btn-discret,
.btn-hero-secondaire {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--text);
  cursor: pointer;
  font-weight: 850;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.btn-discret {
  color: var(--muted);
  border-color: transparent;
  background: transparent;
}

.btn-secondaire:hover,
.btn-discret:hover,
.btn-hero-secondaire:hover {
  border-color: rgba(255, 255, 255, 0.46);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.form-acces {
  width: min(100%, 440px);
  display: grid;
  gap: 14px;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(14, 15, 22, 0.94);
  box-shadow: var(--shadow);
}

.form-acces .logo-marque,
.form-acces .avatar-grand {
  justify-self: center;
}

.form-acces .sur-titre,
.form-acces h1,
.form-acces .acces-sous-titre {
  text-align: center;
}

.acces-sous-titre {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.btn-retour-acces {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 7px;
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.btn-retour-acces:hover { color: #fff; }

.champ-formulaire {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.champ-formulaire input,
.select-avatar-admin {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: rgba(255, 255, 255, 0.075);
  color: var(--text);
  padding: 0 12px;
}

.champ-formulaire input:focus,
.select-avatar-admin:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(42, 207, 214, 0.14);
}

.choix-avatar {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.avatars-ligne {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.avatar-choix {
  width: 31px;
  height: 31px;
  border: 2px solid transparent;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.avatar-choix.actif {
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(42, 207, 214, 0.7);
}

/* ============ ADMINISTRATION ET PROFIL ACTIF ============ */

.admin-shell {
  width: min(100%, 840px);
  max-height: min(88vh, 780px);
  overflow: auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101118;
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.58);
}

.admin-entete,
.admin-liste-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.admin-entete { margin-bottom: 22px; }
.admin-liste-entete { margin: 24px 0 12px; }
.admin-liste-entete h2 { font-size: 20px; }
.admin-liste-entete span { color: var(--soft); font-weight: 800; }

.form-admin,
.admin-cle-form {
  display: grid;
  gap: 12px;
}

.form-admin { width: min(100%, 390px); }

.admin-cle-form {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
}

.admin-profils-liste {
  display: grid;
  gap: 8px;
}

.admin-profil {
  display: grid;
  grid-template-columns: 30px minmax(120px, 1fr) 104px minmax(112px, 0.8fr) 40px 40px;
  align-items: center;
  gap: 9px;
  min-height: 58px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.admin-profil input,
.admin-profil select {
  min-width: 0;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: #171923;
  color: var(--text);
  padding: 0 9px;
  font-size: 13px;
}

.admin-profil .badge-proprietaire {
  position: static;
  justify-self: end;
}

.btn-icone.danger:hover {
  border-color: rgba(255, 107, 114, 0.8);
  background: rgba(229, 9, 20, 0.22);
}

.profil-menu-wrap { position: relative; }

.profil-actif {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  height: 40px;
  padding: 0 8px 0 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.075);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
}

#profil-actif-nom {
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.menu-profil {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 42;
  width: 210px;
  display: grid;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #161820;
  box-shadow: var(--shadow);
}

.menu-profil button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 750;
}

.menu-profil button:hover { background: rgba(255, 255, 255, 0.1); }

.hero-boutons .btn-hero-secondaire,
.modal-actions .btn-hero-secondaire {
  min-height: 46px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 3px;
}

/* ============ CARTES ET LECTEUR ============ */

.carte { cursor: pointer; }

.btn-favori-carte {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.66);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.16s ease, transform 0.16s ease, background 0.16s ease;
}

.carte:hover .btn-favori-carte,
.carte:focus-within .btn-favori-carte,
.btn-favori-carte.actif {
  opacity: 1;
  transform: translateY(0);
}

.btn-favori-carte.actif {
  border-color: transparent;
  background: var(--red);
}

.lecteur-scene {
  position: relative;
  min-height: 0;
  display: grid;
}

.lecteur-scene > #video {
  grid-area: 1 / 1;
}

.carte-suivant {
  grid-area: 1 / 1;
  align-self: end;
  justify-self: end;
  z-index: 2;
  width: min(420px, calc(100% - 36px));
  display: grid;
  gap: 10px;
  margin: 0 18px 22px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(12, 13, 18, 0.94);
  box-shadow: 0 20px 56px rgba(0, 0, 0, 0.6);
}

.suivant-kicker {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.carte-suivant h2 { font-size: 22px; line-height: 1.18; }
.carte-suivant > p:not(.suivant-kicker) { color: var(--muted); font-size: 14px; }

.suivant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 3px;
}

@media (max-width: 980px) {
  .outils { gap: 7px; }
  .profil-actif { margin-left: auto; }
  .admin-profil {
    grid-template-columns: 30px minmax(130px, 1fr) 100px 40px 40px;
  }
  .admin-profil input[placeholder] { grid-column: 2 / span 2; }
}

@media (max-width: 680px) {
  .ecran-acces { padding: 16px; }
  .acces-contenu { padding: 24px 0; gap: 14px; }
  .profils-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 10px; }
  .carte-profil { min-height: 142px; }
  .avatar-profil { width: 88px; font-size: 36px; }
  .form-acces,
  .admin-shell { padding: 20px; }
  .form-acces { width: 100%; }
  .admin-shell { max-height: 94vh; }
  .admin-cle-form { grid-template-columns: 1fr; }
  .admin-profil {
    grid-template-columns: 30px minmax(0, 1fr) 40px 40px;
  }
  .admin-profil .select-avatar-admin { grid-column: 2; }
  .admin-profil input[placeholder] { grid-column: 2; }
  .admin-profil .badge-proprietaire { grid-column: 2 / span 3; justify-self: start; }
  .outils { flex-wrap: wrap; }
  .recherche { order: 3; flex-basis: 100%; }
  #choix-tri { max-width: 118px; }
  .profil-actif { margin-left: 0; }
  #profil-actif-nom { max-width: 68px; }
  .hero-boutons,
  .modal-actions { align-items: stretch; }
  .hero-boutons > button,
  .modal-actions > button { flex: 1 1 auto; }
  .carte-suivant {
    width: calc(100% - 24px);
    margin: 0 12px 14px;
    padding: 16px;
  }
}
