/* ==========================================================================
   Bootleggers Wrapped — styles
   Les 3 couleurs du club (--primary, --dark, --grey) sont écrasées au
   chargement par celles de data/season.json (voir applyClubTheme dans app.js).
   Les tailles en "cqw" sont relatives à la largeur du cadre .app : tout
   s'adapte automatiquement, du petit smartphone au cadre desktop.
   ========================================================================== */

:root {
  --primary: #C8102E;
  --dark: #111111;
  --grey: #8A8D8F;
  --white: #FFFFFF;

  --font-display: 'Anton', Impact, 'Arial Narrow Bold', sans-serif;
  --font-body: 'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --slide-ms: 600ms;            /* garder synchro avec TRANSITION_MS (app.js) */

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Taille du cadre "téléphone" sur desktop */
  --frame-h: min(calc(100dvh - 48px), 880px);
  --frame-w: calc(var(--frame-h) * 9 / 19);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
ol, ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

html, body { height: 100%; }
body {
  display: grid;
  place-items: center;
  background: var(--dark);
  color: var(--white);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* --------------------------------------------------------------------------
   Cadre de l'app
   -------------------------------------------------------------------------- */
.app {
  position: relative;
  width: 100%;
  max-width: 560px;
  height: 100dvh;
  overflow: hidden;
  background: var(--dark);
  container-type: size;           /* active les unités cqw / cqh */
  user-select: none;
  touch-action: pan-y;            /* le navigateur gère le scroll vertical, nous le swipe horizontal */
}

@media (min-width: 720px) and (min-height: 560px) {
  body { background: radial-gradient(circle at 50% 35%, #2b2b2b 0%, var(--dark) 70%); }
  .app {
    width: var(--frame-w);
    height: var(--frame-h);
    border-radius: 32px;
    box-shadow: 0 30px 90px rgba(0, 0, 0, .65), 0 0 0 1px rgba(255, 255, 255, .07);
  }
}

.stage { position: absolute; inset: 0; }

/* --------------------------------------------------------------------------
   Thèmes d'écran (fond + couleurs de texte)
   -------------------------------------------------------------------------- */
.theme-red, .theme-poster { --bg: var(--primary); --fg: var(--white); --accent: var(--dark);    --muted: rgba(255, 255, 255, .78); --line: rgba(0, 0, 0, .22); --card: rgba(0, 0, 0, .2); }
.theme-dark { --bg: var(--dark);    --fg: var(--white); --accent: var(--primary); --muted: rgba(255, 255, 255, .62); --line: rgba(255, 255, 255, .12); --card: rgba(255, 255, 255, .06); }
.theme-grey { --bg: var(--grey);    --fg: var(--dark);  --accent: var(--white);   --muted: rgba(17, 17, 17, .72);   --line: rgba(17, 17, 17, .18); --card: rgba(17, 17, 17, .1); }

/* --------------------------------------------------------------------------
   Écrans + transitions
   -------------------------------------------------------------------------- */
.screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  visibility: hidden;
  transform: translateX(100%);                        /* écrans à venir : à droite */
  transition: transform var(--slide-ms) var(--ease), visibility 0s linear var(--slide-ms);
}
.screen.is-past { transform: translateX(-100%); }     /* écrans passés : à gauche */
.screen.is-active {
  z-index: 1;
  visibility: visible;
  transform: none;
  transition: transform var(--slide-ms) var(--ease), visibility 0s;
}
.no-slide .screen { transition: none !important; }

.screen__body {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: safe center;   /* centré verticalement, mais scrollable si ça déborde */
  gap: clamp(14px, 4.5cqw, 26px);
  padding: calc(66px + var(--safe-top)) 7cqw calc(28px + var(--safe-bottom));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.screen__body::-webkit-scrollbar { display: none; }

/* Apparition progressive des éléments .rv (délai = --d) */
.rv { opacity: 0; transform: translateY(28px); }
.is-active .rv,
.is-leaving .rv { opacity: 1; transform: none; }
.is-active .rv {
  transition: opacity .6s var(--ease), transform .8s var(--ease);
  transition-delay: calc(250ms + var(--d, 0) * 90ms);  /* garder synchro avec REVEAL_* (app.js) */
}

/* --------------------------------------------------------------------------
   Typographie
   -------------------------------------------------------------------------- */
.kicker {
  font-weight: 700;
  font-size: clamp(11px, 3.4cqw, 15px);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}
.kicker--sm { margin-bottom: 10px; font-size: clamp(10px, 3cqw, 13px); }

.mega, .title, .num {
  font-family: var(--font-display);
  font-weight: 400;
  text-transform: uppercase;
  line-height: .9;
}
.mega  { font-size: 25cqw; letter-spacing: -.005em; }
.title { font-size: 11.5cqw; line-height: .95; }
.title small { display: block; margin-top: 6px; font-family: var(--font-body); font-size: 3.6cqw; font-weight: 700; letter-spacing: .08em; color: var(--muted); }

.num { display: inline-block; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num--huge { font-size: 40cqw; }
.num--xl   { font-size: 34cqw; }
.num--lg   { font-size: 19cqw; }
.num--md   { font-size: 13cqw; }
.num .dash { margin: 0 .08em; opacity: .55; }

.accent { color: var(--accent); }
.muted  { color: var(--muted); font-weight: 700; }

/* --------------------------------------------------------------------------
   Décor
   -------------------------------------------------------------------------- */
.deco-ball {
  position: absolute;
  pointer-events: none;
  color: var(--fg);
  opacity: .14;
  animation: spin 60s linear infinite;
}
.deco-ball--intro  { width: 110cqw; right: -50cqw; bottom: -40cqw; }
.deco-ball--corner { width: 80cqw; right: -30cqw; top: -18cqw; opacity: .12; }

.watermark {
  position: absolute;
  right: -6cqw;
  bottom: -12cqw;
  font-family: var(--font-display);
  font-size: 110cqw;
  line-height: .8;
  color: var(--fg);
  opacity: .05;
  pointer-events: none;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --------------------------------------------------------------------------
   Barre du haut (progression + marque + partage)
   -------------------------------------------------------------------------- */
.topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  padding: calc(10px + var(--safe-top)) 12px 0;
  color: var(--white);
  pointer-events: none;
  transition: color .4s;
}
.app[data-theme="grey"] .topbar { color: var(--dark); }

.progress { display: flex; gap: 4px; }
.progress__seg {
  position: relative;
  flex: 1;
  height: 3px;
  border-radius: 3px;
  overflow: hidden;
  background: color-mix(in srgb, currentColor 28%, transparent);
}
.progress__seg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .5s var(--ease);
}
.progress__seg.is-done::after,
.progress__seg.is-current::after { transform: scaleX(1); }

/* Défilement automatique : le segment courant se remplit pendant la durée de l'écran (--dur) */
.progress__seg.is-current.is-timed::after { animation: seg-fill var(--dur, 6s) linear both; }
@keyframes seg-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.topbar__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;            /* hauteur conservée : les écrans sont calés dessous */
  margin-top: 8px;
}
.brand { font-size: 12px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }

/* --------------------------------------------------------------------------
   1. Intro
   -------------------------------------------------------------------------- */
/* Mise en page "affiche" : grand bloc blanc en haut (le logo est dessiné pour
   un fond blanc), coupé en diagonale avec un liseré noir, texte en bas sur le rouge. */
.intro {
  gap: 0;
  padding: 0;
  justify-content: flex-start;
  overflow: hidden;
}
.intro__hero {
  position: relative;
  flex: 1 1 auto;
  min-height: 34cqh;
  background: var(--dark);                                       /* = liseré noir */
  clip-path: polygon(0 0, 100% 0, 100% 84%, 0 100%);
}
.intro__hero::before {                                           /* le bloc blanc */
  content: '';
  position: absolute;
  inset: 0;
  background: var(--white);
  clip-path: polygon(0 0, 100% 0, 100% calc(84% - 2.4cqw), 0 calc(100% - 2.8cqw));
}
.intro__hero .logo {
  position: absolute;
  z-index: 1;
  top: calc(62px + var(--safe-top));
  left: 10cqw;
  width: 80cqw;
  height: calc(100% - 62px - var(--safe-top) - 12cqh);           /* laisse la place à la diagonale */
  object-fit: contain;
}
.is-active .intro__hero .logo { animation: logo-in .9s var(--ease) .15s both; }
@keyframes logo-in { from { opacity: 0; transform: scale(.85) rotate(-4deg); } }

.intro__content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: clamp(10px, 3cqw, 16px);
  padding: 3cqh 7cqw calc(32px + var(--safe-bottom));
}
.intro .mega { font-size: 21cqw; }

.app[data-theme="poster"] .topbar { color: var(--dark); }        /* barre du haut sur le blanc */
.logo--mono {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--dark);
  color: var(--primary);
  font-family: var(--font-display);
  font-size: 15cqw;
}
.sticker {
  display: inline-block;
  padding: .12em .35em .06em;
  background: var(--accent);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 13cqw;
  text-transform: uppercase;
  line-height: 1;
  transform: rotate(-4deg);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, .25);
}
.intro__tagline { font-size: clamp(14px, 4cqw, 18px); font-weight: 500; color: var(--muted); max-width: 26ch; }


