:root {
  color-scheme: light;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  background: #eef3fb;
  color: #14213d;
  --panel: rgba(255, 249, 230, 0.9);
  --border: #184a96;
  --grid: #aac5f4;
  --cell: rgba(255, 255, 255, 0.82);
  --snake: #1e63d2;
  --snake-head: #f4c514;
  --accent: #2954a3;
  --accent-soft: #fff0a8;
  --shadow: rgba(20, 33, 61, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.9), transparent 35%),
    linear-gradient(180deg, #1d63cf 0 50%, #f5d23c 50% 100%);
}

.app {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.panel {
  width: min(100%, 540px);
  background: var(--panel);
  border: 3px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 18px 45px var(--shadow);
  backdrop-filter: blur(8px);
  padding: 24px;
}

.panel__header,
.panel__actions,
.controls__row {
  display: flex;
  align-items: center;
}

.panel__header,
.panel__actions {
  justify-content: space-between;
  gap: 12px;
}

.panel__actions {
  margin: 16px 0 12px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1;
}

.scoreboard {
  min-width: 96px;
  text-align: right;
}

.scoreboard span {
  display: block;
  font-size: 0.85rem;
  color: var(--accent);
}

.scoreboard strong {
  font-size: 2rem;
}

button {
  border: 2px solid var(--border);
  border-radius: 999px;
  background: linear-gradient(180deg, #fff7cc, #f6da57);
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(24, 74, 150, 0.14);
}

button:hover,
button:focus-visible {
  background: linear-gradient(180deg, #fff2b6, #efcb2b);
}

.status {
  min-height: 1.5em;
  margin: 0 0 16px;
  color: var(--accent);
  font-weight: 700;
}

.board {
  display: grid;
  grid-template-columns: repeat(16, minmax(0, 1fr));
  gap: 2px;
  aspect-ratio: 1;
  background: var(--grid);
  border: 3px solid var(--border);
  border-radius: 20px;
  padding: 8px;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.45);
}

.cell {
  background: var(--cell);
  border-radius: 4px;
}

.cell--snake {
  background: linear-gradient(180deg, #3d84ed 0 50%, #ffd949 50% 100%);
}

.cell--head {
  background: linear-gradient(135deg, #ffe067, #f4c514);
  box-shadow: inset 0 0 0 2px rgba(20, 33, 61, 0.1);
}

.cell--food {
  box-shadow: inset 0 0 0 2px rgba(20, 33, 61, 0.12);
}

.cell--food-blue {
  background: #2563eb;
}

.cell--food-white {
  background: #ffffff;
  box-shadow:
    inset 0 0 0 2px #184a96,
    0 0 0 1px rgba(255, 255, 255, 0.9);
}

.cell--food-red {
  background: #dc2626;
}

.instructions {
  margin-top: 14px;
  color: var(--accent);
  font-weight: 600;
}

.controls {
  margin-top: 16px;
  display: grid;
  justify-content: center;
  justify-items: center;
  gap: 12px;
}

.controls > button,
.controls__row > button {
  width: 64px;
  height: 64px;
  padding: 0;
}

.controls__row {
  gap: 12px;
}

.controls > button {
  margin-bottom: -2px;
}

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