
/* ================================
   DEBUG: BOTONES Y ENEMY LAYER
   ================================ */
.menu-btn.debug#respawnEnemiesBtn {
  background: #ff2222;
  color: #fff;
}
.menu-btn.debug#checkSpritesBtn {
  background: #06ffa5;
  color: #222;
}

#enemyLayer {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 10;
}
/* Estilos principales del juego DOOM */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Courier New', monospace;
  background: #000;
  color: #0f0;
  overflow: hidden;
  user-select: none;
}

#gameContainer {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#gameCanvas {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  z-index: 10 !important;
  background: #000 !important;
  cursor: default; /* Cursor normal por defecto */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  pointer-events: auto !important;
}

/* Cursor de mira SOLO cuando el juego está activo (pointer locked) */
#gameCanvas.pointer-locked {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="none" stroke="%23ff0000" stroke-width="3"><line x1="16" y1="2" x2="16" y2="14"/><line x1="16" y1="18" x2="16" y2="30"/><line x1="2" y1="16" x2="14" y2="16"/><line x1="18" y1="16" x2="30" y2="16"/><circle cx="16" cy="16" r="3" fill="%23ff0000" stroke="%23ffffff" stroke-width="1"/></g></svg>') 16 16, crosshair;
}

/* Cursor de disparo (cuando se hace clic y está en modo juego) */
#gameCanvas.pointer-locked.shooting {
  cursor: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32"><g fill="none" stroke="%23ff4444" stroke-width="4"><line x1="16" y1="1" x2="16" y2="15"/><line x1="16" y1="17" x2="16" y2="31"/><line x1="1" y1="16" x2="15" y2="16"/><line x1="17" y1="16" x2="31" y2="16"/><circle cx="16" cy="16" r="4" fill="%23ff4444" stroke="%23ffff00" stroke-width="2"/></g></svg>') 16 16, crosshair;
}

/* UI del juego */
#gameUI {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.8);
  padding: 10px;
  border: 1px solid #0f0;
  font-size: 12px;
  z-index: 100;
}

#debugPanel {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.9);
  padding: 15px;
  border: 1px solid #f80;
  font-size: 11px;
  color: #f80;
  z-index: 101;
  min-width: 200px;
}

.debug-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.8);
  padding: 10px;
  border-radius: 5px;
  font-size: 12px;
  z-index: 100;
  display: none;
  color: #0f0;
}

#playerStatus {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background: rgba(0, 50, 0, 0.9);
  padding: 10px;
  border: 2px solid #0f0;
  font-size: 14px;
  font-weight: bold;
  z-index: 102;
}

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  pointer-events: none;
  z-index: 103;
}

#crosshair::before,
#crosshair::after {
  content: '';
  position: absolute;
  background: #0f0;
}

#crosshair::before {
  top: 50%;
  left: 8px;
  width: 4px;
  height: 2px;
  transform: translateY(-50%);
}

#crosshair::after {
  left: 50%;
  top: 8px;
  width: 2px;
  height: 4px;
  transform: translateX(-50%);
}

/* Pantalla de carga */
#loadingScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  color: #0f0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  font-size: 18px;
}

#loadingScreen.hidden {
  display: none;
}

.loading-text {
  margin: 10px 0;
  text-align: center;
}

.loading-bar {
  width: 300px;
  height: 10px;
  border: 1px solid #0f0;
  margin: 20px 0;
  overflow: hidden;
}

.loading-progress {
  height: 100%;
  background: #0f0;
  width: 0%;
  transition: width 0.3s ease;
}

.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 1000;
  background: rgba(0,0,0,0.9);
  padding: 30px;
  border-radius: 10px;
  border: 2px solid #ff6b35;
}

.loading h1 {
  color: #ff6b35;
  font-size: 2em;
  margin-bottom: 20px;
}

.loading-info {
  color: #0f0;
  font-size: 14px;
  margin: 10px 0;
  padding: 5px;
  background: rgba(0,255,0,0.1);
  border-radius: 3px;
}

/* Game Over Screen */
#gameOverScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 0, 0, 0.8);
  color: #fff;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 999;
  font-size: 24px;
  text-shadow: 2px 2px 4px #000;
}

#gameOverScreen.show {
  display: flex;
}

.game-over-title {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 20px;
  text-shadow: 3px 3px 6px #000;
}

.game-over-stats {
  font-size: 16px;
  margin: 10px 0;
  text-align: center;
}

