.login-shell .login-card:not(.auth-surface-ready) {
  opacity: 0 !important;
  transform: translate3d(0, 42px, 0) scale(.94) !important;
}

.login-shell .login-card.auth-surface-ready {
  transition: none !important;
  animation: auth-surface-enter 1200ms cubic-bezier(.2, .82, .24, 1) both;
}

.login-shell .login-card.auth-surface-ready .stack-form {
  animation: auth-form-enter 720ms cubic-bezier(.2, .82, .24, 1) 180ms both;
}

.login-shell .login-card {
  display: grid;
}

.login-shell .auth-panel-content,
.login-shell .auth-progress {
  grid-area: 1 / 1;
}

.login-shell .auth-panel-content {
  z-index: 1;
  transition:
    opacity 580ms cubic-bezier(.22, 1, .36, 1),
    transform 580ms cubic-bezier(.22, 1, .36, 1),
    filter 580ms cubic-bezier(.22, 1, .36, 1);
}

.login-shell .auth-progress {
  z-index: 2;
  align-self: center;
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: 22px;
  width: min(100%, 340px);
  visibility: hidden;
  opacity: 0;
  transform: scale(.985);
  filter: blur(7px);
  pointer-events: none;
  text-align: center;
  transition:
    visibility 0s linear 580ms,
    opacity 580ms cubic-bezier(.22, 1, .36, 1),
    transform 580ms cubic-bezier(.22, 1, .36, 1),
    filter 580ms cubic-bezier(.22, 1, .36, 1);
}

.login-shell .login-card.auth-state-progress .auth-panel-content {
  opacity: 0;
  transform: scale(.975);
  filter: blur(8px);
  pointer-events: none;
}

.login-shell .login-card.auth-state-progress .auth-progress {
  visibility: visible;
  opacity: 1;
  transform: none;
  filter: none;
  transition-delay: 0s;
}

.auth-progress-spinner {
  position: relative;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, rgba(10, 18, 32, .96) 53%, transparent 55%),
    conic-gradient(from 0deg, rgba(147, 197, 253, .68) 0deg, rgba(147, 197, 253, .46) 70deg, rgba(147, 197, 253, .12) 220deg, rgba(147, 197, 253, .18) 300deg, rgba(147, 197, 253, .68) 360deg);
  box-shadow: 0 0 36px rgba(59, 130, 246, .2), inset 0 0 0 1px rgba(255, 255, 255, .05);
  animation: auth-progress-spin 860ms linear infinite;
}

.auth-progress-spinner-marker {
  position: absolute;
  top: 3px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow: 0 0 12px rgba(248, 250, 252, .9);
  transform: translateX(-50%);
}

.auth-progress-copy {
  display: grid;
  justify-items: center;
  gap: 7px;
}

.auth-progress-copy h2 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(22px, 4vw, 28px);
  font-weight: 650;
  letter-spacing: -.035em;
}

.auth-progress-copy p {
  margin: 0;
  color: #cbd5e1;
  font-size: 14px;
}

.auth-progress-email {
  max-width: 100%;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: #94a3b8;
  font-size: 13px;
}

@keyframes auth-progress-spin {
  to { transform: rotate(1turn); }
}

