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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0d1117;
  font-family: 'Rajdhani', 'Inter', sans-serif;
  color: #fff;
}

#game-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.hidden {
  display: none !important;
}

/* CROSSHAIR */
#crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 10;
}

.ch-center {
  position: absolute;
  top: 11px;
  left: 11px;
  width: 2px;
  height: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 4px #000;
}

.ch-top, .ch-bottom, .ch-left, .ch-right {
  position: absolute;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 0 2px #000;
}

.ch-top { top: 0; left: 11px; width: 2px; height: 7px; }
.ch-bottom { bottom: 0; left: 11px; width: 2px; height: 7px; }
.ch-left { top: 11px; left: 0; width: 7px; height: 2px; }
.ch-right { top: 11px; right: 0; width: 7px; height: 2px; }

#hitmarker {
  position: absolute;
  top: -8px;
  left: -8px;
  width: 40px;
  height: 40px;
  opacity: 0;
  transition: opacity 0.05s ease-out;
}

#hitmarker.active {
  opacity: 1;
}

#hitmarker::before, #hitmarker::after {
  content: '';
  position: absolute;
  top: 19px;
  left: 5px;
  width: 30px;
  height: 2px;
  background: #ff3838;
  box-shadow: 0 0 6px #ff3838;
}

#hitmarker::before { transform: rotate(45deg); }
#hitmarker::after { transform: rotate(-45deg); }

/* HUD LAYOUT */
#hud {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 5;
}

#top-bar {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 15px;
  pointer-events: none;
}

.stat-card {
  background: rgba(13, 17, 23, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 1px;
}

#kills-val {
  color: #ff4757;
}

/* DAMAGE FLOATING NUMBERS */
#damage-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.damage-num {
  position: absolute;
  font-family: 'Teko', sans-serif;
  font-size: 38px;
  font-weight: 700;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.9);
  animation: floatUp 0.8s ease-out forwards;
  pointer-events: none;
}

.dmg-shield { color: #00d2d3; }
.dmg-body { color: #ffffff; }
.dmg-crit { color: #ff9f43; font-size: 46px; }

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

/* BOTTOM LEFT: HEALTH & SHIELD */
#bottom-left {
  position: absolute;
  bottom: 25px;
  left: 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 260px;
  pointer-events: auto;
}

.bar-container {
  position: relative;
  height: 28px;
  background: rgba(10, 10, 15, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  overflow: hidden;
}

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

.shield-container .bar-fill {
  background: linear-gradient(90deg, #0984e3, #00cec9);
  box-shadow: 0 0 10px rgba(0, 206, 201, 0.5);
}

.health-container .bar-fill {
  background: linear-gradient(90deg, #20bf6b, #26de81);
  box-shadow: 0 0 10px rgba(38, 222, 129, 0.5);
}

.bar-text {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  font-size: 18px;
  font-weight: 700;
  text-shadow: 0 0 4px #000;
}

.bar-sub {
  font-size: 12px;
  opacity: 0.85;
}

/* BOTTOM CENTER: BUILDING */
#bottom-center {
  position: absolute;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: auto;
}

.build-slot {
  position: relative;
  width: 62px;
  height: 62px;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  cursor: pointer;
}

.build-slot:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.build-slot.active-build {
  border-color: #00d2d3;
  box-shadow: 0 0 14px rgba(0, 210, 211, 0.6);
  transform: translateY(-4px);
}

.slot-key {
  position: absolute;
  top: 3px;
  left: 5px;
  font-size: 11px;
  font-weight: 800;
  background: rgba(0, 0, 0, 0.6);
  padding: 1px 4px;
  border-radius: 3px;
}

.slot-icon {
  font-size: 22px;
}

.slot-name {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.mats-badge {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 700;
  font-size: 14px;
  margin-left: 8px;
}

#mats-val {
  color: #ff9f43;
  font-size: 18px;
}

/* BOTTOM RIGHT: WEAPONS */
#bottom-right {
  position: absolute;
  bottom: 25px;
  right: 30px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  pointer-events: auto;
}

.weapon-slot {
  position: relative;
  width: 68px;
  height: 68px;
  background: rgba(15, 23, 42, 0.85);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
  cursor: pointer;
}

.weapon-slot:hover {
  border-color: rgba(255, 255, 255, 0.4);
}

.weapon-slot.active-weapon {
  border-color: #ff4757;
  box-shadow: 0 0 16px rgba(255, 71, 87, 0.7);
  transform: translateY(-6px);
}

.weapon-icon {
  font-size: 26px;
}

.weapon-name {
  font-size: 10px;
  font-weight: 700;
}

#ammo-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 8px 14px;
  height: 68px;
}

#ammo-val {
  font-family: 'Teko', sans-serif;
  font-size: 26px;
  letter-spacing: 1px;
}

#reload-bar {
  width: 50px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

#reload-fill {
  width: 100%;
  height: 100%;
  background: #2ed573;
}

