/* Base styles */
:root {
  /* Light theme (Catppuccin Latte) */
  --primary: #b06161;
  --secondary: #f0dbaf;
  --accent: #7ed7c1;
  --danger: #dc8686;
  --text: #4c4f69;
  --button-text: #333;
  --canvas-bg: #fff;
  --snake-head: #7ed7c1;
  --snake-body: white;
  --snake-border: #b06161;
  --food: #b06161;
  --score-bg: #f0dbaf;
  --game-over-text: #dc8686;
  --overlay: rgba(0, 0, 0, 0.7);
}

.dark-theme {
  /* Dark theme (Catppuccin Macchiato) */
  --primary: #24273a;
  --secondary: #1e2030;
  --accent: #8aadf4;
  --danger: #ed8796;
  --text: #cad3f5;
  --button-text: #181926;
  --canvas-bg: #181926;
  --snake-head: #8bd5ca;
  --snake-body: #363a4f;
  --snake-border: #b7bdf8;
  --food: #f5a97f;
  --score-bg: #1e2030;
  --game-over-text: #ed8796;
  --overlay: rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: var(--primary);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  padding: 20px;
  color: var(--text);
  transition:
    background-color 0.3s,
    color 0.3s;
}

.container {
  width: 100%;
  max-width: 900px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  position: relative;
}

h1 {
  color: white;
  font-size: 2.5rem;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.game-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  background-color: var(--secondary);
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s;
}

canvas {
  background-color: var(--canvas-bg);
  border-radius: 8px;
  display: block;
  max-width: 100%;
  transition: background-color 0.3s;
}

.controls {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  width: 100%;
  justify-content: center;
}

button {
  padding: 12px 24px;
  font-size: 1rem;
  cursor: pointer;
  border: none;
  background-color: var(--accent);
  color: var(--button-text);
  border-radius: 8px;
  font-weight: bold;
  transition: all 0.2s;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button:hover {
  background-color: #6bc3ad;
  transform: translateY(-2px);
}

button:active {
  transform: translateY(1px);
}

.score-container {
  display: flex;
  justify-content: center;
  gap: 30px;
  width: 100%;
  background-color: var(--score-bg);
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s;
}

.score-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 1.4rem;
  font-weight: bold;
  color: var(--text);
  transition: color 0.3s;
}

.score-item span:first-child {
  font-size: 1.1rem;
  margin-bottom: 5px;
}

/* Mobile controls */
.mobile-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  width: 100%;
}

.mobile-controls > div {
  display: flex;
  gap: 50px;
}

.control-button {
  width: 70px; /* Set a fixed width */
  height: 70px; /* Set a fixed height */
  font-size: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%; /* Keep it circular */
  background-color: var(--accent);
  color: var(--button-text);
  aspect-ratio: 1; /* Maintain a 1:1 aspect ratio */
}

@media (max-width: 768px) {
  h1 {
    font-size: 2rem;
  }

  .score-container {
    flex-direction: column;
    gap: 15px;
  }

  .mobile-controls {
    display: flex;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 1.8rem;
  }

  button {
    padding: 10px 20px;
    font-size: 0.9rem;
  }

  .control-button {
    width: 60px; /* Adjust width for mobile */
    height: 60px; /* Adjust height for mobile */
  }
}

.theme-container {
  display: flex;
  justify-content: center;
  gap: 30px;
  width: 100%;
  background-color: var(--score-bg);
  border-radius: 15px;
  padding: 15px;
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s;
}
