/* ---------- Snake ---------- */

.stage { justify-content: center; gap: 12px; padding: 8px 10px; }

.scorebar {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 360px;
}
.scorebox {
  flex: 1 1 0;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 6px 4px;
  text-align: center;
}
.scorebox span {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}
.scorebox b {
  display: block;
  font-size: 21px;
  font-weight: 750;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.board-wrap {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

canvas.pit {
  display: block;
  border-radius: var(--r);
  background: var(--bg-2);
  box-shadow: inset 0 0 0 1px var(--line-soft);
  touch-action: none;    /* the swipe steers the snake, it doesn't scroll */
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: var(--r);
  background: rgb(14 16 20 / .82);
  z-index: 5;
  text-align: center;
  padding: 0 20px;
}
.overlay[hidden] { display: none; }
.overlay b { font-size: 25px; font-weight: 800; }
.overlay p { margin: 0; font-size: 14px; color: var(--text-2); }

/* ---------- d-pad ---------- */

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 7px;
  max-width: 260px;
  margin: 0 auto;
}
.dpad button {
  height: 48px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  display: grid;
  place-items: center;
  transition: background .12s, transform .08s;
}
.dpad button:active { background: var(--surface-3); transform: translateY(1px); }
.dpad button svg { width: 22px; height: 22px; }
.dpad .d-up    { grid-column: 2; grid-row: 1; }
.dpad .d-left  { grid-column: 1; grid-row: 2; }
.dpad .d-down  { grid-column: 2; grid-row: 2; }
.dpad .d-right { grid-column: 3; grid-row: 2; }

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