:root {
  --ink: #e8e2d5;
  --ash: #a8ada4;
  --blood: #c44737;
  --blood-dark: #72271f;
  --night: #111713;
  --fog: #657068;
  --radio: #d8c866;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--night); }
body { color: var(--ink); font-family: "Arial Narrow", "Roboto Condensed", Impact, sans-serif; }
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

#game, #game-canvas { position: fixed; inset: 0; width: 100%; height: 100%; }
#game { overflow: hidden; background: #53605a; }
#game-canvas { display: block; touch-action: none; }

.screen { position: fixed; inset: 0; z-index: 30; display: none; place-items: center; padding: max(24px, env(safe-area-inset-top)) max(24px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(24px, env(safe-area-inset-left)); background: rgba(9, 13, 10, .84); backdrop-filter: blur(8px); }
.screen--active { display: grid; }
#title-screen { grid-template-columns: minmax(310px, 580px) 1fr; place-items: center start; background: radial-gradient(circle at 70% 45%, rgba(133, 146, 129, .2), transparent 34%), linear-gradient(105deg, rgba(8, 13, 10, .98) 0 45%, rgba(12, 18, 14, .86) 72%, rgba(12, 18, 14, .7)); }
.title-grain { position: absolute; inset: 0; pointer-events: none; opacity: .14; background-image: repeating-linear-gradient(92deg, transparent 0 13px, rgba(255,255,255,.03) 13px 14px), repeating-linear-gradient(0deg, transparent 0 3px, rgba(0,0,0,.2) 3px 4px); mix-blend-mode: soft-light; }
.title-card { position: relative; z-index: 1; width: min(100%, 520px); margin-left: clamp(0px, 6vw, 100px); padding: 36px 0; }
.eyebrow, .label { margin: 0 0 12px; color: var(--radio); font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 11px; font-weight: 800; letter-spacing: .28em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(76px, 13vw, 168px); font-weight: 950; line-height: .72; letter-spacing: -.065em; text-shadow: 0 10px 40px rgba(0,0,0,.4); }
h1 span { color: transparent; -webkit-text-stroke: 2px var(--blood); text-stroke: 2px var(--blood); }
.premise { max-width: 390px; margin: 32px 0; color: #c7c9c3; font-family: Georgia, serif; font-size: clamp(17px, 2vw, 22px); font-style: italic; line-height: 1.5; }
.menu-stack { display: grid; align-items: start; justify-items: start; gap: 8px; }
.primary-action { min-width: 260px; border: 0; padding: 16px 20px; color: #f4eee2; background: var(--blood); cursor: pointer; text-align: left; font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 13px; font-weight: 900; letter-spacing: .16em; clip-path: polygon(0 0, 96% 0, 100% 28%, 100% 100%, 4% 100%, 0 72%); }
.primary-action:hover, .primary-action:focus-visible { background: #df5947; outline: 2px solid #f4eee2; outline-offset: 3px; }
.primary-action span { float: right; opacity: .6; }
.text-action { border: 0; padding: 9px 0; color: #9ea69e; background: none; cursor: pointer; font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 12px; font-weight: 800; letter-spacing: .18em; }
.text-action:hover, .text-action:focus-visible { color: #fff; outline: none; }
.controls-hint { margin-top: 30px; color: #788078; font: 10px/1.7 ui-monospace, "Cascadia Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.title-quote { align-self: end; justify-self: end; position: relative; z-index: 1; margin: 0 clamp(0px, 6vw, 100px) clamp(10px, 4vw, 50px) 20px; color: #aeb6ad; font: italic clamp(18px, 2.2vw, 32px)/1.35 Georgia, serif; text-align: right; }

.panel { position: relative; width: min(620px, 100%); max-height: 88vh; overflow: auto; border: 1px solid rgba(232,226,213,.18); padding: clamp(28px, 6vw, 64px); background: linear-gradient(145deg, rgba(23,32,26,.98), rgba(11,16,13,.98)); box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.compact-panel { width: min(420px, 100%); text-align: center; }
.panel h2 { margin: 0 0 30px; font-size: clamp(44px, 8vw, 82px); line-height: .9; letter-spacing: -.045em; }
.compact-panel .primary-action { margin: auto; }
.pause-actions { display: grid; justify-items: center; gap: 10px; }
.pause-actions .danger-action { margin-top: 10px; }
.close-panel { position: absolute; top: 16px; right: 18px; width: 44px; height: 44px; border: 0; color: var(--ink); background: transparent; cursor: pointer; font-size: 30px; }
.panel label { display: grid; gap: 10px; margin: 22px 0; color: #c7cbc5; font: 12px ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.panel input[type="range"] { width: 100%; accent-color: var(--blood); }
.panel select { width: 100%; border: 1px solid rgba(232,226,213,.2); padding: 11px 12px; color: #e6e0d4; background: #121a15; font: 800 11px ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.panel select:focus-visible { border-color: var(--radio); outline: none; }
.panel .check-row { display: flex; align-items: center; }
.danger-action { width: 100%; margin-top: 28px; border: 1px solid #8f3a30; padding: 13px 18px; color: #e3a79e; background: rgba(91,31,25,.22); cursor: pointer; font: 800 11px ui-monospace, monospace; letter-spacing: .16em; }
.reset-warning { margin: 9px 0 0; color: #8d766f; font: 10px/1.5 ui-monospace, monospace; }
.stash-panel { width: min(820px, 100%); }
.stash-contents { display: grid; gap: 1px; margin: 22px 0; background: rgba(255,255,255,.1); }
.stash-heading, .stash-row { display: grid; grid-template-columns: minmax(120px,1fr) 86px 196px 86px; align-items: center; gap: 10px; }
.stash-heading { padding: 8px 14px; color: #7f8981; background: #0d130f; font: 9px ui-monospace, monospace; letter-spacing: .13em; text-align: center; }
.stash-heading span:first-child { text-align: left; }
.stash-row { min-height: 54px; padding: 8px 14px; background: #121a15; color: #9da69e; font: 11px ui-monospace, monospace; text-transform: uppercase; }
.stash-row > strong { color: #f0eadf; font-size: 13px; text-align: center; }
.stash-item { color: #c6cdc6; font-weight: 800; }
.stash-transfer { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.stash-transfer button, .stash-weapon-row button, .stash-weapon-list button, .stash-bulk-actions button { border: 1px solid rgba(232,226,213,.2); padding: 8px; color: #d9d4c8; background: #1b2720; cursor: pointer; font: 800 9px ui-monospace, monospace; letter-spacing: .04em; }
.stash-transfer button:hover, .stash-weapon-row button:hover, .stash-weapon-list button:hover, .stash-bulk-actions button:hover { border-color: var(--radio); color: var(--radio); }
.stash-transfer button:disabled, .stash-weapon-row button:disabled, .stash-weapon-list button:disabled { cursor: default; opacity: .28; }
.stash-weapon-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 14px; padding: 14px; background: #151e18; }
.stash-weapon-row span, .stash-weapon-row strong { display: block; }
.stash-weapon-row small { color: #788279; font: 9px ui-monospace, monospace; letter-spacing: .12em; }
.stash-weapon-row strong { margin-top: 4px; color: var(--ink); font: 800 12px ui-monospace, monospace; }
.stash-weapon-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px; background: #101712; }
.stash-empty { color: #657068; font: 9px ui-monospace, monospace; letter-spacing: .1em; }
.stash-bulk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.stash-bulk-actions button { min-height: 44px; }
.trader-panel { width: min(760px, 100%); }
.trader-offer { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin: 22px 0; background: rgba(255,255,255,.1); }
.trader-offer div { min-height: 82px; padding: 16px; background: #121a15; }
.trader-offer span, .trader-offer strong { display: block; }
.trader-offer span { color: #7f8981; font: 9px ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; }
.trader-offer strong { margin-top: 8px; color: #f0eadf; font: 800 18px ui-monospace, monospace; }
.trader-options { display: grid; gap: 8px; }
.trader-options button { display: flex; justify-content: space-between; gap: 18px; width: 100%; border: 1px solid rgba(232,226,213,.2); padding: 15px 17px; color: #e6e0d4; background: #1b2720; cursor: pointer; font: 800 11px ui-monospace, monospace; letter-spacing: .08em; text-align: left; }
.trader-options button:hover, .trader-options button:focus-visible { border-color: var(--radio); color: var(--radio); outline: none; }
.trader-options button:disabled { cursor: default; opacity: .34; }
.trader-options button span:last-child { color: #89938a; font-weight: 500; }
.trade-choice-list { display: grid; gap: 7px; }
.trade-choice b, .trade-choice small { display: block; }
.trade-choice b { color: inherit; font: inherit; }
.trade-choice small { margin-top: 5px; color: #89938a; font: 500 9px/1.45 ui-monospace, monospace; letter-spacing: .04em; }
.trade-choice.selected { border-color: var(--radio); color: var(--radio); box-shadow: inset 3px 0 var(--radio); }
.trader-options .trade-choice.selected > span:last-child { color: var(--radio); }
.trade-source-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.trade-source-actions button { min-height: 54px; }
.trader-status { min-height: 18px; margin: 12px 0 0; color: #d88879; font: 10px ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: rgba(255,255,255,.12); }
.stat-grid div { padding: 18px; background: #151e18; }
.stat-grid strong, .stat-grid span { display: block; }
.stat-grid strong { color: var(--ink); font-size: 28px; }
.stat-grid span { margin-top: 4px; color: #818b82; font: 9px ui-monospace, monospace; letter-spacing: .15em; text-transform: uppercase; }
.world-copy { margin: 26px 0; color: #b5bbb4; font: 18px/1.65 Georgia, serif; }
.book-link { color: var(--radio); font: 11px ui-monospace, monospace; letter-spacing: .12em; text-decoration: none; }
.death-panel { border-color: rgba(196,71,55,.4); }
.death-panel h2 { color: #d8d0c3; }
.death-stats { display: grid; gap: 1px; margin: 24px 0; background: rgba(255,255,255,.1); }
.death-stats div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 16px; background: #121a15; color: #929b92; font: 11px ui-monospace, monospace; letter-spacing: .1em; text-transform: uppercase; }
.death-stats strong { color: #f0eadf; }
.handover-line { margin: 28px 0; color: #e5dfd2; font: italic 21px Georgia, serif; }

.hud { position: fixed; inset: 0; z-index: 10; display: none; pointer-events: none; font-family: ui-monospace, "Cascadia Mono", monospace; text-shadow: 0 2px 4px #000; }
.hud--active { display: block; }
.hud-top { display: grid; grid-template-columns: 1fr auto 1fr; gap: 30px; align-items: start; padding: max(22px, env(safe-area-inset-top)) max(26px, env(safe-area-inset-right)); }
.hud-top > div:first-child { justify-self: start; }
.hud-top > div:last-child { justify-self: end; text-align: right; }
.hud-top strong { display: block; color: #fff; font-size: 22px; }
.phase-readout { text-align: center; }
.phase-readout span { display: block; margin-bottom: 4px; color: var(--radio); font-size: 9px; letter-spacing: .28em; }
.phase-readout strong { font-variant-numeric: tabular-nums; }
.crosshair { position: absolute; left: 50%; top: 50%; width: 32px; height: 32px; transform: translate(-50%, -50%); opacity: 0; transition: opacity .12s; }
.crosshair i { position: absolute; display: block; background: rgba(246,242,231,.9); box-shadow: 0 0 2px #000; }
.crosshair i:nth-child(1) { left: 15px; top: 1px; width: 2px; height: 8px; }
.crosshair i:nth-child(2) { left: 15px; bottom: 1px; width: 2px; height: 8px; }
.crosshair i:nth-child(3) { left: 1px; top: 15px; width: 8px; height: 2px; }
.crosshair i:nth-child(4) { right: 1px; top: 15px; width: 8px; height: 2px; }
.scope-overlay { position: absolute; inset: 0; z-index: 4; display: none; background: radial-gradient(circle at center, transparent 0 31vmin, rgba(4,7,5,.98) 31.5vmin 100%); }
.scope-overlay i, .scope-overlay b { position: absolute; left: 50%; top: 50%; display: block; background: rgba(14,18,15,.88); transform: translate(-50%,-50%); }
.scope-overlay i:nth-child(1) { width: 1px; height: 62vmin; }
.scope-overlay i:nth-child(2) { width: 62vmin; height: 1px; }
.scope-overlay i:nth-child(3) { width: 12px; height: 2px; transform: translate(-50%,8vmin); }
.scope-overlay i:nth-child(4) { width: 12px; height: 2px; transform: translate(-50%,16vmin); }
.scope-overlay b { width: 5px; height: 5px; border-radius: 50%; background: var(--blood); }
.hud-bottom { position: absolute; left: max(26px, env(safe-area-inset-left)); right: max(26px, env(safe-area-inset-right)); bottom: max(22px, env(safe-area-inset-bottom)); display: flex; align-items: end; justify-content: space-between; }
.health-block { display: grid; grid-template-columns: 54px 160px 42px; gap: 10px; align-items: center; }
.health-block .label { margin: 0; }
.meter { height: 7px; background: rgba(255,255,255,.18); transform: skewX(-14deg); }
.meter i { display: block; width: 100%; height: 100%; background: var(--blood); transition: width .2s; }
.ammo-block { text-align: right; }
.ammo-block > span { display: block; color: #c6ccc6; font-size: 10px; letter-spacing: .16em; }
.ammo-block strong { font-size: 33px; font-weight: 500; }
.ammo-block b { color: #fff; font-size: 48px; }
.ammo-block small { margin: 0 7px; color: #777; }
.jerrycan-readout { position: absolute; right: max(26px, env(safe-area-inset-right)); bottom: max(100px, calc(env(safe-area-inset-bottom) + 100px)); color: #aeb7af; font-size: 9px; letter-spacing: .13em; text-align: right; }
.jerrycan-readout span, .jerrycan-readout strong { display: block; }
.jerrycan-readout strong { margin-top: 4px; color: var(--radio); font-size: 15px; }
.message-line { position: absolute; left: 50%; top: 71%; width: min(90vw, 720px); transform: translateX(-50%); color: #ece6d9; font: italic 16px/1.5 Georgia, serif; text-align: center; opacity: 0; transition: opacity .25s; }
.message-line--active { opacity: 1; }
.interaction-prompt { position: absolute; left: 50%; top: calc(50% + 55px); transform: translateX(-50%); color: #fff; font-size: 11px; letter-spacing: .16em; }
.damage-vignette { position: absolute; inset: 0; opacity: 0; background: radial-gradient(circle, transparent 42%, rgba(122, 16, 8, .82)); transition: opacity .18s; }
.damage-vignette--active { opacity: 1; }
.hud--ads .crosshair { opacity: 1; }
.hud.hud--scoped > .scope-overlay { display: block; }
.hud--scoped .crosshair { opacity: 0; }
.hud--ads .hud-top, .hud--ads .hud-bottom, .hud--ads .jerrycan-readout, .hud--ads .message-line, .hud--ads .interaction-prompt,
.hud--scoped .hud-top, .hud--scoped .hud-bottom, .hud--scoped .jerrycan-readout, .hud--scoped .message-line, .hud--scoped .interaction-prompt { opacity: 0; }
.spray-wheel { position: fixed; left: 50%; top: 50%; z-index: 18; display: none; width: 310px; height: 310px; transform: translate(-50%, -50%); border: 1px solid rgba(232,226,213,.24); border-radius: 50%; background: radial-gradient(circle, rgba(12,18,14,.95) 0 26%, rgba(12,18,14,.74) 27% 66%, rgba(12,18,14,.2) 67%); pointer-events: none; }
.spray-wheel--active { display: block; }
.spray-wheel div { position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 92px; height: 48px; margin: -24px -46px; color: #9ca49c; font: 9px ui-monospace, monospace; letter-spacing: .1em; text-align: center; }
.spray-wheel div:nth-child(1) { transform: translate(0,-117px); }
.spray-wheel div:nth-child(2) { transform: translate(101px,-58px); }
.spray-wheel div:nth-child(3) { transform: translate(101px,58px); }
.spray-wheel div:nth-child(4) { transform: translate(0,117px); }
.spray-wheel div:nth-child(5) { transform: translate(-101px,58px); }
.spray-wheel div:nth-child(6) { transform: translate(-101px,-58px); }
.spray-wheel div.selected { color: #fff; background: var(--blood); clip-path: polygon(7% 0,100% 0,93% 100%,0 100%); }
.spray-wheel span { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); color: var(--radio); font: 800 10px ui-monospace, monospace; letter-spacing: .2em; }
.touch-controls { display: none; }
.touch-enabled .touch-controls { display: block; }
.touch-look-zone { position: fixed; z-index: 11; left: 34%; right: 0; top: 0; bottom: 0; touch-action: none; }
.touch-move-zone { position: fixed; z-index: 13; left: max(18px,env(safe-area-inset-left)); bottom: max(18px,env(safe-area-inset-bottom)); width: 150px; height: 150px; border: 1px solid rgba(255,255,255,.17); border-radius: 50%; background: rgba(10,15,12,.18); touch-action: none; }
.touch-move-zone i { position: absolute; left: 50%; top: 50%; width: 60px; height: 60px; transform: translate(-50%,-50%); border: 2px solid rgba(255,255,255,.35); border-radius: 50%; background: rgba(151,163,151,.16); }
.touch-actions, .touch-edge, .touch-slots { position: fixed; z-index: 15; display: flex; gap: 8px; pointer-events: auto; }
.touch-actions { right: max(20px,env(safe-area-inset-right)); bottom: max(18px,env(safe-area-inset-bottom)); align-items: end; }
.touch-edge { right: max(18px,env(safe-area-inset-right)); top: 23%; flex-direction: column; }
.touch-slots { left: max(14px,env(safe-area-inset-left)); top: max(14px,env(safe-area-inset-top)); display: grid; grid-template-columns: repeat(7, 56px); }
.touch-actions button, .touch-edge button, .touch-slots button { min-width: 52px; min-height: 52px; border: 1px solid rgba(255,255,255,.25); color: #eee8dc; background: rgba(13,20,16,.64); border-radius: 50%; touch-action: none; font: 800 9px ui-monospace, monospace; letter-spacing: .05em; }
.touch-actions .touch-fire { width: 82px; height: 82px; border-color: rgba(211,78,61,.7); background: rgba(148,43,33,.58); }
.touch-slots button { min-width: 0; min-height: 48px; border-radius: 3px; padding: 0 3px; }
.touch-slots button:disabled { opacity: .32; }
.touch-actions button.active { border-color: var(--radio); color: var(--radio); }
.touch-enabled .health-block { position: fixed; left: max(20px,env(safe-area-inset-left)); top: 72px; grid-template-columns: 42px 118px 30px; transform: scale(.86); transform-origin: left top; }
.touch-enabled .ammo-block { position: fixed; right: max(82px,env(safe-area-inset-right)); top: 48px; transform: scale(.76); transform-origin: right top; }
.rotate-gate { position: fixed; inset: 0; z-index: 100; display: none; place-items: center; padding: 30px; color: #efe9dc; background: #101713; text-align: center; }
.rotate-gate span { display: block; margin-bottom: 18px; color: var(--radio); font-size: 60px; }
.rotate-gate strong { font: 800 18px ui-monospace, monospace; letter-spacing: .12em; }
.rotate-gate p { color: #9aa29a; font: 16px Georgia, serif; }

@media (max-width: 760px) {
  #title-screen { grid-template-columns: 1fr; }
  .title-card { margin: 0; align-self: center; }
  .title-quote { display: none; }
  h1 { font-size: clamp(70px, 22vw, 120px); }
  .hud-top { padding: 16px; }
  .fuel-readout { display: none; }
  .health-block { grid-template-columns: 44px min(28vw, 120px) 30px; gap: 6px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stash-heading, .stash-row { grid-template-columns: minmax(88px,1fr) 64px 136px 64px; gap: 5px; }
  .stash-row { padding: 7px 9px; }
  .stash-transfer button { padding: 7px 3px; font-size: 8px; }
  .trader-offer { grid-template-columns: 1fr; }
  .trade-source-actions { grid-template-columns: 1fr; }
}

@media (orientation: portrait) { .touch-enabled .hud--active ~ .rotate-gate { display: grid; } }
@media (orientation: landscape) {
  .touch-enabled .hud-bottom { left: 185px; right: 120px; }
  .touch-enabled .controls-hint { display: none; }
}
