#loadingScreen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  place-items: center;
  padding: clamp(14px, 2.2vw, 28px);
}

#loadingScreen > .loading-bg,
#loadingScreen > .loading-card {
  grid-column: 1;
  grid-row: 1;
}

#loadingScreen > .loading-bg {
  align-self: stretch;
  justify-self: stretch;
  z-index: 0;
}

#loadingScreen > .loading-card {
  z-index: 1;
  align-self: center;
  justify-self: center;
}

.loading-bg {
  position: relative;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 115, 0, 0.18), transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(0, 140, 255, 0.18), transparent 40%),
    linear-gradient(180deg, #050a14, #000);
  background-size: 130% 130%, 130% 130%, auto;
  background-position: 20% 30%, 80% 70%, 50% 50%;
  overflow: hidden;
  animation: loading-bg-drift 26s ease-in-out infinite alternate;
}

.loading-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(0, 140, 255, 0.08), transparent 60%),
    radial-gradient(circle at center, rgba(255, 115, 0, 0.08), transparent 60%);
  pointer-events: none;
  z-index: 1;
  animation: loading-bg-orbit 20s ease-in-out infinite alternate;
}

.loading-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    120deg,
    transparent,
    transparent 40px,
    rgba(0, 140, 255, 0.05) 41px
  );
  animation:
    loading-bg-move 12s linear infinite,
    loading-streak-pulse 5.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
  opacity: 0.65;
}

@keyframes loading-bg-move {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-200px);
  }
}

@keyframes loading-bg-drift {
  0% {
    background-position: 14% 22%, 76% 62%, 50% 50%;
  }
  100% {
    background-position: 32% 38%, 58% 48%, 50% 50%;
  }
}

@keyframes loading-bg-orbit {
  0% {
    transform: translate(-2.5%, -1.5%) scale(1.02);
    opacity: 0.95;
  }
  100% {
    transform: translate(2.5%, 2%) scale(1.05);
    opacity: 1;
  }
}

@keyframes loading-streak-pulse {
  0%,
  100% {
    opacity: 0.82;
  }
  50% {
    opacity: 1;
  }
}

.loading-bg.image-mode {
  background: url("loading-bg.png") center / cover no-repeat;
  background-size: cover;
  animation: none;
}

.loading-bg.image-mode::before,
.loading-bg.image-mode::after {
  animation: none;
  opacity: 0.55;
}

.loading-card {
  width: min(1240px, 100%);
  min-height: max(620px, 54vh);
  border: 1px solid rgba(249, 115, 22, 0.34);
  border-radius: 40px;
  background:
    linear-gradient(135deg, rgba(0, 0, 0, 0.82), rgba(20, 20, 20, 0.72)),
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.22), transparent 35%);
  box-shadow:
    0 34px 100px rgba(0, 0, 0, 0.65),
    0 0 52px rgba(249, 115, 22, 0.14),
    inset 0 0 0 1px rgba(59, 130, 246, 0.14);
  padding: clamp(24px, 2.8vw, 40px);
  display: grid;
  grid-template-columns: 0.9fr 1.35fr 0.9fr;
  gap: clamp(20px, 2.2vw, 32px);
  align-items: center;
  overflow: hidden;
  animation: loading-card-hud 5s ease-in-out infinite;
}

@keyframes loading-card-hud {
  0%,
  100% {
    box-shadow:
      0 34px 100px rgba(0, 0, 0, 0.65),
      0 0 52px rgba(249, 115, 22, 0.14),
      inset 0 0 0 1px rgba(59, 130, 246, 0.14);
  }
  50% {
    box-shadow:
      0 34px 100px rgba(0, 0, 0, 0.65),
      0 0 86px rgba(249, 115, 22, 0.24),
      inset 0 0 0 1px rgba(59, 130, 246, 0.26);
  }
}

