/* ============================================================
   style.css — Kulturo Design System
   Police : DM Sans (corps) + Playfair Display (display)
   Thème : dark par défaut · light en option
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&family=Playfair+Display:wght@700;900&display=swap');

/* ── Variables ────────────────────────────────────────────── */
:root {
  /* Dark (défaut) */
  --bg:          #0d0d0f;
  --bg-2:        #131316;
  --bg-3:        #1a1a1f;
  --bg-4:        #222228;
  --border:      #2a2a32;
  --border-2:    #35353f;
  --text:        #f0f0f4;
  --text-2:      #a0a0b0;
  --text-3:      #606070;
  --accent:      #c8a96e;        /* or chaud */
  --accent-2:    #e8c98e;
  --accent-glow: rgba(200,169,110,.15);
  --game:        #5b8dee;
  --movie:       #e05b7f;
  --book:        #5bbf8d;
  --danger:      #e05b5b;
  --success:     #5bbf8d;
  --warn:        #e09b5b;
  --radius:      8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --shadow:      0 4px 24px rgba(0,0,0,.5);
  --shadow-lg:   0 8px 48px rgba(0,0,0,.7);
  --transition:  .18s cubic-bezier(.4,0,.2,1);
  --font-body:   'DM Sans', system-ui, sans-serif;
  --font-display:'Playfair Display', Georgia, serif;
  --text-1:      #ffffff;
}

[data-theme="light"] {
  --bg:          #f5f4f0;
  --bg-2:        #ffffff;
  --bg-3:        #eeede9;
  --bg-4:        #e4e3de;
  --border:      #d8d7d2;
  --border-2:    #cccbc6;
  --text:        #1a1a20;
  --text-2:      #50505f;
  --text-3:      #909099;
  --accent-glow: rgba(200,169,110,.1);
  --shadow:      0 4px 24px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 48px rgba(0,0,0,.15);
  --text-1:      #0d0d0f;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--transition), color var(--transition);
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
input, textarea, select {
  font-family: inherit;
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius);
  padding: .6rem .9rem;
  font-size: .875rem;
  transition: border var(--transition), box-shadow var(--transition);
  width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
textarea { resize: vertical; min-height: 80px; }

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 900; }
h2 { font-size: clamp(1.3rem, 3vw, 1.8rem); font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 700; }
.label { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

/* ── Layout ───────────────────────────────────────────────── */
#app {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

/* ── Topbar ───────────────────────────────────────────────── */
#topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0;
  padding: .75rem 0;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-logo {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--accent);
  letter-spacing: -.02em;
  white-space: nowrap;
  padding-left: 1.5rem;
  width: 220px;
  flex-shrink: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: .05rem;
  line-height: 1;
}
.topbar-search-wrap {
  flex: 1;
  max-width: 560px;
  position: relative;
  margin: 0 auto;
}
.topbar-right {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding-right: 2rem;
  flex-shrink: 0;
}
.topbar-tagline {
  font-size: .62rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: var(--font-body, sans-serif);
}
.topbar-search-wrap input {
  padding-left: 2.4rem;
  background: var(--bg-3);
  height: 38px;
}
.topbar-search-wrap .search-icon {
  position: absolute;
  left: .75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-3);
  pointer-events: none;
}
.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-3);
  color: var(--text-2);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}
.btn-icon:hover { background: var(--bg-4); color: var(--text); }
.btn-icon.active { background: var(--accent-glow); color: var(--accent); }

/* ── Sidebar ──────────────────────────────────────────────── */
#sidebar {
  background: var(--bg-2);
  border-right: 1px solid var(--border);
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.nav-section-label {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: .75rem .5rem .25rem;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .75rem;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.nav-item:hover { background: var(--bg-3); color: var(--text); }
.nav-item.active { background: var(--accent-glow); color: var(--accent); font-weight: 600; }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: .7rem;
  background: var(--bg-4);
  color: var(--text-3);
  border-radius: 99px;
  padding: .1em .5em;
  font-weight: 600;
  transition: background .25s, color .25s, transform .2s;
}
.nav-item.active .nav-badge { background: var(--accent-glow); color: var(--accent); }

/* ── Main content ─────────────────────────────────────────── */
#main {
  padding: .75rem 2rem 4rem;
  overflow-y: auto;
  height: calc(100vh - 53px);
}

/* .page rules consolidated in animation block below */

/* ── Page header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: .25rem;
  flex-wrap: wrap;
}
.page-header h2 { flex: 1; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1.1rem;
  border-radius: var(--radius);
  border: none;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--accent);
  color: #0d0d0f;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-secondary {
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-4); }
.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}
.btn-danger:hover { background: rgba(224,91,91,.1); }

.btn-sm { padding: .35rem .75rem; font-size: .8rem; }

/* ── Filtres ──────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
  align-items: center;
}
.filter-chip {
  padding: .3rem .85rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0d0d0f;
  font-weight: 700;
}
.filter-select {
  padding: .3rem .75rem;
  height: 34px;
  font-size: .8rem;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 99px;
  color: var(--text-2);
  width: auto;
  cursor: pointer;
}

/* ── Grille cartes ────────────────────────────────────────── */
#cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: .8rem;
  transition: gap .2s;
}

/* ── Carte média ──────────────────────────────────────────── */
.media-card {
  background: transparent;
  border-radius: var(--radius);
  overflow: visible;
  cursor: pointer;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  animation: cardAppear .22s var(--ease-out) both;
}
@keyframes cardAppear {
  from { opacity: 0; transform: translateY(8px) scale(.98); }
  to   { opacity: 1; transform: none; }
}

