/* Splash khi mở app. Khung đầu tiên (blob + Capy đứng yên) trùng ảnh apple-touch-startup-image
   do iOS hiện lúc khởi chạy (public/splash/*.png = ảnh chụp #splash khi tắt animation),
   nên chuyển sang animation không bị giật. Màu viết thẳng để file này tự đứng được. */
#splash {
  position: fixed; inset: 0; z-index: 100; overflow: hidden;
  background: #FBF6EC; color: #1B2340;
  font-family: "Baloo 2", "Nunito", system-ui, sans-serif;
  transition: opacity .4s ease, transform .4s ease;
}
#splash.out { opacity: 0; transform: scale(1.06); pointer-events: none; }

/* Sân khấu luôn nằm giữa màn hình — vị trí không phụ thuộc chữ bên dưới. */
.sp-stage { position: absolute; left: 50%; top: 50%; width: 220px; height: 220px; margin: -150px 0 0 -110px; }
.sp-blob {
  position: absolute; inset: 0; border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%;
  background: #2EC4A0; border: 3px solid #1B2340; box-shadow: 0 7px 0 #1B2340;
  animation: sp-morph 2.4s ease-in-out infinite;
}
.sp-capy { position: absolute; left: 35px; top: 40px; width: 150px; height: 143px; transform-origin: 50% 92%; animation: sp-hop .9s cubic-bezier(.3, 1.4, .5, 1) .12s 2; }

/* Xu bật tung từ sau lưng Capy rồi lơ lửng */
.sp-coin {
  position: absolute; left: 95px; top: 95px; width: 30px; height: 30px; border-radius: 50%;
  background: #FFD84D; border: 2.5px solid #1B2340; box-shadow: inset -3px -3px 0 #E8B400;
  transform: scale(0); animation: sp-pop .6s cubic-bezier(.3, 1.6, .5, 1) forwards, sp-float 2.2s ease-in-out infinite;
}
.sp-coin.c1 { --x: -108px; --y: -78px; animation-delay: .38s, 1s; }
.sp-coin.c2 { --x: 112px; --y: -52px; width: 24px; height: 24px; animation-delay: .46s, 1.1s; }
.sp-coin.c3 { --x: -96px; --y: 74px; width: 22px; height: 22px; animation-delay: .54s, 1.2s; }
.sp-coin.c4 { --x: 104px; --y: 86px; animation-delay: .62s, 1.3s; }

/* Tim nhỏ bay lên cạnh má */
.sp-heart { position: absolute; left: 160px; top: 52px; width: 22px; height: 22px; opacity: 0; color: #FF7A1A; animation: sp-heart 1.1s ease-out .7s forwards; }

.sp-text { position: absolute; left: 0; right: 0; top: calc(50% + 100px); text-align: center; }
.sp-title { margin: 0; font-size: 40px; font-weight: 800; letter-spacing: -.5px; opacity: 0; animation: sp-rise .6s cubic-bezier(.3, 1.4, .5, 1) .45s forwards; }
.sp-tag { margin: 2px 0 0; font: 700 15px "Nunito", system-ui, sans-serif; color: #B84E06; opacity: 0; animation: sp-rise .6s cubic-bezier(.3, 1.4, .5, 1) .6s forwards; }
.sp-dots { display: flex; justify-content: center; gap: 7px; margin-top: 22px; opacity: 0; animation: sp-fade .3s .8s forwards; }
.sp-dots i { width: 9px; height: 9px; border-radius: 50%; background: #1B2340; animation: sp-dot .9s ease-in-out infinite; }
.sp-dots i:nth-child(2) { animation-delay: .15s; background: #FF7A1A; }
.sp-dots i:nth-child(3) { animation-delay: .3s; background: #2EC4A0; }

@keyframes sp-hop {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  15% { transform: translateY(0) scale(1.1, .88); }      /* lấy đà */
  45% { transform: translateY(-34px) scale(.94, 1.08); }  /* bay lên */
  75% { transform: translateY(0) scale(1.12, .86); }      /* đáp, bẹp */
  88% { transform: translateY(0) scale(.97, 1.03); }
}
@keyframes sp-pop { to { transform: translate(var(--x), var(--y)) scale(1) rotate(20deg); } }
@keyframes sp-float { 50% { margin-top: -6px; } }
@keyframes sp-heart { 0% { opacity: 0; transform: translateY(10px) scale(.4); } 30% { opacity: 1; transform: translateY(0) scale(1.1); } 100% { opacity: 0; transform: translateY(-40px) scale(.9) rotate(15deg); } }
@keyframes sp-rise { from { opacity: 0; transform: translateY(14px) scale(.9); } to { opacity: 1; transform: none; } }
@keyframes sp-fade { to { opacity: 1; } }
@keyframes sp-dot { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-9px); } }
@keyframes sp-morph { 50% { border-radius: 58% 42% 45% 55% / 42% 56% 44% 58%; } }

@media (prefers-reduced-motion: reduce) {
  #splash *, #splash { animation: none !important; transition: opacity .3s !important; transform: none !important; }
  .sp-coin { display: none; }
  .sp-title, .sp-tag, .sp-dots { opacity: 1; }
}
