* { box-sizing: border-box; }

:root {
  --fnaf-black: #020202;
  --fnaf-panel: rgba(5, 6, 5, 0.88);
  --fnaf-panel-heavy: rgba(0, 0, 0, 0.94);
  --fnaf-glass: rgba(12, 18, 14, 0.78);
  --fnaf-green: #8dff8d;
  --fnaf-green-dim: rgba(141, 255, 141, 0.58);
  --fnaf-red: #ff3d35;
  --fnaf-red-dim: rgba(255, 61, 53, 0.55);
  --fnaf-amber: #e6c56a;
  --fnaf-amber-dim: rgba(230, 197, 106, 0.5);
  --fnaf-white: #e9f2df;
  --fnaf-muted: rgba(233, 242, 223, 0.7);
  --fnaf-border: rgba(141, 255, 141, 0.34);
  --fnaf-border-hot: rgba(230, 197, 106, 0.48);
  --fnaf-shadow: rgba(0, 0, 0, 0.88);
  --fnaf-font: 'OCR A Extended';
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  color: var(--fnaf-white);
  user-select: none;
  touch-action: none;
  cursor: default;
  font-family: var(--fnaf-font);
  font-synthesis: none;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  z-index: 2;
  background:
    repeating-linear-gradient(
      180deg,
      rgba(255, 255, 255, 0.035) 0,
      rgba(255, 255, 255, 0.035) 1px,
      rgba(0, 0, 0, 0.08) 2px,
      rgba(0, 0, 0, 0.08) 4px
    );
  mix-blend-mode: screen;
  opacity: 0.42;
}

body::after {
  z-index: 3;
  background:
    radial-gradient(circle at center, transparent 0 50%, rgba(0, 0, 0, 0.54) 100%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.025), rgba(0, 255, 80, 0.018), rgba(0, 90, 255, 0.025));
  opacity: 0.85;
}

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

canvas {
  display: block;
  background: #000;
}

#preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 5px),
    radial-gradient(circle at 50% 42%, rgba(94, 150, 84, 0.16), transparent 38%),
    linear-gradient(180deg, #0b0d0a 0%, #000 100%);
  color: var(--fnaf-green);
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 7px rgba(141, 255, 141, 0.72), 2px 2px 0 #000;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

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

.preloader-panel {
  width: min(430px, 86vw);
  padding: 26px 24px 24px;
  background:
    linear-gradient(180deg, rgba(8, 14, 10, 0.96), rgba(0, 0, 0, 0.86)),
    repeating-linear-gradient(90deg, rgba(141, 255, 141, 0.04) 0 1px, transparent 1px 6px);
  border: 1px solid var(--fnaf-border);
  border-radius: 0;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.92),
    0 0 34px rgba(0, 0, 0, 0.9),
    inset 0 0 26px rgba(141, 255, 141, 0.08);
}

.preloader-title {
  margin-bottom: 18px;
  color: var(--fnaf-green);
  font-size: 30px;
  line-height: 1;
}

.preloader-bar {
  width: 100%;
  height: 16px;
  padding: 2px;
  background: rgba(0, 0, 0, 0.82);
  border: 1px solid var(--fnaf-border);
  border-radius: 0;
  box-shadow: inset 0 0 12px #000, 0 0 12px rgba(141, 255, 141, 0.16);
  overflow: hidden;
}

#preloaderFill {
  width: 0%;
  height: 100%;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.2) 0 5px, transparent 5px 10px),
    linear-gradient(90deg, #5cff5c, #e6c56a);
  box-shadow: 0 0 16px rgba(141, 255, 141, 0.64);
  transition: width 0.15s ease;
}

#preloaderText {
  margin-top: 12px;
  color: var(--fnaf-muted);
  font-size: 18px;
  line-height: 1;
}