/* Transition grille au changement de filtre */
#cards-grid.filter-transition {
  animation: gridRefresh .18s var(--ease-out) both;
}
@keyframes gridRefresh {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
.card-cover {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: cover;
  background: var(--bg-3);
  border-radius: var(--radius);
  flex-shrink: 0;
  transition: transform .2s var(--ease-spring), box-shadow .2s, filter .2s, opacity .2s;
}
.media-card.is-wishlist .card-cover,
.media-card.is-wishlist .card-cover-placeholder {
  opacity: .45;
  filter: saturate(0.2);
}
.media-card.is-wishlist:hover .card-cover,
.media-card.is-wishlist:hover .card-cover-placeholder {
  opacity: 1;
  filter: saturate(1);
}

/* En cours / En pause / Abandonné — grisé comme wishlist */
.media-card.is-playing .card-cover,
.media-card.is-playing .card-cover-placeholder,
.media-card.is-paused .card-cover,
.media-card.is-paused .card-cover-placeholder,
.media-card.is-dropped .card-cover,
.media-card.is-dropped .card-cover-placeholder {
  opacity: .45;
  filter: saturate(0.2);
}
.media-card.is-playing:hover .card-cover,
.media-card.is-playing:hover .card-cover-placeholder,
.media-card.is-paused:hover .card-cover,
.media-card.is-paused:hover .card-cover-placeholder,
.media-card.is-dropped:hover .card-cover,
.media-card.is-dropped:hover .card-cover-placeholder {
  opacity: 1;
  filter: saturate(1);
}
.media-card:hover .card-cover {
  transform: scale(1.04);
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.media-card {
  transition: none;
}
.card-cover-placeholder {
  width: 100%;
  aspect-ratio: 2/3;
  background: var(--bg-3);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  color: var(--text-3);
  flex-shrink: 0;
}

/* ── Bas de carte : étoiles + cœur ───────────────────────── */
.card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .25rem;
  padding: 0 .1rem;
  min-height: 1rem;
}
.card-stars {
  font-size: .85rem;
  color: var(--accent);
  letter-spacing: -.01em;
  line-height: 1;
}

/* Shimmer continu sur 10/10 */
.card-stars.perfect {
  background: linear-gradient(90deg, var(--accent) 0%, #fff8e1 40%, var(--accent-2) 60%, var(--accent) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: shimmer 2s linear infinite;
}
@keyframes shimmer {
  from { background-position: 200% center; }
  to   { background-position: -200% center; }
}
.card-heart {
  font-size: 1rem;
  color: var(--movie);
  line-height: 1;
  flex-shrink: 0;
  animation: heartbeat 1.8s ease-in-out infinite;
}
@keyframes heartbeat {
  0%, 100% { transform: scale(1);    }
  15%       { transform: scale(1.3); }
  30%       { transform: scale(1);   }
  45%       { transform: scale(1.15);}
  60%       { transform: scale(1);   }
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .5rem;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
}
.badge-game  { background: rgba(91,141,238,.15); color: var(--game); }
.badge-movie { background: rgba(224,91,127,.15); color: var(--movie); }
.badge-book  { background: rgba(91,191,141,.15); color: var(--book); }
.badge-wishlist  { background: rgba(96,96,112,.15); color: var(--text-3); }
.badge-playing   { background: rgba(91,141,238,.15); color: var(--game); }
.badge-finished  { background: rgba(91,191,141,.15); color: var(--success); }
.badge-paused    { background: rgba(255,180,50,.15);  color: var(--warn); }
.badge-dropped   { background: rgba(220,60,60,.15);   color: var(--danger); }

/* ── Étoiles / note ───────────────────────────────────────── */

.rating-stars {
  display: flex;
  gap: .1rem;
}
.star-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 28px;
  height: 28px;
}
.star-svg {
  pointer-events: none;
  display: flex;
}
.star-svg svg {
  transition: transform .12s var(--ease-spring);
}
.star-wrap:hover .star-svg svg { transform: scale(1.2); }
.star-half-zone, .star-full-zone {
  position: absolute;
  top: 0;
  height: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  z-index: 1;
}
.star-half-zone { left: 0; width: 50%; }
.star-full-zone { right: 0; width: 50%; }

/* demi-étoile sur les cartes */
.card-star-half {
  font-size: .75em;
  vertical-align: middle;
  opacity: .85;
}

/* ── Favori ───────────────────────────────────────────────── */
.fav-btn {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 30px;
  height: 30px;
  border-radius: 99px;
  border: none;
  background: rgba(13,13,15,.7);
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  backdrop-filter: blur(4px);
  z-index: 2;
  font-size: 14px;
  line-height: 1;
}
.fav-btn:hover { color: var(--accent); background: rgba(13,13,15,.9); }


/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 5rem 2rem;
  text-align: center;
  color: var(--text-3);
  gap: 1rem;
}
.empty-state .empty-icon { font-size: 4rem; }
.empty-state h3 { color: var(--text-2); font-family: var(--font-body); font-size: 1rem; font-weight: 600; }
.empty-state p { font-size: .875rem; max-width: 280px; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem 1.5rem 0;
  margin-bottom: 1.25rem;
}
.modal-header h3 { font-size: 1.1rem; }
.modal-body { padding: 0 1.5rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.modal-footer {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
}

/* ── Form groups ──────────────────────────────────────────── */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-group label { font-size: .8rem; font-weight: 600; color: var(--text-2); }

/* ── API search dans modal ────────────────────────────────── */
.api-search-wrap { position: relative; }
.api-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 50;
  max-height: 240px;
  overflow-y: auto;
  box-shadow: var(--shadow);
}
.api-result-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .75rem;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.api-result-item:last-child { border-bottom: none; }
.api-result-item:hover { background: var(--bg-4); }
.api-result-thumb {
  width: 36px;
  height: 54px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg-4);
  flex-shrink: 0;
}
.api-result-info { flex: 1; min-width: 0; }
.api-result-title { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.api-result-sub   { font-size: .75rem; color: var(--text-3); }

/* ── Dashboard stats ──────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}
.stat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
}
.stat-card .stat-label { font-size: .75rem; color: var(--text-3); font-weight: 600; }

/* ── Charts ───────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}
.chart-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}
.chart-card-compact {
  padding: .85rem 1rem;
}
.chart-card-compact .top-row {
  padding: .2rem .3rem;
}
.chart-card-compact .top-cover { width: 26px; height: 34px; }
.chart-card-compact .top-title { font-size: .78rem; }
.chart-card h3 { font-size: .875rem; font-weight: 600; color: var(--text-2); margin-bottom: 1rem; font-family: var(--font-body); }
.bar-chart { display: flex; flex-direction: column; gap: .6rem; }
.bar-item { display: flex; flex-direction: column; gap: .25rem; }
.bar-item-label {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--text-2);
}
.bar-track {
  height: 6px;
  background: var(--bg-4);
  border-radius: 99px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

/* ── Auth page ────────────────────────────────────────────── */
#page-auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem;
  background: var(--bg);
}
.auth-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}
.auth-card .logo {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 900;
  color: var(--accent);
  text-align: center;
  margin-bottom: .25rem;
}
.auth-card .tagline {
  text-align: center;
  font-size: .85rem;
  color: var(--text-3);
  margin-bottom: 2rem;
}
.auth-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.5rem;
  background: var(--bg-3);
  border-radius: var(--radius);
  padding: .25rem;
}
.auth-tab {
  flex: 1;
  padding: .5rem;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: .875rem;
  font-weight: 600;
  border-radius: calc(var(--radius) - 2px);
  transition: all var(--transition);
  cursor: pointer;
}
.auth-tab.active { background: var(--bg-2); color: var(--text); box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 1rem; }
.auth-divider {
  text-align: center;
  font-size: .75rem;
  color: var(--text-3);
  margin: .5rem 0;
}
.auth-demo-btn {
  width: 100%;
  padding: .65rem;
  border: 1px dashed var(--border-2);
  background: transparent;
  color: var(--text-3);
  border-radius: var(--radius);
  font-size: .8rem;
  cursor: pointer;
  transition: all var(--transition);
}
.auth-demo-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ── Toast ────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1.1rem;
  font-size: .85rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn .2s ease, toastOut .3s ease 2.7s forwards;
  max-width: 300px;
  display: flex;
  align-items: center;
  gap: .5rem;
  pointer-events: auto;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error   { border-color: var(--danger);  color: var(--danger); }
