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

:root {
  --bg-color: #06040d;
  --accent-neon: #ff0055;
  --accent-cyan: #00f0ff;
  --accent-yellow: #ffb700;
  --accent-green: #33ff66;
  --panel-bg: rgba(10, 8, 20, 0.92);
}

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

body, html {
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 1280px;
  max-height: 960px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #000;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7);
  border: 1px solid #140f26;
}

#canvas-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: calc(100vh * (320 / 224));
  max-height: calc(100vw * (224 / 320));
  aspect-ratio: 320 / 224;
  display: flex;
  justify-content: center;
  align-items: center;
  background: #040308;
  cursor: none;
}

canvas {
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* CRT Scanline Overlay */
.crt-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: linear-gradient(
    rgba(18, 16, 16, 0) 50%, 
    rgba(0, 0, 0, 0.35) 50%
  ), linear-gradient(
    90deg,
    rgba(255, 0, 0, 0.04),
    rgba(0, 255, 0, 0.02),
    rgba(0, 0, 255, 0.04)
  );
  background-size: 100% 4px, 6px 100%;
  z-index: 10;
  box-shadow: inset 0 0 140px rgba(0, 0, 0, 0.9);
}

/* HUD Overlay */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
}

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  text-shadow: 2px 2px 0px #000, 0 0 8px rgba(0, 0, 0, 0.9);
}

.brand-title {
  font-size: 14px;
  color: var(--accent-yellow);
  letter-spacing: 1px;
}

.stat-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.label {
  color: var(--accent-cyan);
}

.value {
  color: #ffffff;
}

.value-highlight {
  color: var(--accent-green);
}

/* Discrete Pixel Pop Banner */
#broadcast-banner {
  position: absolute;
  top: 14%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-neon);
  color: #fff;
  padding: 12px 28px;
  border: 4px solid #fff;
  font-size: 20px;
  text-align: center;
  box-shadow: 0 0 35px var(--accent-neon), 6px 6px 0 #000;
  display: none;
  z-index: 30;
  pointer-events: none;
  white-space: nowrap;
}

#broadcast-banner.active {
  display: block;
}

/* UI Overlay Screen (Title / Game Over) */
.overlay-screen {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(6, 4, 13, 0.94);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 40;
  gap: 22px;
  text-align: center;
  padding: 20px;
}

.hidden {
  display: none !important;
}

.game-logo {
  font-size: 34px;
  color: var(--accent-yellow);
  text-shadow: 4px 4px 0 var(--accent-neon), -2px -2px 0 var(--accent-cyan);
  line-height: 1.3;
  margin-bottom: 5px;
}

.subtitle {
  font-family: 'VT323', monospace;
  font-size: 26px;
  color: var(--accent-cyan);
  letter-spacing: 2px;
}

.btn {
  background: var(--accent-neon);
  color: #fff;
  border: 4px solid #fff;
  padding: 16px 34px;
  font-family: 'Press Start 2P', monospace;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 4px 4px 0 #000;
  margin-top: 10px;
}

.btn:hover {
  background: var(--accent-yellow);
  color: #000;
  box-shadow: 6px 6px 0 #000;
}

.controls-hint {
  font-family: 'VT323', monospace;
  font-size: 22px;
  color: #ccc;
  margin-top: 15px;
  line-height: 1.6;
}

#build-bar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 25;
  pointer-events: auto;
}

.build-slot {
  background: rgba(12, 16, 28, 0.88);
  border: 2px solid rgba(0, 240, 255, 0.4);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

.build-slot:hover, .build-slot.active {
  border-color: #33ff66;
  background: rgba(18, 38, 28, 0.95);
  box-shadow: 0 0 14px rgba(51, 255, 102, 0.5);
  transform: translateY(-2px);
}

.build-slot .key {
  background: #33ff66;
  color: #040810;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}

.build-slot .name {
  color: #f1f5f9;
}

.build-slot .cost {
  color: #33ff66;
}
