* { box-sizing: border-box; }

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

  font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', 'Trebuchet MS', 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 center, rgba(70, 62, 36, 0.22), transparent 42%),
    linear-gradient(180deg, #15120c 0%, #050505 100%);
  color: #f2d37b;
  text-align: center;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #000, 0 0 14px rgba(255, 188, 64, 0.35);
  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(22, 20, 14, 0.92), rgba(0, 0, 0, 0.72));
  border: 1px solid rgba(242, 211, 123, 0.38);
  border-radius: 4px;
  box-shadow: 0 0 34px rgba(0, 0, 0, 0.78), 0 0 24px rgba(255, 188, 64, 0.12);
}

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

.preloader-bar {
  width: 100%;
  height: 16px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(242, 211, 123, 0.56);
  border-radius: 3px;
  box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.85), 0 0 14px rgba(255, 188, 64, 0.16);
  overflow: hidden;
}

#preloaderFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #8fcf6a, #f2d37b);
  box-shadow: 0 0 14px rgba(242, 211, 123, 0.55);
  transition: width 0.15s ease;
}

#preloaderText {
  margin-top: 12px;
  color: rgba(255, 255, 255, 0.86);
  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.82);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: right;
  background: linear-gradient(180deg, rgba(20, 18, 12, 0.82), rgba(0, 0, 0, 0.55));
  border: 1px solid rgba(242, 211, 123, 0.24);
  border-radius: 4px;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.55);
  text-shadow: 0 2px 0 #000, 0 0 8px rgba(255, 188, 64, 0.22);
}

/* 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(#39ff14, #39ff14) center 0 / 2px 11px no-repeat,
    linear-gradient(#39ff14, #39ff14) center 100% / 2px 11px no-repeat,
    linear-gradient(#39ff14, #39ff14) 0 center / 11px 2px no-repeat,
    linear-gradient(#39ff14, #39ff14) 100% center / 11px 2px no-repeat;
}

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

.cs-hud #crosshair.fire {
  width: 58px;
  height: 58px;
  background:
    linear-gradient(#39ff14, #39ff14) center 0 / 2px 12px no-repeat,
    linear-gradient(#39ff14, #39ff14) center 100% / 2px 12px no-repeat,
    linear-gradient(#39ff14, #39ff14) 0 center / 12px 2px no-repeat,
    linear-gradient(#39ff14, #39ff14) 100% center / 12px 2px no-repeat;
}

#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(0, 0, 0, 0.98) 34.4vmin 100%),
    linear-gradient(to right, transparent calc(50% - 1px), rgba(0, 0, 0, 0.92) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), rgba(0, 0, 0, 0.92) 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(0, 0, 0, 0.96);
  border-radius: 50%;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.16),
    inset 0 0 32px rgba(0, 0, 0, 0.62),
    0 0 22px rgba(0, 0, 0, 0.95);
}

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

.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: #f2d37b;
  text-shadow: 0 2px 0 #000, 0 0 10px rgba(255, 188, 64, 0.35);
}

.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(20, 18, 12, 0.88), rgba(0, 0, 0, 0.58));
  border: 1px solid rgba(242, 211, 123, 0.32);
  border-radius: 4px;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.6);
  font-size: 18px;
}

.cs-badge {
  color: #e8e8e8;
  font-size: 14px;
  opacity: 0.9;
}

.cs-score {
  min-width: 96px;
  text-align: center;
  color: #95e37f;
}

.cs-round {
  color: #f2d37b;
}

.cs-bottom-left,
.cs-bottom-right {
  position: absolute;
  bottom: 24px;
  min-width: 155px;
  padding: 10px 14px 12px;
  background: linear-gradient(180deg, rgba(22, 20, 14, 0.82), rgba(0, 0, 0, 0.5));
  border: 1px solid rgba(242, 211, 123, 0.34);
  border-radius: 4px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.68);
}

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

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

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

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

.cs-ammo small {
  font-size: 22px;
  color: rgba(242, 211, 123, 0.75);
}

.cs-bottom-left.danger,
.cs-bottom-right.danger {
  border-color: rgba(255, 95, 79, 0.55);
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(255, 0, 0, 0.55);
}

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

/* buttons */
.cs-button {
  display: inline-block;
  margin-top: 12px;
  padding: 11px 22px;
  color: #f2d37b;
  font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', 'Trebuchet MS', 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 2px 0 #000, 0 0 10px rgba(255, 188, 64, 0.35);
  background: linear-gradient(180deg, rgba(22, 20, 14, 0.9), rgba(0, 0, 0, 0.65));
  border: 1px solid rgba(242, 211, 123, 0.45);
  border-radius: 4px;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.65);
  cursor: pointer;
  transition: all 0.12s ease;
}

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

.cs-button:hover {
  color: #ffffff;
  border-color: rgba(242, 211, 123, 0.9);
  box-shadow: 0 0 22px rgba(255, 188, 64, 0.35);
  transform: translateY(-1px);
}

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

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

#panel {
  width: min(540px, 92vw);
  padding: 28px;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

h1 {
  margin: 0 0 12px;
  font-size: 30px;
}

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

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

/* damage flash */
#damageFlash {
  position: fixed;
  inset: 0;
  background: rgba(255, 0, 0, 0.22);
  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.78);
  font-size: 14px;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #000, 0 0 8px rgba(255, 188, 64, 0.25);
  background: linear-gradient(180deg, rgba(20, 18, 12, 0.75), rgba(0, 0, 0, 0.45));
  border: 1px solid rgba(242, 211, 123, 0.25);
  border-radius: 4px;
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.6);
  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(0, 0, 0, 0.58);
  font-family: inherit;
}

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

.cs-buy-panel {
  width: min(860px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 18px;
  background: rgba(15, 18, 24, 0.96);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  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;
}

.cs-buy-subtitle {
  margin-top: 6px;
  font-size: 13px;
  opacity: 0.7;
  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(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-family: Arial, Helvetica, 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, 95, 79, 0.72);
  border-color: rgba(255, 95, 79, 0.92);
  transform: translateY(-1px);
}

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

.cs-buy-score {
  margin-bottom: 16px;
  font-size: 24px;
  color: #a7ff83;
}

.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(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.cs-buy-card:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.13);
}

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

.cs-buy-card.active {
  border-color: rgba(167, 255, 131, 0.85);
  opacity: 1;
}

.cs-buy-card.available {
  border-color: rgba(255, 222, 90, 0.72);
}

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

.cs-buy-key {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.32);
  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.75;
}

.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: #6cff6c;
  text-shadow: 0 0 10px rgba(108, 255, 108, 0.62);
}

.cs-buy-price.expensive {
  color: #ff5f4f;
  text-shadow: 0 0 10px rgba(255, 95, 79, 0.62);
}

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

.cs-buy-action {
  font-size: 12px;
  opacity: 0.75;
  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(0, 0, 0, 0.98) 40.4vmin 100%),
      linear-gradient(to right, transparent calc(50% - 1px), rgba(0, 0, 0, 0.92) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
      linear-gradient(to bottom, transparent calc(50% - 1px), rgba(0, 0, 0, 0.92) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
  }

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