/* Scoped to the Snake app; canvas geometry uses attributes, never inline CSS. */
.snake-app {
  box-sizing: border-box;
  container-type: inline-size;
  width: 100%;
  max-width: 660px;
  min-width: 0;
  margin: 0 auto;
  padding: 16px;
  color: #f4e6d2;
  background: #30271f;
  border: 1px solid #816346;
  border-radius: 12px;
  font: 14px/1.45 system-ui, sans-serif;
}
.snake-app *, .snake-app *::before, .snake-app *::after { box-sizing: border-box; }
.snake-header { display: grid; grid-template-columns: 1fr auto; gap: 0 12px; align-items: center; }
.snake-title { margin: 0; font-size: 24px; font-weight: 650; letter-spacing: -.03em; }
.snake-subtitle { grid-column: 1; margin: 0 0 12px; color: #dac3a8; font-size: 13px; }
.snake-scores { grid-column: 2; grid-row: 1 / 3; display: flex; gap: 8px; font-variant-numeric: tabular-nums; }
.snake-player-score, .snake-ai-score { padding: 7px 10px; border: 1px solid #816346; border-radius: 6px; font-weight: 650; white-space: nowrap; }
.snake-player-score { color: #f2bd78; }
.snake-ai-score { color: #a9d8dd; border-style: dashed; }
.snake-toolbar { display: flex; gap: 12px; justify-content: space-between; align-items: end; margin-bottom: 12px; }
.snake-app button, .snake-app select {
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 8px 14px;
  border: 1px solid #a1805c;
  border-radius: 6px;
  color: #f4e6d2;
  background: #49382b;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.snake-app .snake-start { color: #202321; background: #f2bd78; border-color: #f2bd78; font-weight: 700; min-width: 88px; }
.snake-difficulty-label { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.snake-app select { padding-right: 8px; }
.snake-app button:hover:enabled, .snake-app select:hover:enabled { border-color: #ffd65a; }
.snake-app button:disabled, .snake-app select:disabled { opacity: .6; cursor: default; }
.snake-app :focus-visible { outline: 3px solid #ffd65a; outline-offset: 3px; }
.snake-board { display: block; width: 100%; height: auto; aspect-ratio: 1; background: #202321; border: 2px solid #a1805c; border-radius: 3px; touch-action: none; }
.snake-status { min-height: 21px; margin: 10px 0 8px; font-size: 13px; }
.snake-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; padding: 0; list-style: none; font-size: 12px; }
.snake-key-player { color: #f2bd78; }
.snake-key-ai { color: #a9d8dd; }
.snake-key-common { color: #b9df87; }
.snake-key-rare { color: #ffd65a; }
.snake-directions { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(2, 44px); gap: 4px; justify-content: center; margin: 12px 0 8px; }
.snake-app .snake-direction { padding: 4px; font-size: 23px; line-height: 1; }
.snake-direction-up { grid-column: 2; grid-row: 1; }
.snake-direction-left { grid-column: 1; grid-row: 2; }
.snake-direction-down { grid-column: 2; grid-row: 2; }
.snake-direction-right { grid-column: 3; grid-row: 2; }
.snake-help { margin: 0; color: #dac3a8; font-size: 12px; }
@container (max-width: 320px) {
  .snake-scores { gap: 4px; }
  .snake-player-score, .snake-ai-score { padding: 6px; }
  .snake-difficulty-label { gap: 4px; }
}
/* No animation, transitions or pulsing, including with reduced motion. */

/* The window supplies both dimensions; the board fits its remaining square. */
.app-snake .window-body { display: flex; padding: 12px; overflow: hidden; }
.app-snake .snake-app { display: grid; grid-template-columns: minmax(0, 1fr) 176px; grid-template-rows: auto auto minmax(21px, 1fr) auto auto auto; gap: 8px 14px; height: 100%; max-width: none; padding: 10px; min-height: 0; }
.app-snake .snake-header { grid-column: 1 / -1; grid-row: 1; }
.app-snake .snake-title { font-size: 22px; line-height: 1.2; margin: 0; }
.app-snake .snake-subtitle { margin: 0; line-height: 1.4; font-size: 12px; }
.snake-playfield { grid-column: 1; grid-row: 2 / 6; container-type: size; min-width: 0; min-height: 0; display: grid; place-items: center; }
.snake-playfield .snake-board { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); }
.app-snake .snake-toolbar { grid-column: 2; grid-row: 2; flex-wrap: wrap; gap: 8px; margin: 0; }
.app-snake .snake-difficulty-label { white-space: nowrap; flex: none; }
.app-snake .snake-difficulty { width: auto; }
.app-snake .snake-status { grid-column: 2; grid-row: 3; margin: 0; font-size: 13px; line-height: 1.4; }
.app-snake .snake-legend { grid-column: 2; grid-row: 4; gap: 3px 8px; font-size: 11px; }
.app-snake .snake-directions { grid-column: 2; grid-row: 5; margin: 0; }
.app-snake .snake-help { grid-column: 1 / -1; grid-row: 6; margin: 0; font-size: 11px; line-height: 1.3; }
@container (max-width: 500px) {
 .app-snake .snake-app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto minmax(0, 1fr) auto auto auto; padding: 8px; gap: 6px; }
 .app-snake .snake-header { grid-row: 1; }
 .app-snake .snake-subtitle { display: none; }
 .app-snake .snake-toolbar { grid-column: 1; grid-row: 2; flex-wrap: nowrap; }
 .snake-playfield { grid-column: 1; grid-row: 3; }
 .app-snake .snake-status { grid-column: 1; grid-row: 4; }
 .app-snake .snake-legend { grid-column: 1; grid-row: 5; }
 .app-snake .snake-directions { grid-column: 1; grid-row: 6; grid-template-columns: repeat(4,44px); grid-template-rows: 44px; gap: 4px; }
 .app-snake .snake-direction { grid-column: auto; grid-row: auto; }
 .app-snake .snake-help { display: none; }
}
