:root {
  color-scheme: light;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #f5f5f5;
  color: #1d1d1d;
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem;
}

.hud {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.hud h1 {
  margin: 0;
  font-size: 1.25rem;
}

.hud-meta {
  text-align: right;
}

.hud-meta p {
  margin: 0;
  font-size: 0.95rem;
}

.board {
  --grid-width: 16;
  --grid-height: 16;
  margin-top: 0.75rem;
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(var(--grid-width), 1fr);
  grid-template-rows: repeat(var(--grid-height), 1fr);
  background: #ffffff;
  border: 1px solid #d7d7d7;
}

.cell {
  position: relative;
  border: 1px solid #f1f1f1;
  background: #ffffff;
}

.cell.snake {
  background: #2d6a4f;
}

.cell.head {
  background: #1b4332;
}

.cell.food {
  background: #ffffff;
}

.cell.food::after {
  content: "";
  position: absolute;
  inset: 22% 14%;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ffb3ba 0 14%, #e63946 15% 72%, #b11f2a 73% 100%);
  transform: scaleX(0.78);
}

.controls {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
}

.speed-controls {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.speed-label {
  font-size: 0.95rem;
  font-weight: 600;
}

button {
  border: 1px solid #999;
  background: #ffffff;
  color: inherit;
  font: inherit;
  padding: 0.5rem 0.8rem;
  cursor: pointer;
}

.speed-btn.is-active {
  background: #1b4332;
  border-color: #1b4332;
  color: #ffffff;
}

.mobile-controls {
  margin-top: 0.75rem;
}

.mobile-controls-row {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (min-width: 720px) {
  .mobile-controls {
    display: none;
  }
}
