/* ─── Reset & Base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --tan:     #c8a96e;
  --tan-dim: #8a6e3e;
  --dark:    #0d0e0b;
  --darker:  #070806;
  --green:   #2a3d1e;
  --green-lt:#4a7a2e;
  --red:     #c0392b;
  --white:   #e8e0cc;
  --scope-brown: #1a1208cc;
  --font-display: 'Georgia', 'Times New Roman', serif;
  --font-mono:    'Courier New', monospace;
}

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--darker);
  color: var(--white);
  font-family: var(--font-mono);
  cursor: none;
  user-select: none;
}

/* ─── Canvas ────────────────────────────────────────────── */
#canvas-wrap {
  position: fixed; inset: 0;
  z-index: 0;
}
#canvas-wrap canvas {
  display: block; width: 100% !important; height: 100% !important;
}

/* ─── Scope / Crosshair ─────────────────────────────────── */
#scope {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  display: none;
}

#scope-ring {
  position: absolute;
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(200,169,110,0.7);
  box-shadow:
    0 0 0 1px rgba(0,0,0,0.8),
    inset 0 0 40px rgba(0,0,0,0.4);
  transform: translate(-50%, -50%);
  /* position driven by JS */
}

.cross {
  position: absolute;
  background: rgba(200,169,110,0.75);
  transform: translate(-50%, -50%);
}
.cross-h {
  width: 160px; height: 1px;
  top: var(--cy, 50%); left: var(--cx, 50%);
}
.cross-v {
  width: 1px; height: 160px;
  top: var(--cy, 50%); left: var(--cx, 50%);
}

/* ─── HUD ───────────────────────────────────────────────── */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: none;
  justify-content: space-between;
  align-items: flex-start;
  padding: 18px 28px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.65) 0%, transparent 100%);
}

.hud-label {
  font-size: 10px;
  letter-spacing: 0.25em;
  color: var(--tan-dim);
  margin-bottom: 4px;
}

#score, #timer {
  font-family: var(--font-display);
  font-size: 36px;
  color: var(--tan);
  line-height: 1;
}

#timer.urgent { color: var(--red); animation: pulse 0.5s infinite alternate; }

@keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }

#ammo-pips {
  display: flex; gap: 6px; margin-top: 2px;
}
.pip {
  width: 10px; height: 22px;
  background: var(--tan);
  border-radius: 2px;
  transition: background 0.15s, transform 0.15s;
}
.pip.empty {
  background: transparent;
  border: 1px solid var(--tan-dim);
  transform: scaleY(0.7);
}

/* ─── Flash ─────────────────────────────────────────────── */
#flash {
  position: fixed; inset: 0;
  z-index: 30;
  background: rgba(255,240,180,0.55);
  pointer-events: none;
  opacity: 0;
}
#flash.bang {
  animation: bang 0.12s ease-out forwards;
}
@keyframes bang {
  0%   { opacity: 0.7; }
  100% { opacity: 0; }
}

/* ─── Hit marker ────────────────────────────────────────── */
#hit-marker {
  position: fixed;
  z-index: 25;
  font-size: 28px;
  color: var(--red);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  text-shadow: 0 0 8px rgba(192,57,43,0.8);
}
#hit-marker.show {
  animation: hitfade 0.5s ease-out forwards;
}
@keyframes hitfade {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(1.4); }
  100% { opacity: 0; transform: translate(-50%, -58%) scale(0.8); }
}

/* ─── Screens ───────────────────────────────────────────── */
.screen {
  position: fixed; inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7,8,6,0.88);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.4s;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
}

.screen-inner {
  text-align: center;
  padding: 48px 40px;
  border: 1px solid rgba(200,169,110,0.25);
  background: rgba(13,14,11,0.7);
  max-width: 420px;
  width: 90%;
}

.title-eyebrow {
  font-size: 11px;
  letter-spacing: 0.35em;
  color: var(--tan-dim);
  margin-bottom: 12px;
}

.game-title {
  font-family: var(--font-display);
  font-size: clamp(56px, 12vw, 96px);
  line-height: 0.9;
  color: var(--tan);
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  text-shadow: 0 2px 40px rgba(200,169,110,0.3);
}

.go-title {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--tan-dim);
  letter-spacing: 0.15em;
  margin-bottom: 10px;
}

.subtitle {
  font-size: 12px;
  letter-spacing: 0.1em;
  color: rgba(232,224,204,0.5);
  margin-bottom: 36px;
}

#final-score {
  font-family: var(--font-display);
  font-size: 80px;
  color: var(--tan);
  line-height: 1;
  margin-bottom: 8px;
}

#final-grade {
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--tan-dim);
  margin-bottom: 32px;
  min-height: 20px;
}

.btn-primary {
  display: inline-block;
  padding: 14px 40px;
  background: transparent;
  border: 1px solid var(--tan);
  color: var(--tan);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.25em;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-bottom: 28px;
}
.btn-primary:hover {
  background: var(--tan);
  color: var(--darker);
}

.controls-hint {
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 11px;
  color: rgba(232,224,204,0.35);
  flex-wrap: wrap;
}

/* ─── Reload bar ────────────────────────────────────────── */
#reload-bar-wrap {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  text-align: center;
  display: none;
}
#reload-bar-wrap .rl-label {
  font-size: 11px;
  letter-spacing: 0.3em;
  color: var(--tan-dim);
  margin-bottom: 6px;
}
#reload-bar {
  width: 180px;
  height: 3px;
  background: rgba(200,169,110,0.15);
  border: 1px solid rgba(200,169,110,0.3);
}
#reload-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--tan);
  transition: width 0.05s linear;
}