/* SOLDIER:76 — OPERATION DOCKLAND */
@font-face {
  font-family: 'Black Ops One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/blackopsone-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+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --olive: #5a6148;
  --gunmetal: #2b2f33;
  --asphalt: #0a0e16;
  --signal-red: #d8372c;
  --visor-gold: #ffb340;
  --bone: #d8d4c4;
  --steel: #8a9199;
  --stencil: 'Black Ops One', 'Courier New', monospace;
  --mono: 'Courier New', ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { width: 100%; height: 100%; overflow: hidden; background: var(--asphalt); }
body { font-family: var(--mono); color: var(--bone); }

#app { position: fixed; inset: 0; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.hidden { display: none !important; }

/* ---------- Title / dispatch ---------- */
#title-screen, #end-screen {
  position: absolute; inset: 0; z-index: 40;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse at 50% 120%, rgba(216,55,44,.08), transparent 60%),
    linear-gradient(180deg, rgba(6,9,14,.88), rgba(6,9,14,.94));
  padding: 16px;
  overflow-y: auto;
}
.dispatch {
  width: min(680px, 94vw);
  border: 1px solid rgba(216,212,196,.25);
  background: linear-gradient(180deg, rgba(20,24,30,.92), rgba(12,15,20,.95));
  box-shadow: 0 0 60px rgba(0,0,0,.7), inset 0 0 40px rgba(0,0,0,.4);
  padding: clamp(18px, 4vw, 40px);
  position: relative;
}
.dispatch::before {
  content: ''; position: absolute; inset: 6px;
  border: 1px dashed rgba(216,212,196,.15); pointer-events: none;
}
.dispatch-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 8px; flex-wrap: wrap; }
.stamp {
  font-family: var(--stencil); color: var(--signal-red);
  border: 2px solid var(--signal-red); padding: 2px 10px;
  transform: rotate(-3deg); letter-spacing: 2px; font-size: 14px;
  text-shadow: 0 0 8px rgba(216,55,44,.5);
}
.dispatch-id { font-size: 11px; color: var(--steel); letter-spacing: 1px; }
#title-screen h1 {
  font-family: var(--stencil); font-size: clamp(38px, 9vw, 72px);
  color: var(--bone); letter-spacing: 2px; line-height: 1;
  text-shadow: 0 0 24px rgba(255,179,64,.25), 3px 3px 0 rgba(216,55,44,.35);
}
#title-screen h1 .colon { color: var(--signal-red); }
.op-name {
  font-family: var(--stencil); color: var(--visor-gold);
  letter-spacing: 6px; font-size: clamp(13px, 2.5vw, 18px); margin: 6px 0 18px;
}
.brief { border-left: 3px solid var(--olive); padding-left: 12px; margin-bottom: 18px; }
.brief p { font-size: 13px; line-height: 1.55; color: var(--bone); margin-bottom: 8px; }
.controls-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px 14px; margin-bottom: 22px; font-size: 12px;
}
.controls-grid div { display: flex; justify-content: space-between; border-bottom: 1px dotted rgba(216,212,196,.2); padding: 3px 0; gap: 8px; }
.controls-grid b { color: var(--visor-gold); font-weight: normal; }
.controls-grid span { color: var(--steel); }
#deploy-btn, #restart-btn {
  font-family: var(--stencil); font-size: clamp(18px, 3vw, 24px);
  background: var(--signal-red); color: #fff; border: none;
  padding: 12px 34px; letter-spacing: 3px; cursor: pointer;
  box-shadow: 0 0 22px rgba(216,55,44,.45);
  transition: transform .12s, box-shadow .12s;
  min-height: 48px;
}
#deploy-btn:hover, #restart-btn:hover { transform: translateY(-2px); box-shadow: 0 0 34px rgba(216,55,44,.75); }
.dispatch-foot { margin-top: 18px; font-size: 11px; color: var(--steel); letter-spacing: 1px; }

.dispatch.end { text-align: center; }
#end-title { font-family: var(--stencil); font-size: clamp(30px, 7vw, 56px); letter-spacing: 3px; }
#end-title.win { color: var(--visor-gold); text-shadow: 0 0 30px rgba(255,179,64,.5); }
#end-title.lose { color: var(--signal-red); text-shadow: 0 0 30px rgba(216,55,44,.5); }
#end-sub { margin: 8px 0 16px; color: var(--steel); font-size: 13px; letter-spacing: 2px; }
#end-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 20px;
  text-align: left; font-size: 13px; margin: 0 auto 22px; max-width: 420px;
}
#end-stats div { display: flex; justify-content: space-between; border-bottom: 1px dotted rgba(216,212,196,.2); padding: 3px 0; }
#end-stats b { color: var(--visor-gold); font-weight: normal; }

