.halo-iq-loader {
  --halo-iq-accent: #655dc6;
  --halo-iq-bright: #a78bfa;
  --halo-iq-ink: #f0f4fa;
  --halo-iq-muted: #94a3b8;
  --halo-iq-line: #2a3348;
  --halo-iq-surface: #151a28;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--halo-iq-ink);
  font-family: inherit;
  text-align: center;
}

.halo-iq-loader[data-tone='light'] {
  --halo-iq-ink: #18263d;
  --halo-iq-muted: #617087;
  --halo-iq-line: #dce8ee;
  --halo-iq-surface: #fff;
}

.halo-iq-loader__scene {
  width: 230px;
  height: 230px;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.halo-iq-loader__halo {
  position: absolute;
  inset: 40px;
  border: 1px solid var(--halo-iq-line);
  border-radius: 50%;
}

.halo-iq-loader__halo::after {
  content: '';
  position: absolute;
  inset: 18px;
  border: 1px solid var(--halo-iq-line);
  border-radius: 50%;
}

.halo-iq-loader__orbit {
  position: absolute;
  inset: 15px;
  border-radius: 50%;
  border: 1px solid var(--halo-iq-line);
  animation: halo-iq-orbit 9s linear infinite;
}

.halo-iq-loader__orbit::before {
  content: '';
  position: absolute;
  left: 50%;
  top: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--halo-iq-bright);
  box-shadow: 0 0 14px rgba(167, 139, 250, 0.5);
}

.halo-iq-loader__arc {
  position: absolute;
  inset: 26px;
  border: 2px solid transparent;
  border-top-color: var(--halo-iq-accent);
  border-right-color: var(--halo-iq-bright);
  border-radius: 50%;
  transform: rotate(-35deg);
  animation: halo-iq-orbit 3.4s linear infinite;
}

.halo-iq-loader__core {
  width: 78px;
  height: 90px;
  border-radius: 10px 16px 16px 10px;
  background: var(--halo-iq-surface);
  border: 1px solid var(--halo-iq-line);
  box-shadow: 0 12px 30px rgba(4, 11, 33, 0.25);
  position: relative;
  display: grid;
  place-items: center;
  transform: rotate(-7deg);
}

.halo-iq-loader__core::before {
  content: '';
  position: absolute;
  left: 5px;
  top: 0;
  bottom: 0;
  border-left: 2px solid var(--halo-iq-accent);
  opacity: 0.7;
}

.halo-iq-loader__mark {
  font-size: 30px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -2px;
  color: var(--halo-iq-accent);
  transform: rotate(7deg);
  font-family: 'Sora', system-ui, sans-serif;
}

.halo-iq-loader__core::after {
  content: '';
  position: absolute;
  bottom: 14px;
  width: 25px;
  height: 2px;
  background: var(--halo-iq-bright);
}

.halo-iq-loader__satellite {
  position: absolute;
  inset: 0;
  animation: halo-iq-orbit 10s linear infinite;
}

.halo-iq-loader__satellite:nth-of-type(2) {
  animation-delay: -3.33s;
}

.halo-iq-loader__satellite:nth-of-type(3) {
  animation-delay: -6.66s;
}

.halo-iq-loader__page {
  position: absolute;
  left: calc(50% - 12px);
  top: 3px;
  width: 24px;
  height: 31px;
  border: 1px solid var(--halo-iq-line);
  border-radius: 4px;
  background: var(--halo-iq-surface);
  box-shadow: 0 2px 8px rgba(6, 27, 48, 0.06);
  animation: halo-iq-counter 10s linear infinite;
}

.halo-iq-loader__satellite:nth-of-type(2) .halo-iq-loader__page {
  animation-delay: -3.33s;
}

.halo-iq-loader__satellite:nth-of-type(3) .halo-iq-loader__page {
  animation-delay: -6.66s;
}

.halo-iq-loader__page::before,
.halo-iq-loader__page::after {
  content: '';
  position: absolute;
  left: 5px;
  right: 5px;
  height: 2px;
  background: var(--halo-iq-accent);
  top: 9px;
  opacity: 0.65;
}

.halo-iq-loader__page::after {
  top: 15px;
  right: 9px;
  opacity: 0.3;
}

