/* ==========================================================================
   CinéTracker — feuille de style
   ========================================================================== */

:root {
  --bg: #0a0b0f;
  --bg-elevated: #12141b;
  --bg-card: #171922;
  --bg-card-hover: #1d202b;
  --border: #262a38;
  --border-soft: #1c1f2a;

  --text: #eceef4;
  --text-muted: #9498a8;
  --text-faint: #666a7a;

  --red: #e0212b;
  --red-soft: #e0212b22;
  --red-glow: #e0212b55;
  --gold: #d4af37;
  --gold-soft: #d4af3722;

  --tier-s: #e0212b;
  --tier-a: #e08a21;
  --tier-b: #d4af37;
  --tier-c: #3b9b6b;
  --tier-d: #4a7dc9;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 18px;

  --shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 48px rgba(0, 0, 0, 0.5);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background:
    radial-gradient(ellipse 1200px 600px at 50% -10%, #2a0d10 0%, transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold);
}

/* ---------- Header / Nav ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 11, 15, 0.85);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}

.header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 24px;
  max-width: 1200px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

.brand-logo {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 3px 8px var(--red-glow));
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-wrap: nowrap;
}

.main-nav a {
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}

.main-nav a:hover { color: var(--text); background: var(--bg-card); }
.main-nav a.active { color: var(--text); background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red-glow); }

.nav-dropdown { position: relative; }
.nav-dropdown-toggle {
  display: flex; align-items: center; gap: 5px;
  padding: 7px 11px;
  border-radius: 999px;
  border: none;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s var(--ease), background 0.2s var(--ease);
}
.nav-dropdown-toggle:hover { color: var(--text); background: var(--bg-card); }
.nav-dropdown-toggle.active { color: var(--text); background: var(--red-soft); box-shadow: inset 0 0 0 1px var(--red-glow); }
.nav-dropdown-toggle svg { transition: transform 0.15s var(--ease); }
.nav-dropdown.open .nav-dropdown-toggle svg { transform: rotate(180deg); }

.nav-dropdown-menu {
  display: none;
  flex-direction: column;
  gap: 2px;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 210px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px;
  box-shadow: var(--shadow-lg);
  z-index: 60;
}
.nav-dropdown.open .nav-dropdown-menu { display: flex; }
.nav-dropdown-menu a {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}
.nav-dropdown-menu a:hover { color: var(--text); background: var(--bg-card); }
.nav-dropdown-menu a.active { color: var(--gold); background: var(--gold-soft); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.countdown-chip {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, #1a0c0c, #0f0a10);
  border: 1px solid #3a1418;
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.countdown-chip strong {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

/* ---------- Buttons / forms ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.btn:hover { background: var(--bg-card-hover); border-color: #333849; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: linear-gradient(135deg, var(--red), #a3161d);
  border-color: #ff3b3b33;
  box-shadow: 0 4px 20px var(--red-glow);
}
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--red), #a3161d); }

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #a5811f);
  border-color: #ffd76a33;
  color: #1a1305;
}

.btn-ghost { background: transparent; border-color: var(--border); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.input, select.input, textarea.input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}
textarea.input { resize: vertical; min-height: 70px; }

.auth-card {
  max-width: 420px;
  margin: 60px auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-lg);
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 16px;
}
.alert-error { background: #3a0f13; border: 1px solid #6b1d24; color: #ffb3ba; }
.alert-success { background: #0f3a24; border: 1px solid #1d6b41; color: #b3ffd4; }

.divider-text {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-faint);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin: 22px 0;
}
.divider-text::before, .divider-text::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---------- Hero / landing ---------- */

.hero {
  padding: 90px 24px 60px;
  text-align: center;
  max-width: 780px;
  margin: 0 auto;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  margin: 14px 0 16px;
  background: linear-gradient(135deg, #fff, #b9bcca);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p { color: var(--text-muted); font-size: 17px; margin-bottom: 30px; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.hero-countdown {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 36px 0;
  flex-wrap: wrap;
}
.hero-countdown .unit {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  min-width: 84px;
  text-align: center;
  box-shadow: var(--shadow);
}
.hero-countdown .unit strong {
  display: block;
  font-size: 30px;
  font-weight: 900;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.hero-countdown .unit span {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
}

/* ---------- Progress bars ---------- */

.progress-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin: 24px 0;
  box-shadow: var(--shadow);
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
}
.progress-row + .progress-row { border-top: 1px solid var(--border-soft); }

.progress-row .label {
  width: 190px;
  flex-shrink: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-muted);
}
.progress-row.global .label { color: var(--text); }

.progress-track {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  background: var(--bg-elevated);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--border-soft);
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width 0.6s var(--ease);
  width: 0%;
}
.progress-row.global .progress-fill { background: linear-gradient(90deg, #ff4b4b, var(--gold)); }

.progress-pct {
  width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: 14px;
  flex-shrink: 0;
}
.progress-count {
  width: 64px;
  text-align: right;
  font-size: 12px;
  color: var(--text-faint);
  flex-shrink: 0;
}

/* ---------- Page header / toolbar ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin: 36px 0 20px;
}
.page-head h1 { font-size: 28px; }
.page-head p { color: var(--text-muted); margin: 0; font-size: 14px; }

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}

.segmented {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.segmented button {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 7px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.segmented button.active {
  background: linear-gradient(135deg, var(--red), #a3161d);
  color: #fff;
}

.search-input { position: relative; flex: 1; min-width: 180px; max-width: 280px; }
.search-input input { padding-left: 34px; }
.search-input::before {
  content: "";
  position: absolute;
  left: 12px; top: 50%;
  width: 14px; height: 14px;
  margin-top: -8px;
  border: 2px solid var(--text-faint);
  border-radius: 50%;
}

.filter-checks { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-checks-label { font-size: 13px; font-weight: 700; color: var(--text-muted); margin-right: 2px; }

.chip-filter {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s var(--ease);
}
.chip-filter.active { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }

/* ---------- Chapters & Grid ---------- */

.chapter-block { margin-bottom: 40px; }
.chapter-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 800;
  margin: 0 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}
@media (max-width: 640px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

.movie-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
  position: relative;
  display: flex;
  flex-direction: column;
}
.movie-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
  border-color: #3a3f52;
}

