* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  font-family: "Press Start 2P", monospace;
  background: radial-gradient(circle at center, #253f70, #121427 70%);
  color: #ffffff;
}

.game-shell {
  position: relative;
  width: min(96vw, 1000px);
}

#game-canvas {
  width: 100%;
  height: auto;
  border: 4px solid #ffffff33;
  border-radius: 12px;
  background: #000;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.overlay-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  padding: 20px;
}

.cheat-console {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, 92%);
  z-index: 50;
  pointer-events: auto;
}

.cheat-console.hidden {
  display: none;
}

.audio-toggle-btn {
  position: absolute;
  top: 56px;
  right: 12px;
  z-index: 70;
  border: 2px solid #b7dcff;
  border-radius: 8px;
  background: #0b142af2;
  color: #ffffff;
  font-family: inherit;
  font-size: 9px;
  line-height: 1;
  padding: 8px 10px;
  cursor: pointer;
}

.audio-toggle-btn.is-muted {
  border-color: #f1b4b4;
  color: #ffd7d7;
  background: #2b1111f0;
}

.audio-toggle-btn:hover {
  transform: translateY(-1px);
}

.cheat-box {
  background: #070b15f5;
  border: 2px solid #9cd0ff;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 0 0 2px #00000055;
}

.cheat-box label {
  display: block;
  font-size: 10px;
  margin-bottom: 8px;
  color: #b3dbff;
}

.cheat-box input {
  width: 100%;
  border: 2px solid #4a7aba;
  background: #0f1930;
  color: #ffffff;
  padding: 8px;
  font-family: inherit;
  font-size: 10px;
  outline: none;
}

.cheat-hint {
  margin-top: 8px;
  font-size: 9px;
  color: #d2ebff;
  min-height: 1.2em;
}

.panel {
  pointer-events: auto;
  width: min(700px, 90%);
  max-height: 84%;
  overflow: auto;
  background: #101322f2;
  border: 3px solid #6fa3ff;
  border-radius: 10px;
  padding: 16px;
  line-height: 1.5;
}

.panel h1,
.panel h2,
.panel h3 {
  margin-top: 0;
}

.panel p,
.panel li,
.panel a,
.panel button {
  font-size: 11px;
}

.panel button {
  margin-top: 12px;
  border: 2px solid #fff;
  background: #2f4676;
  color: #fff;
  padding: 10px 12px;
  cursor: pointer;
  font-family: inherit;
}

.panel button:hover {
  background: #4a68a6;
}

#start-game-btn.is-loading,
#start-game-btn:disabled {
  background: #26395f;
  color: #d4e3ff;
  opacity: 0.92;
  cursor: wait;
  animation: start-btn-pulse 900ms ease-in-out infinite;
}

@keyframes start-btn-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.2);
  }
}

.controls-guide {
  margin-top: 12px;
  border: 1px solid #7ea8df;
  border-radius: 8px;
  padding: 8px 10px;
  background: #0a1324c7;
}

.controls-guide .ctrl-row {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px;
  align-items: start;
  font-size: 8px;
  color: #d5e9ff;
  line-height: 1.5;
}

.controls-guide .ctrl-row + .ctrl-row {
  margin-top: 4px;
}

.controls-guide .ctrl-key {
  color: #9fc8ff;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  border: 1px solid #9fd0ff;
  color: #d9f0ff;
  padding: 4px 6px;
  font-size: 9px;
}

.mobile-controls {
  margin-top: 10px;
  display: none;
  justify-content: space-between;
  gap: 10px;
}

.control-group {
  display: flex;
  gap: 8px;
}

.touch-btn {
  font-family: inherit;
  border: none;
  border-radius: 10px;
  background: #fefefe22;
  color: #fff;
  padding: 10px 12px;
  min-width: 54px;
  min-height: 44px;
}

.touch-btn:active {
  transform: translateY(1px);
  background: #fefefe3a;
}

@media (max-width: 900px),
(pointer: coarse) {
  .audio-toggle-btn {
    top: 52px;
    right: 10px;
    font-size: 8px;
    padding: 7px 9px;
  }

  .mobile-controls {
    display: flex;
  }

  .panel p,
  .panel li,
  .panel a,
  .panel button {
    font-size: 10px;
  }
}