html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0b0d14;
  color: #cbd5e1;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
  user-select: none;
}

#out {
  height: 100%;
  width: 100%;
  position: relative;
}

.loading-container {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 40%, #171b29 0%, #0b0d14 100%);
  transition: opacity 0.25s ease-out;
}

.loading-container.loading-done {
  opacity: 0;
  pointer-events: none;
}

.loading-container.loading-failed .loading-status {
  color: #f87171;
  user-select: text;
}

.loading-container.loading-failed .progress-bar {
  background: #f87171;
}

.loading-card {
  width: 90%;
  max-width: 420px;
  padding: 32px 28px;
  background: rgba(18, 22, 36, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4), 0 0 40px rgba(99, 102, 241, 0.12);
  text-align: center;
  backdrop-filter: blur(12px);
}

.loading-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.loading-icon {
  font-size: 26px;
  animation: pulse-glow 2s infinite ease-in-out;
}

.loading-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.5px;
  color: #f8fafc;
  margin: 0;
}

.loading-status {
  font-size: 14px;
  color: #94a3b8;
  margin: 0 0 18px 0;
  min-height: 20px;
}

.progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #6366f1 0%, #a855f7 50%, #38bdf8 100%);
  border-radius: 999px;
  transition: width 0.15s ease-out;
  position: relative;
}

.loading-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 13px;
}

.loading-pct {
  font-weight: 600;
  color: #38bdf8;
  font-variant-numeric: tabular-nums;
}

.loading-detail {
  color: #64748b;
  font-size: 12px;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 4px rgba(168, 85, 247, 0.4)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 12px rgba(99, 102, 241, 0.8)); }
}
/* Phones: no pull-to-refresh or double-tap zoom inside the game, no grey tap flash, and the page keeps clear of notches and the browser's bars. */
html, body {
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

@media (max-width: 640px) {
  html, body, #out { height: 100dvh; }
  #out { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); box-sizing: border-box; }
  .loading-card { padding: 24px 18px; }
  .loading-title { font-size: 20px; }
}
