html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #272836;
  color: #f8f1ff;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: none;
  user-select: none;
}

#game-root {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  background: #272836;
}

#game-root canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 45%, #168f8a 0%, #075856 48%, #06383b 100%);
  isolation: isolate;
}

#level-loading-screen {
  opacity: 0;
  transition: opacity 280ms cubic-bezier(0.215, 0.61, 0.355, 1);
  will-change: opacity;
}

#level-loading-screen.is-visible {
  opacity: 1;
}

.loading-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #06383b;
  opacity: 0;
  pointer-events: none;
  transition: opacity 280ms cubic-bezier(0.215, 0.61, 0.355, 1);
}

.loading-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(circle at 50% 50%, rgba(255, 220, 100, 0.18), transparent 42%);
  animation: loading-ambient-pulse 1.8s ease-in-out infinite;
}

.loading-content {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 1;
  display: block;
  width: 1254px;
  height: 1254px;
  transform: translate(-50%, -50%) scale(var(--loading-art-scale, 0.5));
  transform-origin: center;
}

.loading-splash {
  display: block;
  width: 1254px;
  height: 1254px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-mask-image: radial-gradient(circle closest-side, #000 0%, #000 25%, rgba(0, 0, 0, 0.92) 40%, transparent 100%);
  mask-image: radial-gradient(circle closest-side, #000 0%, #000 25%, rgba(0, 0, 0, 0.92) 40%, transparent 100%);
  filter: drop-shadow(0 20px 44px rgba(14, 0, 39, 0.42));
}

.loading-indicator {
  position: absolute;
  left: 627px;
  top: 1022px;
  display: flex;
  width: 352px;
  height: 77px;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  align-items: center;
  justify-content: center;
  gap: 21px;
  border: 2px solid rgba(255, 226, 132, 0.52);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(15, 112, 103, 0.9), rgba(5, 61, 61, 0.94));
  box-shadow:
    0 9px 24px rgba(4, 2, 18, 0.44),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transform: translate(-50%, -50%) scale(1.2);
  transform-origin: center;
}

.loading-label {
  color: #f7eeff;
  font-size: 23px;
  font-weight: 900;
  letter-spacing: 3.2px;
  text-shadow: 0 2px 5px rgba(7, 2, 24, 0.7);
}

.loading-dots {
  display: flex;
  align-items: center;
  gap: 9px;
}

.loading-dots i {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffdd6d;
  box-shadow: 0 0 9px rgba(255, 218, 91, 0.9);
  animation: loading-dot-bounce 900ms ease-in-out infinite;
}

.loading-dots i:nth-child(2) {
  animation-delay: 120ms;
}

.loading-dots i:nth-child(3) {
  animation-delay: 240ms;
}

.loading-screen.is-transitioning::before {
  opacity: 1;
}

.loading-screen.is-error .loading-dots {
  display: none;
}

.loading-screen.is-error .loading-label {
  color: #ffd4e5;
}

@keyframes loading-dot-bounce {
  0%, 60%, 100% {
    opacity: 0.42;
    transform: translateY(2px) scale(0.82);
  }
  30% {
    opacity: 1;
    transform: translateY(-3px) scale(1.12);
  }
}

@keyframes loading-ambient-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.05); }
}

@media (prefers-reduced-motion: reduce) {
  .loading-screen::after,
  .loading-dots i {
    animation: none;
  }
}
