:root {
  --orange: #d97757;
  --navy: #141413;
  --cream: #faf9f5;
  --green: #788c5d;
  --blue: #6a9bcc;
  --gray: #b0aea5;
  --light-gray: #e8e6dc;
  --red: #c1574b;
}

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

body {
  background: var(--navy);
  color: var(--cream);
  font-family: 'VT323', monospace;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  /* Mobile: prevent pull-to-refresh and overscroll bounce while playing */
  overscroll-behavior: contain;
  -webkit-tap-highlight-color: transparent;
}
/* Canvas: own all touch input — no pinch/zoom/scroll interference */
#game {
  touch-action: none;
}

.game-shell {
  width: 100%;
  max-width: 840px;
}

.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding: 1rem;
  background: rgba(176, 174, 165, 0.06);
  border: 1px solid var(--gray);
  border-radius: 8px;
}

.back-link {
  color: var(--gray);
  text-decoration: none;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
}

h1 {
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.8rem, 3vw, 1.2rem);
  color: var(--cream);
  text-align: center;
  flex: 1;
}

.score-box {
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  color: var(--cream);
  text-align: right;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

#game {
  width: 100%;
  height: auto;
  display: block;
  background: var(--cream);
  border: 2px solid var(--gray);
  border-radius: 8px;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.controls {
  margin-top: 1rem;
  text-align: center;
  font-size: 1.2rem;
  color: var(--gray);
}

.controls button {
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--gray);
  border-radius: 4px;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.7rem;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.controls button:hover {
  background: var(--cream);
  color: var(--navy);
}

.hidden { display: none; }

.game-footer {
  margin-top: 2rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--gray);
}
