/* ── Launch splash (all viewports) ── */

html.mobile-splash-active body {
  overflow: hidden;
}

/* Never show app beside launch splash (returning session used to peek through) */
html.mobile-splash-active #app-shell {
  display: none !important;
}

html.mobile-splash-skip .mobile-splash {
  display: none !important;
}

.mobile-splash {
  --ms-navy: #1E3A8A;
  --ms-blue: #2563EB;
  --ms-gold: #FBBF24;
  --ms-gold-soft: #FDE68A;
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
  background: linear-gradient(155deg, #0f172a 0%, var(--ms-navy) 38%, #1d4ed8 100%);
  opacity: 1;
  visibility: visible;
  transition: opacity 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              visibility 0.55s;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0)
           env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.mobile-splash.is-exiting {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.mobile-splash.is-exiting .ms-content {
  transform: scale(1.06);
  opacity: 0;
}

/* Animated ambient background */
.ms-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ms-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.55;
  will-change: transform;
}

.ms-orb--1 {
  width: 280px;
  height: 280px;
  top: -8%;
  left: -18%;
  background: radial-gradient(circle, rgba(37, 99, 235, 0.95) 0%, transparent 70%);
  animation: ms-orb-drift-1 7s ease-in-out infinite alternate;
}

.ms-orb--2 {
  width: 220px;
  height: 220px;
  bottom: 8%;
  right: -12%;
  background: radial-gradient(circle, rgba(251, 191, 36, 0.75) 0%, transparent 68%);
  animation: ms-orb-drift-2 6s ease-in-out infinite alternate;
}

.ms-orb--3 {
  width: 180px;
  height: 180px;
  top: 42%;
  left: 58%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.7) 0%, transparent 70%);
  animation: ms-orb-drift-3 8s ease-in-out infinite alternate;
}

.ms-grid {
  position: absolute;
  inset: 0;
  opacity: 0.14;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(ellipse 85% 70% at 50% 45%, black 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 85% 70% at 50% 45%, black 20%, transparent 78%);
  animation: ms-grid-pulse 4s ease-in-out infinite;
}

.ms-shine {
  position: absolute;
  inset: -40%;
  background: linear-gradient(
    115deg,
    transparent 42%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 58%
  );
  transform: translateX(-120%) rotate(12deg);
  animation: ms-shine-sweep 2.8s ease-in-out 0.35s forwards;
}

/* Main content */
.ms-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 0 28px;
  transition: transform 0.55s cubic-bezier(0.4, 0, 0.2, 1),
              opacity 0.45s ease;
}

.ms-logo-wrap {
  position: relative;
  width: 108px;
  height: 108px;
  margin-bottom: 28px;
  animation: ms-logo-enter 0.85s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.ms-logo-ring {
  position: absolute;
  inset: -6px;
  border-radius: 28px;
  border: 2px solid rgba(251, 191, 36, 0.35);
  animation: ms-ring-pulse 2.2s ease-in-out 0.5s infinite;
}

.ms-logo-ring::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  animation: ms-ring-pulse 2.2s ease-in-out 0.85s infinite reverse;
}

.ms-logo {
  position: relative;
  width: 108px;
  height: 108px;
  border-radius: 24px;
  display: block;
  overflow: hidden;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

.ms-logo .brand-logo {
  width: 108px;
  height: 108px;
  display: block;
  border-radius: 24px;
  object-fit: fill;
}

.ms-ball {
  display: none;
}

.ms-brand {
  margin: 0;
  font-size: clamp(2rem, 9vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: #fff;
  animation: ms-brand-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.25s both;
}

.ms-brand-dink {
  display: inline-block;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
}

.ms-brand-plus {
  display: inline-block;
  background: linear-gradient(90deg, var(--ms-gold-soft), var(--ms-gold), #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: ms-plus-shimmer 2.4s ease-in-out 0.9s infinite;
}

.ms-tagline {
  margin: 12px 0 0;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.62);
  animation: ms-tagline-rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) 0.45s both;
}

.ms-loader {
  position: absolute;
  bottom: calc(36px + env(safe-area-inset-bottom, 0));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 8px;
  z-index: 2;
  animation: ms-loader-in 0.5s ease 0.7s both;
}

.ms-loader span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  animation: ms-dot-bounce 1.1s ease-in-out infinite;
}

.ms-loader span:nth-child(2) { animation-delay: 0.15s; }
.ms-loader span:nth-child(3) { animation-delay: 0.3s; }

/* Keyframes */
@keyframes ms-orb-drift-1 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(36px, 28px) scale(1.12); }
}

@keyframes ms-orb-drift-2 {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-28px, -22px) scale(1.08); }
}

@keyframes ms-orb-drift-3 {
  from { transform: translate(0, 0) scale(0.95); }
  to   { transform: translate(-18px, 24px) scale(1.1); }
}

@keyframes ms-grid-pulse {
  0%, 100% { opacity: 0.1; }
  50%      { opacity: 0.18; }
}

@keyframes ms-shine-sweep {
  to { transform: translateX(120%) rotate(12deg); }
}

@keyframes ms-logo-enter {
  from {
    opacity: 0;
    transform: scale(0.55) translateY(24px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes ms-ring-pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.55;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

@keyframes ms-ball-orbit {
  0%   { transform: rotate(0deg) translateX(46px) rotate(0deg); }
  50%  { transform: rotate(180deg) translateX(46px) rotate(-180deg); }
  100% { transform: rotate(360deg) translateX(46px) rotate(-360deg); }
}

@keyframes ms-brand-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ms-plus-shimmer {
  0%, 100% { filter: brightness(1); }
  50%      { filter: brightness(1.25); }
}

@keyframes ms-tagline-rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes ms-loader-in {
  from { opacity: 0; transform: translateX(-50%) translateY(8px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes ms-dot-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-7px);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mobile-splash *,
  .mobile-splash *::before,
  .mobile-splash *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
  }

  .ms-ball { display: none; }
}