.loading-panel--left {
  animation: loading-panel-slide-left 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.loading-panel--right {
  animation: loading-panel-slide-right 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.08s both;
}

.loading-logo-wrap {
  text-align: center;
  animation: loading-center-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}

@keyframes loading-panel-slide-left {
  from {
    opacity: 0;
    transform: translateX(-28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes loading-panel-slide-right {
  from {
    opacity: 0;
    transform: translateX(28px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes loading-center-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading-logo {
  width: min(520px, 92%);
  max-height: 260px;
  object-fit: contain;
  filter: drop-shadow(0 0 28px rgba(249, 115, 22, 0.35));
  animation:
    loading-logo-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both,
    loading-logo-glow 3.2s ease-in-out 0.9s infinite;
}

#loadingFallbackLogo {
  animation:
    loading-logo-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both,
    loading-logo-glow 3.2s ease-in-out 0.9s infinite;
}

@keyframes loading-logo-in {
  from {
    opacity: 0;
    transform: scale(0.94);
    filter: drop-shadow(0 0 8px rgba(249, 115, 22, 0.12));
  }
  to {
    opacity: 1;
    transform: scale(1);
    filter: drop-shadow(0 0 28px rgba(249, 115, 22, 0.35));
  }
}

@keyframes loading-logo-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 22px rgba(249, 115, 22, 0.28));
  }
  50% {
    filter: drop-shadow(0 0 36px rgba(249, 115, 22, 0.45));
  }
}

.loading-title {
  margin-top: 20px;
  font-size: clamp(32px, 3.6vw, 46px);
  font-weight: 900;
  letter-spacing: 0.03em;
}

.loading-tagline {
  color: #fdba74;
  font-weight: 900;
  margin-top: 10px;
  letter-spacing: 0.16em;
  font-size: clamp(12px, 1.1vw, 15px);
  opacity: 0;
  animation: loading-tagline-in 0.55s ease-out 0.34s forwards;
}

@keyframes loading-tagline-in {
  to {
    opacity: 1;
  }
}

.loading-panel {
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.42);
  border-radius: 28px;
  padding: clamp(18px, 2vw, 26px);
}

.loading-panel h3 {
  margin: 0 0 16px;
  font-size: clamp(14px, 1.15vw, 17px);
  color: #fdba74;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.loading-list {
  display: grid;
  gap: 12px;
}

.loading-pill {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  padding: 12px 14px;
  color: #e5e5e5;
  font-size: clamp(13px, 1.05vw, 16px);
  font-weight: 700;
}

.loading-status {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: clamp(12px, 1vw, 15px);
}

.loading-status span:last-child {
  color: #86efac;
  font-weight: 900;
}

.loading-panel--right .loading-status span:last-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.loading-panel--right .loading-status span:last-child::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #d1fae5, #22c55e 42%, #166534);
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
  flex-shrink: 0;
  animation: loading-status-dot 2.5s ease-in-out infinite;
}

.loading-panel--right .loading-status:nth-child(2) span:last-child::before {
  animation-delay: 0s;
}

.loading-panel--right .loading-status:nth-child(3) span:last-child::before {
  animation-delay: 0.18s;
}

.loading-panel--right .loading-status:nth-child(4) span:last-child::before {
  animation-delay: 0.36s;
}

.loading-panel--right .loading-status:nth-child(5) span:last-child::before {
  animation-delay: 0.54s;
}

.loading-panel--right .loading-status:nth-child(6) span:last-child::before {
  animation-delay: 0.72s;
}

@keyframes loading-status-dot {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.82;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.35);
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
    box-shadow: 0 0 14px rgba(34, 197, 94, 0.65);
  }
}

.loading-bar-shell {
  margin-top: 34px;
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.11);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.loading-bar-fill {
  position: relative;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f97316, #facc15);
  border-radius: 999px;
  transition: width 0.25s ease;
  overflow: hidden;
}

.loading-bar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 42%;
  background: linear-gradient(
    100deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 35%,
    rgba(255, 255, 255, 0.42) 50%,
    rgba(255, 255, 255, 0.08) 65%,
    transparent 100%
  );
  border-radius: inherit;
  transform: translateX(-120%);
  animation: loading-bar-shine 2.1s ease-in-out infinite;
  pointer-events: none;
}

@keyframes loading-bar-shine {
  0% {
    transform: translateX(-130%);
  }
  100% {
    transform: translateX(320%);
  }
}

.loading-message {
  margin-top: 16px;
  color: #d4d4d4;
  font-weight: 800;
  text-align: center;
  font-size: clamp(14px, 1.2vw, 17px);
}

.loading-message.loading-message--tick {
  animation: loading-message-snap 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes loading-message-snap {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading-tip {
  margin-top: 24px;
  border: 1px solid rgba(249, 115, 22, 0.25);
  background: rgba(249, 115, 22, 0.1);
  border-radius: 20px;
  padding: clamp(14px, 1.8vw, 18px);
  color: #fed7aa;
  font-size: clamp(13px, 1.1vw, 16px);
  line-height: 1.45;
  animation: loading-tip-ambient 8s ease-in-out infinite;
}

@keyframes loading-tip-ambient {
  0%,
  100% {
    opacity: 0.94;
    transform: translateY(0);
    border-color: rgba(249, 115, 22, 0.22);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
    border-color: rgba(249, 115, 22, 0.38);
  }
}

.loading-badge {
  display: inline-block;
  margin-bottom: 14px;
  background: rgba(249, 115, 22, 0.16);
  border: 1px solid rgba(249, 115, 22, 0.35);
  color: #fdba74;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: clamp(11px, 0.95vw, 14px);
  font-weight: 900;
  letter-spacing: 0.08em;
  animation:
    loading-badge-in 0.55s cubic-bezier(0.22, 1, 0.36, 1) both,
    loading-badge-pulse 2.8s ease-in-out 0.55s infinite;
}

@keyframes loading-badge-in {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes loading-badge-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0), 0 0 14px rgba(249, 115, 22, 0.18);
  }
  50% {
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.25), 0 0 26px rgba(249, 115, 22, 0.35);
  }
}

@media (max-width: 900px) {
  .loading-card {
    grid-template-columns: 1fr;
    min-height: auto;
    width: 100%;
  }

  .loading-title {
    font-size: clamp(28px, 8vw, 36px);
  }

  .loading-panel--left,
  .loading-panel--right {
    animation: loading-panel-fade-mobile 0.55s ease-out both !important;
  }
}

@keyframes loading-panel-fade-mobile {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  #loadingScreen *,
  #loadingScreen *::before,
  #loadingScreen *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  #loadingScreen .loading-tagline {
    opacity: 1 !important;
  }
}
