/* Progression animee + boosters debloques persistants (2026-11-11) — partage TV / page joueur.
   Uniquement transform / opacity dans les animations (aucun recalcul de mise en page). */
:root {
  --rt-gold: #d8b968;
  --rt-gold-light: #f1d998;
  --rt-ink: #f7f3e8;
  --rt-size: 40px;
  --rt-pack-w: 30px;
  --rt-pack-h: 42px;
}

/* ------------------------------------------------------------------ mascotte sur la barre */
/* overflow: hidden (pas seulement overflow-x: clip, absent des anciens Safari) : la boite du
   coureur, decalee par translateX, ne doit jamais creer de defilement horizontal. Les 22 px du
   haut laissent la place au petit saut de la mascotte. */
.rt-rail { position: absolute; left: 0; right: 0; box-sizing: content-box; height: calc(var(--rt-size) * 1.125); padding-top: 22px; pointer-events: none; z-index: 3; overflow: hidden; }
/* Le coureur occupe la largeur utile (barre moins une mascotte) : translateX(p%) place le centre
   de la mascotte entre le debut et la fin de la barre, jamais en dehors, a 0 % comme a 100 %. */
.rt-runner {
  position: absolute; top: 0; bottom: 0;
  left: calc(var(--rt-size) / 2); right: calc(var(--rt-size) / 2);
  transform: translate3d(0, 0, 0);
  transition: transform 850ms cubic-bezier(.3, 1.12, .5, 1);
  will-change: transform;
}
.rt-runner.rt-instant { transition: none; }
.rt-mascot {
  position: absolute; left: 0; bottom: 0; width: var(--rt-size); height: calc(var(--rt-size) * 1.125);
  margin-left: calc(var(--rt-size) / -2);
  transform-origin: 50% 100%;
  animation: rt-float 3.2s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(169, 156, 255, .55));
}
.rt-mascot-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.rt-mascot-star { transform-origin: 32px 8px; animation: rt-twinkle 2.6s ease-in-out infinite; }
@keyframes rt-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes rt-twinkle { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .7; transform: scale(.82); } }
/* Petite marche pendant le deplacement (balancement), puis retour au flottement calme. */
.rt-mascot.rt-walking { animation: rt-walk .3s ease-in-out 3; }
@keyframes rt-walk { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-4px) rotate(-6deg); } 75% { transform: translateY(-4px) rotate(6deg); } }
.rt-mascot.rt-hop { animation: rt-hop .7s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes rt-hop { 0% { transform: translateY(0) scale(1, 1); } 20% { transform: translateY(0) scale(1.12, .86); } 50% { transform: translateY(-16px) scale(.94, 1.08); } 80% { transform: translateY(0) scale(1.06, .94); } 100% { transform: translateY(0) scale(1, 1); } }

/* ------------------------------------------------------------------ zone BOOSTERS DÉBLOQUÉS */
.rt-tray { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rt-tray-head { display: flex; align-items: baseline; gap: 8px; }
.rt-tray-title { font-weight: 700; font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--rt-gold-light); }
.rt-tray-count { font-weight: 800; font-size: .95rem; color: var(--rt-ink); font-variant-numeric: tabular-nums; }
.rt-tray-empty { margin: 0; font-size: .82rem; opacity: .7; }
.rt-tray.rt-has .rt-tray-empty { display: none; }
.rt-packs { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; min-height: var(--rt-pack-h); perspective: 600px; }
.rt-tray:not(.rt-has) .rt-packs { min-height: 0; }
/* 6+ : boosters legerement plus petits et chevauches (toujours tous visibles jusqu'a 12). */
.rt-tray.rt-many .rt-packs { gap: 0; flex-wrap: nowrap; }
.rt-tray.rt-many .rt-pack { --rt-pack-w: 26px; --rt-pack-h: 36px; margin-right: -7px; }
.rt-tray.rt-crowd .rt-pack { margin-right: -12px; }

.rt-pack {
  position: relative; display: inline-block; flex: none;
  width: var(--rt-pack-w); height: var(--rt-pack-h);
  transform-style: preserve-3d;
  animation: rt-idle calc(3.4s + (var(--i, 1) * .37s)) ease-in-out infinite;
  animation-delay: calc(var(--i, 1) * -.9s);
}
@keyframes rt-idle { 0%, 100% { transform: translateY(0) rotateY(-10deg); } 50% { transform: translateY(-3px) rotateY(12deg); } }
.rt-pack-body {
  position: absolute; inset: 0; border-radius: 4px; overflow: hidden;
  background: linear-gradient(135deg, #3b2f86 0%, #6a3d9a 32%, #2b5aa8 58%, #d8b968 86%, #8a4fb0 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45), inset 0 0 0 1.5px rgba(241, 217, 152, .9);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.rt-pack-crimp { position: absolute; left: 0; right: 0; height: 12%; background: repeating-linear-gradient(90deg, rgba(20, 16, 50, .55) 0 3px, rgba(241, 217, 152, .6) 3px 4.5px); }
.rt-pack-crimp.top { top: 0; } .rt-pack-crimp.bottom { bottom: 0; }
.rt-pack-mark { color: var(--rt-gold-light); font-size: calc(var(--rt-pack-w) * .42); line-height: 1; text-shadow: 0 0 6px rgba(241, 217, 152, .8); }
.rt-pack-num { margin-top: 1px; font: 700 calc(var(--rt-pack-w) * .32)/1 system-ui, sans-serif; color: var(--rt-ink); }
/* Reflet qui passe de temps en temps, decale d'un booster a l'autre. */
.rt-pack-sheen { position: absolute; inset: -40%; background: linear-gradient(110deg, transparent 42%, rgba(255, 255, 255, .55) 50%, transparent 58%); transform: translateX(-80%); animation: rt-sheen calc(5s + (var(--i, 1) * .6s)) ease-in-out infinite; animation-delay: calc(var(--i, 1) * -1.3s); }
@keyframes rt-sheen { 0%, 70% { transform: translateX(-80%); } 100% { transform: translateX(80%); } }
.rt-pack.rt-land { animation: rt-land .85s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes rt-land { 0% { transform: scale(.2) rotate(-25deg); opacity: 0; } 60% { transform: scale(1.25) rotate(6deg); opacity: 1; } 100% { transform: scale(1) rotate(0); } }

/* ------------------------------------------------------------------ animation de deblocage
   Jamais bloquante (pointer-events: none) : l'ecran reste utilisable pendant ~2,5 s. */
.rt-unlock { position: fixed; left: 50%; top: 42%; width: 0; height: 0; z-index: 60; pointer-events: none; }
.rt-unlock-halo { position: absolute; left: -130px; top: -130px; width: 260px; height: 260px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 244, 208, .95) 0%, rgba(241, 217, 152, .55) 30%, rgba(169, 156, 255, .25) 55%, transparent 70%); opacity: 0; transform: scale(.3); }
.rt-unlock-pack { position: absolute; left: -36px; top: -50px; width: 72px; height: 100px; opacity: 0; }
.rt-pack-big { --rt-pack-w: 72px; --rt-pack-h: 100px; animation: none; }
.rt-pack-big .rt-pack-num { font-size: 22px; }
.rt-unlock-cards { position: absolute; left: 0; top: 0; }
.rt-fan { position: absolute; left: -26px; top: -38px; width: 52px; height: 74px; opacity: 0; transform-origin: 50% 120%; }
.rt-card { position: absolute; inset: 0; border-radius: 5px; background: linear-gradient(160deg, #1d1a4d, #2d2672 60%, #1a1640); box-shadow: 0 4px 12px rgba(0, 0, 0, .5), inset 0 0 0 2px rgba(241, 217, 152, .85); display: flex; align-items: center; justify-content: center; }
.rt-card-inner { width: 70%; height: 74%; border: 1px solid rgba(241, 217, 152, .55); border-radius: 50% / 40%; display: flex; align-items: center; justify-content: center; color: var(--rt-gold-light); font-size: 18px; }
.rt-unlock-sparks i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--rt-gold-light); box-shadow: 0 0 10px var(--rt-gold-light); opacity: 0; transform: rotate(var(--a)) translateY(0); }
.rt-unlock-text { position: absolute; left: -160px; width: 320px; top: 66px; text-align: center; font: 800 1.15rem/1.2 system-ui, sans-serif; letter-spacing: .04em; color: var(--rt-gold-light); text-shadow: 0 0 18px rgba(241, 217, 152, .8), 0 2px 6px rgba(0, 0, 0, .9); opacity: 0; }

/* 1. flash / halo  2. booster qui apparait (scale + rotation)  3. il s'ouvre  4. cartes en
   eventail  5. etincelles  6. fin  7. le booster rejoint la zone (--tx/--ty). */
.rt-unlock.rt-go .rt-unlock-halo { animation: rt-halo 1.9s ease-out forwards; }
@keyframes rt-halo { 0% { opacity: 0; transform: scale(.3); } 15% { opacity: 1; transform: scale(1.1); } 60% { opacity: .55; transform: scale(1.4); } 100% { opacity: 0; transform: scale(1.8); } }
.rt-unlock.rt-go .rt-unlock-pack { animation: rt-pack-show 2.5s cubic-bezier(.3, 1.2, .5, 1) forwards; }
@keyframes rt-pack-show {
  0% { opacity: 0; transform: translate(0, 0) scale(.2) rotate(-200deg); }
  22% { opacity: 1; transform: translate(0, 0) scale(1.12) rotate(8deg); }
  30% { transform: translate(0, 0) scale(1) rotate(0); }
  36% { transform: translate(0, 0) scale(1.04) rotate(-4deg); }
  42% { transform: translate(0, 0) scale(1.04) rotate(4deg); }
  48% { transform: translate(0, 4px) scale(1) rotate(0); }
  74% { opacity: 1; transform: translate(0, 4px) scale(1) rotate(0); }
  100% { opacity: .9; transform: translate(var(--tx, 0), var(--ty, 0)) scale(.4) rotate(0); }
}
/* L'ouverture : le haut du booster se detache. */
.rt-unlock.rt-go .rt-pack-big .rt-pack-crimp.top { animation: rt-tear 2.5s ease-out forwards; }
@keyframes rt-tear { 0%, 46% { transform: translateY(0) rotate(0); opacity: 1; } 58% { transform: translateY(-26px) rotate(-18deg); opacity: 1; } 70%, 100% { transform: translateY(-40px) rotate(-30deg); opacity: 0; } }
.rt-unlock.rt-go .rt-fan { animation: rt-fan 2.5s cubic-bezier(.2, .9, .3, 1.15) forwards; animation-delay: calc(var(--k) * 40ms); }
@keyframes rt-fan {
  0%, 46% { opacity: 0; transform: translateY(10px) rotate(0) scale(.6); }
  60% { opacity: 1; transform: translateY(-74px) rotate(var(--deg)) scale(1); }
  76% { opacity: 1; transform: translateY(-80px) rotate(calc(var(--deg) * 1.1)) scale(1); }
  90%, 100% { opacity: 0; transform: translateY(-30px) rotate(0) scale(.5); }
}
.rt-unlock.rt-go .rt-unlock-sparks i { animation: rt-spark 1.1s ease-out forwards .95s; }
@keyframes rt-spark { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-120px) scale(.3); } }
.rt-unlock.rt-go .rt-unlock-text { animation: rt-text 2.5s ease forwards; }
@keyframes rt-text { 0%, 30% { opacity: 0; transform: translateY(8px); } 42%, 80% { opacity: 1; transform: translateY(0); } 100% { opacity: 0; transform: translateY(-4px); } }

/* ------------------------------------------------------------------ mouvement reduit
   Apparition simple, aucune rotation, aucune carte qui vole ; l'etat final reste lisible. */
@media (prefers-reduced-motion: reduce) {
  .rt-runner { transition: transform .2s linear; }
  .rt-mascot, .rt-mascot.rt-walking, .rt-mascot.rt-hop, .rt-mascot-star, .rt-pack, .rt-pack-sheen { animation: none !important; }
  .rt-pack.rt-land { animation: rt-fade .4s ease !important; }
  .rt-unlock-cards, .rt-unlock-sparks, .rt-unlock-halo { display: none; }
  .rt-unlock.rt-go .rt-unlock-pack { animation: rt-calm 1.1s ease forwards !important; }
  .rt-unlock.rt-go .rt-unlock-text { animation: rt-calm 1.1s ease forwards !important; }
  .rt-unlock.rt-go .rt-pack-big .rt-pack-crimp.top { animation: none !important; }
}
@keyframes rt-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rt-calm { 0% { opacity: 0; } 20%, 75% { opacity: 1; } 100% { opacity: 0; } }
