/* Shared bootstrap / refresh loader — used in index.html and app shell */
.app-bootstrap-loader {
  position: fixed;
  inset: 0;
  z-index: 20000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(165deg, #fff9f6 0%, #f7f3ee 42%, #fff0e8 100%);
  transition: opacity 0.45s ease, visibility 0.45s ease;
}

.app-bootstrap-loader--exit {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.app-bootstrap-loader__backdrop {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.app-bootstrap-loader__orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.75;
  animation: bootstrap-orb-float 8s ease-in-out infinite;
}

.app-bootstrap-loader__orb--1 {
  width: 340px;
  height: 340px;
  top: -120px;
  left: -80px;
  background: rgba(254, 152, 51, 0.22);
}

.app-bootstrap-loader__orb--2 {
  width: 300px;
  height: 300px;
  right: -70px;
  bottom: -100px;
  background: rgba(225, 83, 69, 0.18);
  animation-delay: -3s;
}

.app-bootstrap-loader__ring {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1px solid rgba(225, 83, 69, 0.08);
  transform: translate(-50%, -50%);
}

.app-bootstrap-loader__ring--outer {
  width: min(72vw, 520px);
  height: min(72vw, 520px);
  animation: bootstrap-ring-spin 24s linear infinite;
}

.app-bootstrap-loader__ring--inner {
  width: min(52vw, 360px);
  height: min(52vw, 360px);
  animation: bootstrap-ring-spin 18s linear infinite reverse;
}

.app-bootstrap-loader__card {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  width: min(92vw, 360px);
  padding: 2.25rem 2rem 1.85rem;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow:
    0 0 0 1px rgba(225, 83, 69, 0.06),
    0 24px 60px rgba(225, 83, 69, 0.14),
    0 8px 24px rgba(28, 26, 23, 0.06);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  text-align: center;
  animation: bootstrap-card-rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.app-bootstrap-loader__logo-wrap {
  position: relative;
  width: 88px;
  height: 88px;
  display: grid;
  place-items: center;
}

.app-bootstrap-loader__logo-glow {
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(254, 152, 51, 0.35) 0%, rgba(225, 83, 69, 0) 72%);
  animation: bootstrap-glow-pulse 2.2s ease-in-out infinite;
}

.app-bootstrap-loader__wheel-outer,
.app-bootstrap-loader__wheel-center {
  position: absolute;
  inset: 8px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

/* Outer ring rotates; center hub stays fixed */
.app-bootstrap-loader__wheel-outer {
  animation: bootstrap-wheel-spin 10s linear infinite;
  -webkit-mask: radial-gradient(circle, transparent 47.6%, #000 47.7%);
  mask: radial-gradient(circle, transparent 47.6%, #000 47.7%);
}

.app-bootstrap-loader__wheel-center {
  z-index: 1;
  -webkit-mask: radial-gradient(circle, #000 47.6%, transparent 47.7%);
  mask: radial-gradient(circle, #000 47.6%, transparent 47.7%);
}

.app-bootstrap-loader__logo {
  position: relative;
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 8px 18px rgba(225, 83, 69, 0.22));
}

.app-bootstrap-loader__title {
  margin: 0.15rem 0 0;
  font-family: Inter, system-ui, sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  display: flex;
  gap: 0.35rem;
  justify-content: center;
}

.app-bootstrap-loader__title-astro {
  background: linear-gradient(135deg, #e15345 0%, #fe9833 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.app-bootstrap-loader__title-empire {
  color: #1c1a17;
}

.app-bootstrap-loader__text {
  margin: 0;
  min-height: 1.25rem;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.92rem;
  color: #6b7280;
  animation: bootstrap-text-fade 0.35s ease;
}

.app-bootstrap-loader__progress {
  width: 100%;
  height: 4px;
  margin-top: 0.35rem;
  border-radius: 999px;
  background: rgba(225, 83, 69, 0.1);
  overflow: hidden;
}

.app-bootstrap-loader__progress-bar {
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e15345 0%, #fe9833 100%);
  animation: bootstrap-progress-slide 1.35s ease-in-out infinite;
}

.app-bootstrap-loader__dots {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.15rem;
}

.app-bootstrap-loader__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(225, 83, 69, 0.28);
  animation: bootstrap-dot-bounce 1.1s ease-in-out infinite;
}

.app-bootstrap-loader__dot:nth-child(2) {
  animation-delay: 0.15s;
}

.app-bootstrap-loader__dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bootstrap-card-rise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes bootstrap-wheel-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes bootstrap-glow-pulse {
  0%, 100% {
    opacity: 0.55;
    transform: scale(0.95);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

@keyframes bootstrap-progress-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(280%);
  }
}

@keyframes bootstrap-orb-float {
  0%, 100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(12px, 16px);
  }
}

@keyframes bootstrap-ring-spin {
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes bootstrap-dot-bounce {
  0%, 80%, 100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  40% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes bootstrap-text-fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-bootstrap-loader__wheel-outer,
  .app-bootstrap-loader__orb,
  .app-bootstrap-loader__ring--outer,
  .app-bootstrap-loader__ring--inner,
  .app-bootstrap-loader__progress-bar,
  .app-bootstrap-loader__dot,
  .app-bootstrap-loader__logo-glow {
    animation: none;
  }

  .app-bootstrap-loader__card {
    animation: none;
  }
}
