.loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -10%, rgba(255, 255, 255, 0.22), transparent 36%),
    linear-gradient(180deg, #160a26 0%, #25103c 38%, #38205f 68%, #1c0e2e 100%);
  isolation: isolate;
}

.loader__nebula {
  position: absolute;
  border-radius: 50%;
  filter: blur(48px);
  opacity: 0.88;
  mix-blend-mode: screen;
  animation: nebulaDrift 16s ease-in-out infinite;
}

.loader__nebula--violet {
  top: -6%;
  left: -4%;
  width: 520px;
  height: 520px;
  background: radial-gradient(circle, rgba(120, 88, 231, 0.72) 0%, rgba(120, 88, 231, 0.08) 46%, transparent 72%);
}

.loader__nebula--rose {
  right: -8%;
  top: 14%;
  width: 440px;
  height: 440px;
  background: radial-gradient(circle, rgba(255, 162, 221, 0.56) 0%, rgba(255, 162, 221, 0.08) 48%, transparent 74%);
  animation-delay: -5s;
}

.loader__nebula--gold {
  left: 24%;
  bottom: -18%;
  width: 520px;
  height: 420px;
  background: radial-gradient(circle, rgba(238, 190, 98, 0.34) 0%, rgba(238, 190, 98, 0.06) 42%, transparent 72%);
  animation-delay: -9s;
}

.loader__vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 42%, transparent 0%, rgba(17, 7, 30, 0.08) 42%, rgba(12, 3, 20, 0.5) 100%);
}

.loader__starfield {
  position: absolute;
  inset: -20%;
  background-repeat: repeat;
  pointer-events: none;
}

.loader__starfield--far {
  opacity: 0.38;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.88) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(211, 194, 255, 0.66) 0 1px, transparent 1.8px);
  background-size: 180px 180px, 240px 240px;
  background-position: 0 0, 60px 100px;
  animation: starDriftFar 44s linear infinite;
}

.loader__starfield--mid {
  opacity: 0.56;
  background-image:
    radial-gradient(circle, rgba(255, 247, 232, 0.9) 0 1.3px, transparent 2px),
    radial-gradient(circle, rgba(193, 167, 255, 0.9) 0 1px, transparent 1.9px);
  background-size: 130px 130px, 190px 190px;
  background-position: 20px 30px, 90px 120px;
  animation: starDriftMid 28s linear infinite;
}

.loader__starfield--near {
  opacity: 0.72;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, 0.98) 0 1.6px, transparent 2.3px),
    radial-gradient(circle, rgba(255, 216, 165, 0.92) 0 1.2px, transparent 2px);
  background-size: 110px 110px, 170px 170px;
  background-position: 0 0, 55px 85px;
  animation: starDriftNear 18s linear infinite;
}

.loader__constellation {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.constellation-star {
  position: absolute;
  color: #fbe9ff;
  text-shadow:
    0 0 10px rgba(255, 240, 255, 0.65),
    0 0 28px rgba(184, 143, 255, 0.42);
  animation: constellationTwinkle 3.8s ease-in-out infinite;
}

.constellation-star--1 { top: 15%; left: 22%; font-size: 18px; animation-delay: 0s; }
.constellation-star--2 { top: 24%; right: 24%; font-size: 24px; animation-delay: .6s; }
.constellation-star--3 { top: 32%; left: 72%; font-size: 15px; animation-delay: 1.1s; }
.constellation-star--4 { bottom: 23%; left: 18%; font-size: 20px; animation-delay: 1.5s; }
.constellation-star--5 { bottom: 18%; right: 21%; font-size: 17px; animation-delay: 2s; }
.constellation-star--6 { top: 48%; left: 11%; font-size: 13px; animation-delay: 2.4s; }

.loader__scene {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(640px, calc(100% - 40px));
  text-align: center;
}

.loader__tableau {
  position: relative;
  width: 340px;
  height: 230px;
  margin-bottom: 26px;
  animation: tableauFloat 6s ease-in-out infinite;
}

.loader__aurora {
  position: absolute;
  top: 34px;
  width: 210px;
  height: 118px;
  border-radius: 999px;
  filter: blur(22px);
  opacity: 0.82;
  mix-blend-mode: screen;
}

.loader__aurora--violet {
  left: 24px;
  background: linear-gradient(90deg, rgba(148, 118, 248, 0.08) 0%, rgba(196, 160, 255, 0.6) 46%, rgba(255, 205, 233, 0.3) 100%);
  animation: auroraDrift 7s ease-in-out infinite;
}

.loader__aurora--peach {
  position: absolute;
  right: 18px;
  top: 56px;
  width: 190px;
  background: linear-gradient(90deg, rgba(255, 216, 179, 0.08) 0%, rgba(255, 212, 171, 0.42) 42%, rgba(255, 170, 218, 0.28) 100%);
  animation: auroraDrift 7s ease-in-out infinite -2.4s;
}

.loader__hanger {
  position: absolute;
  top: 0;
  width: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: hangerSwing 4.6s ease-in-out infinite;
}

.loader__hanger--left {
  left: 62px;
  animation-delay: -0.4s;
}

.loader__hanger--center {
  left: 142px;
}

.loader__hanger--right {
  right: 58px;
  animation-delay: -0.9s;
}

.loader__thread {
  position: absolute;
  top: 0;
  width: 1px;
  height: 72px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.32) 0%, rgba(215, 193, 255, 0.62) 100%);
}

