* { box-sizing: border-box; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #090b1f;
  color: #fff;
  user-select: none;
  touch-action: none;
  cursor: default;

  font-family: 'Comic Sans MS', 'Trebuchet MS', 'Arial Rounded MT Bold', Arial, sans-serif;
}

body.cursor-locked { cursor: none; }
body.fallback-look { cursor: crosshair; }

canvas { display: block; }

/* preloader */
#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at 24% 22%, rgba(65, 169, 255, 0.36), transparent 30%),
    radial-gradient(circle at 76% 30%, rgba(255, 78, 205, 0.26), transparent 28%),
    radial-gradient(circle at 50% 78%, rgba(112, 255, 83, 0.18), transparent 34%),
    linear-gradient(180deg, #162057 0%, #070817 100%);
  color: #7bd7ff;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #000, 0 0 16px rgba(73, 190, 255, 0.55);
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

#preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.preloader-panel {
  width: min(420px, 86vw);
  padding: 26px 24px 24px;
  background: linear-gradient(180deg, rgba(23, 31, 86, 0.94), rgba(8, 9, 28, 0.82));
  border: 1px solid rgba(123, 215, 255, 0.52);
  border-radius: 14px;
  box-shadow: 0 0 34px rgba(0, 0, 0, 0.8), 0 0 26px rgba(73, 190, 255, 0.22), inset 0 0 18px rgba(255, 78, 205, 0.08);
}

.preloader-title {
  margin-bottom: 18px;
  color: #7bd7ff;
  font-size: 30px;
  line-height: 1;
}

.preloader-bar {
  width: 100%;
  height: 16px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(123, 215, 255, 0.7);
  border-radius: 999px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.85), 0 0 16px rgba(73, 190, 255, 0.26);
  overflow: hidden;
}

#preloaderFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #3b8cff, #7bd7ff, #7cff5f, #ffe45e, #ff4ecd);
  box-shadow: 0 0 16px rgba(123, 215, 255, 0.75);
  transition: width 0.15s ease;
}

#preloaderText {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  line-height: 1;
}

#modeNote {
  position: absolute;
  top: 18px;
  right: 18px;
  max-width: 300px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: right;
  background: linear-gradient(180deg, rgba(23, 31, 86, 0.86), rgba(8, 9, 28, 0.66));
  border: 1px solid rgba(123, 215, 255, 0.32);
  border-radius: 12px;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.6), 0 0 16px rgba(73, 190, 255, 0.16);
  text-shadow: 0 2px 0 #000, 0 0 8px rgba(73, 190, 255, 0.32);
}

/* HUD base */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
}

#crosshair::before,
#crosshair::after {
  content: "";
  position: absolute;
  background: white;
  opacity: 0.9;
}

#crosshair::before {
  left: 8px;
  top: 0;
  width: 2px;
  height: 18px;
}

#crosshair::after {
  left: 0;
  top: 8px;
  width: 18px;
  height: 2px;
}

