/* NES Game Page Styles */
body {
  margin: 0;
  font-family: 'Courier New', monospace;
  background: linear-gradient(135deg, #0f0f23 0%, #1a1a3a 100%);
  color: #fff;
  overflow-x: hidden;
}

.nes-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

.nes-header {
  text-align: center;
  padding: 2rem 1rem;
  animation: fadeIn 1s ease;
}

.nes-header h1 {
  font-size: 2.5rem;
  margin: 0 0 0.5rem 0;
  background: linear-gradient(45deg, #ff6b35, #f7931e);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.nes-header p {
  font-size: 1.2rem;
  color: #ccc;
  margin-bottom: 1.5rem;
}

.back-button {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: #9146ff;
  color: white;
  text-decoration: none;
  border-radius: 8px;
  font-weight: bold;
  transition: all 0.3s ease;
  border: 2px solid #9146ff;
}

.back-button:hover {
  background: transparent;
  color: #9146ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(145, 70, 255, 0.3);
}

.game-controls {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin: 2rem 0;
  flex-wrap: wrap;
}

.control-button {
  padding: 0.75rem 1.25rem;
  background: #23234a;
  color: white;
  border: 2px solid #444;
  border-radius: 6px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
}

.control-button:hover:not(:disabled) {
  background: #2a2a5a;
  border-color: #666;
  transform: translateY(-1px);
}

.control-button:active:not(:disabled) {
  transform: translateY(0);
}

.control-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.game-area {
  display: flex;
  justify-content: center;
  margin: 2rem 0;
}

.screen-container {
  position: relative;
  background: #000;
  border: 4px solid #333;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 
    0 0 20px rgba(0,0,0,0.8),
    inset 0 0 20px rgba(255,255,255,0.1);
}

#nes-canvas {
  display: block;
  width: 512px;
  height: 480px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  background: #000;
  border-radius: 4px;
}

.loading-overlay, .error-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.loading-content, .error-content {
  text-align: center;
  color: white;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #333;
  border-top: 4px solid #9146ff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem auto;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-detail {
  font-size: 0.9rem;
  color: #ccc;
  margin-top: 0.5rem;
}

.error-content h3 {
  color: #ff4444;
  margin-bottom: 1rem;
}

.retry-button {
  padding: 0.5rem 1rem;
  background: #9146ff;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 1rem;
}

.retry-button:hover {
  background: #a970ff;
}

.controls-info {
  background: rgba(35, 35, 74, 0.6);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0;
  animation: fadeInUp 1.2s ease;
}

.controls-info h3 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #fff;
  font-size: 1.5rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

.control-group h4 {
  color: #9146ff;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.control-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.control-item:last-child {
  border-bottom: none;
}

.key {
  background: #1a1a2e;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: bold;
  color: #fff;
  border: 1px solid #333;
  min-width: 60px;
  text-align: center;
}

.action {
  color: #ccc;
  flex: 1;
  margin-left: 1rem;
}

.game-info {
  background: rgba(30, 30, 47, 0.8);
  border-radius: 12px;
  padding: 1.5rem;
  margin: 2rem 0 0.5rem;
  animation: fadeInUp 1.4s ease;
}

.game-info h3 {
  color: #fff;
  margin-bottom: 1rem;
  text-align: center;
}

.game-info p {
  color: #ccc;
  line-height: 1.6;
  margin-bottom: 1rem;
}

.nes-footer {
  text-align: center;
  padding: 1rem;
  color: #aaa;
  font-size: 0.9rem;
  margin-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Responsive Design */
@media (max-width: 768px) {
  .nes-header h1 {
    font-size: 2rem;
  }
  
  .nes-header p {
    font-size: 1rem;
  }
  
  #nes-canvas {
    width: 320px;
    height: 300px;
  }
  
  .controls-grid {
    grid-template-columns: 1fr;
  }
  
  .game-controls {
    gap: 0.5rem;
  }
  
  .control-button {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }
  
  .nes-container {
    padding: 0.5rem;
  }
}

@media (max-width: 480px) {
  .nes-header h1 {
    font-size: 1.5rem;
  }
  
  #nes-canvas {
    width: 256px;
    height: 240px;
  }
  
  .screen-container {
    padding: 10px;
  }
  
  .control-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }
  
  .action {
    margin-left: 0;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Fullscreen styles */
.fullscreen-active {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-active #nes-canvas {
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
}