.toast.info    { border-color: var(--accent);  color: var(--accent); }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(20px); } }

/* ── Spinner ──────────────────────────────────────────────── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  display: inline-block;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Responsive (tablet 681–900px handled separately below) ── */
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
}
/* Suppression de l'ancienne règle 480px — gérée dans le bloc 680px consolidé */

/* ── Toggle switch ────────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: .5rem 0;
}
.toggle-label {
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-2);
}
.toggle-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.toggle-track {
  width: 40px;
  height: 22px;
  background: var(--bg-4);
  border: 1px solid var(--border-2);
  border-radius: 99px;
  display: flex;
  align-items: center;
  padding: 2px;
  transition: background var(--transition), border-color var(--transition);
  cursor: pointer;
}
.toggle-thumb {
  width: 16px;
  height: 16px;
  background: var(--text-3);
  border-radius: 50%;
  transition: transform var(--transition), background var(--transition);
}
.toggle-switch input:checked ~ .toggle-track {
  background: var(--accent-glow);
  border-color: var(--accent);
}
.toggle-switch input:checked ~ .toggle-track .toggle-thumb {
  transform: translateX(18px);
  background: var(--accent);
}

/* ── Details / advanced section ──────────────────────────── */
.advanced-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.advanced-summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .65rem .9rem;
  cursor: pointer;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  user-select: none;
  list-style: none;
  transition: background var(--transition);
}
.advanced-summary::-webkit-details-marker { display: none; }
.advanced-summary::before {
  content: "›";
  font-size: 1rem;
  color: var(--text-3);
  transition: transform var(--transition);
  display: inline-block;
}
details[open] .advanced-summary::before { transform: rotate(90deg); }
.advanced-summary:hover { background: var(--bg-3); }
.advanced-hint {
  font-weight: 400;
  color: var(--text-3);
  font-size: .75rem;
}
.advanced-body {
  padding: .75rem .9rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

/* ── Découverte ───────────────────────────────────────────── */
.discover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.25rem;
}
.discover-card {
  cursor: default;
}
.discover-loading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 4rem 2rem;
  color: var(--text-3);
  font-size: .875rem;
}

/* ── Discover reason (Groq) ───────────────────────────────── */
.discover-reason {
  display: flex;
  align-items: flex-start;
  gap: .3rem;
  font-size: .72rem;
  color: var(--text-2);
  margin-top: .5rem;
  line-height: 1.45;
  background: rgba(200,169,110,.08);
  border-left: 2px solid var(--accent);
  padding: .3rem .45rem;
  border-radius: 0 4px 4px 0;
}
.discover-reason-icon {
  color: var(--accent);
  flex-shrink: 0;
  font-size: .7rem;
  margin-top: .05rem;
}
.discover-desc {
  font-size: .72rem;
  color: var(--text-3);
  margin-top: .35rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Fiche détaillée ──────────────────────────────────────── */
.detail-modal {
  max-width: 640px;
  overflow: hidden;
  padding: 0;
}

/* ── Backdrop ── */
.detail-backdrop {
  position: relative;
  height: 200px;
  background: var(--bg-3);
  overflow: hidden;
  flex-shrink: 0;
}
.detail-backdrop.has-backdrop {
  height: 240px;
}
.detail-backdrop-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom,
    rgba(0,0,0,.35) 0%,
    rgba(0,0,0,.65) 60%,
    rgba(13,13,15,1) 100%);
  z-index: 1;
}
/* Fallback poster flou — via ::before pour ne pas flouter les enfants */
.detail-backdrop.has-fallback {
  background: none !important;
}
.detail-backdrop.has-fallback::before {
  content: '';
  position: absolute;
  inset: -12%;
  background-image: var(--fallback-img);
  background-size: cover;
  background-position: center;
  filter: blur(22px) saturate(1.5) brightness(.85);
  z-index: 0;
}
.detail-close-btn {
  position: absolute;
  top: .85rem;
  right: .85rem;
  z-index: 10;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.15);
  color: #fff;
}
.detail-close-btn:hover { background: rgba(0,0,0,.7); }
.detail-backdrop-content {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  padding: 1rem 1.25rem;
}
.detail-poster {
  width: 80px;
  min-width: 80px;
  height: 120px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  box-shadow: 0 4px 20px rgba(0,0,0,.6);
  flex-shrink: 0;
}
.detail-poster-placeholder {
  width: 80px;
  height: 120px;
  background: var(--bg-2);
  border-radius: calc(var(--radius) - 2px);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
}
.detail-backdrop-info {
  flex: 1;
  min-width: 0;
}
.detail-title {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: .3rem;
  font-family: var(--font-display);
  color: #fff;
  text-shadow: 0 1px 8px rgba(0,0,0,.8);
}
.detail-stars {
  font-size: 1rem;
  letter-spacing: .05em;
  margin-bottom: .4rem;
}
.detail-badges {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.detail-fav {
  color: var(--accent);
  font-size: .9rem;
}

/* ── Body ── */
.detail-body {
  padding: 1rem 1.25rem .5rem;
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.detail-meta {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.detail-meta-row {
  display: flex;
  gap: .5rem;
  font-size: .82rem;
}
.detail-meta-label {
  color: var(--text-3);
  min-width: 75px;
  font-weight: 600;
}
.detail-meta-value { color: var(--text-2); }
.detail-notes {
  background: var(--bg-3);
  border-radius: var(--radius);
  padding: .75rem;
  font-size: .85rem;
  color: var(--text-2);
  line-height: 1.6;
}
.detail-notes-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  margin-bottom: .4rem;
}

/* ── Animation nouvelle carte ─────────────────────────────── */
@keyframes cardFlash {
  0%   { box-shadow: 0 0 0 0 var(--accent); transform: scale(1.03); }
  40%  { box-shadow: 0 0 0 8px transparent; }
  100% { transform: scale(1); }
}
.card-flash {
  animation: cardFlash .6s ease-out forwards;
}

/* ── Bouton ghost discover ────────────────────────────────── */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-3);
  border-radius: var(--radius);
  padding: .3rem .55rem;
  font-size: .8rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-ghost:hover {
  background: var(--bg-3);
  color: var(--text-1);
}

/* ── Synopsis fiche détaillée ─────────────────────────────── */
.detail-synopsis {
  background: var(--bg-3);
  border-radius: var(--radius);
  padding: .75rem;
  font-size: .85rem;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: .75rem;
}

/* ── Liens externes fiche détaillée ──────────────────────── */
.detail-ext-link {
  text-decoration: none;
  font-size: .72rem;
  padding: .3rem .6rem;
  opacity: .85;
  transition: opacity var(--transition);
}
.detail-ext-link:hover { opacity: 1; }

/* ── Vue liste ────────────────────────────────────────────── */
/* ── Profil / Stats ───────────────────────────────────────── */
.profile-section {
  margin-bottom: 2rem;
}
.profile-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-1);
  margin-bottom: 1rem;
  font-family: var(--font-display);
}
.stat-card.accent { border-color: var(--accent); }

