/* ============================================================
   DVDthèque — style.css
   Thème cinéma sobre. Variables CSS pour dark/light.
   ============================================================ */

:root {
  --bg:        #14181c;
  --bg-2:      #1c2228;
  --surface:   #232a31;
  --surface-2: #2c343c;
  --text:      #eef2f5;
  --text-dim:  #9aa7b2;
  --accent:    #e50914;       /* rouge cinéma */
  --accent-dim:#b00710;
  --border:    #313a43;
  --star:      #f5c518;
  --radius:    14px;
  --tabbar-h:  64px;
  --topbar-h:  54px;
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-size: 16px;
}

[data-theme="light"] {
  --bg:        #f4f6f8;
  --bg-2:      #ffffff;
  --surface:   #ffffff;
  --surface-2: #eef1f4;
  --text:      #161c22;
  --text-dim:  #5d6b78;
  --border:    #dde3e9;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* FIX CRITIQUE : sans cette règle, les éléments .modal/.sheet/.backdrop
   qui ont un display: explicite s'affichent malgré l'attribut hidden,
   ce qui ouvrait l'éditeur par-dessus l'app au démarrage. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  overscroll-behavior: none;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}

/* ---------------- Topbar ---------------- */
#topbar {
  height: calc(var(--topbar-h) + var(--safe-top));
  padding-top: var(--safe-top);
  display: flex; align-items: center; gap: 8px;
  padding-left: 12px; padding-right: 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
#topbar-title {
  font-size: 1.15rem; font-weight: 700; margin: 0;
  flex: 1; text-align: left;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  background: none; border: none; color: var(--text);
  font-size: 1.4rem; padding: 6px 10px; cursor: pointer; border-radius: 8px;
}
.icon-btn:active { background: var(--surface); }

/* ---------------- Searchbar ---------------- */
#searchbar {
  padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--border);
  position: sticky;
  top: calc(var(--topbar-h) + var(--safe-top));
  z-index: 19;
}
#search-input {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 1rem; outline: none;
}

/* ---------------- Views container ---------------- */
#views { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view { padding: 12px 12px calc(var(--tabbar-h) + var(--safe-bottom) + 16px); }

/* ---------------- Toolbar (library) ---------------- */
#library-header {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#library-header .active-filters {
  padding: 0 12px 8px;
  margin-bottom: 0;
}
.format-seg {
  display: flex; gap: 6px;
  padding: 8px 12px;
  background: var(--bg);
}
.toolbar {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap;
  padding: 6px 12px 8px;
  background: var(--bg);
  margin-bottom: 0;
}
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; }
.seg button {
  background: var(--surface); border: none; color: var(--text-dim);
  padding: 7px 12px; font-size: 1rem; cursor: pointer;
}
.seg button.active { background: var(--accent); color: #fff; }
.select {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 10px; font-size: .9rem; cursor: pointer;
}
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 20px; padding: 4px 12px; font-size: .8rem; color: var(--text-dim);
  display: inline-flex; gap: 6px; align-items: center;
}
.chip b { color: var(--text); font-weight: 600; }
.chip .x { cursor: pointer; color: var(--accent); font-weight: 700; }

/* ---------------- Grid / List ---------------- */
.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
.grid.list { grid-template-columns: 1fr; }

.card { cursor: pointer; }
.card .poster {
  width: 100%; aspect-ratio: 2/3; border-radius: var(--radius);
  background: var(--surface-2) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: var(--text-dim); overflow: hidden;
  border: 1px solid var(--border);
}
.card .meta { padding: 6px 2px 0; }
.card .meta .t { font-size: .85rem; font-weight: 600; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .meta .y { font-size: .72rem; color: var(--text-dim); margin-top: 2px; }
.fmt-badge {
  position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.7);
  color: #fff; font-size: .6rem; font-weight: 700; padding: 2px 6px; border-radius: 6px;
  letter-spacing: .5px;
}
.card .poster-wrap { position: relative; }

/* List layout */
.grid.list .card {
  display: flex; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px;
}
.grid.list .poster-wrap { width: 60px; flex: none; }
.grid.list .poster { aspect-ratio: 2/3; font-size: 1.2rem; }
.grid.list .meta { flex: 1; padding: 0; }
.grid.list .meta .t { -webkit-line-clamp: 1; font-size: .95rem; }
.grid.list .meta .sub { font-size: .75rem; color: var(--text-dim); margin-top: 3px; }

