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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  font-family: 'Courier New', monospace;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#game-canvas {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

#hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  color: #f4f4f4;
  text-shadow: 2px 2px 0 #000;
  font-size: 14px;
  letter-spacing: 1px;
  pointer-events: none;
  z-index: 5;
}

#gem-counter {
  color: #6ee0ff;
}

#debug-readout {
  color: #ffd766;
  font-size: 12px;
}

#overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(10, 10, 18, 0.92);
  color: #f4f4f4;
  text-align: center;
  padding: 24px;
  z-index: 10;
}

#overlay.hidden {
  display: none;
}

#overlay-title {
  font-size: 28px;
  letter-spacing: 2px;
  color: #6ee0ff;
  text-shadow: 3px 3px 0 #123;
}

#overlay-sub {
  max-width: 440px;
  font-size: 14px;
  line-height: 1.5;
  color: #cfd4e6;
}

#overlay-button {
  font-family: inherit;
  font-size: 16px;
  letter-spacing: 1px;
  padding: 12px 28px;
  background: #ffd766;
  color: #221a05;
  border: 3px solid #221a05;
  box-shadow: 4px 4px 0 #000;
  cursor: pointer;
}

#overlay-button:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #000;
}

#overlay-button:disabled {
  opacity: 0.6;
  cursor: default;
}

#hazard-flash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(120, 10, 10, 0.55);
  color: #fff2e0;
  font-size: 22px;
  letter-spacing: 1px;
  text-shadow: 3px 3px 0 #000;
  pointer-events: none;
  z-index: 8;
}

#hazard-flash.hidden {
  display: none;
}