/* Graphique mensuel */
.month-chart {
  display: flex;
  align-items: flex-end;
  gap: .35rem;
  height: 100px;
  padding-bottom: 1.5rem;
  position: relative;
}
.month-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  position: relative;
}
.month-bar-wrap {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
}
.month-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  transition: height .3s ease;
}
.month-label {
  font-size: .6rem;
  color: var(--text-3);
  margin-top: .25rem;
  text-align: center;
}
.month-count {
  font-size: .6rem;
  color: var(--accent);
  font-weight: 700;
  position: absolute;
  top: -1rem;
  text-align: center;
  width: 100%;
}

/* ── Histogramme des notes ────────────────────────────────── */
.rating-hist-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: .5rem;
}
.rating-hist-meta {
  display: flex;
  gap: .75rem;
}
.rating-hist-total {
  font-size: .78rem;
  color: var(--text-3);
}
.rating-hist-avg {
  font-size: .78rem;
  color: var(--text-2);
}
.rating-hist-avg strong {
  color: var(--accent);
  font-weight: 700;
}
.rating-hist {
  display: flex;
  align-items: flex-end;
  gap: .35rem;
  height: 80px;
}
.rating-hist-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
  cursor: default;
  gap: .25rem;
}
.rating-hist-col:hover .rating-hist-bar { opacity: 1; }
.rating-hist-col:hover .rating-hist-count { color: var(--accent); }
.rating-hist-count {
  font-size: .6rem;
  color: var(--text-3);
  font-weight: 600;
  line-height: 1;
  min-height: .8rem;
  transition: color .15s;
}
.rating-hist-bar {
  width: 100%;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  opacity: .35;
  transition: opacity .15s, height .4s cubic-bezier(.4,0,.2,1);
  flex-shrink: 0;
}
.rating-hist-bar.peak { opacity: 1; }

/* Légende gauche / droite */
.rating-hist-legend {
  display: flex;
  justify-content: space-between;
  margin-top: .5rem;
  font-size: .7rem;
  color: var(--text-3);
  font-weight: 500;
}

/* Top liste */
.top-list { display: flex; flex-direction: column; gap: .5rem; }
.top-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  cursor: pointer;
  padding: .3rem .4rem;
  border-radius: var(--radius);
  transition: background .15s;
}
.top-row:hover { background: var(--bg-3); }
.top-rank { font-size: .7rem; color: var(--text-3); min-width: 1rem; text-align: center; font-weight: 700; }
.top-cover { width: 32px; height: 42px; object-fit: cover; border-radius: 3px; }
.top-cover-placeholder { display:flex;align-items:center;justify-content:center;background:var(--bg-3);font-size:1rem; }
.top-title { flex: 1; font-size: .82rem; color: var(--text-1); }
.top-rating { font-size: .75rem; color: var(--accent); font-weight: 700; white-space: nowrap; }

/* Bouton vue toggle */
.btn-icon-only {
  width: 34px;
  height: 34px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

/* ============================================================
   ANIMATIONS & MICRO-INTERACTIONS
   ============================================================ */

/* ── Transitions globales enrichies ──────────────────────── */
:root {
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --ease-smooth: cubic-bezier(.4,0,.2,1);
  --ease-out:    cubic-bezier(0,0,.2,1);
  --transition:  .18s var(--ease-smooth);
}

/* Toutes les couleurs et backgrounds transitionnent */
*, *::before, *::after {
  transition-property: background-color, border-color, color, opacity;
  transition-duration: .18s;
  transition-timing-function: var(--ease-smooth);
}
/* Sauf les éléments qui ont des transitions spécifiques */
.media-card, .btn, .nav-item, .modal, .modal-overlay,
.fav-btn, .rating-stars button, .api-result-item,
.month-bar, .bar-fill, .top-row, input, select, textarea {
  transition: all var(--transition);
}

/* ── Page transitions — fade + slide ─────────────────────── */
.page { display: none; }
.page.active {
  display: block;
  animation: pageIn .3s var(--ease-out) both;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Cartes — hover enrichi ───────────────────────────────── */
.media-card {
  transition: transform .22s var(--ease-spring),
              box-shadow .22s var(--ease-smooth),
              border-color .18s var(--ease-smooth);
  will-change: transform;
}
.media-card:hover .card-cover {
  transform: scale(1.04);
  z-index: 2;
}
@media (hover: none) {
  .media-card:hover .card-cover { transform: none; box-shadow: none; }
  .media-card:active .card-cover { transform: scale(.97); transition-duration: .08s; }
}
.media-card:active .card-cover {
  transform: scale(0.99);
  transition-duration: .08s;
}

/* ── Skeleton loader ──────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-3) 25%,
    var(--bg-4) 50%,
    var(--bg-3) 75%);
  background-size: 400px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius);
}
.skeleton-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.skeleton-cover {
  width: 100%;
  aspect-ratio: 2/3;
}
.skeleton-body {
  padding: .75rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.skeleton-line { height: 10px; border-radius: 99px; }
.skeleton-line.short { width: 60%; }
.skeleton-line.xshort { width: 40%; }

/* ── Cartes — apparition en cascade (stagger) ─────────────── */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.media-card
/* ── Modal — entrée spring ────────────────────────────────── */
.modal-overlay {
  animation: overlayIn .2s var(--ease-smooth) both;
}
@keyframes overlayIn {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to   { opacity: 1; backdrop-filter: blur(6px); }
}
.modal {
  animation: modalIn .3s ease both;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Favori — pulse cœur ──────────────────────────────────── */
@keyframes heartPop {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.5); }
  60%  { transform: scale(.9); }
  100% { transform: scale(1); }
}
.fav-btn.pop {
  animation: heartPop .4s var(--ease-spring);
}
.fav-btn {
  transition: color .18s var(--ease-smooth),
              background .18s var(--ease-smooth),
              transform .18s var(--ease-spring);
}
.fav-btn:hover { transform: scale(1.15); }
.fav-btn.on {
  color: var(--accent);
  transition: color .25s var(--ease-spring), transform .25s var(--ease-spring);
}
.fav-btn:not(.on) {
  transition: color .25s var(--ease-spring);
}

/* ── Boutons — ripple + press ─────────────────────────────── */
.btn {
  position: relative;
  overflow: hidden;
  transition: all .18s var(--ease-smooth);
}
.btn:active { transform: scale(.97); }
.btn-primary:hover {
  background: var(--accent-2);
  box-shadow: 0 4px 20px rgba(200,169,110,.3);
}
.btn-secondary:hover {
  background: var(--bg-4);
  border-color: var(--border-2);
}
@keyframes ripple {
  to { transform: scale(4); opacity: 0; }
}
.ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,.15);
  width: 40px;
  height: 40px;
  margin-top: -20px;
  margin-left: -20px;
  animation: ripple .5s var(--ease-out);
  pointer-events: none;
}

