* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #0b0c0e; }
body { font-family: "Segoe UI", Tahoma, sans-serif; color: #e8e4d9; user-select: none; }
canvas { display: block; }

.hidden { display: none !important; }

#menu {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(42, 33, 20, 0.72) 0%, transparent 50%),
    linear-gradient(180deg, rgba(20, 17, 13, 0.78) 0%, rgba(11, 12, 14, 0.88) 100%);
}

.menu-panel { width: min(720px, 92vw); text-align: center; }
.menu-kicker {
  letter-spacing: 0.42em;
  font-size: 12px;
  color: #c4a35a;
  margin-bottom: 10px;
}
.menu-panel h1 {
  font-size: 64px;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 0.95;
}
.menu-panel h1 span { color: #de9b35; }
.menu-sub { margin: 14px 0 18px; color: #9a9386; font-size: 15px; }
.section-label {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: #c4a35a;
  margin: 0 0 8px;
}

.weapon-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.rank-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}
.rank-card {
  background: #161410;
  border: 1px solid #3a3428;
  color: #cfc8b8;
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.rank-card:hover { border-color: #8a7340; }
.rank-card.selected {
  border-color: #de9b35;
  background: #241c12;
  color: #f0d78a;
}

.weapon-card {
  background: #161410;
  border: 1px solid #3a3428;
  color: #e8e4d9;
  padding: 16px 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.weapon-card:hover { border-color: #8a7340; }
.weapon-card.selected {
  border-color: #de9b35;
  background: #241c12;
}
.w-name { font-size: 20px; font-weight: 700; }
.w-tag { font-size: 11px; color: #c4a35a; letter-spacing: 0.16em; margin: 4px 0; }
.w-stats { font-size: 12px; color: #8d8678; }

#fight-btn, #again-btn {
  width: 100%;
  border: 0;
  background: #de9b35;
  color: #1a140c;
  font-weight: 800;
  letter-spacing: 0.18em;
  font-size: 18px;
  padding: 14px;
  cursor: pointer;
}
#fight-btn:hover, #again-btn:hover { background: #f0b14a; }

.menu-controls { margin-top: 16px; font-size: 12px; color: #6f6a60; }

#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

#scoreboard {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  background: rgba(8, 8, 10, 0.55);
  border: 1px solid rgba(222, 155, 53, 0.25);
  padding: 8px 16px;
}
.score-side { display: flex; flex-direction: column; align-items: center; min-width: 48px; }
.score-side span { font-size: 10px; letter-spacing: 0.14em; color: #9a9386; }
.score-side b { font-size: 26px; line-height: 1; }
.score-side.you b { color: #6ec8ff; }
.score-side.ai b { color: #e07a3a; }
.score-mid { font-size: 10px; letter-spacing: 0.16em; color: #c4a35a; }

#crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
}
#crosshair::before, #crosshair::after {
  content: "";
  position: absolute;
  background: #9dff6a;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.55);
}
#crosshair::before { left: 5px; top: 0; width: 2px; height: 12px; }
#crosshair::after { left: 0; top: 5px; width: 12px; height: 2px; }
#hud.scoped #crosshair { display: none; }

#hitmarker {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  pointer-events: none;
}
#hitmarker.on { opacity: 1; transform: translate(-50%, -50%) scale(1); }
#hitmarker::before, #hitmarker::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 0;
  width: 2px;
  height: 18px;
  background: #f3f3f3;
}
#hitmarker::before { transform: rotate(45deg); }
#hitmarker::after { transform: rotate(-45deg); }
#hitmarker.head { filter: hue-rotate(-50deg) saturate(2); }

#scope-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 90px, rgba(0,0,0,0.88) 140px, #000 220px);
}
.scope-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 196px;
  height: 196px;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(0, 0, 0, 0.85);
  border-radius: 50%;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.35);
}
.scope-hair { position: absolute; background: #111; }
.scope-hair.h { left: 0; top: 50%; width: 100%; height: 1px; }
.scope-hair.v { top: 0; left: 50%; width: 1px; height: 100%; }

#hurt {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(140, 0, 0, 0.55) 100%);
  opacity: 0;
  transition: opacity 0.15s;
}
#hurt.show { opacity: 1; }

#bottom-hud {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.hp-label, #weapon-label {
  font-size: 10px;
  letter-spacing: 0.16em;
  color: #c4a35a;
}
#hp-num { font-size: 40px; font-weight: 800; line-height: 1; color: #d6ff7a; }
.hp-bar { width: 160px; height: 6px; background: #2a2a24; margin-top: 6px; }
#hp-fill { height: 100%; width: 100%; background: #b6e04a; }
.ammo-wrap { text-align: right; }
#ammo-clip { font-size: 40px; font-weight: 800; line-height: 1; display: inline; }
.ammo-rest { display: inline; color: #9a9386; font-size: 20px; }

#killfeed {
  position: absolute;
  top: 18px;
  right: 18px;
  text-align: right;
  font-size: 13px;
}
.kf {
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.4);
  padding: 3px 8px;
}
.kf .p { color: #6ec8ff; }
.kf .e { color: #e07a3a; }

#center-msg {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-size: 42px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-shadow: 0 2px 12px #000;
  opacity: 0;
}
#center-msg.show { opacity: 1; }

#click-lock {
  position: absolute;
  left: 50%;
  bottom: 90px;
  transform: translateX(-50%);
  letter-spacing: 0.2em;
  font-size: 13px;
  color: #c4a35a;
}

#end-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.72);
}
.end-panel { text-align: center; width: min(420px, 90vw); }
#end-title { font-size: 56px; font-weight: 800; letter-spacing: 0.08em; }
#end-title.win { color: #de9b35; }
#end-title.lose { color: #c45a3a; }
#end-score { margin: 10px 0 22px; font-size: 22px; color: #cfc8b8; }
