/* ============================================================
   SYNAPSE — direction artistique cyberpunk / réseau neuronal
   ============================================================ */
:root {
  --bg: #07060d;
  --bg-2: #0e0c1a;
  --bg-3: #151228;
  --line: rgba(5, 217, 232, 0.22);
  --pink: #ff2a6d;
  --cyan: #05d9e8;
  --yellow: #f9f002;
  --text: #e9e6f5;
  --muted: #8a85a8;
  --bevel: 12px;
  --bevel-sm: 7px;
  --font-title: 'Orbitron', system-ui, sans-serif;
  --font-mono: 'Share Tech Mono', ui-monospace, monospace;
  --clip: polygon(var(--bevel) 0, 100% 0, 100% calc(100% - var(--bevel)), calc(100% - var(--bevel)) 100%, 0 100%, 0 var(--bevel));
  --clip-sm: polygon(var(--bevel-sm) 0, 100% 0, 100% calc(100% - var(--bevel-sm)), calc(100% - var(--bevel-sm)) 100%, 0 100%, 0 var(--bevel-sm));
  --gutter: clamp(16px, 4vw, 48px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.5;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
a { color: var(--cyan); text-decoration: none; }
a:hover { color: var(--yellow); }
img { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
code, .code { font-family: var(--font-mono); color: var(--yellow); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
::selection { background: var(--pink); color: var(--bg); }

.muted { color: var(--muted); }
.tiny { font-size: 0.78rem; }
.accent { color: var(--yellow); text-shadow: 0 0 10px rgba(249, 240, 2, 0.5); }

/* ---------- Fond : canvas neuronal, grille synthwave, scanlines ---------- */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -3; pointer-events: none; opacity: 0.85; }
.synth-grid {
  position: fixed; left: 0; right: 0; bottom: 0; height: 45vh; z-index: -2; pointer-events: none;
  overflow: hidden;
  mask-image: linear-gradient(to top, rgba(0,0,0,0.7), transparent 85%);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.7), transparent 85%);
  opacity: 0.35;
}
/* Animation sur transform uniquement (composée par le GPU, sans repeindre). */
.synth-grid::before {
  content: ''; position: absolute; left: -50%; right: -50%; top: -60px; bottom: 0;
  background-image:
    linear-gradient(rgba(255, 42, 109, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 42, 109, 0.35) 1px, transparent 1px);
  background-size: 60px 60px;
  transform-origin: 50% 100%;
  transform: perspective(320px) rotateX(62deg) translateY(0);
  animation: grid-move 6s linear infinite;
  will-change: transform;
}
@keyframes grid-move { to { transform: perspective(320px) rotateX(62deg) translateY(60px); } }
.scanlines {
  position: fixed; inset: 0; z-index: 100; pointer-events: none;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.018) 0 1px, transparent 1px 3px);
}
/* Vignettage : derrière le contenu (il assombrissait la barre du haut et les coins). */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0,0,0,0.55));
}

