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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: #0b0d11;
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  color: #e6edf3;
}

#gameCanvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  cursor: none;
  z-index: 1;
}

/* ====================================================
   HUD INTERFACE (Z-INDEX: 10)
==================================================== */
#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: 20px;
}

/* Top Bar: Stats, Wave & Score */
.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: 100%;
}

.hud-group {
  display: flex;
  gap: 16px;
  align-items: center;
}

/* Player Status Meters */
.status-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(13, 17, 23, 0.85);
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #30363d;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  min-width: 260px;
}

.bar-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  font-size: 11px;
  font-weight: 700;
  width: 48px;
  letter-spacing: 0.5px;
}

.bar-bg {
  flex: 1;
  height: 12px;
  background: #161b22;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #21262d;
  position: relative;
}

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

.hp-fill {
  background: linear-gradient(90deg, #ff3b30, #ff6b6b);
  box-shadow: 0 0 10px rgba(255, 59, 48, 0.5);
}

.armor-fill {
  background: linear-gradient(90deg, #007aff, #58a6ff);
  box-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
}

.stamina-fill {
  background: linear-gradient(90deg, #30d158, #34c759);
}

.bar-text {
  font-size: 11px;
  font-weight: 600;
  min-width: 55px;
  text-align: right;
  color: #8b949e;
}

/* Wave & Objectives Center Panel */
.wave-panel {
  text-align: center;
  background: rgba(13, 17, 23, 0.9);
  padding: 10px 24px;
  border-radius: 8px;
  border: 1px solid #ff3b30;
  box-shadow: 0 0 18px rgba(255, 59, 48, 0.3);
  backdrop-filter: blur(4px);
}

.wave-title {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  color: #ff3b30;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(255, 59, 48, 0.6);
}

.enemies-title {
  font-size: 13px;
  font-weight: 700;
  color: #c9d1d9;
  margin-top: 2px;
  letter-spacing: 1px;
}

/* Economy & Score Top Right */
.score-panel {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.stat-badge {
  background: rgba(13, 17, 23, 0.85);
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid #30363d;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.stat-cash {
  color: #39ff14;
  border-color: #238636;
  text-shadow: 0 0 8px rgba(57, 255, 20, 0.4);
}

.stat-score {
  color: #ffd700;
}

.combo-badge {
  background: #ff3b30;
  color: #ffffff;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 1px;
  animation: pulse-combo 0.4s infinite alternate;
  display: none;
}

@keyframes pulse-combo {
  from { transform: scale(1.0); }
  to { transform: scale(1.1); }
}

/* Top Buttons: Mute & Pause */
.btn-top {
  pointer-events: auto;
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-top:hover {
  background: #30363d;
  color: #ffffff;
}

.btn-top.muted {
  background: #ff3b30;
  color: #ffffff;
}

.btn-top.tactical-mode {
  background: #0969da;
  color: #ffffff;
}

/* Bottom HUD Area: Weapons, Ammo, Minimap */
.hud-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  width: 100%;
}

/* Ammo & Weapon Information */
.ammo-panel {
  background: rgba(13, 17, 23, 0.85);
  padding: 14px 18px;
  border-radius: 8px;
  border: 1px solid #30363d;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ammo-numbers {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ammo-val {
  font-size: 38px;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
}

.ammo-reserve {
  font-size: 18px;
  font-weight: 700;
  color: #8b949e;
}

.reload-indicator {
  font-size: 12px;
  font-weight: 800;
  color: #ff9900;
  animation: blink 0.5s infinite alternate;
  display: none;
}

@keyframes blink {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

.grenade-val {
  font-size: 13px;
  font-weight: 700;
  color: #ff9900;
  margin-top: 4px;
}

/* Weapon Hotbar */
.weapon-hotbar {
  display: flex;
  gap: 8px;
  background: rgba(13, 17, 23, 0.85);
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #30363d;
  pointer-events: auto;
}

.weapon-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 68px;
  height: 60px;
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), border-color 0.15s, background 0.15s, box-shadow 0.15s;
  position: relative;
}

.weapon-slot:hover:not(.locked) {
  border-color: #58a6ff;
  background: #21262d;
  transform: translateY(-3px);
}

.weapon-slot.active {
  border-color: #00ff88;
  background: rgba(0, 255, 136, 0.14);
  box-shadow: 0 0 14px rgba(0, 255, 136, 0.45);
  transform: translateY(-4px) scale(1.04);
}

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

.slot-num {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #8b949e;
}

.slot-icon {
  font-size: 18px;
  margin-top: 6px;
}

.slot-name {
  font-size: 9px;
  font-weight: 700;
  color: #c9d1d9;
  text-align: center;
  margin-top: 2px;
  text-transform: uppercase;
}

/* Minimap Radar */
.minimap-panel {
  background: rgba(13, 17, 23, 0.85);
  padding: 6px;
  border-radius: 8px;
  border: 1px solid #30363d;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  align-items: center;
}

#minimapCanvas {
  border-radius: 4px;
  display: block;
  border: 1px solid #21262d;
}

.minimap-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #8b949e;
  margin-top: 4px;
}

/* ====================================================
   MODALS & OVERLAYS (Z-INDEX: 100)
==================================================== */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 10, 0.88);
  backdrop-filter: blur(8px);
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: center;
}

