@import url("https://fonts.googleapis.com/css2?family=Rajdhani:wght@500;600;700&display=swap");

:root {
  --hud: #f2f4ee;
  --dim: rgba(242, 244, 238, .55);
  --accent: #9fd356;
  --enemy: #ff4b3e;
  --ally: #4fb6ff;
  --gold: #ffcc4d;
  --glass: rgba(14, 18, 16, .55);
  --line: rgba(255, 255, 255, .14);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: #0c0f0d; color: var(--hud);
  font-family: Rajdhani, "Segoe UI", Roboto, system-ui, sans-serif; user-select: none; -webkit-user-select: none;
}
canvas#view { display: block; width: 100vw; height: 100vh; }
.hidden { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.7); }

/* ---------- damage ---------- */
#vignette, #blood { position: absolute; inset: 0; opacity: 0; }
#vignette { background: radial-gradient(ellipse at center, transparent 40%, rgba(140, 0, 0, .85) 100%); }
#blood {
  background:
    radial-gradient(circle at 6% 12%, rgba(120,0,0,.9) 0 6%, transparent 14%),
    radial-gradient(circle at 92% 18%, rgba(110,0,0,.85) 0 5%, transparent 12%),
    radial-gradient(circle at 10% 86%, rgba(120,0,0,.9) 0 7%, transparent 16%),
    radial-gradient(circle at 88% 90%, rgba(100,0,0,.85) 0 6%, transparent 15%),
    radial-gradient(circle at 50% 104%, rgba(110,0,0,.8) 0 8%, transparent 18%),
    radial-gradient(circle at 50% -6%, rgba(110,0,0,.7) 0 6%, transparent 14%);
  filter: blur(2px);
}
#dmgDirs { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
.dmgDir {
  position: absolute; left: -90px; top: -90px; width: 180px; height: 180px; border-radius: 50%;
  border-top: 6px solid rgba(255, 40, 30, .9); filter: drop-shadow(0 0 6px rgba(255,0,0,.7));
  clip-path: polygon(30% 0, 70% 0, 50% 50%);
}

/* ---------- scope ---------- */
#scope { position: absolute; inset: 0; opacity: 0; transition: opacity .06s; }
#scope .ring {
  position: absolute; left: 50%; top: 50%; width: 92vmin; height: 92vmin; transform: translate(-50%, -50%);
  border-radius: 50%; box-shadow: 0 0 0 200vmax #000, inset 0 0 40px 18px rgba(0,0,0,.9);
}
#scope .lineH, #scope .lineV { position: absolute; background: #000; }
#scope .lineH { left: 4vw; right: 4vw; top: 50%; height: 2px; margin-top: -1px; }
#scope .lineV { top: 4vh; bottom: 4vh; left: 50%; width: 2px; margin-left: -1px; }
#scope .dot { position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #ff2a1a; box-shadow: 0 0 4px #f00; }
#breath { position: absolute; left: 50%; bottom: 14vh; transform: translateX(-50%); font-weight: 600; letter-spacing: 2px; color: var(--dim); font-size: 14px; }

/* ---------- radar ---------- */
#radarWrap { position: absolute; left: 22px; top: 22px; width: 200px; height: 200px; }
#radar { border-radius: 50%; box-shadow: 0 0 0 2px rgba(255,255,255,.25), 0 0 20px rgba(0,0,0,.5); }
#uavTag {
  position: absolute; right: -8px; top: -4px; background: var(--accent); color: #0c0f0d; font-weight: 700;
  padding: 1px 8px; border-radius: 3px; font-size: 13px; letter-spacing: 1px; opacity: 0; text-shadow: none;
}
#uavTag.on { opacity: 1; }

/* ---------- top center ---------- */
#topCenter { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; }
#compass { width: 460px; height: 38px; }
#scoreBar { display: flex; align-items: center; gap: 4px; }
.sb { display: flex; align-items: center; gap: 8px; padding: 2px 12px; min-width: 120px; background: var(--glass); border: 1px solid var(--line); }
.sb.you { justify-content: flex-end; border-right: 3px solid var(--accent); }
.sb.lead { border-left: 3px solid var(--enemy); }
.sb span { font-size: 13px; letter-spacing: 1px; color: var(--dim); }
.sb b { font-size: 24px; font-variant-numeric: tabular-nums; }
#timer { font-size: 18px; font-weight: 700; padding: 4px 10px; background: rgba(0,0,0,.55); font-variant-numeric: tabular-nums; }
#goal { font-size: 12px; letter-spacing: 2px; color: var(--dim); }

