/* The splash screen: shown from the page's own HTML the moment it opens, while the scripts, the look (config.xml) and
   the content load — so nobody sees a half-built page. js/core/Splash.js updates and hides it.
     .splash.game  the game: no product brand of its own (games are white-labelled); a pin drops onto a map grid, and
                   the game's logo from config.xml appears once the look has loaded. Colours follow the theme.
     .splash.tool  Craft and the configurators: the Gameficate logo and the tool's name.
   Shared by the game, Craft and both configurators (tools/sync-shared.mjs copies this file). */
.splash {
  position: fixed;
  inset: 0;
  z-index: 2147482000; /* above everything the app draws; below the crash screen and the old-browser notice */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 24px;
  overflow: hidden;
  text-align: center;
  font-family: 'Nunito', system-ui, sans-serif;
  color: #fff;
  background: radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.1), transparent 55%),
    linear-gradient(160deg, var(--hud-1, #214667), var(--hud-2, #17324d) 70%);
  transition:
    opacity 0.45s ease,
    visibility 0.45s;
}
.splash.out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.splash.gone {
  display: none;
}
.sp-status {
  min-height: 1.4em;
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.78);
}
/* An indeterminate progress line. */
.sp-bar {
  position: relative;
  width: min(260px, 60vw);
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
}
.sp-bar span {
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--orange, #ff7a3d), var(--gold, #ffc83d));
  animation: sp-slide 1.25s ease-in-out infinite;
}
@keyframes sp-slide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(260%);
  }
}

/* ---------- The game: a pin drops onto a map ---------- */
.splash.game .sp-scene {
  position: relative;
  width: 180px;
  height: 150px;
}
.sp-grid {
  position: absolute;
  inset: 34px 0 0;
  border-radius: 50%;
  background: radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.55) 1.6px, transparent 0) 0 0 / 14px 14px;
  -webkit-mask: radial-gradient(ellipse at 50% 60%, #000 30%, transparent 70%);
  mask: radial-gradient(ellipse at 50% 60%, #000 30%, transparent 70%);
  transform: perspective(300px) rotateX(58deg);
  animation: sp-fade 0.8s ease both;
}
.sp-pin {
  position: absolute;
  left: 50%;
  top: 26px;
  width: 46px;
  height: 46px;
  margin-left: -23px;
  border-radius: 50% 50% 50% 0;
  background: var(--orange, #ff7a3d);
  box-shadow: inset -6px -6px 0 rgba(0, 0, 0, 0.12);
  transform: rotate(-45deg);
  animation: sp-drop 2.4s cubic-bezier(0.3, 0.9, 0.4, 1) infinite;
}
.sp-pin::after {
  content: '';
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  background: #fff;
}
.sp-ring {
  position: absolute;
  left: 50%;
  top: 100px;
  width: 70px;
  height: 22px;
  margin-left: -35px;
  border: 3px solid var(--gold, #ffc83d);
  border-radius: 50%;
  opacity: 0;
  animation: sp-ripple 2.4s ease-out infinite;
}
.sp-ring.r2 {
  animation-delay: 0.25s;
}
@keyframes sp-drop {
  0% {
    transform: translateY(-70px) rotate(-45deg);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  32% {
    transform: translateY(0) rotate(-45deg);
  }
  40% {
    transform: translateY(-12px) rotate(-45deg);
  }
  48%,
  82% {
    transform: translateY(0) rotate(-45deg);
    opacity: 1;
  }
  100% {
    transform: translateY(0) rotate(-45deg);
    opacity: 0;
  }
}
@keyframes sp-ripple {
  0%,
  30% {
    transform: scale(0.3);
    opacity: 0;
  }
  34% {
    opacity: 0.9;
  }
  70%,
  100% {
    transform: scale(1.6);
    opacity: 0;
  }
}
@keyframes sp-fade {
  from {
    opacity: 0;
  }
}
/* The game's logo (config.xml), filled in by Splash.brand() once the look has loaded. */
.sp-brand:empty {
  display: none;
}
.sp-brand {
  animation: sp-up 0.5s ease both;
}
.sp-brand .game-logo {
  margin: 0 auto;
  color: #fff;
}
.sp-brand .game-logo .word {
  color: #fff;
}
.sp-brand .game-logo .word span {
  color: var(--gold, #ffc83d);
}
.sp-brand .game-logo.custom img {
  max-height: 84px;
  max-width: min(320px, 70vw);
}

/* ---------- Craft and the configurators: the Gameficate logo ---------- */
.splash.tool {
  background: radial-gradient(circle at 50% 36%, rgba(255, 122, 61, 0.22), transparent 52%),
    linear-gradient(160deg, #214667, #102a42 72%);
}
.sp-logo {
  width: 96px;
  height: 96px;
  filter: drop-shadow(0 14px 30px rgba(0, 0, 0, 0.35));
  animation: sp-pop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.sp-logo svg {
  display: block;
  width: 100%;
  height: 100%;
}
.sp-logo .sp-play {
  transform-box: fill-box;
  transform-origin: center;
  animation: sp-play 0.6s 0.35s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}
.sp-logo .sp-star {
  transform-box: fill-box;
  transform-origin: center;
  animation: sp-twinkle 2.2s 0.8s ease-in-out infinite;
}
.sp-word {
  font-family: 'Baloo 2', 'Nunito', sans-serif;
  font-size: 44px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  animation: sp-up 0.6s 0.2s ease both;
}
.sp-word span {
  color: #ffc83d;
}
.sp-app {
  margin: -4px 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.82);
  animation: sp-up 0.6s 0.32s ease both;
}
@keyframes sp-pop {
  from {
    transform: scale(0.4) rotate(-12deg);
    opacity: 0;
  }
}
@keyframes sp-play {
  from {
    transform: translateX(-8px) scale(0.4);
    opacity: 0;
  }
}
@keyframes sp-twinkle {
  0%,
  100% {
    transform: scale(1) rotate(0);
  }
  50% {
    transform: scale(1.35) rotate(45deg);
  }
}
@keyframes sp-up {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
}

/* Small screens */
@media (max-height: 460px) {
  .splash {
    gap: 8px;
  }
  .splash.game .sp-scene {
    transform: scale(0.75);
    margin: -20px 0;
  }
  .sp-logo {
    width: 72px;
    height: 72px;
  }
  .sp-word {
    font-size: 34px;
  }
}
/* Reduce motion (the device setting): everything stands still. */
@media (prefers-reduced-motion: reduce) {
  .splash *,
  .splash *::before,
  .splash *::after {
    animation: none !important;
  }
  .sp-bar span {
    width: 100%;
    opacity: 0.6;
  }
  .splash {
    transition: none;
  }
}
