* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #1a1a2e;
  overflow: hidden;
}

.game-container {
  position: relative;
  width: 90vmin;
  max-width: 600px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.game-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.score-container,
.high-score-container {
  color: white;
  font-size: 1.2rem;
  font-weight: 600;
}

.game-board {
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  position: relative;
}

.snake {
  position: absolute;
  background: #4ecca3;
  border-radius: 0%;
  z-index: 2;
  transition: all 0.1s linear;
}

.snake-head {
  background: #2c9c7a;
  z-index: 3;
}

.food {
  position: absolute;
  background: #e84545;
  border-radius: 50%;
  z-index: 1;
  box-shadow: 0 0 15px rgba(232, 69, 69, 0.8);
}

.controls {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.control-btn {
  flex: 1;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: white;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  justify-content: center;
  align-items: center;
}

.control-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.control-btn:active {
  transform: scale(0.95);
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10;
  color: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.overlay.active {
  opacity: 1;
  pointer-events: all;
}

.overlay h2 {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.overlay p {
  font-size: 1.2rem;
  margin-bottom: 25px;
}

.start-btn {
  padding: 12px 24px;
  background: #4ecca3;
  border: none;
  border-radius: 8px;
  color: #1a1a2e;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
}

.start-btn:hover {
  background: #2c9c7a;
  transform: translateY(-2px);
}

.start-btn:active {
  transform: translateY(0);
}

@media screen and (max-width: 600px) {
  .game-header {
    padding: 10px;
  }

  .control-btn {
    padding: 10px;
    font-size: 1rem;
  }
}

/* Animations */
@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }

  100% {
    transform: scale(1);
  }
}

.food {
  animation: pulse 1s infinite;
}

.game-over {
  animation: shake 0.5s;
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-10px);
  }

  50% {
    transform: translateX(10px);
  }

  75% {
    transform: translateX(-10px);
  }

  100% {
    transform: translateX(0);
  }
}

/* Navbar */
.navbar {
  width: 100%;
  position: absolute;
  top: 0;
  left: 0;
  background-color: transparent;
  padding: 15px;
  display: flex;
  justify-content: flex-start;
}

/* Back Button */
.back-button {
  background: #2867f0;
  color: white;
  border: none;
  /* padding: 0.8rem 20px; */
  width: 4rem;
  height: 2.5rem;
  font-size: 16px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.back-button:hover {
  background: #0190f6;
  transform: scale(1.05);
}

.toggle-btn {
  position: fixed;
  top: 0;
  right: 30px;
  color: white;
  border: none;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  font-size: 30px;
  cursor: pointer;
  transition: 0.3s;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Toggle theme style */
#toggleTheme {
  background: transparent;
  box-shadow: none;
  position: absolute;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Click animation (subtle scaling effect) */
#toggleTheme:active {
  transform: scale(0.9);
  opacity: 0.7;
}

/* Dark mode effect */
.dark-mode #toggleTheme {
  background: transparent;
  box-shadow: none;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Click animation in dark mode */
.dark-mode #toggleTheme:active {
  transform: scale(0.9);
  opacity: 0.7;
}

.toggle-btn:hover {
  background: #0056b3;
}

body.dark-mode {
  background: #121212;
  color: #fff;
}

.dark-mode .game-container {
  background: #2A2A2A;
}

.dark-mode .game-container h2,
.dark-mode .timer {
  text-shadow: none;
}

.dark-mode .game-container button {
  color: #1e1e1e;
}

.dark-mode .game-container button:hover {
  background-color: #121212;
  color: #fff;
}