/* ── Nav item — transition enrichie ──────────────────────── */
.nav-item {
  transition: background .18s var(--ease-smooth),
              color .18s var(--ease-smooth),
              transform .12s var(--ease-spring);
}
@media (hover: hover) {
  .nav-item:hover { transform: translateX(3px); }
}
.nav-item:active { transform: translateX(1px) scale(.98); }
.nav-item.active { transform: none; }
.nav-badge {
  transition: background .18s, color .18s, transform .2s var(--ease-spring);
}
.nav-badge.bounce {
  animation: badgeBounce .35s var(--ease-spring);
}
@keyframes badgeBounce {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.4); }
  100% { transform: scale(1); }
}

/* ── Étoiles de note — vague ──────────────────────────────── */
.star-full {
  transition: color .12s, transform .15s var(--ease-spring);
}
.star-full:hover { transform: scale(1.3) rotate(-5deg); }

/* ── Cartes découverte — stagger ──────────────────────────── */
@keyframes discoverIn {
  from { opacity: 0; transform: translateY(20px) scale(.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.discover-card {
  animation: discoverIn .4s var(--ease-spring) both;
}

/* ── Toast — entrée/sortie ────────────────────────────────── */

  to   { opacity: 1; transform: translateY(0) scale(1); }
}

  to   { opacity: 0; transform: translateY(8px) scale(.95); }
}
.toast {
  animation: toastIn .25s var(--ease-spring) both;
}
.toast.removing {
  animation: toastOut .2s var(--ease-smooth) both;
}

/* ── Stat cards — entrée ──────────────────────────────────── */
@keyframes statIn {
  from { opacity: 0; transform: scale(.92); }
  to   { opacity: 1; transform: scale(1); }
}
.stat-card {
  transition: transform .2s var(--ease-spring), box-shadow .2s;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.stat-card
/* ── Search bar — focus glow ──────────────────────────────── */
.topbar-search-wrap input {
  transition: box-shadow .2s var(--ease-smooth),
              border-color .2s var(--ease-smooth),
              background .2s;
}
.topbar-search-wrap input:focus {
  box-shadow: 0 0 0 3px var(--accent-glow), 0 2px 12px rgba(200,169,110,.1);
}

/* ── Sidebar indicator glide ──────────────────────────────── */
#sidebar { position: relative; }
.nav-indicator {
  position: absolute;
  left: 1rem;
  right: 1rem;
  height: 36px;
  background: var(--accent-glow);
  border-radius: var(--radius);
  pointer-events: none;
  transition: top .22s var(--ease-spring), opacity .15s;
  z-index: 0;
}
.nav-item { position: relative; z-index: 1; }

/* ── Filter chips — bounce ────────────────────────────────── */
.filter-chip {
  transition: all .18s var(--ease-spring);
}
.filter-chip:hover { transform: translateY(-1px); }
.filter-chip:active { transform: scale(.95); }
.filter-chip.active {
  box-shadow: 0 2px 12px rgba(200,169,110,.2);
}


/* ============================================================
   ANIMATIONS AVANCÉES
   ============================================================ */

/* ── Loading bar ──────────────────────────────────────────── */
#loading-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  overflow: hidden;
  pointer-events: none;
}
#loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--accent));
  background-size: 200% 100%;
  animation: shimmerBar 1.5s linear infinite;
  border-radius: 0 2px 2px 0;
  box-shadow: 0 0 8px var(--accent);
}
@keyframes shimmerBar {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Confetti ─────────────────────────────────────────────── */
.confetti-piece {
  position: fixed;
  top: -10px;
  pointer-events: none;
  z-index: 9999;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg) translateX(0); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg) translateX(calc((var(--drift,1)) * 80px)); opacity: 0; }
}

/* ── Theme wave ───────────────────────────────────────────── */
  to   { width: 250vmax; height: 250vmax; opacity: 0; }
}

/* ── Glow pulsant sur coups de cœur ──────────────────────── */
/* ── Contours pulsants cartes ─────────────────────────────── */

/* Cœur + note max : dégradé or→rouge pulsant */
@keyframes bothPulse {
  0%   { box-shadow: 0 0 0 2px rgba(200,169,110,.6), 0 0 12px 2px rgba(200,169,110,.2); }
  50%  { box-shadow: 0 0 0 2px rgba(200,169,110,1),  0 0 20px 6px rgba(200,169,110,.4); }
  100% { box-shadow: 0 0 0 2px rgba(200,169,110,.6), 0 0 12px 2px rgba(200,169,110,.2); }
}
.media-card.both .card-cover {
  animation: bothPulse 2s ease-in-out infinite;
}
.media-card.both:hover .card-cover {
  box-shadow: 0 8px 24px rgba(0,0,0,.5), 0 0 0 2px rgba(200,169,110,1), 0 0 24px 8px rgba(200,169,110,.4);
}

/* ── Transitions directionnelles entre pages ─────────────── */
@keyframes pageSlideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pageSlideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pageSlideOutLeft {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(-20px); }
}
@keyframes pageSlideOutRight {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(20px); }
}

/* ── Barres dashboard animées ────────────────────────────── */



/* ============================================================
   MOBILE RESPONSIVE + QUICK SEARCH
   ============================================================ */

/* ── Quick search dropdown ────────────────────────────────── */
.search-quick-add {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  max-height: 70vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  animation: slideDown .15s var(--ease-spring);
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.quick-result {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem .85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background .15s ease, transform .15s ease;
}
.quick-result:hover { background: var(--bg-3); transform: translateX(3px); }
.quick-thumb {
  width: 32px; height: 44px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-3);
}
.quick-thumb-ph {
  display: flex; align-items: center;
  justify-content: center; font-size: 1.1rem;
}
.quick-info { flex: 1; min-width: 0; }
.quick-title {
  font-size: .83rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.quick-sub { font-size: .72rem; color: var(--text-3); margin-top: .1rem; }



/* ── Bottom nav (mobile only) ─────────────────────────────── */
#bottom-nav {
  display: none;
}

/* ── Mobile breakpoint ────────────────────────────────────── */