/* --------------------------------------------------------------------------
   2a. Bilan
   -------------------------------------------------------------------------- */
.record { display: flex; align-items: flex-start; gap: 3cqw; margin-top: -1cqw; }
.record__item { display: flex; flex-direction: column; }
.record__item--w .num { color: var(--accent); }
.record__sep { font-family: var(--font-display); font-size: 20cqw; line-height: 1.6; color: var(--muted); }
.record__label { margin-top: 4px; font-size: clamp(12px, 3.8cqw, 17px); font-weight: 900; text-transform: uppercase; letter-spacing: .1em; }

.stat-line { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.stat-line__label { font-weight: 700; font-size: clamp(14px, 4.4cqw, 19px); }

.meter { height: 12px; border-radius: 99px; background: var(--line); overflow: hidden; }
.meter__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--accent);
}
.is-active .meter__fill, .is-leaving .meter__fill { width: var(--w); }
.is-active .meter__fill { transition: width 1.2s var(--ease) .7s; }

/* grille : les pastilles passent à la ligne quand il y a beaucoup de matchs */
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(24px, 6.8cqw), 1fr)); gap: 1.6cqw; }
.form__cell {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 6px;
  font-weight: 900;
  font-size: clamp(10px, 3.2cqw, 14px);
  background: var(--card);
  color: var(--muted);
  transform: scale(0);
}
.form__cell--W { background: var(--primary); color: var(--white); }
.theme-red .form__cell--W { background: var(--dark); }
.is-active .form__cell, .is-leaving .form__cell { transform: none; }
.is-active .form__cell { transition: transform .45s var(--ease) calc(.8s + var(--i) * 70ms); }

