/* ── Universal Loader ───────────────────────────────── */

@keyframes loaderBgShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes loaderPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.05); }
}

@keyframes loaderThumbGlow {
  0%, 100% { box-shadow: 0 0 20px rgba(60, 247, 220, 0.15); }
  50%      { box-shadow: 0 0 40px rgba(60, 247, 220, 0.35); }
}

@keyframes loaderBarShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

@keyframes loaderFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes loaderFloat {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-6px); }
}

html, body {
  margin: 0; padding: 0;
  width: 100vw; height: 100vh; overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ── Game container sits behind loader ── */
#game-container {
  position: absolute;
  left: 50%;
  top: 50%;
}
#game, #game canvas {
  width: 100% !important;
  height: 100% !important;
}

/* ── Loader ── */
#loader {
  width: 100%; height: 100%;
  background: linear-gradient(-45deg, #0a0a0d, #111114, #0d0d12, #131318);
  background-size: 400% 400%;
  animation: loaderBgShift 8s ease infinite;
  display: flex;
  align-items: center;
  justify-content: center;
}

#slideshow {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#slideshow-top {
  display: flex;
  align-items: center;
  gap: 24px;
  margin: 0;
  animation: loaderFadeIn 0.6s ease-out both;
}

#slideshow-images,
#slideshow-nav {
  display: none;
}

#thumbnail {
  border-radius: 16px;
  animation: loaderThumbGlow 3s ease-in-out infinite, loaderFloat 4s ease-in-out infinite;
  margin: 0;
}

#slideshow-top-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 200px;
}

#game-title {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
  animation: loaderFadeIn 0.6s ease-out 0.15s both;
}

#progress-container {
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 1;
  transition: opacity 0.5s ease;
  animation: loaderFadeIn 0.6s ease-out 0.3s both;
}

#progress-container.done {
  opacity: 0;
}

#progress-bar {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

#progress-fill {
  background: linear-gradient(90deg, #3CF7DC, #00d4ff);
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

#progress-fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  animation: loaderBarShimmer 2s ease-in-out infinite;
}

#progress-amount {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

#progress-comment {
  font-size: 14px;
  color: rgba(255,255,255,0.35);
  animation: loaderFadeIn 0.6s ease-out 0.45s both;
}

#progress-spinner {
  display: none;
}

@media (max-width: 520px) {
  #slideshow-top {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
  #slideshow-top-container {
    align-items: center;
  }
  #game-title {
    font-size: 18px;
  }
}