/* override default crosshair when HUD active */
.cs-hud #crosshair {
  width: 42px;
  height: 42px;
  transition: width 70ms ease, height 70ms ease;
  background:
    linear-gradient(#7cff5f, #7cff5f) center 0 / 2px 11px no-repeat,
    linear-gradient(#7cff5f, #7cff5f) center 100% / 2px 11px no-repeat,
    linear-gradient(#7cff5f, #7cff5f) 0 center / 11px 2px no-repeat,
    linear-gradient(#7cff5f, #7cff5f) 100% center / 11px 2px no-repeat;
  filter: drop-shadow(0 0 5px rgba(124, 255, 95, 0.95));
}

.cs-hud #crosshair::before,
.cs-hud #crosshair::after {
  display: none;
}

.cs-hud #crosshair.fire {
  width: 58px;
  height: 58px;
  background:
    linear-gradient(#ff4ecd, #ff4ecd) center 0 / 2px 12px no-repeat,
    linear-gradient(#ff4ecd, #ff4ecd) center 100% / 2px 12px no-repeat,
    linear-gradient(#ff4ecd, #ff4ecd) 0 center / 12px 2px no-repeat,
    linear-gradient(#ff4ecd, #ff4ecd) 100% center / 12px 2px no-repeat;
  filter: drop-shadow(0 0 7px rgba(255, 78, 205, 0.9));
}

#sniperScope {
  position: fixed;
  inset: 0;
  z-index: 7;
  display: none;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(circle at center, transparent 0 34vmin, rgba(5, 6, 18, 0.98) 34.4vmin 100%),
    linear-gradient(to right, transparent calc(50% - 1px), rgba(123, 215, 255, 0.8) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), rgba(123, 215, 255, 0.8) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
}

#sniperScope.active,
#sniperScope.open {
  display: block;
}

#sniperScope::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 68vmin;
  height: 68vmin;
  transform: translate(-50%, -50%);
  border: 3px solid rgba(123, 215, 255, 0.9);
  border-radius: 50%;
  box-shadow:
    0 0 0 2px rgba(255, 78, 205, 0.26),
    inset 0 0 32px rgba(0, 0, 0, 0.68),
    0 0 24px rgba(73, 190, 255, 0.55);
}

#sniperScope::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 6px;
  height: 6px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(123, 215, 255, 0.95);
  box-shadow:
    0 -16vmin 0 -2px rgba(123, 215, 255, 0.85),
    0 16vmin 0 -2px rgba(123, 215, 255, 0.85),
    -16vmin 0 0 -2px rgba(123, 215, 255, 0.85),
    16vmin 0 0 -2px rgba(123, 215, 255, 0.85);
}

.cs-hud.scoped #crosshair,
.cs-hud.scope-active #crosshair {
  display: none;
}

body.scoped #crosshair,
body.scope-active #crosshair {
  display: none;
}

/* HUD style */
.cs-hud {
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7bd7ff;
  text-shadow: 0 3px 0 #000, 0 0 11px rgba(73, 190, 255, 0.48);
}

.cs-hud #stats {
  position: static;
  padding: 0;
  background: transparent;
  border-radius: 0;
  line-height: 1;
  font-size: inherit;
  min-width: 0;
}

.cs-topbar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: linear-gradient(180deg, rgba(23, 31, 86, 0.9), rgba(7, 8, 23, 0.66));
  border: 1px solid rgba(123, 215, 255, 0.42);
  border-radius: 14px;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.64), 0 0 18px rgba(73, 190, 255, 0.18);
  font-size: 18px;
}

.cs-badge {
  color: #ffffff;
  font-size: 14px;
  opacity: 0.92;
}

.cs-score {
  min-width: 96px;
  text-align: center;
  color: #7cff5f;
  text-shadow: 0 3px 0 #000, 0 0 10px rgba(124, 255, 95, 0.55);
}

.cs-round {
  color: #ffe45e;
  text-shadow: 0 3px 0 #000, 0 0 10px rgba(255, 228, 94, 0.48);
}

.cs-bottom-left,
.cs-bottom-right {
  position: absolute;
  bottom: 24px;
  min-width: 155px;
  padding: 10px 14px 12px;
  background: linear-gradient(180deg, rgba(23, 31, 86, 0.84), rgba(7, 8, 23, 0.56));
  border: 1px solid rgba(123, 215, 255, 0.44);
  border-radius: 14px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.7), 0 0 18px rgba(73, 190, 255, 0.16);
}

.cs-bottom-left { left: 28px; }

.cs-bottom-right {
  right: 28px;
  text-align: right;
}

.cs-label {
  margin-bottom: 6px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  letter-spacing: 0.12em;
}

.cs-big,
.cs-ammo {
  font-size: 48px;
  line-height: 0.9;
  color: #7bd7ff;
}

.cs-ammo small {
  font-size: 22px;
  color: rgba(123, 215, 255, 0.78);
}