/* --------------------------------------------------------------------------
   2b. Points
   -------------------------------------------------------------------------- */
.big-stat { display: flex; flex-direction: column; gap: 4px; }
.big-stat__label { font-weight: 900; font-size: clamp(14px, 4.6cqw, 20px); text-transform: uppercase; letter-spacing: .06em; }
.num--hero { font-size: min(30cqw, 12cqh); }

/* Tuiles de stats (3 colonnes) */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2.6cqw; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 3.4cqw 3.4cqw 3.8cqw;
  border-radius: 14px;
  background: var(--card);
}
/* --chars = nombre de caractères de la valeur la plus longue de la zone (ex. "16.69" → 5) :
   les chiffres rétrécissent pour tenir dans la tuile, avec la même taille sur toute la zone */
.tile .num { font-size: min(11.5cqw, 5.6cqh, calc(19.5cqw / (var(--chars, 3) * .47))); }
/* Zone à 4 stats : 4 colonnes plus serrées, chiffres un peu plus petits */
.tiles--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2cqw; }
.tiles--4 .tile { padding: 3cqw 2.6cqw 3.2cqw; }
.tiles--4 .tile .num { font-size: min(8.4cqw, 4.2cqh, calc(14.2cqw / (var(--chars, 3) * .47))); }
.tiles--4 .tile__label { font-size: clamp(10px, 3cqw, 13px); }

.tile__empty { opacity: .45; }                                  /* stat vide « – » */
.tile__label { font-weight: 900; font-size: clamp(11px, 3.3cqw, 14px); line-height: 1.15; }
.tile__meta  { font-weight: 700; font-size: clamp(10px, 3cqw, 13px); color: var(--muted); }
.tile--strong { background: var(--dark); color: var(--white); }
.theme-dark .tile--strong { background: var(--primary); }       /* noir sur noir serait invisible */
.tile--strong .tile__meta { color: rgba(255, 255, 255, .65); }