.halo-iq-loader__title {
  font-size: 23px;
  line-height: 1.3;
  font-weight: 650;
  letter-spacing: -0.6px;
  margin: 12px 0 8px;
  font-family: 'Sora', system-ui, sans-serif;
}

.halo-iq-loader__detail {
  color: var(--halo-iq-muted);
  font-size: 14px;
  line-height: 1.6;
  max-width: 330px;
  margin: 0;
}

.halo-iq-loader__activity {
  margin-top: 23px;
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  height: 12px;
}

.halo-iq-loader__activity i {
  display: block;
  background: var(--halo-iq-accent);
  width: 4px;
  height: 12px;
  border-radius: 4px;
  animation: halo-iq-wave 1.2s ease-in-out infinite;
}

.halo-iq-loader__activity i:nth-child(2) {
  animation-delay: 0.12s;
}

.halo-iq-loader__activity i:nth-child(3) {
  animation-delay: 0.24s;
}

.halo-iq-loader__activity i:nth-child(4) {
  animation-delay: 0.36s;
}

.halo-iq-loader__activity i:nth-child(5) {
  animation-delay: 0.48s;
}

.halo-iq-loader[data-state='complete'] .halo-iq-loader__scene > *:not(.halo-iq-loader__core) {
  opacity: 0.22;
  animation: none;
}

.halo-iq-loader[data-state='complete'] .halo-iq-loader__mark {
  font-size: 35px;
}

.halo-iq-loader[data-state='complete'] .halo-iq-loader__activity {
  visibility: hidden;
}

.halo-iq-loader[data-state='error'] .halo-iq-loader__scene * {
  animation-play-state: paused;
}

.halo-iq-loader[data-state='error'] .halo-iq-loader__activity {
  visibility: hidden;
}

.halo-iq-loader[data-size='compact'] {
  display: inline-flex;
  flex-direction: row;
  gap: 10px;
  text-align: left;
}

.halo-iq-loader[data-size='compact'] .halo-iq-loader__scene {
  width: 26px;
  height: 26px;
}

.halo-iq-loader[data-size='compact'] .halo-iq-loader__halo,
.halo-iq-loader[data-size='compact'] .halo-iq-loader__satellite,
.halo-iq-loader[data-size='compact'] .halo-iq-loader__orbit,
.halo-iq-loader[data-size='compact'] .halo-iq-loader__activity {
  display: none;
}

.halo-iq-loader[data-size='compact'] .halo-iq-loader__arc {
  inset: 0;
  border-width: 2px;
}

.halo-iq-loader[data-size='compact'] .halo-iq-loader__core {
  width: 17px;
  height: 20px;
  box-shadow: none;
  border: 0;
  background: none;
  transform: none;
}

.halo-iq-loader[data-size='compact'] .halo-iq-loader__core::before,
.halo-iq-loader[data-size='compact'] .halo-iq-loader__core::after {
  display: none;
}

.halo-iq-loader[data-size='compact'] .halo-iq-loader__mark {
  font-size: 11px;
  letter-spacing: -0.6px;
  transform: none;
}

.halo-iq-loader[data-size='compact'] .halo-iq-loader__title {
  font-size: 14px;
  margin: 0;
  letter-spacing: 0;
}

.halo-iq-loader[data-size='compact'] .halo-iq-loader__detail {
  display: none;
}

@keyframes halo-iq-orbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes halo-iq-counter {
  to {
    transform: rotate(-360deg);
  }
}

@keyframes halo-iq-wave {
  0%,
  100% {
    transform: scaleY(0.35);
    opacity: 0.4;
  }
  50% {
    transform: scaleY(1);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .halo-iq-loader * {
    animation: none !important;
    transition: none !important;
  }

  .halo-iq-loader__activity i {
    transform: scaleY(0.65);
  }

  .halo-iq-loader__satellite:nth-of-type(2) {
    transform: rotate(120deg);
  }

  .halo-iq-loader__satellite:nth-of-type(2) .halo-iq-loader__page {
    transform: rotate(-120deg);
  }

  .halo-iq-loader__satellite:nth-of-type(3) {
    transform: rotate(240deg);
  }

  .halo-iq-loader__satellite:nth-of-type(3) .halo-iq-loader__page {
    transform: rotate(-240deg);
  }
}