.cs-bottom-left.danger,
.cs-bottom-right.danger {
  border-color: rgba(255, 78, 205, 0.72);
  text-shadow: 0 3px 0 #000, 0 0 14px rgba(255, 78, 205, 0.68);
}

.cs-bottom-left.danger .cs-big,
.cs-bottom-right.danger .cs-ammo,
.cs-bottom-right.danger small {
  color: #ff4ecd;
}

/* buttons */
.cs-button {
  display: inline-block;
  margin-top: 12px;
  padding: 11px 22px;
  color: #ffffff;
  font-family: 'Comic Sans MS', 'Trebuchet MS', 'Arial Rounded MT Bold', Arial, sans-serif;
  font-size: 18px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #000, 0 0 10px rgba(73, 190, 255, 0.5);
  background: linear-gradient(180deg, #316dff, #192d9c 58%, #0c1453);
  border: 1px solid rgba(123, 215, 255, 0.72);
  border-radius: 14px;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.68), 0 0 18px rgba(73, 190, 255, 0.22);
  cursor: pointer;
  transition: all 0.12s ease;
}

.cs-button + .cs-button {
  margin-left: 14px;
}

.cs-button:hover {
  color: #ffffff;
  border-color: rgba(255, 228, 94, 0.95);
  box-shadow: 0 0 24px rgba(73, 190, 255, 0.38), 0 0 14px rgba(255, 78, 205, 0.24);
  transform: translateY(-1px);
}

.cs-button:active {
  transform: translateY(1px);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.72);
}

/* overlay */
#overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(5, 6, 18, 0.78);
  z-index: 10;
  text-align: center;
  padding: 24px;
}

#panel {
  width: min(540px, 92vw);
  padding: 28px;
  background: linear-gradient(180deg, rgba(23, 31, 86, 0.96), rgba(8, 9, 28, 0.94));
  border: 1px solid rgba(123, 215, 255, 0.34);
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.62), 0 0 26px rgba(73, 190, 255, 0.18);
}

h1 {
  margin: 0 0 12px;
  font-size: 30px;
  color: #7bd7ff;
  text-shadow: 0 3px 0 #000, 0 0 12px rgba(73, 190, 255, 0.45);
}

p {
  margin: 8px 0;
  color: #e8f7ff;
  line-height: 1.45;
}

/* remove default button styles */
button {
  all: unset;
  display: inline-block;
}

/* damage flash */
#damageFlash {
  position: fixed;
  inset: 0;
  background: rgba(255, 78, 205, 0.24);
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 120ms ease;
}

/* buy hint */
#buyHint {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  padding: 10px 18px;
  color: rgba(255, 255, 255, 0.84);
  font-size: 14px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 3px 0 #000, 0 0 8px rgba(73, 190, 255, 0.34);
  background: linear-gradient(180deg, rgba(23, 31, 86, 0.8), rgba(7, 8, 23, 0.52));
  border: 1px solid rgba(123, 215, 255, 0.34);
  border-radius: 14px;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.64), 0 0 14px rgba(73, 190, 255, 0.14);
  pointer-events: none;
}

#buyHint.hidden {
  display: none;
}

/* buy menu */
.cs-buy-menu {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  background: rgba(5, 6, 18, 0.66);
  font-family: inherit;
}

.cs-buy-menu.open {
  display: grid;
}

.cs-buy-panel {
  width: min(860px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid rgba(123, 215, 255, 0.32);
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(73, 190, 255, 0.18), transparent 30%),
    radial-gradient(circle at top right, rgba(255, 78, 205, 0.14), transparent 28%),
    rgba(11, 14, 42, 0.97);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.62), 0 0 24px rgba(73, 190, 255, 0.18);
  color: #fff;
}

.cs-buy-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.cs-buy-title {
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #7bd7ff;
  text-shadow: 0 3px 0 #000, 0 0 12px rgba(73, 190, 255, 0.48);
}