/* Zones (Attaque / Défense / Lanceurs) */
.zone { display: flex; flex-direction: column; gap: 8px; }
.zone__title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(11px, 3.3cqw, 14px);
  font-weight: 900;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.zone__title::after { content: ''; flex: 1; height: 2px; background: var(--line); }

/* --------------------------------------------------------------------------
   3. Fiches joueurs
   -------------------------------------------------------------------------- */
.player__bignum {                                  /* numéro de maillot géant en fond */
  position: absolute;
  right: -4cqw;
  top: 6cqh;
  font-family: var(--font-display);
  font-size: 95cqw;
  line-height: .8;
  color: var(--fg);
  opacity: .08;
  pointer-events: none;
}
.player__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 4cqw; }
.player__id { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.player__name { display: flex; flex-direction: column; font-weight: 400; }
.player__first {
  font-weight: 900;
  font-size: clamp(18px, 6.2cqw, 28px);
  line-height: 1.1;
}
.player__last {
  font-family: var(--font-display);
  /* --len = nombre de lettres du mot le plus long : les noms longs rétrécissent pour tenir en largeur */
  font-size: min(17cqw, 9cqh, calc(84cqw / (var(--len, 6) * .54)));
  line-height: .9;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.player__meta {
  align-self: flex-start;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--fg);
  color: var(--bg);
  font-weight: 900;
  font-size: clamp(12px, 3.6cqw, 15px);
  letter-spacing: .08em;
}
/* Photo en grand à gauche, derrière le nom (le numéro géant reste à droite) */
.player__head { position: relative; padding-top: 62cqw; }
.player__id { position: relative; z-index: 1; }
.player__name { text-shadow: 0 2px 14px rgba(0, 0, 0, .35); }
.player__photo {
  position: absolute;
  z-index: 0;
  left: -38cqw;                 /* le visage (centre de l'image) tombe dans le tiers gauche */
  bottom: 2cqw;                 /* le bas de la photo passe sous le NOM */
  width: 135cqw;                /* grand : les PNG détourés ont beaucoup de marge transparente */
  max-width: none;
  height: auto;
  pointer-events: none;
  /* fondu vers le bas pour que le nom reste lisible par-dessus */
  -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent 95%);
          mask-image: linear-gradient(to bottom, #000 62%, transparent 95%);
}
.player__quote {
  padding-left: 4cqw;
  border-left: 4px solid var(--fg);
  font-weight: 700;
  font-size: clamp(14px, 4.3cqw, 19px);
  line-height: 1.3;
}
.player__quote::before { content: '« '; }
.player__quote::after  { content: ' »'; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 12px;
  border-radius: 99px;
  background: var(--card);
  font-size: clamp(12px, 3.6cqw, 15px);
  font-weight: 700;
}
.chip strong { font-weight: 900; }

/* --------------------------------------------------------------------------
   2c. Records (cartes)
   -------------------------------------------------------------------------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 4.5cqw 5cqw;
  border-radius: 18px;
  background: var(--card);
}
.card__label { font-size: clamp(11px, 3.3cqw, 14px); font-weight: 900; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.card__meta  { font-size: clamp(13px, 3.8cqw, 16px); font-weight: 700; }
.card__row   { display: flex; align-items: center; gap: 4cqw; }
.card__text  { font-weight: 900; font-size: clamp(15px, 4.8cqw, 21px); line-height: 1.1; text-transform: uppercase; }
.card--split { flex-direction: row; }
.card--split > div { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.card--split > div + div { padding-left: 5cqw; border-left: 2px solid var(--line); }

/* --------------------------------------------------------------------------
   2d. La saison en accéléré (replay.js)
   -------------------------------------------------------------------------- */
.replay__bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--dark);
  transition: background-color .25s;
}