.movie-card .poster-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  background: linear-gradient(160deg, #1c1f2a, #0f1016);
}
.movie-card .poster-wrap img { width: 100%; height: 100%; object-fit: cover; }
.movie-card .poster-placeholder {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint); font-size: 12px; text-align: center; padding: 10px;
}

.card-badges {
  position: absolute;
  top: 8px; left: 8px;
  display: flex; flex-direction: column; gap: 5px;
}
.badge {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 3px 7px;
  border-radius: 5px;
  backdrop-filter: blur(4px);
}
.badge-optional { background: #00000080; color: var(--text-muted); border: 1px solid var(--border); }
.badge-upcoming { background: #00000080; color: var(--gold); border: 1px solid var(--gold); }
.badge-watchlist { background: #00000080; color: #6fb3ff; border: 1px solid #6fb3ff; }
.badge-not-interested { background: #00000080; color: var(--text-faint); border: 1px solid var(--border); }

.watch-count-badge {
  position: absolute;
  bottom: 8px; right: 8px;
  background: #000000b0;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

/* Contrôle "Vu / À voir / Pas intéressé" : 3 boutons strictement identiques,
   un seul actif à la fois (le style actif ne change jamais selon le bouton). */
.status-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-top: 10px;
}
.status-btn {
  flex: 1;
  min-width: 0;
  border: none;
  border-right: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.2;
  padding: 7px 4px;
  cursor: pointer;
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.status-btn:last-child { border-right: none; }
.status-btn:hover:not(:disabled) { color: var(--text); }
.status-btn.active { background: var(--gold-soft); color: var(--gold); }
.status-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.status-toggle-lg .status-btn { font-size: 13px; padding: 10px 14px; }

.watch-count-mini {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-muted);
}
.watch-count-mini strong { color: var(--text); font-size: 14px; }
.watch-count-mini button {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  padding: 0;
}
.watch-count-mini button:hover { border-color: var(--gold); color: var(--gold); }

.tier-badge {
  position: absolute;
  top: 8px; right: 8px;
  min-width: 26px; height: 26px;
  padding: 0 4px;
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900;
  font-size: 12px;
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.5);
}
.tier-badge.tier-S { background: var(--tier-s); }
.tier-badge.tier-A { background: var(--tier-a); }
.tier-badge.tier-B { background: var(--tier-b); color: #241a00; }
.tier-badge.tier-C { background: var(--tier-c); }
.tier-badge.tier-D { background: var(--tier-d); }

.watched-indicator {
  position: absolute;
  bottom: 8px; left: 8px;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1f9d55, #157a41);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.watched-indicator svg { width: 14px; height: 14px; }

.card-detail-btn {
  display: block;
  text-align: center;
  padding: 7px;
  margin-top: 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 700;
  transition: all 0.15s var(--ease);
}
.card-detail-btn:hover { background: var(--bg-card-hover); color: var(--text); border-color: #3a3f52; }

.movie-card .card-body { padding: 12px 12px 12px; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.movie-card .title { font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.movie-card .meta { font-size: 11.5px; color: var(--text-faint); }
.mini-countdown {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 800;
  color: var(--gold);
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  padding: 2px 8px;
  border-radius: 999px;
}
.movie-card.is-watched { border-color: #2ec86c44; }
.movie-card.is-hidden { display: none; }
.tier-chip.is-hidden { display: none; }

.category-filter-bar {
  flex-wrap: wrap;
  gap: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
}
.category-filter-bar > span { font-size: 14px; font-weight: 700; color: var(--text); }
.category-filter-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  transition: all 0.15s var(--ease);
}
.category-filter-check:has(input:checked) { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); }
.category-filter-check input { accent-color: var(--gold); width: 16px; height: 16px; }

/* ---------- Movie detail page ---------- */

.movie-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 24px 0 32px;
  border: 1px solid var(--border);
}
.movie-hero .backdrop {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  filter: brightness(0.35) saturate(1.1);
}
.movie-hero .backdrop::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 95%), linear-gradient(90deg, var(--bg) 0%, transparent 45%);
}
.movie-hero-content {
  position: relative;
  display: flex;
  gap: 28px;
  padding: 36px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.movie-hero .poster {
  width: 180px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  flex-shrink: 0;
}
.movie-hero .info { flex: 1; min-width: 260px; }
.movie-hero h1 { font-size: 30px; }
.movie-hero .synopsis { color: var(--text-muted); max-width: 640px; margin: 14px 0; font-size: 14.5px; }
.movie-hero .meta-row { display: flex; gap: 16px; flex-wrap: wrap; color: var(--text-muted); font-size: 13px; margin-bottom: 10px; }
.movie-hero .actions { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }

/* Sélecteur de tier détaillé (S+ / S / S- ... D+ / D / D-) : 5 colonnes (une par lettre),
   chacune avec ses 3 nuances empilées, du "+" en haut au "-" en bas. */
.tier-picker {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.tier-picker .tier-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.tier-picker button {
  width: 46px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-weight: 800;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.tier-picker button:hover { transform: translateY(-1px); border-color: #3a3f52; }
.tier-picker button.active[data-letter="S"] { background: var(--tier-s); border-color: var(--tier-s); color: #fff; }
.tier-picker button.active[data-letter="A"] { background: var(--tier-a); border-color: var(--tier-a); color: #fff; }
.tier-picker button.active[data-letter="B"] { background: var(--tier-b); border-color: var(--tier-b); color: #241a00; }
.tier-picker button.active[data-letter="C"] { background: var(--tier-c); border-color: var(--tier-c); color: #fff; }
.tier-picker button.active[data-letter="D"] { background: var(--tier-d); border-color: var(--tier-d); color: #fff; }

/* Petit nudge +/- sur les affiches de la tierlist, pour ajuster sans glisser-déposer. */
.tier-nudge {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 3px;
}
.tier-nudge button {
  width: 26px; height: 22px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}
.tier-nudge button:hover { color: var(--text); border-color: #3a3f52; }

.subtier-badge {
  position: absolute;
  top: -8px; right: -8px;
  font-size: 12px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.compare-tag {
  margin-top: 4px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  background: var(--gold-soft);
  border-radius: 6px;
  padding: 3px 5px;
}

.comment-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 30px;
}
.comment-panel h3 { font-size: 15px; margin-bottom: 12px; }
.save-status { font-size: 12px; color: var(--text-faint); margin-top: 8px; height: 16px; }
.save-status.saved { color: #4ade80; }

.opinion-list { display: flex; flex-direction: column; gap: 14px; }
.opinion-row { padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.opinion-row:last-child { border-bottom: none; padding-bottom: 0; }
.opinion-head { display: flex; align-items: center; gap: 8px; }
.opinion-user { font-weight: 700; font-size: 13.5px; }
.opinion-comment { font-size: 13px; color: var(--text-muted); margin: 6px 0 0; }
.opinion-comment.opinion-private { color: var(--text-faint); font-style: italic; }
.tier-badge-inline {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 24px; height: 20px; padding: 0 5px;
  border-radius: 5px;
  font-size: 11px; font-weight: 900;
  color: #fff;
}
.tier-badge-inline.tier-S { background: var(--tier-s); }
.tier-badge-inline.tier-A { background: var(--tier-a); }
.tier-badge-inline.tier-B { background: var(--tier-b); color: #241a00; }
.tier-badge-inline.tier-C { background: var(--tier-c); }
.tier-badge-inline.tier-D { background: var(--tier-d); }

/* ---------- Tierlist page ---------- */

.tier-row {
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 18px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
}
.tier-row .tier-label {
  width: 100px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 42px;
  font-weight: 900;
  color: #fff;
}
.tier-row[data-tier="S"] .tier-label { background: linear-gradient(160deg, var(--tier-s), #8f0d15); }
.tier-row[data-tier="A"] .tier-label { background: linear-gradient(160deg, var(--tier-a), #8f4d0d); }
.tier-row[data-tier="B"] .tier-label { background: linear-gradient(160deg, var(--tier-b), #8f6f0d); color: #241a00; }
.tier-row[data-tier="C"] .tier-label { background: linear-gradient(160deg, var(--tier-c), #145232); }
.tier-row[data-tier="D"] .tier-label { background: linear-gradient(160deg, var(--tier-d), #1d4a80); }

/* Non scopé à .tier-row : réutilisé tel quel dans le panneau "non classés" (mise en page
   horizontale avec retour à la ligne, pas seulement dans les lignes S/A/B/C/D). */
.tier-items {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 20px;
  min-height: 150px;
  align-content: flex-start;
}
.tier-items.drag-over { background: var(--bg-card-hover); }
.empty-hint { color: var(--text-faint); font-size: 14px; align-self: center; padding: 10px; }

.tier-chip {
  width: 112px;
  cursor: grab;
  transition: transform 0.15s var(--ease);
  position: relative;
}
.tier-chip:active { cursor: grabbing; }
.tier-chip.dragging { opacity: 0.35; }
.tier-chip img { width: 100%; border-radius: 8px; aspect-ratio: 2/3; object-fit: cover; box-shadow: var(--shadow); }
.tier-chip .cap { font-size: 12px; text-align: center; margin-top: 5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.unranked-panel {
  margin-top: 30px;
  padding-top: 24px;
  border-top: 1px dashed var(--border);
}
.unranked-panel h3 { font-size: 14px; color: var(--text-muted); margin-bottom: 14px; }

/* ---------- Stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 24px 0;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-card .num { font-size: 28px; font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.stat-card .lbl { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }

/* ---------- Community ---------- */

.leaderboard { display: flex; flex-direction: column; gap: 10px; }
.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  transition: transform 0.2s var(--ease), border-color 0.2s var(--ease);
}
.leaderboard-row:hover { transform: translateX(3px); border-color: #3a3f52; }
.leaderboard-row.rank-1 { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-soft), var(--shadow); }
.leaderboard-link {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
  min-width: 0;
  color: inherit;
}
.delete-user-btn {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-faint);
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s var(--ease);
}
.delete-user-btn:hover { border-color: #e0212b; color: #ff6b6b; background: var(--red-soft); }
.leaderboard-rank { width: 30px; text-align: center; font-weight: 900; color: var(--text-faint); font-size: 15px; }
.leaderboard-row.rank-1 .leaderboard-rank { color: var(--gold); font-size: 20px; }
.leaderboard-user { flex: 1; min-width: 140px; }
.leaderboard-user .name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.leaderboard-user .sub { font-size: 12px; color: var(--text-faint); }
.leaderboard-bars { display: flex; gap: 20px; flex-wrap: wrap; }
.leaderboard-bars .mini { width: 110px; }
.leaderboard-bars .mini .track { height: 6px; border-radius: 999px; background: var(--bg-elevated); overflow: hidden; margin-top: 4px; }
.leaderboard-bars .mini .fill { height: 100%; background: linear-gradient(90deg, var(--red), var(--gold)); }
.leaderboard-bars .mini .lbl { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.leaderboard-global { width: 70px; text-align: right; font-weight: 900; font-size: 18px; color: var(--gold); flex-shrink: 0; }
.crown { font-size: 15px; }

/* ---------- Profile ---------- */

.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 800px) { .profile-grid { grid-template-columns: 1fr; } }

.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.panel h2 { font-size: 16px; margin-bottom: 4px; }
.panel .sub { font-size: 13px; color: var(--text-faint); margin-bottom: 18px; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { display: none; }
.switch .track {
  width: 42px; height: 24px; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  position: relative; transition: background 0.2s var(--ease);
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.switch input:checked + .track { background: var(--red-soft); border-color: var(--red); }
.switch input:checked + .track::after { transform: translateX(18px); background: var(--red); }

.credential-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-soft);
  font-size: 13.5px;
}
.credential-row:last-child { border-bottom: none; }

/* ---------- Profil : avatar, sections, sagas ---------- */

.profile-section-title {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 800;
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-soft);
}

.profile-avatar {
  position: relative;
  width: 84px; height: 84px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: linear-gradient(160deg, #1c1f2a, #0f1016);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
}
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-initial { font-size: 32px; font-weight: 900; color: var(--text-faint); }

.profile-avatar-btn { cursor: pointer; border: 2px solid var(--border); background: none; padding: 0; }
.profile-avatar-btn:hover { border-color: var(--gold); }
.profile-avatar-edit-hint {
  position: absolute; inset: auto 0 0 0;
  background: rgba(10,11,15,0.8);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  padding: 3px 0;
  opacity: 0;
  transition: opacity 0.15s var(--ease);
}
.profile-avatar-btn:hover .profile-avatar-edit-hint { opacity: 1; }

.avatar-saga-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.avatar-saga-list .chip-filter.active { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); }

.avatar-cast-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
}
.avatar-cast-item {
  cursor: pointer;
  text-align: center;
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  transition: border-color 0.15s var(--ease);
}
.avatar-cast-item:hover { border-color: var(--gold); }
.avatar-cast-item img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.avatar-cast-item .name { font-size: 10.5px; font-weight: 700; padding: 5px 4px 1px; }
.avatar-cast-item .character { font-size: 10px; color: var(--text-faint); padding: 0 4px 5px; }

/* ---------- Favori (profil) ---------- */

.favorite-hero { margin-bottom: 24px; }
.favorite-tag {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 800;
  color: var(--gold); background: var(--gold-soft); border: 1px solid var(--gold);
  padding: 4px 10px; border-radius: 999px; margin-bottom: 10px;
}
.favorite-empty { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 24px; }

.tier-bars { display: flex; flex-direction: column; gap: 11px; margin-top: 6px; }
.tier-bar-row { display: flex; align-items: center; gap: 12px; }
.tier-bar-letter {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 14px; color: #fff;
}
.tier-bar-letter.tier-S { background: var(--tier-s); }
.tier-bar-letter.tier-A { background: var(--tier-a); }
.tier-bar-letter.tier-B { background: var(--tier-b); color: #241a00; }
.tier-bar-letter.tier-C { background: var(--tier-c); }
.tier-bar-letter.tier-D { background: var(--tier-d); }
.tier-bar-track { flex: 1; height: 13px; border-radius: 999px; background: var(--bg-elevated); overflow: hidden; }
.tier-bar-fill { height: 100%; border-radius: 999px; transition: width 0.4s var(--ease); }
.tier-bar-fill.tier-S { background: var(--tier-s); }
.tier-bar-fill.tier-A { background: var(--tier-a); }
.tier-bar-fill.tier-B { background: var(--tier-b); }
.tier-bar-fill.tier-C { background: var(--tier-c); }
.tier-bar-fill.tier-D { background: var(--tier-d); }
.tier-bar-count { width: 30px; text-align: right; font-size: 13px; color: var(--text-muted); flex-shrink: 0; font-variant-numeric: tabular-nums; }

.favorite-picker-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  margin: 14px 0;
}
.favorite-picker-item {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  transition: border-color 0.15s var(--ease);
}
.favorite-picker-item:hover { border-color: var(--gold); }
.favorite-picker-item img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.favorite-picker-item .name { font-size: 11px; padding: 5px 6px; text-align: center; }

/* ---------- Footer ---------- */

.site-footer {
  margin-top: 80px;
  padding: 30px 24px 50px;
  text-align: center;
  color: var(--text-faint);
  font-size: 12.5px;
}

/* ---------- Rating modal ---------- */

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(5, 6, 9, 0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }

.modal-box {
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  position: relative;
  transform: translateY(12px) scale(0.98);
  transition: transform 0.2s var(--ease);
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }

.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { color: var(--text); }

.modal-header {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 18px;
  padding-right: 30px;
}
.modal-header img {
  width: 56px;
  border-radius: 8px;
  aspect-ratio: 2/3;
  object-fit: cover;
  box-shadow: var(--shadow);
}
.modal-header h3 { font-size: 17px; margin: 2px 0 0; }

.modal-body label { display: block; font-size: 13px; font-weight: 600; color: var(--text-muted); margin-bottom: 8px; }
.modal-footer { margin-top: 20px; }

/* ---------- Toast ---------- */

.toast-stack {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 200;
}
.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.25s var(--ease);
}
.toast.error { border-color: #6b1d24; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Misc ---------- */

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-faint); }
.mobile-nav-toggle { display: none; }

/* Le nav complet (6 liens + logo + countdown + auth) ne tient à l'aise qu'au-delà de ~1180px :
   en dessous, on bascule proprement sur le menu hamburger plutôt que de laisser les liens
   retourner à la ligne au milieu du header. */
@media (max-width: 1180px) {
  .main-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--bg-elevated); flex-direction: column; padding: 10px; border-bottom: 1px solid var(--border-soft); }
  .main-nav.open { display: flex; }
  .main-nav a { white-space: normal; }
  .mobile-nav-toggle {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 8px;
    background: var(--bg-card); border: 1px solid var(--border); color: var(--text);
    cursor: pointer;
  }
  .header-bar { flex-wrap: wrap; }
  .countdown-chip { order: 3; width: 100%; justify-content: center; }
}

@media (max-width: 860px) {
  .movie-hero-content { padding: 24px; }
  .movie-hero .poster { width: 130px; }
  .progress-row .label { width: 110px; font-size: 12px; }
}

/* ---------- Admin ---------- */

.admin-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: 28px 0 24px;
  overflow-x: auto;
}
.admin-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--gold); border-bottom-color: var(--gold); }
.admin-tab .count {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-faint);
}
.admin-tab.active .count { color: var(--gold); border-color: var(--gold-soft); background: var(--gold-soft); }

.admin-tab-panel { display: none; }
.admin-tab-panel.active { display: block; animation: admin-tab-fade 0.18s var(--ease); }
@keyframes admin-tab-fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.admin-title-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-faint);
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
}

.admin-btn-danger:hover { border-color: #6b1d24; color: #ff6b6b; background: var(--red-soft); }

.admin-step {
  display: flex;
  gap: 16px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--border-soft);
}
.admin-step:first-of-type { margin-top: 18px; padding-top: 0; border-top: none; }
.admin-step-num {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--gold-soft);
  border: 1px solid var(--gold);
  color: var(--gold);
  font-weight: 900;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.admin-step-body { flex: 1; min-width: 0; }
.admin-step-title { font-weight: 700; font-size: 14px; margin-bottom: 10px; }

.admin-category-group summary, .admin-titles-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 10px 0;
  list-style: none;
}
.admin-category-group summary::-webkit-details-marker { display: none; }
.admin-category-group summary::before { content: '▸ '; color: var(--gold); }
.admin-category-group[open] summary::before { content: '▾ '; }
.admin-category-group { border-bottom: 1px solid var(--border-soft); }
.admin-category-group:last-child { border-bottom: none; }

.admin-category-row, .admin-title-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 14px;
}
.admin-category-row:last-child, .admin-title-row:last-child { border-bottom: none; }
.admin-category-row .sub, .admin-title-row .sub { color: var(--text-faint); font-size: 12px; }
.admin-category-display { display: flex; flex-direction: column; gap: 2px; }
.admin-category-edit-form { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.admin-category-actions { display: flex; gap: 8px; flex-shrink: 0; }
.input-sm { padding: 6px 10px; font-size: 13px; width: auto; }

.admin-title-reorder { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.reorder-btn {
  width: 22px; height: 18px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}
.reorder-btn:hover { color: var(--text); border-color: #3a3f52; }
.admin-title-name { flex: 1; }

.admin-tmdb-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.admin-tmdb-result {
  cursor: pointer;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elevated);
  position: relative;
  transition: border-color 0.2s var(--ease);
}
.admin-tmdb-result:hover { border-color: #3a3f52; }
.admin-tmdb-result.active { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-soft); }
.admin-tmdb-result.active::after {
  content: "✓";
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: #241a00;
  font-weight: 900;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
}
.admin-tmdb-result img { width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block; }
.admin-tmdb-result .title { font-size: 12px; font-weight: 700; padding: 6px 8px 0; }
.admin-tmdb-result .sub { font-size: 11px; color: var(--text-faint); padding: 0 8px 8px; }

.admin-selection-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}
.admin-selection-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.admin-selection-item img { width: 32px; aspect-ratio: 2/3; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.admin-selection-item .name { flex: 1; font-size: 13px; }
.admin-selection-date { flex-shrink: 0; width: 150px; color-scheme: dark; }
.admin-selection-item .remove-btn {
  background: none; border: none; color: var(--text-faint);
  font-size: 18px; line-height: 1; cursor: pointer; padding: 0 4px;
}
.admin-selection-item .remove-btn:hover { color: #ff6b6b; }
