:root {
  --boot-bg: #1d283a;
  --boot-fg: #f35d23;
}

#boot-splash {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: grid;
  place-items: center;
  background: var(--boot-bg);
  color: var(--boot-fg);
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

#boot-splash.boot-splash--done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-splash__stage {
  position: relative;
  display: grid;
  place-items: center;
  /* Keep under the native splash mark size so the handoff doesn't jump larger. */
  width: 168px;
  height: 168px;
}

.boot-splash__glow {
  position: absolute;
  inset: -24%;
  border-radius: 50%;
  background: radial-gradient(circle, rgb(243 93 35 / 0.32) 0%, transparent 70%);
  opacity: 0;
  will-change: transform, opacity;
}

.boot-splash__ring {
  position: absolute;
  inset: -9%;
  border-radius: 50%;
  border: 2px solid rgb(243 93 35 / 0.38);
  opacity: 0;
  will-change: transform, opacity;
}

/* Ambient motion only after the native → HTML handoff, so iOS doesn't flash/restart.
   Enabled from JS on native + mobile only (`boot-splash--live`). */
#boot-splash.boot-splash--live {
  background: var(--boot-bg);
}

#boot-splash.boot-splash--live .boot-splash__glow {
  opacity: 0.5;
  animation: boot-glow 2.8s ease-in-out infinite;
}

#boot-splash.boot-splash--live .boot-splash__ring {
  animation: boot-ring 3.2s ease-out infinite;
}

.boot-splash__mark {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
}

/* Desktop/static path: spinner under the mark while the app boots. */
.boot-splash__loader {
  position: absolute;
  top: calc(50% + 108px);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2.5px solid rgb(255 255 255 / 0.18);
  border-top-color: var(--boot-fg);
  animation: boot-loader-spin 0.75s linear infinite;
}

#boot-splash.boot-splash--live .boot-splash__loader {
  display: none;
}

.boot-splash__word {
  position: absolute;
  top: calc(50% + 108px);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.72);
  opacity: 0;
}

#boot-splash.boot-splash--live .boot-splash__word {
  animation: boot-word-in 0.7s ease 0.15s both;
}

@keyframes boot-word-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes boot-loader-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes boot-glow {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.95);
  }
  50% {
    opacity: 0.95;
    transform: scale(1.08);
  }
}

@keyframes boot-ring {
  0% {
    transform: scale(0.94);
    opacity: 0.72;
  }
  65% {
    transform: scale(1.28);
    opacity: 0;
  }
  100% {
    transform: scale(1.28);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  #boot-splash.boot-splash--live .boot-splash__glow,
  #boot-splash.boot-splash--live .boot-splash__ring,
  #boot-splash.boot-splash--live .boot-splash__word {
    animation: none !important;
  }

  .boot-splash__loader {
    animation: none;
    border-top-color: rgb(255 255 255 / 0.45);
  }

  #boot-splash.boot-splash--live .boot-splash__word {
    opacity: 1;
  }
}