#modeNote {
  position: absolute;
  top: 18px;
  right: 18px;
  max-width: 300px;
  padding: 10px 12px;
  color: var(--fnaf-muted);
  font-size: 13px;
  line-height: 1.4;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  text-align: right;
  background: var(--fnaf-panel);
  border: 1px solid rgba(141, 255, 141, 0.24);
  border-radius: 0;
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.74), inset 0 0 18px rgba(141, 255, 141, 0.06);
  text-shadow: 0 0 7px rgba(141, 255, 141, 0.28), 2px 2px 0 #000;
}

#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: var(--fnaf-green);
  opacity: 0.92;
  box-shadow: 0 0 7px rgba(141, 255, 141, 0.55);
}

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

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

.cs-hud #crosshair {
  width: 42px;
  height: 42px;
  transition: width 70ms ease, height 70ms ease;
  background:
    linear-gradient(var(--fnaf-green), var(--fnaf-green)) center 0 / 2px 11px no-repeat,
    linear-gradient(var(--fnaf-green), var(--fnaf-green)) center 100% / 2px 11px no-repeat,
    linear-gradient(var(--fnaf-green), var(--fnaf-green)) 0 center / 11px 2px no-repeat,
    linear-gradient(var(--fnaf-green), var(--fnaf-green)) 100% center / 11px 2px no-repeat;
  filter: drop-shadow(0 0 5px rgba(141, 255, 141, 0.58));
}

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

.cs-hud #crosshair.fire {
  width: 58px;
  height: 58px;
  background:
    linear-gradient(var(--fnaf-red), var(--fnaf-red)) center 0 / 2px 12px no-repeat,
    linear-gradient(var(--fnaf-red), var(--fnaf-red)) center 100% / 2px 12px no-repeat,
    linear-gradient(var(--fnaf-red), var(--fnaf-red)) 0 center / 12px 2px no-repeat,
    linear-gradient(var(--fnaf-red), var(--fnaf-red)) 100% center / 12px 2px no-repeat;
  filter: drop-shadow(0 0 7px rgba(255, 61, 53, 0.7));
}

#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%),
    repeating-linear-gradient(0deg, rgba(141, 255, 141, 0.04) 0 1px, transparent 1px 5px),
    linear-gradient(to right, transparent calc(50% - 1px), rgba(141, 255, 141, 0.88) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(to bottom, transparent calc(50% - 1px), rgba(141, 255, 141, 0.88) 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: 2px solid rgba(141, 255, 141, 0.7);
  border-radius: 50%;
  box-shadow:
    0 0 0 2px rgba(0, 0, 0, 0.96),
    inset 0 0 34px rgba(0, 0, 0, 0.72),
    0 0 18px rgba(141, 255, 141, 0.36);
}

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

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

.cs-hud {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fnaf-green);
  text-shadow: 0 0 8px rgba(141, 255, 141, 0.46), 2px 2px 0 #000;
}

.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:
    repeating-linear-gradient(90deg, rgba(141, 255, 141, 0.04) 0 1px, transparent 1px 8px),
    linear-gradient(180deg, rgba(8, 16, 10, 0.9), rgba(0, 0, 0, 0.62));
  border: 1px solid var(--fnaf-border);
  border-radius: 0;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.72), inset 0 0 14px rgba(141, 255, 141, 0.08);
  font-size: 18px;
}

.cs-badge {
  color: var(--fnaf-muted);
  font-size: 14px;
  opacity: 0.92;
}

.cs-score {
  min-width: 96px;
  text-align: center;
  color: var(--fnaf-green);
}

.cs-round {
  color: var(--fnaf-amber);
}

.cs-bottom-left,
.cs-bottom-right {
  position: absolute;
  bottom: 24px;
  min-width: 155px;
  padding: 10px 14px 12px;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 5px),
    linear-gradient(180deg, rgba(8, 16, 10, 0.82), rgba(0, 0, 0, 0.58));
  border: 1px solid var(--fnaf-border);
  border-radius: 0;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.78), inset 0 0 16px rgba(141, 255, 141, 0.06);
}

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

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