/* ---------- killfeed ---------- */
#killfeed { position: absolute; top: 20px; right: 22px; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.kf {
  display: flex; align-items: center; gap: 8px; padding: 3px 10px; background: rgba(0,0,0,.42);
  font-size: 17px; font-weight: 600; white-space: nowrap; animation: kfIn .18s ease-out; transition: opacity .4s;
}
.kf .w { color: var(--dim); font-size: 15px; letter-spacing: -1px; }
.kf .me { color: var(--gold); }
.kf .en { color: var(--enemy); }
.kf .al { color: var(--ally); }
.kf svg { width: 16px; height: 16px; }
@keyframes kfIn { from { transform: translateX(30px); opacity: 0; } }

/* ---------- crosshair & hitmarker ---------- */
#crosshair { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transition: opacity .1s; }
#crosshair i { position: absolute; background: rgba(255,255,255,.92); box-shadow: 0 0 2px #000; }
#crosshair .t, #crosshair .b { width: 2px; height: 9px; left: -1px; }
#crosshair .l, #crosshair .r { height: 2px; width: 9px; top: -1px; }
#crosshair .c { width: 2px; height: 2px; left: -1px; top: -1px; }
#crosshair.enemy i { background: var(--enemy); }
#hitmarker { position: absolute; left: 50%; top: 50%; width: 0; height: 0; opacity: 0; }
#hitmarker i { position: absolute; width: 2.5px; height: 11px; left: -1.25px; top: -5.5px; background: #fff; box-shadow: 0 0 3px rgba(0,0,0,.8); }
#hitmarker i:nth-child(1) { transform: rotate(45deg) translateY(-12px); }
#hitmarker i:nth-child(2) { transform: rotate(135deg) translateY(-12px); }
#hitmarker i:nth-child(3) { transform: rotate(225deg) translateY(-12px); }
#hitmarker i:nth-child(4) { transform: rotate(315deg) translateY(-12px); }
#hitmarker.head i { background: #ff3326; }
#hitmarker.kill i { background: #ff3326; height: 14px; }
#aimName { position: absolute; left: 50%; top: calc(50% + 34px); transform: translateX(-50%); font-weight: 700; font-size: 16px; letter-spacing: 1px; }

/* ---------- banners ---------- */
#banner { position: absolute; left: 50%; top: 26%; transform: translateX(-50%); text-align: center; opacity: 0; }
#bannerMain { font-size: 34px; font-weight: 700; letter-spacing: 3px; color: var(--gold); }
#bannerSub { font-size: 16px; letter-spacing: 3px; color: var(--hud); }
#banner.show { animation: banner 2.2s ease-out forwards; }
@keyframes banner {
  0% { opacity: 0; transform: translateX(-50%) scale(1.6); }
  8% { opacity: 1; transform: translateX(-50%) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}
#popups { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 2px; }
.pop { font-size: 18px; font-weight: 700; letter-spacing: 1.5px; animation: pop 1.6s ease-out forwards; white-space: nowrap; }
.pop b { color: var(--gold); margin-right: 6px; }
.pop.medal { color: var(--gold); font-size: 22px; }
@keyframes pop {
  0% { opacity: 0; transform: scale(1.5); }
  10% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-16px); }
}
#hint { position: absolute; left: 50%; top: 64%; transform: translateX(-50%); font-weight: 700; letter-spacing: 2px; font-size: 16px; color: var(--gold); }

