/* PWA cold start splash — immagine 9:16 + logo ML originale */
html.pwa-standalone {
  background-color: #020a18;
}

.xg-pwa-splash {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #020a18;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.48s ease, visibility 0.48s ease;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
}

.xg-pwa-splash.is-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.xg-pwa-splash__bg {
  position: absolute;
  inset: 0;
  background-color: #020a18;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  transform: scale(1.02);
  transition: transform 0.48s ease;
}

.xg-pwa-splash.is-out .xg-pwa-splash__bg {
  transform: scale(1.04);
}

.xg-pwa-splash__inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.85rem, 3.5vw, 1.25rem);
  width: 100%;
  max-width: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 0.5rem) 1rem calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
  box-sizing: border-box;
}

.xg-pwa-splash__logo {
  display: block;
  width: clamp(12rem, 52vw, 22rem);
  max-width: 55vw;
  height: auto;
  object-fit: contain;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  opacity: 0;
  transform: scale(0.94);
  filter: drop-shadow(0 10px 28px rgba(2, 10, 24, 0.45));
}

.xg-pwa-splash.is-active .xg-pwa-splash__logo {
  animation: xgPwaSplashEnter 0.58s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.xg-pwa-splash__loader {
  display: block;
  width: min(7.5rem, 34vw);
  height: 3px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(2, 10, 24, 0.42);
  opacity: 0;
}

.xg-pwa-splash.is-active .xg-pwa-splash__loader {
  animation: xgPwaSplashLoaderIn 0.45s ease 0.12s forwards;
}

.xg-pwa-splash__loader > span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #22d3ee, #34d399, #67e8f9);
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.45);
  transform: translateX(-130%);
  animation: xgPwaSplashLoaderMove 1.05s ease-in-out infinite;
}

@keyframes xgPwaSplashEnter {
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes xgPwaSplashLoaderIn {
  to { opacity: 1; }
}

@keyframes xgPwaSplashLoaderMove {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(320%); }
}

@media (prefers-reduced-motion: reduce) {
  .xg-pwa-splash,
  .xg-pwa-splash__bg {
    transition: none !important;
  }

  .xg-pwa-splash__logo,
  .xg-pwa-splash__loader,
  .xg-pwa-splash__loader > span {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
