@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&family=Rajdhani:wght@500;600;700&display=swap');

:root {
  --bg-dark: #0a0c10;
  --panel-bg: rgba(14, 18, 26, 0.85);
  --panel-border: rgba(0, 255, 204, 0.25);
  --cyan-glow: #00f3ff;
  --amber-glow: #ffb703;
  --crimson-glow: #ff0055;
  --health-green: #00ff88;
  --armor-blue: #00b4d8;
  --text-main: #e2e8f0;
  --text-muted: #64748b;
  --font-hud: 'Orbitron', monospace, sans-serif;
  --font-ui: 'Rajdhani', sans-serif;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-ui);
  color: var(--text-main);
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  max-width: 1600px;
  max-height: 900px;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(0, 243, 255, 0.15), 0 20px 50px rgba(0,0,0,0.8);
  border: 1px solid rgba(0, 243, 255, 0.2);
  cursor: none; /* Custom canvas crosshair */
}

/* CANVAS */
#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: #0d1117;
}

/* 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.25) 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% 3px, 4px 100%;
  z-index: 5;
  opacity: 0.6;
}

/* VIGNETTES */
.damage-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  box-shadow: inset 0 0 80px rgba(255, 0, 60, 0);
  transition: box-shadow 0.1s ease-out;
  z-index: 6;
}

.damage-flash.hit {
  box-shadow: inset 0 0 120px rgba(255, 0, 60, 0.85);
}

.sniper-scope-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 32%, rgba(0,0,0,0.92) 34%, #000 70%);
  display: none;
  z-index: 7;
}

.sniper-scope-overlay.active {
  display: block;
}

.scope-cross-h {
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(0, 255, 204, 0.5);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.scope-cross-v {
  position: absolute;
  top: 0;
  left: 50%;
  width: 1px;
  height: 100%;
  background: rgba(0, 255, 204, 0.5);
  box-shadow: 0 0 8px var(--cyan-glow);
}

.scope-ring {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 38%;
  aspect-ratio: 1/1;
  border: 2px solid rgba(0, 255, 204, 0.6);
  border-radius: 50%;
  box-shadow: 0 0 15px rgba(0, 255, 204, 0.3);
}

/* HUD LAYER */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px 32px;
  font-family: var(--font-hud);
}

/* TOP HUD */
.top-hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.hud-stat-box {
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  padding: 10px 20px;
  border-radius: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.hud-stat-box .label {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 2px;
}

.hud-stat-box .value {
  font-size: 24px;
  font-weight: 700;
  color: var(--cyan-glow);
  text-shadow: 0 0 10px rgba(0, 243, 255, 0.5);
}

.wave-display {
  text-align: center;
  min-width: 140px;
}

.wave-display .value {
  color: var(--amber-glow);
  text-shadow: 0 0 10px rgba(255, 183, 3, 0.5);
}

.combo-badge {
  color: var(--crimson-glow);
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-badge.active {
  opacity: 1;
  transform: scale(1);
  text-shadow: 0 0 12px var(--crimson-glow);
}

/* BOTTOM HUD */
.bottom-hud {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.vitals-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 280px;
}

.bar-wrapper {
  background: rgba(0,0,0,0.6);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 4px;
  position: relative;
}

.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 3px;
}

.bar-track {
  width: 100%;
  height: 12px;
  background: rgba(255,255,255,0.05);
  border-radius: 2px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.25s ease-out;
}

.health-fill {
  background: linear-gradient(90deg, #ff0055, var(--health-green));
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.6);
}

.armor-fill {
  background: linear-gradient(90deg, #0077b6, var(--armor-blue));
  box-shadow: 0 0 8px rgba(0, 180, 216, 0.6);
}

/* WEAPON SELECTOR SLOTS */
.weapon-inventory {
  display: flex;
  gap: 10px;
}

.weapon-slot {
  background: var(--panel-bg);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 8px 14px;
  border-radius: 6px;
  min-width: 95px;
  text-align: center;
  transition: all 0.2s ease;
  position: relative;
}

.weapon-slot .key-hint {
  position: absolute;
  top: 3px;
  left: 6px;
  font-size: 10px;
  color: var(--text-muted);
}

.weapon-slot .name {
  font-size: 13px;
  font-weight: 700;
  margin-top: 4px;
  color: #fff;
}

.weapon-slot.active {
  border-color: var(--cyan-glow);
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.4);
  transform: translateY(-4px);
}

.weapon-slot.locked {
  opacity: 0.35;
  filter: grayscale(1);
}

/* AMMO COUNTER */
.ammo-box {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  padding: 12px 24px;
  border-radius: 6px;
  text-align: right;
}

.ammo-main {
  font-size: 38px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

.ammo-reserve {
  font-size: 16px;
  color: var(--text-muted);
}

.reload-prompt {
  font-size: 12px;
  color: var(--crimson-glow);
  font-weight: 900;
  letter-spacing: 1px;
  animation: blink 0.6s infinite alternate;
  display: none;
}

.reload-prompt.visible {
  display: block;
}

@keyframes blink {
  0% { opacity: 0.2; }
  100% { opacity: 1; text-shadow: 0 0 8px var(--crimson-glow); }
}

/* MODALS / OVERLAYS (START, SHOP, GAMEOVER) */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(7, 10, 15, 0.88);
  backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  cursor: default;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal-box {
  background: #0f141d;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 36px 48px;
  max-width: 800px;
  width: 90%;
  box-shadow: 0 0 40px rgba(0, 243, 255, 0.2);
  text-align: center;
}

.modal-title {
  font-family: var(--font-hud);
  font-size: 42px;
  font-weight: 900;
  letter-spacing: 3px;
  background: linear-gradient(135deg, #fff, var(--cyan-glow));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.modal-subtitle {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

/* BUTTONS */
.btn {
  background: linear-gradient(135deg, rgba(0, 243, 255, 0.2), rgba(0, 180, 216, 0.4));
  border: 1px solid var(--cyan-glow);
  color: #fff;
  padding: 14px 36px;
  font-family: var(--font-hud);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-transform: uppercase;
  box-shadow: 0 0 15px rgba(0, 243, 255, 0.25);
  margin: 10px;
  display: inline-block;
  text-decoration: none;
}

.btn:hover {
  background: var(--cyan-glow);
  color: #000;
  box-shadow: 0 0 30px var(--cyan-glow);
  transform: translateY(-2px);
}

.btn-arcade {
  background: linear-gradient(135deg, rgba(255, 183, 3, 0.2), rgba(255, 0, 85, 0.4));
  border: 1px solid var(--amber-glow);
  color: #fff;
}

.btn-arcade:hover {
  background: var(--amber-glow);
  color: #000;
  box-shadow: 0 0 30px var(--amber-glow);
}

.arcade-corner-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1000;
  background: rgba(14, 18, 26, 0.85);
  border: 1px solid var(--amber-glow);
  color: var(--amber-glow);
  padding: 8px 16px;
  border-radius: 6px;
  font-family: var(--font-hud);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 15px rgba(255, 183, 3, 0.2);
  transition: all 0.2s ease;
  cursor: pointer;
}

.arcade-corner-btn:hover {
  background: var(--amber-glow);
  color: #000;
  box-shadow: 0 0 25px var(--amber-glow);
  transform: translateY(-2px);
}

/* SHOP GRID */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
  text-align: left;
}

.shop-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: all 0.2s ease;
}

.shop-card:hover {
  border-color: var(--amber-glow);
  background: rgba(255, 183, 3, 0.05);
}

.shop-card h4 {
  font-family: var(--font-hud);
  font-size: 15px;
  color: #fff;
  margin-bottom: 6px;
}

.shop-card p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.shop-btn {
  background: rgba(255, 183, 3, 0.15);
  border: 1px solid var(--amber-glow);
  color: var(--amber-glow);
  padding: 8px 12px;
  font-family: var(--font-hud);
  font-size: 12px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.shop-btn:hover:not(:disabled) {
  background: var(--amber-glow);
  color: #000;
  box-shadow: 0 0 15px rgba(255, 183, 3, 0.5);
}

.shop-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  border-color: rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.4);
}