/* ---------- streaks ---------- */
#streaks { position: absolute; left: 22px; bottom: 26px; width: 220px; }
.streakRow { display: flex; align-items: center; gap: 8px; padding: 3px 8px; margin-bottom: 4px; background: rgba(0,0,0,.4); color: var(--dim); font-weight: 600; letter-spacing: 1px; }
.streakRow .key { border: 1px solid currentColor; padding: 0 5px; font-size: 12px; }
.streakRow .ksName { flex: 1; }
.streakRow.ready { color: #0c0f0d; background: var(--accent); text-shadow: none; animation: ready 1s infinite alternate; }
.streakRow.active { color: var(--accent); }
@keyframes ready { to { background: #c9f28d; } }
#streakBar { position: relative; height: 6px; background: rgba(255,255,255,.16); margin-top: 6px; }
#streakFill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); transition: width .25s; }
#streakBar i { position: absolute; top: -3px; width: 2px; height: 12px; background: rgba(255,255,255,.6); }
#streakNum { margin-top: 4px; font-size: 13px; letter-spacing: 2px; color: var(--dim); }

/* ---------- ammo ---------- */
#ammo { position: absolute; right: 26px; bottom: 24px; text-align: right; }
#wpnName { font-size: 16px; letter-spacing: 2px; color: var(--dim); font-weight: 600; }
#ammoNums { font-variant-numeric: tabular-nums; }
#ammoNums b { font-size: 46px; font-weight: 700; line-height: 1; }
#ammoNums span { font-size: 22px; color: var(--dim); margin-left: 4px; }
#ammoNums.low b { color: var(--enemy); }
#pips { display: flex; gap: 2px; justify-content: flex-end; margin-top: 4px; height: 12px; }
#pips i { width: 3px; height: 12px; background: var(--hud); }
#pips i.e { background: rgba(255,255,255,.18); }
#pips.big i { width: 8px; }
#wpnSlots { display: flex; gap: 4px; justify-content: flex-end; margin-top: 8px; }
#wpnSlots span { width: 22px; text-align: center; font-size: 13px; border: 1px solid var(--line); color: var(--dim); }
#wpnSlots span.on { background: var(--hud); color: #0c0f0d; text-shadow: none; }

#healthBar { position: absolute; left: 50%; bottom: 22px; width: 220px; height: 4px; transform: translateX(-50%); background: rgba(255,255,255,.15); opacity: 0; transition: opacity .3s; }
#healthBar.show { opacity: 1; }
#healthFill { height: 100%; background: var(--hud); width: 100%; }
#fps { position: absolute; right: 8px; bottom: 4px; font-size: 12px; color: var(--dim); }

/* ---------- death ---------- */
#death { position: absolute; left: 50%; top: 66%; transform: translateX(-50%); text-align: center; }
#death .by { font-size: 14px; letter-spacing: 3px; color: var(--dim); }
#killer { font-size: 32px; font-weight: 700; color: var(--enemy); letter-spacing: 2px; }
#respawnIn { font-size: 15px; letter-spacing: 2px; }

/* ---------- glass panels ---------- */
.glass {
  background: rgba(16, 22, 18, .62); border: 1px solid rgba(255,255,255,.14);
  backdrop-filter: blur(12px) saturate(1.2); -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
#board { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(720px, 94vw); padding: 18px 22px; }
.boardHead { display: flex; justify-content: space-between; font-size: 20px; font-weight: 700; letter-spacing: 2px; margin-bottom: 10px; }
#board table { width: 100%; border-collapse: collapse; font-size: 17px; }
#board th { text-align: left; font-size: 12px; letter-spacing: 2px; color: var(--dim); padding: 4px 8px; border-bottom: 1px solid var(--line); }
#board td { padding: 6px 8px; font-variant-numeric: tabular-nums; font-weight: 600; }
#board tr.me td { background: rgba(255, 204, 77, .16); color: var(--gold); }
#board tr.dead td { opacity: .5; }
#board td.al { color: var(--ally); }
#board td.en { color: var(--enemy); }
#board tr.teamRow td { font-size: 13px; letter-spacing: 2px; color: var(--dim); padding-top: 12px; }

/* ---------- screens ---------- */
.screen {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 30%, rgba(40,50,40,.35), rgba(5,7,6,.85));
}
#menu { background: linear-gradient(180deg, rgba(5,7,6,.3), rgba(5,7,6,.9)); }
.back {
  position: absolute; left: 16px; top: 14px; color: var(--hud); text-decoration: none; font-weight: 600;
  padding: 6px 12px; border: 1px solid var(--line); background: rgba(0,0,0,.35);
}
.menuBox { width: min(520px, 100%); padding: 26px 26px 20px; text-align: center; max-height: calc(100vh - 32px); overflow: auto; }
.menuBox.small { width: min(320px, 100%); display: flex; flex-direction: column; gap: 12px; }
.logo { font-size: 50px; font-weight: 700; letter-spacing: 6px; line-height: 1; }
.logo span { color: var(--accent); font-size: .5em; letter-spacing: 8px; margin-left: 10px; vertical-align: middle; }
.logo.small { font-size: 30px; }
.tagline { color: var(--dim); letter-spacing: 3px; margin: 6px 0 18px; font-weight: 600; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; text-align: left; margin-bottom: 18px; }
.opts label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; letter-spacing: 1.5px; color: var(--dim); font-weight: 600; text-transform: uppercase; }
.opts output { display: inline; color: var(--hud); margin-left: 6px; }
.opts select, .opts input[type=range] { font: inherit; font-size: 16px; text-transform: none; letter-spacing: 0; }
.opts select { background: rgba(0,0,0,.45); color: var(--hud); border: 1px solid var(--line); padding: 6px 8px; }
.opts input[type=range] { accent-color: var(--accent); margin: 8px 0 0; }
.btn {
  font: inherit; font-weight: 700; font-size: 20px; letter-spacing: 3px; cursor: pointer; width: 100%;
  padding: 12px 18px; border: 0; background: var(--accent); color: #0c0f0d; margin-top: 4px;
}
.btn:hover, .btn:focus-visible { background: #c3ee86; outline: none; }
.btn.ghost { background: transparent; color: var(--hud); border: 1px solid var(--line); margin-top: 8px; }
.btn.ghost:hover { background: rgba(255,255,255,.08); }
#record { margin-top: 12px; color: var(--dim); font-size: 14px; letter-spacing: 1px; }
.controls { margin-top: 12px; text-align: left; font-size: 15px; }
.controls summary { cursor: pointer; color: var(--dim); letter-spacing: 2px; font-weight: 600; }
.controls table { width: 100%; margin-top: 8px; border-collapse: collapse; }
.controls td { padding: 3px 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
.controls td:last-child { text-align: right; color: var(--accent); font-weight: 600; }
.note { color: var(--dim); font-size: 13px; margin: 8px 0 0; }
.note.mobile { display: none; }
@media (pointer: coarse) { .note.mobile { display: block; color: var(--gold); } }
#endStats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
#endStats div { background: rgba(0,0,0,.35); padding: 8px; }
#endStats b { display: block; font-size: 26px; }
#endStats span { font-size: 12px; letter-spacing: 2px; color: var(--dim); }
#endTitle.win { color: var(--accent); }
#endTitle.lose { color: var(--enemy); }

@media (max-width: 760px) {
  #compass { width: 300px; }
  #radarWrap { transform: scale(.7); transform-origin: 0 0; }
  .opts { grid-template-columns: 1fr; }
}

/* ---------- touch controls ---------- */
body.touch, body.touch * { touch-action: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
body.touch .menuBox, body.touch .menuBox * { touch-action: pan-y; }
#touch { position: fixed; inset: 0; z-index: 3; }
.tzone { position: absolute; top: 0; bottom: 0; }
#tLeft { left: 0; width: 42%; }
#tRight { right: 0; width: 58%; }
#stickBase {
  position: absolute; width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%; pointer-events: none;
  border: 2px solid rgba(255,255,255,.35); background: rgba(0,0,0,.18); opacity: 0; transition: opacity .1s;
}
#stickBase.on { opacity: 1; }
#stickKnob {
  position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; border-radius: 50%;
  background: rgba(255,255,255,.55); box-shadow: 0 0 10px rgba(0,0,0,.4);
}
.tb {
  position: absolute; border-radius: 50%; border: 2px solid rgba(255,255,255,.4); background: rgba(10,14,12,.38);
  color: rgba(255,255,255,.92); font: 700 13px Rajdhani, system-ui, sans-serif; letter-spacing: 1px; padding: 0;
  display: flex; align-items: center; justify-content: center; user-select: none;
}
.tb.held { background: rgba(159,211,86,.55); border-color: var(--accent); }
.tb.active { background: rgba(159,211,86,.4); border-color: var(--accent); }
#tFire { right: calc(22px + env(safe-area-inset-right)); bottom: 34px; width: 92px; height: 92px; font-size: 16px; border-color: rgba(255,90,70,.7); }
#tAds { right: calc(126px + env(safe-area-inset-right)); bottom: 20px; width: 62px; height: 62px; }
#tJump { right: calc(22px + env(safe-area-inset-right)); bottom: 142px; width: 60px; height: 60px; }
#tCrouch { right: calc(98px + env(safe-area-inset-right)); bottom: 104px; width: 56px; height: 56px; font-size: 11px; }
#tReload { right: calc(168px + env(safe-area-inset-right)); bottom: 92px; width: 50px; height: 50px; font-size: 18px; }
#tSwap { right: calc(92px + env(safe-area-inset-right)); bottom: 178px; width: 50px; height: 50px; font-size: 22px; }
#tSteady { right: calc(196px + env(safe-area-inset-right)); bottom: 160px; width: 64px; height: 64px; font-size: 11px; display: none; }
#tSteady.show { display: flex; }
.tb.pill { border-radius: 6px; width: auto; height: 38px; padding: 0 14px; left: calc(16px + env(safe-area-inset-left)); display: none; background: var(--accent); color: #0c0f0d; border: 0; }
.tb.pill.show { display: flex; animation: ready 1s infinite alternate; }
#tUav { top: 46%; }
#tAir { top: calc(46% + 48px); }
.tb.sq { border-radius: 8px; width: 40px; height: 36px; top: 8px; font-size: 15px; }
#tPause { right: calc(10px + env(safe-area-inset-right)); }
#tBoard { right: calc(58px + env(safe-area-inset-right)); }

body.touch #radarWrap { transform: scale(.62); transform-origin: 0 0; left: 10px; top: 10px; }
body.touch #topCenter { top: 6px; transform: translateX(-50%) scale(.8); transform-origin: 50% 0; }
body.touch #killfeed { top: 52px; right: 10px; transform: scale(.78); transform-origin: 100% 0; }
body.touch #ammo { right: calc(236px + env(safe-area-inset-right)); bottom: 10px; transform: scale(.7); transform-origin: 100% 100%; }
body.touch #streaks { left: 10px; top: 136px; bottom: auto; transform: scale(.7); transform-origin: 0 0; }
body.touch #streaks .streakRow { display: none; }
body.touch #hint { top: 30%; }
body.touch #board { transform: translate(-50%, -50%) scale(.85); }
body.touch .note.mobile { display: block; color: var(--accent); }

#rotate {
  display: none; position: fixed; inset: 0; z-index: 50; background: #0c0f0d; color: var(--hud);
  flex-direction: column; align-items: center; justify-content: center; gap: 10px; font-size: 20px; font-weight: 700; letter-spacing: 1px; text-align: center; padding: 24px;
}
#rotate div { font-size: 54px; animation: spin 2s ease-in-out infinite; }
@keyframes spin { 50% { transform: rotate(90deg); } }
@media (orientation: portrait) { body.touch.playing #rotate { display: flex; } }

/* short landscape phones: keep the whole menu on one screen */
@media (max-height: 520px) {
  .menuBox { padding: 14px 18px 12px; width: min(680px, 100%); }
  .logo { font-size: 32px; letter-spacing: 4px; }
  .tagline { margin: 2px 0 10px; font-size: 13px; }
  .opts { grid-template-columns: repeat(3, 1fr); gap: 6px 12px; margin-bottom: 10px; }
  .opts label { font-size: 11px; }
  .opts select { padding: 4px 6px; font-size: 14px; }
  .opts input[type=range] { margin-top: 4px; }
  .btn { padding: 9px 14px; font-size: 17px; }
  .controls { display: none; }
  #record, .note { font-size: 12px; margin-top: 6px; }
  #endStats { grid-template-columns: repeat(4, 1fr); }
  #endStats b { font-size: 20px; }
}

/* ---------- online lobby ---------- */
.field { display: flex; flex-direction: column; gap: 4px; text-align: left; font-size: 13px; letter-spacing: 1.5px; color: var(--dim); font-weight: 600; text-transform: uppercase; margin-bottom: 12px; }
.field input, .onRow input, .onRow select {
  font: inherit; font-size: 18px; background: rgba(0,0,0,.45); color: var(--hud); border: 1px solid var(--line); padding: 8px 10px; text-transform: none; letter-spacing: 1px;
}
.onRow { display: flex; gap: 8px; align-items: stretch; margin-bottom: 8px; }
.onRow .btn { margin-top: 0; flex: 1; }
.onRow select { width: 96px; }
#onCode { width: 140px; text-transform: uppercase; letter-spacing: 4px; text-align: center; font-weight: 700; }
.onOr { color: var(--dim); font-size: 13px; letter-spacing: 2px; margin: 10px 0 8px; text-transform: uppercase; }
.codeBox { display: flex; align-items: center; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 4px; }
.codeBox span { color: var(--dim); letter-spacing: 2px; font-size: 13px; }
.codeBox b { font-size: 34px; letter-spacing: 6px; color: var(--gold); }
.codeBox .btn { width: auto; margin: 0; font-size: 14px; padding: 6px 12px; }
.teams { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; margin-bottom: 12px; }
.teams h4 { margin: 0 0 6px; letter-spacing: 3px; font-size: 14px; }
.teams .ta { color: var(--ally); } .teams .tb2 { color: var(--enemy); }
.teams ul { list-style: none; margin: 0; padding: 0; }
.teams li { padding: 6px 10px; margin-bottom: 4px; background: rgba(0,0,0,.35); font-weight: 600; font-size: 17px; }
.teams li.me { color: var(--gold); }
.teams li.bot { color: var(--dim); font-style: italic; }
.teams li i { font-style: normal; font-size: 11px; letter-spacing: 1px; color: var(--accent); margin-left: 6px; }
.note.err { color: var(--enemy); }
#onStart:disabled { opacity: .5; }

/* ---------- key bindings ---------- */
.keysTable { width: 100%; border-collapse: collapse; margin-bottom: 12px; text-align: left; font-size: 16px; }
.keysTable td { padding: 3px 4px; border-bottom: 1px solid rgba(255,255,255,.06); }
.keysTable td:last-child { text-align: right; width: 48%; }
.keyBtn {
  font: inherit; font-weight: 700; min-width: 150px; padding: 4px 10px; cursor: pointer;
  background: rgba(0,0,0,.45); color: var(--accent); border: 1px solid var(--line);
}
.keyBtn:hover { border-color: var(--accent); }
.keyBtn.wait { color: #0c0f0d; background: var(--gold); animation: ready .6s infinite alternate; }

/* ---------- touch layout editor ---------- */
#touch .tb { opacity: var(--tbOpacity, 1); }
#tEdit { display: none; }
#touch.editing { background: repeating-linear-gradient(0deg, transparent 0 39px, rgba(255,255,255,.05) 39px 40px), repeating-linear-gradient(90deg, transparent 0 39px, rgba(255,255,255,.05) 39px 40px), #141a17; z-index: 60; }
#touch.editing .tzone { display: none; }
#touch.editing .tb { display: flex; }
#touch.editing .tb.sel { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(255,204,77,.45); }
#touch.editing #tEdit {
  display: flex; position: absolute; left: 50%; top: 8px; transform: translateX(-50%); gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center;
  background: rgba(0,0,0,.6); border: 1px solid var(--line); padding: 8px 12px; max-width: min(620px, 70vw); font-size: 13px; color: var(--hud);
}
.tEdTitle { width: 100%; text-align: center; color: var(--dim); letter-spacing: 1px; }
#tEdit label { display: flex; align-items: center; gap: 6px; letter-spacing: 1px; }
#tEdit input[type=range] { width: 110px; accent-color: var(--accent); }
#tEdit button { font: 700 14px Rajdhani, sans-serif; letter-spacing: 2px; padding: 6px 14px; border: 1px solid var(--line); background: transparent; color: var(--hud); }
#tEdit #tEdDone { background: var(--accent); color: #0c0f0d; border: 0; }

/* ---------- voice ---------- */
.voiceRow { align-items: center; justify-content: center; margin-top: 8px; }
.voiceRow span { letter-spacing: 2px; color: var(--dim); font-weight: 600; font-size: 13px; }
.voiceRow select { width: auto; }
#voiceList { position: absolute; left: 22px; top: 236px; display: flex; flex-direction: column; gap: 3px; }
.vTalk { background: rgba(0,0,0,.5); padding: 2px 10px; font-weight: 700; font-size: 15px; border-left: 3px solid var(--ally); }
.vTalk.me { border-left-color: var(--accent); color: var(--accent); }
body.touch #voiceList { left: 150px; top: 10px; }
#tMic { left: calc(16px + env(safe-area-inset-left)); top: 30%; width: 56px; height: 56px; display: none; border-color: rgba(79,182,255,.7); }
#tMic.show { display: flex; }
#tMic.held { background: rgba(79,182,255,.55); }

/* ======================= campaign ======================= */
.btn.camp { background: #2b2a26; color: #e8dcc0; border: 1px solid #6b5d45; }
.btn.camp:hover { background: #3a372f; }
.warn { border: 1px solid #8a3a2a; background: rgba(120, 30, 20, .25); padding: 12px 14px; text-align: left; font-size: 15px; line-height: 1.45; margin-bottom: 10px; }
.warn b { display: block; color: #ff7a5a; letter-spacing: 3px; margin-bottom: 4px; }
body.campaign #radarWrap, body.campaign #topCenter, body.campaign #killfeed, body.campaign #streaks,
body.campaign #board, body.campaign #popups, body.campaign #banner, body.campaign #voiceList { display: none !important; }
body:not(.campaign) .tb.story { display: none !important; }
#touch .tb.story { top: 30%; width: 50px; height: 50px; font-size: 11px; }
#tLight { left: calc(16px + env(safe-area-inset-left)); }
#tNV { left: calc(74px + env(safe-area-inset-left)); }

/* letterbox */
.lb { position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 30; transition: height .8s ease; pointer-events: none; }
#lbTop { top: 0; } #lbBot { bottom: 0; }
body.letterbox .lb { height: 11vh; }
body.letterbox #ammo, body.letterbox #crosshair, body.letterbox #touch { opacity: 0; pointer-events: none; }

/* objective */
#objective { position: fixed; left: 24px; top: 20px; z-index: 6; font: 600 15px Rajdhani, sans-serif; letter-spacing: 2px; color: #d9cfb8;
  text-shadow: 0 1px 3px #000; opacity: 0; transition: opacity .6s; pointer-events: none; max-width: 60vw; }
#objective.show { opacity: 1; }
body:not(.campaign) #objective { display: none; }

/* dialogue / radio subtitles */
#dlg { position: fixed; left: 50%; bottom: 14vh; transform: translateX(-50%); z-index: 31; max-width: min(880px, 90vw); text-align: center; pointer-events: none; }
#dlg.voice #dlgWho { color: #e8c98a; font: 700 15px Rajdhani, sans-serif; letter-spacing: 3px; margin-right: 10px; }
#dlg.voice #dlgText { color: #f2eee4; font: 500 21px Rajdhani, sans-serif; text-shadow: 0 2px 6px #000, 0 0 2px #000; }
#dlg.radio { background: rgba(4, 14, 6, .78); border-left: 3px solid #4ce06a; padding: 6px 14px; text-align: left; animation: radioIn .25s steps(3); }
#dlg.radio #dlgWho { color: #7dff8f; font: 700 14px ui-monospace, 'Courier New', monospace; margin-right: 10px; }
#dlg.radio #dlgText { color: #b8ffc2; font: 15px/1.4 ui-monospace, 'Courier New', monospace; text-shadow: 0 0 6px rgba(80,255,120,.5); }
@keyframes radioIn { 0% { opacity: 0; transform: translateX(-50%) skewX(8deg); } 50% { opacity: .6; } 100% { opacity: 1; } }

/* decision */
#decision { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 41; text-align: center; width: min(720px, 92vw); }
#decPrompt { font: 600 22px Rajdhani, sans-serif; letter-spacing: 2px; color: #f4e9d2; text-shadow: 0 2px 10px #000; margin-bottom: 18px; }
#decOpts { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.decOpt { font: 700 17px Rajdhani, sans-serif; letter-spacing: 2px; color: #fff; background: rgba(20, 8, 4, .7); border: 1px solid rgba(255, 140, 80, .6);
  padding: 12px 16px; cursor: pointer; display: flex; align-items: center; gap: 10px; animation: pulse 0.62s infinite alternate; }
.decOpt:hover { background: rgba(120, 40, 10, .7); }
.decOpt .cap { border: 2px solid #ffb070; color: #ffb070; padding: 0 8px; font-size: 18px; }
@keyframes pulse { to { box-shadow: 0 0 18px rgba(255, 90, 30, .45); } }
#decBarWrap { height: 6px; background: rgba(255,255,255,.12); margin: 18px auto 6px; width: 70%; overflow: hidden; }
#decBar { height: 100%; width: 100%; background: linear-gradient(90deg, #ff3b1a, #ffb040); box-shadow: 0 0 14px #ff5a20; }
#decTime { font: 700 14px ui-monospace, monospace; color: #ffb070; }
#tunnel { position: fixed; inset: 0; z-index: 29; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(ellipse at center, transparent 22%, rgba(0,0,0,.55) 48%, rgba(0,0,0,.96) 80%);
  backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px);
  -webkit-mask-image: radial-gradient(ellipse at center, transparent 25%, #000 60%); mask-image: radial-gradient(ellipse at center, transparent 25%, #000 60%); }
#tunnel.on { opacity: 1; animation: throb .62s infinite alternate; }
@keyframes throb { to { transform: scale(1.04); } }

/* night vision grain */
#nvOverlay { position: fixed; inset: 0; z-index: 2; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,.18) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.85) 95%); }
#nvOverlay.on { opacity: 1; animation: nvn .12s steps(2) infinite; }
@keyframes nvn { 50% { background-position: 0 1px, 0 0; } }

/* fades, water, cards */
#fade { position: fixed; inset: 0; background: #000; z-index: 42; opacity: 0; transition: opacity 1.5s; pointer-events: none; }
#fade.on { opacity: 1; }
#water { position: fixed; inset: 0; z-index: 28; pointer-events: none; opacity: 0; transition: opacity 3s;
  background: radial-gradient(ellipse at 50% 30%, rgba(30,60,60,.4), rgba(2,10,12,.97)); }
#water.on { opacity: 1; }
#card { position: fixed; inset: 0; z-index: 44; background: #000; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 24px; text-align: center; transition: opacity 1.1s; }
#card.out { opacity: 0; }
#card .big { font: 700 clamp(26px, 5vw, 46px) Rajdhani, sans-serif; letter-spacing: 6px; color: #e8dcc0; }
#card .small { font: 15px/1.6 ui-monospace, 'Courier New', monospace; color: #a59a84; max-width: 760px; }
#campEnd { z-index: 45; background: #000; }
#ceStats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
#ceStats div { background: rgba(255,255,255,.05); padding: 8px; }
#ceStats b { display: block; font-size: 22px; color: #e8dcc0; }
#ceStats span { font-size: 11px; letter-spacing: 2px; color: var(--dim); }
.ceQuote { font-style: italic; color: #d8cdb4; font-size: 18px; }
.ceSupport { color: var(--dim); font-size: 14px; line-height: 1.5; }
.ceSupport a { color: #9fd356; }
#nvOverlay.on { background: repeating-linear-gradient(0deg, rgba(0,0,0,.2) 0 1px, transparent 1px 3px), radial-gradient(ellipse at center, rgba(60,255,110,.10) 40%, rgba(0,0,0,.9) 95%); }
body.lowfx #tunnel { backdrop-filter: none; -webkit-backdrop-filter: none; -webkit-mask-image: none; mask-image: none; }
body.deciding #crosshair, body.deciding #aimName, body.letterbox #aimName, body.deciding #hitmarker { opacity: 0 !important; }
#useHint { position: fixed; left: 50%; top: 60%; transform: translateX(-50%); z-index: 6; pointer-events: none;
  font: 700 17px Rajdhani, sans-serif; letter-spacing: 2px; color: #f2e6c8; text-shadow: 0 1px 4px #000; }
#touch #tUse { left: auto; right: calc(186px + env(safe-area-inset-right)); top: auto; bottom: 170px; width: 64px; height: 64px; display: none; border-color: rgba(255,220,140,.8); }
#touch #tUse.show { display: flex; }
body:not(.campaign) #useHint { display: none; }
