/* World Intro Guide - Synthwave Loading Screen */

.world-intro-guide {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: #0a0a1a;
  font-family: "Rajdhani", "Segoe UI", system-ui, sans-serif;
  color: #e0e0ff;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px 0;
}

/* Background layers */
.wig-background {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

/* Starfield */
.wig-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(2px 2px at 20% 30%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 40% 70%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(3px 3px at 50% 50%, rgba(255, 255, 255, 0.9), transparent),
    radial-gradient(2px 2px at 60% 20%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(3px 3px at 80% 60%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(2px 2px at 10% 80%, rgba(255, 255, 255, 0.6), transparent),
    radial-gradient(2px 2px at 70% 90%, rgba(255, 255, 255, 0.7), transparent),
    radial-gradient(3px 3px at 90% 40%, rgba(255, 255, 255, 0.8), transparent),
    radial-gradient(2px 2px at 30% 10%, rgba(255, 255, 255, 0.5), transparent),
    radial-gradient(2px 2px at 85% 15%, rgba(255, 255, 255, 0.6), transparent);
  background-size: 300px 300px;
  animation: wig-star-drift 60s linear infinite;
}

@keyframes wig-star-drift {
  from { transform: translateY(0); }
  to { transform: translateY(-300px); }
}

/* Horizon grid */
.wig-grid {
  position: absolute;
  bottom: 0;
  left: -50%;
  width: 200%;
  height: 45%;
  background:
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 48px,
      rgba(255, 0, 128, 0.15) 48px,
      rgba(255, 0, 128, 0.15) 50px
    ),
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 48px,
      rgba(0, 255, 255, 0.12) 48px,
      rgba(0, 255, 255, 0.12) 50px
    );
  transform: perspective(300px) rotateX(60deg);
  transform-origin: center top;
  animation: wig-grid-scroll 8s linear infinite;
}

@keyframes wig-grid-scroll {
  from { background-position: 0 0, 0 0; }
  to { background-position: 0 50px, 0 50px; }
}

/* Neon sun */
.wig-sun {
  position: absolute;
  bottom: 18%;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(180px, 28vw, 400px);
  height: clamp(90px, 14vw, 200px);
  background: linear-gradient(
    to bottom,
    #ff2a6d 0%,
    #ff6b35 25%,
    #f7c948 50%,
    #f7c948 50%,
    transparent 50%
  );
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  box-shadow:
    0 0 80px rgba(255, 42, 109, 0.5),
    0 0 160px rgba(255, 107, 53, 0.3);
  mask-image: repeating-linear-gradient(
    to bottom,
    black 0px,
    black 8px,
    transparent 8px,
    transparent 14px
  );
  -webkit-mask-image: repeating-linear-gradient(
    to bottom,
    black 0px,
    black 8px,
    transparent 8px,
    transparent 14px
  );
}

/* Scanlines */
.wig-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    transparent 0px,
    transparent 3px,
    rgba(255, 255, 255, 0.015) 3px,
    rgba(255, 255, 255, 0.015) 6px
  );
  pointer-events: none;
  mix-blend-mode: overlay;
}

/* Content container */
.wig-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 1400px;
  width: 94%;
  margin: auto;
  padding: 32px 40px;
  background: linear-gradient(
    135deg,
    rgba(10, 10, 30, 0.92),
    rgba(20, 10, 40, 0.95)
  );
  border: 2px solid rgba(255, 0, 128, 0.35);
  border-radius: 20px;
  box-shadow:
    0 0 60px rgba(255, 0, 128, 0.2),
    0 0 120px rgba(0, 255, 255, 0.15),
    inset 0 2px 0 rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(16px);
}

.world-intro-guide.wig-training {
  align-items: center;
}

.world-intro-guide.wig-training .wig-content {
  margin: 20px auto;
}

/* Header */
.wig-header {
  text-align: center;
  margin-bottom: 24px;
}