/* ---------- HUD ---------- */
#hud { position: absolute; inset: 0; z-index: 20; pointer-events: none; }

#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.ch-line { position: absolute; background: rgba(216,212,196,.9); box-shadow: 0 0 4px rgba(0,0,0,.8); }
.ch-t { width: 2px; height: 8px; left: -1px; top: calc(-10px - var(--spread, 4px)); }
.ch-b { width: 2px; height: 8px; left: -1px; top: calc(2px + var(--spread, 4px)); }
.ch-l { width: 8px; height: 2px; top: -1px; left: calc(-10px - var(--spread, 4px)); }
.ch-r { width: 8px; height: 2px; top: -1px; left: calc(2px + var(--spread, 4px)); }
.ch-dot { position: absolute; width: 2px; height: 2px; left: -1px; top: -1px; background: var(--bone); }
#crosshair.visor-on .ch-line { background: var(--visor-gold); box-shadow: 0 0 8px var(--visor-gold); }

#hitmarker {
  position: absolute; left: 50%; top: 50%; width: 22px; height: 22px;
  transform: translate(-50%, -50%) rotate(45deg) scale(.6); opacity: 0;
}
#hitmarker::before, #hitmarker::after { content: ''; position: absolute; background: #fff; }
#hitmarker::before { left: 10px; top: 0; width: 2px; height: 22px; }
#hitmarker::after { top: 10px; left: 0; width: 22px; height: 2px; }
#hitmarker.pop { animation: hitpop .18s ease-out; }
#hitmarker.kill::before, #hitmarker.kill::after { background: var(--signal-red); }
@keyframes hitpop { 0% { opacity: 1; transform: translate(-50%,-50%) rotate(45deg) scale(1.25);} 100% { opacity: 0; transform: translate(-50%,-50%) rotate(45deg) scale(.6);} }

#barks {
  position: absolute; top: 18px; left: 18px; max-width: min(420px, 60vw);
  font-size: 12px; line-height: 1.5;
}
.bark {
  color: #9fd6a0; text-shadow: 0 1px 2px #000;
  background: rgba(8,12,10,.55); border-left: 2px solid #4c7a4e;
  padding: 3px 8px; margin-bottom: 4px;
  animation: barkin .25s ease-out;
}
.bark .who { color: var(--visor-gold); }
@keyframes barkin { from { opacity: 0; transform: translateX(-8px);} to { opacity: 1; transform: none; } }
.bark.fade { opacity: 0; transition: opacity .8s; }

#objective-banner { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); text-align: center; }
#sector-label { font-size: 11px; letter-spacing: 3px; color: var(--steel); }
#objective-text { font-family: var(--stencil); font-size: clamp(14px, 2.6vw, 20px); letter-spacing: 3px; color: var(--bone); text-shadow: 0 0 12px rgba(0,0,0,.9); }
#hostiles-left { font-size: 11px; color: var(--signal-red); letter-spacing: 2px; margin-top: 2px; }

#hud-bottom-left { position: absolute; left: 18px; bottom: 18px; }
.hud-tag { font-size: 10px; letter-spacing: 2px; color: var(--steel); display: block; margin-bottom: 3px; }
#health-bar { width: min(220px, 34vw); height: 12px; background: rgba(10,14,20,.8); border: 1px solid rgba(216,212,196,.3); }
#health-fill { height: 100%; width: 100%; background: linear-gradient(90deg, #7fae6b, #a5d189); transition: width .15s; }
#health-fill.low { background: linear-gradient(90deg, #b03a30, var(--signal-red)); }
#health-num { font-family: var(--stencil); font-size: 20px; color: var(--bone); margin-top: 2px; }
#ability-row { display: flex; gap: 10px; margin-top: 12px; }
.ability { width: 64px; }
.ability .ab-key { font-size: 10px; color: var(--visor-gold); display: block; }
.ability .ab-name { font-size: 10px; letter-spacing: 1px; color: var(--bone); display: block; margin: 1px 0 3px; }
.ab-cd { height: 5px; background: rgba(10,14,20,.8); border: 1px solid rgba(216,212,196,.25); }
.ab-cd-fill { height: 100%; width: 100%; background: var(--olive); }
.ability.ready .ab-cd-fill { background: var(--visor-gold); box-shadow: 0 0 6px rgba(255,179,64,.7); }
.ability.flash { animation: abflash .4s ease-out; }
@keyframes abflash { 0% { transform: scale(1.15);} 100% { transform: none; } }

