/* === GENERAL RESET === */
* {
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background-color: #111;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* === SCORE BOX === */
#score-box {
  margin-top: 20px;
  margin-bottom: 10px;
  background-color: #222;
  color: white;
  padding: 8px 14px;
  border: 2px solid limegreen;
  border-radius: 8px;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  min-width: 120px;
}

/* === GAME BOARD === */
#game-board {
  display: grid;
  grid-template-columns: repeat(20, 30px);
  grid-template-rows: repeat(20, 30px);
  gap: 1px;
  background-color: #333;
  border: 3px solid #555;
}

/* === CELLS === */
.cell {
  width: 30px;
  height: 30px;
  background-color: #222;
}

.snake {
  background-color: limegreen;
}

.snake-head {
  background-color: yellowgreen;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: black;
}

.food {
  background-color: red;
}

.obstacle {
  background-color: #555;
}

.super-bonus {
  background-color: violet;
}


/* === GAME OVER OVERLAY === */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
}

#overlay.hidden {
  display: none;
}

#game-over-box {
  background-color: #222;
  padding: 30px;
  border-radius: 10px;
  color: white;
  text-align: center;
  box-shadow: 0 0 20px black;
}

#restart-btn {
  padding: 10px 20px;
  font-size: 16px;
  background-color: limegreen;
  color: black;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  margin-top: 10px;
}

/* === MOBILE CONTROLS === */
#mobile-controls {
  display: none; /* hidden on desktop by default */
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
}

.controller-row {
  display: flex;
  justify-content: center;
  gap: 12px;
}

#mobile-controls button {
  background-color: #555;
  color: white;
  font-size: 48px;
  border: none;
  border-radius: 12px;
  padding: 24px;
  width: 70px;
  height: 60px;
  touch-action: manipulation;
  box-shadow: 0 0 5px #0005;
}

#mobile-controls button:active {
  transform: scale(0.95);
}

.empty-center {
  width: 60px;
  height: 60px;
}

/* === RESPONSIVE: MOBILE ONLY === */
@media (max-width: 768px) {
  #mobile-controls {
    display: flex;
  }

  #game-board {
    grid-template-columns: repeat(20, 15px);
    grid-template-rows: repeat(20, 15px);
  }

  .cell {
    width: 15px;
    height: 15px;
  }

  #score-box {
    font-size: 16px;
    padding: 6px 10px;
    min-width: 100px;
  }

  #mobile-controls button {
    font-size: 18px;
    min-width: 44px;
    min-height: 44px;
    padding: 10px 16px;
  }

  .empty-center {
    width: 44px;
    height: 44px;
  }
}