.wig-eyebrow {
  font-family: "Orbitron", "Audiowide", monospace;
  font-size: clamp(0.85rem, 1.5vw, 1.1rem);
  font-weight: 700;
  letter-spacing: 0.35em;
  color: #0ff;
  text-shadow: 0 0 12px rgba(0, 255, 255, 0.9);
  margin-bottom: 8px;
  animation: wig-pulse 2s ease-in-out infinite;
}

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

.wig-title {
  font-family: "Audiowide", "Orbitron", sans-serif;
  font-size: clamp(1.8rem, 5vw, 3rem);
  font-weight: 400;
  margin: 0 0 10px;
  background: linear-gradient(90deg, #ff2a6d, #f7c948, #0ff);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: wig-gradient-shift 4s ease infinite;
  text-shadow: none;
}

.world-intro-guide.wig-training .wig-eyebrow,
.world-intro-guide.wig-training .wig-title,
.world-intro-guide.wig-training .wig-begin-btn.wig-btn-ready {
  animation: none;
}

.world-intro-guide.wig-training .wig-title {
  background-position: 0 center;
}

@keyframes wig-gradient-shift {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.wig-subtitle {
  font-size: clamp(1rem, 2vw, 1.2rem);
  color: rgba(224, 224, 255, 0.75);
  margin: 0;
  font-weight: 500;
}

/* Controls grid */
.wig-controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  width: 100%;
  margin-bottom: 24px;
}

.wig-control-group {
  background: rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 0, 128, 0.25);
  border-radius: 12px;
  padding: 16px;
}

.wig-group-title {
  font-family: "Orbitron", "Audiowide", monospace;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #ff2a6d;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 42, 109, 0.35);
  text-shadow: 0 0 10px rgba(255, 42, 109, 0.5);
}

.wig-control-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}

.wig-keys {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.wig-keys kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 32px;
  padding: 0 10px;
  font-family: "Rajdhani", monospace;
  font-size: 1rem;
  font-weight: 700;
  color: #0ff;
  background: rgba(0, 20, 40, 0.85);
  border: 2px solid rgba(0, 255, 255, 0.6);
  border-radius: 6px;
  box-shadow:
    0 3px 0 rgba(0, 255, 255, 0.35),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    0 0 10px rgba(0, 255, 255, 0.3);
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.9);
}

.wig-label {
  font-size: 1rem;
  font-weight: 500;
  color: rgba(224, 224, 255, 0.9);
}

.wig-group-note {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.8rem;
  font-style: italic;
  color: rgba(224, 224, 255, 0.5);
}

/* Footer */
.wig-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 20px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.world-intro-guide.wig-training .wig-footer {
  justify-content: flex-end;
}

.world-intro-guide.wig-training .wig-begin-btn {
  min-width: 245px;
}

.wig-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wig-status-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #f7c948;
  box-shadow: 0 0 12px rgba(247, 201, 72, 0.7);
  animation: wig-blink 1s ease-in-out infinite;
}

.wig-status-icon.ready {
  background: #0ff;
  box-shadow: 0 0 16px rgba(0, 255, 255, 0.9);
  animation: none;
}

.wig-status-icon.error {
  background: #ff2a6d;
  box-shadow: 0 0 16px rgba(255, 42, 109, 0.9);
  animation: none;
}

@keyframes wig-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.wig-status-text {
  font-size: 1rem;
  color: rgba(224, 224, 255, 0.65);
  font-style: italic;
}

/* Begin button */
.wig-begin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 200px;
  padding: 14px 32px;
  font-family: "Orbitron", "Audiowide", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: rgba(224, 224, 255, 0.5);
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 10px;
  cursor: not-allowed;
  transition: all 0.3s ease;
}

.wig-begin-btn:disabled {
  opacity: 0.7;
}

.wig-btn-loader {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-top-color: #f7c948;
  border-radius: 50%;
  animation: wig-spin 0.8s linear infinite;
}

@keyframes wig-spin {
  to { transform: rotate(360deg); }
}

