* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0000;
  font-family: 'MedievalSharp', cursive;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: fixed;
  top: 0;
  left: 0;
}

footer {
  position: fixed;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  opacity: 0.3;
}

footer a {
  color: #aa4422;
  text-decoration: none;
  font-size: 11px;
  font-family: 'MedievalSharp', cursive;
}

footer a:hover {
  opacity: 1;
}

#mobile-controls {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 180px;
  z-index: 50;
  pointer-events: none;
}

#joystick-area {
  position: absolute;
  left: 20px;
  bottom: 30px;
  pointer-events: auto;
}

#joystick-base {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255,100,50,0.15);
  border: 2px solid rgba(255,100,50,0.3);
  position: relative;
}

#joystick-stick {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,150,50,0.4);
  border: 2px solid rgba(255,200,100,0.5);
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: none;
}

#attack-buttons {
  position: absolute;
  right: 15px;
  bottom: 25px;
  display: grid;
  grid-template-columns: repeat(3, 55px);
  grid-template-rows: repeat(2, 55px);
  gap: 6px;
  pointer-events: auto;
}

.atk-btn {
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: rgba(180,40,20,0.3);
  border: 2px solid rgba(255,100,50,0.4);
  color: white;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.atk-btn:active {
  background: rgba(255,100,50,0.5);
  transform: scale(0.9);
}

@media (max-width: 900px), (pointer: coarse) {
  #mobile-controls {
    display: block;
  }
}