/* ---------- Glitch ---------- */
.logo-glitch, .glitch-text { position: relative; display: inline-block; }
.logo-glitch::before, .logo-glitch::after,
.glitch-text::before, .glitch-text::after {
  content: attr(data-text);
  position: absolute; inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.logo-glitch::before, .glitch-text::before {
  color: var(--pink); transform: translate(-2px, 0);
  clip-path: inset(0 0 55% 0);
  animation: glitch-a 3.2s infinite steps(1);
}
.logo-glitch::after, .glitch-text::after {
  color: var(--cyan); transform: translate(2px, 0);
  clip-path: inset(50% 0 0 0);
  animation: glitch-b 2.7s infinite steps(1);
}
.glitch-text { color: var(--text); }
.glitch-text.big { font-family: var(--font-title); font-size: clamp(1.3rem, 4vw, 2.2rem); letter-spacing: 0.06em; }
@keyframes glitch-a {
  0%, 86%, 100% { transform: translate(-2px, 0); clip-path: inset(0 0 55% 0); }
  88% { transform: translate(-6px, -1px); clip-path: inset(10% 0 70% 0); }
  91% { transform: translate(4px, 1px); clip-path: inset(40% 0 30% 0); }
  94% { transform: translate(-3px, 0); clip-path: inset(70% 0 5% 0); }
}
@keyframes glitch-b {
  0%, 82%, 100% { transform: translate(2px, 0); clip-path: inset(50% 0 0 0); }
  84% { transform: translate(6px, 1px); clip-path: inset(60% 0 15% 0); }
  88% { transform: translate(-4px, -1px); clip-path: inset(20% 0 55% 0); }
  92% { transform: translate(3px, 0); clip-path: inset(5% 0 80% 0); }
}

/* ---------- En-tête ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 12px var(--gutter);
  /* PWA : place pour l'encoche / la barre d'état en mode standalone */
  padding-top: max(12px, env(safe-area-inset-top));
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
  background: linear-gradient(to bottom, rgba(7, 6, 13, 0.97), rgba(7, 6, 13, 0.9));
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 42, 109, 0.25), 0 6px 30px rgba(0,0,0,0.5);
}
.logo { flex-shrink: 0; }
.logo-glitch {
  font-family: var(--font-title); font-weight: 900; font-size: 1.45rem; letter-spacing: 0.08em;
  color: var(--text);
  text-shadow: 0 0 12px rgba(5, 217, 232, 0.55);
}
.logo-glitch b { color: var(--pink); font-weight: 900; text-shadow: 0 0 12px var(--pink); }
.logo:hover .logo-glitch::before { animation-duration: 0.4s; }
.logo:hover .logo-glitch::after { animation-duration: 0.35s; }

.nav { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  position: relative; white-space: nowrap;
  padding: 8px 12px;
  color: #b4afd0;
  font-family: var(--font-title); font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  transition: color 0.2s;
}
.nav a::after {
  content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px;
  background: var(--pink); box-shadow: 0 0 8px var(--pink);
  transform: scaleX(0); transform-origin: left; transition: transform 0.25s;
}
.nav a:hover { color: var(--text); }
.nav a.active { color: var(--cyan); text-shadow: 0 0 8px rgba(5, 217, 232, 0.6); }
.nav a.active::after, .nav a:hover::after { transform: scaleX(1); }
.nav-search { color: var(--yellow) !important; }
.account { flex-shrink: 0; display: flex; align-items: center; }
.install-btn { flex-shrink: 0; margin-left: auto; }
.install-btn:not([hidden]) + .account { margin-left: 0; }
.account-link { display: flex; align-items: center; gap: 8px; color: var(--text); }
.account-link:hover .avatar { box-shadow: 0 0 16px hsl(var(--h) 100% 60%); }
.account-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tag {
  display: inline-block; padding: 1px 8px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em;
  border: 1px solid var(--yellow); color: var(--yellow);
}
.tag-ghost { border-color: var(--muted); color: var(--muted); }

/* ---------- Mise en page ---------- */
.main { padding: 24px var(--gutter) 60px; min-height: 70vh; outline: none; }
.page-in { animation: page-in 0.35s ease-out; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); filter: hue-rotate(40deg); } to { opacity: 1; transform: none; filter: none; } }
.page-head { margin: 8px 0 24px; }
.page-head.center { text-align: center; }
.page-title {
  margin: 0 0 6px;
  font-family: var(--font-title); font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase;
  font-size: clamp(1.5rem, 4vw, 2.4rem);
  color: var(--text);
  text-shadow: 0 0 18px rgba(255, 42, 109, 0.45);
}
.page-title::before { content: '// '; color: var(--pink); }
.glitch-text.page-title::before { content: attr(data-text); }

.panel {
  position: relative;
  background: linear-gradient(135deg, rgba(21, 18, 40, 0.92), rgba(14, 12, 26, 0.92));
  clip-path: var(--clip);
  padding: 20px;
  border-left: 2px solid var(--cyan);
}

.empty { text-align: center; padding: 60px 16px; max-width: 560px; margin: 0 auto; }
.empty-glyph { font-family: var(--font-title); font-size: 3rem; margin: 0; color: var(--pink); text-shadow: 0 0 20px var(--pink); }
.empty .btn { margin-top: 12px; }
.boot { display: grid; place-items: center; min-height: 50vh; font-family: var(--font-title); letter-spacing: 0.1em; }

