/* ==========================================================================
   PARTY-NIGHT · Design system néon / LED / arcade
   Règles de performance : on n'anime que transform et opacity. Les lueurs sont
   portées par des pseudo-éléments dont on fait varier l'opacité, jamais box-shadow.
   Accessibilité : prefers-reduced-motion coupe scintillements, chenillards et grille.
   ========================================================================== */

/* Polices auto-hébergées (licence SIL OFL 1.1, Google Fonts) : aucune requête vers Google (RGPD), disponibles hors-ligne. */
@font-face { font-family: 'Audiowide'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/audiowide-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Audiowide'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/audiowide-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 800; font-display: swap; src: url('/assets/fonts/inter-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Monoton'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/monoton-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Monoton'; font-style: normal; font-weight: 400; font-display: swap; src: url('/assets/fonts/monoton-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* Fond et surfaces */
  --bg: #07060D;
  --bg-2: #0E0B1C;
  --surface: rgba(22, 17, 44, 0.78);
  --surface-2: #141027;
  --surface-3: #1D1838;
  --line: rgba(255, 255, 255, 0.09);

  /* Palette néon */
  --violet: #7C3AED;
  --magenta: #EC4899;
  --cyan: #06B6D4;
  --acid: #A3E635;     /* succès */
  --yellow: #FACC15;   /* alerte, premium */
  --red: #F43F5E;      /* erreur */

  /* Texte (contrastes ≥ 4.5:1 sur --bg) */
  --text: #F5F3FF;
  --text-2: #D8D2F5;
  --muted: #9790B8;

  /* Lueurs (statiques, portées par des pseudo-éléments) */
  --glow-violet: 0 0 6px rgba(124, 58, 237, .95), 0 0 18px rgba(124, 58, 237, .65), 0 0 44px rgba(124, 58, 237, .4);
  --glow-magenta: 0 0 6px rgba(236, 72, 153, .95), 0 0 18px rgba(236, 72, 153, .65), 0 0 44px rgba(236, 72, 153, .4);
  --glow-cyan: 0 0 6px rgba(6, 182, 212, .95), 0 0 18px rgba(6, 182, 212, .65), 0 0 44px rgba(6, 182, 212, .4);
  --glow-acid: 0 0 6px rgba(163, 230, 53, .95), 0 0 18px rgba(163, 230, 53, .6), 0 0 40px rgba(163, 230, 53, .35);
  --glow-yellow: 0 0 6px rgba(250, 204, 21, .95), 0 0 18px rgba(250, 204, 21, .6), 0 0 40px rgba(250, 204, 21, .35);

  /* Typo */
  --font-logo: 'Monoton', 'Audiowide', system-ui, sans-serif;
  --font-display: 'Audiowide', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  /* Les scores utilisent Inter (.big-score, .num…) : le « 0 » barré d'Audiowide se lit comme un symbole d'interdiction. */

  /* Formes et rythme */
  --radius: 20px;
  --radius-sm: 12px;
  --gap: 16px;
  --page-max: 1120px;
  --touch: 52px;
  --ease-pop: cubic-bezier(.2, 1.4, .4, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --topbar-h: 60px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; overflow-x: hidden; }
body {
  margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text);
  font: 400 16px/1.5 var(--font-body); overflow-x: hidden;
  -webkit-tap-highlight-color: transparent; text-rendering: optimizeLegibility;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--cyan); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 400; line-height: 1.15; margin: 0 0 .5em; letter-spacing: .02em; }
