/* =========================================================
   Chill Time — thème "Nuit & Or"
   Noir profond + or (#e9b949) · minimaliste, à plat
   ========================================================= */

:root {
  --bg: #0b0b0c;             /* noir profond */
  --surface: #161617;
  --surface-2: #1e1e20;
  --surface-3: #2a2a2d;
  --border: #29292c;
  --text: #f4f4ef;           /* blanc cassé */
  --muted: #8c8c88;
  --muted-2: #5c5c5e;

  --primary: #e9b949;        /* or */
  --primary-hover: #f2ca63;
  --primary-soft: rgba(233, 185, 73, .14);

  --accent: #e9b949;         /* or (identité unifiée) */
  --accent-hover: #f2ca63;
  --accent-soft: rgba(233, 185, 73, .14);

  --success: #4ac57e;
  --success-soft: rgba(74, 197, 126, .14);

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 16px 40px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html { height: 100%; }
body { min-height: 100%; }   /* pas height:100% : sinon la topbar sticky décroche au scroll */

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Icônes */
.ic { display: block; }
[data-ic] { display: inline-flex; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 26px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 11, 12, .82);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 40;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  display: grid; place-items: center;
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
}
.logo .ic path[stroke="#f5a524"] { color: var(--accent); }
.brand h1 { margin: 0; font-size: 20px; letter-spacing: .3px; font-weight: 800; }
.tagline { margin: 0; font-size: 12px; color: var(--muted); }

.search-wrap {
  flex: 1; min-width: 240px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color .15s;
}
.search-wrap:focus-within { border-color: var(--primary); }
.search-ic { color: var(--muted); display: flex; }
.search-wrap input {
  flex: 1; padding: 12px 0; border: none; background: transparent;
  color: var(--text); font-size: 15px; outline: none;
}
.search-wrap input::placeholder { color: var(--muted-2); }

.toolbar { display: flex; gap: 8px; align-items: center; }

/* Zone compte / synchro */
.auth { display: flex; align-items: center; gap: 8px; }
.auth-btn { padding: 9px 12px; }
.user-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 6px; border: 1px solid var(--border); border-radius: 22px;
  background: var(--surface); font-size: 13px; font-weight: 600; color: var(--text);
}
.user-chip img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.user-chip .ic { color: var(--muted); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); flex-shrink: 0; }
.user-chip.local { cursor: pointer; color: var(--muted); }
.user-chip.local .ic { color: var(--muted); }
.user-chip.local:hover { border-color: var(--primary); }

