:root {
  --bg: #0f1419;
  --panel: #161b22;
  --grid: #1c2230;
  --accent: #3fb950;
  --accent-dim: #2ea043;
  --food: #f85149;
  --text: #e6edf3;
  --muted: #7d8590;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
  /* Kill pull-to-refresh and scroll-chaining so a downward swipe steers the
     snake instead of refreshing the page. */
  overscroll-behavior: none;
}

.wrap {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px;
}

.bar {
  width: min(400px, 92vw);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bar h1 { font-size: 20px; font-weight: 700; letter-spacing: 0.5px; }

.scores { display: flex; gap: 14px; }
.score { font-size: 13px; color: var(--muted); }
.score strong { color: var(--text); margin-left: 4px; }

.board {
  position: relative;
  width: min(400px, 92vw);
  aspect-ratio: 1 / 1;
  border: 2px solid var(--grid);
  border-radius: 10px;
  overflow: hidden;
  background: var(--panel);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  /* The game handles all touch gestures on the canvas; tell the browser not to
     pan/zoom/refresh so swipes register as steering. */
  touch-action: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: rgba(15, 20, 25, 0.82);
  text-align: center;
  padding: 16px;
  cursor: pointer;
  transition: opacity 0.15s ease;
}

.overlay.hidden { opacity: 0; pointer-events: none; }
#overlay-title { font-size: 26px; font-weight: 700; }
#overlay-sub { font-size: 14px; color: var(--muted); }

.hint {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  max-width: 400px;
}

.foot { font-size: 11px; }

/* Return to games list */
.home {
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 14px; line-height: 1; color: var(--text);
  border: 1px solid var(--grid); border-radius: 8px; padding: 4px 7px;
}
.home:hover { border-color: var(--accent); }