#controls-hint {
  position: absolute;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  opacity: 0.65;
  letter-spacing: 0.5px;
  pointer-events: none;
}

/* BUTTONS */
.btn {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 1px;
  padding: 12px 24px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  pointer-events: auto;
  transition: all 0.15s ease;
}

.btn-primary {
  background: #ff4757;
  color: #fff;
}

.btn-primary:hover {
  background: #ff6b81;
  box-shadow: 0 0 15px rgba(255, 71, 87, 0.5);
  transform: translateY(-2px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-glow {
  background: linear-gradient(135deg, #00FF88, #10ac84);
  color: #000;
  width: 100%;
}

.btn-glow:hover {
  box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
  transform: translateY(-2px);
}

.btn-glow-blue {
  background: linear-gradient(135deg, #00d2d3, #0984e3);
  color: #fff;
  width: 100%;
}

.btn-glow-blue:hover {
  box-shadow: 0 0 20px rgba(0, 210, 211, 0.6);
  transform: translateY(-2px);
}

.btn-glow-purple {
  background: linear-gradient(135deg, #a29bfe, #6c5ce7);
  color: #fff;
  width: 100%;
}

.btn-glow-purple:hover {
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.6);
  transform: translateY(-2px);
}

/* MENU OVERLAY */
#menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(5, 7, 10, 0.88);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: auto;
}

.menu-box {
  width: 900px;
  max-width: 95%;
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 35px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
  display: flex;
  flex-direction: column;
  gap: 25px;
  pointer-events: auto;
}

.menu-header {
  text-align: center;
}

.logo-title {
  font-family: 'Teko', sans-serif;
  font-size: 70px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: 2px;
}

.logo-title span {
  color: #00FF88;
  text-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
}

.logo-subtitle {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #8b949e;
  margin-top: 6px;
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.mode-card {
  position: relative;
  background: rgba(22, 27, 34, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all 0.2s ease;
  cursor: pointer;
  pointer-events: auto;
}

.mode-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-4px);
  background: rgba(30, 38, 48, 0.9);
}

.card-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 10px;
  font-weight: 800;
  color: #00FF88;
  background: rgba(0, 255, 136, 0.1);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 1px;
}

.card-badge.pulse {
  color: #00d2d3;
  background: rgba(0, 210, 211, 0.15);
}

.card-icon {
  font-size: 44px;
  margin-bottom: 12px;
}

.mode-card h2 {
  font-family: 'Teko', sans-serif;
  font-size: 28px;
  letter-spacing: 1px;
  margin-bottom: 8px;
}

.mode-card p {
  font-size: 13px;
  color: #8b949e;
  line-height: 1.4;
  margin-bottom: 20px;
  flex-grow: 1;
}

.custom-party-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(22, 27, 34, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 18px;
  pointer-events: auto;
}

.custom-title {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  color: #8b949e;
}

#room-code-input {
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  padding: 10px 14px;
  font-family: 'Rajdhani', sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  letter-spacing: 2px;
  text-transform: uppercase;
  outline: none;
  pointer-events: auto;
}

#room-code-input:focus {
  border-color: #00FF88;
}

.menu-footer {
  text-align: center;
  font-size: 12px;
  color: #484f58;
}

/* VICTORY BANNER */
#victory-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 90;
  pointer-events: auto;
}

.banner-box {
  text-align: center;
  background: rgba(13, 17, 23, 0.95);
  border: 2px solid #00FF88;
  box-shadow: 0 0 50px rgba(0, 255, 136, 0.4);
  border-radius: 16px;
  padding: 40px 60px;
  pointer-events: auto;
}

#victory-title {
  font-family: 'Teko', sans-serif;
  font-size: 64px;
  color: #ff9f43;
  letter-spacing: 2px;
}

#victory-desc {
  font-size: 18px;
  color: #c8d6e5;
  margin-top: 8px;
  margin-bottom: 25px;
}

.banner-buttons {
  display: flex;
  justify-content: center;
  gap: 15px;
}

/* RESPONSIVE MEDIA QUERIES */
@media (max-width: 1080px) {
  #bottom-left {
    width: 220px;
    left: 15px;
    bottom: 15px;
  }
  #bottom-right {
    right: 15px;
    bottom: 15px;
  }
  .weapon-slot {
    width: 58px;
    height: 58px;
  }
  .build-slot {
    width: 54px;
    height: 54px;
  }
  #bottom-center {
    bottom: 15px;
  }
}

@media (max-width: 768px) {
  .mode-grid {
    grid-template-columns: 1fr;
    max-height: 50vh;
    overflow-y: auto;
  }
  .logo-title {
    font-size: 48px;
  }
  .menu-box {
    padding: 20px;
  }
  .custom-party-bar {
    flex-direction: column;
    align-items: stretch;
  }
}