/* ---------------- Empty state ---------------- */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty-icon { font-size: 3rem; margin-bottom: 10px; }

/* ---------------- Detail view ---------------- */
.detail-hero {
  position: relative; margin: -12px -12px 0;
  padding: 24px 16px; min-height: 260px;
  display: flex; gap: 16px; align-items: flex-end;
  background-size: cover; background-position: center;
}
.detail-hero::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(to top, var(--bg) 4%, rgba(20,24,28,.55) 60%, rgba(20,24,28,.7));
}
.detail-hero > * { position: relative; z-index: 1; }
.detail-poster {
  width: 110px; aspect-ratio: 2/3; border-radius: 10px; flex: none;
  background: var(--surface-2) center/cover; border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.detail-headline { min-width: 0; flex: 1; }
.detail-headline h2 { margin: 0 0 4px; font-size: 1.3rem; overflow-wrap: break-word; word-break: break-word; }
.detail-headline .orig { color: var(--text-dim); font-size: .85rem; font-style: italic; overflow-wrap: break-word; }
.detail-headline .facts { color: var(--text-dim); font-size: .85rem; margin-top: 6px; overflow-wrap: break-word; }
.detail-section { margin-top: 18px; }
.detail-section h4 { margin: 0 0 8px; font-size: .8rem; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-dim); }
.detail-section p { margin: 0; line-height: 1.5; font-size: .92rem; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-grid .lbl { font-size: .7rem; color: var(--text-dim); text-transform: uppercase; }
.info-grid .val { font-size: .9rem; margin-top: 2px; }

.rating-stars { font-size: 1.5rem; color: var(--border); cursor: pointer; user-select: none; }
.rating-stars .on { color: var(--star); }

.detail-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.detail-actions button { flex: 1; min-width: 90px; }

/* Audio comments */
.audio-list { display: flex; flex-direction: column; gap: 8px; }
.audio-item {
  display: flex; align-items: center; gap: 10px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px;
}
.audio-item .play { font-size: 1.2rem; cursor: pointer; color: var(--accent); }
.audio-item .label { flex: 1; font-size: .85rem; }
.audio-item .dur { font-size: .75rem; color: var(--text-dim); }
.audio-item .del { color: var(--text-dim); cursor: pointer; }
.rec-btn {
  width: 100%; padding: 12px; border-radius: 10px; border: 1px dashed var(--border);
  background: var(--surface); color: var(--text); font-size: .9rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.rec-btn.recording { border-color: var(--accent); color: var(--accent); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.3} }

.text-comment {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; font-size: .88rem; margin-bottom: 8px;
}
.text-comment .when { font-size: .7rem; color: var(--text-dim); margin-top: 4px; }

/* ---------------- Tabbar ---------------- */
#tabbar {
  height: calc(var(--tabbar-h) + var(--safe-bottom) + var(--admob-h, 0px));
  padding-bottom: calc(var(--safe-bottom) + var(--admob-h, 0px));
  display: flex; background: var(--bg-2);
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; background: none; border: none; color: var(--text-dim);
  font-size: .68rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.tab span { font-size: 1.25rem; }
.tab.active { color: var(--accent); }
.add-plus {
  background: var(--accent); color: #fff !important; width: 44px; height: 44px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem !important; margin-top: -10px; box-shadow: 0 4px 12px rgba(229,9,20,.5);
}

/* ---------------- Buttons ---------------- */
.btn-primary {
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  padding: 12px 18px; font-size: .95rem; font-weight: 600; cursor: pointer; width: 100%;
}
.btn-primary:active { background: var(--accent-dim); }
.btn-ghost {
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 18px; font-size: .95rem; cursor: pointer; width: 100%;
}
.btn-link { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 1rem; cursor: pointer; }
.btn-secondary {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 10px; padding: 11px 16px; font-size: .9rem; cursor: pointer; flex: 1;
}

/* ---------------- Sheet (add) ---------------- */
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--bg-2); border-radius: 20px 20px 0 0;
  padding: 10px 18px calc(20px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 10px;
  animation: slideup .25s ease;
}
@keyframes slideup { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 2px; margin: 4px auto 8px; }
.sheet h3 { margin: 0 0 6px; font-size: 1.05rem; }
.big-action {
  display: flex; align-items: center; gap: 14px; width: 100%;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 16px; color: var(--text); font-size: 1rem; cursor: pointer; text-align: left;
}
.big-action span { font-size: 1.4rem; }

