:root {
  --ui: 'Rajdhani', 'Segoe UI', sans-serif;
  --title: 'Orbitron', 'Segoe UI', sans-serif;
  --accent: #ffcc33;
  --accent2: #37c8ff;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #000; color: #eee; font-family: var(--ui); overflow: hidden; user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
body.playing, body.playing canvas#game { cursor: none; }   /* no menu up: the cursor is gone even when nothing locks the pointer (a controller) */
.hidden { display: none !important; }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; transform: translate(-50%, -50%); transition: transform .1s; }
#crosshair span { position: absolute; background: rgba(255,255,255,.85); box-shadow: 0 0 2px #000; }
#crosshair span:nth-child(1) { left: 11px; top: 0; width: 2px; height: 7px; }
#crosshair span:nth-child(2) { left: 11px; bottom: 0; width: 2px; height: 7px; }
#crosshair span:nth-child(3) { top: 11px; left: 0; height: 2px; width: 7px; }
#crosshair span:nth-child(4) { top: 11px; right: 0; height: 2px; width: 7px; }
#crosshair.ads { transform: translate(-50%, -50%) scale(.45); opacity: .5; }
#crosshair.hidden-soft { opacity: 0; }
/* night vision: the frame behind the HUD is recoloured to green phosphor with a backdrop filter (a blend mode cannot
   see the canvas through the HUD's stacking context), the player floods the scene with a green fill and opens the
   exposure, and scanlines and a vignette go on top; .scope keeps it inside the marksman rifle's glass */
#nv { position: absolute; inset: 0; background: rgba(90,255,130,.08); -webkit-backdrop-filter: grayscale(1) sepia(1) hue-rotate(65deg) saturate(2.4) brightness(1.15) contrast(1.1); backdrop-filter: grayscale(1) sepia(1) hue-rotate(65deg) saturate(2.4) brightness(1.15) contrast(1.1); }
#nv::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, rgba(0,0,0,.14) 0 2px, transparent 2px 4px), radial-gradient(circle, transparent 50%, rgba(0,0,0,.55) 100%); }
#nv.scope { clip-path: circle(31vmin at 50% 50%); }
/* the marksman rifle's scope: a circle of the world, black around it, a reticle in the middle */
#scope { position: absolute; inset: 0; background: radial-gradient(circle at 50% 50%, transparent 0, transparent 30vmin, rgba(0,0,0,.6) 31vmin, #000 34vmin); }
#scope .reticle { position: absolute; left: 50%; top: 50%; width: 62vmin; height: 62vmin; transform: translate(-50%, -50%); border-radius: 50%; box-shadow: inset 0 0 40px rgba(0,0,0,.8); }
#scope .reticle i { position: absolute; background: rgba(0,0,0,.85); }
#scope .reticle i:nth-child(1) { left: 50%; top: 0; width: 1.5px; height: 44%; transform: translateX(-50%); }
#scope .reticle i:nth-child(2) { left: 50%; bottom: 0; width: 1.5px; height: 44%; transform: translateX(-50%); }
#scope .reticle i:nth-child(3) { top: 50%; left: 0; height: 1.5px; width: 44%; transform: translateY(-50%); }
#scope .reticle i:nth-child(4) { top: 50%; right: 0; height: 1.5px; width: 44%; transform: translateY(-50%); }
#scope .reticle b { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #ff3a2a; box-shadow: 0 0 6px rgba(255,58,42,.8); }
#hitmarker { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; transform: translate(-50%,-50%) rotate(45deg); opacity: 0; border: 2px solid #fff; border-radius: 2px; }
#hitmarker.show { animation: hit .18s ease-out; }
#hitmarker.kill { border-color: #ff3b3b; }
@keyframes hit { 0% { opacity: 1; transform: translate(-50%,-50%) rotate(45deg) scale(1.3);} 100% { opacity: 0; transform: translate(-50%,-50%) rotate(45deg) scale(.8);} }
#damage-vignette { position: absolute; inset: 0; box-shadow: inset 0 0 160px rgba(200,0,0,0); transition: box-shadow .3s; }
#damage-vignette.hurt { box-shadow: inset 0 0 200px rgba(220,0,0,.75); transition: none; }