.restart-button {
  background: #0a0;
  color: #fff;
  border: none;
  padding: 15px 30px;
  font-size: 18px;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  margin-top: 20px;
  border: 2px solid #0f0;
  transition: all 0.3s ease;
}

.restart-button:hover {
  background: #0f0;
  color: #000;
  transform: scale(1.05);
}

/* Comandos de consola */
.console-commands {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: rgba(0, 0, 0, 0.9);
  padding: 10px;
  border: 1px solid #888;
  font-size: 10px;
  color: #888;
  z-index: 90;
  max-width: 300px;
}

.console-commands h4 {
  color: #0f0;
  margin-bottom: 5px;
}

.console-commands ul {
  list-style: none;
  padding: 0;
}

.console-commands li {
  margin: 2px 0;
  cursor: help;
}

/* Efectos visuales */
.glow {
  text-shadow: 0 0 10px currentColor;
}

.pulse {
  animation: pulse 2s infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  #gameUI {
    font-size: 10px;
    padding: 5px;
  }
  
  #debugPanel {
    font-size: 9px;
    padding: 8px;
  }
  
  #playerStatus {
    font-size: 12px;
    padding: 8px;
  }
  
  .console-commands {
    display: none;
  }
}

/* Estados del juego */
.game-paused #gameCanvas {
  filter: blur(2px) brightness(0.5);
}

.game-running #loadingScreen {
  display: none;
}

/* Animaciones de entrada */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

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

/* ============================================
   MENÚ PRINCIPAL MODERNO
   ============================================ */