/* ---------------- Scanner ---------------- */
.fullscreen-modal { position: fixed; inset: 0; z-index: 60; background: #000; }
#scanner-video { width: 100%; height: 100%; object-fit: cover; }
.scanner-frame {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 78%; max-width: 340px; aspect-ratio: 3/2;
  border: 3px solid var(--accent); border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.45);
}
.scanner-hint {
  position: absolute; bottom: 14%; left: 0; right: 0; text-align: center;
  color: #fff; font-size: .9rem; padding: 0 20px;
}
.close-scan { position: absolute; top: calc(12px + var(--safe-top)); right: 14px; color: #fff; font-size: 1.6rem; z-index: 2; background: rgba(0,0,0,.4); border-radius: 50%; }

/* ---------------- Edit modal ---------------- */
.modal {
  position: fixed; inset: 0; z-index: 55; background: var(--bg);
  display: flex; flex-direction: column;
  animation: slideup .25s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + var(--safe-top)) 16px 12px; border-bottom: 1px solid var(--border);
}
.modal-body { flex: 1; overflow-y: auto; padding: 16px calc(16px + var(--safe-bottom)); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .75rem; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 5px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 1rem; outline: none; font-family: inherit;
}
.field textarea { min-height: 90px; resize: vertical; }

/* ---------------- Random reel ---------------- */
.random-wrap { text-align: center; padding-top: 20px; }
.random-wrap h2 { font-size: 1.4rem; }
.random-filters { display: flex; gap: 8px; justify-content: center; margin: 16px 0; }
.random-reel {
  height: 320px; margin: 20px auto; max-width: 230px;
  border-radius: var(--radius); overflow: hidden; position: relative;
  background: var(--surface); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.reel-placeholder { font-size: 3rem; opacity: .4; }
.random-reel .poster { width: 100%; height: 100%; background-size: cover; background-position: center; }
.random-reel.spinning { animation: shake .12s linear infinite; }
@keyframes shake { 0%{transform:translateY(-4px)} 50%{transform:translateY(4px)} 100%{transform:translateY(-4px)} }

/* ---------------- Profile ---------------- */
.profile-wrap { padding-top: 8px; }
.profile-card { display: flex; gap: 14px; align-items: center; margin-bottom: 24px; }
.avatar {
  width: 60px; height: 60px; border-radius: 50%; background: var(--accent);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem; font-weight: 700;
}
.profile-name { font-size: 1.2rem; font-weight: 700; }
.profile-meta { color: var(--text-dim); font-size: .85rem; margin-top: 2px; }
.settings-list { display: flex; flex-direction: column; gap: 1px; background: var(--border);
  border-radius: 12px; overflow: hidden; }
.settings-row {
  background: var(--surface); border: none; color: var(--text); text-align: left;
  padding: 15px 16px; font-size: .95rem; cursor: pointer;
}
.settings-row:active { background: var(--surface-2); }
.settings-row.danger { color: var(--accent); }
.muted { color: var(--text-dim); }
.small { font-size: .78rem; }
.profile-wrap .muted { text-align: center; margin-top: 20px; }

/* ---------------- Toast ---------------- */
.toast {
  position: fixed; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px);
  left: 50%; transform: translateX(-50%);
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 11px 18px; border-radius: 30px; font-size: .85rem; z-index: 80;
  box-shadow: 0 6px 20px rgba(0,0,0,.4); max-width: 88%; text-align: center;
  animation: toastin .2s ease;
}
@keyframes toastin { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------------- OCR modal ---------------- */
.ocr-spinner { font-size: 3rem; animation: ocrpulse 1.4s ease-in-out infinite; }
@keyframes ocrpulse { 0%,100%{transform:scale(1);opacity:.6} 50%{transform:scale(1.15);opacity:1} }
.ocr-bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 14px auto 0; max-width: 260px; }
.ocr-bar-fill { height: 100%; background: var(--accent); transition: width .2s ease; }
.ocr-candidates { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ocr-cand {
  text-align: left; background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 13px 14px; color: var(--text); font-size: 1rem; cursor: pointer;
}
.ocr-cand:active { background: var(--surface-2); border-color: var(--accent); }

/* Liste de résultats TMDB (choix du film) */
.tmdb-results { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.tmdb-result {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px; color: var(--text); cursor: pointer;
}
.tmdb-result:active { background: var(--surface-2); border-color: var(--accent); }
.tmdb-poster {
  width: 46px; height: 69px; flex: none; border-radius: 6px;
  background: var(--surface-2) center/cover no-repeat;
  display: flex; align-items: center; justify-content: center; font-size: 1.2rem;
}
.tmdb-info { flex: 1; }
.tmdb-title { font-weight: 600; font-size: .95rem; }
.tmdb-year { font-size: .8rem; color: var(--text-dim); margin-top: 2px; }

/* ---------------- Tablet ---------------- */
@media (min-width: 768px) {
  #app { max-width: 900px; margin: 0 auto; border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .detail-poster { width: 150px; }
}

/* ====================== ÉCRAN DE CONNEXION ====================== */
#login-screen {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.login-box {
  max-width: 360px; width: 100%; text-align: center;
}
.login-logo { font-size: 4rem; margin-bottom: 8px; }
.login-box h1 { font-size: 2.2rem; margin: 12px 0 16px; font-weight: 800; }
.login-sub { color: var(--text-dim); font-size: .95rem; line-height: 1.5; margin-bottom: 28px; }
.login-google {
  display: inline-flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 14px 20px; border-radius: 12px; border: none;
  background: #fff; color: #1f1f1f; font-size: 1rem; font-weight: 600; cursor: pointer;
  margin-bottom: 12px;
}
.login-google:active { opacity: .85; }
.login-apple {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 14px 20px; border-radius: 12px; border: none;
  background: #000; color: #fff; font-size: 1rem; font-weight: 600; cursor: pointer;
  margin-bottom: 12px;
}
.login-apple:active { opacity: .85; }
.g-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: conic-gradient(from -45deg, #ea4335 0deg 90deg, #fbbc05 90deg 180deg, #34a853 180deg 270deg, #4285f4 270deg 360deg);
  color: #fff; font-weight: 700; font-size: .9rem;
}
.login-error { color: var(--accent); font-size: .85rem; margin-top: 16px; }

/* ====================== SÉLECTEUR DE FORMAT (Tout/DVD/Blu-ray/4K) ====================== */
.format-seg {
  display: flex; gap: 6px; margin-bottom: 10px;
}
.format-seg button {
  flex: 1; padding: 9px 4px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); font-size: .9rem; font-weight: 600; cursor: pointer;
  transition: all .15s;
}
.format-seg button.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.format-seg button:active { opacity: .8; }

