:root {
  --ink: #f1e8d2; --dim: #b9ad91; --muted: #857b66; --gold: #f2c46d; --gold2: #d7a44a; --red: #c8412f; --green: #9ecb72;
  --panel: rgba(20, 21, 18, 0.84); --panel2: rgba(34, 33, 27, 0.9); --line: rgba(242, 196, 109, 0.35);
  --display: 'Oswald', 'Arial Narrow', sans-serif; --serif: 'EB Garamond', Georgia, serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d0d0b; color: var(--ink); font: 15px/1.45 system-ui, sans-serif; user-select: none; -webkit-user-select: none; }
canvas#battlefield { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; outline: none; cursor: crosshair; }
button { font: 600 14px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line); padding: 11px 18px; cursor: pointer; transition: background .15s, border-color .15s, transform .1s; }
button:hover { background: rgba(242, 196, 109, 0.14); border-color: var(--gold); }
button:active { transform: translateY(1px); }
button.primary { background: linear-gradient(180deg, #f5cb78, #d39b3d); color: #1c150a; border-color: #f5cb78; font-size: 16px; padding: 14px 26px; }
button.primary:hover { background: linear-gradient(180deg, #ffd98e, #e2a94a); }
kbd { display: inline-block; min-width: 1.7em; padding: 1px 6px; margin: 0 2px 3px 0; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 3px; font: 600 12px var(--display); color: var(--gold); background: rgba(0,0,0,.35); text-align: center; }
small { font: 600 11px var(--display); letter-spacing: .28em; text-transform: uppercase; color: var(--gold); }
.note { color: var(--dim); font-size: 13px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: .2em 0; letter-spacing: .04em; }

/* ======================= menus ======================= */
#menu { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; pointer-events: none; }
#menu[hidden] { display: none; }
.screen { pointer-events: auto; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px; }
.screen[hidden] { display: none; }
body[data-screen="title"] .screen#screen-title, body[data-screen="pause"] #screen-pause, body[data-screen="settings"] #screen-settings, body[data-screen="controls"] #screen-controls, body[data-screen="credits"] #screen-credits, body[data-screen="end"] #screen-end { background: radial-gradient(ellipse at center, rgba(0,0,0,.15), rgba(0,0,0,.72)); }
#screen-loading { background: #0d0d0b url(assets/cutscenes/counterattack.png) center/cover; }
#screen-loading::before { content: ''; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(10,10,8,.92) 0%, rgba(10,10,8,.55) 55%, rgba(10,10,8,.2)); }
.load-card { position: relative; width: min(520px, 92vw); margin-right: auto; margin-left: max(24px, 7vw); display: grid; gap: 12px; }
h1 { font-size: clamp(56px, 9vw, 112px); line-height: .9; letter-spacing: .16em; color: var(--ink); text-shadow: 0 4px 30px rgba(0,0,0,.6); }
h1 span { display: block; font-size: .24em; letter-spacing: .5em; color: var(--gold); margin-top: 10px; }
.load-bar { height: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .2s; }
#load-text { font: 14px var(--serif); font-style: italic; color: var(--dim); margin: 0; }
#load-go { justify-self: start; }
.brand { text-align: center; }
.brand h1 { font-size: clamp(48px, 7vw, 88px); }
.roles { display: grid; grid-template-columns: repeat(3, minmax(0, 290px)); gap: 16px; }
.role { position: relative; display: grid; align-content: end; gap: 4px; min-height: 250px; padding: 18px; text-align: left; text-transform: none; letter-spacing: 0; background: #111; border: 1px solid rgba(255,255,255,.12); overflow: hidden; }
.role .art { position: absolute; inset: 0; background-size: cover; background-position: center; filter: saturate(.85) brightness(.62); transition: transform .5s, filter .3s; }
.role::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 30%, rgba(8,8,6,.92)); }
.role > *:not(.art) { position: relative; z-index: 1; }
.role b { font: 700 22px var(--display); letter-spacing: .03em; }
.role em { font: italic 15px var(--serif); color: var(--dim); }
.role:hover .art { transform: scale(1.04); filter: saturate(1) brightness(.75); }
.role[aria-pressed="true"] { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold), 0 10px 40px rgba(242,196,109,.18); }
.role[aria-pressed="true"] .art { filter: saturate(1.05) brightness(.8); }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; justify-content: center; }
.diff { display: flex; gap: 0; align-items: center; }
.diff span { font: 600 12px var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--dim); margin-right: 12px; }
.diff button { padding: 8px 14px; font-size: 12px; }
.diff button[aria-pressed="true"] { background: rgba(242,196,109,.22); border-color: var(--gold); color: var(--gold); }
.check { font: 600 12px var(--display); letter-spacing: .15em; text-transform: uppercase; color: var(--dim); display: flex; gap: 8px; align-items: center; cursor: pointer; }
.links { display: flex; gap: 10px; }
.links button { background: transparent; border-color: transparent; color: var(--dim); }
.links button:hover { color: var(--gold); border-color: var(--line); }
.panel { display: grid; gap: 12px; width: min(420px, 92vw); padding: 28px; background: var(--panel); border: 1px solid var(--line); backdrop-filter: blur(6px); }
.panel.wide { width: min(980px, 94vw); max-height: 92vh; overflow: auto; }
.panel h2 { font-size: 34px; }
.panel label { display: grid; grid-template-columns: 1fr 180px; align-items: center; gap: 10px; font: 600 13px var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--dim); }
.panel select, .panel input[type=range] { width: 100%; accent-color: var(--gold); background: #222; color: var(--ink); border: 1px solid var(--line); padding: 6px; }
.cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.cols h3 { color: var(--gold); font-size: 18px; }
.cols p { margin: 6px 0; }
details { border-top: 1px solid rgba(255,255,255,.08); padding: 8px 0; }
summary { cursor: pointer; font: 600 13px var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
details p { color: var(--dim); font-family: var(--serif); font-size: 16px; }
a { color: var(--gold); }
/* briefing */
.brief { display: grid; grid-template-columns: 1.35fr 1fr; width: min(1200px, 95vw); min-height: min(560px, 80vh); background: var(--panel2); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
#brief-art { background-size: cover; background-position: center; min-height: 260px; }
.brief-copy { display: flex; flex-direction: column; gap: 12px; padding: 34px; }
.brief-copy h2 { font-size: 40px; line-height: 1; }
#brief-text { font: 19px/1.5 var(--serif); color: var(--ink); margin: 0; }
.objective { margin: 0; padding: 12px 14px; border-left: 3px solid var(--gold); background: rgba(242,196,109,.08); font: 16px var(--serif); }
.objective b { display: block; font: 600 11px var(--display); letter-spacing: .25em; text-transform: uppercase; color: var(--gold); }
#brief-steps { display: flex; gap: 6px; }
#brief-steps i { width: 38px; height: 4px; background: rgba(255,255,255,.14); }
#brief-steps i.done { background: var(--green); } #brief-steps i.now { background: var(--gold); }
#brief-go { margin-top: auto; align-self: flex-start; }
/* end */
.stats { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.stats div { display: grid; padding: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08); }
.stats b { font: 700 30px var(--display); color: var(--gold); }
.stats span { font: 600 11px var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
#end-text { font: 19px var(--serif); color: var(--dim); }

/* ======================= HUD ======================= */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; font-family: var(--display); }
#hud[hidden] { display: none; }
#objective { position: absolute; top: 20px; left: 22px; width: 330px; padding: 12px 14px; background: linear-gradient(90deg, rgba(10,10,8,.7), rgba(10,10,8,0)); border-left: 3px solid var(--gold); }
#objective p { margin: 3px 0 8px; font: 600 16px var(--display); letter-spacing: .02em; }
#objective .bar { height: 3px; background: rgba(255,255,255,.15); }
#objective .bar i { display: block; height: 100%; width: 0; background: var(--gold); transition: width .4s; }
#obj-count { display: block; margin-top: 5px; font-size: 12px; letter-spacing: .12em; color: var(--dim); text-transform: uppercase; }
#compass { position: absolute; top: 16px; left: 50%; width: 300px; height: 26px; transform: translateX(-50%); overflow: hidden; -webkit-mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); mask-image: linear-gradient(90deg, transparent, #000 25%, #000 75%, transparent); }
#compass-strip { display: flex; white-space: nowrap; will-change: transform; }
#compass-strip span { flex: 0 0 40px; text-align: center; font: 600 13px var(--display); letter-spacing: .1em; color: var(--ink); text-shadow: 0 1px 3px #000; }
#compass > i { position: absolute; left: 50%; bottom: 0; width: 2px; height: 7px; background: var(--gold); }
#minimap { position: absolute; right: 22px; bottom: 22px; width: 200px; height: 200px; border-radius: 50%; border: 2px solid rgba(242,196,109,.5); box-shadow: 0 0 0 4px rgba(0,0,0,.35); opacity: .92; }
#unit-panel { position: absolute; left: 22px; bottom: 22px; width: 360px; padding: 14px 16px; background: linear-gradient(90deg, rgba(10,10,8,.8), rgba(10,10,8,.25)); border-left: 3px solid var(--gold); display: grid; gap: 7px; }
.hp { position: relative; height: 16px; background: rgba(255,255,255,.1); }
.hp i { display: block; height: 100%; background: linear-gradient(90deg, #7aa35a, #a9d17e); transition: width .25s; }
.hp i.warn { background: linear-gradient(90deg, #c69a3a, #f2c46d); } .hp i.crit { background: linear-gradient(90deg, #8c2418, #d2412f); animation: pulse .6s infinite alternate; }
.hp b { position: absolute; right: 6px; top: -1px; font-size: 13px; text-shadow: 0 1px 2px #000; }
.ammo { display: flex; gap: 12px; font-size: 13px; letter-spacing: .06em; color: var(--muted); }
.ammo span.on { color: var(--ink); } .ammo span.on::before { content: '▸ '; color: var(--gold); }
.reload { height: 4px; background: rgba(255,255,255,.1); } .reload i { display: block; height: 100%; background: var(--gold); }
.reload[data-ready="1"] i { background: var(--green); }
.specials { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; letter-spacing: .08em; color: var(--dim); } .specials span { white-space: nowrap; }
#hud-status { font-size: 13px; letter-spacing: .14em; color: #ff8a6a; min-height: 1em; animation: pulse .5s infinite alternate; }
@keyframes pulse { from { opacity: .6 } to { opacity: 1 } }
#killfeed { position: absolute; top: 20px; right: 22px; display: grid; gap: 4px; justify-items: end; }
.feed { padding: 5px 10px; background: rgba(10,10,8,.6); font-size: 13px; letter-spacing: .04em; border-right: 3px solid rgba(255,255,255,.3); transition: opacity .6s, transform .6s; }
.feed.kill { border-right-color: var(--gold); } .feed.loss { border-right-color: var(--red); color: #f0b7a8; }
.feed b { color: var(--gold); font-weight: 600; } .feed.out { opacity: 0; transform: translateX(20px); }
#subtitle { position: absolute; bottom: 110px; left: 50%; transform: translateX(-50%); max-width: 720px; padding: 8px 16px; text-align: center; font: 20px var(--serif); background: rgba(0,0,0,.5); opacity: 0; transition: opacity .25s; }
#subtitle.show { opacity: 1; } #subtitle b { display: block; font: 600 11px var(--display); letter-spacing: .25em; text-transform: uppercase; color: var(--gold); }
#banner { position: absolute; top: 24%; left: 50%; transform: translate(-50%, -10px); text-align: center; opacity: 0; transition: opacity .5s, transform .5s; }
#banner.show { opacity: 1; transform: translate(-50%, 0); }
#banner h2 { font-size: clamp(34px, 5vw, 56px); letter-spacing: .14em; text-transform: uppercase; text-shadow: 0 3px 20px rgba(0,0,0,.8); margin: 0; }
#banner p { margin: 4px 0 0; font: italic 18px var(--serif); color: var(--dim); text-shadow: 0 2px 8px #000; }
#banner.good h2 { color: var(--gold); }
#hud-hint { position: absolute; bottom: 160px; left: 50%; transform: translateX(-50%); padding: 8px 14px; font-size: 13px; letter-spacing: .06em; background: rgba(10,10,8,.7); border: 1px solid var(--line); opacity: 0; transition: opacity .4s; white-space: nowrap; }
#hud-hint.show { opacity: 1; }
#hitinfo { position: absolute; top: 58%; left: 50%; transform: translateX(-50%); font: 700 16px var(--display); letter-spacing: .2em; opacity: 0; transition: opacity .2s; text-shadow: 0 2px 6px #000; white-space: nowrap; }
#hitinfo.show { opacity: 1; } #hitinfo.pen { color: #ffd07a; } #hitinfo.ric { color: #c9d4de; }
#hitmarker { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px; opacity: 0; background: conic-gradient(from 45deg, transparent 0 20deg, #fff 20deg 70deg, transparent 70deg 110deg, #fff 110deg 160deg, transparent 160deg 200deg, #fff 200deg 250deg, transparent 250deg 290deg, #fff 290deg 340deg, transparent 340deg); -webkit-mask: radial-gradient(circle, transparent 5px, #000 6px, #000 12px, transparent 13px); mask: radial-gradient(circle, transparent 5px, #000 6px, #000 12px, transparent 13px); }
#hitmarker.show { opacity: .95; } #hitmarker.kill { opacity: 1; filter: sepia(1) saturate(6) hue-rotate(-20deg); transform: scale(1.3); }
#damage-dirs { position: absolute; left: 50%; top: 50%; }
.dmg-dir { position: absolute; left: -60px; top: -150px; width: 120px; height: 300px; transform-origin: 60px 150px; background: radial-gradient(ellipse at 50% 0%, rgba(210,50,30,.75), transparent 45%); animation: fade 1.1s forwards; }
@keyframes fade { to { opacity: 0 } }
/* reticles */
#reticle { position: absolute; left: 50%; top: 50%; width: 0; height: 0; }
#reticle i { position: absolute; background: rgba(255,255,255,.9); box-shadow: 0 0 2px #000; }
#reticle b { position: absolute; width: 4px; height: 4px; margin: -2px; border-radius: 50%; background: #fff; box-shadow: 0 0 2px #000; }
#reticle.tank i { display: none; } #reticle.tank b { width: 22px; height: 22px; margin: -11px; background: none; border: 1.5px solid rgba(255,255,255,.75); }
#reticle.plane { display: none; }
#reticle.soldier i:nth-child(1) { width: 2px; height: 8px; left: -1px; top: calc(-8px - var(--spread)); } #reticle.soldier i:nth-child(2) { width: 2px; height: 8px; left: -1px; top: var(--spread); }
#reticle.soldier i:nth-child(3) { width: 8px; height: 2px; top: -1px; left: calc(-8px - var(--spread)); } #reticle.soldier i:nth-child(4) { width: 8px; height: 2px; top: -1px; left: var(--spread); }
#reticle.soldier b { width: 3px; height: 3px; margin: -1.5px; }
.mark { position: absolute; left: 0; top: 0; display: none; }
#gun-mark { width: 30px; height: 30px; margin: -15px 0 0 -15px; border: 2px solid var(--gold); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.5); }
#gun-mark::after { content: ''; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px; background: var(--gold); border-radius: 50%; }
#hud[data-mode="tank"] #gun-mark { display: block; }
#plane-cursor { width: 34px; height: 34px; margin: -17px 0 0 -17px; border: 2px solid rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
#plane-nose { width: 16px; height: 16px; margin: -8px 0 0 -8px; } #plane-nose::before, #plane-nose::after { content: ''; position: absolute; background: var(--gold); box-shadow: 0 0 2px #000; } #plane-nose::before { left: 7px; top: 0; width: 2px; height: 16px; } #plane-nose::after { top: 7px; left: 0; height: 2px; width: 16px; }
#bomb-mark { width: 40px; height: 40px; margin: -20px 0 0 -20px; border: 2px dashed #ff6a4a; border-radius: 50%; }
#hud:not([data-mode="plane"]) #plane-cursor, #hud:not([data-mode="plane"]) #plane-nose, #hud:not([data-mode="plane"]) #bomb-mark { display: none !important; }
#hud:not([data-mode="tank"]) #gun-mark { display: none !important; }
#tank-sight { position: absolute; inset: 0; display: none; }
#tank-sight svg { width: 100%; height: 100%; }
#hud.sight #tank-sight { display: block; } #hud.sight #reticle, #hud.sight #markers { display: none; }
#sight-range { position: absolute; left: calc(50% + 70px); top: calc(50% + 10px); font: 600 15px var(--display); color: #1b1b18; text-shadow: 0 0 2px rgba(255,255,255,.4); }
/* objective markers */
.marker { position: absolute; left: 0; top: 0; width: 0; height: 0; }
.marker::before { content: ''; position: absolute; left: -7px; top: -12px; border: 7px solid transparent; border-top: 10px solid var(--gold); filter: drop-shadow(0 1px 2px #000); }
.marker::after { content: attr(data-d); position: absolute; left: -30px; top: -30px; width: 60px; text-align: center; font: 600 11px var(--display); color: var(--ink); text-shadow: 0 1px 2px #000; }
.marker.far::before { border-top-color: rgba(242,196,109,.7); transform: scale(.8); }
/* cinematics */
#letterbox { position: fixed; inset: 0; z-index: 15; pointer-events: none; }
#letterbox i { position: absolute; left: 0; right: 0; height: 0; background: #000; transition: height .9s ease; }
#letterbox i:first-child { top: 0; } #letterbox i:last-child { bottom: 0; }
#letterbox.on i { height: 11vh; }
#cine-title { position: fixed; left: 7vw; bottom: 18vh; z-index: 16; pointer-events: none; opacity: 0; transition: opacity 1.2s; text-shadow: 0 3px 24px rgba(0,0,0,.8); }
#cine-title.show { opacity: 1; }
#cine-title h1 { font-size: clamp(38px, 5vw, 64px); letter-spacing: .12em; }
#cine-title.title { left: 50%; bottom: auto; top: 50%; transform: translate(-50%, -50%); text-align: center; }
#cine-title.title h1 { font-size: clamp(80px, 13vw, 170px); letter-spacing: .3em; margin-right: -.3em; }
#cine-title h3 { font: 600 clamp(14px, 2vw, 24px) var(--display); letter-spacing: .6em; color: var(--gold); text-transform: uppercase; }
#cine-title.defeat h1 { color: #e6d8c0; }
#cine-skip { position: fixed; right: 24px; bottom: 3vh; z-index: 16; font: 600 11px var(--display); letter-spacing: .2em; text-transform: uppercase; color: rgba(255,255,255,.55); opacity: 0; transition: opacity .5s; pointer-events: none; }
#cine-skip.show { opacity: 1; }
body[data-screen="game"] canvas#battlefield { cursor: none; }
@media (max-width: 900px) {
  .roles { grid-template-columns: 1fr; } .role { min-height: 120px; } .brief { grid-template-columns: 1fr; } .cols { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(3, 1fr); }
  #unit-panel { width: 280px; } #minimap { width: 140px; height: 140px; } #objective { width: 250px; }
}
@media (max-height: 560px), (max-width: 720px) {
  #unit-panel { width: 230px; padding: 8px 10px; gap: 4px; font-size: 12px; } #unit-panel .ammo, #unit-panel .specials { font-size: 10px; }
  #objective { width: 220px; padding: 8px 10px; } #objective p { font-size: 13px; } #minimap { width: 120px; height: 120px; }
}

/* ============================ Touch & mobile ============================ */
html, body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
body.touch { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#cine-skip .tc, body.touch #cine-skip .kb { display: none; } body.touch #cine-skip .tc { display: inline; }
body.touch #cine-skip { pointer-events: none; bottom: calc(3vh + env(safe-area-inset-bottom)); }
#touch { display: none; position: absolute; inset: 0; pointer-events: auto; touch-action: none; }
body.touch #touch { display: block; }
body.touch #hud-hint { display: none; }
#stick { position: absolute; width: 124px; height: 124px; margin: -62px 0 0 -62px; border-radius: 50%; border: 2px solid rgba(242,196,109,.45); background: radial-gradient(circle, rgba(0,0,0,.28), rgba(0,0,0,.08)); opacity: 0; transition: opacity .15s; pointer-events: none; }
#stick.on { opacity: 1; }
#stick i { position: absolute; left: 50%; top: 50%; width: 54px; height: 54px; margin: -27px 0 0 -27px; border-radius: 50%; background: rgba(242,196,109,.55); box-shadow: 0 2px 10px rgba(0,0,0,.5); }
#stick-hint, #look-hint { position: absolute; pointer-events: none; display: grid; place-items: center; font: 600 10px var(--display); letter-spacing: .22em; text-transform: uppercase; color: rgba(255,255,255,.35); transition: opacity .4s; }
#stick-hint { left: calc(28px + env(safe-area-inset-left)); bottom: calc(40px + env(safe-area-inset-bottom)); width: 112px; height: 112px; border-radius: 50%; border: 2px dashed rgba(255,255,255,.18); }
#look-hint { right: 22%; top: 46%; }
#touch.used #stick-hint span, #touch.used #look-hint { opacity: 0; }
#touch:has(#stick.on) #stick-hint, #touch:has(#stick.on) #look-hint { opacity: 0; }
#touch-buttons { position: absolute; right: calc(14px + env(safe-area-inset-right)); bottom: calc(18px + env(safe-area-inset-bottom)); width: 236px; display: flex; flex-wrap: wrap-reverse; justify-content: flex-end; align-content: flex-start; gap: 9px; pointer-events: none; }
.tb { pointer-events: auto; touch-action: none; width: 60px; height: 60px; padding: 0; border-radius: 50%; display: grid; place-items: center; font: 600 11px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--ink); background: rgba(12,12,10,.5); border: 1.5px solid rgba(242,196,109,.5); box-shadow: 0 2px 12px rgba(0,0,0,.35); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); transition: transform .06s, background .1s; }
.tb.big { order: -1; width: 92px; height: 92px; font-size: 15px; letter-spacing: .12em; background: rgba(150,40,20,.45); border-color: rgba(255,170,120,.7); }
.tb.down { transform: scale(.92); background: rgba(242,196,109,.4); }
.tb.active { background: rgba(242,196,109,.35); border-color: var(--gold); }
#touch-pause { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); margin-top: 26px; width: 40px; height: 34px; border-radius: 8px; font-size: 12px; letter-spacing: 0; }
#touch-pause.down { transform: translateX(-50%) scale(.92); }

/* the HUD makes room for thumbs: unit status moves to the top-left under the objective, the map goes top-right */
body.touch #unit-panel { top: calc(96px + env(safe-area-inset-top)); bottom: auto; left: calc(10px + env(safe-area-inset-left)); width: 220px; padding: 7px 10px; gap: 4px; font-size: 11px; }
body.touch #unit-panel .ammo, body.touch #unit-panel .specials { font-size: 10px; }
body.touch #objective { top: calc(8px + env(safe-area-inset-top)); left: calc(10px + env(safe-area-inset-left)); width: 230px; padding: 7px 10px; }
body.touch #objective p { font-size: 13px; margin: 2px 0 5px; }
body.touch #minimap { top: calc(8px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); bottom: auto; width: 104px; height: 104px; }
body.touch #killfeed { top: calc(120px + env(safe-area-inset-top)); right: calc(10px + env(safe-area-inset-right)); font-size: 11px; }
body.touch #compass { top: calc(6px + env(safe-area-inset-top)); width: 200px; }
body.touch #subtitle { bottom: auto; top: 30%; font-size: 15px; max-width: 80vw; }
body.touch canvas#battlefield { touch-action: none; }

/* portrait phones */
@media (orientation: portrait) and (max-width: 820px) {
  body.touch #objective { width: calc(100vw - 186px); }
  body.touch #unit-panel { top: calc(92px + env(safe-area-inset-top)); width: min(230px, 58vw); }
  body.touch #killfeed { top: calc(122px + env(safe-area-inset-top)); max-width: 40vw; }
  body.touch #compass { top: calc(118px + env(safe-area-inset-top)); left: auto; right: calc(10px + env(safe-area-inset-right)); transform: none; width: 104px; }
  body.touch #touch-pause { left: auto; right: calc(124px + env(safe-area-inset-right)); top: calc(12px + env(safe-area-inset-top)); transform: none; margin-top: 0; }
  body.touch #touch-pause.down { transform: scale(.92); }
  #touch-buttons { width: 212px; }
  .tb { width: 56px; height: 56px; } .tb.big { width: 88px; height: 88px; }
  #banner h2 { font-size: 28px; } #banner p { font-size: 15px; }
  #hitinfo { font-size: 13px; }
  #tank-sight svg { width: 100%; height: 100%; }
  /* menus stack and scroll */
  .screen { justify-content: flex-start; overflow-y: auto; padding: calc(18px + env(safe-area-inset-top)) 14px calc(18px + env(safe-area-inset-bottom)); gap: 12px; }
  .brand h1, .load-card h1 { font-size: 56px; }
  .roles { grid-template-columns: 1fr; width: 100%; gap: 10px; }
  .role { min-height: 104px; padding: 12px 14px; } .role b { font-size: 18px; } .role em { font-size: 13px; }
  .row { flex-direction: column; gap: 10px; align-items: stretch; width: 100%; }
  .diff { justify-content: space-between; }
  .brief { grid-template-columns: 1fr; min-height: 0; width: 100%; } #brief-art { min-height: 26vh; }
  .brief-copy { padding: 18px; } .brief-copy h2 { font-size: 28px; }
  .panel { padding: 18px; } .panel h2 { font-size: 26px; } .panel label { grid-template-columns: 1fr; }
  .cols { grid-template-columns: 1fr; }
  #cine-title h1 { font-size: 44px; }
}
/* landscape phones: short screens */
@media (orientation: landscape) and (max-height: 500px) {
  .screen { justify-content: flex-start; overflow-y: auto; padding: calc(10px + env(safe-area-inset-top)) calc(16px + env(safe-area-inset-right)) 10px calc(16px + env(safe-area-inset-left)); gap: 10px; }
  .brand h1, .load-card h1 { font-size: 40px; } .brand small { font-size: 10px; }
  .roles { grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; gap: 8px; }
  .role { min-height: 118px; padding: 10px; } .role b { font-size: 15px; } .role em { font-size: 12px; line-height: 1.2; } .role small { font-size: 9px; }
  .brief { grid-template-columns: 1fr 1.2fr; min-height: 0; width: 100%; } .brief-copy { padding: 14px; gap: 6px; } .brief-copy h2 { font-size: 24px; }
  #brief-text { font-size: 14px; }
  .panel { padding: 14px; gap: 8px; } .panel h2 { font-size: 22px; } .panel.wide { max-height: 96vh; }
  body.touch #unit-panel { top: calc(100px + env(safe-area-inset-top)); width: 210px; }
  body.touch #objective { width: 210px; }
  body.touch #killfeed { top: calc(118px + env(safe-area-inset-top)); }
  #stick-hint { width: 96px; height: 96px; bottom: calc(22px + env(safe-area-inset-bottom)); }
  #touch-buttons { width: 250px; bottom: calc(10px + env(safe-area-inset-bottom)); gap: 7px; }
  .tb { width: 52px; height: 52px; font-size: 10px; } .tb.big { width: 80px; height: 80px; }
  #cine-title h1 { font-size: 40px; }
}
@media (orientation: portrait) and (max-width: 820px) {
  body.touch #subtitle { top: auto; bottom: calc(250px + env(safe-area-inset-bottom)); max-width: 92vw; font-size: 14px; }
  #banner { top: 34%; width: 92vw; } #banner h2 { font-size: 24px; letter-spacing: .08em; }
}
@media (orientation: landscape) and (max-height: 500px) {
  body.touch #subtitle { top: auto; bottom: calc(66px + env(safe-area-inset-bottom)); font-size: 14px; max-width: 46vw; }
  #banner { top: 18%; } #banner h2 { font-size: 30px; }
}

/* touch buttons v2: label + live count, empty state, reload ring */
.tb { position: relative; flex-direction: column; gap: 1px; line-height: 1; }
.tb .l { display: block; }
.tb .s { display: block; font-size: 9px; letter-spacing: .08em; color: rgba(242,196,109,.85); min-height: 9px; }
.tb .s:empty { display: none; }
.tb.small { width: 44px; height: 44px; font-size: 15px; align-self: flex-end; }
.tb.off { opacity: .38; filter: grayscale(1); }
.tb.cooling::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; pointer-events: none;
  background: conic-gradient(rgba(242,196,109,.0) 0 var(--cd), rgba(242,196,109,.75) var(--cd) 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px)); }
#stick.sprint { border-color: rgba(255,170,120,.9); }
#stick.sprint i { background: rgba(255,170,120,.75); }
#stick i { transition: background .15s; }

/* ============================ Soldier dossier (shown before each deployment) ============================ */
.dossier { width: min(720px, 94vw); display: grid; gap: 16px; padding: 28px 30px; background: linear-gradient(180deg, rgba(36,32,24,.96), rgba(20,18,14,.96)); border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.dossier header { display: flex; gap: 18px; align-items: center; }
#story-badge { flex: 0 0 auto; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font: 700 26px var(--display); letter-spacing: .04em; color: #1a1712; background: radial-gradient(circle at 35% 30%, #f4d38a, #b8873a); box-shadow: inset 0 -4px 10px rgba(0,0,0,.35), 0 0 0 3px rgba(242,196,109,.25); }
#story-kicker { color: var(--gold); }
#story-name { font-size: clamp(24px, 4vw, 36px); line-height: 1.05; margin: 4px 0; }
#story-meta { margin: 0; font: 600 12px var(--display); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); line-height: 1.5; }
#story-text { margin: 0; font: 19px/1.55 var(--serif); color: var(--ink); }
.dossier .record { padding: 12px 14px; border-left: 3px solid var(--gold); background: rgba(242,196,109,.08); font: italic 16px/1.5 var(--serif); color: var(--ink); }
.dossier .record b { display: block; font: 600 11px var(--display); font-style: normal; letter-spacing: .25em; text-transform: uppercase; color: var(--gold); margin-bottom: 4px; }
.dossier .row { justify-content: flex-start; }
.story-note { font: 12px var(--serif); font-style: italic; color: var(--dim); }
@media (orientation: portrait) and (max-width: 820px) {
  .dossier { padding: 18px; gap: 12px; } #story-badge { width: 54px; height: 54px; font-size: 20px; }
  #story-text { font-size: 16px; } .dossier .record { font-size: 14px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  .dossier { padding: 14px 18px; gap: 8px; width: min(820px, 96vw); } #story-badge { width: 46px; height: 46px; font-size: 17px; }
  #story-name { font-size: 22px; } #story-text { font-size: 14px; line-height: 1.4; } .dossier .record { font-size: 13px; padding: 8px 10px; }
}
/* on touch the grenade counts live on the buttons, so the unit panel can stay compact */
body.touch #hud-specials { display: none; }
body.touch #hud-unit { font-size: 10px; letter-spacing: .14em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
