/* Game Container */
#game-container {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  background: var(--bg-dark);
}

#game-container.active {
  display: block;
}

#app {
  width: 100%;
  height: 100%;
}

#app canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.back-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 1001;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid var(--primary);
  color: var(--text);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  display: none;
  transition: all 0.2s;
}

.back-btn:hover {
  background: rgba(0, 0, 0, 0.9);
  transform: translateX(-2px);
}

#game-container.active .back-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1002;
}

.loading-overlay.hidden {
  display: none;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--bg-card);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
  .hero h1 {
    font-size: 1.5rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .stats-bar {
    gap: 1rem;
  }

  .stat-number {
    font-size: 1.2rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .zones-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .connection-steps {
    grid-template-columns: 1fr;
  }

  .code-tabs {
    font-size: 0.8rem;
  }

  .code-tab {
    padding: 0.5rem 1rem;
  }

  .footer-links {
    flex-direction: column;
    gap: 1rem;
  }

  section {
    padding: 3rem 1.5rem;
  }

  .agent-prompt-content {
    font-size: 0.7rem;
  }
}

@media (max-width: 480px) {
  .zones-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 1.5rem;
  }

  section {
    padding: 2rem 1rem;
  }

  .feature-card,
  .step-card,
  .zone-card {
    padding: 1.5rem;
  }

  .agent-prompt {
    padding: 1.5rem;
  }

  .prompt-header {
    flex-direction: column;
    text-align: center;
  }
}

@media (min-width: 1200px) {
  .hero h1 {
    font-size: 3.5rem;
  }

  .hero-subtitle {
    font-size: 1.5rem;
  }

  .features-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .zones-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .btn:hover,
  .feature-card:hover,
  .zone-card:hover {
    transform: none;
  }

  .btn:active {
    transform: scale(0.98);
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .loading-spinner {
    border-width: 2px;
  }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}