:root {
  --bg: #1c1c1c;
  --panel: #242424;
  --grid: #2f2f2f;
  --snake: #7bd389;
  --snake-head: #52a86e;
  --food: #e86a5c;
  --text: #f2f2f2;
  --muted: #b9b9b9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

.app {
  width: min(92vw, 520px);
  background: var(--panel);
  padding: 20px;
  border-radius: 16px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  display: grid;
  gap: 16px;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.header h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0.02em;
}

.score {
  display: grid;
  gap: 4px;
  text-align: right;
  color: var(--muted);
  font-size: 12px;
}

.score strong {
  font-size: 18px;
  color: var(--text);
}

.board {
  background: var(--grid);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas {
  width: 100%;
  height: auto;
  background: #141414;
  border-radius: 8px;
  display: block;
}

.controls {
  display: flex;
  gap: 12px;
  justify-content: center;
}

button {
  border: none;
  background: #3a3a3a;
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

button:hover {
  background: #4a4a4a;
}

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

.help {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.touch-controls {
  display: none;
  gap: 10px;
  justify-content: center;
  align-items: center;
}

.touch-controls button {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

.touch-row {
  display: flex;
  gap: 10px;
}

@media (max-width: 700px) {
  .touch-controls {
    display: grid;
    justify-items: center;
  }
}
