#main-container {
  margin-top: 20px !important;
}

.snake-container {
  display: flex;
  width: 100%;
  height: 100%;
  flex-flow: column wrap;
  justify-content: center;
}

.snake-wrapper {
  display: flex;
  flex-flow: row wrap;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

/* 🎯 Bigger Canvas */
#gameCanvas {
  width: 100% !important;
  max-width: 650px;
  height: 500px !important;
  background-color: #F5F5F5 !important;
  background-image: linear-gradient(90deg, #E0E0E0 1px, transparent 1px),
    linear-gradient(#E0E0E0 1px, transparent 1px) !important;
  background-size: 22px 22px;
  border-radius: 12px !important;
  display: block;
  margin: 0 auto;
}

#ui {
  display: flex;
  align-items: center;
  font-size: 10px;
  flex-flow: column;
  margin-left: 10px;
}

#scoreboard {
  display: flex;
  justify-content: space-between;
  border-radius: 5px;
  margin-bottom: 20px;
  align-items: center;
}

.score,
.high-score {
  background-color: #19A4EF;
  color: #fff !important;
  text-align: center;
  width: 130px;
  border-radius: 5px;
  font-size: 1.2rem;
  font-weight: bold;
}

.high-score {
  background-color: #0A2B50;
}

.score h2,
.high-score h2 {
  color: #fff !important;
  margin: 10px auto 10px;
  letter-spacing: 1.2px;
}

#game-container {
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.6),
    inset 0 0 12px rgba(255, 255, 255, 0.05);
  padding: 13px;
}

#replay {
  margin: 15px auto 0;
  padding: 10px 25px;
  border: none;
  border-radius: 25px;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  font-size: 16px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-block;
  width: auto;
}

#replay:hover {
  transform: translateY(-2px);
}

#replay:focus-visible {
  outline: none !important;
}

#gameOverOverlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 99999999;
}

#gameOverOverlay .popup {
  background: #FFF;
  padding: 40px 30px;
  border-radius: 15px;
  text-align: center;
  color: #fff;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.9);
  display: block;
}

#gameOverOverlay .popup h1 {
  color: #19A4EF;
  margin-bottom: 20px;
  font-size: 45px;
}

#popupRestart {
  margin-top: 15px;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  background: #0A2B50;
  color: #fff;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
}

/* ✅ Mobile Controls (smaller & compact) */
#mobile-controls {
  display: none;
  text-align: center;
  margin-top: 12px;
}

#mobile-controls .row {
  display: flex;
  justify-content: center;
  margin: 4px 0;
}

.control-btn {
  width: 48px;
  height: 48px;
  font-size: 22px;
  font-weight: bold;
  border: none;
  border-radius: 10px;
  background: #19A4EF;
  color: white;
  margin: 4px;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  transition: background 0.2s;
}

.control-btn:active {
  background: #0A2B50;
}

/* --- Responsive --- */
@media screen and (max-width: 992px) {
  .scorebox {
    flex-direction: row;
    justify-content: space-between;
    width: 100%;
  }

  .score,
  .high-score {
    font-size: 1.2rem;
  }

  .hero-section h2 {
    width: 60% !important;
  }
}

@media screen and (max-width: 768px) {
  .hero-section{
    margin: 0 !important;
  }
  
  .score,
  .high-score {
    font-size: 1.2rem;
  }

  #gameCanvas {
    height: 420px !important;
  }

  #scoreboard h2 {
    font-size: 18px;
  }

  #mobile-controls {
    display: block;
  }
}

@media (max-width: 600px) {
  #replay {
    font-size: 14px;
    padding: 10px 40px;
  }

  #ui {
    flex-flow: row wrap;
    margin-bottom: 20px;
  }

  .snake-container {
    flex-flow: column wrap;
  }
  #gameOverOverlay .popup h1 {
    font-size: 40px;
  }
  .popup p{
    font-size: 18px;
  }
}

@media (max-width: 580px) {
  .hero-section {
    padding: 20px !important;
  }

  #gameCanvas {
    width: 100% !important;
    height: auto !important;
    max-width: 450px;
  }

  .control-btn {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }
  #scoreboard {
    display: flex;
    justify-content: space-evenly ;
    font-size: 14px;
  }
}

@media (max-width: 400px) {
  #gameCanvas {
    height: 320px !important;
  }

  .control-btn {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
}

@media (max-width: 350px) {
  #gameCanvas {
    width: 100% !important;
    height: 240px !important;
    max-width: 300px;
  }
  #scoreboard {
    display: flex;
    justify-content: space-evenly ;
    font-size: 14px;
  }
  #scoreboard h2 {
    font-size: 16px;
  }

  #replay {
    font-size: 13px;
  }
}

@media (max-width: 320px) {
  #gameCanvas {
    width: 280px !important;
    height: 220px !important;
  }

  #scoreboard {
    display: flex;
    justify-content: space-evenly ;
    font-size: 14px;
  }

  #replay {
    font-size: 16px;
    padding: 5px 30px;
  }

  #gameOverOverlay .popup h1 {
    font-size: 30px;
  }

  .popup p {
    font-size: 15px;
  }
  .hero-section h2 {
    width: 100%;
  }

  .score,
  .high-score {
    display: flex;
    align-items: center;
    /* ✅ vertical center */
    justify-content: center;
    /* ✅ horizontal center */
    background-color: #19A4EF;
    /* Score वाला light blue */
    color: #fff !important;
    text-align: center;
    width: 130px;
    height: 50px;
    /* ✅ fix height ताकि बराबर दिखे */
    border-radius: 5px;
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 1.2px;
  }

  .high-score {
    background-color: #0A2B50;
    /* Best score वाला dark blue */
  }

}