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

body {
  overflow: hidden;
  background: #070d19;
  color: #e2e8f0;
  font-family: 'Segoe UI', Inter, system-ui, -apple-system, sans-serif;
}

#canvas-container {
  position: fixed;
  inset: 0;
  z-index: 1;
}

#floating-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  overflow: hidden;
}

#damage-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 6;
  opacity: 0;
  background: radial-gradient(circle at center, transparent 48%, rgba(220, 38, 38, 0.78) 100%);
  transition: opacity 0.1s linear;
}

/* FPS SNIPER SCOPE */
#sniper-scope-overlay {
  position: fixed;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background: radial-gradient(circle at center, transparent 31%, #020617 33%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.scope-circle {
  position: relative;
  width: min(64vh, 64vw);
  height: min(64vh, 64vw);
  border: 2px solid rgba(56, 189, 248, 0.7);
  border-radius: 50%;
}
.scope-line-h {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background: rgba(226, 232, 240, 0.75);
}
.scope-line-v {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(226, 232, 240, 0.75);
}
.scope-center-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: #ef4444;
  box-shadow: 0 0 8px #ef4444;
}

/* FPS CROSSHAIR & HITMARKER */
#fps-crosshair {
  position: fixed;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 8;
  transition: width 0.12s ease, height 0.12s ease;
}
#fps-crosshair.ads {
  width: 16px;
  height: 16px;
}
.ch-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #38bdf8;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 4px rgba(0, 0, 0, 0.9);
}
.ch-tick {
  position: absolute;
  background: rgba(248, 250, 252, 0.92);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.95);
}
.ch-tick.top {
  width: 2px;
  height: 7px;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
}
.ch-tick.bottom {
  width: 2px;
  height: 7px;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
}
.ch-tick.left {
  height: 2px;
  width: 7px;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
}
.ch-tick.right {
  height: 2px;
  width: 7px;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}

#fps-hitmarker {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 9;
  font-size: 22px;
  font-weight: 900;
  color: #f8fafc;
  text-shadow: 0 0 6px rgba(0, 0, 0, 0.95);
}
#fps-hitmarker.headshot {
  color: #facc15;
  font-size: 27px;
  text-shadow: 0 0 12px #ef4444;
}

.floating-text {
  position: absolute;
  left: 0;
  top: 0;
  font-weight: 800;
  font-size: 14px;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
  white-space: nowrap;
  will-change: transform, opacity;
}
.ft-dmg {
  color: #f8fafc;
}
.ft-crit {
  color: #fde047;
  font-size: 17px;
  text-shadow: 0 0 10px rgba(239, 68, 68, 0.9);
}
.ft-cash {
  color: #4ade80;
  font-size: 16px;
}
.ft-player-hit {
  color: #f87171;
  font-size: 16px;
}
.ft-heal {
  color: #38bdf8;
  font-size: 14px;
}

.hud-panel {
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

/* TOP LEFT */
#hud-top-left {
  position: fixed;
  top: 14px;
  left: 14px;
  width: 260px;
  padding: 13px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.money-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.money-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
}
.money-val {
  font-size: 24px;
  font-weight: 800;
  color: #4ade80;
  margin-right: auto;
}
.kills-pill {
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.2);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  color: #cbd5e1;
}

