* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #000;
  color: #fff;
  font-family: 'Courier New', 'Consolas', monospace;
  height: 100%;
  overflow-x: hidden;
}

#wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100%;
  padding: 10px 8px 24px;
}

h1 {
  color: #ffd23f;
  letter-spacing: 4px;
  text-shadow: 0 0 10px #ffd23f88;
  margin: 4px 0 10px;
  font-size: clamp(20px, 5vw, 34px);
}

#hud {
  display: flex;
  gap: 18px;
  margin-bottom: 8px;
  font-size: 12px;
  text-align: center;
  flex-wrap: wrap;
  justify-content: center;
}

#hud .hud-item {
  color: #9fdcff;
  line-height: 1.4;
}

#hud span {
  color: #fff;
  font-size: 16px;
  font-weight: bold;
}

#stage {
  position: relative;
  border: 3px solid #2233ff;
  border-radius: 6px;
  box-shadow: 0 0 18px #2233ffaa, inset 0 0 12px #0a0a3a;
  background: #000;
  max-width: 96vw;
}

canvas#game {
  display: block;
  image-rendering: pixelated;
  max-width: 96vw;
  height: auto;
}

.overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 4px;
}

.overlay.hidden { display: none; }

.panel {
  padding: 16px 22px;
  max-width: 90%;
}

.panel h2 {
  color: #ffd23f;
  font-size: clamp(18px, 4vw, 28px);
  margin-bottom: 10px;
  text-shadow: 0 0 8px #ffd23f77;
}

.panel p {
  font-size: 13px;
  line-height: 1.6;
  color: #ddd;
  margin-bottom: 16px;
}

.panel button, #bottom-bar button {
  background: #ffd23f;
  color: #111;
  border: none;
  padding: 10px 18px;
  font-family: inherit;
  font-weight: bold;
  font-size: 14px;
  border-radius: 20px;
  cursor: pointer;
  box-shadow: 0 3px 0 #b8951f;
}

.panel button:active, #bottom-bar button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #b8951f;
}

#controls-hint {
  margin-top: 10px;
  font-size: 11px;
  color: #888;
  text-align: center;
}

#bottom-bar {
  margin-top: 10px;
  display: flex;
  gap: 10px;
}

#bottom-bar button {
  background: #333;
  color: #fff;
  box-shadow: 0 3px 0 #111;
}

#touch-controls {
  margin-top: 14px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  user-select: none;
}

.tc-row { display: flex; gap: 46px; }

.tc {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  border: 2px solid #2233ff;
  background: #10102a;
  color: #9fdcff;
  font-size: 22px;
  touch-action: manipulation;
}

.tc:active { background: #2233ff55; }

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