/* Snake Game Styles */

/* Game container */
.snake-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
  margin: 0 auto;
  padding: 15px;
  font-family: Arial, sans-serif;
  gap: 15px;
}

/* Score info panel */
.snake-info {
  width: 100%;
  max-width: 600px;
  background-color: #222;
  border-radius: 10px;
  padding: 10px 20px;
  margin-bottom: 10px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.snake-score-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: white;
}

.snake-score-container h3 {
  margin: 5px 0;
  font-size: 18px;
}

/* Replay button */
#snake-replay {
  background: linear-gradient(to bottom, #4CAF50, #388E3C);
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

#snake-replay:hover {
  transform: rotate(180deg);
  background: linear-gradient(to bottom, #43A047, #2E7D32);
}

#snake-replay:active {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  transform: translateY(2px) rotate(180deg);
}

/* Canvas wrapper */
.snake-canvas-wrapper {
  position: relative;
  background-color: #111;
  border: 3px solid #333;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  width: 100%;
  max-width: 600px;
}

/* Game canvas */
#snakeCanvas {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Game controls - Keyboard layout */
.snake-controls {
  width: 100%;
  max-width: 400px;
  margin: 15px auto;
}

.snake-controls-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.snake-controls-row {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.middle-row {
  width: 100%;
  justify-content: space-between;
  padding: 0 15px;
  max-width: 280px;
}

.snake-middle-spacer {
  width: 70px; /* Space in the middle of left and right buttons */
}

.snake-controls button {
  width: 70px;
  height: 70px;
  font-size: 28px;
  border-radius: 12px;
  border: none;
  background: linear-gradient(to bottom, #4CAF50, #388E3C);
  color: white;
  cursor: pointer;
  box-shadow: 0 6px 0 #2E7D32, 0 8px 10px rgba(0, 0, 0, 0.4);
  transition: all 0.1s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.snake-controls button:active {
  box-shadow: 0 2px 0 #2E7D32, 0 3px 5px rgba(0, 0, 0, 0.4);
  transform: translateY(4px);
}

/* Game over popup */
#snake-game-over {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.85);
  color: white;
  padding: 20px 30px;
  border-radius: 15px;
  text-align: center;
  min-width: 250px;
  z-index: 100;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
  animation: fadeIn 0.3s ease;
}

#snake-game-over h2 {
  color: #4CAF50;
  margin-top: 0;
  font-size: 24px;
}

#snake-game-over p {
  margin: 10px 0;
  font-size: 16px;
}

#snake-restart {
  background: linear-gradient(to bottom, #4CAF50, #388E3C);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  margin-top: 15px;
  transition: all 0.2s ease;
}

#snake-restart:hover {
  background: linear-gradient(to bottom, #3b9044, #2d7331);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#snake-restart:active {
  transform: translateY(2px);
}

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

/* Responsive design */
@media (max-width: 768px) {
  .snake-container {
    padding: 10px;
  }
  
  .snake-controls button {
    width: 65px;
    height: 65px;
    font-size: 24px;
  }
  
  .snake-info {
    padding: 8px 15px;
  }
  
  .snake-score-container h3 {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .snake-controls button {
    width: 60px;
    height: 60px;
    font-size: 22px;
  }
  
  .middle-row {
    max-width: 240px;
  }
  
  .snake-middle-spacer {
    width: 50px;
  }
  
  #snake-game-over {
    padding: 15px 20px;
    min-width: 200px;
  }
  
  #snake-game-over h2 {
    font-size: 20px;
  }
  
  #snake-game-over p {
    font-size: 14px;
  }
  
  #snake-restart {
    padding: 10px 20px;
    font-size: 14px;
  }
  
  .snake-score-container h3 {
    font-size: 14px;
  }
  
  #snake-replay {
    width: 30px;
    height: 30px;
    font-size: 16px;
  }
}

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
  .snake-info {
    background-color: #222;
  }
  
  .snake-canvas-wrapper {
    border-color: #444;
  }
}