.night-loader {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  min-height: 100dvh;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  isolation: isolate;
  color: #f5f3ff;
  background:
    radial-gradient(circle at 50% 44%, rgba(121, 82, 255, 0.16), transparent 28%),
    radial-gradient(circle at 50% 50%, #111022 0%, #08080f 45%, #050509 100%);
  font-family: "Manrope", system-ui, sans-serif;
  text-align: center;
}

.night-loader::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: min(620px, 82vw);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(116, 80, 255, 0.13), transparent 66%);
  animation: night-loader-breathe 2.8s ease-in-out infinite;
}

.night-loader::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.22;
  background-image:
    linear-gradient(rgba(132, 101, 255, 0.075) 1px, transparent 1px),
    linear-gradient(90deg, rgba(132, 101, 255, 0.075) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: radial-gradient(circle at center, black, transparent 68%);
}

.night-loader-grid {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(115deg, transparent 28%, rgba(123, 91, 255, 0.055) 50%, transparent 72%);
  animation: night-loader-scan 4.5s linear infinite;
}

.night-loader-core {
  position: relative;
  display: grid;
  width: 154px;
  height: 154px;
  place-items: center;
  margin-bottom: 5px;
}

.night-loader-core::before {
  content: "";
  position: absolute;
  inset: 27px;
  border: 1px solid rgba(164, 139, 255, 0.21);
  border-radius: 34px;
  background: linear-gradient(145deg, rgba(126, 88, 255, 0.16), rgba(5, 5, 11, 0.74));
  box-shadow:
    inset 0 0 32px rgba(126, 88, 255, 0.08),
    0 18px 70px rgba(72, 40, 180, 0.28);
  transform: rotate(45deg);
}

.night-loader-core img {
  position: relative;
  z-index: 2;
  display: block;
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(255, 255, 255, 0.16));
  animation: night-loader-logo 2.4s ease-in-out infinite;
}

.night-loader-ring {
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(141, 111, 255, 0.16);
  border-top-color: #9c7cff;
  border-right-color: rgba(96, 195, 255, 0.78);
  border-radius: 50%;
  animation: night-loader-spin 2.6s linear infinite;
}

.night-loader-ring::before,
.night-loader-ring::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #b49cff;
  box-shadow: 0 0 14px #8f6dff;
}

.night-loader-ring::before {
  top: 13px;
  right: 17px;
}

.night-loader-ring::after {
  bottom: 13px;
  left: 17px;
}

.night-loader-ring-two {
  inset: 21px;
  border-top-color: rgba(111, 209, 255, 0.76);
  border-right-color: transparent;
  border-bottom-color: #7655ff;
  animation-duration: 1.9s;
  animation-direction: reverse;
}

.night-loader > strong {
  font-family: "JetBrains Mono", monospace;
  font-size: clamp(15px, 2vw, 19px);
  font-weight: 800;
  letter-spacing: 0.18em;
  text-shadow: 0 0 26px rgba(151, 118, 255, 0.34);
}

.night-loader-status {
  min-height: 21px;
  color: rgba(224, 220, 242, 0.62);
  font: 600 11px/1.5 "JetBrains Mono", monospace;
  letter-spacing: 0.04em;
}

.night-loader-status i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 5px;
  border-radius: 50%;
  background: #76f3ba;
  box-shadow: 0 0 12px rgba(118, 243, 186, 0.9);
  animation: night-loader-dot 1.15s ease-in-out infinite;
}

.night-loader-line {
  position: relative;
  width: min(260px, 62vw);
  height: 3px;
  margin-top: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
}

.night-loader-line i {
  position: absolute;
  inset-block: 0;
  left: -42%;
  width: 42%;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, #7655ff 28%, #8ecfff 72%, transparent);
  box-shadow: 0 0 18px rgba(118, 85, 255, 0.68);
  animation: night-loader-progress 1.35s ease-in-out infinite;
}

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

@keyframes night-loader-logo {
  0%, 100% { transform: scale(0.96); opacity: 0.82; }
  50% { transform: scale(1.04); opacity: 1; }
}

@keyframes night-loader-breathe {
  0%, 100% { transform: scale(0.92); opacity: 0.72; }
  50% { transform: scale(1.08); opacity: 1; }
}

@keyframes night-loader-dot {
  0%, 100% { transform: scale(0.72); opacity: 0.55; }
  50% { transform: scale(1.12); opacity: 1; }
}

@keyframes night-loader-progress {
  0% { left: -42%; }
  55%, 100% { left: 100%; }
}

@keyframes night-loader-scan {
  from { transform: translateX(-35%); }
  to { transform: translateX(35%); }
}

@media (max-width: 560px) {
  .night-loader {
    gap: 13px;
  }

  .night-loader-core {
    width: 132px;
    height: 132px;
  }

  .night-loader-core img {
    width: 74px;
    height: 74px;
  }

  .night-loader > strong {
    font-size: 14px;
    letter-spacing: 0.13em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .night-loader *,
  .night-loader::before,
  .night-loader-grid {
    animation-duration: 8s !important;
  }
}