/* ---------- Boutons ---------- */
.btn {
  position: relative; isolation: isolate;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  font-family: var(--font-title); font-weight: 700; font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--bg); background: var(--cyan);
  border: 0; cursor: pointer;
  clip-path: var(--clip-sm);
  transition: transform 0.12s, filter 0.2s, background 0.2s, color 0.2s;
}
.btn:hover { filter: drop-shadow(0 0 10px currentColor) brightness(1.15); color: var(--bg); transform: translateY(-1px); }
.btn:active { transform: translateY(1px) scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; transform: none; }
.btn-pink { background: var(--pink); color: #fff; }
.btn-pink:hover { color: #fff; box-shadow: inset 0 0 0 100px rgba(255,255,255,0.08); }
.btn-cyan { background: var(--cyan); }
.btn-yellow { background: var(--yellow); }
.btn-ghost { background: var(--cyan); color: var(--cyan); }
.btn-ghost::before {
  content: ''; position: absolute; inset: 1px; z-index: -1;
  background: var(--bg-2); clip-path: var(--clip-sm);
  transition: background 0.2s;
}
.btn-ghost:hover { color: var(--bg); }
.btn-ghost:hover::before { background: transparent; }
.btn-ghost.active { color: var(--yellow); background: var(--yellow); }
.btn-ghost.active:hover { color: var(--bg); }
.btn-sm { padding: 7px 12px; font-size: 0.68rem; }
.btn-big { padding: 18px 34px; font-size: 1rem; }
.btn-block { width: 100%; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 0 8px; }
.chip {
  display: inline-block; padding: 6px 12px;
  border: 1px solid var(--line); background: rgba(5, 217, 232, 0.06);
  color: var(--cyan); font-size: 0.82rem; cursor: pointer;
  clip-path: var(--clip-sm);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.chip:hover { background: var(--cyan); color: var(--bg); box-shadow: 0 0 14px var(--cyan); }
.chip-sm { padding: 2px 8px; font-size: 0.75rem; }

/* ---------- Avatar ---------- */
.avatar {
  --h: 320;
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 40px; height: 40px;
  font-family: var(--font-title); font-weight: 900;
  color: var(--bg);
  background: hsl(var(--h) 100% 60%);
  clip-path: polygon(25% 0, 75% 0, 100% 50%, 75% 100%, 25% 100%, 0 50%);
  box-shadow: 0 0 10px hsl(var(--h) 100% 60%);
  text-shadow: 0 0 2px rgba(255,255,255,0.6);
  transition: box-shadow 0.2s;
}
.avatar-sm { width: 30px; height: 30px; font-size: 0.85rem; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 52px; height: 52px; font-size: 1.3rem; }
.avatar-xl { width: 96px; height: 96px; font-size: 2.6rem; }

/* ---------- Hero ---------- */
.hero {
  --bgimg: none;
  position: relative; min-height: clamp(320px, 55vh, 560px);
  display: flex; align-items: flex-end;
  margin: -24px calc(-1 * var(--gutter)) 0;
  padding: 40px var(--gutter);
  background: linear-gradient(90deg, rgba(7,6,13,0.92) 0%, rgba(7,6,13,0.55) 45%, rgba(7,6,13,0.05) 100%), var(--bgimg) center / cover no-repeat;
  overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  background: linear-gradient(transparent, var(--bg));
  pointer-events: none;
}
.hero-loading { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
.hero-content { position: relative; z-index: 1; max-width: 640px; animation: page-in 0.6s ease-out; }
.hero-kicker { color: var(--pink); margin: 0 0 6px; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.82rem; }
.hero-title {
  margin: 0; font-family: var(--font-title); font-weight: 900; text-transform: uppercase;
  font-size: clamp(1.6rem, 5vw, 3.2rem); line-height: 1.05; letter-spacing: 0.03em;
  text-shadow: 0 0 24px rgba(5, 217, 232, 0.45), 2px 2px 0 rgba(255, 42, 109, 0.6);
}
.hero-meta { color: var(--yellow); margin: 10px 0; }
.hero-overview {
  color: #cfcbe2; margin: 0 0 20px;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* ---------- Rangées ---------- */
.row { margin: 28px 0; }
.row-head { display: flex; align-items: center; gap: 16px; margin-bottom: 12px; }
.row-title {
  margin: 0; font-family: var(--font-title); font-size: clamp(0.95rem, 2.4vw, 1.2rem); letter-spacing: 0.08em; text-transform: uppercase;
}
.row-title::before { content: '▍'; color: var(--pink); text-shadow: 0 0 10px var(--pink); margin-right: 4px; }
.row-link { font-size: 0.85rem; }
.row-arrows { margin-left: auto; display: flex; gap: 6px; }
.row-arrow {
  width: 34px; height: 34px; border: 1px solid var(--line); background: var(--bg-2); color: var(--cyan);
  cursor: pointer; font-size: 1.2rem; clip-path: var(--clip-sm); transition: background 0.2s, color 0.2s;
}
.row-arrow:hover { background: var(--cyan); color: var(--bg); }
.row-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: clamp(130px, 15vw, 180px);
  gap: 16px; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; padding: 6px 4px 14px;
  scrollbar-width: thin; scrollbar-color: var(--pink) transparent;
}
.row-track > * { scroll-snap-align: start; }
.row-track::-webkit-scrollbar { height: 6px; }
.row-track::-webkit-scrollbar-thumb { background: var(--pink); }
.row-empty { padding: 12px 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px 16px; }
.more { display: flex; justify-content: center; margin: 28px 0; }

/* ---------- Cartes ---------- */
.card { display: block; color: var(--text); transition: transform 0.2s, filter 0.2s; min-width: 0; }
.card:hover { color: var(--text); transform: translateY(-4px); filter: drop-shadow(0 0 10px rgba(255, 42, 109, 0.7)); }
.card:hover .card-title { color: var(--cyan); }
.card-poster {
  position: relative; aspect-ratio: 2 / 3; overflow: hidden;
  background: var(--bg-3);
  clip-path: var(--clip);
}
.card-poster::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(transparent 60%, rgba(7,6,13,0.8));
  pointer-events: none;
}
.card-poster img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s; }
.card:hover .card-poster img { transform: scale(1.05); }
.noposter {
  width: 100%; height: 100%; display: grid; place-items: center; padding: 12px; text-align: center;
  background: repeating-linear-gradient(45deg, var(--bg-3) 0 10px, var(--bg-2) 10px 20px);
  font-family: var(--font-title); font-size: 0.8rem; color: var(--muted);
}
.badge {
  position: absolute; z-index: 1;
  padding: 2px 7px; font-size: 0.75rem; font-weight: bold; line-height: 1.4;
  clip-path: var(--clip-sm);
}
.badge-tmdb { left: 8px; bottom: 8px; background: rgba(7,6,13,0.85); color: var(--yellow); border-left: 2px solid var(--yellow); }
.badge-mine { right: 8px; top: 8px; background: var(--pink); color: #fff; box-shadow: 0 0 10px var(--pink); }
.badge-their { left: 8px; top: 8px; background: var(--cyan); color: var(--bg); }
.badge-wl { right: 8px; bottom: 8px; background: var(--yellow); color: var(--bg); }
.card-body { padding: 8px 2px 0; }
.card-title {
  margin: 0; font-family: var(--font-mono); font-size: 0.92rem; font-weight: normal; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  transition: color 0.2s;
}
.card-year { font-size: 0.78rem; color: var(--muted); }
.card-reason { margin: 4px 0 0; font-size: 0.75rem; color: var(--muted); line-height: 1.3; }
.card-reason strong { color: var(--pink); font-weight: normal; }

.skeleton .card-poster { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Jauge d'impulsions ---------- */
.gauge { display: flex; gap: 4px; align-items: center; }
.gauge .seg {
  width: 14px; height: 10px; flex-shrink: 0;
  background: rgba(5, 217, 232, 0.08);
  border: 1px solid rgba(5, 217, 232, 0.25);
  clip-path: polygon(3px 0, 100% 0, calc(100% - 3px) 100%, 0 100%);
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
}
.gauge .seg.on {
  background: linear-gradient(90deg, var(--pink), #ff6ac1);
  border-color: var(--pink);
  box-shadow: 0 0 8px var(--pink);
}
.gauge .seg.on:nth-child(n+7) { background: linear-gradient(90deg, #ff6ac1, var(--yellow)); border-color: var(--yellow); box-shadow: 0 0 10px var(--yellow); }
.gauge-input { gap: 6px; padding: 6px 0; outline-offset: 4px; }
.gauge-input .seg { width: clamp(18px, 6vw, 28px); height: 26px; padding: 0; cursor: pointer; }
.gauge-input .seg:hover { transform: scaleY(1.15); }
.gauge-input .seg.preview { background: linear-gradient(90deg, rgba(5,217,232,0.6), var(--cyan)); border-color: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.gauge.fire .seg.on { animation: neuron-fire 0.5s ease-out backwards; }
.gauge.fire .seg.on:nth-child(1) { animation-delay: 0s; }
.gauge.fire .seg.on:nth-child(2) { animation-delay: 0.03s; }
.gauge.fire .seg.on:nth-child(3) { animation-delay: 0.06s; }
.gauge.fire .seg.on:nth-child(4) { animation-delay: 0.09s; }
.gauge.fire .seg.on:nth-child(5) { animation-delay: 0.12s; }
.gauge.fire .seg.on:nth-child(6) { animation-delay: 0.15s; }
.gauge.fire .seg.on:nth-child(7) { animation-delay: 0.18s; }
.gauge.fire .seg.on:nth-child(8) { animation-delay: 0.21s; }
.gauge.fire .seg.on:nth-child(9) { animation-delay: 0.24s; }
.gauge.fire .seg.on:nth-child(10) { animation-delay: 0.27s; }
@keyframes neuron-fire { 0% { filter: brightness(3); transform: scaleY(1.5); } 100% { filter: none; transform: none; } }
.gauge-readout { margin: 6px 0 14px; font-family: var(--font-title); font-size: 1.1rem; }
.gauge-readout > span:first-child { color: var(--pink); font-size: 1.6rem; text-shadow: 0 0 10px var(--pink); }
.gauge-readout .muted { font-family: var(--font-mono); font-size: 0.8rem; margin-left: 6px; }

/* ---------- Formulaires ---------- */
.field { display: block; position: relative; margin-bottom: 16px; }
.field-label { display: block; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--cyan); margin-bottom: 4px; }
input, textarea {
  width: 100%; padding: 10px 12px;
  font: inherit; color: var(--text);
  background: rgba(7,6,13,0.8);
  border: 1px solid var(--line); border-radius: 0;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, textarea:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 1px var(--pink), 0 0 14px rgba(255, 42, 109, 0.4); }
.field-hint { display: block; min-height: 1.2em; font-size: 0.78rem; margin-top: 4px; color: var(--muted); }
.field-hint.good { color: var(--cyan); }
.field-hint.bad, .form-error { color: var(--pink); }
.form-error { min-height: 1.2em; margin: 0 0 12px; }
.counter { position: absolute; right: 8px; bottom: 6px; font-size: 0.72rem; color: var(--muted); pointer-events: none; }

/* Terminal de recherche */
.terminal {
  display: flex; align-items: center; gap: 10px;
  max-width: 720px; padding: 4px 16px;
  background: rgba(7,6,13,0.9);
  border: 1px solid var(--cyan);
  box-shadow: 0 0 20px rgba(5, 217, 232, 0.2), inset 0 0 20px rgba(5, 217, 232, 0.06);
  clip-path: var(--clip);
  margin-bottom: 14px;
}
.terminal-prefix { color: var(--yellow); font-size: 1.3rem; text-shadow: 0 0 8px var(--yellow); }
.terminal input { border: 0; background: transparent; font-size: 1.2rem; padding: 12px 0; box-shadow: none; }
.terminal input:focus { box-shadow: none; }
.terminal-cursor { width: 10px; height: 1.3em; background: var(--cyan); animation: blink 1s steps(1) infinite; }
.terminal:focus-within { border-color: var(--pink); box-shadow: 0 0 24px rgba(255, 42, 109, 0.3); }
.terminal-sm { max-width: 420px; }
.terminal-sm input { font-size: 1rem; padding: 8px 0; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Config ---------- */
.config { max-width: 760px; margin: 20px auto; }
.steps { padding-left: 20px; }
.steps li { margin: 8px 0; }
.code { background: var(--bg); padding: 16px; overflow-x: auto; border-left: 2px solid var(--pink); font-size: 0.9rem; }

/* ---------- Modale fiche film ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: flex; justify-content: center; align-items: flex-start; padding: 4vh 16px; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(4, 3, 9, 0.9); animation: fade 0.25s; }
@keyframes fade { from { opacity: 0; } }
.modal-panel {
  position: relative; width: min(1040px, 100%); max-height: 92vh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-2);
  clip-path: var(--clip);
  box-shadow: 0 0 0 1px var(--line);
  animation: modal-in 0.35s cubic-bezier(.2,.9,.3,1.2);
  scrollbar-width: thin; scrollbar-color: var(--pink) transparent;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(20px) scale(0.98); } }
.modal-close {
  position: sticky; top: 10px; float: right; margin: 10px 10px -50px 0; z-index: 5;
  width: 40px; height: 40px; border: 1px solid var(--pink); background: rgba(7,6,13,0.85); color: var(--pink);
  cursor: pointer; font-size: 1.1rem; clip-path: var(--clip-sm); transition: background 0.2s, color 0.2s;
}
.modal-close:hover { background: var(--pink); color: #fff; }
.modal-loading { display: grid; place-items: center; min-height: 50vh; font-family: var(--font-title); letter-spacing: 0.1em; }

.m-hero {
  --bgimg: none;
  position: relative;
  background: linear-gradient(to top, var(--bg-2) 0%, rgba(14,12,26,0.85) 45%, rgba(14,12,26,0.4) 100%), var(--bgimg) center / cover no-repeat;
  padding: 80px 28px 24px;
}
.m-hero-inner { display: flex; gap: 24px; align-items: flex-end; }
.m-poster { width: 180px; flex-shrink: 0; clip-path: var(--clip); box-shadow: 0 0 30px rgba(0,0,0,0.6); aspect-ratio: 2/3; background: var(--bg-3); }
.m-poster img { width: 100%; height: 100%; object-fit: cover; }
.m-head { min-width: 0; }
.m-title {
  margin: 0; font-family: var(--font-title); font-weight: 900; text-transform: uppercase;
  font-size: clamp(1.4rem, 4vw, 2.4rem); line-height: 1.1;
  text-shadow: 0 0 20px rgba(5, 217, 232, 0.4), 2px 2px 0 rgba(255, 42, 109, 0.5);
}
.m-orig { margin: 4px 0 0; font-style: italic; }
.m-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0; color: var(--yellow); }
.m-tmdb { font-family: var(--font-title); font-size: 1.4rem; color: var(--yellow); text-shadow: 0 0 10px rgba(249,240,2,0.5); }
.m-tmdb small { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); text-shadow: none; margin-left: 6px; }
.m-director { margin: 8px 0; }
.m-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.m-body { padding: 8px 28px 32px; }
.player-wrap { display: none; margin: 8px 0 12px; }
.player-wrap.playing { display: block; animation: page-in 0.3s; }
.player { position: relative; aspect-ratio: 16/9; background: #000; clip-path: var(--clip); box-shadow: 0 0 0 1px var(--pink); }
.player iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.m-videos { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 8px; scrollbar-width: thin; }
.m-videos .chip { white-space: nowrap; }
.m-section { margin: 26px 0; }
.m-h {
  margin: 0 0 12px; font-family: var(--font-title); font-size: 0.85rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--cyan);
}
.m-h::before { content: '◢ '; color: var(--pink); }
.m-overview { margin: 0; color: #d6d2ea; max-width: 75ch; }
.m-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.m-rate-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.prov-group { margin-bottom: 12px; }
.prov-group h4 { margin: 0 0 6px; font-weight: normal; font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.prov-list { display: flex; flex-wrap: wrap; gap: 8px; }
.prov { display: inline-grid; place-items: center; min-width: 44px; height: 44px; font-size: 0.7rem; background: var(--bg-3); clip-path: var(--clip-sm); transition: transform 0.2s; }
.prov:hover { transform: scale(1.08); }
.prov img { width: 44px; height: 44px; object-fit: cover; }
.cast { display: grid; grid-auto-flow: column; grid-auto-columns: 110px; gap: 14px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: thin; }
.cast-item { display: flex; flex-direction: column; font-size: 0.8rem; line-height: 1.25; }
.cast-item strong { font-weight: normal; margin-top: 6px; }
.cast-photo { aspect-ratio: 2/3; background: var(--bg-3); clip-path: var(--clip-sm); display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.cast-photo img { width: 100%; height: 100%; object-fit: cover; }
.community-avg { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.big-num { font-family: var(--font-title); font-weight: 900; font-size: 2.6rem; line-height: 1; color: var(--pink); text-shadow: 0 0 18px var(--pink); }
.reviews { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.review { background: var(--bg-3); padding: 12px 14px; clip-path: var(--clip-sm); border-left: 2px solid var(--pink); }
.review-head { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.review-score { color: var(--yellow); margin: 0 10px; }
.review p { margin: 8px 0 0; white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- Roulette ---------- */
.roulette { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.roulette-screen {
  width: min(820px, 100%); min-height: 260px;
  display: grid; place-items: center; padding: 24px; text-align: center;
  background: rgba(14,12,26,0.9);
  clip-path: var(--clip);
  box-shadow: inset 0 0 0 1px var(--line);
}
.roulette-screen.glitching { animation: screen-glitch 0.25s infinite steps(2); }
@keyframes screen-glitch {
  0% { transform: translate(0); filter: hue-rotate(0deg); }
  25% { transform: translate(-3px, 1px) skewX(-2deg); filter: hue-rotate(90deg); }
  50% { transform: translate(3px, -1px); filter: hue-rotate(180deg) saturate(2); }
  75% { transform: translate(-1px, 2px) skewX(2deg); filter: hue-rotate(270deg); }
}
.roulette-result { display: grid; grid-template-columns: 180px 1fr; gap: 24px; text-align: left; align-items: center; animation: page-in 0.4s; }

/* ---------- Le Réseau ---------- */
.nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.node {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: rgba(21,18,40,0.85); color: var(--text);
  clip-path: var(--clip);
  transition: transform 0.2s, filter 0.2s, background 0.2s;
}
.node:hover { color: var(--text); transform: translateY(-2px); background: rgba(30,25,58,0.95); filter: drop-shadow(0 0 8px rgba(5,217,232,0.6)); }
.node-me { box-shadow: inset 2px 0 0 var(--yellow); }
.node-info { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.node-info .muted { font-size: 0.8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-count { display: flex; flex-direction: column; align-items: flex-end; }
.node-count b { font-family: var(--font-title); color: var(--pink); font-size: 1.4rem; text-shadow: 0 0 10px var(--pink); }
.node-count small { font-size: 0.68rem; color: var(--muted); }

/* ---------- Profil ---------- */
.profile-head { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; margin-bottom: 20px; }
.profile-id { flex: 1; min-width: 220px; }
.profile-bio { margin: 10px 0; white-space: pre-line; overflow-wrap: anywhere; }
.profile-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.bio-form { margin: 10px 0; display: grid; gap: 8px; }
.sync { --p: 0; display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: rgba(7,6,13,0.6); clip-path: var(--clip-sm); }
.sync p { margin: 0 0 4px; }
.sync-ring {
  width: 92px; height: 92px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
  background: conic-gradient(var(--pink) calc(var(--p) * 1%), rgba(5,217,232,0.15) 0);
  box-shadow: 0 0 20px rgba(255,42,109,0.45);
  animation: ring-pulse 2.4s ease-in-out infinite;
}
.sync-ring span {
  width: 74px; height: 74px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--bg-2); font-family: var(--font-title); font-weight: 900; font-size: 1.4rem; color: var(--text);
}
.sync-ring small { font-size: 0.7rem; }
@keyframes ring-pulse { 50% { box-shadow: 0 0 34px rgba(255,42,109,0.75); } }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat { display: flex; flex-direction: column; gap: 8px; padding: 16px; }
.stat-wide { grid-column: span 1; }
.histo { display: flex; align-items: flex-end; gap: 4px; height: 90px; }
.histo-col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; }
.histo-bar { width: 100%; min-height: 2px; background: linear-gradient(to top, var(--pink), var(--yellow)); box-shadow: 0 0 8px rgba(255,42,109,0.6); transition: height 0.6s; }
.histo-col small { font-size: 0.65rem; color: var(--muted); }
.top-genres { margin: 0; padding-left: 20px; }
.top-genres li { margin: 2px 0; }
.tabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.tab {
  padding: 10px 16px; background: none; border: 0; cursor: pointer; color: var(--muted);
  font-family: var(--font-title); font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--cyan); border-bottom-color: var(--pink); }

/* ---------- Auth ---------- */
.auth { max-width: 460px; margin: 30px auto; }

/* ---------- Footer ---------- */
.footer { padding: 28px var(--gutter) max(40px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); text-align: center; background: rgba(7,6,13,0.85); }
.slogan { font-family: var(--font-title); letter-spacing: 0.12em; text-transform: uppercase; color: var(--cyan); text-shadow: 0 0 10px rgba(5,217,232,0.5); margin: 0 0 12px; }
.tmdb-attrib { font-size: 0.82rem; color: var(--muted); max-width: 640px; margin: 0 auto 8px; }
.tmdb-logo {
  display: inline-block; padding: 1px 8px; margin-right: 6px; font-family: var(--font-title); font-weight: 900; font-size: 0.75rem;
  color: #0d253f; background: linear-gradient(90deg, #90cea1, #01b4e4); border-radius: 4px;
}
.tmdb-logo:hover { color: #0d253f; filter: brightness(1.15); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 120; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast {
  padding: 12px 16px; background: var(--bg-3); border-left: 3px solid var(--cyan);
  clip-path: var(--clip-sm); box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  transform: translateX(120%); opacity: 0; transition: transform 0.3s, opacity 0.3s;
}
.toast.show { transform: none; opacity: 1; }
.toast-ok { border-color: var(--cyan); }
.toast-warn { border-color: var(--yellow); }
.toast-err { border-color: var(--pink); }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
  .stats { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; gap: 8px 12px; padding-top: max(10px, env(safe-area-inset-top)); padding-bottom: 6px; }
  .logo-glitch { font-size: 1.2rem; }
  .account { margin-left: auto; }
  .install-btn:not([hidden]) + .account { margin-left: 8px; }
  .account-name { display: none; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -8px; }
  .nav a { padding: 8px; font-size: 0.68rem; }
  .nav-search span { display: none; }
  /* Plein écran sous l'encoche / la barre d'état de l'iPhone en mode app */
  .modal { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); background: var(--bg-2); }
  .modal-panel { max-height: 100%; height: 100%; width: 100%; clip-path: none; padding-bottom: env(safe-area-inset-bottom); }
  .m-hero { padding: 64px 16px 16px; }
  .m-hero-inner { flex-direction: column; align-items: flex-start; gap: 16px; }
  .m-poster { width: 120px; }
  .m-body { padding: 4px 16px 28px; }
  .m-cols { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 16px 12px; }
  .roulette-result { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .roulette-result .card { width: 160px; }
  .hero { min-height: 380px; }
  .community-avg { flex-wrap: wrap; }
}
@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
  .btn { padding: 10px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* ---------- PWA installée ---------- */
@media (display-mode: standalone), (display-mode: window-controls-overlay) {
  .topbar, .nav, .btn, .chip, .tab { -webkit-user-select: none; user-select: none; }
  body { overscroll-behavior-y: none; }
}
