/* FemtoTV - Obsidian Frosted Glass */

:root {
  /* Colors — Varz palette: noir pur, gris, blanc */
  --bg: #141414;
  --bg-rgb: 20, 20, 20;
  --surface: #1a1a1a;
  --surface-hover: #222;
  --accent: #fff;
  --accent-rgb: 255, 255, 255;
  --accent-hover: #ccc;
  --accent-glow: rgba(255, 255, 255, 0.15);
  --grad: var(--accent);

  /* Typography — rehaussé: #aaa→#bbb, #888→#999 pour meilleure lisibilité */
  --text: #e0e0e0;
  --text-bright: #fff;
  --muted: rgba(255, 255, 255, 0.75);
  --text-secondary: rgba(255, 255, 255, 0.75);
  --border: #2a2a2a;
  --border-hover: #666;

  /* Espacement unifié — grille 4/8/12 px (base 16px = 0.25rem) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-6: 24px;
  --sp-8: 32px;

  /* Échelle z-index — Nav: 40, Recherche: 45, Modale: 55, Player: 60, Toasts: 100
     ponytail: player 55 SINON la fiche (#detail 55) passerait par-dessus la vidéo. */
  --z-nav: 40;
  --z-search: 45;
  --z-modal: 55;
  --z-player: 60;
  --z-toast: 100;

  /* Glass (subtle translucency + blur) */
  --glass: rgba(10, 10, 10, 0.82);
  --glass-border: rgba(255, 255, 255, 0.06);
  --blur: blur(16px);
  --surface: #1a1a1a;

  /* Radii & Shadows — arrondi moderne */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-full: 9999px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.85);
  --shadow-glow: 0 0 24px var(--accent-glow);

  /* props explicites (pas `all`): n'anime jamais layout/width/height par accident */
  --transition: color 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    border-color 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1),
    transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  color-scheme: dark;
}

/* Self-hosted variable fonts (latin only). ~48 KB Inter, ~32 KB Outfit.
   Google Fonts CDN retiré : pas de blocage headless, pas de DNS ext. */
@font-face {
  font-family: 'Inter';
  font-weight: 300 700;
  font-display: swap;
  src: url('/fonts/Inter.woff2') format('woff2');
}
@font-face {
  font-family: 'Outfit';
  font-weight: 500 800;
  font-display: swap;
  src: url('/fonts/Outfit.woff2') format('woff2');
}

/* Reset & Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  /* effet natif: un appui long ne surligne jamais l'UI (titres, onglets, boutons) */
  -webkit-user-select: none;
  user-select: none;
}

/* seuls les champs de saisie restent sélectionnables */
input, textarea {
  -webkit-user-select: text;
  user-select: text;
}

/* typo Outfit garantie sur toute la chaîne interactive (hérite du body) */
button, input, select, textarea {
  font-family: inherit;
}

/* contenu texte lisible sélectionnable (malgré le user-select:none global) */
.plot, .cast, .card .title {
  -webkit-user-select: text;
  user-select: text;
}

html {
  /* les sauts programmés (A-Z, ancres, scrollIntoView) doivent laisser les titres
     SOUS le header sticky flottant, pas derrière lui */
  scroll-padding-top: 6.5rem;
}

html, body {
  width: 100%;
  min-height: 100%; /* PAS height:100% — ça déplace le scroll hors de window (scrollY figé à 0) */
  background-color: var(--bg);
  color: var(--text);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  /* clip et pas hidden: overflow-x hidden crée un conteneur de scroll qui casse
     position:sticky (header disparaissait au scroll) */
  overflow-x: clip;
  /* effet natif: le scroll ne fuit pas au fond, pas de pull-to-refresh accidentel */
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.45);
}

.accent {
  color: var(--accent);
  font-weight: 700;
}

a {
  color: var(--accent-hover);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--text-bright);
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

[hidden] {
  display: none !important;
}

/* Authentication Page */
.auth {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(1.5rem, calc(env(safe-area-inset-top) + 0.5rem)) 1.5rem max(1.5rem, calc(env(safe-area-inset-bottom) + 0.5rem));
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 420px;
  padding: 3.5rem 2.5rem;
  border-radius: var(--radius-lg);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: authFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes authFadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-card h1.brand-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 2.5rem;
  font-weight: 800;
  text-align: center;
  margin-bottom: 2.5rem;
  letter-spacing: -0.8px;
}

.pass-wrap {
  position: relative;
  display: block;
  margin-bottom: 1.2rem;
}
.pass-wrap input {
  margin-bottom: 0;
  padding-right: 2.75rem;
  width: 100%;
  box-sizing: border-box;
}
.pass-toggle {
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 6px;
  padding: 0;
  margin: 0;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center / 1.15rem no-repeat;
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.2s;
}
.pass-toggle:hover { opacity: 1; }
.pass-toggle.visible {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.94 17.94A10.07 10.07 0 0 1 12 20c-7 0-11-8-11-8a18.45 18.45 0 0 1 5.06-5.94M9.9 4.24A9.12 9.12 0 0 1 12 4c7 0 11 8 11 8a18.5 18.5 0 0 1-2.16 3.19m-6.72-1.07a3 3 0 1 1-4.24-4.24M1 1l22 22'/%3E%3C/svg%3E");
  opacity: 0.85;
}

.auth-card input {
  width: 100%;
  margin-bottom: 1.2rem;
  padding: 1.1rem 1.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-bright);
  font-size: 1rem;
  transition: var(--transition);
}

.auth-card input::placeholder {
  color: rgba(255, 255, 255, 0.4);
}

.auth-card input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.1);
}

.auth-card button[type=submit] {
  margin-top: 1rem;
  padding: 1.1rem;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: #000;
  font-weight: 700;
  font-size: 1.05rem;
  box-shadow: var(--shadow-glow);
  transition: var(--transition);
}

.auth-card button[type=submit]:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.15);
}

.auth-switch {
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
  margin-top: 2rem;
}

.auth-switch a {
  font-weight: 600;
  margin-left: 0.4rem;
}

.auth-error {
  background: rgba(239, 68, 68, 0.08);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.15);
  border-radius: var(--radius-md);
  padding: 1rem;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Navigation / Topbar — barre flottante arrondie (même style mobile et desktop) */
/* ---------- Header — source unique ----------
   Desktop: pill d'onglets FLOTTANTE centrée (verre sombre, bords ronds),
   déconnexion SEULE en haut à droite. Mobile (@768px): zéro barre en haut,
   la pill devient bottom-nav fixe, déconnexion flottante en haut à droite.
   #topbar = conteneur fantôme (aucun fond): AUCUN backdrop-filter ici,
   sinon il devient containing block du #logout en position:fixed. */
#topbar {
  position: sticky;
  top: max(0.4rem, env(safe-area-inset-top));
  z-index: var(--z-nav);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 1.5rem;
  margin: 0.4rem 0 0;
}

/* la pill se suffit; la marque vit sur l'écran de connexion */
.brand { display: none; }

.tabs {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  padding: 0.3rem;
}

.tabs button {
  background: transparent;
  color: var(--muted);
  padding: 0.7rem 1.3rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  transition: var(--transition);
}

.tabs button:hover {
  color: var(--text-bright);
}

.tabs button:focus-visible {
  outline: 2px solid #e50914;
  outline-offset: 2px;
}

