* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  overflow: hidden;
}

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

#loading-bg {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--initial-loader-bg, #0a0a12);
  overflow: hidden;
  z-index: 9999;
}

/* ── Animated gradient background ── */
.loader-bg-gradient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% 50%, rgba(255, 82, 82, 0.08) 0%, transparent 70%),
    radial-gradient(ellipse 60% 80% at 20% 80%, rgba(115, 103, 240, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 80% at 80% 20%, rgba(255, 82, 82, 0.04) 0%, transparent 60%);
  animation: bgPulse 4s ease-in-out infinite;
}

@keyframes bgPulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ── Floating particles ── */
.particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: rgba(255, 82, 82, 0.6);
  border-radius: 50%;
  animation: floatUp linear infinite;
  box-shadow: 0 0 6px rgba(255, 82, 82, 0.3);
}

.particle:nth-child(1)  { left: 10%; animation-duration: 6s; animation-delay: 0s;   width: 2px; height: 2px; }
.particle:nth-child(2)  { left: 20%; animation-duration: 8s; animation-delay: 1s;   width: 4px; height: 4px; }
.particle:nth-child(3)  { left: 30%; animation-duration: 7s; animation-delay: 0.5s; width: 2px; height: 2px; }
.particle:nth-child(4)  { left: 40%; animation-duration: 9s; animation-delay: 2s;   width: 3px; height: 3px; }
.particle:nth-child(5)  { left: 50%; animation-duration: 6s; animation-delay: 1.5s; width: 2px; height: 2px; }
.particle:nth-child(6)  { left: 60%; animation-duration: 8s; animation-delay: 0.8s; width: 4px; height: 4px; }
.particle:nth-child(7)  { left: 70%; animation-duration: 7s; animation-delay: 2.5s; width: 2px; height: 2px; }
.particle:nth-child(8)  { left: 80%; animation-duration: 9s; animation-delay: 0.3s; width: 3px; height: 3px; }
.particle:nth-child(9)  { left: 15%; animation-duration: 10s; animation-delay: 1.2s; width: 2px; height: 2px; background: rgba(115, 103, 240, 0.5); box-shadow: 0 0 6px rgba(115, 103, 240, 0.3); }
.particle:nth-child(10) { left: 55%; animation-duration: 7s; animation-delay: 3s;   width: 2px; height: 2px; background: rgba(115, 103, 240, 0.5); box-shadow: 0 0 6px rgba(115, 103, 240, 0.3); }
.particle:nth-child(11) { left: 85%; animation-duration: 8s; animation-delay: 0.7s; width: 3px; height: 3px; background: rgba(115, 103, 240, 0.5); box-shadow: 0 0 6px rgba(115, 103, 240, 0.3); }
.particle:nth-child(12) { left: 35%; animation-duration: 11s; animation-delay: 1.8s; width: 2px; height: 2px; background: rgba(255, 255, 255, 0.2); }

@keyframes floatUp {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
    transform: translateY(90vh) scale(1);
  }
  90% {
    opacity: 0.8;
  }
  100% {
    transform: translateY(-10vh) scale(0.5);
    opacity: 0;
  }
}

/* ── Logo container ── */
.loader-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  z-index: 2;
}

/* ── Glow ring around logo ── */
.logo-ring {
  position: relative;
  width: 160px;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-ring::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: 2px;
  background: conic-gradient(
    from 0deg,
    transparent 0%,
    #FF5252 25%,
    transparent 50%,
    #7367F0 75%,
    transparent 100%
  );
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: ringRotate 3s linear infinite;
}

.logo-ring::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  background: conic-gradient(
    from 180deg,
    transparent 0%,
    rgba(255, 82, 82, 0.15) 25%,
    transparent 50%,
    rgba(115, 103, 240, 0.1) 75%,
    transparent 100%
  );
  filter: blur(12px);
  animation: ringRotate 3s linear infinite;
}

@keyframes ringRotate {
  to { transform: rotate(1turn); }
}

/* ── Logo image ── */
.loader-img {
  width: 90px;
  height: auto;
  animation: logoPulse 2s ease-in-out infinite;
  filter: drop-shadow(0 0 20px rgba(255, 82, 82, 0.3));
  position: relative;
  z-index: 1;
}

@keyframes logoPulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 20px rgba(255, 82, 82, 0.3));
  }
  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 35px rgba(255, 82, 82, 0.5));
  }
}

/* ── Brand name ── */
.loader-brand {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  background: linear-gradient(135deg, #ffffff 0%, #FF5252 50%, #7367F0 100%);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: textShimmer 3s ease-in-out infinite;
}

@keyframes textShimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* ── Progress bar ── */
.loader-progress-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  width: 220px;
}

.loader-progress-track {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.loader-progress-bar {
  height: 100%;
  width: 40%;
  border-radius: 4px;
  background: linear-gradient(90deg, #FF5252, #7367F0, #FF5252);
  background-size: 200% 100%;
  animation: progressSlide 2s ease-in-out infinite, progressShimmer 2s linear infinite;
  box-shadow: 0 0 12px rgba(255, 82, 82, 0.4);
}

@keyframes progressSlide {
  0%   { transform: translateX(-100%); }
  50%  { transform: translateX(300%); }
  100% { transform: translateX(-100%); }
}

@keyframes progressShimmer {
  0%   { background-position: 0% 0; }
  100% { background-position: 200% 0; }
}

/* ── Loading text with dot animation ── */
.loader-status {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}

.loader-dots {
  display: inline-flex;
  gap: 2px;
}

.loader-dots span {
  animation: dotFade 1.4s ease-in-out infinite;
}

.loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotFade {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* ── Aperture shutter decoration (top-right) ── */
.aperture-deco {
  position: absolute;
  top: 10%;
  right: 8%;
  width: 60px;
  height: 60px;
  opacity: 0.04;
  animation: apertureSpin 20s linear infinite;
}

@keyframes apertureSpin {
  to { transform: rotate(1turn); }
}

/* ── Subtle scanline overlay ── */
.scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.008) 2px,
    rgba(255, 255, 255, 0.008) 4px
  );
  pointer-events: none;
  z-index: 1;
}
