/* ==========================================================
   Médiathèque — feuille de style
   Contrainte de fond : lisible à 3 m sur une TV, utilisable
   à la souris sur un Mac, au doigt sur un téléphone.
   Aucune webfont : le lecteur doit démarrer sans réseau.
   ========================================================== */

/* L'attribut `hidden` doit toujours l'emporter. Sans cette regle, toute classe
   qui declare un `display` (flex, grid, block...) le neutralise silencieusement :
   #player-message, en position fixed, z-index 40 et fond opaque a 94 %, restait
   affiche par-dessus le lecteur et interceptait tous les clics sur les
   controles. Meme cause pour #topbar et #load-more. */
[hidden] { display: none !important; }

:root {
  --ink:        #0E1116;   /* fond, noir légèrement bleuté */
  --ink-2:      #161C25;   /* surfaces */
  --ink-3:      #1F2733;   /* surfaces au repos */
  --brass:      #E0A33E;   /* accent : la lumière du projecteur */
  --brass-dim:  #8C6524;
  --paper:      #EDE8DF;   /* texte, blanc cassé chaud */
  --muted:      #8B94A4;
  --danger:     #E06C5B;

  --gap:        clamp(12px, 2vw, 24px);
  --radius:     10px;
  --focus-ring: 0 0 0 3px var(--brass), 0 12px 40px rgba(0,0,0,.6);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font);
  font-size: clamp(15px, 1.15vw, 19px);
  line-height: 1.5;
  overscroll-behavior: none;
}

/* Les titres portent l'identité : capitales serrées, poids fort.
   Sans webfont, le caractère vient du traitement, pas de la fonte. */
h1, h2, h3 {
  margin: 0;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: .72em;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--brass);
}

/* ---------------------------------------------------- écrans */

.screen { display: none; padding: var(--gap); padding-top: 84px; min-height: 100%; }
.screen.is-active { display: block; }
.screen-player { padding: 0; background: #000; }

/* ---------------------------------------------------- connexion */

#screen-login { display: none; place-items: center; padding-top: var(--gap); }
#screen-login.is-active { display: grid; }

.login-box {
  width: min(420px, 100%);
  padding: clamp(24px, 4vw, 40px);
  background: var(--ink-2);
  border: 1px solid var(--ink-3);
  border-radius: var(--radius);
}
.login-title { font-size: 2em; margin-bottom: 24px; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 6px; font-size: .85em; color: var(--muted); }
.field input {
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--ink-3);
  border-radius: 8px;
}
.field input:focus { outline: none; border-color: var(--brass); box-shadow: 0 0 0 3px rgba(224,163,62,.25); }

.form-error { margin: 0 0 14px; color: var(--danger); font-size: .9em; }

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

.btn {
  font: inherit;
  font-weight: 600;
  color: var(--paper);
  background: var(--ink-3);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 20px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}
