/* ── LOADER ──────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@900&display=swap');

#loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #07071a;
  transition: opacity 0.8s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.8s;
  overflow: hidden;
}

#loader.loader-out {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#loader::after {
  content: '';
  position: absolute;
  width: 600px;
  height: 300px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(ellipse, rgba(60,35,140,0.45) 0%, transparent 70%);
  animation: loader-glow 3.5s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes loader-glow {
  from { opacity: 0.5; transform: translate(-50%, -50%) scale(0.95); }
  to   { opacity: 1;   transform: translate(-50%, -50%) scale(1.1);  }
}

#loader-inner {
  position: relative;
  z-index: 1;
  display: inline-flex;
  flex-direction: column;
  align-items: stretch;
  gap: 20px;
}

#loader-title {
  font-family: 'Orbitron', monospace;
  font-weight: 900;
  font-size: clamp(38px, 9vw, 62px);
  letter-spacing: 0.32em;
  text-indent: 0.32em;
  color: transparent;
  background: linear-gradient(160deg,
    #8060d8  0%,
    #d8c8ff 45%,
    #a078e8 100%
  );
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 32px rgba(140,100,255,0.5));
  animation: loader-title-in 1s cubic-bezier(0.22, 1, 0.36, 1) both;
  white-space: nowrap;
}

@keyframes loader-title-in {
  from {
    opacity: 0;
    letter-spacing: 0.7em;
    filter: blur(14px) drop-shadow(0 0 0 transparent);
  }
  to {
    opacity: 1;
    letter-spacing: 0.32em;
    filter: blur(0) drop-shadow(0 0 32px rgba(140,100,255,0.5));
  }
}

#loader-bar-track {
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.05);
  border-radius: 99px;
  position: relative;
  animation: loader-bar-in 0.6s 0.35s ease both;
  opacity: 0;
}

@keyframes loader-bar-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

#loader-bar-track::before {
  content: '';
  position: absolute;
  inset: -5px;
  border-radius: 99px;
  background: rgba(80,45,180,0.07);
  filter: blur(6px);
}

#loader-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(90deg,
    rgba(60,35,150,0.8)   0%,
    rgba(110,70,240,1)   40%,
    rgba(175,130,255,1)  75%,
    rgba(230,210,255,1) 100%
  );
  box-shadow:
    0 0 10px rgba(145,95,255,0.8),
    0 0 28px rgba(110,70,240,0.4),
    0 0 2px  rgba(255,255,255,0.7);
}

#loader-bar-fill::before {
  content: '';
  position: absolute;
  right: -1px;
  top: -3px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 0 5px  rgba(220,200,255,1),
    0 0 14px rgba(160,120,255,0.95),
    0 0 28px rgba(120,80,240,0.7);
  animation: loader-dot 0.65s ease-in-out infinite alternate;
}

@keyframes loader-dot {
  from { opacity: 0.7; transform: scale(0.8); }
  to   { opacity: 1;   transform: scale(1.2); }
}

#loader-bar-shimmer {
  position: absolute;
  inset: 0;
  left: -100%;
  width: 60%;
  background: linear-gradient(90deg,
    transparent,
    rgba(255,255,255,0.45),
    transparent
  );
  animation: loader-shimmer 2s ease-in-out infinite;
}

@keyframes loader-shimmer {
  from { left: -100%; }
  to   { left:  160%; }
}