.tabs button.active {
  color: #000;
  background: var(--accent);
  box-shadow: var(--shadow-glow);
}

/* boutons icône dans la pill (recherche / favoris / admin): plus étroits */
#tab-fav, #tab-admin, #search-btn {
  padding: 0.85rem;
}

#search-btn {
  background: transparent;
  color: var(--muted);
  border-radius: var(--radius-full);
  transition: var(--transition);
}
#search-btn:hover { color: var(--text-bright); }
#search-btn:focus-visible { outline: 2px solid #e50914; outline-offset: 2px; }
#search-btn.active {
  color: #000;
  background: var(--accent);
  box-shadow: var(--shadow-glow);
}

/* Recherche: flotte centrée sous la pill quand ouverte */

/* Cacher boutons quand un overlay est ouvert */
body:has(.overlay:not([hidden])) #logout { display: none; }
body:has(.overlay:not([hidden])) .tabs { display: none; }
/* Cacher la croix du détail et catégorie quand le player est par-dessus (chevauchement) */
body:has(#player:not([hidden])) #detail .close,
body:has(#player:not([hidden])) #category .close { display: none !important; }

/* Déconnexion: bouton power SEUL, flottant en haut à droite, fond opaque */
#logout {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  right: 1.4rem;
  z-index: 41;
  color: #f87171;
  background: var(--surface);
  border: 1px solid var(--glass-border);
}
#logout:hover { background: #262626; color: #fff; }
#logout:focus-visible { outline: 2px solid #f87171; outline-offset: 2px; }

a:focus-visible {
  outline: 2px solid #e50914;
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
#search-wrap {
  width: 100%;
  max-width: 560px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  z-index: var(--z-search);
  transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, margin 0.3s ease;
}

#topbar.search-open #search-wrap {
  max-height: 64px;
  opacity: 1;
  margin-top: 0.6rem;
}

#search {
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
}

.search {
  width: 100%;
  padding: 0.75rem 1.4rem;
  border-radius: var(--radius-full);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-bright);
  font-size: 0.95rem;
  transition: var(--transition);
}

.search:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

/* Page Layout */
#content {
  padding: 1.4rem 3rem 6rem;
  max-width: 1760px;
  margin: 0 auto;
}

.row {
  margin-bottom: 2.2rem;
  /* Rangées hors écran non rendues → premier affichage bien plus rapide
     (38 catégories × 40 cartes sinon rendues d'un coup) */
  content-visibility: auto;
  contain-intrinsic-size: auto 400px;
}

.row h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 1.3rem;
  letter-spacing: -0.3px;
  color: var(--text-bright);
}

.row-scroll {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding: 0.5rem 0.2rem 1.5rem;
  scroll-behavior: smooth;
  scroll-snap-type: x proximity; /* effet rail: les affiches se calent, jamais coupées au repos */
  scroll-padding-left: 0.2rem;
  mask-image: linear-gradient(to right, black 85%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
}

.row-scroll > .card {
  scroll-snap-align: start;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 2rem;
  padding: 0.5rem 0.2rem;
}

/* Favoris groupés par type: chaînes en colonnes plus larges (logo paysage 16/10) */
.fav-sec { margin-bottom: 2.5rem; }
.fav-sec h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0 0 1.1rem;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}
.fav-count {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.1rem 0.55rem;
  border-radius: var(--radius-full);
}
/* chaînes: MÊME largeur de colonne que les films/séries (grille standard héritée),
   juste un poster paysage. Un minmax dédié plus large les rendait trop grosses
   (270px vs 170px dans l'onglet Live) — incohérent. */

/* Titre de rangée cliquable ("Voir tout") */
.row-head {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  max-width: 100%; /* pour que le titre tronque au lieu de wrapper + désaligner "Voir tout" */
  min-height: 44px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: inherit;
}
/* Titre sur UNE ligne, tronqué si trop long → "Voir tout" reste aligné (fini le wrap moche mobile) */
.row-head h2 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.4;
}
.row-head .see-all {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent-hover);
  opacity: 0.75;
  transition: var(--transition);
  white-space: nowrap;
  line-height: 1.4;
}
.row-head:hover .see-all { opacity: 1; }

/* Vue "Voir tout" d'une catégorie */
.cat-head {
  padding: 1rem 3rem 1.5rem;
  padding-top: max(4.5rem, calc(env(safe-area-inset-top) + 3.5rem));
  max-width: 1760px;
  margin: 0 auto;
}
.cat-head h1 {
  font-family: 'Outfit', sans-serif;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-bright);
}
.cat-count { color: var(--muted); font-size: 0.95rem; }

.cat-grid {
  max-width: 1760px;
  margin: 0 auto;
  padding: 0 3.4rem 6rem 3rem; /* place à droite pour l'index A-Z */
}
.az-anchor { scroll-margin-top: 5.5rem; }

/* Index alphabétique flottant à droite */
.az-scrub {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  padding: 0.4rem 0.35rem 0.4rem 0.7rem;
  touch-action: none;
}
.az-scrub .az {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  width: 26px;
  height: 16px;
  padding: 0;
  cursor: pointer;
  border-radius: var(--radius-md);
  touch-action: none;
  transition: color 0.15s ease, background 0.15s ease;
}
.az-scrub .az:hover, .az-scrub .az:active, .az-scrub .az.cur {
  color: #000;
  background: var(--accent);
}
/* Lettre survolée pendant le glissé: grossit (repère façon molette iOS) */
.az-scrub .az.cur { transform: scale(1.35); }
/* .off reste draggable: le scrub saute à la lettre suivante disponible.
   pointer-events:none cassait le glissé du doigt (elementFromPoint ratait la lettre). */
.az-scrub .az.off { color: rgba(255, 255, 255, 0.35); }

/* Bulle "classeur" façon Android/Jellyfin: grosse lettre en cours pendant le drag. */
.az-bubble {
  position: fixed;
  right: 3.4rem;
  z-index: 51;
  transform: translateY(-50%) scale(0.6);
  width: 68px;
  height: 68px;
  border-radius: 50% 50% 12px 50%; /* goutte pointant vers la barre à droite */
  background: var(--accent);
  color: #000;
  font-family: 'Outfit', sans-serif;
  font-size: 2rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  transition: opacity 0.12s ease, transform 0.12s ease;
}
.az-bubble.show { opacity: 1; transform: translateY(-50%) scale(1); }

/* Souris desktop: l'index est minuscule et inutile (molette) → caché. */
@media (hover: hover) and (pointer: fine) { .az-scrub, .az-bubble { display: none; } }

/* Mobile: colonne haute, lettres espacées et élargies → drag du pouce fiable (façon iOS). */
@media (max-width: 768px) {
  .az-scrub {
    top: 4rem;
    bottom: 1.5rem;
    transform: none;
    justify-content: space-between;
    padding: 0.5rem 0.4rem 0.5rem 1rem;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.55), transparent);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
  }
  .az-scrub .az {
    width: 30px;
    height: auto;
    flex: 1 0 auto;
    font-size: 0.82rem;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Media Cards */
.card {
  flex: 0 0 auto;
  width: 170px;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-md);
}

.grid .card {
  width: auto;
}

