#preloader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  background: #f7f8fc;
  color: #0e1730;
  font-family: 'Manrope Variable', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  transition: opacity 0.6s ease, visibility 0.6s;
}

[data-theme='dark'] #preloader {
  background: #080c18;
  color: #eef1f8;
}

/* sekin suzuvchi rangli nurlar (aurora) */
.pl-aura {
  position: absolute;
  width: 560px;
  height: 560px;
  border-radius: 50%;
  opacity: 0.7;
  pointer-events: none;
}

.pl-aura.a1 {
  top: -300px;
  left: -260px;
  background: radial-gradient(circle, rgba(120, 150, 255, 0.55) 0%, rgba(120, 150, 255, 0) 65%);
  animation: pl-float 9s ease-in-out infinite alternate;
}

.pl-aura.a2 {
  bottom: -300px;
  right: -260px;
  background: radial-gradient(circle, rgba(178, 160, 255, 0.5) 0%, rgba(178, 160, 255, 0) 65%);
  animation: pl-float 11s ease-in-out infinite alternate-reverse;
}

[data-theme='dark'] .pl-aura {
  opacity: 0.4;
}

.pl-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* belgi */
.pl-mark {
  position: relative;
  width: 88px;
  height: 88px;
  margin-bottom: 40px;
  animation: pl-in 0.9s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* aylanuvchi nur halqasi — yuklanish ko'rsatkichi */
.pl-mark::before {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  padding: 2.5px;
  background: conic-gradient(from 0deg, rgba(79, 124, 255, 0) 0 55%, rgba(79, 124, 255, 0.35) 75%, #4f7cff 94%, #ffffff 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  animation: pl-fade 0.6s ease 0.5s both, pl-spin 1.2s linear infinite;
}

/* halqa izi */
.pl-mark::after {
  content: '';
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  border: 2.5px solid rgba(79, 124, 255, 0.1);
  animation: pl-fade 0.6s ease 0.5s both;
}

.pl-tile {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 28px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #5b86ff 0%, #2747d4 52%, #1b2b74 100%);
  box-shadow:
    0 18px 40px -12px rgba(39, 71, 212, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

/* yaltirash */
.pl-tile::after {
  content: '';
  position: absolute;
  top: -20%;
  bottom: -20%;
  width: 40%;
  left: -60%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: skewX(-20deg);
  animation: pl-shine 2.6s ease-in-out 1.1s infinite;
}

.pl-tile svg {
  width: 54px;
  height: 54px;
  overflow: visible;
}

.pl-book {
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: pl-draw 1.1s cubic-bezier(0.65, 0, 0.35, 1) 0.35s forwards;
}

.pl-spine {
  stroke-dasharray: 14;
  stroke-dashoffset: 14;
  animation: pl-draw 0.5s ease 1s forwards;
}

.pl-star {
  transform-origin: 18.6px 3.6px;
  animation: pl-star 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) 1.15s both;
}

/* nom: har so'z pastdan "ochiladi" */
.pl-title {
  margin: 0;
  max-width: 290px;
  font-size: 23px;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.02em;
}

.pl-title > span {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding-bottom: 2px;
}

.pl-title > span > span {
  display: inline-block;
  animation: pl-reveal 0.8s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pl-title > span:nth-child(1) > span { animation-delay: 0.55s; }
.pl-title > span:nth-child(2) > span { animation-delay: 0.63s; }
.pl-title > span:nth-child(3) > span { animation-delay: 0.71s; }
.pl-title > span:nth-child(4) > span { animation-delay: 0.79s; }

.pl-sub {
  margin: 12px 0 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #6a7491;
  animation: pl-track 1s cubic-bezier(0.16, 1, 0.3, 1) 1s both;
}

[data-theme='dark'] .pl-sub {
  color: #9aa3bd;
}

.pl-foot {
  position: absolute;
  bottom: calc(24px + env(safe-area-inset-bottom));
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #9098b0;
  animation: pl-fade 0.8s ease 1.3s both;
}

.pl-foot svg {
  width: 13px;
  height: 13px;
}

/* chiqish */
#preloader.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#preloader.done .pl-center {
  transform: scale(0.96);
  filter: blur(4px);
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1), filter 0.6s ease;
}

@keyframes pl-in {
  from { opacity: 0; transform: translateY(14px) scale(0.86); }
}

@keyframes pl-fade {
  from { opacity: 0; }
}

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

@keyframes pl-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes pl-star {
  from { opacity: 0; transform: scale(0) rotate(-90deg); }
}

@keyframes pl-shine {
  0% { left: -60%; }
  45%, 100% { left: 130%; }
}

@keyframes pl-reveal {
  from { transform: translateY(105%); opacity: 0; }
}

@keyframes pl-track {
  from { opacity: 0; letter-spacing: 0.3em; }
}

@keyframes pl-float {
  to { transform: translate(60px, 40px) scale(1.15); }
}

@media (prefers-reduced-motion: reduce) {
  #preloader *,
  #preloader *::before,
  #preloader *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