.main-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-background {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.menu-background::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: 
    radial-gradient(circle at 25% 25%, rgba(255, 140, 0, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(0, 255, 255, 0.1) 0%, transparent 50%);
  animation: backgroundPulse 4s ease-in-out infinite alternate;
}

@keyframes backgroundPulse {
  0% { opacity: 0.3; }
  100% { opacity: 0.7; }
}

.menu-container {
  background: rgba(0, 0, 0, 0.85);
  border: 3px solid #ff8c00;
  border-radius: 20px;
  padding: 40px;
  text-align: center;
  box-shadow: 
    0 0 30px rgba(255, 140, 0, 0.5),
    inset 0 0 30px rgba(255, 140, 0, 0.1);
  backdrop-filter: blur(10px);
  animation: menuEntrance 0.8s ease-out;
  max-width: 500px;
  width: 90%;
}

@keyframes menuEntrance {
  0% {
    transform: scale(0.8) translateY(50px);
    opacity: 0;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.game-title h1 {
  font-size: 2.5em;
  color: #ff8c00;
  margin-bottom: 5px;
  text-shadow: 
    0 0 10px #ff8c00,
    0 0 20px #ff8c00,
    0 0 30px #ff8c00;
  font-weight: bold;
  letter-spacing: 2px;
}

.game-title h2 {
  font-size: 2em;
  color: #00ffff;
  margin-bottom: 10px;
  text-shadow: 
    0 0 10px #00ffff,
    0 0 20px #00ffff;
  font-weight: bold;
}

.subtitle {
  font-size: 1.1em;
  color: #888;
  margin-bottom: 30px;
  font-style: italic;
}

.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

.menu-btn {
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  border: 2px solid #444;
  color: #fff;
  padding: 15px 25px;
  border-radius: 10px;
  font-family: 'Courier New', monospace;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  overflow: hidden;
}

.menu-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.menu-btn:hover::before {
  left: 100%;
}

.menu-btn:hover {
  transform: translateY(-2px);
  border-color: #ff8c00;
  box-shadow: 
    0 5px 15px rgba(255, 140, 0, 0.3),
    0 0 20px rgba(255, 140, 0, 0.2);
  color: #ff8c00;
}

.menu-btn.primary {
  background: linear-gradient(145deg, #ff8c00, #e67e22);
  border-color: #ff8c00;
  color: #000;
  font-size: 18px;
  animation: primaryPulse 2s ease-in-out infinite;
}

@keyframes primaryPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(255, 140, 0, 0.5); }
  50% { box-shadow: 0 0 30px rgba(255, 140, 0, 0.8); }
}

.menu-btn.primary:hover {
  background: linear-gradient(145deg, #ffa500, #ff8c00);
  transform: translateY(-3px) scale(1.05);
  color: #000;
}

.btn-icon {
  font-size: 1.2em;
}

.menu-footer {
  color: #666;
  font-size: 14px;
  line-height: 1.4;
}

.version {
  font-size: 12px;
  color: #444;
  margin-top: 5px;
}

/* ============================================
   PANELES DE INFORMACIÓN
   ============================================ */

.info-panel {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.95);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}

.info-panel.active {
  display: flex;
  animation: panelFadeIn 0.3s ease-out;
}

@keyframes panelFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.panel-content {
  background: linear-gradient(145deg, #2a2a2a, #1a1a1a);
  border: 3px solid #ff8c00;
  border-radius: 15px;
  padding: 30px;
  max-width: 90%;
  max-height: 90%;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 0 30px rgba(255, 140, 0, 0.5);
}

.close-btn {
  position: absolute;
  top: 15px;
  right: 20px;
  background: none;
  border: none;
  color: #ff8c00;
  font-size: 24px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.close-btn:hover {
  color: #fff;
  transform: scale(1.2);
}

.panel-content h2 {
  color: #ff8c00;
  text-align: center;
  margin-bottom: 25px;
  font-size: 2em;
  text-shadow: 0 0 10px #ff8c00;
}

/* ============================================
   PANEL DE CONTROLES
   ============================================ */

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 25px;
  color: #fff;
}

.control-section h3 {
  color: #00ffff;
  margin-bottom: 15px;
  font-size: 1.3em;
  text-shadow: 0 0 5px #00ffff;
}

.control-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 5px;
  border-left: 3px solid #ff8c00;
}

.key {
  background: #333;
  color: #ff8c00;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: bold;
  font-size: 14px;
  min-width: 60px;
  text-align: center;
}

.desc {
  color: #ccc;
  font-size: 14px;
  text-align: right;
  flex: 1;
  margin-left: 10px;
}

/* ============================================
   PANEL DE DONACIONES
   ============================================ */

.donation-content {
  color: #fff;
  text-align: center;
}

.donation-content p {
  margin-bottom: 15px;
  line-height: 1.6;
}

.donation-methods {
  display: grid;
  gap: 20px;
  margin: 25px 0;
}

.donation-item {
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid #444;
  border-radius: 10px;
  padding: 20px;
  transition: all 0.3s ease;
}

.donation-item:hover {
  border-color: #ff8c00;
  transform: translateY(-2px);
}

.donation-item h3 {
  color: #00ffff;
  margin-bottom: 10px;
  font-size: 1.2em;
}

.account-info {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.account-number {
  background: #333;
  color: #ff8c00;
  padding: 8px 12px;
  border-radius: 5px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  border: 1px solid #555;
}

.copy-btn {
  background: #ff8c00;
  color: #000;
  border: none;
  padding: 8px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.copy-btn:hover {
  background: #ffa500;
  transform: scale(1.05);
}

.donation-note {
  color: #888;
  font-style: italic;
  margin-top: 20px;
}

/* ============================================
   PANEL DE CRÉDITOS
   ============================================ */

.credits-content {
  color: #fff;
}

.credit-section {
  margin-bottom: 25px;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border-left: 4px solid #ff8c00;
}

.credit-section h3 {
  color: #00ffff;
  margin-bottom: 10px;
  font-size: 1.2em;
  text-shadow: 0 0 5px #00ffff;
}

.credit-section p {
  margin-bottom: 8px;
  line-height: 1.5;
}

.credit-section strong {
  color: #ff8c00;
}

.version-info {
  background: rgba(0, 255, 255, 0.1);
  border: 2px solid #00ffff;
  border-radius: 10px;
  padding: 15px;
  text-align: center;
  margin-top: 20px;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

@media (max-width: 768px) {
  .menu-container {
    padding: 25px;
    margin: 20px;
  }
  
  .game-title h1 {
    font-size: 2em;
  }
  
  .game-title h2 {
    font-size: 1.5em;
  }
  
  .menu-btn {
    padding: 12px 20px;
    font-size: 14px;
  }
  
  .controls-grid {
    grid-template-columns: 1fr;
  }
  
  .panel-content {
    padding: 20px;
    margin: 10px;
  }
  
  .control-item {
    flex-direction: column;
    text-align: center;
    gap: 5px;
  }
  
  .desc {
    text-align: center;
    margin-left: 0;
  }
}

/* ============================================
   CANVAS DEL JUEGO (OCULTO INICIALMENTE)
   ============================================ */

#gameCanvas {
  display: none;
}

#gameCanvas.active {
  display: block !important;
}

/* ================================
   POSTER OVERLAY SYSTEM
   ================================ */

/* Contenedor principal para posters HTML */
#poster-overlay-container {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
  z-index: 15 !important; /* Encima del canvas pero debajo de la UI */
  overflow: hidden !important;
}

/* Estilos para las imágenes de posters */
#poster-overlay-container img {
  position: absolute !important;
  display: none !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  user-select: none !important;
  pointer-events: none !important;
  
  /* Optimización de renderizado para imágenes */
  image-rendering: auto !important;
  image-rendering: high-quality !important;
  -webkit-image-rendering: -webkit-optimize-contrast !important;
  
  /* Transiciones suaves para aparición/desaparición */
  transition: opacity 0.1s ease-out !important;
  
  /* Filtros para integración visual con el juego */
  filter: brightness(0.9) contrast(1.1) !important;
}

/* Posters visibles */
#poster-overlay-container img[style*="display: block"] {
  display: block !important;
}

