* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background-color: hsl(220, 13%, 9%);
  color: white;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}

.header {
  text-align: center;
  margin-bottom: 1rem;
}

.title {
  font-size: 2.5rem;
  font-weight: bold;
  color: hsl(48, 100%, 67%);
  text-shadow: 0 0 20px hsl(48, 100%, 67%);
}

.instructions {
  color: hsl(220, 9%, 65%);
  font-size: 1rem;
}

.stats-container {
  display: flex;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background-color: hsl(220, 13%, 12%);
  padding: 1.5rem 2rem;
  border-radius: 0.5rem;
  border: 1px solid hsl(221, 83%, 53%);
  text-align: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.stat-label {
  font-size: 0.875rem;
  color: hsl(220, 9%, 65%);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: bold;
  color: hsl(48, 100%, 67%);
}

.stat-value.level {
  color: hsl(221, 83%, 53%);
}

.stat-value.win {
  color: hsl(48, 100%, 67%);
}

.stat-value.game-over {
  color: hsl(0, 100%, 60%);
}

.game-board-container {
  border: 2px solid hsl(221, 83%, 53%);
  border-radius: 0.5rem;
  padding: 0.5rem;
  background-color: hsl(220, 13%, 12%);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.game-board {
  display: grid;
  grid-template-columns: repeat(20, 1fr);
}

.cell {
  width: 1.5rem;
  height: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell.wall {
  background-color: hsl(221, 83%, 53%);
  border: 1px solid hsl(221, 83%, 53%);
}

.cell.empty {
  background-color: hsl(220, 13%, 9%);
}

.dot {
  width: 0.375rem;
  height: 0.375rem;
  background: white;
  border-radius: 50%;
  animation: pulse 2s ease-in-out infinite;
}

.pacman {
  width: 1.25rem;
  height: 1.25rem;
  background-color: hsl(48, 100%, 67%);
  border-radius: 50%;
  border: 2px solid hsla(48, 100%, 67%, 0.2);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.restart-container {
  margin-top: 1.5rem;
  text-align: center;
}

.restart-button {
  background-color: hsl(48, 100%, 67%);
  color: black;
  padding: 0.75rem 2rem;
  font-size: 1.1rem;
  border: none;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: bold;
  transition: 0.3s;
}

.restart-button:hover {
  background-color: hsl(48, 100%, 60%);
}

.mobile-controls {
  display: none;
  margin-top: 1rem;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.middle-row {
  display: flex;
  gap: 0.5rem;
}

.control-btn {
  background: hsl(221, 83%, 53%);
  color: white;
  font-size: 1.5rem;
  padding: 1rem;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: 0.3s;
}

.control-btn:active {
  background: hsl(221, 100%, 60%);
}

@media (max-width: 768px) {
  .mobile-controls {
    display: flex;
  }

  .cell {
    width: 1rem;
    height: 1rem;
  }

  .pacman {
    width: 0.8rem;
    height: 0.8rem;
  }

  .dot {
    width: 0.2rem;
    height: 0.2rem;
  }

  .game-board-container {
    transform: scale(0.8); /* Shrinks the entire board */
    transform-origin: top center;
  }

  .title {
    font-size: 2rem;
  }

  .stats-container {
    
    gap: 1rem;
  }

  .stat-card {
    padding: 1rem 1.5rem;
  }

  .restart-button {
    font-size: 1rem;
    padding: 0.6rem 1.5rem;
  }
}