#hud-bottom-right { position: absolute; right: 18px; bottom: 18px; text-align: right; }
#score-wrap { margin-bottom: 8px; }
#score-num { font-family: var(--stencil); font-size: 20px; color: var(--visor-gold); }
#ammo-mag { font-family: var(--stencil); font-size: clamp(34px, 6vw, 48px); color: var(--bone); text-shadow: 0 0 14px rgba(255,179,64,.3); line-height: 1; }
#ammo-mag.low { color: var(--signal-red); animation: ammopulse .6s infinite; }
@keyframes ammopulse { 50% { opacity: .45; } }
#ammo-state { font-size: 10px; letter-spacing: 2px; color: var(--steel); }

#event-toast {
  position: absolute; left: 50%; bottom: 24%; transform: translateX(-50%);
  font-family: var(--stencil); font-size: clamp(13px, 2.4vw, 18px); letter-spacing: 2px;
  color: var(--visor-gold); text-shadow: 0 0 12px rgba(0,0,0,.9);
  opacity: 0; transition: opacity .2s; text-align: center; white-space: nowrap;
}
#event-toast.show { opacity: 1; }

/* ---------- Visor overlay ---------- */
#visor-overlay { position: absolute; inset: 0; z-index: 15; pointer-events: none; }
#visor-overlay::before { content: ''; position: absolute; inset: 0; background: rgba(255,179,64,.10); mix-blend-mode: screen; }
.visor-scanlines {
  position: absolute; inset: 0;
  background: repeating-linear-gradient(0deg, rgba(255,179,64,.06) 0 1px, transparent 1px 4px);
  animation: scandrift 1.2s linear infinite;
}
@keyframes scandrift { to { background-position: 0 8px; } }
.visor-frame {
  position: absolute; inset: 0;
  box-shadow: inset 0 0 120px rgba(255,179,64,.35);
  border: 2px solid rgba(255,179,64,.25);
}
#visor-readout {
  position: absolute; top: 12%; left: 50%; transform: translateX(-50%);
  font-family: var(--stencil); color: var(--visor-gold); letter-spacing: 4px;
  font-size: clamp(12px, 2.2vw, 16px); text-shadow: 0 0 10px rgba(255,179,64,.8);
  animation: visorblink 1s steps(2) infinite;
}
@keyframes visorblink { 50% { opacity: .55; } }

/* ---------- Damage vignette ---------- */
#damage-vignette {
  position: absolute; inset: 0; z-index: 14; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(180,20,10,.55) 100%);
  transition: opacity .25s;
}

/* ---------- Touch UI ---------- */
#touch-ui { position: absolute; inset: 0; z-index: 30; pointer-events: none; }
#joystick {
  position: absolute; left: 26px; bottom: 90px; width: 120px; height: 120px;
  border: 2px solid rgba(216,212,196,.35); border-radius: 50%;
  background: rgba(10,14,20,.35); pointer-events: auto; touch-action: none;
}
#joystick-knob {
  position: absolute; left: 50%; top: 50%; width: 52px; height: 52px;
  margin: -26px 0 0 -26px; border-radius: 50%;
  background: rgba(216,212,196,.4); border: 2px solid rgba(216,212,196,.6);
}
#touch-buttons { position: absolute; right: 14px; bottom: 84px; display: grid; grid-template-columns: repeat(2, 64px); gap: 10px; pointer-events: auto; }
.tbtn {
  width: 64px; height: 56px; font-family: var(--stencil); font-size: 13px; letter-spacing: 1px;
  color: var(--bone); background: rgba(20,26,34,.65); border: 1px solid rgba(216,212,196,.4);
  border-radius: 6px; touch-action: none;
}
.tbtn:active { background: rgba(216,55,44,.55); }
.tbtn.big { grid-column: span 2; width: 138px; height: 64px; background: rgba(216,55,44,.5); font-size: 16px; }

#boot-error {
  position: absolute; inset: 0; z-index: 99; display: flex; align-items: center; justify-content: center;
  background: var(--asphalt); color: var(--signal-red); font-size: 14px; padding: 24px; text-align: center;
}

@media (max-width: 700px) {
  #barks { top: 64px; max-width: 52vw; font-size: 11px; }
  #hud-bottom-left { left: 12px; bottom: 12px; }
  #hud-bottom-right { right: 12px; bottom: 12px; }
  .ability { width: 52px; }
  #health-bar { width: 34vw; }
}
@media (pointer: coarse) {
  #hud-bottom-left { bottom: 300px; }
  #hud-bottom-right { bottom: 300px; }
}