#settingsModal {
  z-index: 150;
}

.modal-content {
  background: #0d1117;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 32px;
  max-width: 860px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  border-bottom: 1px solid #21262d;
  padding-bottom: 16px;
}

.modal-title {
  font-size: 28px;
  font-weight: 900;
  color: #ff3b30;
  letter-spacing: 1px;
}

.modal-cash {
  font-size: 20px;
  font-weight: 800;
  color: #39ff14;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #238636, #2ea043);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(35, 134, 54, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(35, 134, 54, 0.6);
}

.btn-danger {
  background: linear-gradient(135deg, #da3633, #f85149);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 14px 28px;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 14px rgba(218, 54, 51, 0.4);
}

.btn-secondary {
  background: #21262d;
  color: #c9d1d9;
  border: 1px solid #30363d;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #30363d;
  color: #ffffff;
}

/* Start Screen Specific */
.start-container {
  text-align: center;
  max-width: 640px;
}

.game-logo {
  font-size: 46px;
  font-weight: 900;
  letter-spacing: 4px;
  color: #ff3b30;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(255, 59, 48, 0.7);
  margin-bottom: 8px;
}

.game-sub {
  font-size: 16px;
  color: #8b949e;
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.controls-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 24px 0;
  text-align: left;
}

.control-item {
  background: #161b22;
  border: 1px solid #21262d;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}

.control-item kbd {
  background: #21262d;
  border: 1px solid #30363d;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: monospace;
  font-weight: 700;
  color: #58a6ff;
}

/* Shop Modal Grid */
.shop-section-title {
  font-size: 16px;
  font-weight: 800;
  color: #58a6ff;
  letter-spacing: 1px;
  margin: 18px 0 10px 0;
  text-transform: uppercase;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.shop-card {
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s;
}

.shop-card:hover {
  border-color: #30363d;
}

.shop-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shop-card-title {
  font-size: 14px;
  font-weight: 800;
  color: #e6edf3;
}

.shop-card-desc {
  font-size: 11px;
  color: #8b949e;
  line-height: 1.4;
}

.btn-buy {
  background: #238636;
  color: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 8px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-buy:hover:not(:disabled) {
  background: #2ea043;
}

.btn-buy:disabled {
  background: #21262d;
  color: #484f58;
  cursor: not-allowed;
}

.btn-buy.owned {
  background: #1f6feb;
  color: #ffffff;
}

/* Game Over Stats */
.go-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 24px 0;
}

.go-stat-card {
  background: #161b22;
  border: 1px solid #21262d;
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.go-stat-val {
  font-size: 32px;
  font-weight: 900;
  color: #ff3b30;
  margin-top: 4px;
}

.go-stat-lbl {
  font-size: 12px;
  font-weight: 700;
  color: #8b949e;
  text-transform: uppercase;
}

/* ====================================================
   BOSS HEALTH BAR & EVENT ANNOUNCEMENTS
==================================================== */
.boss-hud-container {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  width: 520px;
  max-width: 90%;
  background: rgba(13, 17, 23, 0.92);
  border: 1px solid #ff3b30;
  box-shadow: 0 0 24px rgba(255, 59, 48, 0.45);
  border-radius: 8px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  pointer-events: none;
  z-index: 15;
  animation: slide-down 0.4s ease-out;
}

.boss-hud-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.boss-hud-name {
  font-size: 14px;
  font-weight: 900;
  color: #ff3b30;
  letter-spacing: 1.5px;
}

.boss-hud-title {
  font-size: 11px;
  color: #8b949e;
  font-weight: 600;
}

.boss-hud-bar-bg {
  width: 100%;
  height: 14px;
  background: #161b22;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid #30363d;
}

.boss-hud-hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #b81212, #ff3b30);
  box-shadow: 0 0 12px rgba(255, 59, 48, 0.6);
  transition: width 0.15s ease-out;
}

.boss-hud-hp-text {
  font-size: 10px;
  font-weight: 700;
  color: #c9d1d9;
  text-align: right;
}

/* Event Banner */
.event-banner {
  position: absolute;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 17, 23, 0.94);
  border: 2px solid #58a6ff;
  border-radius: 8px;
  padding: 10px 24px;
  text-align: center;
  box-shadow: 0 0 20px rgba(88, 166, 255, 0.4);
  pointer-events: none;
  z-index: 14;
  animation: pop-in 0.3s ease-out;
}

.event-title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 1px;
  color: #58a6ff;
}

.event-desc {
  font-size: 12px;
  color: #c9d1d9;
  margin-top: 2px;
}

@keyframes slide-down {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

@keyframes pop-in {
  from { transform: translate(-50%, -10px) scale(0.95); opacity: 0; }
  to { transform: translate(-50%, 0) scale(1.0); opacity: 1; }
}

/* ====================================================
   ROGUELITE DRAFT CARDS
==================================================== */
.draft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.draft-card {
  background: #161b22;
  border: 2px solid #30363d;
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
  gap: 12px;
  transition: all 0.2s;
  cursor: pointer;
}

.draft-card:hover {
  border-color: #ffd700;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(255, 215, 0, 0.25);
  background: #21262d;
}

.draft-badge {
  font-size: 38px;
}

.draft-name {
  font-size: 15px;
  font-weight: 900;
  color: #ffd700;
  letter-spacing: 0.5px;
}

.draft-desc {
  font-size: 12px;
  color: #c9d1d9;
  line-height: 1.5;
}

.btn-draft-select {
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 800;
}

/* ====================================================
   ACHIEVEMENTS & RECORD ARCHIVES
==================================================== */
.achievements-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 6px;
}

.achievement-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #161b22;
  border: 1px solid #21262d;
  border-radius: 8px;
  gap: 14px;
}

.achievement-item.unlocked {
  border-color: #238636;
  background: rgba(35, 134, 54, 0.12);
}

.achievement-item.locked {
  opacity: 0.55;
  filter: grayscale(0.8);
}

.ach-icon {
  font-size: 24px;
}

.ach-info {
  flex: 1;
}

.ach-name {
  font-size: 14px;
  font-weight: 800;
  color: #e6edf3;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ach-badge {
  font-size: 9px;
  background: #238636;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 4px;
}

.ach-desc {
  font-size: 11px;
  color: #8b949e;
  margin-top: 2px;
}

.ach-reward {
  font-size: 13px;
  font-weight: 800;
  color: #39ff14;
}

/* ====================================================
   SETTINGS FORM
==================================================== */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 10px;
}

.setting-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #161b22;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid #21262d;
  font-size: 13px;
  font-weight: 700;
}

.setting-row input[type="range"] {
  width: 160px;
  cursor: pointer;
}
