* { box-sizing: border-box; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f6f7fb;
  margin: 0;
  padding: 16px;
  color: #1f2330;
}
.wrap { max-width: 420px; margin: 0 auto; text-align: center; }
.status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
  font-size: 16px;
}
#newbtn {
  background: #4f46e5; color: white; border: 0; padding: 8px 14px;
  border-radius: 6px; cursor: pointer;
}
#newbtn:hover { background: #4338ca; }
#board {
  background: #1f2330;
  border-radius: 6px;
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;
  margin: 0 auto;
  touch-action: none;
}
#board:focus { outline: 2px solid #4f46e5; }
.hint { color: #6b7280; font-size: 13px; margin-top: 8px; }
.result {
  margin-top: 16px;
  padding: 12px;
  background: #fee2e2;
  color: #991b1b;
  border-radius: 6px;
  font-size: 18px;
  font-weight: 600;
}
.result.hidden { display: none; }

/* On-screen D-pad — visible on small screens only. Swipe still works. */
.game-controls {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 0 4px;
}
.game-controls .dpad-row {
  display: flex;
  gap: 8px;
}
.game-controls button {
  width: 60px; height: 60px;
  border-radius: 12px;
  border: 0;
  background: rgba(31, 35, 48, 0.92);
  color: #f6f7fb;
  font-size: 24px;
  font-weight: bold;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  cursor: pointer;
}
.game-controls button:active { transform: scale(0.96); background: #4f46e5; }
@media (max-width: 768px) { .game-controls { display: flex; } }
