/* ЗМІЙКА
   Використовує класи з 2048.css: .score-box, .milestones-container,
   .milestone, .milestone.claimed, .ms-tile, .ms-reward.
   Тому snake.css треба підключати ПІСЛЯ 2048.css. */

/* Верхня панель: рахунок, золоті, рестарт */
.snake-top {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}
.snake-top .score-box:first-child {
  flex: 1;
}

/* Ігрове поле */
.board-snake {
  position: relative;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  padding: 10px;
  background: #a9c2d9;
  border-radius: 15px;
  touch-action: none;
}
.board-snake canvas {
  position: absolute;
  top: 10px;
  left: 10px;
  width: calc(100% - 20px);
  height: calc(100% - 20px);
  display: block;
  border-radius: 10px;
}

/* Оверлеї: старт і кінець гри */
.snake-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  color: #1b3b5a;
  background: rgba(240, 248, 255, 0.92);
  border-radius: 15px;
}
.snake-overlay h2 {
  font-size: 26px;
}
.snake-overlay p {
  font-size: 13px;
  line-height: 1.4;
  font-weight: 600;
  color: #4a6a8a;
}
.snake-overlay .menu-btn {
  width: auto;
  min-height: 52px;
  padding: 0 30px;
  justify-content: center;
  background: #2196f3;
  color: #fff;
  margin-top: 6px;
}
.snake-big {
  font-size: 48px;
  font-weight: 900;
  line-height: 1;
}
.snake-best {
  font-size: 14px;
  font-weight: 800;
  color: #b8860b;
}

/* Повідомлення "+10 G-Coins" над полем. Не блокує гру, на відміну від showAlert */
.snake-toast {
  position: absolute;
  top: 18px;
  left: 50%;
  z-index: 30;
  padding: 8px 14px;
  border-radius: 20px;
  background: #1b3b5a;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -10px);
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
}
.snake-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* Нагороди під полем */
.snake-ms-title {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
  font-weight: 800;
  color: #1b3b5a;
}
#milestones-snake .milestones-container {
  margin-top: 8px;
}
.snake-ms-gold {
  justify-content: space-around;
}

/* Кольори плиток цілей (ті самі відтінки, що в 2048) */
.snk-t1 {
  background: #81d4fa;
  color: #1b3b5a;
}
.snk-t2 {
  background: #29b6f6;
  color: #fff;
}
.snk-t3 {
  background: #0288d1;
  color: #fff;
}
.snk-t4 {
  background: #01579b;
  color: #fff;
}
.snk-gold {
  background: linear-gradient(135deg, #ffe066, #ffb300);
  color: #7a4b00;
}

/* Найближча ціль обведена */
.milestone.next .ms-tile {
  box-shadow: 0 0 0 3px #1b3b5a;
}

@media (prefers-reduced-motion: reduce) {
  .snake-toast {
    transition: none;
  }
}

/* ОПЦІЙНО: головне меню з 6+ кнопок може не влізти на невеликих екранах
   (html/body мають overflow: hidden). Це дозволяє меню скролитись.
   Якщо все влазить, нічого не змінюється. Можна видалити, якщо заважає. */
#main-menu {
  flex: 0 1 auto;
  min-height: 0;
  overflow-y: auto;
}
