/* Four-dot loading, skeletons and local overlays share the Isaac palette. */
.wa-loading-dots {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  color: var(--brand-action);
  transform: rotate(45deg);
  animation: wa-loading-rotate 1.2s linear infinite;
}
.wa-loading-dots i {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: currentColor;
  opacity: .3;
  animation: wa-loading-pulse 1s linear infinite alternate;
}
.wa-loading-dots i:nth-child(1) { top: 0; left: 0; }
.wa-loading-dots i:nth-child(2) { top: 0; right: 0; animation-delay: .4s; }
.wa-loading-dots i:nth-child(3) { bottom: 0; right: 0; animation-delay: .8s; }
.wa-loading-dots i:nth-child(4) { bottom: 0; left: 0; animation-delay: 1.2s; }
.wa-loading-page {
  position: relative;
  min-height: min(580px, 70vh);
  padding: 36px clamp(16px, 3vw, 42px);
  color: var(--brand-text-muted);
}
.wa-loading-placeholder {
  max-width: 1280px;
  margin: auto;
  opacity: 0;
  animation: wa-loading-appear .18s ease-out .05s forwards;
}
.wa-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--brand-surface-muted);
  border-radius: 7px;
}
.wa-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 20%, var(--brand-surface-soft) 50%, transparent 80%);
  transform: translateX(-100%);
  animation: wa-loading-shimmer 1.6s ease-in-out infinite;
}
.wa-skeleton-title { width: 28%; min-width: 140px; height: 28px; }
.wa-skeleton-subtitle { width: 45%; height: 13px; margin-top: 18px; }
.wa-skeleton-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 30px 0; }
.wa-skeleton-cards > div { height: 82px; opacity: .65; }
.wa-skeleton-table { display: grid; gap: 18px; padding: 22px; border: 1px solid var(--brand-border); border-radius: 12px; }
.wa-skeleton-table > div { height: 18px; opacity: .6; }
.wa-skeleton-table > div:nth-child(even) { width: 83%; }
.wa-loading-message, .wa-loading-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  font-size: 13px;
  color: var(--brand-text-secondary);
  opacity: 0;
  animation: wa-loading-appear .18s ease-out .05s forwards;
}
.wa-loading-message { padding: 28px 0; }
.wa-loading-scope { position: relative; }
.wa-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  min-height: 110px;
  border-radius: inherit;
  flex-direction: column;
  background: color-mix(in srgb, var(--brand-paper) 82%, transparent);
  cursor: progress;
}
.wa-loading-track {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  overflow: hidden;
  opacity: 0;
  animation: wa-loading-appear .18s ease-out .05s forwards;
}
.wa-loading-track::after {
  content: "";
  display: block;
  width: 35%;
  height: 100%;
  background: var(--brand-accent);
  animation: wa-loading-travel 1.4s ease-in-out infinite;
}
.bi-wait .wa-loading-dots { width: 22px; height: 22px; }
.bi-wait .wa-loading-dots i { width: 9px; height: 9px; }
.bi-wait-copy { display: grid; gap: 5px; }
.bi-wait-copy small { color: var(--brand-text-muted); font-size: 11px; }
.bi-answer-placeholder { max-width: 600px; display: grid; gap: 10px; margin: 0 0 20px; }
.bi-answer-placeholder .wa-skeleton { height: 10px; opacity: .5; }
.bi-answer-placeholder .wa-skeleton:last-child { width: 65%; }
.bi-plan .bi-step-dot.running { animation: wa-loading-pulse .9s ease-in-out infinite alternate; }
@keyframes wa-loading-rotate { to { transform: rotate(405deg); } }
@keyframes wa-loading-pulse { to { opacity: 1; } }
@keyframes wa-loading-appear { to { opacity: 1; } }
@keyframes wa-loading-shimmer { to { transform: translateX(100%); } }
@keyframes wa-loading-travel { from { transform: translateX(-100%); } to { transform: translateX(385%); } }
@media (max-width: 600px) {
  .wa-skeleton-cards { gap: 10px; margin: 24px 0; }
  .wa-skeleton-cards > div { height: 64px; }
  .wa-loading-page { padding-top: 26px; }
}
@media (prefers-reduced-motion: reduce) {
  .wa-loading-dots, .wa-loading-dots i, .wa-skeleton::after,
  .wa-loading-placeholder, .wa-loading-message, .wa-loading-overlay,
  .wa-loading-track, .wa-loading-track::after, .bi-plan .bi-step-dot.running {
    animation: none;
  }
  .wa-loading-placeholder, .wa-loading-message, .wa-loading-overlay, .wa-loading-track, .wa-loading-dots i { opacity: 1; }
  .wa-skeleton::after { display: none; }
  .wa-loading-track::after { width: 100%; opacity: .4; }
}