.bar-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #cbd5e1;
}
.bar-track {
  width: 100%;
  height: 9px;
  background: rgba(2, 6, 23, 0.8);
  border-radius: 999px;
  overflow: hidden;
}
.bar-track.thin {
  height: 4px;
}
.bar-fill {
  height: 100%;
  width: 100%;
  transition: width 0.15s ease;
}
.bar-fill.hp {
  background: linear-gradient(90deg, #ef4444, #22c55e);
}
.bar-fill.stamina {
  background: #fbbf24;
}
.bar-fill.core {
  background: linear-gradient(90deg, #0284c7, #38bdf8);
}
.bar-fill.enemy {
  background: linear-gradient(90deg, #dc2626, #f97316);
}

/* TOP CENTER */
#hud-top-center {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 390px;
  padding: 11px 16px;
  z-index: 10;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wave-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.wave-num {
  font-size: 19px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #f8fafc;
}
.wave-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.05em;
}
.wave-pill.prep {
  background: rgba(234, 179, 8, 0.22);
  color: #fde047;
  border: 1px solid rgba(250, 204, 21, 0.45);
}
.wave-pill.action {
  background: rgba(239, 68, 68, 0.24);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.5);
}
.wave-progress-row {
  font-size: 12px;
  color: #cbd5e1;
}
.wave-grant-hint {
  font-size: 11px;
  color: #86efac;
}
.wave-btn-row {
  display: flex;
  gap: 6px;
  margin-top: 2px;
}
.start-wave-btn {
  flex: 1;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(250, 204, 21, 0.6);
  background: linear-gradient(135deg, #ca8a04, #ea580c);
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
}
.start-wave-btn.rush {
  background: linear-gradient(135deg, #dc2626, #9333ea);
  border-color: rgba(248, 113, 113, 0.7);
}
.start-wave-btn:hover {
  filter: brightness(1.14);
}

.auto-wave-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: rgba(30, 41, 59, 0.9);
  color: #cbd5e1;
  font-weight: 800;
  font-size: 11px;
  cursor: pointer;
}
.auto-wave-btn.active {
  background: linear-gradient(135deg, #15803d, #059669);
  border-color: #4ade80;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.45);
}

.pointer-hint {
  position: fixed;
  top: 156px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(14, 116, 144, 0.88);
  border: 1px solid rgba(56, 189, 248, 0.6);
  padding: 6px 15px;
  border-radius: 999px;
  font-size: 12px;
  color: #f0f9ff;
  cursor: pointer;
}

/* TOP RIGHT */
#hud-top-right {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}
.radar-wrap {
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.radar-caption {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #94a3b8;
}
.top-utility-btns {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 100%;
}
.util-btn {
  padding: 6px 11px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  background: rgba(15, 23, 42, 0.86);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
}
.util-btn.accent {
  background: linear-gradient(135deg, rgba(2, 132, 199, 0.85), rgba(37, 99, 235, 0.85));
  border-color: rgba(56, 189, 248, 0.55);
}
.util-btn:hover {
  filter: brightness(1.15);
}

/* BANNERS & PROMPTS */
.wave-banner {
  position: fixed;
  top: 192px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.45);
  padding: 10px 26px;
  border-radius: 12px;
  text-align: center;
  pointer-events: none;
  animation: popIn 0.25s ease-out;
}
.wave-banner-title {
  font-size: 19px;
  font-weight: 900;
  color: #f8fafc;
}
.wave-banner-sub {
  font-size: 12px;
  color: #7dd3fc;
  margin-top: 2px;
}

.context-prompt {
  position: fixed;
  bottom: 108px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fef08a;
  font-size: 13px;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 999px;
}

/* BOTTOM HOTBAR */
#hud-hotbar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: stretch;
  gap: 7px;
}
.hotbar-divider {
  width: 1px;
  background: rgba(148, 163, 184, 0.3);
  margin: 4px 2px;
}
.hotbar-slot {
  position: relative;
  min-width: 132px;
  padding: 8px 11px 8px 27px;
  background: rgba(15, 23, 42, 0.86);
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.1s ease;
}
.hotbar-slot.defense {
  min-width: 112px;
}
.hotbar-slot:hover {
  transform: translateY(-2px);
  border-color: rgba(148, 163, 184, 0.6);
}
.hotbar-slot.active {
  border-color: #38bdf8;
  background: rgba(14, 116, 144, 0.38);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.35);
}
.hotbar-slot.shop-cta {
  border-color: rgba(74, 222, 128, 0.45);
  background: rgba(20, 83, 45, 0.42);
}
.slot-key {
  position: absolute;
  top: 7px;
  left: 7px;
  width: 17px;
  height: 17px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #f8fafc;
}
.slot-title {
  font-size: 12px;
  font-weight: 800;
  color: #f8fafc;
  white-space: nowrap;
}
.slot-sub {
  font-size: 11px;
  color: #94a3b8;
  margin-top: 2px;
}

#controls-footer {
  position: fixed;
  bottom: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  font-size: 11px;
  color: rgba(203, 213, 225, 0.72);
  white-space: nowrap;
  pointer-events: none;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(2, 6, 23, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.hidden {
  display: none !important;
}

.modal-window {
  width: min(840px, 95vw);
  max-height: 89vh;
  background: #0f172a;
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
}
.modal-window.wide {
  width: min(1180px, 96vw);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  padding-bottom: 12px;
}
.modal-header h2 {
  font-size: 18px;
  letter-spacing: 0.04em;
}
.modal-sub {
  font-size: 12px;
  color: #94a3b8;
}
.modal-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.shop-balance {
  font-size: 15px;
  color: #cbd5e1;
}
.shop-balance b {
  color: #4ade80;
  font-size: 18px;
}
.close-btn {
  padding: 7px 13px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #1e293b;
  color: #f8fafc;
  font-weight: 700;
  cursor: pointer;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.shop-col h3 {
  font-size: 13px;
  color: #7dd3fc;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.shop-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.shop-card {
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.shop-card.equipped {
  border-color: rgba(56, 189, 248, 0.65);
  background: rgba(14, 116, 144, 0.2);
}
.shop-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}
.shop-item-title {
  font-size: 13.5px;
  font-weight: 800;
  color: #f8fafc;
}
.shop-item-sub {
  font-size: 11px;
  color: #94a3b8;
}
.badge-eq {
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
}
.shop-desc {
  font-size: 11.5px;
  color: #cbd5e1;
  line-height: 1.35;
}
.shop-stats {
  font-size: 11px;
  color: #94a3b8;
}
.shop-actions {
  display: flex;
  gap: 6px;
  margin-top: 3px;
}
.shop-actions.wrap {
  flex-wrap: wrap;
}
.shop-btn {
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #334155;
  color: #f8fafc;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.shop-btn.primary {
  background: #2563eb;
  border-color: #60a5fa;
}
.shop-btn.accent {
  background: #15803d;
  border-color: #4ade80;
}
.shop-btn.small {
  padding: 4px 9px;
  font-size: 11px;
}
.shop-btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ASSETS MODAL */
.assets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.asset-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(30, 41, 59, 0.65);
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 9px 12px;
  border-radius: 8px;
}
.asset-name {
  font-size: 13px;
  font-weight: 700;
}
.asset-cat {
  font-size: 10px;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
  margin-left: 6px;
}
.asset-path {
  font-size: 11px;
  color: #7dd3fc;
}
.asset-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.asset-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}
.asset-badge.proc {
  background: rgba(234, 179, 8, 0.2);
  color: #fde047;
}
.asset-badge.glb {
  background: rgba(34, 197, 94, 0.24);
  color: #86efac;
}

/* START & GAMEOVER CARDS */
.start-card {
  max-width: 580px;
  background: #0f172a;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 18px;
  padding: 28px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
}
.start-badge {
  align-self: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(2, 132, 199, 0.25);
  color: #7dd3fc;
}
.start-badge.danger {
  background: rgba(220, 38, 38, 0.28);
  color: #fca5a5;
}
.start-card h1 {
  font-size: 26px;
  font-weight: 900;
}
.start-card p {
  font-size: 14px;
  line-height: 1.5;
  color: #cbd5e1;
}
.start-highlights {
  background: rgba(30, 41, 59, 0.7);
  border-radius: 10px;
  padding: 12px;
  text-align: left;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  color: #e2e8f0;
}
.loading-status {
  font-size: 12px;
  color: #94a3b8;
}
.deploy-btn {
  padding: 13px 22px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #0284c7, #2563eb);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.deploy-btn:disabled {
  opacity: 0.5;
  cursor: wait;
}
.deploy-btn:hover:not(:disabled) {
  filter: brightness(1.12);
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@media (max-width: 980px) {
  .shop-grid {
    grid-template-columns: 1fr;
  }
}