.btn:hover { background: #2A3441; }
.btn-primary { width: 100%; background: var(--brass); color: #1A1204; }
.btn-primary:hover { background: #F0B554; }
.btn-ghost { background: transparent; border-color: var(--ink-3); }
.btn-round { width: 54px; height: 54px; padding: 0; border-radius: 50%; }
.btn-play { width: 64px; height: 64px; font-size: 1.3em; background: var(--brass); color: #1A1204; }

/* Anneau de focus unique pour souris, clavier et télécommande.
   C'est le repère principal sur TV : il doit être impossible à rater. */
:focus-visible,
.is-focused {
  outline: none;
  box-shadow: var(--focus-ring);
  z-index: 2;
}
.card.is-focused { transform: scale(1.06); }

/* ---------------------------------------------------- barre du haut */

#topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  padding: 12px var(--gap);
  background: linear-gradient(to bottom, rgba(14,17,22,.98), rgba(14,17,22,.72) 70%, transparent);
  backdrop-filter: blur(8px);
}
.topbar-back {
  font: inherit; font-size: 1.3em; line-height: 1;
  width: 44px; height: 44px; flex: none;
  color: var(--paper); background: transparent;
  border: 1px solid var(--ink-3); border-radius: 8px; cursor: pointer;
}
.tabs { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  font: inherit; font-weight: 600; white-space: nowrap;
  padding: 10px 16px; border-radius: 8px; cursor: pointer;
  color: var(--muted); background: transparent; border: 1px solid transparent;
}
.tab.is-current { color: var(--paper); background: var(--ink-2); border-color: var(--ink-3); }
.topbar-right { display: flex; gap: 8px; align-items: center; }
.search {
  font: inherit; width: clamp(120px, 22vw, 240px);
  padding: 10px 14px; color: var(--paper);
  background: var(--ink-2); border: 1px solid var(--ink-3); border-radius: 8px;
}
.search:focus { outline: none; border-color: var(--brass); }

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

.row { margin-bottom: clamp(24px, 4vw, 44px); }
.row-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.row-head h2 { font-size: 1.25em; }
.row-strip {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: clamp(140px, 16vw, 210px);
  gap: var(--gap);
  overflow-x: auto; scroll-behavior: smooth;
  padding: 6px 2px 14px;
  scrollbar-width: none;
}
.row-strip::-webkit-scrollbar { display: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(clamp(130px, 15vw, 190px), 1fr));
  gap: var(--gap);
}

/* ---------------------------------------------------- vignettes */

.card {
  display: block; width: 100%; padding: 0; text-align: left;
  background: none; border: none; color: inherit; cursor: pointer;
  font: inherit;
  transition: transform .16s ease, box-shadow .16s ease;
  border-radius: var(--radius);
}
.card:hover { transform: scale(1.04); }

.card-art {
  position: relative;
  aspect-ratio: 2 / 3;
  background: var(--ink-2);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-art.is-wide { aspect-ratio: 16 / 9; }
.card-art img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Repli quand TMDB n'a pas d'affiche : les initiales, pas une icône générique */
.card-fallback {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  padding: 10px; text-align: center;
  font-size: 1.5em; font-weight: 800; letter-spacing: -.02em;
  color: var(--brass-dim);
  background: linear-gradient(160deg, var(--ink-3), var(--ink-2));
}

/* Signature : le trait de reprise, ancré au bas de l'affiche.
   Il dit d'un coup d'œil où tu en es, sans texte. */
.card-progress {
  position: absolute; left: 0; right: 0; bottom: 0; height: 4px;
  background: rgba(0,0,0,.55);
}
.card-progress i { display: block; height: 100%; background: var(--brass); }

.card-title {
  margin: 8px 2px 0;
  font-size: .92em; font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-sub { margin: 2px 2px 0; font-size: .78em; color: var(--muted); }

/* ---------------------------------------------------- bibliothèque */

.library-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.library-head h2 { font-size: 1.7em; }
.sorts { display: flex; gap: 6px; }
.sort {
  font: inherit; font-size: .85em; padding: 8px 14px; cursor: pointer;
  color: var(--muted); background: transparent;
  border: 1px solid var(--ink-3); border-radius: 999px;
}
.sort.is-current { color: #1A1204; background: var(--brass); border-color: var(--brass); }
.load-more { display: block; margin: 28px auto 0; }

/* ---------------------------------------------------- fiche */

.hero { position: relative; margin: -84px calc(var(--gap) * -1) 28px; padding: 100px var(--gap) 28px; }
.hero-art { position: absolute; inset: 0; overflow: hidden; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; opacity: .32; }
.hero-art::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--ink) 6%, rgba(14,17,22,.6) 55%, rgba(14,17,22,.85));
}
.hero-body { position: relative; max-width: 62ch; }
.hero-body h2 { font-size: clamp(1.9em, 4.5vw, 3em); margin-bottom: 10px; }
.meta { margin: 0 0 14px; color: var(--muted); font-size: .9em; }
.meta span + span::before { content: '·'; margin: 0 8px; }
.overview { margin: 0 0 22px; max-width: 60ch; color: #C9CFDA; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.season { margin-bottom: 28px; }
.season h3 { font-size: 1.1em; margin-bottom: 10px; }

.track {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 12px 14px; margin-bottom: 6px; text-align: left;
  font: inherit; color: inherit; cursor: pointer;
  background: var(--ink-2); border: 1px solid transparent; border-radius: 8px;
}
.track:hover { background: var(--ink-3); }
.track-no { flex: none; width: 2.4em; font-variant-numeric: tabular-nums; color: var(--muted); }
.track-body { flex: 1; min-width: 0; }
.track-title { font-weight: 600; }
.track-sub {
  font-size: .82em; color: var(--muted);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.track-time { flex: none; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85em; }

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

#video { width: 100%; height: 100vh; height: 100dvh; background: #000; display: block; }

.overlay {
  position: fixed; inset: 0; z-index: 30;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--gap);
  background: linear-gradient(to bottom, rgba(0,0,0,.75), transparent 22%, transparent 62%, rgba(0,0,0,.88));
  opacity: 1; transition: opacity .25s ease;
}
.overlay.is-hidden { opacity: 0; pointer-events: none; }
.overlay-top { display: flex; align-items: center; gap: 16px; }
.overlay-top p { margin: 0; font-weight: 600; font-size: 1.05em; }
.overlay-bottom { display: flex; flex-direction: column; gap: 14px; }

.scrub { position: relative; height: 6px; border-radius: 3px; background: rgba(255,255,255,.22); cursor: pointer; }
.scrub-fill { height: 100%; width: 0; border-radius: 3px; background: var(--brass); }
.scrub-head {
  position: absolute; top: 50%; left: 0;
  width: 15px; height: 15px; margin: -7.5px 0 0 -7.5px;
  border-radius: 50%; background: var(--brass);
  transition: transform .12s ease;
}
.scrub.is-focused .scrub-head { transform: scale(1.5); }

.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9em; min-width: 4.2em; }
.select {
  font: inherit; font-size: .85em; padding: 10px 12px;
  color: var(--paper); background: var(--ink-2);
  border: 1px solid var(--ink-3); border-radius: 8px; cursor: pointer;
}
.select:empty, .select[hidden] { display: none; }

.player-message {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-content: center; gap: 16px;
  padding: var(--gap); text-align: center;
  background: rgba(14,17,22,.94);
}
.player-message h3 { font-size: 1.4em; }
.player-message p { max-width: 46ch; color: var(--muted); }

/* ---------------------------------------------------- divers */

.empty { padding: 60px 0; text-align: center; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 50;
  transform: translateX(-50%);
  padding: 12px 22px; border-radius: 999px;
  background: var(--ink-2); border: 1px solid var(--ink-3);
  font-size: .9em;
}

.spinner {
  width: 34px; height: 34px; margin: 60px auto;
  border: 3px solid var(--ink-3); border-top-color: var(--brass);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .card:hover, .card.is-focused { transform: none; }
}

/* Zones sûres des TV : beaucoup rognent les bords de l'image */
@media (min-width: 1400px) {
  .screen { padding-left: max(var(--gap), 3vw); padding-right: max(var(--gap), 3vw); }
  #topbar { padding-left: max(var(--gap), 3vw); padding-right: max(var(--gap), 3vw); }
}

/* Extraction des sous-titres : quelques secondes a la premiere demande. */
.subs-loading {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%);
  z-index: 35; padding: 10px 18px; border-radius: 999px;
  background: rgba(14,17,22,.92); border: 1px solid var(--ink-3);
  color: var(--muted); font-size: .95em;
}

/* Le lecteur en plein ecran : la video occupe tout, l'overlay reste au-dessus. */
#screen-player:fullscreen { background: #000; }
#screen-player:fullscreen #video { width: 100%; height: 100%; }
#player-ratio { max-width: 11em; }

/* Le lecteur centre la video quel que soit le format impose. */
.screen-player { display: none; place-items: center; }
.screen-player.is-active { display: grid; }

/* ============================================================ profils / PIN */

.profiles-wrap, .pin-wrap { display: grid; place-items: center; gap: 20px; padding: 8vh 20px; text-align: center; }
.profiles-grid { display: flex; flex-wrap: wrap; gap: 28px; justify-content: center; max-width: 900px; }

.profile-card {
  display: grid; gap: 12px; justify-items: center;
  background: none; border: 0; cursor: pointer; padding: 8px; border-radius: var(--radius);
}
.profile-card:hover .avatar, .profile-card:focus-visible .avatar { transform: scale(1.06); border-color: var(--brass); }
.profile-card span { color: var(--muted); font-size: 1.05em; }
.profile-card:hover span { color: #fff; }

.avatar {
  width: 128px; height: 128px; border-radius: 18px; object-fit: cover;
  background: var(--ink-3); border: 3px solid transparent;
  display: grid; place-items: center;
  font-size: 2.6em; font-weight: 700; color: var(--brass);
  transition: transform .15s ease, border-color .15s ease;
}
.avatar-xl { width: 148px; height: 148px; }
.avatar-sm { width: 44px; height: 44px; border-radius: 10px; font-size: 1.1em; }

.pin-name { font-size: 1.6em; margin: 0; }
.pin-dots { display: flex; gap: 14px; height: 18px; }
.pin-dot { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-3); }
.pin-dot.is-on { background: var(--brass); border-color: var(--brass); }

.pin-pad { display: grid; grid-template-columns: repeat(3, 78px); gap: 14px; }
.pin-key {
  height: 78px; border-radius: 50%; font-size: 1.5em; font-weight: 600;
  background: var(--ink-2); color: #fff; border: 1px solid var(--ink-3); cursor: pointer;
}
.pin-key:hover { background: var(--ink-3); }
.pin-key-alt { font-size: 1.2em; color: var(--muted); }

/* ================================================================== admin */

.admin-title { margin: 0 0 18px; }
.admin-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 24px; border-bottom: 1px solid var(--ink-3); }
.admin-tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  color: var(--muted); padding: 10px 16px; cursor: pointer; font-size: 1em;
}
.admin-tab.is-on { color: #fff; border-bottom-color: var(--brass); }
.admin-panel { display: none; }
.admin-panel.is-on { display: block; }

.admin-row {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px; border: 1px solid var(--ink-3); border-radius: var(--radius);
  background: var(--ink-2); margin-bottom: 10px;
}
.admin-row-main { flex: 1 1 260px; min-width: 0; }
.admin-row-main strong { display: block; }
.admin-row-main small { color: var(--muted); }
.admin-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.admin-form { display: grid; gap: 14px; max-width: 560px; margin-bottom: 28px;
  padding: 18px; border: 1px solid var(--ink-3); border-radius: var(--radius); background: var(--ink-2); }
.admin-form h3 { margin: 0; }
.admin-form label { display: grid; gap: 6px; font-size: .95em; color: var(--muted); }
.admin-form input[type=text], .admin-form input[type=password], .admin-form input[type=number], .admin-form select {
  background: var(--ink); border: 1px solid var(--ink-3); border-radius: 10px;
  color: #fff; padding: 10px 12px; font: inherit; width: 100%;
}
.admin-libs { display: flex; gap: 14px; flex-wrap: wrap; }
.admin-libs label { flex-direction: row; align-items: center; gap: 8px; color: #fff; }

.jauge { height: 10px; border-radius: 5px; background: var(--ink-3); overflow: hidden; min-width: 160px; flex: 1 1 200px; }
.jauge > i { display: block; height: 100%; background: var(--brass); transition: width .4s ease; }

.tmdb-res { display: flex; gap: 12px; align-items: center; padding: 8px;
  border: 1px solid var(--ink-3); border-radius: 10px; margin-bottom: 8px; background: var(--ink); }
.tmdb-res img { width: 46px; height: 69px; object-fit: cover; border-radius: 6px; }
.tmdb-res .t { flex: 1; min-width: 0; }
.tmdb-res small { color: var(--muted); display: block; }

.pastille { padding: 2px 9px; border-radius: 999px; font-size: .78em; background: var(--ink-3); color: var(--muted); }
.pastille-on { background: var(--brass-dim); color: #fff; }

/* Action destructive : rouge sobre, pas criard. */
.btn-danger { background: #3A1D1D; border: 1px solid #6B2B2B; color: #F0B4B4; }
.btn-danger:hover { background: #4A2323; }

/* Mode de navigation actif dans la musique. */
.sorts .btn.is-on { background: var(--ink-3); color: #fff; }

/* ==========================================================================
   Coque : rail lateral + zone principale
   ========================================================================== */

:root { --rail: 268px; --orange: #F2650C; --orange-clair: #FF8A3D; }

.coque { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; min-height: 100dvh; }

.rail {
  position: sticky; top: 0; align-self: start; height: 100vh; height: 100dvh;
  display: flex; flex-direction: column; gap: 8px;
  padding: 26px 18px; background: #0A0C10; border-right: 1px solid #161B22;
}
.rail-logo { display: flex; align-items: center; gap: 12px; padding: 0 10px 26px; }
.rail-mark {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(140deg, var(--orange-clair), var(--orange));
  color: #fff; font-weight: 800; font-size: 1.3em;
}
.rail-nom { font-size: 1.22em; letter-spacing: -.01em; }
.rail-nom b { font-weight: 400; color: var(--muted); }

.rail-nav { display: grid; gap: 4px; }
.rail-lien {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 13px 16px; border-radius: 12px; border: 0; cursor: pointer;
  background: none; color: var(--muted); font: inherit; font-size: 1.04em; text-align: left;
}
.rail-lien:hover { background: #12161D; color: #fff; }
.rail-lien.is-on {
  background: linear-gradient(90deg, rgba(242,101,12,.18), rgba(242,101,12,.04));
  color: #fff; box-shadow: inset 2px 0 0 var(--orange);
}
.rail-ico { width: 22px; text-align: center; font-size: 1.15em; }

.rail-profil {
  margin-top: auto; display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 14px; background: #12161D; border: 1px solid #1B212B;
  color: #fff; cursor: pointer; font: inherit; text-align: left;
}
.rail-profil-txt { display: grid; min-width: 0; }
.rail-profil-txt strong { font-size: .98em; }
.rail-profil-txt small { color: var(--orange); font-size: .82em; }

.zone { min-width: 0; display: flex; flex-direction: column; }
.entete {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; justify-content: space-between;
  padding: 16px 34px; background: linear-gradient(180deg, rgba(10,12,16,.96), rgba(10,12,16,0));
}
.entete-droite { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.entete-btn {
  width: 40px; height: 40px; border-radius: 50%; background: #12161D;
  border: 1px solid #1B212B; color: var(--muted); cursor: pointer; font-size: 1.05em;
}
.entete-btn:hover { color: #fff; }
.horloge { color: var(--muted); font-variant-numeric: tabular-nums; }
.principal { padding: 0 34px 60px; flex: 1; }

/* ------------------------------------------------------------- banniere */

.hero-bandeau {
  position: relative; border-radius: 22px; overflow: hidden;
  min-height: 380px; display: flex; align-items: flex-end; margin-bottom: 34px;
  background: var(--ink-2);
}
.hero-fond { position: absolute; inset: 0; }
.hero-fond img { width: 100%; height: 100%; object-fit: cover; }
.hero-fond::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(8,10,14,.97) 0%, rgba(8,10,14,.82) 38%, rgba(8,10,14,.15) 78%);
}
.hero-texte { position: relative; padding: 44px; max-width: 620px; }
.hero-eyebrow { color: var(--orange); font-size: .8em; letter-spacing: .14em; text-transform: uppercase; margin: 0 0 10px; font-weight: 700; }
.hero-titre { font-size: clamp(2.1em, 4.4vw, 3.5em); line-height: .98; margin: 0 0 14px; text-transform: uppercase; letter-spacing: -.02em; }
.hero-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; color: var(--muted); font-size: .92em; }
.hero-tag { padding: 3px 9px; border: 1px solid #2A313D; border-radius: 6px; font-size: .88em; }
.hero-tag-fort { border-color: var(--orange); color: var(--orange); }
.hero-resume { color: #C8CED8; line-height: 1.5; margin: 0 0 22px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-points { display: flex; gap: 7px; margin-top: 24px; }
.hero-point { width: 26px; height: 4px; border-radius: 2px; background: #2A313D; border: 0; cursor: pointer; padding: 0; }
.hero-point.is-on { background: var(--orange); }

.btn-orange {
  background: var(--orange); color: #fff; border: 0; border-radius: 10px;
  padding: 13px 26px; font: inherit; font-weight: 600; cursor: pointer;
}
.btn-orange:hover { background: var(--orange-clair); }
.btn-sombre {
  background: rgba(255,255,255,.09); color: #fff; border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; padding: 13px 22px; font: inherit; cursor: pointer;
}
.btn-sombre:hover { background: rgba(255,255,255,.16); }

/* --------------------------------------------------------- rangees */

.rangee { margin-bottom: 34px; }
.rangee-titre { display: flex; align-items: baseline; gap: 8px; margin: 0 0 14px; font-size: 1.16em; }
.rangee-lien { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; }
.rangee-lien:hover { color: var(--orange); }
.rangee-defile { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
/* Largeur FIXE des cartes en rangee : toutes identiques, plus grandes,
   et on fait defiler horizontalement (facon Plex). */
.rangee-defile > .card { flex: 0 0 200px; width: 200px; }
.rangee-defile > .card .card-title { white-space: normal; }
.rangee-defile::-webkit-scrollbar { height: 6px; }
.rangee-defile::-webkit-scrollbar-thumb { background: #232A34; border-radius: 3px; }

.carte-reprise {
  position: relative; flex: 0 0 268px; height: 150px; border-radius: 13px;
  overflow: hidden; cursor: pointer; border: 0; padding: 0; background: var(--ink-2);
}
.carte-reprise img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.carte-reprise-voile {
  position: absolute; inset: 0; padding: 14px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(180deg, rgba(8,10,14,.72) 0%, rgba(8,10,14,.25) 45%, rgba(8,10,14,.92) 100%);
  text-align: left;
}
.carte-reprise-titre { font-weight: 700; font-size: 1.02em; line-height: 1.2; text-transform: uppercase; }
.carte-reprise-bas { display: flex; justify-content: space-between; align-items: center; font-size: .85em; color: #C8CED8; }
.carte-reprise-barre { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(255,255,255,.18); }
.carte-reprise-barre > i { display: block; height: 100%; background: var(--orange); }

/* ==========================================================================
   Responsive : mobile & tablette
   Le rail lateral devient une barre de navigation en bas (facon appli).
   ========================================================================== */

@media (max-width: 820px) {
  .coque { grid-template-columns: 1fr; }

  .rail {
    position: fixed; bottom: 0; left: 0; right: 0; top: auto;
    height: auto; width: 100%; z-index: 60;
    flex-direction: row; align-items: center; justify-content: space-around;
    gap: 0; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    border-right: 0; border-top: 1px solid #161B22; background: #0A0C10;
  }
  .rail-logo, .rail-profil-txt { display: none; }
  .rail-profil { margin: 0; padding: 4px; background: none; border: 0; flex: 0 0 auto; }
  .rail-profil .avatar { width: 30px; height: 30px; border-radius: 8px; font-size: .85em; }
  .rail-nav { display: flex; flex: 1; justify-content: space-around; gap: 0; }
  .rail-lien {
    flex-direction: column; gap: 3px; padding: 6px 4px; font-size: .68em;
    border-radius: 10px; text-align: center; box-shadow: none !important;
  }
  .rail-lien.is-on { background: none; color: var(--orange); }
  .rail-lien span:last-child { font-size: 1em; }
  .rail-ico { font-size: 1.35em; }

  .zone { min-height: 100dvh; }
  .entete { padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); }
  .principal { padding: 0 16px calc(84px + env(safe-area-inset-bottom)); }

  .hero-bandeau { min-height: 300px; border-radius: 16px; }
  .hero-texte { padding: 24px; max-width: none; }
  .hero-titre { font-size: clamp(1.6em, 8vw, 2.4em); }
  .hero-resume { display: none; }

  .horloge { display: none; }
  .search { width: 40vw; min-width: 120px; }

  .carte-reprise { flex-basis: 220px; height: 124px; }
  .rangee-defile > .card { flex-basis: 150px; width: 150px; }

  /* grille des bibliotheques : cartes plus petites */
  .grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)) !important; gap: 12px !important; }

  /* profils & PIN : tiennent dans l'ecran */
  .profiles-grid { gap: 16px; }
  .avatar { width: 96px; height: 96px; }
  .avatar-xl { width: 120px; height: 120px; }
  .pin-pad { grid-template-columns: repeat(3, 68px); gap: 12px; }
  .pin-key { height: 68px; }

  /* admin : formulaires pleine largeur */
  .admin-form, .admin-row { max-width: none; }
}

@media (max-width: 420px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)) !important; }
  .rail-lien span:last-child { display: none; }   /* icones seules sur tres petit ecran */
  .rail-ico { font-size: 1.5em; }
}

/* Compte suspendu : visible d'un coup d'oeil dans l'administration */
.pastille-bloque { background: rgba(220, 60, 60, .18); color: #FF9B9B;
  border-color: rgba(220, 60, 60, .45); }
.btn-warn { border-color: rgba(242, 160, 12, .5); color: #FFC978; }