/* Lettre géante V / D qui traverse le fond */
.replay__ghost {
  position: absolute;
  left: -6cqw;
  bottom: -16cqw;
  font-family: var(--font-display);
  font-size: 150cqw;
  line-height: .8;
  color: var(--white);
  opacity: .08;
}
.replay__ghost.is-in { animation: ghost-in .6s var(--ease); }
@keyframes ghost-in { from { transform: translateX(35%) skewX(-10deg); opacity: 0; } }

/* Balle qui roule d'un cran à chaque match (--step est mis à jour par replay.js) */
.deco-ball.replay__ball {
  width: 90cqw;
  right: -38cqw;
  top: 10cqh;
  opacity: .1;
  animation: none;
  transform: translateX(calc(var(--step, 0) * -1.4cqw)) rotate(calc(var(--step, 0) * -45deg));
  transition: transform .5s var(--ease);
}
.screen[data-result="W"] .replay__bg { background: var(--primary); }
.screen[data-result="T"] .replay__bg { background: var(--grey); }

.replay__card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5cqw 5.5cqw 6cqw;
  border-radius: 20px;
  background: rgba(0, 0, 0, .3);
  opacity: 0;                                   /* invisible avant le 1er match */
}
.is-running .replay__card, .is-done .replay__card { opacity: 1; }
/* Entrée de chaque match : la carte glisse, le score claque, le tampon tombe */
.replay__card.is-in { animation: card-in .38s var(--ease); }
.replay__card.is-in.is-shake { animation: card-in .38s var(--ease), card-shake .36s linear .22s; }
.is-in .replay__score { transform-origin: left center; animation: score-slam .42s var(--ease) .06s both; }
.is-in .replay__stamp { animation: stamp .38s cubic-bezier(.3, 1.6, .5, 1) .16s both; }

