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

body {
  background: #0a0a12;
  overflow: hidden;
  font-family: 'Press Start 2P', monospace;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-wrapper {
  position: relative;
  width: 100%;
  height: calc(100% - 32px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#touch-controls {
  display: none;
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 10;
}

@media (pointer: coarse) {
  #touch-controls {
    display: flex;
    justify-content: space-between;
    padding: 0 16px;
  }
}

#dpad {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 50px 50px 50px;
  grid-template-rows: 50px 50px;
  gap: 4px;
}

#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: 2; }

.dpad-btn, .action-btn {
  pointer-events: auto;
  background: rgba(255,255,255,0.12);
  border: 2px solid rgba(255,255,255,0.25);
  border-radius: 10px;
  color: rgba(255,255,255,0.6);
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-tap-highlight-color: transparent;
}

.dpad-btn:active, .action-btn:active {
  background: rgba(255,255,255,0.3);
}

#action-btns {
  pointer-events: auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.action-btn {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  font-size: 12px;
}

#btn-jump { background: rgba(80,200,80,0.2); border-color: rgba(80,200,80,0.5); }
#btn-interact { background: rgba(80,80,200,0.2); border-color: rgba(80,80,200,0.5); }
#btn-flash { background: rgba(200,200,80,0.2); border-color: rgba(200,200,80,0.5); }

#game-footer {
  height: 32px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: #556;
  background: #0d0d18;
  flex-shrink: 0;
}

#game-footer a {
  color: #4f8;
  text-decoration: none;
}

#game-footer button {
  background: none;
  border: none;
  color: #556;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 4px;
}

#game-footer button:hover {
  color: #aab;
}