h1 { font-size: clamp(1.7rem, 5vw, 2.6rem); }
h2 { font-size: clamp(1.25rem, 3.6vw, 1.7rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; border-radius: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.noscript { padding: 24px; text-align: center; }

/* ---------- Fond synthwave : soleil + grille en perspective qui défile ---------- */
.synth { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
  background: radial-gradient(120% 55% at 50% 100%, rgba(124, 58, 237, .28), transparent 62%),
              radial-gradient(80% 40% at 50% 0%, rgba(236, 72, 153, .10), transparent 70%), var(--bg); }
.synth__sun { position: absolute; left: 50%; bottom: 36%; width: min(62vw, 440px); aspect-ratio: 1; border-radius: 50%;
  transform: translateX(-50%); opacity: .32;
  background: linear-gradient(180deg, var(--yellow) 0%, var(--magenta) 55%, var(--violet) 100%);
  -webkit-mask: linear-gradient(#000 0 50%, transparent 0) top / 100% 100% no-repeat, repeating-linear-gradient(#000 0 14px, transparent 14px 22px);
          mask: linear-gradient(#000 0 50%, transparent 0) top / 100% 100% no-repeat, repeating-linear-gradient(#000 0 14px, transparent 14px 22px); }
.synth__grid { position: absolute; left: -60%; right: -60%; bottom: 0; height: 42%; overflow: hidden;
  transform-origin: 50% 100%; transform: perspective(280px) rotateX(62deg);
  -webkit-mask: linear-gradient(to top, #000 25%, transparent 95%); mask: linear-gradient(to top, #000 25%, transparent 95%); }
.synth__grid::before { content: ''; position: absolute; left: 0; right: 0; top: -64px; bottom: 0; will-change: transform;
  background-image: linear-gradient(rgba(236, 72, 153, .55) 2px, transparent 2px), linear-gradient(90deg, rgba(6, 182, 212, .4) 2px, transparent 2px);
  background-size: 64px 64px; animation: grid-scroll 1.6s linear infinite; }
@keyframes grid-scroll { from { transform: translateY(0); } to { transform: translateY(64px); } }
body.in-game .synth__sun, body.in-game .synth__grid::before { animation-play-state: paused; }
body.in-game .synth { opacity: .55; }

/* ---------- Logo en tube néon : allumage qui grésille puis scintillement rare ---------- */
.neon-logo { font-family: var(--font-logo); font-size: clamp(2.2rem, 9vw, 5rem); line-height: 1; color: #FFE6F5; white-space: nowrap;
  text-shadow: 0 0 2px #fff, 0 0 8px var(--magenta), 0 0 20px var(--magenta), 0 0 42px rgba(236, 72, 153, .8), 0 0 80px rgba(124, 58, 237, .6);
  animation: neon-ignite 1.8s steps(1, end) both, neon-flicker 11s 2s infinite; }
.neon-logo__dash { color: #E0FBFF; text-shadow: 0 0 2px #fff, 0 0 8px var(--cyan), 0 0 22px var(--cyan), 0 0 44px rgba(6, 182, 212, .7);
  display: inline-block; animation: neon-flicker 7s 3.3s infinite; }
.neon-logo--sm { font-family: var(--font-display); font-size: 1.1rem; animation: none; letter-spacing: .02em; }
.neon-logo--sm .neon-logo__dash { animation: none; }
@keyframes neon-ignite {
  0% { opacity: .06; } 8% { opacity: .7; } 10% { opacity: .12; } 18% { opacity: .85; } 20% { opacity: .2; }
  31% { opacity: 1; } 33% { opacity: .35; } 42% { opacity: 1; } 100% { opacity: 1; }
}
@keyframes neon-flicker {
  0%, 95.9%, 100% { opacity: 1; } 96% { opacity: .5; } 96.6% { opacity: 1; } 97.4% { opacity: .72; } 97.9% { opacity: 1; }
}

/* ---------- Mise en page ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(rgba(7, 6, 13, .92), rgba(7, 6, 13, .7)); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.topbar__logo { text-decoration: none; }
.topbar__nav { display: flex; align-items: center; gap: 6px; }
.topbar__link { color: var(--text-2); text-decoration: none; font-weight: 600; padding: 10px; border-radius: 10px; }
.topbar__link:hover, .topbar__link[aria-current="page"] { color: var(--text); background: rgba(255, 255, 255, .06); }
body.in-game .topbar, body.tv .topbar { display: none; }
.topbar { max-width: 100vw; }
@media (max-width: 420px) {
  .topbar { gap: 6px; }
  .topbar__nav { gap: 2px; }
  .topbar__link { padding: 8px 6px; font-size: .9rem; }
  .neon-logo--sm { font-size: .95rem; }
  .topbar .icon-btn { width: 40px; height: 40px; }
}
@media (max-width: 350px) { .topbar__link[href="/rejoindre"] { display: none; } }

.page { width: 100%; max-width: var(--page-max); margin: 0 auto; padding: 20px 16px calc(40px + env(safe-area-inset-bottom)); animation: page-in .35s var(--ease-out) both; }
@keyframes page-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.page-loading { min-height: 60vh; display: grid; place-items: center; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.center { text-align: center; }
.section { margin-top: 36px; }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.section__head h2 { margin: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; backdrop-filter: blur(6px); }

/* ---------- Boutons : ils « s'allument » au toucher ---------- */
.btn { --c: var(--violet); --g: var(--glow-violet);
  position: relative; isolation: isolate; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: var(--touch); padding: 0 24px; border-radius: 999px; border: 2px solid var(--c); cursor: pointer;
  background: color-mix(in srgb, var(--c) 22%, transparent); color: var(--text); text-decoration: none;
  font-family: var(--font-display); font-size: 1rem; letter-spacing: .06em; text-transform: uppercase;
  transition: transform .15s var(--ease-out); user-select: none; touch-action: manipulation; }
.btn::after { content: ''; position: absolute; inset: -2px; border-radius: inherit; box-shadow: var(--g); opacity: .35; transition: opacity .18s; z-index: -1; pointer-events: none; }
.btn:hover::after, .btn:focus-visible::after { opacity: .8; }
.btn:active { transform: scale(.96); }
.btn:active::after, .btn.is-lit::after { opacity: 1; }
.btn[disabled], .btn.is-disabled { opacity: .42; cursor: not-allowed; }
.btn[disabled]::after { opacity: 0; }
.btn--magenta { --c: var(--magenta); --g: var(--glow-magenta); }
.btn--cyan { --c: var(--cyan); --g: var(--glow-cyan); }
.btn--acid { --c: var(--acid); --g: var(--glow-acid); }
.btn--yellow { --c: var(--yellow); --g: var(--glow-yellow); }
.btn--solid { background: var(--c); color: #0B0816; }
.btn--ghost { background: transparent; border-color: rgba(255, 255, 255, .22); }
.btn--ghost::after { opacity: 0; }
.btn--ghost:hover { border-color: var(--c); }
.btn--sm { min-height: 40px; padding: 0 16px; font-size: .82rem; }
.btn--xl { min-height: 76px; width: 100%; font-size: clamp(1.15rem, 4.4vw, 1.5rem); border-width: 3px; }
.btn--xl .btn__sub { display: block; font-family: var(--font-body); font-size: .78rem; letter-spacing: 0; text-transform: none; color: var(--text-2); font-weight: 600; }
.btn--block { width: 100%; }
.btn__icon { font-size: 1.4em; line-height: 1; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); cursor: pointer; font-size: 1.2rem; }
.icon-btn:active { transform: scale(.94); }

/* ---------- Cartes de jeu : LED en chenillard sur le pourtour ---------- */
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(156px, 1fr)); gap: 14px; }
@media (min-width: 720px) { .games-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; } }
.gcard { --c: var(--violet); position: relative; isolation: isolate; display: block; padding: 3px; border-radius: 22px; overflow: hidden;
  text-decoration: none; color: var(--text); background: color-mix(in srgb, var(--c) 30%, #120E24); transition: transform .2s var(--ease-out); }
/* Lumière qui tourne autour de la carte (transform: rotate). */
.gcard::before { content: ''; position: absolute; inset: -60%; z-index: -2;
  background: conic-gradient(from 0deg, transparent 0 62%, var(--c) 74%, #fff 80%, var(--c) 86%, transparent 96%);
  animation: led-spin 4.5s linear infinite paused; }
/* Chenillard actif seulement pour les cartes visibles (classe posée par animateVisibleCards). */
.gcard.is-on::before { animation-play-state: running; will-change: transform; }
/* Points LED sur la bordure (masque : seul l'anneau de 3 px est visible). */
.gcard::after { content: ''; position: absolute; inset: 0; z-index: -1; border-radius: inherit; padding: 3px; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .85) 0 1.2px, transparent 1.8px) 0 0 / 9px 9px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
          mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); opacity: .55; }
.gcard:hover, .gcard:focus-visible { transform: translateY(-4px); }
.gcard:hover::before, .gcard:focus-visible::before { animation-duration: 1.3s; }
@keyframes led-spin { to { transform: rotate(1turn); } }
.gcard__body { position: relative; border-radius: 19px; background: linear-gradient(180deg, var(--surface-3), var(--surface-2)); height: 100%; display: flex; flex-direction: column; }
.gcard__thumb { aspect-ratio: 4 / 3; border-radius: 19px 19px 0 0; overflow: hidden; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 45%, transparent), transparent 70%), #0B0818; display: grid; place-items: center; }
.gcard__thumb img { width: 100%; height: 100%; object-fit: cover; }
.gcard__info { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 4px; }
.gcard__name { font-family: var(--font-display); font-size: 1rem; line-height: 1.2; }
.gcard__meta { font-size: .78rem; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; }
.gcard__badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; z-index: 1; }

/* Rangées défilantes (accueil) et cartes compactes */
.rail { display: grid; grid-auto-flow: column; grid-auto-columns: 46%; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 6px 2px 12px; margin: 0 -2px; scrollbar-width: thin; }
.rail > * { scroll-snap-align: start; }
@media (min-width: 640px) { .rail { grid-auto-columns: 210px; } }
.gcard--mini .gcard__info { padding: 8px 10px 10px; }
.gcard--mini .gcard__name { font-size: .9rem; }
.suggest { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.suggest .gcard__name { font-size: .75rem; }

/* ---------- Badges ---------- */
.badge { --c: var(--violet); display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px;
  font: 600 .7rem/1.4 var(--font-body); letter-spacing: .04em; text-transform: uppercase; color: #0B0816; background: var(--c); }
.badge--new { --c: var(--acid); }
.badge--popular { --c: var(--magenta); color: #fff; }
.badge--premium { --c: var(--yellow); }
.badge--outline { background: transparent; color: var(--c); border: 1px solid var(--c); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); font-size: .85rem; color: var(--text-2); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn { cursor: pointer; min-height: 40px; }
.chip-btn[aria-pressed="true"] { border-color: var(--cyan); color: var(--text); background: rgba(6, 182, 212, .16); }

/* ---------- Avatars ---------- */
.avatar { --pc: var(--violet); position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
  font-size: 1.6rem; line-height: 1; text-decoration: none; background: radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--pc) 45%, #1d1838), #120e24);
  border: 2px solid var(--pc); box-shadow: 0 0 12px color-mix(in srgb, var(--pc) 60%, transparent); flex: none; }
.avatar--sm { width: 40px; height: 40px; font-size: 1.25rem; }
.avatar--lg { width: 72px; height: 72px; font-size: 2.4rem; }
.avatar--xl { width: 104px; height: 104px; font-size: 3.4rem; border-width: 3px; }
.avatar.is-off { opacity: .35; filter: grayscale(1); }
.avatar__tag { position: absolute; bottom: -6px; right: -8px; font-size: .9rem; }

/* ---------- Champs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 600; font-size: .9rem; color: var(--text-2); }
.input, .select { min-height: var(--touch); padding: 0 16px; border-radius: var(--radius-sm); border: 2px solid var(--line); background: rgba(0, 0, 0, .35);
  color: var(--text); font: 600 1rem var(--font-body); width: 100%; }
.input:focus, .select:focus { outline: none; border-color: var(--cyan); }
.code-input { font-family: var(--font-display); font-size: clamp(2rem, 10vw, 3.2rem); text-align: center; letter-spacing: .45em; text-transform: uppercase;
  padding-left: .45em; min-height: 84px; caret-color: var(--magenta); }

/* ---------- Code de salle en LED ---------- */
.led-code { display: inline-flex; gap: 8px; }
.led-code span { display: grid; place-items: center; width: 1.25em; height: 1.45em; font-family: var(--font-display); font-size: clamp(2rem, 9vw, 3.4rem);
  border-radius: 12px; border: 2px solid var(--cyan); background: rgba(6, 182, 212, .1); color: #E0FBFF; text-shadow: 0 0 10px var(--cyan); }
body.tv .led-code span { font-size: 5.5rem; }

/* ---------- Joueurs (salon) ---------- */
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.player { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 14px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); min-width: 0; }
.player.is-new { animation: pop-in .45s var(--ease-pop) both; }
.player.is-host { border-color: color-mix(in srgb, var(--yellow) 60%, transparent); }
body.tv .players { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
body.tv .player { padding: 16px; font-size: 1.2rem; }
.lobby-head { display: grid; gap: 18px; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 640px) { .lobby-head { grid-template-columns: 1fr auto; } }
.share-row { display: flex; gap: 8px; flex-wrap: wrap; }
.settings-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.banner { padding: 10px 14px; border-radius: 12px; background: rgba(250, 204, 21, .12); border: 1px solid rgba(250, 204, 21, .5); color: var(--yellow); font-weight: 600; }
.result-overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; padding: 16px; background: rgba(7, 6, 13, .82); backdrop-filter: blur(4px); animation: fade-in .25s both; }
.result-card { width: min(440px, 100%); text-align: center; }
.big-score, .podium__score, .ranking__score, .num { font-family: 'Inter', system-ui, sans-serif; font-weight: 800; font-variant-numeric: tabular-nums; }
.big-score { font-size: clamp(3.5rem, 18vw, 6rem); line-height: 1; color: #fff; text-shadow: 0 0 18px var(--magenta), 0 0 50px var(--violet); }
.player__name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.player__x { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1.1rem; padding: 6px; }
.player--empty { border-style: dashed; color: var(--muted); justify-content: center; animation: none; }
@keyframes pop-in { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: none; } }

/* ---------- Modales et toasts ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(4, 3, 10, .72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; animation: fade-in .2s both; }
.modal { width: min(520px, 100%); max-height: 88dvh; overflow: auto; background: var(--surface-2); border: 1px solid rgba(124, 58, 237, .5); border-radius: 24px; padding: 22px; animation: modal-in .32s var(--ease-pop) both; position: relative; }
.modal::before { content: ''; position: absolute; inset: -1px; border-radius: inherit; box-shadow: var(--glow-violet); opacity: .45; pointer-events: none; }
.modal__actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 18px; }
@keyframes modal-in { from { opacity: 0; transform: scale(.9) translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.toasts { position: fixed; z-index: 90; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { --c: var(--violet); pointer-events: auto; padding: 12px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--c); font-weight: 600; animation: toast-in .35s var(--ease-pop) both; }
.toast.is-out { animation: toast-out .25s both; }
.toast--ok { --c: var(--acid); } .toast--warn { --c: var(--yellow); } .toast--err { --c: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }

/* ---------- Compte à rebours 3-2-1 géant ---------- */
.countdown { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle, rgba(7, 6, 13, .35), rgba(7, 6, 13, .85)); animation: fade-in .2s both; }
.countdown__n { font-family: var(--font-display); font-size: clamp(8rem, 40vw, 22rem); line-height: 1; color: #fff; text-shadow: 0 0 20px var(--magenta), 0 0 60px var(--violet); animation: count-pop .9s var(--ease-out) both; }
.countdown__n.is-go { color: var(--acid); text-shadow: 0 0 20px var(--acid), 0 0 60px var(--acid); font-size: clamp(5rem, 26vw, 14rem); }
@keyframes count-pop { 0% { opacity: 0; transform: scale(2.2); } 25% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: scale(.7); } }

/* ---------- Barre de temps (transform: scaleX) ---------- */
.timebar { height: 10px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.timebar__fill { height: 100%; transform-origin: left; background: linear-gradient(90deg, var(--acid), var(--yellow) 60%, var(--red)); will-change: transform; }

/* ---------- Podium ---------- */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 10px; max-width: 520px; margin: 0 auto; }
.podium__col { display: flex; flex-direction: column; align-items: center; gap: 8px; animation: rise .7s var(--ease-pop) both; }
.podium__col:nth-child(1) { animation-delay: .45s; } .podium__col:nth-child(2) { animation-delay: .9s; } .podium__col:nth-child(3) { animation-delay: .1s; }
.podium__name { font-weight: 800; text-align: center; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium__score { color: var(--text-2); font-size: 1.15rem; }
.podium__step { --c: var(--violet); width: 100%; border-radius: 14px 14px 0 0; display: grid; place-items: start center; padding-top: 10px; font-family: var(--font-display); font-size: 2rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 55%, transparent), color-mix(in srgb, var(--c) 10%, transparent)); border: 2px solid var(--c); border-bottom: 0; }
.podium__col--1 .podium__step { --c: var(--yellow); height: 150px; } .podium__col--2 .podium__step { --c: var(--cyan); height: 110px; } .podium__col--3 .podium__step { --c: var(--magenta); height: 80px; }
@keyframes rise { from { opacity: 0; transform: translateY(60px); } to { opacity: 1; transform: none; } }
.ranking { list-style: none; padding: 0; margin: 18px auto 0; max-width: 520px; display: flex; flex-direction: column; gap: 6px; }
.ranking li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.ranking .is-me { border: 1px solid var(--cyan); }
.ranking__pos { width: 28px; font-family: var(--font-display); color: var(--muted); }
.ranking__score { margin-left: auto; }

/* ---------- XP ---------- */
.xpbar { height: 12px; border-radius: 999px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.xpbar__fill { height: 100%; transform-origin: left; background: linear-gradient(90deg, var(--violet), var(--magenta)); transition: transform 1.2s var(--ease-out); }
.xp-gain { font-family: var(--font-display); color: var(--acid); text-shadow: 0 0 12px rgba(163, 230, 53, .7); font-size: 1.6rem; animation: pop-in .6s .8s var(--ease-pop) both; }

/* ---------- Effets de victoire ---------- */
.fx-canvas { position: fixed; inset: 0; z-index: 75; pointer-events: none; }
.flash { position: fixed; inset: 0; z-index: 74; pointer-events: none; background: radial-gradient(circle, rgba(255, 255, 255, .55), rgba(236, 72, 153, .15) 60%, transparent); animation: flash-out .9s ease-out both; }
@keyframes flash-out { from { opacity: 1; } to { opacity: 0; } }

/* ---------- Héros de l'accueil ---------- */
.hero { text-align: center; padding: clamp(28px, 8vh, 72px) 0 12px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.hero__tagline { font-size: clamp(1.05rem, 3.6vw, 1.35rem); color: var(--text-2); max-width: 30ch; margin: 0; }
.hero__ctas { display: grid; gap: 12px; width: min(440px, 100%); }
.join-inline { display: flex; gap: 8px; width: min(440px, 100%); }
.join-inline .input { font-family: var(--font-display); letter-spacing: .3em; text-transform: uppercase; text-align: center; }

/* ---------- Fiche jeu ---------- */
.game-hero { --c: var(--violet); display: grid; gap: 18px; }
@media (min-width: 820px) { .game-hero { grid-template-columns: 1fr 1fr; align-items: center; } }
.game-hero__art { border-radius: 24px; overflow: hidden; aspect-ratio: 4 / 3; background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c) 40%, transparent), transparent 70%), #0B0818; border: 2px solid color-mix(in srgb, var(--c) 60%, transparent); }
.game-hero__art img { width: 100%; height: 100%; object-fit: cover; }
.play-buttons { display: grid; gap: 12px; }

/* ---------- Scène de jeu ---------- */
.stage { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.stage__bar { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 52px; }
.stage__title { font-family: var(--font-display); font-size: .95rem; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage__game { position: relative; flex: 1; min-height: 0; }
.net-status { font-size: .8rem; color: var(--yellow); }

/* ---------- Kit arcade (ctx.arcade) : cadre, HUD, consignes, popups ---------- */
.arcade { position: absolute; inset: 0; overflow: hidden; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; cursor: pointer; }
.arcade__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.arcade__layer { position: absolute; inset: 0; }
.arcade__layer:empty { pointer-events: none; }
.arcade__hud { position: absolute; top: 6px; left: 10px; right: 10px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; pointer-events: none; z-index: 3; }
.arcade__score { grid-column: 2; font-size: clamp(2.4rem, 11vw, 4rem); line-height: 1; color: #fff; text-shadow: 0 0 12px var(--magenta), 0 0 34px var(--violet); }
.arcade__side { font-size: .85rem; color: var(--text-2); display: flex; flex-direction: column; gap: 2px; }
.arcade__side--r { text-align: right; align-items: flex-end; }
.arcade__best b { color: var(--yellow); }
.arcade__lives { color: var(--magenta); font-size: 1.15rem; letter-spacing: 2px; text-shadow: 0 0 8px var(--magenta); }
.arcade__lives i { font-style: normal; color: rgba(255, 255, 255, .18); text-shadow: none; }
.arcade__timer { font-size: 1.05rem; font-weight: 700; }
.arcade__timer.is-low b { color: var(--red); text-shadow: 0 0 10px var(--red); }
.arcade__hint { position: absolute; left: 16px; right: 16px; bottom: 18%; text-align: center; font-weight: 700; color: var(--text-2); pointer-events: none; transition: opacity .4s; z-index: 3; text-shadow: 0 2px 8px #000; }
.arcade__pop { position: absolute; z-index: 4; transform: translate(-50%, -50%); font: 800 1.3rem/1 'Inter', system-ui, sans-serif; pointer-events: none; text-shadow: 0 0 10px currentColor; animation: arcade-pop .85s var(--ease-out) forwards; }
@keyframes arcade-pop { 0% { opacity: 0; transform: translate(-50%, -20%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -190%) scale(1); } }
.arcade__flash { position: absolute; inset: 0; z-index: 2; pointer-events: none; animation: flash-out .4s ease-out forwards; }

/* ---------- Réactions emoji en salle ---------- */
.react { position: fixed; z-index: 60; right: max(12px, env(safe-area-inset-right)); bottom: calc(14px + env(safe-area-inset-bottom)); display: flex; flex-direction: column-reverse; align-items: flex-end; gap: 8px; }
.react__toggle { width: 48px; height: 48px; font-size: 1.4rem; background: rgba(20, 16, 39, .9); border-color: rgba(236, 72, 153, .5); }
.react__list { display: grid; grid-template-columns: repeat(4, 44px); gap: 6px; padding: 8px; border-radius: 16px; background: rgba(20, 16, 39, .95); border: 1px solid var(--line); animation: pop-in .25s var(--ease-pop) both; }
.react__list[hidden] { display: none; }
.react__btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: rgba(255, 255, 255, .06); font-size: 1.4rem; cursor: pointer; }
.react__btn:active { transform: scale(.9); }
.react-layer { position: fixed; inset: 0; z-index: 65; pointer-events: none; overflow: hidden; }
.react-fly { --rc: var(--magenta); position: absolute; bottom: -40px; display: flex; flex-direction: column; align-items: center; font-size: 2.4rem; line-height: 1;
  animation: react-up 2.6s cubic-bezier(.2, .6, .3, 1) forwards; }
body.tv .react-fly { font-size: 4.5rem; }
.react-fly small { font: 700 .7rem var(--font-body); color: #fff; background: var(--rc); padding: 2px 6px; border-radius: 999px; margin-top: 4px; white-space: nowrap; }
@keyframes react-up { 0% { transform: translateY(0) scale(.6); opacity: 0; } 12% { opacity: 1; transform: translateY(-12vh) scale(1.1); } 100% { transform: translateY(-75vh) scale(1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .react-fly { animation: fade-in .3s both; bottom: 20%; } }

/* ---------- Kit duel (ctx.duel) : joueurs, tour, minuteur, plateau ---------- */
.duel { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 12px 14px; overflow-y: auto; }
.duel__players { width: min(560px, 100%); display: flex; align-items: center; gap: 8px; }
.duel__p { --sc: var(--magenta); flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 14px;
  border: 2px solid color-mix(in srgb, var(--sc) 35%, transparent); background: rgba(255, 255, 255, .04); transition: transform .2s; position: relative; }
.duel__p.is-turn { border-color: var(--sc); transform: scale(1.04); background: color-mix(in srgb, var(--sc) 16%, transparent); }
.duel__p.is-turn::after { content: ''; position: absolute; inset: -2px; border-radius: inherit; box-shadow: 0 0 16px var(--sc); pointer-events: none; animation: duel-pulse 1.4s ease-in-out infinite; }
.duel__p.is-winner { border-color: var(--yellow); }
.duel__name { flex: 1; min-width: 0; font-weight: 700; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel__name small { color: var(--muted); font-weight: 600; }
.duel__seat { width: 14px; height: 14px; border-radius: 50%; background: var(--sc); box-shadow: 0 0 8px var(--sc); flex: none; }
.duel__score { font-size: 1.1rem; }
.duel__vs { font-family: var(--font-display); color: var(--muted); font-size: .8rem; }
.duel__timer { width: min(560px, 100%); height: 6px; }
.duel__status { margin: 0; font-weight: 700; color: var(--text-2); min-height: 1.5em; text-align: center; }
.duel__status.is-mine { color: var(--acid); text-shadow: 0 0 10px rgba(163, 230, 53, .6); }
.duel__board { position: relative; width: 100%; flex: 1; display: grid; place-items: center; min-height: 0; }
@keyframes duel-pulse { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }

/* ---------- Kit cartes d'ambiance (ctx.cards) ---------- */
.pcards { --accent: var(--magenta); position: absolute; inset: 0; overflow-y: auto; display: flex; justify-content: center; padding: 8px 14px 20px; }
.pcards__inner { width: min(760px, 100%); display: flex; flex-direction: column; gap: 12px; }
.pcards__head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pcards__me { margin-left: auto; color: var(--text-2); }
.pcards__intro { min-height: 55vh; display: grid; place-items: center; }
.pcards__intro span { font-family: var(--font-display); font-size: clamp(2.4rem, 10vw, 4.4rem); color: #fff; text-shadow: 0 0 18px var(--accent), 0 0 46px var(--accent); animation: pop-in .5s var(--ease-pop) both; }
.pcards__sub { margin: 0; color: var(--accent); font-family: var(--font-display); letter-spacing: .04em; text-transform: uppercase; font-size: .9rem; }
.pcards__prompt { font: 800 clamp(1.3rem, 5vw, 2.1rem)/1.25 var(--font-body); letter-spacing: 0; margin: 0; animation: page-in .35s both; }
.pcards__choices { display: grid; gap: 10px; }
.pcards__choices--options { grid-template-columns: 1fr; }
@media (min-width: 560px) { .pcards__choices--options { grid-template-columns: 1fr 1fr; } }
.pcards__choices--players { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.pcards__opt { --oc: var(--violet); position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 76px; padding: 14px 16px;
  border-radius: 18px; border: 2px solid var(--oc); background: color-mix(in srgb, var(--oc) 18%, #0E0B1C); color: var(--text); text-align: left; font: 700 1.1rem/1.25 var(--font-body); cursor: pointer; touch-action: manipulation; transition: transform .12s; }
.pcards__opt:active:not([disabled]) { transform: scale(.97); }
.pcards__opt.is-picked { background: color-mix(in srgb, var(--oc) 55%, #0E0B1C); box-shadow: 0 0 18px color-mix(in srgb, var(--oc) 70%, transparent); }
.pcards__opt[disabled] { cursor: default; }
.pcards__label { flex: 1; min-width: 60%; }
.pcards__pct { font-size: 1.3rem; }
.pcards__who { display: flex; gap: 2px; flex-wrap: wrap; width: 100%; }
.pcards__who .avatar, .pcards__answered .avatar, .pcards__board .avatar { width: 28px; height: 28px; font-size: .95rem; }
.pcards__bar { position: absolute; inset: 0; z-index: -1; transform-origin: left; background: color-mix(in srgb, var(--oc) 35%, transparent); transition: transform .8s var(--ease-out); }
.pcards__cand { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 16px; border: 2px solid var(--line);
  background: rgba(255, 255, 255, .04); color: var(--text); font: 700 .9rem var(--font-body); cursor: pointer; touch-action: manipulation; }
.pcards__cand .pcards__label { min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.pcards__cand.is-picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 20%, transparent); }
.pcards__cand.is-top { border-color: var(--yellow); box-shadow: 0 0 18px rgba(250, 204, 21, .5); }
.pcards__cand[disabled] { cursor: default; }
.pcards__votes { position: absolute; top: 6px; right: 8px; font-size: 1.2rem; color: var(--yellow); }
.pcards__foot { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.pcards__answered { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; min-height: 30px; }
.pcards__wait { margin: 0; font-weight: 700; color: var(--accent); }
.pcards__note { margin: 0; font-weight: 700; font-size: 1.1rem; }
.pcards__gain { font-size: 2.2rem; color: var(--acid); text-shadow: 0 0 14px rgba(163, 230, 53, .8); animation: pop-in .5s var(--ease-pop) both; }
.pcards__gain.is-zero { color: var(--muted); text-shadow: none; }
.pcards__board { list-style: none; margin: 0; padding: 0; width: min(420px, 100%); display: flex; flex-direction: column; gap: 4px; }
.pcards__board li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); }
.pcards__board li span:not(.avatar) { flex: 1; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcards__board em { color: var(--acid); font-style: normal; font-size: .85rem; }
.pcards--pad .pcards__prompt { font-size: 1.05rem; font-weight: 600; color: var(--text-2); }
.pcards--pad .pcards__opt { min-height: 18vh; justify-content: center; text-align: center; }
.pcards--screen .pcards__inner { width: min(1400px, 100%); }
.pcards--screen .pcards__prompt { font-size: clamp(2rem, 3.6vw, 3.4rem); text-align: center; }
.pcards--screen .pcards__opt { min-height: 120px; font-size: clamp(1.3rem, 2.2vw, 2rem); }
.pcards--screen .pcards__board { width: min(640px, 100%); font-size: 1.3rem; }

/* ---------- Mode TV (écran principal du mode Soirée) ---------- */
body.tv { font-size: clamp(18px, 1.6vw, 28px); }
body.tv .page { max-width: 1600px; }
.tv-lobby { display: grid; gap: 32px; grid-template-columns: minmax(280px, 0.9fr) 1.4fr; align-items: center; min-height: 80vh; }
@media (max-width: 900px) { .tv-lobby { grid-template-columns: 1fr; } }
.qr { background: #fff; border-radius: 18px; padding: 10px; width: min(100%, 220px); aspect-ratio: 1; }
body.tv .qr { width: min(100%, 360px); }
.qr img { width: 100%; height: 100%; }

/* ---------- Divers ---------- */
.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; background: var(--sc); }
.swatch[aria-pressed="true"] { border-color: #fff; }
.emoji-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.emoji-grid button { aspect-ratio: 1; font-size: 1.7rem; border-radius: 14px; border: 2px solid var(--line); background: rgba(255, 255, 255, .04); cursor: pointer; }
.emoji-grid button[aria-pressed="true"] { border-color: var(--magenta); background: rgba(236, 72, 153, .18); }
.footer { margin-top: 48px; text-align: center; color: var(--muted); font-size: .85rem; display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }
.footer a { color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--cyan); animation: led-spin .8s linear infinite; }
.swatch-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.swatch-tile { border-radius: 14px; padding: 12px; border: 1px solid var(--line); font-size: .8rem; }
.swatch-tile i { display: block; height: 44px; border-radius: 10px; margin-bottom: 8px; background: var(--sc); box-shadow: 0 0 18px var(--sc); }

/* ---------- Mouvement réduit : pas de scintillement, pas de chenillard, pas de défilement ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .neon-logo, .neon-logo__dash { animation: none !important; opacity: 1; }
  .synth__grid::before, .gcard::before { animation: none !important; }
  .flash { display: none; }
}