#objective { position: absolute; left: 32px; top: 28px; max-width: 420px; border-left: 3px solid var(--accent); padding: 6px 14px; background: linear-gradient(90deg, rgba(0,0,0,.55), transparent); }
#objective-title { font-family: var(--title); font-size: 11px; letter-spacing: 3px; color: var(--accent); }
#objective-text { font-size: 22px; font-weight: 600; text-shadow: 0 1px 3px #000; }
#objective-hint { font-size: 15px; color: #cfd8dc; }
#objective-hint b { color: #fff; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.4); border-radius: 4px; padding: 0 6px; margin: 0 2px; font-family: var(--title); font-size: 12px; }
#objective.flash { animation: flash .6s; }
@keyframes flash { 0%,100% { background: linear-gradient(90deg, rgba(0,0,0,.55), transparent);} 50% { background: linear-gradient(90deg, rgba(255,204,51,.45), transparent);} }

#prompt { position: absolute; left: 50%; top: 58%; transform: translateX(-50%); font-size: 20px; font-weight: 600; background: rgba(0,0,0,.55); padding: 6px 16px; border-radius: 6px; border: 1px solid rgba(255,255,255,.25); text-shadow: 0 1px 2px #000; }
#prompt:empty { display: none; }
#prompt b { color: var(--accent); font-family: var(--title); font-size: 14px; margin-right: 6px; }
/* work in progress (building a barricade): a bar under the prompt that fills while interact is held */
#work-wrap { position: absolute; left: 50%; top: 64%; transform: translateX(-50%); width: min(30vw, 360px); text-align: center; }
#work-label { font-family: var(--title); font-size: 13px; letter-spacing: 3px; color: var(--accent); text-shadow: 0 1px 2px #000; margin-bottom: 4px; }
#work-track { height: 12px; background: rgba(0,0,0,.55); border: 2px solid rgba(255,255,255,.45); border-radius: 8px; padding: 2px; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
#work-bar { height: 100%; width: 0; border-radius: 5px; background: linear-gradient(90deg, #7dff9a, #ffd060); transition: width .08s; box-shadow: 0 0 10px rgba(125,255,154,.5); }
#reload-stage { position: absolute; left: 50%; top: 64%; transform: translateX(-50%); font-size: 17px; color: #ffd; letter-spacing: 1px; text-shadow: 0 1px 2px #000; }
#reload-stage:empty { display: none; }

