.loader {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(238, 241, 246, 0.86);
  backdrop-filter: blur(10px);
  z-index: 999;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-card {
  width: min(340px, 88vw);
  padding: 24px;
  border-radius: 22px;
  border: 1px solid var(--stroke);
  border-top: 3px solid rgba(109, 94, 252, 0.6);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.96), rgba(235, 238, 248, 0.9));
  box-shadow: var(--shadow);
  text-align: center;
}

.loader-title {
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 14px;
}

.loader-stack {
  position: relative;
  height: 110px;
  width: min(220px, 70vw);
  margin: 0 auto 6px;
}

.stack-plate {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  border-radius: 10px;
  box-shadow: 0 8px 14px rgba(15, 23, 42, 0.18);
  animation: stack-lift 1.6s ease-in-out infinite;
}

.stack-plate.plate-1 {
  width: 170px;
  height: 16px;
  bottom: 6px;
  background: linear-gradient(135deg, #8a7cff, var(--accent));
}

.stack-plate.plate-2 {
  width: 150px;
  height: 14px;
  bottom: 26px;
  background: linear-gradient(135deg, #7be4d0, var(--accent-2));
  animation-delay: 0.1s;
}

.stack-plate.plate-3 {
  width: 130px;
  height: 12px;
  bottom: 44px;
  background: linear-gradient(135deg, #ffd79c, var(--accent-3));
  animation-delay: 0.2s;
}

.stack-plate.plate-4 {
  width: 110px;
  height: 10px;
  bottom: 60px;
  background: linear-gradient(135deg, #3c2d92, #6d5efc);
  animation-delay: 0.3s;
}

.stack-floor {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 180px;
  height: 6px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.12);
}

.loader-progress {
  display: inline-flex;
  gap: 6px;
  margin-top: 6px;
}

.loader-progress span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: dot-pulse 1s ease-in-out infinite;
}

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

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

.loader-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
}

@keyframes stack-lift {
  0%,
  100% {
    transform: translate(-50%, 4px);
  }
  50% {
    transform: translate(-50%, -6px);
  }
}

@keyframes dot-pulse {
  0%,
  100% {
    transform: scale(0.8);
    opacity: 0.5;
  }
  50% {
    transform: scale(1.2);
    opacity: 1;
  }
}