/* ====================== LISTE DES GENRES (filtre) ====================== */
.genre-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.genre-item {
  width: 100%; text-align: left; padding: 13px 16px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: .95rem; cursor: pointer;
}
.genre-item.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; }
.genre-item:active { opacity: .8; }

/* ====================== WISHLIST ====================== */
.fmt-badge.wish { background: #d4a017; color: #fff; }

/* ====================== PRIX ====================== */
.price-inline { font-weight: 700; color: #fff; }
.library-total {
  margin: 16px 4px 8px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  font-size: .95rem; text-align: center;
}
.library-total b { color: var(--accent); font-size: 1.1rem; }

/* ====================== QUIZ ====================== */
.quiz-wrap { padding: 16px; }
.quiz-intro { text-align: center; padding: 24px 12px; }
.quiz-icon { font-size: 3.5rem; }
.quiz-intro h2 { margin: 8px 0; }
.quiz-head { display: flex; justify-content: space-between; font-size: .9rem; color: var(--text-dim); margin-bottom: 14px; }
.quiz-image { width: 140px; aspect-ratio: 2/3; margin: 0 auto 16px; border-radius: 10px;
  background: var(--surface-2) center/cover no-repeat; border: 1px solid var(--border); }
.quiz-q { font-size: 1.1rem; font-weight: 600; line-height: 1.4; margin-bottom: 20px; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt {
  width: 100%; text-align: left; padding: 14px 16px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 1rem; cursor: pointer; transition: all .15s;
}
.quiz-opt:active { background: var(--surface-2); }
.quiz-opt.right { background: #1f7a3d; border-color: #1f7a3d; color: #fff; font-weight: 600; }
.quiz-opt.wrong { background: #b3261e; border-color: #b3261e; color: #fff; font-weight: 600; }
.quiz-opt:disabled { cursor: default; opacity: 1; }
#quiz-next { margin-top: 20px; }
.quiz-result { text-align: center; padding: 20px 12px; }
.quiz-score-big { font-size: 3rem; font-weight: 800; color: var(--accent); }
.quiz-eval { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 18px; margin: 20px 0; }
.quiz-eval .lbl { font-size: .75rem; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); }
.quiz-eval-pct { font-size: 2.4rem; font-weight: 800; color: var(--accent); margin: 4px 0; }
.quiz-level { font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.quiz-result .btn-ghost { margin-top: 10px; }

/* Affiche zoomée pour le quiz (on ne voit qu'un détail) */
.quiz-image.zoomed { width: 200px; height: 200px; aspect-ratio: auto; border-radius: 12px; }

/* Note (étoiles) sur la vignette biblio */
.card-stars { font-size: .8rem; color: #f5b301; margin-top: 2px; }

/* ====================== PROFIL : STATS ====================== */
.profile-stats { margin: 16px 0 20px; }
.stat-lines { margin-bottom: 14px; }
.stat-line { font-size: 1rem; color: var(--text-dim); line-height: 1.7; }
.stat-line .stat-n { font-size: 1.3rem; font-weight: 800; color: var(--accent); margin-right: 4px; }
.genre-quip {
  text-align: center; font-size: 1.05rem; font-weight: 700;
  margin: 4px 0 18px; padding: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
}
.pie-wrap {
  display: flex; align-items: center; gap: 14px; flex-wrap: nowrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px;
}
.pie-svg { width: 150px; height: 150px; flex: none; }
.pie-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.legend-item { font-size: .85rem; display: flex; align-items: center; gap: 8px; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.legend-item b { margin-left: auto; }

/* Le sélecteur TMDB passe au-dessus de l'éditeur */
#tmdb-picker { z-index: 60; }

/* Badge Top 3 sur la vignette (en haut à gauche) */
.top3-badge {
  position: absolute; top: 6px; left: 6px;
  background: linear-gradient(135deg, #f5b301, #e08e00);
  color: #1a1a1a; font-size: .62rem; font-weight: 800;
  padding: 3px 7px; border-radius: 20px; letter-spacing: .3px;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
}

/* Bouton photo jaquette dans l'éditeur */
.poster-input-row { display: flex; gap: 8px; align-items: center; }
.poster-input-row input { flex: 1; }
.btn-photo-jacket {
  flex: none; width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  font-size: 1.3rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.btn-photo-jacket:active { opacity: .7; }

/* ====================== ÉTOILES (demi-étoile CSS) ====================== */
.stars-wrap { display: inline-flex; gap: 1px; }
.star { display: inline-block; color: #555; font-size: inherit; }
.star.full { color: #f5b301; }
.star.empty { color: #444; }
/* Demi-étoile : superposition clip gauche (colorée) sur fond gris */
.star.half { position: relative; display: inline-block; color: #444; }
.star.half .star-fg {
  position: absolute; left: 0; top: 0;
  width: 50%; overflow: hidden; color: #f5b301;
  display: inline-block;
}
.star.half .star-bg { color: #444; }
/* Étoiles éditeur (plus grandes, cliquables) */
.rating-stars { display: flex; gap: 6px; font-size: 1.8rem; cursor: pointer; }
.edit-star { display: inline-block; color: #444; transition: transform .1s; }
.edit-star.full { color: #f5b301; }
.edit-star.empty { color: #444; opacity: .4; }
.edit-star.half { position: relative; display: inline-block; color: #444; }
.edit-star.half .star-fg {
  position: absolute; left: 0; top: 0;
  width: 50%; overflow: hidden; color: #f5b301;
  display: inline-block;
}
.edit-star.half .star-bg { color: #444; opacity: .4; }
.edit-star:active { transform: scale(1.3); }

/* ---------------- Toggle Films/Séries ---------------- */
.media-toggle {
  display: flex; gap: 0; padding: 8px 12px;
  background: var(--bg);
}
.media-toggle-btn {
  flex: 1; padding: 10px; border: none; cursor: pointer;
  font-size: 1rem; font-weight: 600;
  background: var(--surface); color: var(--text-dim);
  transition: all .2s;
}
.media-toggle-btn:first-child { border-radius: 12px 0 0 12px; }
.media-toggle-btn:last-child { border-radius: 0 12px 12px 0; }
.media-toggle-btn.active { background: var(--accent); color: #fff; }

/* ---------------- Séries ---------------- */
.series-picker-item {
  display: flex; gap: 12px; align-items: center;
  padding: 12px; border-radius: 12px; cursor: pointer;
  background: var(--surface); margin-bottom: 8px;
}
.series-picker-item:active { opacity: .8; }

.series-detail { padding-bottom: calc(var(--tabbar-h) + 80px); }
.series-detail-header {
  height: 220px; background-size: cover; background-position: center;
  position: relative; border-radius: 0 0 20px 20px;
}
.series-detail-overlay {
  position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.5), rgba(0,0,0,.1));
  padding: 16px; border-radius: 0 0 20px 20px;
  display: flex; justify-content: space-between; align-items: flex-start;
}
.series-detail-body { padding: 16px; }
.series-status-row { display: flex; gap: 12px; align-items: center; margin: 12px 0; flex-wrap: wrap; }
.series-progress-bar {
  height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; margin: 12px 0 4px;
}
.series-progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.series-progress-text { font-size: .85rem; color: var(--text-dim); margin-bottom: 12px; }
.series-overview { color: var(--text-dim); font-size: .9rem; line-height: 1.5; margin-bottom: 20px; }

.series-season { border-radius: 12px; background: var(--surface); margin-bottom: 10px; overflow: hidden; }
.series-season-header {
  display: flex; align-items: center; gap: 8px; padding: 14px 16px;
  cursor: pointer; font-weight: 600;
}
.season-progress { margin-left: auto; color: var(--accent); font-size: .85rem; }
.series-episodes { padding: 0 12px 12px; }
.episode-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.episode-row:last-child { border-bottom: none; }
.episode-row input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }
.ep-num { font-size: .8rem; color: var(--accent); font-weight: 700; flex-shrink: 0; min-width: 52px; }
.ep-name { flex: 1; font-size: .9rem; }
.ep-runtime { font-size: .75rem; color: var(--text-dim); flex-shrink: 0; }

.series-rating span { color: var(--star); }

#series-grid .card-progress {
  font-size: .75rem; color: var(--accent); font-weight: 600;
}

.series-season-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.season-check { font-size: 1.1rem; flex-shrink: 0; }
.season-title { font-weight: 700; flex: 1; }
.season-progress { color: var(--accent); font-size: .85rem; font-weight: 600; }
.season-all-btn {
  background: var(--surface-2); border: none; color: var(--text-dim);
  font-size: .78rem; padding: 4px 10px; border-radius: 8px; cursor: pointer;
  flex-shrink: 0;
}
.season-all-btn:active { opacity: .8; }

.episode-item { border-bottom: 1px solid var(--border); }
.episode-item:last-child { border-bottom: none; }
.episode-row { border-bottom: none; }
.ep-name { cursor: pointer; text-decoration: underline dotted; }
.ep-overview {
  padding: 8px 16px 12px 46px;
  font-size: .82rem; color: var(--text-dim);
  line-height: 1.5;
}

.series-providers {
  background: var(--surface); border-radius: 14px;
  padding: 14px 16px; margin-bottom: 16px;
}
.series-providers-title {
  font-size: .85rem; font-weight: 700; color: var(--text-dim);
  margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em;
}
.series-providers-list { display: flex; flex-wrap: wrap; gap: 10px; }
.provider-item {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border-radius: 10px; padding: 6px 12px;
}
.provider-logo { width: 28px; height: 28px; border-radius: 6px; object-fit: cover; }
.provider-name { font-size: .85rem; font-weight: 600; }
.series-no-provider { font-size: .82rem; color: var(--text-dim); margin-bottom: 12px; }

#search-toggle { position: relative; }
#search-toggle.search-active { color: var(--accent); }
#search-toggle.search-active::after {
  content: '';
  position: absolute;
  bottom: 2px; right: 4px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
}

#series-searchbar {
  padding: 8px 12px; background: var(--bg);
  border-bottom: 1px solid var(--border);
}
#series-search-input {
  width: 100%; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 1rem; outline: none;
}
#series-status-filter {
  display: flex; gap: 6px; padding: 8px 12px;
  overflow-x: auto; scrollbar-width: none;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
#series-status-filter::-webkit-scrollbar { display: none; }
.status-filter-btn {
  flex-shrink: 0; padding: 6px 14px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-dim); font-size: .82rem; cursor: pointer; white-space: nowrap;
}
.status-filter-btn.active {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
