/* Animation Spec v1 — compositor-only motion (transform / opacity). */

/* Hidden only while a sequence is running. If JS never starts, content stays visible. */
.motion-prep.motion-in {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition:
    opacity var(--motion-standard) var(--ease-standard),
    transform var(--motion-standard) var(--ease-standard);
}

.is-motion-playing .motion-prep {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
}

.is-motion-playing .motion-prep.motion-live {
  pointer-events: auto;
}

.is-motion-playing .motion-prep.motion-rise-12 {
  transform: translateY(12px);
}

.is-motion-playing .motion-prep.motion-pop {
  transform: scale(0.96);
}

.is-motion-playing .motion-prep.motion-seal {
  transform: scale(1.12);
}

.is-motion-playing .motion-prep.motion-slam {
  transform: scale(1.3);
}

.is-motion-playing .motion-prep.motion-seal-land {
  transform: scale(1.45);
}

.is-motion-playing .motion-prep.motion-in {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.is-motion-playing .motion-prep.motion-seal-land.motion-in {
  transition:
    opacity 380ms var(--ease-spring),
    transform 380ms var(--ease-spring);
}

/* Slow vertical slide; duration is set in JS so it lands after the rest of the sequence. */
.is-motion-playing .motion-prep.motion-gate-slide {
  opacity: 1;
  transform: translateY(-100%);
}

.is-motion-playing .motion-prep.motion-gate-slide.motion-in {
  opacity: 1;
  transform: none;
}

/* Held above the page, oversized; drops in and shrinks to rest. */
.is-motion-playing .motion-prep.motion-boss-stamp {
  opacity: 0;
  transform: translateY(-36px) scale(1.55);
}

.is-motion-playing .motion-prep.motion-boss-stamp.motion-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 200ms var(--ease-standard),
    transform 420ms var(--ease-accel);
}

.motion-halo {
  position: absolute;
  inset: -18px;
  border-radius: 20px;
  background: radial-gradient(circle, rgba(226, 168, 75, 0.55), transparent 68%);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
}

.motion-level-wrap {
  position: relative;
  display: inline-block;
}

.motion-level-wrap .statbox {
  position: relative;
  z-index: 1;
}

.rkd.motion-land {
  transform: scale(1.35);
}

.rkd.motion-land.motion-in {
  transform: none;
  transition: transform 180ms var(--ease-spring);
}

.rbar i.motion-fill {
  width: 100%;
  transform: scaleX(0);
  transform-origin: left center;
}

.btn.goldb.motion-breathe {
  animation: motion-breathe 2.4s ease-in-out infinite;
}

@keyframes motion-breathe {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

.motion-detonate {
  position: absolute;
  left: 50%;
  top: 28%;
  width: 280px;
  height: 280px;
  margin-left: -140px;
  margin-top: -140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(226, 168, 75, 0.55), rgba(20, 26, 32, 0) 70%);
  opacity: 0;
  transform: scale(0.6);
  pointer-events: none;
  z-index: 0;
}

.motion-motes {
  position: absolute;
  left: 50%;
  top: 36%;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 2;
}

.motion-mote {
  position: absolute;
  left: 0;
  top: 0;
  width: 6px;
  height: 6px;
  margin-left: -3px;
  margin-top: -3px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0;
  pointer-events: none;
}

.motion-screen-in {
  animation: motion-screen-in var(--motion-screen) var(--ease-standard) both;
}

@keyframes motion-screen-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modalwrap .modal,
.hub-modal-overlay .modal {
  animation: motion-popup-in 180ms var(--ease-standard) both;
}

.modalwrap.motion-popup-down .modal,
.hub-modal-overlay.motion-popup-down .modal {
  animation: motion-popup-down 180ms var(--ease-standard) both;
}

@keyframes motion-popup-in {
  from {
    opacity: 0;
    transform: scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes motion-popup-down {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hub-modal-overlay {
  background: rgba(0, 0, 0, 0.4);
}

.toast {
  transition:
    opacity 160ms var(--ease-standard),
    transform 220ms var(--ease-standard);
}

.motion-stagger {
  opacity: 0;
  transform: translateY(8px);
}

.motion-stagger.motion-in {
  opacity: 1;
  transform: none;
  transition:
    opacity 220ms var(--ease-standard),
    transform 220ms var(--ease-standard);
}

.busy-panel,
.auth-gate.busy-wait {
  text-align: center;
  width: 100%;
}

.busy-bpm {
  margin: 18px auto 8px;
}

.busy-bpm-pips .busy-beats {
  margin-top: 8px;
}

.busy-bpm-num {
  font: 700 72px/1 'Share Tech Mono', monospace;
  color: var(--gold);
  animation: busy-bpm-beat 0.5s var(--ease-standard) infinite;
}

.busy-bpm-unit {
  display: block;
  margin-top: 6px;
  font: 700 11px Rajdhani, sans-serif;
  letter-spacing: 0.34em;
  color: var(--t3);
}

.busy-beats {
  margin-top: 16px;
}

.busy-beats .bd {
  position: relative;
}

.busy-beats .bd::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--blue);
  opacity: 0;
  animation: busy-pip 2s var(--ease-standard) infinite;
}

.busy-beats .bd:nth-child(1)::after {
  animation-delay: 0s;
}

.busy-beats .bd:nth-child(2)::after {
  animation-delay: 0.5s;
}

.busy-beats .bd:nth-child(3)::after {
  animation-delay: 1s;
}

.busy-beats .bd:nth-child(4)::after {
  animation-delay: 1.5s;
}

@keyframes busy-bpm-beat {
  0%,
  100% {
    transform: scale(1);
  }
  20% {
    transform: scale(1.06);
  }
}

@keyframes busy-pip {
  0%,
  12% {
    opacity: 1;
  }
  13%,
  100% {
    opacity: 0;
  }
}

#app.session-mode .busy-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  margin: 0;
}

#app.signin-mode #view:has(.busy-wait),
#app:not(.session-mode):not(.onboarding-mode) #view:has(.busy-panel) {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  .busy-bpm-num,
  .busy-beats .bd::after,
  .btn.goldb.motion-breathe {
    animation: none;
  }

  .motion-prep,
  .motion-stagger,
  .motion-screen-in,
  .modalwrap .modal,
  .hub-modal-overlay .modal {
    opacity: 1;
    transform: none;
    animation: none;
    transition: none;
    pointer-events: auto;
  }
}
