* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #1c2740 0%, #0d1220 100%);
  color: #f2f2f2;
  font-family: "Courier New", Courier, monospace;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#game-wrap {
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

h1 {
  margin: 4px 0;
  font-size: 1.6rem;
  letter-spacing: 2px;
  text-shadow: 2px 2px 0 #000;
}

#hud {
  display: flex;
  gap: 24px;
  width: 100%;
  max-width: 960px;
  justify-content: space-between;
  font-size: 1rem;
  background: #10182c;
  border: 2px solid #3a4a78;
  border-radius: 6px;
  padding: 8px 16px;
}

#canvas-holder {
  position: relative;
  width: 100%;
  max-width: 960px;
  aspect-ratio: 960 / 540;
}

canvas#game {
  width: 100%;
  height: 100%;
  display: block;
  background: #5c94fc;
  border: 3px solid #0d1220;
  border-radius: 4px;
  image-rendering: pixelated;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(8, 12, 24, 0.86);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 16px;
}

.overlay.hidden {
  display: none;
}

.overlay h2 {
  margin: 0;
  font-size: 1.8rem;
  text-shadow: 2px 2px 0 #000;
}

.overlay p {
  margin: 0;
  max-width: 420px;
}

.overlay .controls {
  color: #ffd166;
  font-size: 0.85rem;
}

button {
  font-family: inherit;
  font-size: 1rem;
  padding: 10px 22px;
  border: 2px solid #0d1220;
  border-radius: 4px;
  background: #ffcc33;
  color: #1c1400;
  cursor: pointer;
  font-weight: bold;
}

button:hover {
  background: #ffe08a;
}

button:active {
  transform: translateY(1px);
}

#touch-controls {
  display: none;
  width: 100%;
  max-width: 960px;
  justify-content: space-between;
  gap: 10px;
}

.touch-btn {
  flex: 1;
  padding: 16px 0;
  font-size: 1.2rem;
  background: #3a4a78;
  color: #fff;
  border: 2px solid #0d1220;
  border-radius: 6px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.touch-btn.wide {
  flex: 2;
}

@media (hover: none) and (pointer: coarse) {
  #touch-controls {
    display: flex;
  }
}