.cs-label {
  margin-bottom: 6px;
  color: var(--fnaf-muted);
  font-size: 13px;
  letter-spacing: 0.14em;
}

.cs-big,
.cs-ammo {
  font-size: 48px;
  line-height: 0.9;
  color: var(--fnaf-green);
}

.cs-ammo small {
  font-size: 22px;
  color: var(--fnaf-green-dim);
}

.cs-bottom-left.danger,
.cs-bottom-right.danger {
  border-color: var(--fnaf-red-dim);
  text-shadow: 0 0 10px rgba(255, 61, 53, 0.72), 2px 2px 0 #000;
}

.cs-bottom-left.danger .cs-big,
.cs-bottom-right.danger .cs-ammo,
.cs-bottom-right.danger small {
  color: var(--fnaf-red);
}

.cs-button {
  display: inline-block;
  margin-top: 12px;
  padding: 11px 22px;
  color: var(--fnaf-green);
  font-family: var(--fnaf-font);
  font-size: 18px;
  letter-spacing: 0.09em;
  line-height: 1;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(141, 255, 141, 0.5), 2px 2px 0 #000;
  background:
    linear-gradient(180deg, rgba(9, 18, 11, 0.92), rgba(0, 0, 0, 0.7));
  border: 1px solid var(--fnaf-border);
  border-radius: 0;
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.72), inset 0 0 12px rgba(141, 255, 141, 0.06);
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

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

.cs-button:hover {
  color: #fff;
  border-color: rgba(141, 255, 141, 0.86);
  box-shadow: 0 0 22px rgba(141, 255, 141, 0.28), inset 0 0 16px rgba(141, 255, 141, 0.1);
  transform: translateY(-1px);
}

.cs-button:active {
  color: var(--fnaf-red);
  transform: translateY(1px);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.78);
}

#overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 5px),
    rgba(0, 0, 0, 0.78);
  z-index: 10;
  text-align: center;
  padding: 24px;
}

#panel {
  width: min(540px, 92vw);
  padding: 28px;
  background:
    linear-gradient(180deg, rgba(8, 14, 10, 0.96), rgba(0, 0, 0, 0.9));
  border: 1px solid var(--fnaf-border-hot);
  border-radius: 0;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.72),
    inset 0 0 26px rgba(230, 197, 106, 0.07);
}

h1 {
  margin: 0 0 12px;
  color: var(--fnaf-amber);
  font-size: 30px;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
  text-shadow: 0 0 10px rgba(230, 197, 106, 0.45), 2px 2px 0 #000;
}

p {
  margin: 8px 0;
  color: var(--fnaf-muted);
  line-height: 1.45;
}

button {
  all: unset;
  display: inline-block;
}

#damageFlash {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at center, rgba(255, 61, 53, 0.08), rgba(255, 0, 0, 0.26));
  opacity: 0;
  pointer-events: none;
  z-index: 6;
  transition: opacity 120ms ease;
}

#buyHint {
  position: fixed;
  bottom: 18px;
  left: 50%;
  z-index: 6;
  transform: translateX(-50%);
  padding: 10px 18px;
  color: var(--fnaf-muted);
  font-size: 14px;
  letter-spacing: 0.09em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(141, 255, 141, 0.32), 2px 2px 0 #000;
  background: var(--fnaf-panel);
  border: 1px solid rgba(141, 255, 141, 0.24);
  border-radius: 0;
  box-shadow: 0 0 14px rgba(0, 0, 0, 0.72), inset 0 0 12px rgba(141, 255, 141, 0.06);
  pointer-events: none;
}

#buyHint.hidden {
  display: none;
}

.cs-buy-menu {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  place-items: center;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 5px),
    rgba(0, 0, 0, 0.76);
  font-family: inherit;
}

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

.cs-buy-panel {
  width: min(860px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--fnaf-border-hot);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(8, 14, 10, 0.98), rgba(0, 0, 0, 0.92));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.72), inset 0 0 26px rgba(141, 255, 141, 0.06);
  color: var(--fnaf-white);
}

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