@keyframes card-in    { from { transform: translateX(45%) rotate(7deg) scale(.9); opacity: 0; } }
@keyframes score-slam { from { transform: scale(1.8); opacity: 0; } }
@keyframes stamp      { from { transform: scale(2.6) rotate(-20deg); opacity: 0; } }
@keyframes card-shake {
  20% { transform: translateX(-7px) rotate(-1.2deg); }
  40% { transform: translateX(7px) rotate(1.2deg); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

.replay__meta {
  padding-right: 30cqw;                         /* place pour le tampon */
  font-size: clamp(11px, 3.3cqw, 14px);
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .75);
}
.replay__opp {
  min-height: 2.3em;                            /* évite que la carte saute avec les noms longs */
  font-weight: 900;
  font-size: clamp(16px, 5.4cqw, 23px);
  line-height: 1.15;
}
.replay__score { font-size: 25cqw; }
.replay__stamp {
  position: absolute;
  top: -3.5cqw;                                 /* dépasse du coin, façon étiquette */
  right: 4cqw;
  padding: .12em .4em .06em;
  background: var(--dark);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 7.5cqw;
  text-transform: uppercase;
  transform: rotate(6deg);
  box-shadow: 4px 4px 0 rgba(0, 0, 0, .25);
}
.replay__count {
  position: absolute;
  right: 5.5cqw;
  bottom: 6cqw;
  font-weight: 900;
  font-size: clamp(11px, 3.3cqw, 14px);
  color: rgba(255, 255, 255, .6);
}
.screen[data-result="L"] .replay__stamp { background: var(--primary); }

.replay__tally { display: flex; gap: 8cqw; }
.replay__tally p { display: flex; align-items: baseline; gap: 8px; }
.replay__tally b { font-size: 14cqw; font-weight: 400; transform-origin: left bottom; }
.replay__tally b.is-bump { animation: bump .35s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bump { from { transform: scale(1.45); } }
.replay__tally span { font-weight: 900; font-size: clamp(12px, 3.6cqw, 15px); text-transform: uppercase; letter-spacing: .08em; }

/* Pastilles : lisibles sur fond rouge comme sur fond noir */
.replay .form__cell { transform: none; transition: none; animation: cell-in .35s cubic-bezier(.3, 1.6, .5, 1); }
.replay .form__cell--W { background: var(--white); color: var(--primary); }
.replay .form__cell--L { background: rgba(255, 255, 255, .14); color: rgba(255, 255, 255, .8); }
@keyframes cell-in { from { transform: scale(0) rotate(-40deg); } }


/* --------------------------------------------------------------------------
   Chargement / erreurs / flèches desktop
   -------------------------------------------------------------------------- */
.loader {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: var(--dark);
  font-weight: 700;
  color: rgba(255, 255, 255, .7);
}
.loader[hidden] { display: none; }
.loader--error strong { color: var(--white); font-size: 18px; }
.loader--error small  { color: var(--grey); font-weight: 500; }
.loader code { padding: 1px 5px; border-radius: 4px; background: rgba(255, 255, 255, .1); }


.nav-btn { display: none; }
@media (min-width: 720px) and (min-height: 560px) {
  .nav-btn {
    position: fixed;
    top: 50%;
    display: grid;
    place-items: center;
    width: 52px; height: 52px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    font-size: 34px;
    line-height: 1;
    transform: translateY(-50%);
    transition: background .2s, opacity .2s;
  }
  .nav-btn:hover:not(:disabled) { background: var(--primary); }
  .nav-btn:disabled { opacity: .25; cursor: default; }
  .nav-btn--prev { left:  calc(50% - var(--frame-w) / 2 - 84px); }
  .nav-btn--next { right: calc(50% - var(--frame-w) / 2 - 84px); }
}

:focus-visible { outline: 3px solid var(--white); outline-offset: 2px; }

/* Mouvements réduits : pas de glissement, pas de rotation */
@media (prefers-reduced-motion: reduce) {
  .screen, .rv, .meter__fill, .form__cell { transition: none !important; }
  .deco-ball, .intro__hero .logo, .replay__card, .replay__card *, .replay .form__cell,
  .replay__ghost, .replay__tally b { animation: none !important; }
  .deco-ball.replay__ball { transition: none; }
}

/* --------------------------------------------------------------------------
   Mode vidéo (?video dans l'adresse) : cadre au format story 9:16, prêt à
   être enregistré puis recadré pile sur le cadre
   -------------------------------------------------------------------------- */
/* Curseur masqué uniquement sur le cadre vidéo : il reste visible sur les côtés (menu, flèches) */
html.rec .app, html.rec .app * { cursor: none !important; }
html.rec body { background: #000; }
html.rec .app {
  width: min(100vw, calc(100dvh * 9 / 16));
  height: min(100dvh, calc(100vw * 16 / 9));
  max-width: none;
  border-radius: 0;
  box-shadow: none;
}
html.rec .nav-btn { display: none; }
/* 9:16 est moins haut que le cadre normal : photo un peu plus petite pour que les fiches lanceurs tiennent */
html.rec .player__head { padding-top: 34cqw; }
html.rec .player__photo { width: 110cqw; left: -27cqw; }

/* --------------------------------------------------------------------------
   4. Remerciements (écran de fin)
   -------------------------------------------------------------------------- */
.outro { align-items: flex-start; }
.outro__logo { width: 38cqw; height: auto; margin-bottom: 2cqw; padding: 3cqw; border-radius: 6cqw; background: var(--white); } /* pastille blanche : le logo a des contours noirs */
.outro__title { font-size: 19cqw; line-height: .92; }

/* --------------------------------------------------------------------------
   Mode manuel (bouton « Défilement » du menu) : flèches ‹ › de part et
   d'autre du cadre vidéo, en dehors de celui-ci (la vidéo garde sa taille)
   -------------------------------------------------------------------------- */
html.rec.is-manual .nav-btn {
  --rec-w: min(100vw, calc(100dvh * 9 / 16));   /* largeur du cadre 9:16 */
  position: fixed;
  top: 50%;
  z-index: 50;
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: var(--white);
  font-size: 36px;
  line-height: 1;
  transform: translateY(-50%);
  transition: background .2s, opacity .2s;
  cursor: pointer !important;
}
html.rec.is-manual .nav-btn--prev { left:  calc(50% - var(--rec-w) / 2 - 80px); }
html.rec.is-manual .nav-btn--next { right: calc(50% - var(--rec-w) / 2 - 80px); }
html.rec.is-manual .nav-btn:hover:not(:disabled) { background: var(--primary); }
html.rec.is-manual .nav-btn:disabled { opacity: .2; cursor: default !important; }
/* Pas de place à côté du cadre (téléphone) : on navigue au toucher / swipe */
@media (max-aspect-ratio: 4/5) { html.rec.is-manual .nav-btn { display: none; } }