.card .poster {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: var(--radius-md);
  background-color: #1a1a1a;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  overflow: hidden;
  position: relative;
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out;
}
.card .poster-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.75rem;
  background-color: #0a0a0a;
}

.card.live .poster {
  aspect-ratio: 16/10;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.card:hover .poster {
  transform: scale(1.05);
  transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out;
  box-shadow: 0 0 0 2px var(--accent);
  border-color: var(--border-hover);
}

.card:active .poster {
  transform: translateY(-4px) scale(0.97);
}

.card:hover img,
.card:active img {
  transform: scale(1.02);
}

/* Play Overlay on Hover */
.card .poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: 
    radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, transparent 80%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, transparent 60%);
  opacity: 0;
  transition: var(--transition);
}

.card .title {
  font-size: 0.95rem;
  font-weight: 600;
  margin-top: 0.85rem;
  color: #ddd;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.1rem;
}

@media (hover: hover) {
  .card:hover .title { color: var(--text-bright); }
}

.empty {
  color: var(--muted);
  text-align: center;
  padding: 8rem 1rem;
  font-size: 1.2rem;
}

/* État vide soigné (favoris, etc.) */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.8rem;
  padding: 6rem 1.5rem;
  max-width: 420px;
  margin: 0 auto;
}

.empty-icon {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--accent-hover);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.6rem;
}

.empty-state h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-bright);
}

.empty-state p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.empty-state .btn {
  margin-top: 1rem;
}



/* EPG "en ce moment" sous les cartes live */
.epg-line {
  min-height: 1.1rem;
  margin-top: 0.3rem;
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 0.1rem;
}

.epg-line.on::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ef4444;
  margin-right: 6px;
  vertical-align: middle;
}

/* Rangée « Reprendre » — vignettes paysage 16:9 façon Netflix/Prime */
.card.resume {
  width: 280px;
}

.card.resume .poster {
  aspect-ratio: 16/9;
}

/* barre de progression superposée au BAS de la vignette (façon Netflix) */
.card.resume .resume-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  margin: 0;
  z-index: 3;
}

.resume-bar {
  height: 4px;
  margin-top: 0.5rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.resume-bar-fill {
  height: 100%;
  background: var(--grad);
  border-radius: var(--radius-full);
}

.resume-x {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.75);
  border: 1px solid var(--glass-border);
  color: var(--muted);
  opacity: 0;
  transition: var(--transition);
}

.card.resume:hover .resume-x {
  opacity: 1;
}

.resume-x:hover {
  color: white;
  background: rgba(239, 68, 68, 0.35);
}

@media (hover: none) {
  .resume-x {
    opacity: 1; /* mobile: pas de hover, toujours visible */
    width: 44px;
    height: 44px;
  }
}

/* Detail Overlays */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 42;
  overflow-y: auto;
  overscroll-behavior: contain; /* scroller la fiche/lecteur ne bouge pas la liste dessous */
  background: var(--bg);
  padding-top: max(0.8rem, env(safe-area-inset-top));
  /* opacity-only reveal: PAS de transform résiduel. Un transform (même translateY(0)
     via `forwards`) fait de .overlay le bloc conteneur de ses enfants position:fixed
     (.az-scrub, .close) → ils étaient piégés dans le scroll et disparaissaient au scroll. */
  animation: overlayReveal 0.3s ease forwards;
}

/* Hiérarchie des overlays: la fiche s'ouvre AU-DESSUS de "Voir tout", le lecteur
   au-dessus de tout. Sans ça, tous les .overlay étaient z-index:40 et #detail,
   placé avant #category dans le DOM, s'ouvrait DERRIÈRE la catégorie → clic sur un
   film dans "Voir tout" = fiche invisible sous la grille (semblait ne rien charger). */
#detail { z-index: var(--z-modal); }
#category { z-index: var(--z-modal); }
#guide { z-index: var(--z-modal); }
#player { z-index: var(--z-player); }

@keyframes overlayReveal {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Fondu léger au changement d'onglet (effet natif, non intrusif) */
.tab-enter {
  animation: tabEnter 0.16s ease-out both;
}
@keyframes tabEnter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.overlay .close {
  position: fixed;
  top: max(1.2rem, env(safe-area-inset-top));
  right: 1.2rem;
  z-index: calc(var(--z-modal) + 5);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: #0a0a0a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.overlay .close:hover {
  background: white;
  color: black;
  transform: rotate(90deg) scale(1.05);
}
.overlay .close:focus-visible {
  outline: 2px solid #e50914;
  outline-offset: 2px;
}

/* Dans la catégorie (Voir tout), l'A-Z scrubber est au bord droit → on décale la croix */
#category .close { right: 5rem; }

.detail-hero {
  position: relative;
  height: 60vh;
  min-height: 380px;
  background-position: center 25%;
  background-size: cover;
  background-repeat: no-repeat;
}

.detail-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.4) 50%, var(--bg) 100%);
}

.detail-body {
  position: relative;
  z-index: 1;
  margin-top: max(-150px, min(-70px, calc(-0.15 * 100vw)));
  padding: 4rem 5rem clamp(2rem, 5vw, 6rem);
  background: var(--surface);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border-top: 1px solid var(--glass-border);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  box-shadow: 0 -24px 60px rgba(0, 0, 0, 0.7);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}

.detail-body h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 3.2rem;
  font-weight: 800;
  margin-bottom: 0.8rem;
  letter-spacing: -0.8px;
  line-height: 1.15;
  color: var(--text-bright);
}

.detail-meta {
  color: var(--muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem;
  margin: 2.5rem 0;
}

.btn {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: var(--sp-3) var(--sp-6);
  font-weight: 600;
  font-size: 1.02rem;
  background: #0a0a0a;
  color: white;
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  transition: var(--transition);
}

.btn:hover,
.btn:active {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-2px);
}
.btn:focus-visible {
  outline: 2px solid #e50914;
  outline-offset: 2px;
}

.btn:active {
  transform: translateY(0) scale(0.97);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  box-shadow: var(--shadow-glow);
}

.btn.primary:hover,
.btn.primary:active {
  background: var(--accent-hover);
  color: #000;
  box-shadow: 0 8px 25px rgba(255, 255, 255, 0.15);
}

.btn.fav.on {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.rating-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fbbf24;
  font-weight: 600;
}

.rating-line span {
  color: var(--muted);
  font-weight: 400;
}

.btn.vlc {
  border-color: rgba(241, 90, 36, 0.25);
  color: #f15a24;
}
.btn.vlc:hover {
  background: rgba(241, 90, 36, 0.12);
  border-color: rgba(241, 90, 36, 0.45);
  transform: translateY(-2px);
}

.btn svg, .icon-btn svg, .close svg, .ctrl-btn svg {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
}

.btn.primary svg {
  color: white;
}

.btn.fav svg, .btn.fav.on svg {
  transition: var(--transition);
}

.btn.fav.on svg {
  color: #f87171;
}

.btn.sm {
  padding: 0.4rem 0.9rem;
  font-size: 0.78rem;
  gap: 0.4rem;
}

.plot {
  color: #ccc;
  line-height: 1.75;
  margin: 2rem 0;
  font-size: 1.1rem;
}

.cast {
  color: var(--muted);
  font-size: 1rem;
  margin: 0.6rem 0;
  line-height: 1.6;
}

.cast b {
  color: #ddd;
}

