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

body {
  background: #000;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Courier New", monospace;
  cursor: none;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#game-canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 100vw;
  height: calc(100vw * 400 / 640);
  max-height: 100vh;
  max-width: calc(100vh * 640 / 400);
}

/* HUD Overlay */
#hud-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

#hud-health {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 200px;
  height: 16px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #666;
}

#hud-health-bar {
  height: 100%;
  width: 100%;
  background: #8b0000;
  transition: width 0.3s;
}

#hud-battery {
  position: absolute;
  bottom: 44px;
  left: 20px;
  width: 120px;
  height: 10px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid #666;
}

#hud-battery-bar {
  height: 100%;
  width: 100%;
  background: #ccaa00;
  transition: width 0.3s;
}

#hud-radio {
  position: absolute;
  bottom: 20px;
  right: 20px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #222;
  border: 2px solid #444;
}

#hud-radio.active {
  background: #550000;
  box-shadow: 0 0 10px #ff0000;
  animation: radio-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes radio-pulse {
  from { box-shadow: 0 0 5px #ff0000; }
  to { box-shadow: 0 0 20px #ff0000; }
}

#hud-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: rgba(255, 255, 255, 0.4);
  font-size: 24px;
  font-weight: bold;
  text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

#hud-message {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  color: #ccc;
  font-size: 14px;
  text-align: center;
  text-shadow: 0 0 4px #000;
  opacity: 0;
  transition: opacity 0.5s;
}

#hud-message.visible {
  opacity: 1;
}

#hud-interact {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translateX(-50%);
  color: #aaa;
  font-size: 12px;
  text-shadow: 0 0 4px #000;
  opacity: 0;
  transition: opacity 0.3s;
}

#hud-interact.visible {
  opacity: 1;
}

#hud-weapon {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  color: #888;
  font-size: 11px;
  text-shadow: 0 0 4px #000;
}

/* Menu Overlays */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10;
}

.overlay.hidden {
  display: none;
}

#menu-title {
  font-size: 64px;
  color: #8b0000;
  letter-spacing: 12px;
  text-shadow: 0 0 20px rgba(139, 0, 0, 0.5), 0 0 40px rgba(139, 0, 0, 0.3);
  margin-bottom: 40px;
  font-weight: bold;
}

#menu-subtitle {
  font-size: 16px;
  color: #666;
  letter-spacing: 4px;
  animation: flicker 3s ease-in-out infinite;
}

@keyframes flicker {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
  92% { opacity: 0.6; }
  94% { opacity: 0.1; }
  96% { opacity: 0.8; }
}

#pause-text, #gameover-text {
  font-size: 48px;
  color: #999;
  letter-spacing: 8px;
}

#gameover-text {
  color: #8b0000;
}

#pause-hint, #gameover-hint {
  font-size: 14px;
  color: #555;
  margin-top: 20px;
}

/* Creepypasta Windows 98 Error Dialog */
.error-dialog {
  position: absolute;
  z-index: 100;
  background: #c0c0c0;
  border: 2px outset #fff;
  box-shadow: 2px 2px 0 #000;
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Arial, sans-serif;
  font-size: 11px;
  min-width: 340px;
  cursor: default;
  pointer-events: auto;
}

.error-dialog .title-bar {
  background: linear-gradient(90deg, #000080, #1084d0);
  color: #fff;
  padding: 2px 4px;
  font-weight: bold;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.error-dialog .title-bar-close {
  background: #c0c0c0;
  border: 2px outset #fff;
  width: 16px;
  height: 14px;
  font-size: 9px;
  line-height: 10px;
  text-align: center;
  cursor: pointer;
  font-weight: bold;
}

.error-dialog .title-bar-close:active {
  border-style: inset;
}

.error-dialog .dialog-body {
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.error-dialog .dialog-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}

.error-dialog .dialog-text {
  padding-top: 4px;
  color: #000;
}

.error-dialog .dialog-buttons {
  padding: 8px 16px 12px;
  text-align: center;
}

.error-dialog .dialog-btn {
  background: #c0c0c0;
  border: 2px outset #fff;
  padding: 2px 24px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  margin: 0 4px;
}

.error-dialog .dialog-btn:active {
  border-style: inset;
}

/* Glitch/distortion overlay */
#creepypasta-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 50;
}

.glitch-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  mix-blend-mode: screen;
}