/* Astuce films dans la recherche */
.search-hint {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: 11px; font-size: 13px;
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(233,185,73,.3);
}
.search-hint .ic { width: 15px; height: 15px; flex-shrink: 0; }
.ghost {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; border: 1px solid var(--border);
  color: var(--muted); padding: 10px 13px; border-radius: 10px;
  cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
}
.ghost:hover { color: var(--text); border-color: var(--primary); }
.icon-btn { padding: 10px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; padding: 14px 26px 0; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.tab {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent; border: none; color: var(--muted);
  padding: 10px 15px; border-radius: 10px 10px 0 0;
  cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab .ic { width: 17px; height: 17px; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--primary); }

main { padding: 22px 26px 70px; max-width: 1400px; margin: 0 auto; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 700; }

/* ---------- Grid & cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 18px;
}
.card {
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer; position: relative;
  transition: transform .14s ease, box-shadow .14s ease;
  background: var(--surface-2);
}
.card:active { transform: scale(.97); }
.card:hover { box-shadow: var(--shadow); }

.poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; background: var(--surface-2); }
/* Dégradé animé (shimmer) partagé par les placeholders + les affiches en cours de chargement */
.skel-box, .skel-line, .skel-pill, .poster.loading {
  background: linear-gradient(100deg, var(--surface-2) 30%, #2a2a2e 50%, var(--surface-2) 70%);
  background-size: 200% 100%; animation: shimmer 1.2s ease-in-out infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel-box, .skel-line, .skel-pill, .poster.loading { animation: none; } }

/* Cartes squelette (placeholders) — MÊME structure que les vraies cartes pour zéro décalage */
.card.skel { background: var(--surface-2); pointer-events: none; }
.poster.skel-box { display: block; }                    /* garde l'aspect-ratio 2/3 de .poster */
.skel-line { display: block; height: 12px; border-radius: 6px; }
.card-body .skel-line:first-child { margin-bottom: 7px; }
.skel-line.w80 { width: 80%; } .skel-line.w75 { width: 75%; } .skel-line.w60 { width: 60%; }
.skel-line.w50 { width: 50%; } .skel-line.w45 { width: 45%; }
.skel-pill { display: inline-block; height: 13px; width: 42%; border-radius: 6px; }
/* Skeleton "Sorties" : mêmes lignes que .cal-item (vignette 62x35 + 2 lignes de texte) */
.cal-item.skel { pointer-events: none; }
.cal-thumb-skel { width: 62px; height: 35px; border-radius: 6px; flex: none; }
.ci-skel { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.poster.placeholder { display: grid; place-items: center; color: var(--muted-2); }
.poster.placeholder .ic { width: 40px; height: 40px; }
.poster.gen { display: flex; align-items: flex-start; padding: 14px; }
.poster.gen .gen-title { font-size: 15px; font-weight: 800; line-height: 1.25; color: #fff; text-shadow: 0 2px 8px rgba(0,0,0,.5); }

/* Superposition bas d'affiche : dégradé + progression + compteur */
.card-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 8px 8px;
  background: linear-gradient(to top, rgba(0,0,0,.75), transparent);
  pointer-events: none;
}
.ov-bar { height: 4px; border-radius: 3px; background: rgba(255,255,255,.3); overflow: hidden; }
.ov-bar > i { display: block; height: 100%; background: var(--primary); border-radius: 3px; }
.ov-bar.full > i { background: var(--success); }
.ov-count { font-size: 11px; font-weight: 800; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.7); letter-spacing: .2px; }

.card-body { padding: 11px 12px 13px; }
.card-title { font-size: 13.5px; font-weight: 700; margin: 0 0 5px; line-height: 1.25; }
.card-meta { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Banderole "Nouvel épisode" (façon TV Time) : bandeau doré en haut de l'affiche */
.new-ep {
  position: absolute; top: 0; left: 0; right: 0; z-index: 2;
  padding: 4px 6px; text-align: center;
  background: var(--primary); color: #0b0b0c;
  font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
/* Si banderole présente, on descend la pastille de statut pour ne pas la masquer */
.card:has(.new-ep) .badge { top: 30px; }

/* Badge statut = pastille icône (coin haut-gauche) */
.badge {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 6px; border-radius: 50%;
  background: rgba(11, 11, 12, .72); backdrop-filter: blur(4px);
}
.badge .ic { width: 14px; height: 14px; }
.badge.towatch { color: var(--primary-hover); }
.badge.watching { color: var(--accent); }
.badge.done { color: var(--success); }
.badge.dropped { color: var(--muted); }

/* Étiquette "Film" (coin haut-gauche) + état "Vu" */
.type-chip {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 8px; border-radius: 20px; font-size: 11px; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); backdrop-filter: blur(4px);
}
.type-chip .ic { width: 12px; height: 12px; }
.card-meta .seen { color: var(--success); font-weight: 700; }

.progress { height: 5px; background: var(--surface-3); border-radius: 4px; margin-top: 9px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.progress.full > i { background: var(--success); }

.card .quick {
  position: absolute; top: 8px; right: 8px;
  width: 34px; height: 34px; border-radius: 50%;
  border: none; cursor: pointer; color: #201400;
  background: var(--primary); display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.card .quick:hover { background: var(--primary-hover); }
.card .quick.added { background: var(--success); color: #fff; }
.card .quick .ic { width: 18px; height: 18px; }

/* ---------- Empty state ---------- */
.empty { text-align: center; color: var(--muted); padding: 90px 20px; }
.empty .big { display: grid; place-items: center; width: 78px; height: 78px; margin: 0 auto 16px; border-radius: 20px; background: var(--surface); color: var(--primary); }
.empty .big .ic { width: 38px; height: 38px; }
.empty .t { font-size: 16px; color: var(--text); font-weight: 700; margin-bottom: 6px; }
.empty small { color: var(--muted); }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 18px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .72); backdrop-filter: blur(5px); }
.modal-card {
  position: relative; z-index: 2;
  width: min(880px, 100%); max-height: 92vh; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow);
}
/* ---------- Modal "Carte flottante" (Direction C) ---------- */
.modal-hero.floating { position: relative; display: block; padding: 0; border-bottom: 1px solid var(--border); overflow: hidden; }
.hero-banner {
  position: relative; height: 150px; overflow: hidden; background-color: var(--surface-2);
}
.hero-banner-img {
  position: absolute; inset: -28px; background-size: cover; background-position: center;
  filter: blur(20px) brightness(.72); transform: scale(1.05);
}
.hero-banner::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to bottom, rgba(11,11,12,.15) 0%, rgba(11,11,12,.55) 55%, var(--bg) 100%);
}
.hero-sheet {
  position: relative; z-index: 1; margin-top: -32px;
  background: var(--bg); border-radius: 20px 20px 0 0; padding: 0 22px 22px;
}
.hero-lead { display: flex; gap: 14px; align-items: flex-end; }
.hero-poster {
  width: 92px; aspect-ratio: 2/3; margin-top: -48px; flex-shrink: 0;
  border-radius: 12px; border: 2px solid var(--bg); object-fit: cover;
  box-shadow: 0 12px 30px rgba(0,0,0,.5);
}
.hero-poster.gen { padding: 8px; align-items: center; }
.hero-poster.gen .gen-title { font-size: 11px; }
.hero-titles { min-width: 0; padding-bottom: 4px; }
.hero-titles h2 { margin: 0; font-size: 21px; font-weight: 800; line-height: 1.15; }
.hero-author { font-size: 13px; color: #c9c6bd; margin-top: 3px; }
.hero-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.modal-hero .info { min-width: 0; margin-top: 16px; }
.sub { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-2); color: var(--muted); padding: 5px 11px; border-radius: 20px; font-size: 12px; }
.tag .ic { width: 13px; height: 13px; }
.summary { color: #d6d2c6; font-size: 14px; line-height: 1.65; max-height: 140px; overflow-y: auto; }
.info-note {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 12px;
  padding: 10px 12px; border-radius: 10px; font-size: 12.5px; line-height: 1.45;
  background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(233,185,73,.28);
}
.info-note .ic { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; }

.modal-close {
  position: absolute; top: 16px; right: 16px; z-index: 3;
  background: rgba(11,11,12,.7); border: 1px solid var(--border); color: var(--text);
  width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: grid; place-items: center;
}
.modal-close:hover { border-color: var(--primary); }

/* Contrôle segmenté (statut / étagère) */
.segmented {
  display: flex; gap: 4px; margin-top: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 13px; padding: 4px;
}
.segmented button {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 9px 3px; border: none; border-radius: 9px; cursor: pointer;
  background: transparent; color: var(--muted); font-family: inherit;
  font-size: 11px; font-weight: 600; line-height: 1.1; text-align: center;
}
.segmented.seg-search { margin: 12px 0 14px; flex-wrap: wrap; }
.segmented.seg-search button { flex: 1 1 21%; padding: 8px 3px; }
.segmented.seg-search button span { font-size: 10.5px; }

/* ---------- Mascotte "Popy" ---------- */
.mascot {
  position: fixed; right: 12px; bottom: calc(72px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  display: flex; align-items: flex-end; gap: 8px; pointer-events: none;
  opacity: 0; transform: translateY(14px) scale(.92); transition: opacity .3s ease, transform .3s ease;
}
.mascot.show { opacity: 1; transform: none; }
.mascot .mascot-char, .mascot .mascot-bubble, .mascot .mascot-close, .mascot .mascot-cta { pointer-events: auto; }
.mascot-char {
  border: none; background: none; padding: 0; cursor: pointer; line-height: 0;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.5)); animation: mascot-bob 3.2s ease-in-out infinite;
}
.mascot-char:active { transform: scale(.94); }
@keyframes mascot-bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .mascot-char { animation: none; } }
.mascot-bubble {
  position: relative; max-width: 210px; background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 14px; padding: 11px 13px 12px; box-shadow: var(--shadow);
}
.mascot-text { margin: 0; font-size: 13px; line-height: 1.35; font-weight: 600; padding-right: 14px; }
.mascot-close {
  position: absolute; top: 6px; right: 6px; border: none; background: none; cursor: pointer;
  color: var(--muted); display: grid; place-items: center; padding: 2px;
}
.mascot-close:hover { color: var(--text); }
.mascot-cta {
  margin-top: 9px; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  background: var(--primary); color: #201400; border: none; border-radius: 20px;
  padding: 6px 12px; font-family: inherit; font-size: 12px; font-weight: 800;
}
.mascot-cta:hover { background: var(--primary-hover); }
.mascot-cta .ic { width: 14px; height: 14px; }
.segmented button .ic { width: 16px; height: 16px; }
.segmented button.on { background: var(--primary); color: #201400; }
.segmented button.on[data-k="watching"] { background: var(--accent); color: #201400; }
.segmented button.on[data-k="done"] { background: var(--success); color: #032015; }
.segmented button.on[data-k="dropped"] { background: var(--surface-3); color: var(--text); }

/* Grand bouton d'action (fiches film / livre) */
.btn-primary {
  width: 100%; margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px; border: none; border-radius: 13px; cursor: pointer;
  background: var(--primary); color: #201400; font-family: inherit; font-size: 15px; font-weight: 700;
}
.btn-primary .ic { width: 18px; height: 18px; }
.btn-primary.done { background: var(--success); color: #032015; }
.btn-primary:active { transform: scale(.98); }

/* Rangée secondaire (favori + retirer) */
.side-row { display: flex; gap: 8px; margin-top: 10px; }
.side-row button {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 14px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 600; font-family: inherit;
}
.side-row button .ic { width: 15px; height: 15px; }
.side-row button:hover { border-color: var(--primary); }
.side-row button.danger { margin-left: auto; color: var(--muted); }
.side-row button.danger:hover { border-color: #ef4444; color: #ef4444; }

/* Note de la source (lecture seule) : 5 étoiles remplies au prorata + valeur /10 */
.rating-src { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.rs-stars { position: relative; display: inline-flex; }
.rs-empty, .rs-fill { display: flex; gap: 3px; }
.rs-empty { color: var(--surface-3); }
.rs-empty svg, .rs-fill svg { fill: currentColor; }
.rs-fill { position: absolute; inset: 0; overflow: hidden; white-space: nowrap; color: var(--accent); }
.rs-stars .ic { width: 20px; height: 20px; }
.rs-num { font-size: 16px; font-weight: 800; color: var(--text); }
.rs-num::after { content: " /10"; font-size: 12px; font-weight: 600; color: var(--muted); }
.rating-src.empty .rs-none { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.rating-src.empty .rs-none .ic { width: 15px; height: 15px; }

.note-area {
  width: 100%; margin-top: 12px; padding: 11px 13px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  resize: vertical; min-height: 58px; font-family: inherit; font-size: 13px; line-height: 1.5;
}
.note-area:focus { outline: none; border-color: var(--primary); }

/* ---------- Fenêtre de connexion ---------- */
.auth-card {
  position: relative; z-index: 2;
  width: min(400px, 100%);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 20px; box-shadow: var(--shadow); padding: 30px 26px 24px;
}
.auth-head { text-align: center; margin-bottom: 20px; }
.auth-logo { display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.auth-logo .ic path[stroke="#f5a524"] { color: var(--accent); }
.auth-head h2 { margin: 0 0 4px; font-size: 20px; font-weight: 800; }
.auth-head p { margin: 0; font-size: 13px; color: var(--muted); }

.google-btn {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px; border-radius: 11px; border: 1px solid var(--border);
  background: #fff; color: #1f1f1f; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.google-btn:hover { background: #f2f2f2; }

.auth-sep { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--muted-2); font-size: 12px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-form input {
  padding: 12px 14px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 14px; font-family: inherit; outline: none;
}
.auth-form input:focus { border-color: var(--primary); }
.auth-submit {
  margin-top: 4px; padding: 12px; border-radius: 11px; border: none; cursor: pointer;
  background: var(--primary); color: #201400; font-size: 14px; font-weight: 700; font-family: inherit;
}
.auth-submit:hover { background: var(--primary-hover); }
.auth-submit:disabled { opacity: .6; cursor: default; }

.auth-msg { font-size: 12.5px; padding: 9px 12px; border-radius: 9px; line-height: 1.45; }
.auth-msg.err { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.3); }
.auth-msg.ok { background: var(--success-soft); color: #6ee7b7; border: 1px solid rgba(52,211,153,.3); }

.auth-toggle { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.auth-toggle button { background: none; border: none; color: var(--primary-hover); font-weight: 700; cursor: pointer; font-family: inherit; font-size: 13px; }
.auth-toggle button:hover { text-decoration: underline; }

/* Page de connexion plein écran */
.auth-gate {
  position: fixed; inset: 0; z-index: 90;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  padding: 24px;
  background: var(--bg);
}
.auth-gate-brand { display: flex; align-items: center; gap: 14px; }
.auth-gate-brand #gateLogo { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; background: var(--primary-soft); color: var(--primary); }
.auth-gate-brand #gateLogo .ic path[stroke="#f5a524"] { color: var(--accent); }
.auth-gate-brand h1 { margin: 0; font-size: 26px; font-weight: 800; letter-spacing: .3px; }
.auth-gate-brand p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.auth-gate .auth-card { box-shadow: var(--shadow); }

/* ---------- Next episode banner ---------- */
.next-ep {
  margin: 18px 24px 0; padding: 14px 16px; border-radius: 12px;
  background: var(--primary-soft); border: 1px solid var(--border);
  font-size: 13px; display: flex; flex-direction: column; gap: 8px;
}
.next-ep .line { display: flex; align-items: center; gap: 9px; }
.next-ep .line .ic { width: 16px; height: 16px; flex-shrink: 0; }
.next-ep .line.watch { color: var(--accent); }
.next-ep .line.up { color: var(--primary-hover); }
.next-ep .line.done { color: var(--success); }
.next-ep b { color: var(--text); }

/* ---------- Episodes ---------- */
.eps { padding: 20px 24px 24px; }
.eps h3 { margin: 0 0 14px; font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 9px; }
.eps h3 .ic { color: var(--primary); }
.season { margin-bottom: 12px; }
.season-head {
  display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none;
  padding: 11px 13px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
}
.season-head:hover { border-color: var(--primary); }
.season-head .chev { color: var(--muted); transition: transform .18s; }
.season-head.open .chev { transform: rotate(180deg); }
.season-title { font-weight: 700; font-size: 14px; flex: 1; }
.season-count { font-size: 12px; color: var(--muted); }
.season-mark {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; background: transparent; border: 1px solid var(--border);
  color: var(--muted); padding: 5px 10px; border-radius: 8px; cursor: pointer; font-family: inherit;
}
.season-mark .ic { width: 13px; height: 13px; }
.season-mark:hover { color: var(--text); border-color: var(--accent); }

.ep-list { margin-top: 6px; display: flex; flex-direction: column; gap: 2px; }
.ep {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 9px;
}
.ep:hover { background: var(--surface); }
.ep-check {
  width: 22px; height: 22px; flex-shrink: 0; border-radius: 7px; cursor: pointer;
  border: 1.5px solid var(--border); background: transparent; display: grid; place-items: center; color: transparent;
}
.ep-check:hover { border-color: var(--primary); }
.ep.watched .ep-check { background: var(--success); border-color: var(--success); color: #032015; }
.ep-check .ic { width: 14px; height: 14px; }

.ep-thumb {
  width: 72px; height: 41px; flex-shrink: 0; border-radius: 7px; object-fit: cover;
  background: var(--surface-2); display: block;
}
.ep-thumb.placeholder { display: grid; place-items: center; color: var(--muted-2); }
.ep-thumb.placeholder .ic { width: 18px; height: 18px; }

.ep-info { flex: 1; min-width: 0; }
.ep-num { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .3px; }
.ep-name { font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ep-date { font-size: 12px; color: var(--muted); flex-shrink: 0; }
.ep.unaired .ep-name { color: var(--muted); font-style: italic; }
.ep.watched .ep-name { color: var(--muted); }

/* ---------- Calendar ---------- */
.cal-day { margin-bottom: 22px; grid-column: 1 / -1; }
.cal-date { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 10px; text-transform: capitalize; display: flex; align-items: center; gap: 8px; }
.cal-date .ic { width: 15px; height: 15px; }
.cal-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 7px; cursor: pointer; }
.cal-item:hover { border-color: var(--primary); }
.cal-item img { width: 62px; height: 35px; object-fit: cover; border-radius: 6px; }
.cal-item .poster-mini { width: 34px; height: 48px; object-fit: cover; border-radius: 6px; }
.cal-show { font-weight: 700; font-size: 14px; }
.cal-ep { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ---------- Confirmation ---------- */
.confirm-card {
  position: relative; z-index: 2;
  width: min(380px, 100%); text-align: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 18px; box-shadow: var(--shadow); padding: 26px 24px 22px;
}
.confirm-ic {
  display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 14px;
  border-radius: 13px; background: var(--primary-soft); color: var(--primary);
}
.confirm-ic.danger { background: rgba(239,68,68,.14); color: #ef4444; }
.confirm-card h3 { margin: 0 0 6px; font-size: 18px; font-weight: 800; }
.confirm-card p { margin: 0 0 20px; font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.prompt-input {
  width: 100%; margin: 0 0 20px; padding: 12px 14px; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
  color: var(--text); font-size: 15px; font-family: inherit; text-align: center;
}
.prompt-input:focus { outline: none; border-color: var(--primary); }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions button {
  flex: 1; padding: 11px; border-radius: 11px; cursor: pointer;
  font-size: 14px; font-weight: 700; font-family: inherit; border: 1px solid var(--border);
}
.confirm-cancel { background: var(--surface); color: var(--text); }
.confirm-cancel:hover { border-color: var(--primary); }
.confirm-ok { background: var(--primary); color: #201400; border-color: transparent; }
.confirm-ok:hover { background: var(--primary-hover); }
.confirm-ok.danger { background: #ef4444; color: #fff; }
.confirm-ok.danger:hover { background: #f05252; }

/* ---------- Espace Compte / Profil ---------- */
.profile-head { text-align: center; padding: 12px 0 22px; }
.profile-avatar {
  width: 84px; height: 84px; border-radius: 50%; margin: 0 auto 12px;
  display: grid; place-items: center; overflow: hidden;
  background: var(--primary-soft); color: var(--primary);
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.profile-name { font-size: 20px; font-weight: 800; }
.profile-email { font-size: 13px; color: var(--muted); margin-top: 3px; }
/* Identifiant unique (copiable) — puce dorée sous le nom */
.profile-code {
  display: inline-flex; align-items: center; gap: 5px; margin: 8px auto 0;
  padding: 5px 11px; border-radius: 20px; cursor: pointer;
  background: var(--primary-soft); color: var(--primary);
  border: 1px solid rgba(233,185,73,.3); font-family: inherit;
  font-size: 13px; font-weight: 800; letter-spacing: .5px;
}
.profile-code:hover { background: var(--accent-soft); border-color: var(--primary); }
.profile-code .ic { width: 13px; height: 13px; }
.profile-code .ic:last-child { opacity: .6; }
/* Bannière de profil (image choisie) + avatar qui remonte dessus */
.profile-head.has-banner { padding-top: 0; }
.profile-banner {
  height: 130px; margin: 0 -14px 0; background-size: cover; background-position: center;
  border-radius: 0 0 16px 16px; position: relative;
}
.profile-banner::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 40%, var(--bg)); border-radius: inherit; }
.profile-head.has-banner .profile-avatar { margin-top: -46px; position: relative; z-index: 1; border: 3px solid var(--bg); }

/* Sélecteur d'image (avatar / bannière) */
.picker { padding: 4px 2px 8px; }
.picker-head { display: flex; align-items: center; gap: 8px; margin: 2px 2px 12px; }
.picker-head h3 { margin: 0; font-size: 17px; font-weight: 800; }
.picker-head .ic { width: 18px; height: 18px; color: var(--primary); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; margin-top: 12px; max-height: 60vh; overflow-y: auto; }
.pick-item { padding: 0; border: 1px solid var(--border); background: var(--surface-2); border-radius: 10px; overflow: hidden; cursor: pointer; aspect-ratio: 2/3; }
.pick-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pick-item:hover { border-color: var(--primary); }
.pick-item:active { transform: scale(.96); }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 6px; text-align: center; }
.stat b { display: block; font-size: 22px; font-weight: 800; }
.stat span { font-size: 11px; color: var(--muted); }

/* Statistiques riches (façon TV Time) — carrousel horizontal (swipe) */
.section-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 6px 2px 12px; }
.section-title .ic { width: 14px; height: 14px; }
.stats-big {
  display: flex; gap: 12px; margin: 0 0 16px; padding: 2px 0 6px;
  overflow-x: auto; scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.stats-big::-webkit-scrollbar { display: none; }
.stat-big {
  flex: 0 0 auto; min-width: 150px; scroll-snap-align: start;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; gap: 6px;
}
.stat-big .ic { color: var(--primary); }
.stat-big .sb-label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stat-big .sb-val { font-size: 22px; font-weight: 800; line-height: 1.1; white-space: nowrap; }
.stats-mini { display: flex; justify-content: space-around; gap: 8px; margin-bottom: 22px; color: var(--muted); font-size: 13px; }
.stats-mini b { color: var(--text); font-weight: 800; }

/* Bouton favori dans les fiches */
.fav-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.fav-btn.on .ic { fill: var(--accent); }

/* Listes d'options (profil + paramètres) */
.menu-list, .settings-group { display: flex; flex-direction: column; gap: 8px; margin-bottom: 22px; }
.group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--muted-2); margin: 4px 4px 4px; }
.menu-row {
  width: 100%; display: flex; align-items: center; gap: 14px; text-align: left;
  padding: 15px 16px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; font-family: inherit;
  font-size: 15px; font-weight: 600;
}
.menu-row:hover { background: var(--surface-2); }
.menu-row .ic:first-child { flex-shrink: 0; color: var(--muted); }
.menu-row.accent .ic:first-child { color: var(--accent); }
.menu-row.danger { color: #f87171; }
.menu-row.danger .ic:first-child { color: #f87171; }
.menu-row > span { flex: 1; }
.menu-row .ic:last-child { color: var(--muted-2); width: 18px; height: 18px; }
.menu-row em { font-style: normal; font-size: 13px; color: var(--muted); font-weight: 500; }
.menu-row.static { cursor: default; }
.menu-row.static:hover { background: var(--surface); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); z-index: 200;
  font-size: 14px; display: flex; align-items: center; gap: 9px;
}
.toast .ic { color: var(--success); width: 18px; height: 18px; }

.footer { text-align: center; color: var(--muted); font-size: 12px; padding: 22px; border-top: 1px solid var(--border); }

/* ---------- Loader ---------- */
.loader { grid-column: 1 / -1; text-align: center; padding: 50px; color: var(--muted); }
.spinner { width: 34px; height: 34px; border: 3px solid var(--surface-3); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Fiche livre (Goodreads-like) ---------- */
.book-author { font-size: 14px; color: var(--muted); margin: -4px 0 10px; }
.read-prog { margin-top: 14px; }
.read-prog:empty { margin: 0; }
.rp-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 6px; }
.rp-top b { color: var(--primary); }
.rp-bar { height: 6px; background: var(--surface-3); border-radius: 4px; overflow: hidden; margin-bottom: 10px; }
.rp-bar > i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.rp-range { width: 100%; accent-color: var(--primary); cursor: pointer; }
/* Sections du Calendrier + "Nouveautés de tes auteurs" */
.cal-section { grid-column: 1 / -1; }
.author-group { margin-bottom: 18px; }
.ag-name { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.ag-name .ic { color: var(--primary); width: 15px; height: 15px; }

.author-books { padding-top: 6px; }
.author-books h3 { display: flex; align-items: center; gap: 9px; }
.author-books h3 .ic { color: var(--primary); }
.ab-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.ab-row::-webkit-scrollbar { display: none; }
.ab-card { flex: 0 0 auto; width: 92px; cursor: pointer; }
.ab-card img { width: 92px; height: 138px; object-fit: cover; border-radius: 9px; background: var(--surface-2); display: block; }
.ab-card:active { transform: scale(.96); }
.ab-title { font-size: 11.5px; margin-top: 6px; line-height: 1.25; color: var(--muted); overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

.hidden { display: none !important; }

/* =======================================================
   APP MOBILE — layout façon appli (barre du bas, plein écran)
   Priorité au mobile ; ajustements desktop plus bas.
   ======================================================= */

body {
  padding-bottom: calc(66px + env(safe-area-inset-bottom));
  overscroll-behavior-y: none;
}

/* Topbar compacte */
.topbar {
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  justify-content: space-between;
}
.topbar .brand { gap: 9px; min-width: 0; }
.topbar .logo { width: 36px; height: 36px; }
#viewTitle { margin: 0; font-size: 18px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .toolbar { gap: 6px; flex-shrink: 0; }
.icon-btn { padding: 9px; }
.user-chip span:not(.sync-dot) { display: none; }   /* que l'avatar sur mobile */
.user-chip { padding: 6px; gap: 5px; }

main { padding: 12px 14px 0; max-width: 900px; margin: 0 auto; }
.view { animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* Filtres (chips) */
.filters {
  display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 12px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.filters::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 8px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700;
  font-family: inherit; cursor: pointer; flex-shrink: 0;
}
.chip .ic { width: 14px; height: 14px; }
.chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Grille : 3 colonnes sur mobile */
.grid { grid-template-columns: repeat(3, 1fr); gap: 9px; }

/* Recherche (vue) */
#searchView .search-wrap { margin-bottom: 14px; }
#searchHint { padding: 30px 16px; }

/* Barre de navigation du bas */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: flex; justify-content: space-around; align-items: stretch;
  background: rgba(11, 11, 12, .92); backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--muted-2); padding: 9px 0 8px;
}
.nav-btn .ic { width: 23px; height: 23px; }
.nav-btn b { font-size: 10px; font-weight: 600; letter-spacing: .2px; }
.nav-btn.active { color: var(--primary); }
.nav-search .ic { width: 26px; height: 26px; }
.nav-btn.nav-search.active { color: var(--accent); }
.nav-btn:active { transform: scale(.92); }

/* Fiche détail = plein écran (bottom sheet) sur mobile */
@media (max-width: 640px) {
  #modal { padding: 0; align-items: stretch; }
  #modal .modal-card {
    width: 100%; height: 100%; max-height: 100%; border-radius: 0;
    animation: slideup .22s ease;
  }
  @keyframes slideup { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
  #modal .hero-banner { height: calc(150px + env(safe-area-inset-top)); }
  #modal .hero-sheet { padding-left: 20px; padding-right: 20px; }
  .summary { font-size: 13.5px; }
  .eps, .next-ep { margin-left: 0; margin-right: 0; }
  .modal-card .eps { padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
}

/* Desktop / large : on garde l'esprit appli, barre du bas centrée */
@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .bottom-nav {
    left: 50%; transform: translateX(-50%); right: auto;
    width: 460px; border-radius: 18px 18px 0 0; border: 1px solid var(--border); border-bottom: none;
  }
  .user-chip span:not(.sync-dot) { display: inline; }
}


/* ---------- Tableau de bord Admin ---------- */
.admin-card {
  position: relative; z-index: 2; width: min(560px, 94vw);
  max-height: 86vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.admin-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
}
.admin-head h3 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.admin-head h3 .ic { color: var(--primary); }
.admin-close {
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 4px; border-radius: 8px;
}
.admin-close:hover { color: var(--text); background: rgba(255,255,255,.06); }
.admin-body { padding: 14px 16px; overflow-y: auto; }
.admin-loading { text-align: center; color: var(--muted); padding: 30px 10px; }
.admin-stat { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.admin-stat b { color: var(--primary); font-size: 15px; }
.admin-user {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; background: rgba(255,255,255,.02);
}
.au-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.au-top b { font-size: 15px; }
.au-top span { color: var(--primary); font-size: 13px; white-space: nowrap; }
.au-mail { color: var(--muted); font-size: 12px; margin-top: 2px; word-break: break-all; }
.au-recent { color: var(--text); font-size: 12px; margin-top: 6px; opacity: .8;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.au-meta { color: var(--muted); font-size: 11px; margin-top: 6px; }
.au-actions { display: flex; gap: 8px; margin-top: 10px; }
.au-btn {
  flex: 1; padding: 8px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.05); border: 1px solid var(--border); color: var(--text);
  font-size: 13px;
}
.au-btn:hover { background: rgba(255,255,255,.1); }
.au-btn.danger { color: #ff6b6b; border-color: rgba(255,107,107,.35); }
.au-btn.danger:hover { background: rgba(255,107,107,.12); }
.menu-row.loading { opacity: .6; pointer-events: none; }

/* ---------- Sélecteur de langue (Réglages) ---------- */
.lang-row { display: flex; gap: 8px; padding: 4px 2px; }
.lang-btn {
  flex: 1; padding: 10px 8px; border-radius: 10px; cursor: pointer;
  background: rgba(255,255,255,.04); border: 1px solid var(--border); color: var(--text);
  font-size: 14px;
}
.lang-btn:hover { background: rgba(255,255,255,.08); }
.lang-btn.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 600; }