@keyframes auth-surface-enter {
  from {
    opacity: 0;
    transform: translate3d(0, 42px, 0) scale(.94);
    filter: blur(10px);
  }
  64% {
    opacity: 1;
    transform: translate3d(0, -4px, 0) scale(1.006);
    filter: blur(0);
  }
  84% {
    transform: translate3d(0, 1px, 0) scale(.998);
  }
  to {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@keyframes auth-form-enter {
  from { opacity: .35; transform: translate3d(0, 16px, 0); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .login-shell .login-card:not(.auth-surface-ready) {
    transform: translate3d(0, 4px, 0) !important;
  }

  .login-shell .login-card.auth-surface-ready {
    animation: auth-surface-fade 600ms ease-out both;
    animation-duration: 600ms !important;
  }

  .login-shell .login-card.auth-surface-ready .stack-form {
    animation: auth-form-fade 360ms ease-out 80ms both !important;
  }

  /* The user explicitly requested a visible login animation. Keep this
     compact status transition alive even when the OS reduces decorative
     motion; without these final-layer overrides the global parity sheet
     compresses it to 0.01ms and the POST navigation hides it entirely. */
  .login-shell .auth-panel-content,
  .login-shell .auth-progress {
    transition-duration: 220ms !important;
  }

  .auth-progress-spinner {
    animation: auth-progress-spin 1400ms linear infinite !important;
    animation-duration: 1400ms !important;
  }
}

@keyframes auth-surface-fade {
  from { opacity: 0; transform: translate3d(0, 8px, 0); }
  to { opacity: 1; }
}

@keyframes auth-form-fade {
  from { opacity: .55; }
  to { opacity: 1; }
}

/* Source post-auth journey: loading, a deliberate clearing beat, then the
   account avatar and welcome copy before the authenticated surface opens. */
body.auth-journey-active {
  overflow: hidden;
}

.app-shell.app-auth-blocked {
  visibility: hidden;
  pointer-events: none;
}

.auth-journey {
  position: fixed;
  inset: 0;
  z-index: 1200;
  isolation: isolate;
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px;
  overflow: hidden;
  opacity: 0;
  background: rgba(var(--surface-darker-rgb, 2, 6, 23), .76);
  -webkit-backdrop-filter: blur(22px) saturate(118%);
  backdrop-filter: blur(22px) saturate(118%);
  transition: opacity 460ms cubic-bezier(.22, 1, .36, 1), backdrop-filter 460ms cubic-bezier(.22, 1, .36, 1);
}

.auth-journey::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  opacity: .9;
  background:
    radial-gradient(circle at 50% 54%, rgba(var(--primary-rgb, 59, 130, 246), .14), transparent 34%),
    radial-gradient(circle at 50% 72%, rgba(var(--secondary-rgb, 34, 197, 94), .1), transparent 38%);
}

.auth-journey.is-visible {
  opacity: 1;
}

.auth-journey.is-leaving {
  opacity: 0;
  -webkit-backdrop-filter: blur(0) saturate(100%);
  backdrop-filter: blur(0) saturate(100%);
}

.auth-journey-panel {
  grid-area: 1 / 1;
  display: grid;
  place-items: center;
  width: min(100%, 430px);
}

.auth-journey .auth-progress {
  display: grid;
  justify-items: center;
  gap: 22px;
  width: min(100%, 340px);
  text-align: center;
}

.auth-journey-loading.is-leaving {
  animation: auth-journey-loading-exit 460ms cubic-bezier(.4, 0, 1, 1) both;
}

.auth-welcome {
  justify-items: center;
  gap: 16px;
  text-align: center;
  animation: auth-welcome-enter 720ms cubic-bezier(.22, 1, .36, 1) both;
}

.auth-welcome-avatar {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .035)), rgba(var(--surface-rgb), .82);
  color: #f8fafc;
  font-size: 31px;
  font-weight: 650;
  letter-spacing: -.04em;
  box-shadow: 0 24px 52px -22px rgba(0, 0, 0, .9), 0 0 42px rgba(var(--primary-rgb, 59, 130, 246), .2), inset 0 1px 0 rgba(255, 255, 255, .12);
  animation: auth-welcome-avatar-enter 720ms cubic-bezier(.22, 1, .36, 1) both;
}

.auth-welcome-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.auth-welcome-check {
  width: 32px;
  height: 32px;
  color: #f8fafc;
  filter: drop-shadow(0 0 14px rgba(var(--primary-light-rgb, 96, 165, 250), .42));
}

.auth-welcome-copy {
  display: grid;
  gap: 6px;
}

.auth-welcome-copy h2 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(28px, 6vw, 38px);
  font-weight: 650;
  letter-spacing: -.045em;
  text-wrap: balance;
}

.auth-welcome-copy p {
  margin: 0;
  color: #cbd5e1;
  font-size: 15px;
}

@keyframes auth-journey-loading-exit {
  to { opacity: 0; filter: blur(8px); transform: scale(.985); }
}

@keyframes auth-welcome-enter {
  from { opacity: 0; filter: blur(10px); transform: scale(.985); }
  to { opacity: 1; filter: blur(0); transform: scale(1); }
}

@keyframes auth-welcome-avatar-enter {
  from { opacity: 0; transform: scale(.92); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 480px) {
  .auth-journey { padding: 20px; }
  .auth-welcome-avatar { width: 92px; height: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-journey,
  .auth-journey-loading,
  .auth-welcome,
  .auth-welcome-avatar {
    animation: none !important;
    transition: none !important;
  }
}

/* Carry the entrance cue through the successful login redirect. The login
   page is often skipped entirely when the remembered session is still valid. */
.app-shell:not(.app-entry-ready) {
  opacity: 0;
  transform: translate3d(0, 30px, 0) scale(.985);
}

.app-shell.app-entry-ready {
  animation: app-shell-enter 1200ms cubic-bezier(.2, .82, .24, 1) both;
}

@keyframes app-shell-enter {
  from { opacity: 0; transform: translate3d(0, 30px, 0) scale(.985); }
  68% { opacity: 1; transform: translate3d(0, -2px, 0) scale(1.002); }
  86% { transform: translate3d(0, 1px, 0) scale(.999); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell.app-entry-ready {
    animation: app-shell-fade 600ms ease-out both;
    animation-duration: 600ms !important;
  }
}

@keyframes app-shell-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