.cs-buy-subtitle {
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.78;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.cs-buy-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(123, 215, 255, 0.28);
  border-radius: 14px;
  background: rgba(123, 215, 255, 0.12);
  color: #fff;
  font-family: 'Comic Sans MS', 'Trebuchet MS', 'Arial Rounded MT Bold', Arial, sans-serif;
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  box-shadow: none;
  text-shadow: none;
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.cs-buy-close:hover {
  background: rgba(255, 78, 205, 0.72);
  border-color: rgba(255, 78, 205, 0.94);
  transform: translateY(-1px);
}

.cs-buy-close:active {
  transform: translateY(1px);
}

.cs-buy-score {
  margin-bottom: 16px;
  font-size: 24px;
  color: #7cff5f;
  text-shadow: 0 3px 0 #000, 0 0 10px rgba(124, 255, 95, 0.48);
}

.cs-buy-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cs-buy-card {
  position: relative;
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 15px;
  border: 1px solid rgba(123, 215, 255, 0.24);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(49, 109, 255, 0.16), rgba(255, 255, 255, 0.06));
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.cs-buy-card:hover:not(:disabled) {
  background: linear-gradient(180deg, rgba(73, 190, 255, 0.22), rgba(255, 78, 205, 0.08));
}

.cs-buy-card:disabled {
  cursor: default;
  opacity: 0.62;
}

.cs-buy-card.active {
  border-color: rgba(124, 255, 95, 0.9);
  opacity: 1;
  box-shadow: 0 0 16px rgba(124, 255, 95, 0.16);
}

.cs-buy-card.available {
  border-color: rgba(255, 228, 94, 0.82);
  box-shadow: 0 0 16px rgba(255, 228, 94, 0.12);
}

.cs-buy-card.locked {
  filter: grayscale(0.38);
}

.cs-buy-key {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.34);
  color: #7bd7ff;
  font-size: 14px;
}

.cs-buy-name {
  padding-right: 34px;
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cs-buy-stats {
  font-size: 12px;
  opacity: 0.78;
}

.cs-buy-status {
  margin-top: auto;
  font-size: 20px;
}

.cs-buy-price {
  display: inline-block;
  transition: color 0.12s ease, text-shadow 0.12s ease;
}

.cs-buy-price.affordable {
  color: #7cff5f;
  text-shadow: 0 0 10px rgba(124, 255, 95, 0.68);
}

.cs-buy-price.expensive {
  color: #ff4ecd;
  text-shadow: 0 0 10px rgba(255, 78, 205, 0.68);
}

.cs-buy-owned-text {
  color: #ffe45e;
}

.cs-buy-action {
  font-size: 12px;
  opacity: 0.78;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@media (max-width: 720px) {
  .cs-buy-grid {
    grid-template-columns: 1fr;
  }

  .cs-buy-panel {
    max-height: calc(100vh - 32px);
    overflow: auto;
  }
}

@media (max-width: 700px) {
  .preloader-panel {
    width: min(340px, 88vw);
    padding: 22px 18px 20px;
  }

  .preloader-title {
    font-size: 24px;
  }

  #preloaderText {
    font-size: 16px;
  }

  .cs-topbar { font-size: 14px; gap: 8px; }
  .cs-bottom-left,
  .cs-bottom-right { bottom: 16px; min-width: 118px; padding: 9px 11px; }
  .cs-bottom-left { left: 14px; }
  .cs-bottom-right { right: 14px; }
  .cs-big,
  .cs-ammo { font-size: 34px; }
  .cs-button { font-size: 15px; padding: 10px 18px; }
  #sniperScope {
    background:
      radial-gradient(circle at center, transparent 0 40vmin, rgba(5, 6, 18, 0.98) 40.4vmin 100%),
      linear-gradient(to right, transparent calc(50% - 1px), rgba(123, 215, 255, 0.8) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
      linear-gradient(to bottom, transparent calc(50% - 1px), rgba(123, 215, 255, 0.8) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
  }

  #sniperScope::before {
    width: 80vmin;
    height: 80vmin;
  }
}
