/* Snake game styles. snake.js sets the board colours for the chosen palette; the rest follows the site theme. */
:root {
  --snake-lcd: #c2d09c;
  --snake-ink: #1c2514;
  --snake-food: #e0457b;
}

.snake-game [hidden] { display: none !important; }

/* Score row, with the full-screen button at its corner. */
.snake-top { display: flex; align-items: stretch; gap: 12px; margin-bottom: 14px; }
.snake-stats { flex: 1; min-width: 0; grid-template-columns: 1fr 1fr; margin: 0; }
.snake-fs { flex: none; width: 56px; padding: 0; display: grid; place-items: center; }
.snake-fs svg { width: 22px; height: 22px; }

/* Chip rows for mode, settings and colours. */
.snake-choices { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.snake-choices .chip { font-size: 15px; }
.snake-choices .chip i { box-shadow: 0 0 0 1px var(--line); }
.snake-modes { margin-bottom: 14px; }

.snake-screen {
  position: relative;
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  border-radius: 10px;
  overflow: hidden;
  background: var(--snake-lcd);
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--snake-ink) 35%, transparent);
}
.snake-screen canvas { display: block; width: 100%; height: auto; aspect-ratio: 1 / 1; touch-action: none; }

.snake-veil {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  text-align: center;
  color: var(--snake-ink);
  background: color-mix(in srgb, var(--snake-lcd) 88%, transparent);
}
.snake-veil[hidden] { display: none; }

/* Floating pause button — top-right corner of the board, visible during play and pause. */
.snake-pause-float {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 20;
  width: 40px;
  height: 40px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--snake-ink) 60%, transparent);
  color: var(--snake-lcd);
  border: none;
  border-radius: 8px;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  opacity: 0.7;
  transition: opacity 0.15s;
}
.snake-pause-float:hover, .snake-pause-float:focus-visible { opacity: 1; }
.snake-pause-float[hidden] { display: none; }
.snake-veil h2 { font-size: clamp(30px, 6vw, 40px); }
.snake-veil p { margin: 0; max-width: 28ch; font-size: 16px; }

/* Arrow buttons: snake.js sets data-pad="on" only on touch screens with the setting switched on. */
.snake-pad {
  display: none;
  width: min(300px, 100%);
  margin: 18px auto 0;
  grid-template-columns: repeat(3, 1fr);
  grid-template-areas: ". up ." "left . right" ". down .";
  gap: 10px;
}
.snake-game[data-pad="on"] .snake-pad { display: grid; }
.snake-pad .btn {
  height: 74px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
  display: grid;
  place-items: center;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.snake-pad [data-dir="up"] { grid-area: up; }
.snake-pad [data-dir="down"] { grid-area: down; }
.snake-pad [data-dir="left"] { grid-area: left; }
.snake-pad [data-dir="right"] { grid-area: right; }

.snake-actions { justify-content: center; margin-top: 14px; }
.snake-actions .btn { min-width: 96px; }

.snake-settings {
  display: grid;
  gap: 16px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.snake-set .snake-choices { justify-content: flex-start; }

/* Full screen (native, or the fill fallback on phones): the panel covers the screen and the board fits above the arrows. */
.snake-game:fullscreen, .snake-game.is-fill { margin: 0; border: 0; border-radius: 0; box-shadow: none; overflow: auto; }
.snake-game.is-fill { position: fixed; inset: 0; z-index: 2000; height: 100vh; height: 100dvh; box-sizing: border-box; }
.snake-game:fullscreen .snake-screen, .snake-game.is-fill .snake-screen { max-width: min(560px, max(200px, calc(100dvh - 330px))); }
.snake-game:fullscreen .snake-pad .btn, .snake-game.is-fill .snake-pad .btn { height: 60px; }