/* ── Tablet ────────────────────────────────────────────────── */
@media (min-width: 681px) and (max-width: 900px) {
  #app { grid-template-columns: 180px 1fr; }
  #main { padding: .75rem 1rem 5rem; }
  #cards-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ── Topbar mobile fix ────────────────────────────────────── */

/* ── Cards mobile — plus compactes ───────────────────────── */

/* ── Fix overflow mobile ──────────────────────────────────── */

/* ── Filter bar mobile — scroll horizontal propre ─────────── */

/* swipe removed */

/* ── Bottom nav plus grande ───────────────────────────────── */

@media (min-width: 681px) {
  .category-tabs { display: none; }
}


/* ── Mobile (max-width: 680px) — consolidated ─────────────── */
@media (max-width: 680px) {
  /* Layout — une seule colonne */
  #app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
    padding-bottom: 72px; /* espace bottom nav */
    overflow-x: hidden;
  }

  /* Topbar compact */
  #topbar {
    padding: .6rem .9rem;
    gap: .6rem;
  }
  .topbar-logo { font-size: 1.1rem; }

  /* Sidebar cachée */
  #sidebar { display: none; }

  /* Main pleine largeur */
  #main {
    height: auto;
    min-height: calc(100vh - 53px - 72px);
    padding: .75rem 1rem calc(max(env(safe-area-inset-bottom), 20px) + 80px);
    overflow-x: hidden;
    overflow-y: visible;
  }

  /* Grille mobile équilibrée */
  #cards-grid { grid-template-columns: repeat(3, 1fr); gap: .6rem; }

  /* Page header compact */
  .page-header { margin-bottom: .25rem; }

  /* Filter bar scroll horizontal */
  .filter-bar {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: .5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-chip { white-space: nowrap; flex-shrink: 0; }

  /* Modal plein écran en bas */
  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }
  .modal {
    max-width: 100%;
    width: 100%;
    max-height: 92dvh; /* dvh tient compte du clavier mobile */
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: modalMobileIn .35s ease both;
    display: flex;
    flex-direction: column;
  }
  /* Drag handle visuel */
  .modal::before {
    content: '';
    display: block;
    width: 36px;
    height: 4px;
    background: var(--border-2);
    border-radius: 99px;
    margin: .75rem auto -.25rem;
    flex-shrink: 0;
  }
  .modal-header {
    padding-top: 1rem;
  }
  .modal-body {
    overflow-y: auto;
    flex: 1;
    /* Espace pour le footer fixe + safe area */
    padding-bottom: calc(max(env(safe-area-inset-bottom), 12px) + .5rem);
  }
  .modal-footer {
    flex-shrink: 0;
    padding-bottom: calc(max(env(safe-area-inset-bottom), 12px) + 1rem);
  }
  @keyframes modalMobileIn {
    from { opacity: 0; transform: translateY(40px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  /* Detail modal mobile */
  .detail-modal { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

  /* Stats grid 2 colonnes */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
  }

  /* Charts en colonne */
  .charts-row { grid-template-columns: 1fr; }

  /* Discover grid 2 colonnes */
  .discover-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: .75rem;
  }

  /* Topbar — pas de coupure */
  .topbar-right { flex-shrink: 0; }
  .topbar-search-wrap { min-width: 0; }

  /* Bottom nav visible */
  #bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg-2);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(12px);
    z-index: 150;
    padding: 0 .75rem;
    padding-bottom: max(env(safe-area-inset-bottom), 20px);
    align-items: center;
    justify-content: space-around;
    gap: .25rem;
    min-height: 58px;
  }
  .bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .2rem;
    border: none;
    background: transparent;
    color: var(--text-3);
    cursor: pointer;
    height: 52px;
    border-radius: var(--radius);
    transition: color .18s, background .18s, transform .15s var(--ease-spring);
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .02em;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav-item svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.8;
  }
  .bottom-nav-item:active { transform: scale(.85); }
  .bottom-nav-item { transition: color .2s ease, transform .15s ease; }
  .bottom-nav-item.active { color: var(--accent); }
  .bottom-nav-item.active svg { stroke: var(--accent); }

  .bottom-nav-add {
    background: var(--accent);
    color: #0d0d0f;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    box-shadow: 0 4px 16px rgba(200,169,110,.4);
  }
  .bottom-nav-add svg { stroke: #0d0d0f; width: 20px; height: 20px; }
  .bottom-nav-add.active { color: #0d0d0f; }

  /* Toast au-dessus du bottom nav — centrés */
  #toast-container {
    bottom: 84px !important;
    left: 1rem;
    right: 1rem;
    align-items: center;
  }
  .toast { max-width: 100%; }

  #topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: .6rem;
    padding: .6rem .9rem;
    position: relative;
  }
  .topbar-logo { font-size: 1.1rem; white-space: nowrap; width: auto; padding-left: 0; }
  .topbar-tagline { display: none; }
  .topbar-search-wrap {
    min-width: 0;
    max-width: none;
    width: 100%;
    margin: 0;
  }
  .topbar-right {
    margin-left: 0;
    flex-shrink: 0;
    padding-right: 0;
  }
  /* Garde uniquement le bouton thème, cache les autres boutons déco */
  .topbar-right .btn-icon { display: none; }
  .topbar-right .btn-icon.btn-theme { display: flex; }
  #loading-bar { grid-column: 1 / -1; }

  .badge { font-size: .6rem; padding: .1rem .35rem; }
  .media-card { min-width: 0; }

  .filter-bar {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100vw;
    gap: .4rem;
    padding-bottom: .4rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    mask-image: linear-gradient(to right, black 85%, transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black 85%, transparent 100%);
  }
  .filter-bar::-webkit-scrollbar { display: none; }
  .filter-chip, .filter-select { flex-shrink: 0; }

  #bottom-nav {
    height: 72px;
  }
  /* .bottom-nav-item height already set above */
  .bottom-nav-item svg {
    width: 24px;
    height: 24px;
  }
  .bottom-nav-add {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
  }
  .bottom-nav-add svg {
    width: 22px;
    height: 22px;
  }
  #app { padding-bottom: 72px; }
  #toast-container { bottom: 84px !important; }

  /* Onglets catégories fixes sous le titre */

  .category-tabs {
    display: flex;
    gap: .4rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .category-tabs::-webkit-scrollbar { display: none; }
}

/* Category tabs — global (desktop + mobile) */
.category-tab {
  flex-shrink: 0;
  padding: .3rem .85rem;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .18s var(--ease-spring);
}
.category-tab.active {
  background: var(--accent);
  color: #0d0d0f;
  border-color: var(--accent);
  font-weight: 700;
}
.category-tab:active { transform: scale(.93); }

/* ── Journal des terminés ─────────────────────────────────── */



/* ── Quick search — résultats API ─────────────────────────── */
.quick-section-label {
  padding: .4rem .85rem .25rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.quick-spinner {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
.quick-result-api { border-top: none; }
.quick-add-icon {
  flex-shrink: 0;
  color: var(--accent);
  opacity: 0;
  transition: opacity .15s;
}
.quick-result-api:hover .quick-add-icon { opacity: 1; }

.quick-add-fallback {
  padding: .55rem .85rem;
  font-size: .82rem;
  color: var(--text-2);
  cursor: pointer;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .4rem;
  transition: background var(--transition);
}
.quick-add-fallback:hover { background: var(--bg-3); color: var(--accent); }
.quick-add-fallback strong { color: var(--text-1); }

/* ── Activité partagée ───────────────────────────────────────── */
.activity-date-group { margin-bottom: 1.5rem; }

.activity-date-label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
  padding: .4rem 0;
  margin-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}

.activity-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .75rem 0;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
  border-radius: var(--radius);
}
.activity-row:last-child { border-bottom: none; }

