#loading-overlay {
  position: fixed;
  inset: 0;
  background: #111;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;

  opacity: 1;
  visibility: visible;
  pointer-events: all;

  transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0.45s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: opacity, visibility;
}

/* --- Dot Animation --- */
.dot-loader {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  animation: bounce 1.2s infinite cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform, opacity;
}

.dot.red {
  background: #ef4444;
  animation-delay: 0s;
}
.dot.green {
  background: #22c55e;
  animation-delay: 0.2s;
}
.dot.blue {
  background: #3b82f6;
  animation-delay: 0.4s;
}

@keyframes bounce {
  0%,
  80%,
  100% {
    transform: scale(0.5);
    opacity: 0.5;
  }
  40% {
    transform: scale(1.2);
    opacity: 1;
  }
}

/* --- When fading out --- */
#loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

#loading-overlay.hidden .dot {
  animation: fadeout-dot 0.45s forwards ease-in;
}

/* small detail: dots fade as overlay fades */
@keyframes fadeout-dot {
  to {
    transform: scale(0.8);
    opacity: 0;
  }
}