#status { position: absolute; left: 32px; bottom: 28px; width: 300px; }
#health-wrap, #stamina-wrap { height: 10px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.3); margin-bottom: 4px; }
#health-bar { height: 100%; width: 100%; background: linear-gradient(90deg,#d61a1a,#ff5a3c); transition: width .15s; }
#stamina-bar { height: 100%; width: 100%; background: linear-gradient(90deg,#1f8fd6,#37c8ff); transition: width .1s; }
#stamina-wrap { height: 5px; }
/* the mounted gun's barrel heat: a wide gauge under the gun, mid-screen, that cannot be missed */
#heat-wrap { position: absolute; left: 50%; top: 83%; transform: translateX(-50%); width: min(36vw, 440px); height: 14px; background: rgba(0,0,0,.55); border: 2px solid rgba(255,255,255,.45); border-radius: 8px; padding: 2px; box-shadow: 0 2px 8px rgba(0,0,0,.6); }
#heat-bar { height: 100%; width: 100%; border-radius: 5px; background: linear-gradient(90deg, #ff8a20, #ffd060); transition: width .08s; box-shadow: 0 0 10px rgba(255,150,40,.5); }
#heat-wrap.hot { border-color: #ff6a3a; }
#heat-wrap.hot #heat-bar { background: linear-gradient(90deg, #ff8a20, #ff3a1a); box-shadow: 0 0 16px rgba(255,80,40,.9); }
#heat-wrap.locked { border-color: #ff2a1a; box-shadow: 0 0 24px rgba(255,40,20,.8); }
#heat-wrap.locked #heat-bar { background: #ff2a1a; animation: heatflash .35s steps(2) infinite; }
@keyframes heatflash { 50% { opacity: .3; } }
#ammo { position: fixed; right: 32px; bottom: 28px; width: 240px; text-align: right; }
#ammo-gun { font-family: var(--title); font-size: 40px; font-weight: 700; line-height: 1; text-shadow: 0 2px 6px #000; }
#ammo-gun.low { color: #ff5a3c; }
#ammo-magsize { font-size: 18px; color: #aaa; }
#ammo-mags { display: flex; justify-content: flex-end; gap: 6px; margin: 6px 0; }
#ammo-mags .mag { width: 18px; height: 30px; border: 2px solid #ccc; border-radius: 3px; position: relative; background: rgba(0,0,0,.4); }
#ammo-mags .mag i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); }
#ammo-backpack { font-size: 13px; letter-spacing: 2px; color: #bbb; }
#ammo-backpack span { color: #fff; font-family: var(--title); }
#wave { position: absolute; right: 32px; top: 28px; font-family: var(--title); font-size: 14px; letter-spacing: 3px; color: #ffb0a0; text-align: right; }
.menu-buttons.sites button { text-align: left; }
.menu-buttons.sites button small { display: block; font-family: var(--ui); font-size: 13px; letter-spacing: 0; text-transform: none; color: #b8c0c8; margin-top: 2px; }
.menu-buttons.sites button.ghost { text-align: center; opacity: .8; }
.menu-buttons.sites button.focused small, .menu-buttons.sites button:hover small { color: #2a2000; }
.level-list { margin-bottom: 14px; }
.level-list button { width: 460px; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 10px 18px; }
.level-list button .num { font-size: 22px; font-weight: 700; color: var(--accent); min-width: 34px; text-align: center; }
.level-list button.focused .num, .level-list button:hover .num { color: #2a2000; }
.level-list button .body { flex: 1; }
.level-list button .tick { color: #7dff9a; font-size: 18px; }
.level-list button.locked { opacity: .38; cursor: default; }
.level-list button.locked:hover { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.35); transform: none; }
.level-list button.locked .num, .level-list button.locked:hover .num { color: #888; }
.level-list button.locked .tick { font-size: 15px; }
.level-list button.focused .tick, .level-list button:hover .tick { color: #0a3a14; }
@media (max-width: 520px) { .level-list button { width: 92vw; } }
#boss { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); width: min(46vw, 620px); text-align: center; }
#boss-name { font-family: var(--title); font-size: 13px; letter-spacing: 4px; color: #ff6a4a; text-shadow: 0 0 10px rgba(255,80,40,.6); margin-bottom: 4px; }
#boss-wrap { height: 9px; background: rgba(0,0,0,.6); border: 1px solid rgba(255,120,90,.6); }
#boss-bar { height: 100%; width: 100%; background: linear-gradient(90deg, #ff3a1a, #ff8a4a); transition: width .15s; box-shadow: 0 0 12px rgba(255,90,40,.7); }
#boss-bar.low { background: linear-gradient(90deg, #ffd23a, #ff6a1a); }
#controller-indicator { position: absolute; left: 32px; bottom: 8px; font-size: 12px; color: #9aa; }

/* ---------- Cinematics ---------- */
#letterbox { position: fixed; inset: 0; pointer-events: none; }
#letterbox .bar { position: absolute; left: 0; right: 0; height: 11vh; background: #000; }
#letterbox .top { top: 0; } #letterbox .bottom { bottom: 0; }
#subtitle { position: fixed; left: 50%; bottom: 14vh; transform: translateX(-50%); max-width: 80vw; text-align: center; font-size: 26px; font-weight: 600; color: #fff; text-shadow: 0 2px 4px #000, 0 0 12px rgba(0,0,0,.8); padding: 6px 16px; }
#subtitle .who { color: var(--accent); }
#skip-hint { position: fixed; right: 28px; bottom: 3vh; font-size: 14px; letter-spacing: 2px; color: #aaa; }
#title-card { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--title); font-weight: 900; font-size: clamp(48px, 12vw, 160px); letter-spacing: .12em; color: #ffd21a; text-shadow: 0 0 10px rgba(255,200,0,.35), 0 2px 6px rgba(0,0,0,.6); pointer-events: none; opacity: 0; transition: opacity 1.2s; }
#title-card.show { opacity: 1; }
#fade { position: fixed; inset: 0; background: #000; opacity: 1; pointer-events: none; transition: opacity 1s; }

/* ---------- Menus ---------- */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 16px 0; background: radial-gradient(ellipse at center, rgba(10,14,20,.85), rgba(0,0,0,.95)); z-index: 10; }
.menu-inner { text-align: center; min-width: 320px; }
h1 { font-family: var(--title); font-size: clamp(40px, 8vw, 96px); letter-spacing: .15em; margin: 0 0 8px; color: var(--accent); text-shadow: 0 0 30px rgba(255,204,51,.4); }
h1.red { color: #ff3b3b; text-shadow: 0 0 30px rgba(255,59,59,.5); }
h2 { font-family: var(--title); letter-spacing: .2em; color: #fff; }
.tag { color: #bbb; letter-spacing: 3px; text-transform: uppercase; font-size: 14px; margin-bottom: 28px; }
.menu-buttons { display: flex; flex-direction: column; gap: 10px; align-items: center; }
button { font-family: var(--title); font-size: 15px; letter-spacing: 2px; padding: 12px 28px; min-width: 260px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.35); color: #fff; cursor: pointer; transition: all .15s; }
button:hover, button.focused { background: var(--accent); color: #000; border-color: var(--accent); transform: translateX(6px); }
.small { font-size: 13px; color: #999; margin-top: 18px; display: block; }
/* the email gate (engine/gate.js) */
.gate { max-width: 440px; padding: 0 20px; }
.gate p { color: #c8ccd2; line-height: 1.45; }
.gate input[type="email"] { width: 100%; max-width: 320px; box-sizing: border-box; font-family: var(--ui); font-size: 18px; padding: 12px 14px; margin: 8px 0 4px; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.35); color: #fff; text-align: center; user-select: text; -webkit-user-select: text; outline: none; }
.gate input[type="email"]:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(255,204,51,.25); }
.gate-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.gate-error { min-height: 20px; margin: 4px 0 10px; color: #ff6b6b !important; font-size: 14px; }
.gate button.ghost { opacity: .7; }
.gate button:disabled { opacity: .45; cursor: wait; transform: none; }
#pause h2 { user-select: none; -webkit-user-select: none; }
/* the debug menu: dense grids of small buttons, greyed when there is no level to act on */
.debug .small { margin: 4px 0 6px; min-height: 16px; color: var(--accent); }
.debug h3 { font-family: var(--title); font-size: 12px; letter-spacing: .3em; color: #999; margin: 14px 0 6px; }
.debug-grid { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 760px; margin: 0 auto; }
.debug-grid button { min-width: 0; padding: 7px 12px; font-size: 11px; letter-spacing: 1px; }
.debug-grid button:hover, .debug-grid button.focused { transform: none; }
.debug-grid button:disabled { opacity: .3; cursor: default; }
.debug-grid button:disabled:hover { background: rgba(255,255,255,.06); color: #fff; border-color: rgba(255,255,255,.35); }
.debug .menu-buttons { margin-top: 18px; }
#controls-table { margin: 0 auto 20px; border-collapse: collapse; font-size: 16px; }
#controls-table td { padding: 2px 18px; border-bottom: 1px solid rgba(255,255,255,.1); text-align: left; }
#controls-table td:first-child { color: var(--accent); font-weight: 600; }
#controls-table td b { font-family: var(--title); font-size: 12px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.4); border-radius: 4px; padding: 1px 7px; }
#level-complete-text { max-width: 520px; color: #ccc; font-size: 18px; }

#slots { position: absolute; right: 32px; bottom: 140px; display: flex; gap: 6px; }
#slots .slot { min-width: 84px; padding: 6px 8px; border: 1px solid rgba(255,255,255,.25); background: rgba(0,0,0,.45); font-size: 13px; color: #ddd; text-align: center; }
#slots .slot i { display: block; font-style: normal; font-family: var(--title); font-size: 9px; letter-spacing: 2px; color: #999; text-transform: uppercase; margin-bottom: 2px; }
#slots .slot.active { border-color: var(--accent); color: #fff; box-shadow: 0 0 10px rgba(255,204,51,.35); }
#slots .slot.active i { color: var(--accent); }
#slots .slot.empty { opacity: .45; }
#toast { position: absolute; left: 50%; top: 42%; transform: translateX(-50%); font-family: var(--title); font-size: 14px; letter-spacing: 2px; color: #fff; background: rgba(0,0,0,.6); padding: 6px 14px; border-radius: 4px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.show { opacity: 1; }
#inventory { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); min-width: 520px; background: rgba(6,10,16,.92); border: 1px solid rgba(255,255,255,.3); padding: 18px 24px; }
#inventory h3 { font-family: var(--title); letter-spacing: 4px; margin: 0 0 12px; color: var(--accent); font-size: 16px; }
.inv-row { display: grid; grid-template-columns: 110px 150px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 16px; }
.inv-slot { font-family: var(--title); font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #aaa; align-self: center; }
.inv-item em { color: #666; }
.inv-ammo { color: #bbb; font-size: 14px; align-self: center; }
.inv-foot { margin-top: 12px; font-size: 13px; color: #999; }
.inv-foot b, #map-title b { font-family: var(--title); font-size: 11px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.4); border-radius: 4px; padding: 0 6px; margin: 0 3px; color: #fff; }
#map-overlay { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); text-align: center; }
#map-overlay canvas { display: block; box-shadow: 0 0 40px rgba(0,0,0,.8); }
#map-title { margin-top: 8px; font-family: var(--title); font-size: 12px; letter-spacing: 3px; color: #ccc; }

#gamepad-debug { margin: 10px auto 0; max-width: 640px; text-align: left; font: 12px/1.4 monospace; color: #9fd8ff; background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.2); padding: 8px 12px; white-space: pre-wrap; }
