html, body { height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at 50% 32%, #073419, #020903 68%);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  overflow: hidden;
  font-family: monospace;
}
#game-wrapper {
  position: relative;
  flex-shrink: 0;
}
#controls-panel {
  width: 220px;
  background: rgba(0, 20, 10, 0.8);
  border: 2px solid #00a854;
  padding: 20px;
  color: #83e8ab;
  box-shadow: 0 0 15px rgba(0, 168, 84, 0.3);
  display: flex;
  flex-direction: column;
  gap: 15px;
  flex-shrink: 1;
}
#controls-panel h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  text-align: center;
  border-bottom: 1px solid #00a854;
  padding-bottom: 10px;
}
#ctrl-mode {
  font-size: 12px;
  text-align: center;
  margin-bottom: 10px;
  color: #fff;
}
.ctrl-item {
  display: grid;
  grid-template-columns: 80px 1fr;
  align-items: center;
  gap: 15px;
  margin-bottom: 10px;
}
.ctrl-item img {
  width: 80px;
  height: auto;
  justify-self: center;
}
.ctrl-item img.mouse-ctrl {
  width: 40px;
}
.ctrl-item span {
  font-size: 16px;
  font-weight: bold;
}
.back-link {
  position: fixed;
  top: 14px;
  left: 18px;
  z-index: 20;
  color: #83e8ab;
  background: #041b0d;
  border: 1px solid #00a854;
  padding: 8px 10px;
  text-decoration: none;
  font-size: 10px;
  letter-spacing: .08em;
}
.back-link:hover, .back-link:focus-visible {
  color: #001608;
  background: #00f078;
  outline: none;
}

@media (max-width: 1200px) {
  body {
    flex-wrap: wrap;
  }
}

canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
#death-overlay {
  position: absolute;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
#death-modal {
  background: #000;
  border: 4px double #0f0;
  padding: 30px;
  color: #0f0;
  text-align: center;
  box-shadow: 0 0 20px #0f0;
  max-width: 400px;
  width: 90%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
#death-modal h1 { font-size: 64px; margin-bottom: 20px; color: #f00; text-shadow: 2px 2px #000; }
#death-modal input {
  background: #000; border: 2px solid #0f0; color: #0f0;
  padding: 10px; font-family: monospace; font-size: 20px;
  text-align: center; margin: 10px 0; outline: none;
}
#death-modal button {
  background: #000; color: #0f0; border: 2px solid #0f0;
  padding: 10px 20px; font-family: monospace; font-size: 20px;
  cursor: pointer; font-weight: bold; margin: 5px;
}
#death-modal button:hover { background: #050; color: #fff; }
#leaderboard {
  margin: 20px 0;
  font-size: 20px;
  width: 100%;
}
#leaderboard ul { list-style: none; padding: 0; margin: 0; }
#leaderboard li { 
  display: flex; justify-content: space-between; 
  border-bottom: 1px solid #050; padding: 5px 0; 
}