.wig-begin-btn.wig-btn-ready {
  color: #0ff;
  background: rgba(0, 255, 255, 0.12);
  border-color: rgba(0, 255, 255, 0.7);
  cursor: pointer;
  box-shadow:
    0 0 20px rgba(0, 255, 255, 0.4),
    inset 0 0 20px rgba(0, 255, 255, 0.08);
  animation: wig-glow 1.5s ease-in-out infinite;
}

@keyframes wig-glow {
  0%, 100% { box-shadow: 0 0 20px rgba(0, 255, 255, 0.4), inset 0 0 20px rgba(0, 255, 255, 0.08); }
  50% { box-shadow: 0 0 35px rgba(0, 255, 255, 0.6), inset 0 0 30px rgba(0, 255, 255, 0.15); }
}

.wig-begin-btn.wig-btn-ready:hover {
  background: rgba(0, 255, 255, 0.22);
  transform: scale(1.02);
}

.wig-begin-btn.wig-btn-error {
  color: #ff2a6d;
  background: rgba(255, 42, 109, 0.12);
  border-color: rgba(255, 42, 109, 0.7);
  cursor: pointer;
  box-shadow: 0 0 20px rgba(255, 42, 109, 0.4);
}

/* Error state */
.world-intro-guide.wig-error .wig-content {
  border-color: rgba(255, 42, 109, 0.6);
}

.world-intro-guide.wig-error .wig-eyebrow {
  color: #ff2a6d;
  text-shadow: 0 0 16px rgba(255, 42, 109, 0.9);
}

/* Fade out animation */
.world-intro-guide.wig-fade-out {
  animation: wig-fade-out 600ms ease-out forwards;
}

@keyframes wig-fade-out {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(1.05);
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .wig-stars,
  .wig-grid,
  .wig-eyebrow,
  .wig-title,
  .wig-status-icon,
  .wig-btn-loader,
  .wig-begin-btn.wig-btn-ready {
    animation: none;
  }
  
  .world-intro-guide.wig-fade-out {
    animation: wig-fade-simple 300ms ease-out forwards;
  }
  
  @keyframes wig-fade-simple {
    from { opacity: 1; }
    to { opacity: 0; }
  }
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .wig-content {
    padding: 24px 20px;
  }
  
  .wig-header {
    margin-bottom: 16px;
  }
  
  .wig-controls {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
  }
  
  .wig-control-group {
    padding: 12px;
  }
  
  .wig-group-title {
    font-size: 0.8rem;
    margin-bottom: 8px;
    padding-bottom: 6px;
  }
  
  .wig-control-row {
    padding: 4px 0;
  }
}

@media (max-width: 600px) {
  .world-intro-guide {
    padding: 10px 0;
  }
  
  .wig-content {
    padding: 20px 16px;
  }
  
  .wig-controls {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 16px;
  }
  
  .wig-keys kbd {
    min-width: 28px;
    height: 26px;
    padding: 0 6px;
    font-size: 0.85rem;
  }
  
  .wig-label {
    font-size: 0.9rem;
  }
  
  .wig-footer {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 12px;
  }
  
  .wig-status {
    justify-content: center;
  }
  
  .wig-begin-btn {
    width: 100%;
    padding: 12px 24px;
  }
}

@media (max-height: 700px) {
  .wig-content {
    padding: 20px 24px;
  }
  
  .wig-header {
    margin-bottom: 12px;
  }
  
  .wig-title {
    font-size: clamp(1.4rem, 4vw, 2rem);
    margin-bottom: 6px;
  }
  
  .wig-subtitle {
    font-size: clamp(0.9rem, 1.5vw, 1rem);
  }
  
  .wig-controls {
    gap: 10px;
    margin-bottom: 16px;
  }
  
  .wig-control-group {
    padding: 10px;
  }
  
  .wig-group-title {
    font-size: 0.75rem;
    margin-bottom: 6px;
    padding-bottom: 4px;
  }
  
  .wig-control-row {
    padding: 3px 0;
    gap: 8px;
  }
  
  .wig-keys kbd {
    min-width: 30px;
    height: 26px;
    font-size: 0.85rem;
  }
  
  .wig-label {
    font-size: 0.85rem;
  }
}
