/* Full-screen loader that covers the main area only, so the sidebar stays visible */
.loader {
  position: fixed;
  inset: 0 0 0 var(--sidebar-w);
  background: var(--navy);
  z-index: 100;
  display: grid;
  place-items: center;
  opacity: 1;
  visibility: visible;
  transition: opacity .5s ease, visibility 0s linear 0s;
}
.loader.hide {
  opacity: 0;
  visibility: hidden;
  transition: opacity .5s ease, visibility 0s linear .5s;
}

.loader > .tag-body     { top: 24px; left: 48px; }
.loader > .tag-body-end { bottom: 40px; left: 48px; }
.loader > .tag-html-end { bottom: 14px; left: 28px; }

/* Pac-Man + dots */
.pacman-track {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pacman {
  position: relative;
  width: 50px;
  height: 50px;
  flex: none;
}
.pacman::before,
.pacman::after {
  content: "";
  position: absolute;
  left: 0;
  width: 50px;
  height: 25px;
  background: var(--yellow);
}
.pacman::before {
  top: 0;
  border-radius: 50px 50px 0 0;
  transform-origin: 50% 100%;
  animation: chomp-up .35s ease-in-out infinite alternate;
}
.pacman::after {
  bottom: 0;
  border-radius: 0 0 50px 50px;
  transform-origin: 50% 0;
  animation: chomp-down .35s ease-in-out infinite alternate;
}

@keyframes chomp-up   { from { transform: rotate(0); } to { transform: rotate(-38deg); } }
@keyframes chomp-down { from { transform: rotate(0); } to { transform: rotate(38deg); } }

/* The dots slide left and are clipped at the container edge, right at Pac-Man's mouth */
.dots {
  display: flex;
  gap: 40px;
  width: 190px;
  overflow: hidden;
}
.dots i {
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--yellow);
  animation: eat 1s linear infinite;
}

/* Each dot moves one slot (10px dot + 40px gap) per cycle */
@keyframes eat { to { transform: translateX(-50px); } }

@media (max-width: 860px) {
  .loader { bottom: 56px; }
  .loader > .tag-body-end, .loader > .tag-html-end { display: none; }
  .loader > .tag-body { left: 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .pacman::before, .pacman::after, .dots i { animation: none; }
  .loader, .loader.hide { transition: none; }
}