.activity-cover {
  width: 44px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-3);
}
.activity-cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.activity-info { flex: 1; min-width: 0; }

.activity-line {
  font-size: .82rem;
  color: var(--text-2);
  margin-bottom: .2rem;
  display: flex;
  align-items: center;
  gap: .3rem;
  flex-wrap: wrap;
}
.activity-username {
  font-weight: 700;
  color: var(--text-1);
  display: flex;
  align-items: center;
  gap: .3rem;
}
.activity-verb { color: var(--text-3); }

.activity-me-badge {
  font-size: .62rem;
  font-weight: 600;
  background: var(--accent);
  color: var(--bg-1);
  padding: .1rem .35rem;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

.activity-title {
  font-size: .92rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .3rem;
}

.activity-meta {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.activity-stars {
  font-size: .82rem;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: .2rem;
}

.activity-time {
  font-size: .72rem;
  color: var(--text-3);
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: .2rem;
}

/* ── Page Profil ─────────────────────────────────────────────── */

/* ── Rating tooltip label ────────────────────────────────────── */
.rating-tooltip-label {
  font-size: .78rem;
  font-weight: 400;
  color: var(--accent);
  opacity: 0;
  transition: opacity .15s;
  font-style: italic;
}

/* ── Comparaison ─────────────────────────────────────────────── */
.comparison-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}
.comparison-block-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-3);
  margin-bottom: .85rem;
}
.comparison-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .65rem 0;
  border-bottom: 1px solid var(--border);
}
.comparison-row:last-child { border-bottom: none; }
.comparison-row-sm { padding: .45rem 0; }

.comparison-cover {
  width: 40px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-3);
}
.comparison-cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.comparison-info { flex: 1; min-width: 0; }
.comparison-title {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: .35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.comparison-bars { display: flex; flex-direction: column; gap: .3rem; }
.comparison-bar-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.comparison-name {
  font-size: .72rem;
  color: var(--text-3);
  width: 3.5rem;
  flex-shrink: 0;
}

/* ── Comparaison ─────────────────────────────────────────────── */
.comparison-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 680px) {
  .comparison-top { grid-template-columns: 1fr; }
}

/* Compatibilité */
.compat-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.compat-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .75rem;
}
.compat-emoji { font-size: 1.5rem; }
.compat-info { flex: 1; min-width: 0; }
.compat-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--text-1);
}
.compat-details {
  font-size: .73rem;
  color: var(--text-3);
  margin-top: .15rem;
}
.compat-score {
  font-size: 1.6rem;
  font-weight: 800;
  font-family: var(--font-display);
  flex-shrink: 0;
}
.compat-bar-track {
  height: 6px;
  background: var(--bg-4);
  border-radius: 99px;
  overflow: hidden;
}
.compat-bar-fill {
  height: 100%;
  border-radius: 99px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}

/* Course du mois */
.race-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.race-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: .85rem;
}
.race-bar-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .6rem;
}
.race-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .1rem;
  flex-shrink: 0;
  min-width: 2.5rem;
}
.race-side-other { align-items: flex-end; }
.race-name { font-size: .7rem; color: var(--text-3); }
.race-count { font-size: 1.1rem; font-weight: 700; color: var(--text-1); }
.race-bar-track {
  flex: 1;
  height: 10px;
  background: var(--bg-4);
  border-radius: 99px;
  overflow: hidden;
  display: flex;
}
.race-bar-me {
  height: 100%;
  background: var(--accent);
  border-radius: 99px 0 0 99px;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.race-bar-other {
  height: 100%;
  background: var(--movie);
  border-radius: 0 99px 99px 0;
  transition: width .8s cubic-bezier(.4,0,.2,1);
}
.race-leader {
  font-size: .78rem;
  color: var(--text-3);
  text-align: center;
}

/* Blocs comparaison */
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.comparison-block {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.comparison-block-title {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: .75rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.comparison-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
}
.comparison-row:last-child { border-bottom: none; }
.comparison-row-sm { padding: .4rem 0; }
.comparison-cover {
  width: 36px;
  height: 50px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
  background: var(--bg-3);
}
.comparison-cover-ph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.comparison-info { flex: 1; min-width: 0; }
.comparison-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .3rem;
}
.comparison-bars { display: flex; flex-direction: column; gap: .3rem; }
.comparison-bar-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.comparison-name {
  font-size: .7rem;
  color: var(--text-3);
  width: 3.5rem;
  flex-shrink: 0;
}

/* ── Identity bar dans profil fusionné ───────────────────────── */
.profile-identity-bar {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.star-wrap svg {
  transition: transform .12s var(--ease-spring);
  display: block;
}
.star-wrap:hover svg { transform: scale(1.2); }

:root { --star-empty: var(--border-2); }
#rating-stars { display: flex; gap: 2px; align-items: center; }
.star-wrap { display: inline-flex; }
.star-btn {
  background: none; border: none; padding: 0; cursor: pointer;
  display: flex; align-items: center;
  transition: transform .1s var(--ease-spring);
}
.star-btn:hover { transform: scale(1.2); }
.star-half-btn { margin-right: -2px; }

/* ── Star rating ──────────────────────────────────────────── */
:root { --star-empty: var(--border-2); }
#rating-stars { display: flex; gap: 4px; align-items: center; }
.star-wrap {
  position: relative;
  display: inline-flex;
  width: 28px;
  height: 28px;
  cursor: pointer;
}
.star-svg { display: block; pointer-events: none; }
.star-svg polygon { transition: fill .1s; }
.star-zone {
  position: absolute;
  top: 0; height: 100%;
  background: none; border: none; padding: 0; cursor: pointer;
}
.star-zone-half { left: 0; width: 50%; }
.star-zone-full { right: 0; width: 50%; }
.star-wrap:hover .star-svg { transform: scale(1.15); }
.star-wrap { transition: transform .1s var(--ease-spring); }

/* ── Modal type tabs ─────────────────────────────────────── */
.modal-search-unified { gap: .75rem; }

.modal-type-tabs {
  display: flex;
  gap: .4rem;
  margin-bottom: .25rem;
}

.modal-type-tab {
  flex: 1;
  padding: .45rem .25rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-1);
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  text-align: center;
}

.modal-type-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.modal-type-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 600;
}

