/* ========================
   ESTILOS ESPECÍFICOS PARA SNAKE (ESTILO LABERINTO)
========================= */

/* Variables específicas para Snake */
:root {
    --snake-color: #00b894;
    --snake-head-color: #00ffcc;
    --food-color: #fd79a8;
    --powerup-color: #fdcb6e;
    --obstacle-color: #6c5ce7;
    --grid-color: rgba(255, 255, 255, 0.05);
    --border-color: #8a7cff;
}

/* Contenedor del juego */
.game-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 20px;
  width: 100%;
}

.game-container {
  position: relative;
  background: rgba(15, 15, 35, 0.8);
  padding: 15px;
  border-radius: 15px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(108, 92, 231, 0.2);
  overflow: hidden;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.game-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
  z-index: 2;
}

#game-canvas {
  background: linear-gradient(160deg, #0a0a1a 0%, #15152a 100%);
  display: block;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
  width: 100%;
  max-width: 600px;
  height: auto;
  aspect-ratio: 1/1;
  image-rendering: pixelated;
}

/* Overlay de Game Over */
.game-over-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 184, 148, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
  z-index: 10;
}

.game-over-screen.active {
  opacity: 1;
  visibility: visible;
}

.game-over-content {
  text-align: center;
  transform: scale(0.8);
  animation: pulse 1.5s infinite alternate;
}

.game-over-content i {
  font-size: clamp(3rem, 8vw, 4rem);
  color: white;
  margin-bottom: 15px;
}

.game-over-content h2 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 10px;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.game-over-content p {
  font-size: clamp(1rem, 3vw, 1.2rem);
  color: rgba(255, 255, 255, 0.9);
}

/* Estadísticas finales */
.final-stats {
  background: rgba(253, 121, 168, 0.1);
  border-radius: 10px;
  padding: 15px;
  margin: 20px 0;
  border-left: 4px solid var(--accent-color);
}

.final-stats p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: #c0c0f0;
  font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.final-stats i {
  color: var(--accent-color);
  font-size: 1rem;
  margin-right: 10px;
}

.final-stats span {
  color: white;
  font-weight: 700;
  font-family: 'Courier New', monospace;
}

/* Timer específico */
.timer-value {
  color: #00ffcc !important;
  text-shadow: 0 0 10px rgba(0, 255, 204, 0.5);
}

/* Pantallas de inicio y pausa */
.start-screen,
.pause-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(5px);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  z-index: 10;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.start-screen.active,
.pause-overlay.active {
  opacity: 1;
  visibility: visible;
}

.start-content,
.pause-content {
  text-align: center;
  background: linear-gradient(145deg, #1a1a2e, #16213e);
  border-radius: 15px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(108, 92, 231, 0.3);
  animation: modalSlideIn 0.4s ease-out;
  padding: 30px;
}

.start-content i,
.game-over-content i,
.pause-content i {
  font-size: clamp(3rem, 8vw, 4rem);
  color: var(--snake-color);
  margin-bottom: 20px;
}

.start-content h2,
.game-over-content h2,
.pause-content h2 {
  font-size: clamp(1.8rem, 5vw, 2.5rem);
  margin-bottom: 20px;
  color: white;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Instrucciones en pantalla de inicio */
.instructions {
  background: rgba(0, 184, 148, 0.1);
  border-radius: 10px;
  padding: 15px;
  margin: 20px 0;
  text-align: left;
  border-left: 4px solid var(--secondary-color);
}

.instructions p {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: #c0c0f0;
  font-size: clamp(0.9rem, 2vw, 1rem);
}

.instructions p:last-child {
  margin-bottom: 0;
}

.instructions i {
  color: var(--accent-color);
  font-size: 1rem;
}

/* Selector de dificultad */
.difficulty-selector {
  margin: 25px 0;
}

.difficulty-selector h4 {
  color: #8a7cff;
  margin-bottom: 15px;
  font-size: clamp(1rem, 2.5vw, 1.1rem);
}

.difficulty-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.difficulty-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  color: #b0b0e0;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  min-width: 100px;
}

.difficulty-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.difficulty-btn.active {
  background: var(--secondary-color);
  color: white;
  box-shadow: 0 5px 15px rgba(0, 184, 148, 0.4);
}

.start-btn {
  margin-top: 20px;
  font-size: clamp(1rem, 2.5vw, 1.1rem);
  padding: 15px 30px;
}

/* Botones de game over */
.game-over-buttons {
  display: flex;
  gap: 15px;
  margin-top: 25px;
  justify-content: center;
}

/* Pantalla de pausa */
.pause-content {
  background: rgba(108, 92, 231, 0.95);
}

.pause-content i {
  color: white;
}

.pause-content p {
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1rem, 2.5vw, 1.2rem);
  margin-top: 10px;
}

/* Panel de acciones */
.actions-panel {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 15px;
  margin-bottom: 20px;
}

/* Controles móviles - SOLO MOSTRAR EN MÓVIL */
.mobile-controls {
  display: none;
  margin-top: 20px;
  width: 100%;
  max-width: 300px;
  justify-content: center;
}

/* Mostrar solo en móvil */
@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
  }
}

.dpad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.dpad-btn {
  width: clamp(60px, 15vw, 70px);
  height: clamp(60px, 15vw, 70px);
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  color: white;
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
  cursor: pointer;
}

.dpad-btn:active {
  transform: scale(0.9);
  background: rgba(108, 92, 231, 0.5);
}

.dpad-horizontal {
  display: flex;
  gap: clamp(20px, 5vw, 30px);
}

.dpad-up {
  margin-bottom: 10px;
}

/* Animaciones */
@keyframes pulse {
  from { transform: scale(0.95); }
  to { transform: scale(1.05); }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-50px) scale(0.9);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes snakeMove {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes foodGlow {
  0%, 100% { box-shadow: 0 0 10px var(--food-color); }
  50% { box-shadow: 0 0 20px var(--food-color); }
}

@keyframes scorePop {
  0% { transform: scale(0); opacity: 0; }
  70% { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

/* Efectos específicos del canvas */
.score-popup {
  position: absolute;
  color: var(--secondary-color);
  font-weight: bold;
  font-size: 1.5rem;
  pointer-events: none;
  text-shadow: 0 0 10px rgba(0, 184, 148, 0.8);
  animation: scorePop 0.5s ease-out forwards;
  z-index: 5;
}

/* Responsive */
@media (min-width: 769px) and (max-width: 1024px) {
  .game-wrapper {
    flex-direction: row;
  }
  
  .game-container {
    flex: 2;
  }
}

@media (min-width: 1025px) {
  .game-wrapper {
    flex-direction: row;
    gap: 25px;
  }
  
  .game-container {
    flex: 3;
  }
}

@media (max-width: 768px) {
  .game-wrapper {
    flex-direction: column;
  }
  
  .game-over-buttons {
    flex-direction: column;
  }
  
  .difficulty-buttons {
    flex-direction: column;
    align-items: center;
  }
  
  .difficulty-btn {
    width: 100%;
    max-width: 200px;
  }
}

@media (max-width: 480px) {
  .dpad-btn {
    width: 55px;
    height: 55px;
  }
  
  .dpad-horizontal {
    gap: 15px;
  }
  
  .start-content,
  .game-over-content,
  .pause-content {
    padding: 20px;
  }
  
  .start-content h2,
  .game-over-content h2,
  .pause-content h2 {
    font-size: clamp(1.5rem, 4vw, 2rem);
  }
}