.loader__charm {
  position: absolute;
  top: 62px;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 239, 255, 0.98) 100%);
  color: #fffdf7;
  font-size: 23px;
  box-shadow:
    0 0 18px rgba(255, 233, 195, 0.32),
    0 14px 28px rgba(26, 10, 45, 0.18);
}

.loader__charm--star {
  color: #d39aff;
}

.loader__charm--moon {
  color: #f6c56d;
  font-size: 25px;
}

.loader__charm--spark {
  color: #ffd8ec;
}

.loader__mist {
  position: absolute;
  bottom: 38px;
  height: 66px;
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 239, 255, 0.98) 72%, rgba(232, 214, 255, 0.96) 100%);
  box-shadow:
    inset 0 -10px 14px rgba(190, 166, 237, 0.22),
    0 18px 34px rgba(18, 7, 33, 0.2);
}

.loader__mist::before,
.loader__mist::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: inherit;
}

.loader__mist--left {
  left: 22px;
  width: 126px;
}

.loader__mist--left::before {
  width: 54px;
  height: 54px;
  left: 14px;
  top: -18px;
}

.loader__mist--left::after {
  width: 68px;
  height: 68px;
  right: 12px;
  top: -26px;
}

.loader__mist--center {
  left: 90px;
  bottom: 24px;
  width: 164px;
  z-index: 1;
}

.loader__mist--center::before {
  width: 82px;
  height: 82px;
  left: 16px;
  top: -34px;
}

.loader__mist--center::after {
  width: 72px;
  height: 72px;
  right: 18px;
  top: -24px;
}

.loader__mist--right {
  right: 18px;
  width: 118px;
}

.loader__mist--right::before {
  width: 54px;
  height: 54px;
  left: 10px;
  top: -18px;
}

.loader__mist--right::after {
  width: 48px;
  height: 48px;
  right: 12px;
  top: -12px;
}

.loader__dissolve {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.loader__dissolve-dot {
  position: absolute;
  opacity: 0;
}

.loader__dissolve-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 1;
}

.loader__dissolve-line {
  opacity: 0;
  stroke: rgba(255, 245, 226, 0.92);
  stroke-width: 2;
  stroke-linecap: round;
  filter: drop-shadow(0 0 10px rgba(255, 233, 202, 0.45));
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  vector-effect: non-scaling-stroke;
}

.loader__dissolve-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 248, 236, 0.96);
  box-shadow:
    0 0 16px rgba(255, 238, 206, 0.95),
    0 0 34px rgba(198, 166, 255, 0.55);
  transform: scale(0.4);
}