/* FLOATING HEADSHOT / HIT TEXT */
.floating-text {
  position: absolute;
  pointer-events: none;
  font-family: var(--font-hud);
  font-weight: 900;
  text-shadow: 0 0 10px rgba(0,0,0,0.9);
  animation: floatUp 0.8s forwards cubic-bezier(0.1, 0.8, 0.3, 1);
  z-index: 20;
}

@keyframes floatUp {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  100% { transform: translateY(-40px) scale(1.2); opacity: 0; }
}

/* RESPONSIVE DESIGN (MOBILE & GALAXY A55) */
@media (max-width: 900px) {
  #hud {
    padding: 10px 14px;
  }
  .hud-stat-box .value {
    font-size: 18px;
  }
  .vitals-container {
    min-width: 140px;
  }
  .weapon-slot {
    min-width: 70px;
    padding: 6px 10px;
  }
  .weapon-slot .name {
    font-size: 11px;
  }
  .shop-grid {
    grid-template-columns: repeat(2, 1fr);
    max-height: 48vh;
    overflow-y: auto;
  }
}

@media (max-width: 600px) {
  #hud {
    padding: 6px 8px;
  }
  .arcade-corner-btn {
    padding: 4px 8px;
    font-size: 10px;
    top: 8px;
    right: 8px;
  }
  .top-hud {
    margin-bottom: 0;
  }
  .hud-stat-box {
    padding: 4px 8px;
  }
  .hud-stat-box .label {
    font-size: 8px;
  }
  .hud-stat-box .value {
    font-size: 14px;
  }
  .bottom-hud {
    gap: 6px;
  }
  .vitals-container {
    min-width: 100px;
    gap: 4px;
  }
  .bar-label {
    font-size: 9px;
  }
  .bar-track {
    height: 8px;
  }
  .weapon-inventory {
    gap: 3px;
  }
  .weapon-slot {
    min-width: 48px;
    padding: 3px 5px;
    border-radius: 4px;
  }
  .weapon-slot .key-hint {
    display: none;
  }
  .weapon-slot .name {
    font-size: 9px;
  }
  .ammo-box {
    padding: 4px 8px;
    min-width: 65px;
  }
  .ammo-main {
    font-size: 18px;
  }
  .ammo-reserve {
    font-size: 11px;
  }
  .modal-box {
    padding: 18px 16px;
    max-width: 94vw;
    max-height: 88vh;
    overflow-y: auto;
  }
  .modal-box h2 {
    font-size: 20px;
    margin-bottom: 8px;
  }
  .shop-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 45vh;
  }
  .shop-card {
    padding: 10px;
  }
  .shop-card h4 {
    font-size: 13px;
  }
  .shop-card p {
    font-size: 11px;
    margin-bottom: 6px;
  }
}
