:root {
  --bg: #111827;
  --panel: #1f2937;
  --fg: #e5e7eb;
  --accent: #60a5fa;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: radial-gradient(circle at top, #1f2937, #0b1020 60%);
  color: var(--fg);
}
.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 12px;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 10px;
}
.hud {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  background: rgba(31, 41, 55, 0.9);
  border: 1px solid #374151;
  border-radius: 10px;
  padding: 8px 10px;
}
.hud button {
  margin-left: auto;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #0b1020;
  font-weight: 700;
}
.game-wrap {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 12px;
}
canvas {
  width: min(100%, 832px);
  height: auto;
  border: 2px solid #334155;
  border-radius: 12px;
  background: #1e293b;
  image-rendering: pixelated;
}
.controls {
  width: min(100%, 460px);
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 60px);
  grid-template-rows: repeat(2, 56px);
  gap: 8px;
}
.dpad button, .bomb-btn {
  border: 0;
  border-radius: 14px;
  background: #334155;
  color: #fff;
  font-size: 22px;
  min-height: 54px;
  touch-action: manipulation;
}
.dpad button[data-dir="up"] { grid-column: 2; }
.dpad button[data-dir="left"] { grid-column: 1; grid-row: 2; }
.dpad button[data-dir="down"] { grid-column: 2; grid-row: 2; }
.dpad button[data-dir="right"] { grid-column: 3; grid-row: 2; }
.bomb-btn {
  flex: 1;
  max-width: 160px;
  font-size: 18px;
  font-weight: 700;
  background: #ef4444;
}
.hint { margin: 0; color: #cbd5e1; font-size: 14px; }

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .controls { display: flex; }
}
