/* Fullscreen, 9:16 mobile target */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: Arial, Helvetica, sans-serif;
  background: #000;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#boulderdash {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  flex: 1;
}

/* Overlay header: hidden (instructions + level selector) */
#header {
  display: none;
}
#header img {
  cursor: pointer;
  width: 1.5em;
  height: 1.5em;
  opacity: 0.9;
}
#header img.disabled { cursor: default; opacity: 0.4; }
#header img:active { opacity: 0.7; }
#description { flex: 1; font-style: italic; }
#help { color: #8af; text-decoration: none; }

/* On-screen controls: D-pad + action, bottom center */
#controls {
  position: fixed;
  bottom: 2.5em;
  left: 50%;
  transform: translateX(-50%);
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 0.75em;
  pointer-events: none;
}
#controls > * { pointer-events: auto; }

#dpad {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 0.15em;
  width: min(42vw, 160px);
  height: min(42vw, 160px);
  max-width: 160px;
  max-height: 160px;
  pointer-events: none;
}
#dpad button {
  pointer-events: auto;
  border: none;
  border-radius: 0.35em;
  background: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.9);
  font-size: 1.5em;
  line-height: 1;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.3);
}
#dpad button:active {
  background: rgba(255,255,255,0.5);
}
#btn-up   { grid-column: 2; grid-row: 1; }
#btn-left { grid-column: 1; grid-row: 2; }
#btn-right { grid-column: 3; grid-row: 2; }
#btn-down { grid-column: 2; grid-row: 3; }
#btn-up::after   { content: '\2191'; } /* ↑ */
#btn-left::after { content: '\2190'; } /* ← */
#btn-right::after { content: '\2192'; } /* → */
#btn-down::after { content: '\2193'; } /* ↓ */

#btn-action {
  width: min(22vw, 72px);
  height: min(22vw, 72px);
  max-width: 72px;
  max-height: 72px;
  border: none;
  border-radius: 0.35em;
  background: rgba(255,180,80,0.35);
  color: rgba(255,255,255,0.95);
  font-size: clamp(10px, 3vw, 14px);
  font-weight: bold;
  line-height: 1.1;
  padding: 0.2em;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.35);
}
#btn-action:active {
  background: rgba(255,180,80,0.6);
}

#keys {
  display: none;
}

#stats {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 20;
  pointer-events: none;
}

#back { color: #8af; font-size: 10pt; padding-left: 1em; }
#instructions           { padding: 1em; font-size: 12pt; width: 40em; }
#instructions ul li     { padding: 1em 0.5em; list-style-type: none; vertical-align: middle; border-top: 1px solid #CCC; min-height: 2em; }
#instructions ul li img { width: 32px; height: 32px; float: left; margin-right: 8px; border: 2px solid black; }
#instructions #keys li  { min-height: 0; border: 0; padding: 0; margin-left: 2em; list-style-type: disc; }