/* Efectos de profundidad para posters lejanos */
#poster-overlay-container img.distant {
  filter: brightness(0.7) contrast(0.9) blur(0.5px) !important;
}

/* Efectos para posters cercanos */
#poster-overlay-container img.close {
  filter: brightness(1.0) contrast(1.2) !important;
}

/* ================================
   SISTEMA DE GALERÍA DE ARTE
   ================================ */

/* Posters como obras de arte - estilo galería MEJORADO */
#poster-overlay-container img.gallery-close {
  filter: brightness(1.0) contrast(1.1) saturate(1.05) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4) !important;
  border: 1px solid rgba(139, 69, 19, 0.6) !important; /* Marco sutil */
  border-radius: 2px !important;
  transition: opacity 0.2s ease !important;
}

/* Posters distantes en galería */
#poster-overlay-container img.gallery-distant {
  filter: brightness(0.9) contrast(1.0) saturate(1.0) !important;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3) !important;
  border: 1px solid rgba(139, 69, 19, 0.4) !important; /* Marco más sutil */
  border-radius: 1px !important;
  transition: opacity 0.2s ease !important;
}

/* NUEVOS ESTILOS PARA SISTEMA ULTRA SIMPLE - TAMAÑO TRIPLE ESTABLE */
#poster-overlay-container img.poster-close {
  filter: brightness(1.0) contrast(1.1) saturate(1.1) !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.6) !important;
  border: 3px solid rgba(139, 69, 19, 0.8) !important;
  border-radius: 4px !important;
  position: fixed !important; /* FIXED para máxima estabilidad */
  transform: none !important; /* Sin transformaciones */
  transition: none !important; /* Sin transiciones que causen baile */
}

#poster-overlay-container img.poster-distant {
  filter: brightness(0.9) contrast(1.0) saturate(1.0) !important;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5) !important;
  border: 2px solid rgba(139, 69, 19, 0.6) !important;
  border-radius: 3px !important;
  position: fixed !important; /* FIXED para máxima estabilidad */
  transform: none !important; /* Sin transformaciones */
  transition: none !important; /* Sin transiciones que causen baile */
}

/* Límites de tamaño para TAMAÑO TRIPLE - estabilidad garantizada */
#poster-overlay-container img.gallery-close,
#poster-overlay-container img.gallery-distant,
#poster-overlay-container img.poster-close,
#poster-overlay-container img.poster-distant {
  /* TAMAÑOS TRIPLICADOS - controlados dinámicamente por JS */
  max-width: 600px !important;  /* Máximo absoluto TRIPLICADO (era 200px) */
  max-height: 450px !important; /* Máximo absoluto TRIPLICADO (era 150px) */
  min-width: 60px !important;   /* Mínimo absoluto TRIPLICADO (era 20px) */
  min-height: 45px !important;  /* Mínimo absoluto TRIPLICADO (era 15px) */
  
  /* MÁXIMA ESTABILIDAD VISUAL - SIN BAILE */
  position: fixed !important;
  transform: none !important;
  transform-origin: center center !important;
  backface-visibility: hidden !important;
  will-change: auto !important; /* Desactivar optimizaciones que causen baile */
  transition: none !important; /* CRUCIAL: Sin transiciones */
  
  /* Anti-aliasing mejorado para TAMAÑO TRIPLE */
  image-rendering: high-quality !important;
  image-rendering: -webkit-optimize-contrast !important;
  -webkit-font-smoothing: antialiased !important;
}