.cs-buy-title {
  color: var(--fnaf-amber);
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 0 9px rgba(230, 197, 106, 0.4), 2px 2px 0 #000;
}

.cs-buy-subtitle {
  margin-top: 6px;
  color: var(--fnaf-muted);
  font-size: 13px;
  opacity: 1;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

.cs-buy-close {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 61, 53, 0.38);
  border-radius: 0;
  background: rgba(255, 61, 53, 0.08);
  color: var(--fnaf-red);
  font-family: var(--fnaf-font);
  font-size: 30px;
  line-height: 1;
  text-align: center;
  cursor: pointer;
  box-shadow: none;
  text-shadow: 0 0 7px rgba(255, 61, 53, 0.6);
  transition: background 0.12s ease, border-color 0.12s ease, transform 0.12s ease;
}

.cs-buy-close:hover {
  background: rgba(255, 61, 53, 0.22);
  border-color: rgba(255, 61, 53, 0.92);
  transform: translateY(-1px);
}

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

.cs-buy-score {
  margin-bottom: 16px;
  font-size: 24px;
  color: var(--fnaf-green);
  text-shadow: 0 0 8px rgba(141, 255, 141, 0.45), 2px 2px 0 #000;
}

.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(141, 255, 141, 0.2);
  border-radius: 0;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.025) 0 1px, transparent 1px 5px),
    rgba(4, 9, 5, 0.78);
  color: var(--fnaf-white);
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 0 14px rgba(0, 0, 0, 0.45);
}

.cs-buy-card:hover:not(:disabled) {
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 5px),
    rgba(9, 20, 11, 0.86);
  border-color: rgba(141, 255, 141, 0.46);
}

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

.cs-buy-card.active {
  border-color: rgba(141, 255, 141, 0.9);
  opacity: 1;
  box-shadow: 0 0 14px rgba(141, 255, 141, 0.14), inset 0 0 14px rgba(141, 255, 141, 0.08);
}

.cs-buy-card.available {
  border-color: rgba(230, 197, 106, 0.8);
}

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

.cs-buy-key {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid rgba(141, 255, 141, 0.25);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.55);
  color: var(--fnaf-green);
  font-size: 14px;
}

.cs-buy-name {
  padding-right: 34px;
  color: var(--fnaf-white);
  font-size: 18px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cs-buy-stats {
  color: var(--fnaf-muted);
  font-size: 12px;
  opacity: 1;
}

.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: var(--fnaf-green);
  text-shadow: 0 0 10px rgba(141, 255, 141, 0.62);
}

.cs-buy-price.expensive {
  color: var(--fnaf-red);
  text-shadow: 0 0 10px rgba(255, 61, 53, 0.62);
}

.cs-buy-owned-text {
  color: var(--fnaf-amber);
  text-shadow: 0 0 8px rgba(230, 197, 106, 0.42);
}

.cs-buy-action {
  color: var(--fnaf-muted);
  font-size: 12px;
  opacity: 1;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}

@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;
  }

  

  #modeNote {
    top: 10px;
    right: 10px;
    max-width: 230px;
    font-size: 11px;
  }

  .cs-topbar {
    top: 34px;
    gap: 8px;
    padding: 7px 10px;
    font-size: 14px;
  }

  .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-label {
    font-size: 11px;
  }

  .cs-big,
  .cs-ammo {
    font-size: 34px;
  }

  .cs-ammo small {
    font-size: 16px;
  }

  .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%),
      repeating-linear-gradient(0deg, rgba(141, 255, 141, 0.04) 0 1px, transparent 1px 5px),
      linear-gradient(to right, transparent calc(50% - 1px), rgba(141, 255, 141, 0.88) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
      linear-gradient(to bottom, transparent calc(50% - 1px), rgba(141, 255, 141, 0.88) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px));
  }

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