/* ── Wizard modal ───────────────────────────────────────────── */
.modal-wizard {
  max-width: 440px;
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.wz-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: .875rem 1.5rem;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.wz-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .35rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-3);
  transition: color .2s;
  min-width: 64px;
  text-align: center;
}
.wz-step.active { color: var(--accent); }
.wz-step.done   { color: var(--success, #4caf82); }
.wz-dot {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--bg-3);
  border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
  transition: all .2s;
}
.wz-step.active .wz-dot { background: var(--accent); border-color: var(--accent); color: #000; }
.wz-step.done   .wz-dot { background: var(--success, #4caf82); border-color: var(--success, #4caf82); color: #fff; }
.wz-line { flex: 1; height: 2px; background: var(--border); margin: 0 .5rem; margin-bottom: .9rem; }

.wz-hint {
  text-align: center;
  color: var(--text-2);
  font-size: 1rem;
  font-weight: 500;
  margin: 0 0 1.5rem;
  padding: .75rem 1rem;
  background: var(--bg-3);
  border-radius: var(--radius);
  line-height: 1.4;
}
.wz-skip-hint {
  text-align: center;
  color: var(--text-3);
  font-size: .75rem;
  margin: .75rem 0 0;
  font-style: italic;
}

/* Étape 1 — type grid */
.wz-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .75rem;
}
.wz-type-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  padding: 1.25rem .5rem;
  background: var(--bg-3);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all .15s;
  color: var(--text-2);
}
.wz-type-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
.wz-type-btn.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); transform: translateY(-2px); }
.wz-type-icon { font-size: 2rem; line-height: 1; }
.wz-type-label { font-size: .8rem; font-weight: 600; }

/* Étape 2 — preview sélection */
.wz-selected-preview {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  border-radius: var(--radius);
  margin-top: .75rem;
}
.wz-preview-cover { width: 36px; height: 52px; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.wz-preview-title { font-weight: 600; font-size: .9rem; color: var(--text-1); }
.wz-preview-sub   { font-size: .75rem; color: var(--text-3); }
.wz-clear-btn {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 1rem; padding: .25rem;
  margin-left: auto; flex-shrink: 0;
}
.wz-clear-btn:hover { color: var(--text-1); }

/* Étape 3 — header avec cover */
.wz-step3-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.25rem;
}
.wz-step3-cover { width: 44px; height: 62px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.wz-step3-title { font-weight: 700; font-size: 1rem; color: var(--text-1); }

/* Étape 3 — statut grid */
.wz-status-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.wz-status-btn {
  padding: .4rem .75rem;
  background: var(--bg-3);
  border: 2px solid transparent;
  border-radius: 999px;
  font-size: .8rem;
  cursor: pointer;
  color: var(--text-2);
  transition: all .15s;
}
.wz-status-btn:hover  { border-color: var(--accent); color: var(--accent); }
.wz-status-btn.active { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); font-weight: 600; animation: statusPop .2s ease; }
@keyframes statusPop { 0% { transform: scale(1); } 50% { transform: scale(1.06); } 100% { transform: scale(1); } }

.wz-body {
  animation: wzStepIn .25s cubic-bezier(.4,0,.2,1) both;
}
@keyframes wzStepIn {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Wizard mobile — plein écran ────────────────────────────── */
@media (max-width: 600px) {
  /* Modal overlay plein écran */
  .modal-overlay:has(.modal-wizard) {
    align-items: flex-end;
    padding: 0;
  }
  .modal-wizard {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    display: flex;
    flex-direction: column;
  }
  .modal-wizard .modal-header {
    flex-shrink: 0;
    padding-top: max(1rem, env(safe-area-inset-top));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }
  .modal-wizard .wz-progress {
    flex-shrink: 0;
  }
  .modal-wizard .modal-body {
    flex: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-bottom: 1rem;

  }
  .modal-wizard .modal-footer {
    flex-shrink: 0;
    padding-bottom: max(1.5rem, calc(env(safe-area-inset-bottom) + 1rem));
  }
  .modal-wizard .api-results {
    max-height: none;
    overflow-y: visible;
  }
  .wz-type-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: .75rem;
  }
  .wz-type-btn { padding: 1.5rem .5rem; }
  .wz-type-icon { font-size: 2.25rem; }
}

/* ── Filter bar fusionnée ───────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem var(--content-px);
  overflow: hidden;
}
.filter-bar .category-tabs {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
  display: flex;
  gap: .35rem;
  padding: .1rem 0;
  -webkit-overflow-scrolling: touch;
}
.filter-bar .category-tabs::-webkit-scrollbar { display: none; }
.filter-actions { flex-shrink: 0; }

/* btn-filter-toggle hérite du style category-tab */
.btn-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  white-space: nowrap;
}
.btn-filter-toggle.has-filter { border-color: var(--accent) !important; color: var(--accent) !important; background: color-mix(in srgb, var(--accent) 15%, transparent) !important; }

/* Modal filtres */
.filter-modal {
  max-width: 420px;
}
.filter-modal-section {
  margin-bottom: 1.5rem;
}
.filter-modal-section:last-child { margin-bottom: 0; }
.filter-modal-label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: .6rem;
}
.filter-modal-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.filter-active-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--accent);
  color: #0d0d0f;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 800;
  margin-left: .35rem;
  vertical-align: middle;
}


/* Couche backdrop qui fade par-dessus le fallback */
.detail-backdrop-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  z-index: 0;
  transition: opacity .6s ease;
}

/* ── Sections fiche détail enrichie ────────────────────────── */
.detail-section {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}
.detail-section-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-3);
}
.detail-section-content { }
.detail-synopsis-text {
  font-size: .88rem;
  color: var(--text-2);
  line-height: 1.65;
  margin: 0;
}
.detail-chips {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
}
.detail-chip {
  display: inline-block;
  padding: .25rem .65rem;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: .78rem;
  color: var(--text-2);
  font-weight: 500;
}

/* ── Synopsis tronqué avec voir plus ───────────────────────── */
.detail-synopsis-wrap {
  position: relative;
}
.detail-synopsis-wrap:not(.expanded) .detail-synopsis-text {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail-synopsis-wrap:not(.expanded)::after {
  content: '';
  position: absolute;
  bottom: 22px;
  left: 0; right: 0;
  height: 2rem;
  background: linear-gradient(to bottom, transparent, var(--bg-1));
  pointer-events: none;
}
.detail-synopsis-toggle {
  display: block;
  margin-top: .35rem;
  background: none;
  border: none;
  color: var(--accent);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}
.detail-synopsis-toggle:hover { text-decoration: underline; }

/* ── Label statut sur les cards ─────────────────────────────── */
.card-status-label {
  position: absolute;
  bottom: 2rem;
  left: .5rem;
  background: rgba(13,13,15,.75);
  backdrop-filter: blur(6px);
  color: var(--text-2);
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: .2rem .45rem;
  border-radius: 99px;
  border: 1px solid rgba(255,255,255,.08);
  pointer-events: none;
  opacity: 1;
  transition: opacity .2s ease;
}
.media-card:hover .card-status-label {
  opacity: 0;
}