/* Seasons & Episodes — rail façon Jellyfin: pills compactes, fondu au bord
   droit = affordance "ça continue", la saison active revient dans le champ (JS) */
.seasons {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  margin: 2.8rem 0 1.2rem;
  padding: 2px 2px 0.6rem;
  scrollbar-width: none;
  mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 40px), transparent);
}
.seasons::-webkit-scrollbar {
  display: none;
}

.pill {
  flex-shrink: 0;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted);
  border-radius: var(--radius-full);
  padding: var(--sp-2) 1.25rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}
.pill .count {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.72rem;
  opacity: 0.5;
  font-weight: 500;
  vertical-align: middle;
}

.pill:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}
.pill:hover .count {
  opacity: 0.8;
}

.pill.active {
  background: var(--accent);
  color: #000;
  border-color: transparent;
  box-shadow: var(--shadow-glow);
}
.pill.active .count {
  opacity: 0.8;
}

.episodes {
  display: flex;
  flex-direction: column;
  margin-top: 1.5rem;
}

.ep {
  display: flex;
  min-width: 0;
  gap: 1.2rem;
  align-items: flex-start;
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.2s ease;
  position: relative;
}

.ep:last-child {
  border-bottom: none;
}

.ep:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ep-index {
  flex-shrink: 0;
  width: 2.4rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  color: var(--muted);
  padding-top: 0.2rem;
  font-variant-numeric: tabular-nums;
}

.ep-thumb {
  position: relative;
  width: 18vw;
  max-width: 240px;
  min-width: 100px;
  aspect-ratio: 16/9;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #080808;
  flex-shrink: 0;
  transition: box-shadow 0.25s ease;
}

.ep:hover .ep-thumb {
  box-shadow: 0 0 0 2px var(--accent);
}

/* badge durée posé sur la vignette */
.ep-dur {
  position: absolute;
  right: 5px;
  bottom: 5px;
  padding: 0.08rem 0.4rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
  pointer-events: none;
}

.ep-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.ep:hover .ep-thumb img {
  transform: scale(1.06);
}

.ep-play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  color: white;
  transition: opacity 0.2s ease;
}
.ep-play-overlay svg {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.6));
}
.ep:hover .ep-play-overlay {
  opacity: 1;
}

.ep-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  padding-top: 0.1rem;
}

.ep .ep-t {
  font-weight: 600;
  font-size: 1rem;
  color: white;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.25rem;
}

.ep-plot {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.5rem;
}

.ep-actions {
  display: flex;
  gap: 0.4rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.ep:hover .ep-actions,
.ep:focus-within .ep-actions {
  opacity: 1;
}
.ep-actions .btn.sm {
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  gap: 0.3rem;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 0.3rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.btn-icon:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}
.btn-icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.btn-icon[title="VLC"]:hover {
  color: #f47d31;
}
.btn-icon[title="VLC"]:focus-visible {
  outline-color: #f47d31;
}
.ep-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.2rem;
  flex-shrink: 0;
  margin-left: 0.75rem;
  padding-top: 0.1rem;
}
.ep-meta-dur,
.ep-meta-ext {
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.ep-meta-ext {
  text-transform: uppercase;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.06);
  padding: 0.05rem 0.4rem;
  border-radius: var(--radius-sm);
}

.epg {
  margin: 2.5rem 0;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
}

.epg .now {
  color: white;
  font-weight: 600;
  font-size: 1.15rem;
  margin-bottom: 0.6rem;
}

.epg .next {
  color: var(--muted);
  font-size: 1rem;
}

/* Fullscreen Video Player */
.player {
  background: #000;
  overflow: hidden;
}

/* Vidéo plein écran dans le player */
#player-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #000;
  z-index: 50;
}

/* Gros bouton central play/pause (visible quand en pause) */
.player-bigplay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 62;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  color: white;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--glass-border);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}
.player-bigplay:hover { background: rgba(255, 255, 255, 0.25); transform: translate(-50%, -50%) scale(1.06); }
.player-bigplay[hidden] { display: none; }

/* Barre de contrôles en bas */
.player-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 63;
  padding: 1.4rem 1.6rem max(1.4rem, calc(env(safe-area-inset-bottom) + 0.6rem));
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Auto-hide: le lecteur passe en plein écran visuel (plus de UI) si inactif */
.player.pc-hidden .player-controls { opacity: 0; transform: translateY(12px); pointer-events: none; }
.player.pc-hidden .player-bigplay { display: none; }

.player-controls .pc-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.pc-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--glass-border);
  background: #0a0a0a;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
}
.pc-btn:hover { background: white; color: black; transform: scale(1.05); }

.pc-btn.pc-vlc {
  width: auto;
  border-radius: var(--radius-full);
  padding: 0 1.2rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.pc-btn.pc-vlc:hover { background: #f15a24; border-color: #f15a24; color: white; }

.pc-title {
  flex: 1;
  min-width: 0;
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

.pc-live {
  flex-shrink: 0;
  color: #ff4d4d;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
  animation: livePulse 1.6s ease-in-out infinite;
}
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Seek VOD */
.pc-seek {
  display: flex;
  align-items: center;
  gap: 1rem;
  pointer-events: auto;
}
.pc-seek[hidden] { display: none; }

.pc-time {
  color: white;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
  flex-shrink: 0;
}

.pc-seek-wrap {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-full);
  cursor: pointer;
  pointer-events: auto;
  transition: height 0.15s ease;
}
.pc-seek-wrap:hover { height: 10px; }

.pc-seek-bar {
  height: 100%;
  width: 0;
  background: var(--grad);
  border-radius: var(--radius-full);
  box-shadow: var(--shadow-glow);
}

.pc-seek-buffer {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-full);
}

/* Volume + muet */
.pc-volume {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pc-vol {
  -webkit-appearance: none;
  appearance: none;
  width: 84px;
  height: 4px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.25);
  outline: none;
  cursor: pointer;
}
.pc-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: white;
  box-shadow: var(--shadow-glow);
  cursor: pointer;
}
.pc-vol::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: white;
  cursor: pointer;
}

/* Popup réglages (qualité / audio / sous-titres) */
.pc-pop {
  position: relative;
  flex-shrink: 0;
}
.pc-menu {
  position: absolute;
  bottom: calc(100% + 0.8rem);
  right: 0;
  z-index: 65;
  min-width: 200px;
  max-height: 60vh;
  overflow-y: auto;
  background: #0a0a0a;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 0.5rem;
}
.pc-menu[hidden] { display: none; }
.pc-menu-title {
  color: var(--accent-hover);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.6rem 0.8rem 0.3rem;
}
.pc-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: white;
  font-size: 0.9rem;
  padding: 0.55rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.pc-menu-item:hover { background: rgba(255, 255, 255, 0.08); }
.pc-menu-item.on { color: var(--accent-hover); font-weight: 700; }
.pc-menu-item.on::after { content: ' ✓'; }

.player-msg {
  position: absolute;
  bottom: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 64;
  text-align: center;
  background: #0a0a0a;
  border: 1px solid var(--glass-border);
  padding: 1.5rem 2.5rem;
  border-radius: var(--radius-md);
  color: white;
  box-shadow: var(--shadow-lg);
  max-width: 90%;
}

.player-msg p {
  margin-bottom: 0.9rem;
  font-size: 0.98rem;
}

