* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: #fff; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
body { display: flex; flex-direction: column; align-items: center; justify-content: center; font-family: "DotGothic16", "Noto Sans TC", sans-serif; }
#wrap { flex: 1; width: 100%; display: flex; align-items: center; justify-content: center; min-height: 0; }
#screen { position: relative; width: 256px; height: 240px; background: #000; }
#screen canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#game { image-rendering: pixelated; image-rendering: crisp-edges; }
#gl { display: none; }
#help { color: #777; font-size: 12px; padding: 4px 8px 8px; text-align: center; }
#pad { display: none; width: 100%; justify-content: space-between; align-items: center; padding: 6px 18px 14px; }
#pad button { background: rgba(255,255,255,.12); color: #fff; border: 2px solid rgba(255,255,255,.35); border-radius: 10px; font: inherit; font-size: 20px; touch-action: none; }
#pad button.on { background: rgba(255,224,128,.4); }
.dpad { display: grid; grid-template-columns: 52px 52px 52px; grid-template-rows: 52px 52px 52px; }
.dpad [data-k="up"] { grid-column: 2; grid-row: 1; } .dpad [data-k="left"] { grid-column: 1; grid-row: 2; } .dpad [data-k="right"] { grid-column: 3; grid-row: 2; } .dpad [data-k="down"] { grid-column: 2; grid-row: 3; }
.ab { display: flex; gap: 14px; align-items: center; }
.ab button { width: 64px; height: 64px; border-radius: 50%; font-size: 22px; }
.ab .a { background: rgba(255,90,90,.35); margin-bottom: 24px; }
@media (pointer: coarse), (max-width: 760px) {
  #pad { display: flex; }
  #help { display: none; }
}
