/* DOOM-JS Retro Style */
@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap');

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
  -webkit-user-select: none;
}

body {
  background-color: #0b0b0d;
  color: #d1d5db;
  font-family: 'VT323', monospace;
  font-size: 20px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

#game-container {
  position: relative;
  width: 960px;
  height: 600px;
  max-width: 100vw;
  max-height: 100vh;
  background-color: #000;
  border: 4px solid #4a0000;
  box-shadow: 0 0 30px rgba(255, 0, 0, 0.4), inset 0 0 15px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Viewport Canvas (Raycaster rendering) */
#viewport-canvas {
  width: 100%;
  height: calc(100% - 80px);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-color: #000;
  display: block;
  cursor: crosshair;
}

/* HUD Canvas (Doom Status Bar at bottom) */
#hud-canvas {
  width: 100%;
  height: 80px;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background-color: #2b2b2b;
  border-top: 3px solid #660000;
  display: block;
}

/* Overlay Elements */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(10, 10, 15, 0.92);
  z-index: 50;
  pointer-events: auto;
  transition: opacity 0.2s ease;
}

.hidden {
  display: none !important;
  pointer-events: none !important;
}

/* CRT Scanline Filter */
#crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%,
    rgba(0, 0, 0, 0.35) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.03),
    rgba(0, 255, 0, 0.01),
    rgba(0, 0, 255, 0.03)
  );
  background-size: 100% 4px, 6px 100%;
  opacity: 0.85;
}

/* Crosshair */
#crosshair {
  position: absolute;
  top: calc(50% - 40px);
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 30;
  width: 12px;
  height: 12px;
}

#crosshair::before, #crosshair::after {
  content: '';
  position: absolute;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 3px #ff0000;
}
#crosshair::before {
  top: 5px;
  left: 0;
  width: 12px;
  height: 2px;
}
#crosshair::after {
  top: 0;
  left: 5px;
  width: 2px;
  height: 12px;
}

/* Damage / Pickup Flash Tint */
#flash-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(100% - 80px);
  pointer-events: none;
  z-index: 35;
  opacity: 0;
  transition: opacity 0.05s linear;
}

/* Notifications / Messages */
#message-banner {
  position: absolute;
  top: 15px;
  left: 20px;
  color: #ffff00;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  text-shadow: 2px 2px #000, 0 0 5px #ff6600;
  pointer-events: none;
  z-index: 36;
  max-width: 80%;
  line-height: 1.4;
}

/* Menus & Titles */
.title-banner {
  color: #e51d1d;
  font-family: 'Press Start 2P', monospace;
  font-size: 42px;
  text-shadow: 4px 4px #000, 0 0 20px #ff0000, 0 0 40px #8b0000;
  margin-bottom: 25px;
  letter-spacing: 4px;
  text-align: center;
  animation: pulse-title 2s infinite ease-in-out;
}

@keyframes pulse-title {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.02); filter: brightness(1.2); }
}

.subtitle {
  color: #ffaa00;
  font-size: 24px;
  margin-bottom: 25px;
  text-shadow: 2px 2px #000;
}

.menu-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 380px;
}

.doom-btn {
  background: linear-gradient(180deg, #5a1414, #2a0505);
  border: 2px solid #a32222;
  color: #f7d070;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  padding: 12px 18px;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  z-index: 100;
  text-align: center;
  text-shadow: 2px 2px #000;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.1s ease;
}

.doom-btn:hover {
  background: linear-gradient(180deg, #8a1f1f, #4a0808);
  border-color: #ff5555;
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(255, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.doom-btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

/* Modals & Dialogs */
.modal-content {
  background: #181414;
  border: 3px solid #8b0000;
  box-shadow: 0 0 25px rgba(0, 0, 0, 0.9);
  padding: 25px;
  width: 85%;
  max-width: 700px;
  max-height: 85%;
  overflow-y: auto;
  color: #eee;
}

.modal-header {
  font-family: 'Press Start 2P', monospace;
  font-size: 20px;
  color: #ff3333;
  margin-bottom: 20px;
  text-shadow: 2px 2px #000;
  border-bottom: 2px solid #550000;
  padding-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.controls-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-bottom: 20px;
  font-size: 22px;
}

.control-item {
  display: flex;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.4);
  padding: 8px 12px;
  border-left: 3px solid #a32222;
}

.key-badge {
  background: #333;
  color: #ffff44;
  padding: 2px 8px;
  border-radius: 3px;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  border: 1px solid #666;
}

.settings-group {
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.settings-group label {
  font-size: 22px;
  color: #ffbb33;
}

.settings-group input[type="range"] {
  accent-color: #ff3333;
  cursor: pointer;
}

.settings-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: #ff3333;
  cursor: pointer;
}

/* Level Editor Styling */
#editor-container {
  width: 90%;
  height: 90%;
  background: #111;
  border: 3px solid #ff3333;
  display: flex;
  flex-direction: column;
}

#editor-toolbar {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: #222;
  border-bottom: 2px solid #444;
  flex-wrap: wrap;
  align-items: center;
}

#editor-canvas {
  flex: 1;
  background: #080808;
  cursor: crosshair;
}

.palette-btn {
  padding: 6px 10px;
  font-family: 'VT323', monospace;
  font-size: 18px;
  background: #333;
  color: #fff;
  border: 1px solid #666;
  cursor: pointer;
}

.palette-btn.active {
  background: #a32222;
  border-color: #ff4444;
  color: #ffff00;
}