/* Toast Notifications */
.toast {
  position: fixed;
  bottom: max(2.5rem, calc(env(safe-area-inset-bottom) + 1rem));
  left: 50%;
  transform: translateX(-50%);
  z-index: var(--z-toast);
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid var(--glass-border);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  color: white;
  padding: 1rem 1.8rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
  animation: toastIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes toastIn {
  from { transform: translate(-50%, 1.5rem); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* Admin Dashboard */
/* ---------- Admin : dashboard ---------- */
.admin {
  padding: 1.5rem 0 4rem;
  max-width: 1100px;
  margin: 0 auto;
}
.ab-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
.ab-head h1 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Tuiles KPI */
.ab-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.ab-kpi {
  padding: 1.3rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--glass-border);
}
.ab-kpi-val {
  color: var(--text-bright);
  font-family: 'Outfit', sans-serif;
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ab-kpi-label {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.ab-sec { margin-bottom: 2.5rem; }
.ab-sec h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

/* Carte englobant une table (arrondi propre, scroll horizontal si étroit) */
.ab-card {
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.admin table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
.admin th, .admin td {
  text-align: left;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle; /* règle le "user trop haut": cellules centrées verticalement */
}
.admin th {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  background: rgba(255, 255, 255, 0.02);
}
.admin tbody tr:last-child td, .admin tr:last-child td { border-bottom: none; }
.admin tr:not(:first-child):hover td { background: rgba(255, 255, 255, 0.02); }

/* Cellule utilisateur: avatar initiales + nom + rôle */
.ab-user { display: flex; align-items: center; gap: 0.8rem; }
.ab-av {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text-bright);
}
/* modificateur admin: PAS ".admin" (collision avec le conteneur .admin qui posait
   son padding 1.5rem 0 4rem sur l'avatar → ellipse). D'où ".ab-admin". */
.ab-av.ab-admin {
  background: var(--accent);
  border-color: transparent;
  color: #000;
}
.ab-name {
  font-weight: 600;
  color: var(--text-bright);
  display: flex; align-items: center; gap: 0.3rem;
}
.ab-sub { color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }
.ab-muted { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ab-clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Badge de type de lecture */
.ab-type {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.ab-movie { background: rgba(255, 255, 255, 0.08); color: #ddd; }
.ab-ep    { background: rgba(56, 189, 248, 0.16); color: #7dd3fc; }
.ab-live  { background: rgba(239, 68, 68, 0.16); color: #fca5a5; }

.admin td.code {
  font-family: ui-monospace, monospace;
  color: var(--accent-hover);
  letter-spacing: 1px;
  font-weight: 600;
}
.admin td.muted { color: var(--muted); }

.admin .row-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.admin .btn-sm {
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  border-radius: var(--radius-full);
  padding: 0.4rem 0.9rem;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  transition: var(--transition);
}
.admin .btn-sm:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--border-hover); }
.admin .btn-sm.danger:hover { color: #fca5a5; background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); }

.ab-empty {
  padding: 1.6rem;
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

.admin td.muted {
  color: var(--muted);
  text-decoration: line-through;
}

.empty-inline {
  color: var(--muted);
  margin: 2rem 0 3rem;
}

.admin td {
  color: #ccc;
  font-size: 0.95rem;
}

/* Responsive Styles */
@media (max-width: 1024px) {
  #content {
    padding: 2rem 2rem 5rem;
    padding-top: max(2rem, calc(env(safe-area-inset-top) + 0.5rem));
  }
  .detail-body h1 {
    font-size: 2.5rem;
  }
}

@media (max-width: 768px) {
  /* header fantôme réduit à rien: la pill part en bottom-nav fixe */
  #topbar {
    position: static;
    padding: 0;
    margin: 0;
  }

  .tabs {
    position: fixed;
    left: 0.6rem; right: 0.6rem;
    bottom: max(0.6rem, env(safe-area-inset-bottom));
    z-index: var(--z-nav);
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    padding: 0.3rem;
    gap: 0.25rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  }
  .tabs button {
    flex: 1;
    min-width: 0;
    min-height: 44px;
    padding: 0.5rem 0.4rem;
    font-size: 0.92rem;
  }
  /* touch-first: zone tactile minimale 44px sur tous les contrôles compacts */
  .btn, .btn.sm, .btn-sm, .pill { min-height: 44px; }
  #tab-fav, #tab-admin, #search-btn {
    flex: 0 0 auto;
    width: 52px;
    min-height: 44px;
    padding: 0.5rem 0.65rem;
  }

  #logout {
    top: max(1rem, env(safe-area-inset-top));
    right: 0.8rem;
    width: 44px;
    height: 44px;
  }

  #search-wrap {
    position: fixed;
    left: 0.6rem; right: 0.6rem;
    bottom: calc(max(0.6rem, env(safe-area-inset-bottom)) + 4.4rem);
    z-index: var(--z-search);
    width: auto;
    max-width: none;
    margin: 0;
  }
  #topbar.search-open #search-wrap { margin: 0; }
  #search {
    background: rgba(0, 0, 0, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  }

  .admin {
    padding: 0.8rem 0 4rem;
  }
  .admin table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    width: 100%;
  }
  .admin th, .admin td { padding: 0.55rem 0.8rem; font-size: 0.82rem; }
  .admin .btn-sm { padding: 0.35rem 0.7rem; font-size: 0.74rem; }
  .ab-head h1 { font-size: 1.3rem; }
  .ab-kpis { grid-template-columns: repeat(3, 1fr); gap: 0.6rem; }
  .ab-kpi { padding: 0.8rem 1rem; }
  .ab-kpi-val { font-size: 1.5rem; }
  #content {
    /* bas: bottom-nav fixe (~4.1rem avec son offset) + marge — rien ne finit caché dessous */
    padding: max(0.8rem, calc(env(safe-area-inset-top) + 0.2rem)) 1rem calc(5.5rem + env(safe-area-inset-bottom));
    /* min-height: évite que #content s'effondre entre skeleton + contenu réel (tab switch) */
    min-height: calc(100dvh - 6rem);
  }
  .row {
    margin-bottom: 1.2rem;
  }
  .episodes {
    gap: 1rem;
  }
  .row h2 {
    font-size: 1.15rem;
    margin-bottom: 0.8rem;
  }
  .row-head .see-all { font-size: 0.72rem; }
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.8rem;
  }
  .card {
    width: 150px;
  }
  .row-scroll {
    gap: var(--sp-3);
  }
  .card .title {
    font-size: 0.85rem;
  }
  .detail-hero {
    height: 40vh;
  }
  .detail-body {
    padding: 1.5rem;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
  .detail-body h1 {
    font-size: 2rem;
  }
  .detail-actions {
    gap: 0.8rem;
  }
  .btn {
    padding: 0.8rem 1.6rem;
    font-size: 0.98rem;
    flex: 1 1 45%;
    justify-content: center;
  }
  /* Lire pleine largeur; VLC + ♥ partagent la ligne suivante (♥ compact) →
     1 rang gagné vs 3 boutons pleine largeur empilés. */
  .detail-actions .btn.primary { flex: 1 1 100%; }
  .detail-actions .btn.vlc { flex: 1 1 auto; }
  .detail-actions .btn.fav { flex: 0 0 auto; min-width: 60px; padding-left: 1rem; padding-right: 1rem; }
  .player-controls {
    padding: 1.1rem 1rem max(1.1rem, calc(env(safe-area-inset-bottom) + 0.5rem));
    gap: 0.6rem;
  }
  .pc-btn {
    width: 40px;
    height: 40px;
  }
  .pc-btn.pc-vlc {
    padding: 0 0.9rem;
    font-size: 0.78rem;
  }
  .pc-title {
    font-size: 0.85rem;
  }
  .pc-vol {
    display: none;
  }
  /* barre de seek atteignable au doigt (5 px désespérant au tactile) */
  .pc-seek-wrap {
    height: 8px;
  }
  .pc-time {
    font-size: 0.75rem;
  }
  .player-bigplay {
    width: 76px;
    height: 76px;
  }
  .ep {
    gap: 0.6rem;
    padding: 0.6rem 0.3rem;
  }
  .ep-index {
    width: 1.6rem;
    font-size: 0.85rem;
  }
  .ep-thumb {
    width: 28vw;
    min-width: 70px;
  }
  .ep .ep-t {
    font-size: 0.9rem;
  }
  .ep-plot {
    -webkit-line-clamp: 1;
    font-size: 0.8rem;
  }
  .ep-meta {
    display: none;
  }
  .btn-icon {
    min-width: 44px;
    min-height: 44px;
  }
  .ep-actions {
    opacity: 1;
  }
  .overlay .close {
    right: 1.2rem;
    width: 44px;
    height: 44px;
  }
  /* avertir le § player si tout proche: le body:has() règle le chevauchement avec le détail */
  .cat-head {
    padding: 0.8rem 1.2rem 1rem;
    padding-top: max(3.5rem, calc(env(safe-area-inset-top) + 2.5rem));
  }
  .cat-grid {
    padding: 0 1.2rem 4rem;
  }
  .overlay .close {
    right: auto;
    left: max(1rem, env(safe-area-inset-left));
  }
}

@media (max-width: 480px) {
  .tabs button { font-size: 0.78rem; padding: 0.5rem 0.2rem; }
  #tab-fav, #tab-admin, #search-btn { width: 44px; padding: 0.5rem 0.35rem; }
  .row-head { min-height: 44px; align-items: center; }
  .btn { flex: 1 1 100%; padding: 0.7rem 1.2rem; font-size: 0.9rem; }
  .card { width: 120px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .card .title { font-size: 0.75rem; margin-top: 0.3rem; }
  #content { padding: 0.4rem 0.6rem 5.5rem; padding-top: max(1rem, calc(env(safe-area-inset-top) + 0.3rem)); }
  .row-scroll { gap: var(--sp-3); padding-bottom: 1rem; }
  .auth-card { padding: 2.5rem 1.5rem; }
  .auth-card h1.brand-logo { font-size: 2rem; margin-bottom: 2rem; }
  .ep { gap: 0.4rem; padding: 0.5rem 0.2rem; }
  .ep-thumb { width: 30vw; min-width: 60px; }
  .ep .ep-t { font-size: 0.82rem; }
  .ep-meta { display: none; }
  .ep-plot { display: none; }
  .detail-hero { height: 35vh; min-height: 250px; }
  .detail-body { padding: 1rem 1rem 2rem; }
  .detail-body h1 { font-size: 1.4rem; }
  .detail-meta { font-size: 0.85rem; gap: 0.5rem; flex-wrap: wrap; }
  .admin { padding: 0.4rem 0.4rem 4rem; }
  .ab-head h1 { font-size: 1.1rem; }
  .ab-kpis { grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .ab-kpi { padding: 0.6rem 0.8rem; }
  .admin th, .admin td { padding: 0.4rem 0.5rem; font-size: 0.75rem; }
  .ab-clip { max-width: 120px; }
  .admin .btn-sm { padding: 0.25rem 0.5rem; font-size: 0.68rem; }
  .ab-av { width: 30px; height: 30px; font-size: 0.7rem; }
}

@media (max-width: 380px) {
  .tabs button { font-size: 0.72rem; padding: 0.55rem 0.15rem; }
  #tab-fav, #tab-admin, #search-btn { padding: 0.55rem 0.3rem; }
  .auth-card { padding: 2rem 1rem; }
  .auth-card h1.brand-logo { font-size: 1.6rem; }
  .auth-card input { padding: 0.9rem 1rem; font-size: 0.95rem; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
  .card { width: auto; }
  .card .title { font-size: 0.7rem; }
  .row-scroll { gap: var(--sp-3); }
  #content { padding: 0.3rem 0.4rem 5.5rem; padding-top: max(0.8rem, calc(env(safe-area-inset-top) + 0.3rem)); }
  .admin { padding: 0.3rem 0.3rem 4rem; }
  .ab-head h1 { font-size: 1rem; }
  .ab-kpis { grid-template-columns: 1fr 1fr; gap: 0.4rem; }
  .ab-kpi { padding: 0.5rem 0.6rem; }
  .admin th, .admin td { padding: 0.3rem 0.4rem; font-size: 0.7rem; }
  .admin .btn-sm { padding: 0.2rem 0.4rem; font-size: 0.65rem; }
}

/* ============================================================
   REDESIGN 2026-07 — "Cinema" pass (override en fin de cascade)
   Dark OLED + motion + glass affiné. Mobile: bottom navigation.
   ============================================================ */

:root {
  --shadow-card: 0 8px 24px rgba(0, 0, 0, 0.55);
}

/* ---------- Rangées / titres de section ---------- */
.row-head h2, #content h2 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.3px;
  margin-bottom: 0;
}
.row-head .see-all {
  opacity: 1;
  font-size: 0.85rem;
  color: var(--muted);
}
.row-head:hover .see-all { color: var(--accent-hover); }

/* ---------- Cartes ---------- */
.card {
  position: relative;
  will-change: transform;
}
.card .poster {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
/* VOD/séries: titre SOUS l'affiche — zéro collision avec l'art/texte du poster
   (l'overlay superposait notre titre au titre imprimé sur l'affiche = double texte). */
.card:not(.live) .title {
  position: static;
  margin: 0.55rem 0.15rem 0;
  padding: 0;
  background: none;
  color: #ddd;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transition: color 0.18s ease;
}
@media (hover: hover) { .card:not(.live):hover .title { color: #fff; } }
/* LIVE: garde le bandeau (logo chaîne + EPG en cours) — les vignettes live
   sont des logos simples, l'overlay ne gêne rien et intègre l'EPG. */
.card.live .title {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 1.4rem 0.6rem 1.35rem;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.72) 55%, rgba(0, 0, 0, 0.88));
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.3;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.card.live .epg-line {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  margin: 0;
  padding: 0.15rem 0.6rem 0.45rem;
  background: rgba(0, 0, 0, 0.88);
  border-radius: 0 0 4px 4px;
  font-size: 0.7rem;
  pointer-events: none;
}
/* hover: lift + anneau accent (desktop) */
@media (hover: hover) {
  .card:hover { z-index: 3; }
  .card:hover .poster {
    transform: translateY(-3px);
    box-shadow: 0 0 0 2px var(--accent), 0 20px 50px rgba(0, 0, 0, 0.75);
  }
  .card:hover .title { color: #fff; }
}
.card:active .poster { transform: scale(0.97); }
/* Sur mobile tactile, pas de lift (hover cassé) */
@media (hover: none) {
  .card:active .poster { transform: scale(0.97); }
}
/* reprise: barre par-dessus le bandeau titre */
.card.resume .resume-bar { z-index: 2; }

/* ---------- Player: scrims + contrôles dignes ---------- */
.player-controls {
  padding: 2.6rem 1.2rem max(0.9rem, env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55) 40%, rgba(0, 0, 0, 0.85));
}
.pc-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  color: #fff;
}
.pc-btn:hover { background: rgba(255, 255, 255, 0.12); }
.pc-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.02rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
}
.pc-live {
  background: rgba(220, 38, 38, 0.18);
  color: #f87171;
  border: 1px solid rgba(220, 38, 38, 0.35);
  border-radius: var(--radius-full);
  padding: 0.2rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.pc-vlc {
  border-radius: var(--radius-full) !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0 0.9rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.4px;
}
/* seek: plus épaisse, thumb au survol */
.pc-seek-wrap {
  height: 5px;
  border-radius: var(--radius-full);
  transition: height 0.15s ease;
}
.pc-seek-wrap:hover { height: 9px; }
.pc-seek-bar { border-radius: var(--radius-full); }
.pc-seek-bar::after {
  content: '';
  position: absolute;
  right: -7px; top: 50%;
  width: 14px; height: 14px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: var(--accent-hover);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.pc-seek-wrap:hover .pc-seek-bar::after { opacity: 1; }
.player-bigplay {
  width: 88px; height: 88px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* ---------- Audit guidelines (Vercel web-interface-guidelines) ---------- */
/* rail horizontal: fondu au bord droit = affordance "ça continue à droite" */
.row-scroll {
  mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
  -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent);
}
/* titres: pas de mot orphelin */
#content h2, .row-head h2, .detail h1 { text-wrap: balance; }
/* temps du lecteur: chiffres tabulaires, zéro tremblement à chaque seconde */
.pc-time, #vod-time { font-variant-numeric: tabular-nums; }

/* ---------- Conteneur des lecteurs alternatifs (xgplayer) ---------- */
.lm-container {
  position: absolute;
  inset: 0;
  z-index: 50; /* même plan que #player-video (les contrôles sont à 63) */
  background: #000;
}
.lm-container canvas,
.lm-container video {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

/* ---------- Aide VLC (protocole non enregistré) ---------- */
.vlc-help {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(0, 0, 0, 0.8);
}
.vlc-help-card {
  width: 100%;
  max-width: 520px;
  padding: 2rem;
  border-radius: var(--radius-lg);
  background: var(--glass);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
}
.vlc-help-card h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.4rem;
  margin-bottom: 0.9rem;
}
.vlc-help-card p, .vlc-help-card li {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}
.vlc-help-card ol {
  margin: 0.8rem 0 1.2rem 1.1rem;
  display: grid;
  gap: 0.5rem;
}
.vlc-help-card b { color: var(--text-bright); }
.vlc-help-card code {
  padding: 0.1rem 0.35rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent-hover);
  font-size: 0.85em;
}
.vlc-help-url {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-bright);
  font-size: 0.8rem;
  font-family: ui-monospace, monospace;
}
.vlc-help-actions {
  display: flex;
  gap: 0.6rem;
  margin-top: 1rem;
}

/* ---------- Lecteur: sélecteur de qualité (déclinaisons provider) ---------- */
.pc-quality { position: relative; }
.pc-qbtn {
  /* pill, pas le cercle 44px de .pc-btn: le libellé ("Standard") était rogné */
  width: auto;
  min-width: 0;
  padding: 0 0.9rem;
  height: 40px;
  border-radius: var(--radius-full) !important;
  border: 1px solid rgba(255, 255, 255, 0.25);
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.pq-menu {
  position: absolute;
  bottom: calc(100% + 0.6rem);
  right: 0;
  z-index: 64;
  min-width: 230px;
  max-height: 260px;
  overflow-y: auto;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.96);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
/* menu du moteur dans la barre du haut: ouvrir vers le bas (sinon hors écran) */
.pq-menu.pq-down {
  bottom: auto;
  top: calc(100% + 0.6rem);
}
.pq-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 9px;
  color: var(--muted);
  text-align: left;
}
.pq-item:hover { background: rgba(255, 255, 255, 0.07); color: var(--text-bright); }
.pq-item.active { background: var(--accent); color: #000; }
.pq-label { flex: 0 0 3rem; font-weight: 700; font-size: 0.8rem; }
.pq-name {
  flex: 1;
  min-width: 0;
  font-size: 0.82rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pq-src {
  flex: 0 0 auto;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* ---------- Lecteur: panneau statistiques ---------- */
.pc-stats { font-weight: 800; font-size: 0.85rem; }
.pc-stats.active { background: var(--accent); color: #000; }
.player-stats-panel {
  position: absolute;
  top: max(4.5rem, calc(env(safe-area-inset-top) + 4rem));
  left: 1.2rem;
  z-index: 63;
  min-width: 240px;
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}
.st-row {
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 0.15rem 0;
}
.st-k { color: var(--muted); }
.st-v { color: var(--text-bright); font-weight: 600; }

/* ---------- Progression de visionnage par épisode ---------- */
.ep-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.2);
}
.ep-progress-fill {
  height: 100%;
  background: var(--accent);
}
.ep-seen {
  position: absolute;
  top: 5px; right: 5px;
  width: 20px; height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--accent);
  color: #000;
  font-size: 0.7rem;
  font-weight: 700;
}

/* ---------- Tri "Voir tout" ---------- */
.cat-sort {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.8rem;
}
.cat-sort .pill {
  padding: 0.35rem 0.95rem;
  font-size: 0.82rem;
}

/* ---------- EPG fiche chaîne: liste horaire + direct ---------- */
.epg-row {
  display: flex;
  gap: 0.9rem;
  align-items: baseline;
  padding: 0.45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.epg-row:last-child { border-bottom: none; }
.epg-time {
  flex: 0 0 3.2rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}
.epg-prog { flex: 1; min-width: 0; }
.epg-title {
  font-size: 0.92rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.epg-row.cur .epg-title { color: var(--text-bright); font-weight: 600; }
.epg-row.cur .epg-time { color: var(--accent-hover); }
.epg-bar {
  height: 3px;
  margin-top: 0.35rem;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.epg-bar-fill {
  height: 100%;
  background: var(--grad);
}

/* ---------- Guide TV (grille multi-chaînes, façon iptvnator) ---------- */
#guide { display: flex; flex-direction: column; }
#guide[hidden] { display: none; }
.guide-head {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.8rem 3rem;
  padding: 0.3rem;
  background: var(--surface);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(12px);
}
.guide-title {
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 0 12px rgba(167, 133, 242, 0.8);
  padding: 0 1.1rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  flex: 0 0 auto;
}
.guide-pills {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  flex: 1;
  align-items: center;
  justify-content: center;
  scrollbar-width: none;
}
.guide-pills::-webkit-scrollbar { display: none; }
.guide-pills .pill {
  white-space: nowrap;
  font-size: 0.8rem;
  padding: 0.62rem 1.05rem;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 9999px;
  border: none;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  flex: 0 0 auto;
}
.guide-pills .pill:hover { color: var(--text-bright); }
.guide-pills .pill.active {
  color: #000;
  background: var(--accent);
  box-shadow: var(--shadow-glow);
}
#guide-close {
  flex: 0 0 auto;
  position: relative;
  right: auto;
  top: auto;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--glass-border);
  color: var(--muted);
}
#guide-close::before {
  content: "";
  width: 18px;
  height: 18px;
  display: inline-block;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 6L6 18M6 6l12 12' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M18 6L6 18M6 6l12 12' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
#guide-close:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-bright);
  transform: none;
}

.guide-body {
  overflow-x: auto;
  overflow-y: auto;
  padding: 0 0 2rem;
  flex: 1;
}
/* colonne chaînes fixe à gauche, track temps scrollable à droite */
.g-head, .g-row {
  display: flex;
  align-items: stretch;
  min-width: max-content;
}
.g-corn { flex: 0 0 190px; position: sticky; left: 0; z-index: 2; background: var(--bg); }
.g-head { border-bottom: 1px solid rgba(255, 255, 255, 0.12); position: sticky; top: 0; z-index: 4; background: var(--bg); }
.g-track {
  position: relative;
  width: 1080px; /* 6 colonnes de 30 min = 3 h de fenêtre */
  flex: 0 0 1080px;
}
.g-hour {
  position: absolute;
  top: 0.45rem;
  transform: translateX(-50%);
  font-size: 0.78rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.g-row { border-bottom: 1px solid rgba(255, 255, 255, 0.15); }
.g-row:hover { background: rgba(255, 255, 255, 0.03); }
.g-ch {
  flex: 0 0 190px;
  position: sticky;
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.8rem;
  background: var(--bg);
  min-width: 0;
}
.g-ch img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex: 0 0 26px;
}
.g-ch span {
  font-size: 0.82rem;
  color: #ddd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.g-track { height: 2.4rem; }
.g-prog {
  position: absolute;
  top: 0.3rem;
  bottom: 0.3rem;
  border-radius: 4px;
  background: rgba(122, 92, 224, 0.22);
  border: 1px solid rgba(167, 133, 242, 0.28);
  padding: 0 0.45rem;
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  text-align: left;
}
.g-prog:hover {
  background: rgba(122, 92, 224, 0.45);
  border-color: var(--accent);
}
.g-prog-t {
  font-size: 0.75rem;
  line-height: 1.4;
  padding-right: 0.25rem;
  color: #e8e2ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.g-now {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0.85;
  z-index: 3;
  pointer-events: none;
}

@media (max-width: 640px) {
  /* Mobile: 2 lignes — titre+close au-dessus, pills pleine largeur dessous
     (sinon title+pills+close > 390px → close coupé au bord) */
  .guide-head {
    flex-wrap: wrap;
    border-radius: var(--radius-lg);
    row-gap: 0.15rem;
    margin: 0.5rem 0.6rem;
    padding: 0.25rem;
    gap: 0.15rem;
  }
  .guide-title { order: 1; flex: 1; font-size: 0.82rem; padding: 0 0.7rem; min-height: 40px; }
  /* left/right:auto: annule .overlay .close mobile (left:1rem) qui décalait le bouton */
  #guide-close { order: 2; width: 36px; height: 36px; margin-left: 0; left: auto; right: auto; top: auto; }
  .guide-pills { order: 3; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; }
  .guide-pills .pill { padding: 0.55rem 0.85rem; min-height: 40px; font-size: 0.76rem; }
  .g-corn, .g-ch { flex-basis: 120px; }
}

/* ---------- Loading skeleton cards ---------- */
.sk-row {
  display: flex;
  gap: 1.5rem;
  overflow: hidden;
  margin-bottom: 2.2rem;
}
.sk-card {
  flex: 0 0 170px;
  overflow: hidden;
  border-radius: var(--radius-md);
}
.sk-card .sk-poster {
  aspect-ratio: 2/3;
  border-radius: var(--radius-md);
  background: linear-gradient(90deg, #0a0a0a 25%, #181818 50%, #0a0a0a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
.sk-card.live .sk-poster {
  aspect-ratio: 16/10;
}
.sk-card .sk-title {
  height: 13px;
  margin: 12px 0 0;
  border-radius: 4px;
  background: linear-gradient(90deg, #0a0a0a 25%, #181818 50%, #0a0a0a 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite 0.15s;
  width: 75%;
}
.sk-card .sk-title.short { width: 55%; }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@media (max-width: 768px) {
  .sk-card { flex: 0 0 150px; }
}
@media (max-width: 480px) {
  .sk-row { gap: 0.8rem; }
  .sk-card { flex: 0 0 120px; }
  .sk-card .sk-title { height: 11px; margin-top: 8px; }
}

/* ---------- Barre de progression ---------- */
#loading-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  background: var(--accent);
  z-index: 100;
  width: 100%;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
#loading-bar.active {
  opacity: 0.5;
  animation: lbPulse 1.4s ease-in-out infinite;
}
@keyframes lbPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.15; }
}

/* ---------- Fade d'entrée du contenu (quand l'API répond) ---------- */
.content-in { animation: contentIn 0.25s ease; }
@keyframes contentIn {
  from { opacity: 0.3; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Lecteur: barre haute (titre + fermer), scrim descendant ---------- */
.player-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 63; /* au-dessus de la vidéo (z 50), aligné sur .player-controls */
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: max(0.8rem, env(safe-area-inset-top)) 1.2rem 2.4rem;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent);
  transition: opacity 0.25s ease;
}
.player-top .pc-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.player.pc-hidden .player-top {
  opacity: 0;
  pointer-events: none;
}
.pc-spacer { flex: 1; }

/* pastille ±10 s du double-tap */
.seek-fb {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 63;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-full);
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  animation: seekPop 0.65s ease forwards;
}
.seek-fb.left { left: 10%; }
.seek-fb.right { right: 10%; }
@keyframes seekPop {
  from { opacity: 0; scale: 0.85; }
  30% { opacity: 1; scale: 1; }
  to { opacity: 0; }
}

/* ---------- "À suivre" (lecture auto épisode suivant) ---------- */
.upnext {
  position: absolute;
  right: 1rem;
  bottom: max(7rem, calc(env(safe-area-inset-bottom) + 4rem));
  z-index: 63; /* au-dessus de la vidéo (z 50) — à 5 la carte était invisible */
  display: flex;
  gap: 0.8rem;
  align-items: center;
  max-width: min(380px, calc(100% - 2rem));
  padding: 0.7rem;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: var(--blur);
  -webkit-backdrop-filter: var(--blur);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}
.upnext img {
  width: 110px;
  height: auto;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: 8px;
  background: #0a0a0a;
}
.upnext-info { min-width: 0; }
.upnext-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--muted);
}
#upnext-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0.15rem 0 0.55rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.upnext-actions { display: flex; gap: 0.5rem; }
/* focus clavier visible (souris/tap: rien) — remplace le outline:none global */
:where(button, a, [tabindex]):focus-visible {
  outline: 2px solid #e50914;
  outline-offset: 2px;
}
/* tap mobile: pas de délai 300 ms ni de zoom accidentel sur les contrôles */
button, a, .card, .ep, .pill { touch-action: manipulation; }
/* accessibilité: animations neutralisées quand le système le demande */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
