/* Container Principal (Força tudo a ficar no centro) */
.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 40px 20px;
  font-family: system-ui, -apple-system, sans-serif;
  width: 100%;
}

/* Quadro do Jogo (Fundo preto e bordas) */
#snakeGame {
  background-color: #111;
  border: 3px solid #333;
  border-radius: 8px;
  display: block;
  margin: 20px auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

/* Placar */
.score-board {
  font-size: 1.25rem;
  font-weight: bold;
}

/* Estilos do Menu de Controles */
.game-controls {
  margin: 20px 0;
  padding: 15px;
  background: #222;
  border-radius: 8px;
  display: inline-block;
  color: white;
}

.game-controls label {
  margin-right: 10px;
}

.game-controls select {
  padding: 5px;
  margin-right: 15px;
  border-radius: 4px;
}

.btn-start {
  padding: 6px 15px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}

.btn-stop {
  padding: 6px 15px;
  background: #ff4d4d;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  margin-left: 10px;
}

.btn-start:disabled,
.btn-stop:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Oculta os controles de celular no PC */
.mobile-controls {
  display: none; 
  flex-direction: column;
  align-items: center;
  margin-top: 20px;
  user-select: none; /* Evita selecionar o texto ao tocar rápido */
}

.d-pad-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.d-pad-btn {
  background-color: #333;
  color: white;
  border: none;
  border-radius: 8px;
  width: 60px;
  height: 60px;
  font-size: 24px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.d-pad-btn:active {
  background-color: #555;
  transform: scale(0.95);
}

/* Mostra os controles quando a tela for pequena (Celular/Tablet) */
@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
  }
  
  /* Ajusta o tamanho do jogo para caber na tela do celular */
  #snakeGame {
    width: 100%;
    max-width: 400px;
    height: auto;
    aspect-ratio: 1 / 1; /* Mantém o formato quadrado */
  }
}