/* =============================================
   Splash Screen — Precision Minimal
   ============================================= */

#splash-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: #ffffff;
  transition:
    opacity 400ms cubic-bezier(0.4, 0, 0.2, 1),
    transform 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark #splash-screen {
  background: #0f172a;
}

/* --- Card --- */

#splash-screen .splash-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3rem;
  padding: 1.5rem;
  border-radius: 0.75rem;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  width: min(calc(100vw - 2rem), 24rem);
  min-height: 22rem;
  animation: splash-card-enter 700ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.dark #splash-screen .splash-card {
  background: oklch(0.18 0.006 286);
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* --- Logo --- */

#splash-screen .splash-logo {
  width: 64px;
  height: 64px;
  animation:
    splash-logo-enter 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 150ms both,
    splash-breathe 4s ease-in-out 900ms infinite;
}

#splash-screen .splash-logo-dark {
  display: none;
}

body.dark #splash-screen .splash-logo {
  display: none;
}

body.dark #splash-screen .splash-logo-dark {
  display: block;
  width: 64px;
  height: 64px;
  animation:
    splash-logo-enter 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 150ms both,
    splash-breathe 4s ease-in-out 900ms infinite;
}

/* --- Loading dots --- */

#splash-screen .spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

#splash-screen .spinner > div {
  width: 10px;
  height: 10px;
  background: linear-gradient(135deg, #1ed760, #34d87a);
  border-radius: 100%;
  will-change: transform, opacity;
  animation-name: splash-dot-enter, splash-dot-wave;
  animation-duration: 400ms, 1.6s;
  animation-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1), ease-in-out;
  animation-fill-mode: both, none;
  animation-iteration-count: 1, infinite;
}

body.dark #splash-screen .spinner > div {
  background: linear-gradient(135deg, #1ed760, #5aea8a);
}

#splash-screen .spinner .bounce1 {
  animation-delay: 500ms, 1000ms;
}

#splash-screen .spinner .bounce2 {
  animation-delay: 560ms, 1060ms;
}

#splash-screen .spinner .bounce3 {
  animation-delay: 620ms, 1120ms;
}

/* --- Keyframes — Entry --- */

@keyframes splash-card-enter {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes splash-logo-enter {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  65% {
    opacity: 1;
    transform: scale(1.08);
  }
  82% {
    transform: scale(0.97);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes splash-dot-enter {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0);
  }
  to {
    opacity: 0.55;
    transform: translateY(0) scale(1);
  }
}

/* --- Keyframes — Idle --- */

@keyframes splash-breathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes splash-dot-wave {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  50% {
    transform: translateY(-6px);
    opacity: 1;
  }
}

/* --- Reduced motion --- */

@media (prefers-reduced-motion: reduce) {
  #splash-screen,
  #splash-screen .splash-card,
  #splash-screen .splash-logo,
  #splash-screen .splash-logo-dark,
  #splash-screen .spinner > div {
    animation: none !important;
    transition-duration: 0.01ms !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