.loader__dissolve-dot--one { left: 50px; top: 58px; }
.loader__dissolve-dot--two { left: 155px; top: 35px; }
.loader__dissolve-dot--three { left: 285px; top: 75px; }
.loader__dissolve-dot--four { left: 82px; top: 150px; }
.loader__dissolve-dot--five { left: 190px; top: 132px; }
.loader__dissolve-dot--six { left: 292px; top: 188px; }
.loader__dissolve-dot--seven { left: 218px; top: 208px; }
.loader__dissolve-dot--eight { left: 36px; top: 200px; }

.loader__copy {
  max-width: 620px;
  padding: 0 18px;
}

.loader__eyebrow {
  margin-bottom: 10px;
  color: #b693ff;
  font-family: 'Outfit', sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.loader__title {
  max-width: 600px;
  margin: -4px auto 12px;
  padding: 6px 0 10px;
  color: #fff8fd;
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(36px, 4.8vw, 58px);
  line-height: 1.12;
  font-weight: 700;
  overflow: visible;
  text-wrap: balance;
  text-shadow: 0 8px 34px rgba(19, 7, 37, 0.52);
}

.loader__text {
  max-width: 500px;
  margin: 0 auto;
  color: rgba(240, 231, 255, 0.82);
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  line-height: 1.8;
  text-shadow: 0 4px 18px rgba(15, 5, 28, 0.28);
}

.loader__outro-text {
  max-width: 520px;
  margin: 0 auto;
  color: rgba(255, 248, 235, 0.96);
  font-family: 'Outfit', sans-serif;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.7;
  opacity: 0;
  transform: translateY(10px) scale(0.98);
  text-shadow: 0 2px 10px rgba(15, 5, 28, 0.24);
}

@keyframes nebulaDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(26px, -20px, 0) scale(1.08); }
}

@keyframes starDriftFar {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-120px, 80px, 0); }
}

@keyframes starDriftMid {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-180px, 120px, 0); }
}

@keyframes starDriftNear {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(-220px, 160px, 0); }
}

@keyframes constellationTwinkle {
  0%, 100% { opacity: 0.26; transform: translateY(0) scale(0.9); }
  50% { opacity: 1; transform: translateY(-8px) scale(1.16); }
}

@keyframes tableauFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes auroraDrift {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.78; }
  50% { transform: translate3d(10px, -8px, 0) scale(1.04); opacity: 1; }
}

@keyframes hangerSwing {
  0%, 100% { transform: rotate(-3deg); }
  50% { transform: rotate(3deg); }
}

@media (max-width: 640px) {
  .loader__scene {
    width: min(100%, calc(100% - 24px));
  }

  .loader__tableau {
    width: 250px;
    height: 182px;
    margin-bottom: 14px;
  }

  .loader__aurora {
    width: 150px;
    height: 90px;
  }

  .loader__hanger--left {
    left: 38px;
  }

  .loader__hanger--center {
    left: 104px;
  }

  .loader__hanger--right {
    right: 36px;
  }

  .loader__thread {
    height: 58px;
  }

  .loader__charm {
    top: 48px;
    width: 34px;
    height: 34px;
    font-size: 18px;
  }

  .loader__charm--moon {
    font-size: 20px;
  }

  .loader__mist {
    height: 52px;
  }

  .loader__mist--left {
    left: 12px;
    width: 90px;
  }

  .loader__mist--center {
    left: 62px;
    width: 122px;
    bottom: 18px;
  }

  .loader__mist--right {
    right: 12px;
    width: 84px;
  }

  .loader__dissolve-dot--one   { left: 35px;  top: 45px;  }
  .loader__dissolve-dot--two   { left: 113px; top: 27px;  }
  .loader__dissolve-dot--three { left: 208px; top: 58px;  }
  .loader__dissolve-dot--four  { left: 59px;  top: 118px; }
  .loader__dissolve-dot--five  { left: 138px; top: 103px; }
  .loader__dissolve-dot--six   { left: 213px; top: 148px; }
  .loader__dissolve-dot--seven { left: 159px; top: 164px; }
  .loader__dissolve-dot--eight { left: 25px;  top: 157px; }

  .loader__text {
    font-size: 15px;
    line-height: 1.6;
  }

  .loader__title {
    font-size: clamp(34px, 9vw, 48px);
    line-height: 1.1;
    padding-bottom: 8px;
  }
}
