/* ===== Bulle « Transformation en cours… » : saynètes façon film d'animation 3D ===== */
.magic-bubble { position: absolute; inset: 0; overflow: hidden; border-radius: 50%; perspective: 600px; }
.mb-scene { position: absolute; inset: 0; animation: mb-in .7s ease both; }
.mb-scene.prev { animation: none; }
@keyframes mb-in { from { opacity: 0; transform: scale(1.12); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
.mb-bg { position: absolute; inset: -6%; width: 112%; height: 112%; object-fit: cover; animation: mb-kb 5.8s ease-out both; }
@keyframes mb-kb { from { transform: scale(1.02) translate(1.5%, 1%); } to { transform: scale(1.14) translate(-1.5%, -1%); } }
.mb-actor { position: absolute; transform: translate(-50%, -100%); }
.mb-actor img { display: block; height: 100%; width: auto; transform-origin: 50% 100%; filter: drop-shadow(0 6px 6px rgba(20, 10, 60, .35)); }

/* Princesse qui tourne sur elle-même */
.mb-twirl img { animation: mb-pop .7s cubic-bezier(.3, 1.6, .5, 1) both, mb-twirl 2.6s ease-in-out .7s infinite; }
@keyframes mb-twirl { 0% { transform: rotateY(0) translateY(0); } 40% { transform: rotateY(180deg) translateY(-4%); } 80%, 100% { transform: rotateY(360deg) translateY(0); } }
@keyframes mb-pop { from { transform: scale(.2) translateY(30%); opacity: 0; } to { transform: none; opacity: 1; } }

/* Cowboy au galop : il arrive, galope un moment au milieu de la bulle, puis repart */
.mb-gallop { animation: mb-travel 5.2s ease-in-out both; }
.mb-gallop img { animation: mb-gallop .34s ease-in-out infinite alternate; }
@keyframes mb-travel { 0% { left: -45%; } 28% { left: 46%; } 72% { left: 56%; } 100% { left: 150%; } }
@keyframes mb-gallop { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-7%) rotate(3deg); } }

/* Super-héros qui s'envole en diagonale */
.mb-fly { animation: mb-fly 5.2s cubic-bezier(.45, .05, .55, .95) both; }
.mb-fly img { animation: mb-wobble 1.1s ease-in-out infinite; }
@keyframes mb-fly { 0% { left: -40%; top: 92%; } 45% { left: 50%; top: 62%; } 55% { left: 56%; top: 58%; } 100% { left: 150%; top: 22%; } }
@keyframes mb-wobble { 0%, 100% { transform: rotate(-6deg) translateY(0); } 50% { transform: rotate(-2deg) translateY(-5%); } }

/* Animaux qui arrivent en sautant, l'un après l'autre, puis sautillent */
.mb-hop img { animation: mb-rise .8s cubic-bezier(.3, 1.5, .5, 1) var(--d) both, mb-hop .9s ease-in-out calc(var(--d) + .8s) infinite; }
@keyframes mb-rise { from { transform: translateY(130%) scale(.7); } to { transform: none; } }
@keyframes mb-hop { 0%, 100% { transform: translateY(0) scale(1, 1); } 15% { transform: translateY(0) scale(1.08, .9); } 45% { transform: translateY(-16%) scale(.95, 1.06); } 75% { transform: translateY(0) scale(1.04, .96); } }

/* Astronaute en apesanteur */
.mb-float img { animation: mb-pop .8s ease both, mb-float 4s ease-in-out .8s infinite; }
@keyframes mb-float { 0%, 100% { transform: translate(0, 0) rotate(-8deg); } 50% { transform: translate(4%, -8%) rotate(8deg); } }

/* Pirate sur le pont qui tangue */
.mb-sway img { animation: mb-pop .7s cubic-bezier(.3, 1.6, .5, 1) both, mb-sway 2.4s ease-in-out .7s infinite; }
@keyframes mb-sway { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg) translateY(-2%); } }

/* Petits effets */
.mb-fx { position: absolute; inset: 0; pointer-events: none; }
.mb-sparkles span, .mb-stars span { position: absolute; color: #fff7c2; font-size: calc(var(--u) * 4); text-shadow: 0 0 8px #ffe680; animation: twinkle 1.6s ease-in-out infinite; }
.mb-stars span { font-size: calc(var(--u) * 2.8); }
.mb-dust span { position: absolute; bottom: 10%; left: 50%; width: 14%; aspect-ratio: 1; border-radius: 50%; background: rgba(230, 196, 150, .75);
  animation: mb-dust 1.2s ease-out infinite; animation-delay: calc(var(--i) * .3s); }
@keyframes mb-dust { from { transform: translateX(-140%) scale(.4); opacity: .9; } to { transform: translateX(-380%) scale(1.4); opacity: 0; } }
.mb-speed span { position: absolute; left: 100%; width: 30%; height: 1.4%; border-radius: 9px; background: rgba(255, 255, 255, .75); top: calc(20% + var(--i) * 13%);
  animation: mb-speed .7s linear infinite; animation-delay: calc(var(--i) * -.16s); }
@keyframes mb-speed { to { transform: translateX(-480%); } }
.mb-leaves span { position: absolute; top: -10%; left: calc(12% + var(--i) * 22%); font-size: calc(var(--u) * 4); animation: mb-leaf 3.4s linear infinite; animation-delay: calc(var(--i) * -.85s); }
@keyframes mb-leaf { 0% { transform: translate(0, 0) rotate(0); opacity: 0; } 10% { opacity: 1; } 100% { transform: translate(-30px, 120%) rotate(320deg); opacity: 0; } }
.mb-waves i { position: absolute; left: -50%; right: -50%; bottom: -4%; height: 16%; border-radius: 40% 40% 0 0;
  background: radial-gradient(circle at 25% 0, transparent 34%, rgba(77, 163, 255, .9) 35%) 0 0 / 22% 100% repeat-x; animation: mb-wave 2.2s linear infinite; }
.mb-waves i + i { bottom: -8%; opacity: .8; animation-duration: 3.1s; animation-direction: reverse; filter: hue-rotate(-12deg); }
@keyframes mb-wave { to { transform: translateX(22%); } }

@media (prefers-reduced-motion: reduce) {
  .mb-scene *, .mb-scene { animation-duration: .01s !important; animation-iteration-count: 1 !important; }
}
