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

body {
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
}

#game-wrapper {
  position: relative;
  width: 100%;
  max-width: 800px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#canvas {
  width: 100%;
  max-width: 800px;
  aspect-ratio: 4 / 3;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 3px solid #333;
  border-radius: 2px;
  box-shadow: 0 0 40px rgba(255, 50, 50, 0.15), 0 0 80px rgba(0, 0, 0, 0.8);
}

#mobile-controls {
  display: none;
  width: 100%;
  padding: 10px 20px;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

#dpad {
  display: grid;
  grid-template-areas:
    ". up ."
    "left . right"
    ". down .";
  grid-template-columns: 50px 50px 50px;
  grid-template-rows: 50px 50px 50px;
  gap: 2px;
}

#btn-up { grid-area: up; }
#btn-left { grid-area: left; }
#btn-right { grid-area: right; }
#btn-down { grid-area: down; }

.dpad-btn {
  background: #222;
  border: 2px solid #444;
  color: #ccc;
  font-size: 18px;
  border-radius: 6px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.dpad-btn:active {
  background: #444;
  border-color: #888;
}

#action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.action-btn {
  border: 2px solid #cc3333;
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  line-height: 1.4;
}

.action-btn span {
  font-size: 5px;
  opacity: 0.7;
}

.strike-btn {
  background: #8b0000;
  border-color: #cc3333;
}
.strike-btn:active {
  background: #cc3333;
}

.grapple-btn {
  background: #004488;
  border-color: #3388cc;
}
.grapple-btn:active {
  background: #3388cc;
}

.action-act-btn {
  background: #446600;
  border-color: #66aa00;
}
.action-act-btn:active {
  background: #66aa00;
}

.pin-btn {
  background: #884400;
  border-color: #cc8800;
}
.pin-btn:active {
  background: #cc8800;
}

@media (max-width: 768px) {
  #mobile-controls {
    display: flex;
  }
  #canvas {
    border-width: 2px;
  }
}

@media (max-width: 480px) {
  .dpad-btn {
    font-size: 14px;
  }
  #dpad {
    grid-template-columns: 42px 42px 42px;
    grid-template-rows: 42px 42px 42px;
  }
  .action-btn {
    padding: 10px 10px;
    font-size: 9px;
  }
}

footer {
  margin-top: 12px;
  padding: 8px;
}

footer a {
  color: #666;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  text-decoration: none;
  letter-spacing: 1px;
}

footer a:hover {
  color: #cc3333;
}