@import url(fonts/clear-sans.css);

/* Snake — Combo Edition. Mobile-first: canvas scales to viewport, D-pad for touch. */

html, body { margin: 0; background: #faf8ef; color: #776e65; font-family: "Clear Sans", "Helvetica Neue", Arial, sans-serif; font-size: 18px; }

.container { width: 100%; max-width: 520px; margin: 0 auto; padding: 20px 20px 80px; box-sizing: border-box; }

.heading { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; }
.title { font-size: 56px; margin: 0; color: #776e65; line-height: 1; }
.title-accent { color: #e8834a; }
.tagline { color: #a0948a; font-size: 16px; }

.scores-container { display: flex; gap: 6px; }
.score-container, .best-container {
  background: #bbada0; padding: 6px 12px; border-radius: 4px;
  color: #f9f6f2; font-weight: 700; font-size: 20px; min-width: 44px; text-align: center; position: relative; }
.best-container { background: #d8cdc4; }
.score-addition { position: absolute; top: -6px; right: -2px; color: #e8834a; font-size: 14px; font-weight: 700; opacity: 0; transition: opacity 200ms; }
.score-addition.show { opacity: 1; }

.above-game { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.game-intro { margin: 0; font-size: 14px; color: #a0948a; line-height: 1.4; }
.restart-button {
  background: #8f7a66; color: #f9f6f2; border: none; border-radius: 4px;
  padding: 8px 14px; font-weight: 700; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.restart-button:hover { background: #9f8b77; }
.restart-button:focus-visible { outline: 3px solid #f2b179; }

/* stats bar (shared language with 2048) */
.stats-bar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  background: #fdfbf7; border: 2px solid #eee4da; border-radius: 8px;
  padding: 8px 10px; margin-bottom: 12px; }
.stat { text-align: center; }
.stat-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; color: #a0948a; }
.stat-value { display: block; font-size: 18px; font-weight: 700; color: #776e65; }

/* game board */
.game-container { position: relative; }
.snake-canvas { width: 100%; aspect-ratio: 1; display: block; border-radius: 8px; touch-action: none; }

/* message overlay */
.game-message {
  position: absolute; inset: 0; z-index: 5; background: rgba(238, 228, 218, 0.73);
  border-radius: 8px; display: none; text-align: center; }
.game-message.visible { display: block; }
.game-message p { margin-top: 30%; font-size: 40px; font-weight: 700; color: #776e65; }
.game-message .lower { margin-top: 20px; }
.game-message .lower a {
  display: inline-block; background: #8f7a66; color: #f9f6f2; border-radius: 3px;
  padding: 0 18px; height: 40px; line-height: 40px; text-decoration: none; font-weight: 700; margin: 0 4px; }
.game-message .lower a.lb-cta-button { background: #e8834a; }

/* D-pad (mobile) */
.dpad {
  display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 56px);
  gap: 6px; justify-content: center; margin: 14px auto 0; }
.dpad-btn {
  background: #eee4da; border: none; border-radius: 8px; font-size: 18px; color: #776e65;
  cursor: pointer; display: flex; align-items: center; justify-content: center; }
.dpad-btn:active { background: #d8cdc4; }
.dpad-btn:focus-visible { outline: 3px solid #f2b179; }
.dpad-up { grid-column: 2; grid-row: 1; }
.dpad-left { grid-column: 1; grid-row: 2; }
.dpad-down { grid-column: 2; grid-row: 2; }
.dpad-right { grid-column: 3; grid-row: 2; }

@media (min-width: 641px) {
  .dpad { display: none; } /* desktop uses arrow keys */
}

.game-credit { margin-top: 12px; font-size: 12px; color: #a0948a; text-align: center; }
.game-credit a { color: #776e65; font-weight: bold; }
.game-explanation { font-size: 14px; line-height: 1.5; color: #776e65; }
