/* HIGH NOON — dusty amber, serape red, gunmetal on bleached bone. Wood-type poster lettering. */
@font-face {
  font-family: 'Rye';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(../vendor/rye-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Rye';
  font-style: normal; font-weight: 400; font-display: swap;
  src: url(../vendor/rye-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0300, U+0308, U+0329, U+1E00-1E9F, U+1EF1-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --amber: #d99a4e;
  --amber-hi: #f2c179;
  --bone: #efe3c8;
  --bone-dim: #cbb98f;
  --ink: #2a1c10;
  --serape: #b23a26;
  --gunmetal: #6f7d84;
  --paper: #e8d9b0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #1a1008; }
body {
  font-family: Georgia, 'Times New Roman', serif;
  color: var(--bone);
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
#app { position: fixed; inset: 0; }
#gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.woodtype { font-family: 'Rye', Georgia, serif; font-weight: 400; letter-spacing: 0.04em; }
.hidden { display: none !important; }

/* ---------- crosshair ---------- */
#crosshair {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px;
  margin: -22px 0 0 -22px; pointer-events: none; z-index: 20;
  transition: transform 0.08s ease-out;
}
.ch-ring {
  position: absolute; inset: 6px; border: 1.5px solid rgba(239,227,200,0.9);
  border-radius: 50%; box-shadow: 0 0 4px rgba(0,0,0,0.6);
}
.ch-dot { position: absolute; left: 50%; top: 50%; width: 3px; height: 3px; margin: -1.5px; background: var(--bone); border-radius: 50%; }
.ch-tick { position: absolute; background: rgba(239,227,200,0.9); box-shadow: 0 0 3px rgba(0,0,0,0.6); }
.ch-n { left: 50%; top: 0; width: 1.5px; height: 8px; margin-left: -0.75px; }
.ch-s { left: 50%; bottom: 0; width: 1.5px; height: 8px; margin-left: -0.75px; }
.ch-e { right: 0; top: 50%; height: 1.5px; width: 8px; margin-top: -0.75px; }
.ch-w { left: 0; top: 50%; height: 1.5px; width: 8px; margin-top: -0.75px; }
#crosshair.fanning { transform: scale(1.7); }
#crosshair.fanning .ch-ring { border-color: var(--serape); }
#crosshair.deadeye .ch-ring { border-color: var(--amber-hi); box-shadow: 0 0 12px rgba(242,193,121,0.8); }

#hitmarker {
  position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px;
  pointer-events: none; z-index: 21; opacity: 0;
  background:
    linear-gradient(45deg, transparent 44%, #ff5a3c 44%, #ff5a3c 56%, transparent 56%),
    linear-gradient(-45deg, transparent 44%, #ff5a3c 44%, #ff5a3c 56%, transparent 56%);
  -webkit-mask: radial-gradient(circle, transparent 30%, #000 32%);
  mask: radial-gradient(circle, transparent 30%, #000 32%);
}
#hitmarker.show { animation: hitpop 0.22s ease-out; }
#hitmarker.head { filter: drop-shadow(0 0 6px #ffd27a); transform: scale(1.35); }
@keyframes hitpop { 0% { opacity: 1; transform: scale(0.6); } 100% { opacity: 0; transform: scale(1.15); } }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; pointer-events: none; z-index: 15; }
#hud-top {
  position: absolute; top: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 14px 20px;
}
.hud-label { font-size: 10px; letter-spacing: 0.28em; color: var(--bone-dim); display: block; }
#hud-score, #hud-wave { text-align: left; text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
#hud-wave { text-align: right; }
#score-val, #wave-val { font-family: 'Rye', Georgia, serif; font-size: 26px; color: var(--amber-hi); }
#wave-banner {
  position: absolute; left: 50%; top: 12%; transform: translateX(-50%);
  text-align: center; pointer-events: none;
}
#wave-title { font-family: 'Rye', Georgia, serif; font-size: clamp(28px, 5vw, 52px); color: var(--bone); text-shadow: 0 2px 0 #4a2c12, 0 4px 14px rgba(0,0,0,0.7); }
#wave-sub { font-style: italic; color: var(--bone-dim); font-size: clamp(13px, 1.8vw, 17px); margin-top: 4px; }
#wave-banner.show { animation: bannerIn 2.6s ease-out forwards; }
@keyframes bannerIn {
  0% { opacity: 0; transform: translateX(-50%) scale(0.92); }
  12% { opacity: 1; transform: translateX(-50%) scale(1); }
  80% { opacity: 1; } 100% { opacity: 0; }
}

#hud-bottom {
  position: absolute; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 14px 20px; gap: 12px;
}
#hp-wrap { width: 150px; }
#hp-bar { height: 10px; border: 1px solid rgba(239,227,200,0.5); background: rgba(0,0,0,0.45); border-radius: 2px; overflow: hidden; }
#hp-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #8c2f1d, var(--serape), #d9663a); transition: width 0.2s; }

#ammo { display: flex; gap: 5px; align-items: flex-end; }
.bullet {
  width: 9px; height: 26px; position: relative;
  background: linear-gradient(180deg, var(--amber-hi) 0 22%, #b98a3e 22% 100%);
  border-radius: 4px 4px 1px 1px;
  box-shadow: 0 0 4px rgba(0,0,0,0.7), inset 0 0 2px rgba(0,0,0,0.4);
  transition: opacity 0.12s, transform 0.12s;
}
.bullet.spent { opacity: 0.18; transform: translateY(4px) scaleY(0.85); }
.bullet.chambered { outline: 1px solid rgba(255,235,190,0.8); }

#cooldowns { display: flex; gap: 10px; }
.cd {
  width: 52px; height: 52px; position: relative; border: 1px solid rgba(239,227,200,0.4);
  border-radius: 4px; background: rgba(20,12,6,0.55); overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.cd-fill { position: absolute; left: 0; bottom: 0; width: 100%; height: 0%; background: rgba(217,154,78,0.28); }
.cd.ready { border-color: var(--amber-hi); box-shadow: 0 0 8px rgba(242,193,121,0.45); }
.cd-key { font-size: 10px; color: var(--bone-dim); letter-spacing: 0.1em; }
.cd-name { font-size: 11px; color: var(--bone); letter-spacing: 0.12em; }
#cd-deadeye.charged { border-color: #ffcf7a; box-shadow: 0 0 14px rgba(255,207,122,0.8); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 22px rgba(255,207,122,0.95); } }

#deadeye-hint {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  font-style: italic; color: var(--amber-hi); text-shadow: 0 1px 4px #000; font-size: 15px;
  animation: pulse 1s infinite;
}
#reload-hint {
  position: absolute; left: 50%; bottom: 96px; transform: translateX(-50%);
  font-size: 13px; letter-spacing: 0.3em; color: var(--bone-dim); text-shadow: 0 1px 4px #000;
}

#floaters { position: absolute; inset: 0; overflow: hidden; }
.floater {
  position: absolute; font-family: 'Rye', Georgia, serif; color: var(--amber-hi);
  text-shadow: 0 1px 3px #000; font-size: 18px; pointer-events: none;
  animation: floatUp 1.1s ease-out forwards; white-space: nowrap;
}
.floater.big { font-size: 26px; color: #ffd27a; }
@keyframes floatUp { 0% { opacity: 0; transform: translateY(8px); } 15% { opacity: 1; } 100% { opacity: 0; transform: translateY(-46px); } }

#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 18; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(140,20,8,0.55) 100%);
  transition: opacity 0.25s;
}
#noon-flash {
  position: absolute; inset: 0; pointer-events: none; z-index: 17; opacity: 0;
  background: radial-gradient(ellipse at 50% 20%, rgba(255,236,190,0.9), rgba(255,200,110,0.35) 55%, transparent 80%);
  transition: opacity 0.5s;
}

/* ---------- title screen ---------- */
#title-screen {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 118%, rgba(178,88,38,0.55), transparent 60%),
    linear-gradient(180deg, #c98f4e 0%, #a56a33 38%, #5f3a1c 72%, #2a1a0c 100%);
}
#title-screen::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(20,10,4,0.75) 100%);
  pointer-events: none;
}
.title-inner { position: relative; text-align: center; z-index: 2; padding: 20px; max-width: 720px; }
.title-eyebrow { font-size: 11px; letter-spacing: 0.34em; color: #3a2410; margin-bottom: 10px; font-weight: bold; }
#title-screen h1 {
  font-size: clamp(56px, 13vw, 128px); line-height: 0.95;
  color: #3a2410;
  text-shadow: 0 1px 0 #e8c88a, 0 -1px 0 #1c1006, 0 6px 24px rgba(0,0,0,0.35);
}
.title-sub { font-style: italic; font-size: clamp(15px, 2.4vw, 21px); color: #4a2e12; margin-top: 6px; }
.title-quote { font-style: italic; color: #2e1c0a; margin: 18px 0 4px; font-size: clamp(14px, 2vw, 18px); }
.woodbtn {
  font-family: 'Rye', Georgia, serif; font-size: 26px; letter-spacing: 0.12em;
  color: var(--paper); background: linear-gradient(180deg, #6b3f1c, #4a2a10);
  border: 2px solid #2a1808; border-radius: 4px; padding: 12px 54px; margin: 18px 0 8px;
  cursor: pointer; box-shadow: 0 4px 0 #1c0e04, 0 8px 18px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,220,160,0.25);
  transition: transform 0.08s, box-shadow 0.08s;
}
.woodbtn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 #1c0e04, 0 10px 22px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,220,160,0.3); }
.woodbtn:active { transform: translateY(3px); box-shadow: 0 1px 0 #1c0e04; }
.controls-card {
  display: flex; gap: 28px; justify-content: center; text-align: left;
  background: rgba(38,22,8,0.55); border: 1px solid rgba(232,217,176,0.25);
  border-radius: 6px; padding: 14px 20px; margin-top: 14px;
  font-size: 13px; line-height: 1.9; color: var(--bone);
}
.controls-card b { color: var(--amber-hi); }
.title-foot { margin-top: 16px; font-style: italic; font-size: 13px; color: #3a2410; }

/* ---------- wanted poster / end screen ---------- */
#end-screen {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background: rgba(18,10,4,0.72); backdrop-filter: blur(2px);
}
#poster {
  width: min(420px, 92vw); background:
    linear-gradient(180deg, #ecdcb2, #dcc58f 70%, #c9ad74);
  color: var(--ink); text-align: center; padding: 26px 26px 22px;
  border-radius: 2px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.8), inset 0 0 60px rgba(120,80,30,0.25);
  transform: rotate(-1.2deg);
  position: relative;
}
#poster::before {
  content: ""; position: absolute; top: 8px; left: 50%; width: 10px; height: 10px;
  margin-left: -5px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #8b9094, #4a4f52);
  box-shadow: 0 2px 3px rgba(0,0,0,0.5);
}
.poster-rule { height: 3px; border-top: 2px solid #3a2a18; border-bottom: 1px solid #3a2a18; margin: 8px 0; }
#poster-kicker { font-size: 10px; letter-spacing: 0.3em; }
#poster-title { font-size: 58px; line-height: 1; margin: 6px 0 0; }
#poster-sub { font-size: 15px; letter-spacing: 0.42em; margin: 2px 0 10px; }
#poster-face { opacity: 0.85; margin: 4px 0; }
#poster-name { font-family: 'Rye', Georgia, serif; font-size: 21px; }
#poster-crime { font-size: 11.5px; letter-spacing: 0.12em; margin: 4px 0 10px; }
#poster-reward-label { font-size: 10px; letter-spacing: 0.3em; }
#poster-reward { font-size: 40px; color: #7c1f10; }
#poster-best { font-size: 12px; font-style: italic; margin-bottom: 4px; }
#poster-quip { font-style: italic; font-size: 14px; margin: 10px 0 4px; color: #4a3418; }
#poster .woodbtn { font-size: 20px; padding: 10px 34px; margin: 10px 0 2px; }
.poster-hint { font-size: 11px; color: #6a4c24; }

/* ---------- touch ---------- */
#touch-controls { position: absolute; inset: 0; z-index: 25; pointer-events: none; }
#stick-zone { position: absolute; left: 0; bottom: 0; width: 45%; height: 55%; pointer-events: auto; }
#stick-base {
  position: absolute; left: 60px; bottom: 90px; width: 110px; height: 110px;
  border: 2px solid rgba(239,227,200,0.35); border-radius: 50%;
  background: rgba(20,12,6,0.3); display: none;
}
#stick-base.on { display: block; }
#stick-nub {
  position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px;
  border-radius: 50%; background: rgba(217,154,78,0.55); border: 1px solid var(--bone-dim);
}
#touch-buttons {
  position: absolute; right: 10px; bottom: 86px; display: flex; flex-direction: column; gap: 10px;
  pointer-events: auto;
}
.tbtn {
  width: 74px; height: 52px; border-radius: 8px; border: 1.5px solid rgba(239,227,200,0.5);
  background: rgba(30,18,8,0.6); color: var(--bone); font-family: 'Rye', Georgia, serif;
  font-size: 13px; letter-spacing: 0.08em;
}
.tbtn:active { background: rgba(178,58,38,0.6); }
.tbtn.small { width: 74px; height: 38px; font-size: 11px; }
.tbtn.disabled { opacity: 0.35; }

/* ---------- small screens ---------- */
@media (max-width: 700px) {
  #hp-wrap { width: 100px; }
  #cooldowns { display: none; }
  .controls-card { flex-direction: column; gap: 4px; font-size: 12px; padding: 10px 14px; }
  #score-val, #wave-val { font-size: 19px; }
  #hud-bottom { padding: 10px 12px; }
  #hud-top { padding: 10px 12px; }
  #deadeye-hint, #reload-hint { bottom: 170px; }
}
