* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #0a0a0a;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

#canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: none;
}

#controls {
  display: none;
}

#mobile-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}

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

.dpad-btn {
  width: 60px;
  height: 60px;
  background: rgba(139, 0, 0, 0.3);
  border: 1px solid rgba(139, 0, 0, 0.5);
  border-radius: 8px;
  color: rgba(232, 163, 23, 0.6);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.dpad-btn:active {
  background: rgba(139, 0, 0, 0.6);
  color: rgba(232, 163, 23, 1);
}

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

@media (pointer: coarse) {
  #mobile-controls {
    display: block;
  }
  #canvas {
    cursor: default;
  }
}

@media (max-width: 600px) {
  #mobile-controls {
    display: block;
  }
  .dpad-btn {
    width: 52px;
    height: 52px;
    font-size: 18px;
  }
}