/* ========================================
   LOADING SCREEN
   Pixel-Art Style with Background Image
   ======================================== */

/* Hide loading screen instantly for returning visitors */
html.visited .loading-screen {
  display: none;
}

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: var(--bg-dark);
  background-image: url('../images/loadingscreen.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-container {
  text-align: center;
  padding: var(--space-xl);
}

/* Title */
.loading-title {
  font-family: 'Press Start 2P', cursive;
  font-size: 1.25rem;
  color: var(--text-primary);
  margin-bottom: var(--space-xl);
  letter-spacing: 2px;
  animation: title-glow 1.5s ease-in-out infinite;
}

@keyframes title-glow {
  0%, 100% {
    text-shadow:
      4px 4px 0 var(--shadow-color),
      0 0 10px rgba(76, 201, 240, 0.5);
  }
  50% {
    text-shadow:
      4px 4px 0 var(--shadow-color),
      0 0 20px rgba(76, 201, 240, 0.8),
      0 0 30px rgba(83, 232, 55, 0.6);
  }
}

@media (min-width: 768px) {
  .loading-title {
    font-size: 1.5rem;
  }
}

/* Progress Bar Container */
.progress-bar-container {
  width: 280px;
  margin: 0 auto var(--space-lg);
  position: relative;
}

@media (min-width: 768px) {
  .progress-bar-container {
    width: 350px;
  }
}

/* Progress Bar Background - Pill Shape */
.progress-bar-bg {
  height: 40px;
  background: #1a2744;
  border-radius: 25px;
  border: 3px solid #2a3a5e;
  padding: 4px;
  position: relative;
  overflow: hidden;
}

/* Progress Bar Fill - Cyan to Green Gradient */
.progress-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 20px;
  background: linear-gradient(90deg, #4cc9f0 0%, #53e837 100%);
  transition: width 0.15s ease-out;
  position: relative;
}

/* Shine effect on progress bar */
.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: rgba(255,255,255,0.2);
  border-radius: 20px 20px 0 0;
}

/* Percentage Text */
.progress-percent {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: 'Press Start 2P', cursive;
  font-size: 0.75rem;
  color: white;
  text-shadow: 2px 2px 0 rgba(0,0,0,0.5);
  z-index: 1;
}

@media (min-width: 768px) {
  .progress-percent {
    font-size: 0.875rem;
  }
}

/* Loading Text */
.loading-text {
  font-family: 'VT323', monospace;
  font-size: 1.5rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  letter-spacing: 2px;
}

/* Blinking Cursor */
.blink-cursor {
  animation: blink 0.7s step-end infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* Loading Tip */
.loading-tip {
  font-family: 'Space Mono', monospace;
  font-size: 0.875rem;
  color: #ffffff;
  max-width: 300px;
  margin: 0 auto;
  min-height: 2.5em;
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 0.9),
    -1px -1px 2px rgba(0, 0, 0, 0.7),
    1px -1px 2px rgba(0, 0, 0, 0.7),
    -1px 1px 2px rgba(0, 0, 0, 0.7);
  animation: tip-pulse 2s ease-in-out infinite;
}

@keyframes tip-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* Press Start Text (appears when loaded) */
.press-start {
  font-family: 'Press Start 2P', cursive;
  font-size: 1rem;
  color: var(--accent-yellow);
  margin-top: var(--space-lg);
  animation: press-start-blink 1s ease-in-out infinite;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.5);
}

@media (min-width: 768px) {
  .press-start {
    font-size: 1.25rem;
  }
}

.press-start.visible {
  opacity: 1;
  visibility: visible;
}

@keyframes press-start-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
