:root { --ink: #17121a; --gold: #ffd23c; --red: #ff4a3a; --green: #5fe07a; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0d0b10; overflow: hidden; touch-action: none; -webkit-touch-callout: none; overscroll-behavior: none; font-family: "Arial Black", Impact, system-ui, sans-serif; color: #fff; user-select: none; -webkit-user-select: none; }
#wrap { position: fixed; inset: 0; display: grid; place-items: center; }
#stage { width: min(100vw, calc(100vh * 16 / 9)) !important; height: auto !important; aspect-ratio: 16 / 9; cursor: url('assets/ui/cross.svg') 32 32, crosshair; display: block; background: #222; touch-action: none; }
#hud { position: fixed; inset: 0; pointer-events: none; }
#score { position: absolute; left: 20px; top: 14px; font-size: 30px; letter-spacing: 2px; text-shadow: 3px 3px 0 var(--ink); }
#lives { position: absolute; right: 20px; top: 14px; font-size: 28px; text-shadow: 3px 3px 0 var(--ink); }
#weapon { position: absolute; right: 20px; bottom: 16px; text-align: right; font-size: 18px; text-shadow: 2px 2px 0 var(--ink); }
#ammo { display: flex; gap: 4px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; max-width: 320px; }
#ammo i { width: 10px; height: 26px; border-radius: 3px 3px 1px 1px; background: #444; border: 2px solid var(--ink); }
#ammo i.on { background: linear-gradient(#ffe08a 0 35%, #c88a2a 35%); }
#reload { position: absolute; left: 50%; bottom: 22%; transform: translateX(-50%); font-size: 40px; color: var(--red); text-shadow: 3px 3px 0 var(--ink); opacity: 0; }
#reload.show { opacity: 1; animation: blink .4s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }
#banner { position: fixed; left: 0; right: 0; top: 30%; text-align: center; pointer-events: none; opacity: 0; transition: opacity .25s; }
#banner.show { opacity: 1; }
#banner b { display: block; font-size: clamp(36px, 7vw, 86px); color: var(--gold); text-shadow: 5px 5px 0 var(--ink); letter-spacing: 3px; }
#banner span { display: block; font: 700 clamp(14px, 2vw, 22px) system-ui, sans-serif; text-shadow: 2px 2px 0 var(--ink); margin-top: 6px; }
#subs { position: fixed; left: 50%; bottom: 9%; transform: translateX(-50%); max-width: 80vw; text-align: center; font: 600 clamp(15px, 2.1vw, 24px) Georgia, serif; background: rgba(0,0,0,.55); padding: 10px 18px; border-radius: 6px; opacity: 0; transition: opacity .3s; pointer-events: none; }
#subs.show { opacity: 1; }
#talk { position: fixed; left: 18px; bottom: 18px; max-width: 46vw; background: #fff; color: #111; font: 700 clamp(13px, 1.6vw, 18px) system-ui, sans-serif; padding: 10px 14px; border-radius: 4px; box-shadow: 4px 4px 0 var(--ink); opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; }
#talk.show { opacity: 1; transform: none; }
#talk.dead { color: #777; }
#bossbar { position: fixed; left: 50%; top: 60px; transform: translateX(-50%); width: min(560px, 70vw); display: none; text-align: center; pointer-events: none; }
#bossbar.show { display: block; }
#bossbar b { display: block; font-size: 18px; text-shadow: 2px 2px 0 var(--ink); margin-bottom: 4px; }
#bossbar i { display: block; height: 14px; border: 3px solid var(--ink); background: linear-gradient(90deg, var(--red) calc(var(--hp, 1) * 100%), #333 0); }
.pop { position: fixed; transform: translate(-50%, -100%); font-size: clamp(13px, 1.7vw, 22px); text-shadow: 2px 2px 0 var(--ink); pointer-events: none; animation: rise 1.1s ease-out forwards; white-space: nowrap; }
.pop.good { color: var(--gold); }
.pop.bad { color: var(--red); }
@keyframes rise { to { transform: translate(-50%, -220%); opacity: 0; } }
.tag { position: fixed; transform: translate(-50%, 0); color: var(--ink); pointer-events: none; white-space: nowrap; font-size: 16px; }
.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; background: rgba(10, 8, 14, .55); text-align: center; cursor: crosshair; }
.screen.show { display: flex; }
.screen h1 { font-size: clamp(48px, 10vw, 120px); margin: 0; color: var(--gold); text-shadow: 6px 6px 0 var(--ink), -2px -2px 0 #b8201f; letter-spacing: 6px; }
.screen .sub { font-size: clamp(16px, 2.4vw, 28px); margin: 6px 0 26px; }
.screen .target { font-size: clamp(18px, 2.6vw, 30px); color: #fff; animation: blink 1s steps(2) infinite; }
.screen .help, .screen .cred { font: 600 clamp(12px, 1.4vw, 16px) system-ui, sans-serif; max-width: 640px; opacity: .9; line-height: 1.5; padding: 0 16px; }
.screen .cred { opacity: .6; margin-top: 18px; }
#res { background: rgba(0,0,0,.6); padding: 26px 40px; border-radius: 8px; min-width: min(420px, 90vw); }
#res h2 { color: var(--gold); font-size: clamp(26px, 4vw, 44px); margin: 0 0 14px; text-shadow: 3px 3px 0 var(--ink); }
#res p { display: flex; justify-content: space-between; gap: 30px; margin: 6px 0; font: 700 18px system-ui, sans-serif; }
#res .tot { font-size: 22px; color: var(--gold); margin-top: 14px; }
#res .rank b { font-size: 40px; color: var(--gold); }
#res .small { display: block; font-size: 13px; opacity: .7; margin-top: 14px; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; font: 700 20px system-ui; background: #0d0b10; }

/* the crosshair: the system's own (hardware) cursor while the pointer is free, so it never lags; red over a target */
#stage.target { cursor: url('assets/ui/cross_red.svg') 32 32, crosshair; }
/* with the pointer locked (faster aim) it is this element, moved straight from the mouse handler */
#cross { position: fixed; left: 0; top: 0; width: 64px; height: 64px; margin: -32px 0 0 -32px; background: url('assets/ui/cross.svg') center / contain no-repeat; pointer-events: none; display: none; z-index: 5; will-change: transform; }
#cross.on { display: block; }
#cross.target { background-image: url('assets/ui/cross_red.svg'); }
#cross.kick { width: 86px; height: 86px; margin: -43px 0 0 -43px; }

/* the shot tricks: FATALITY, NUT JOB, NICE GUY, LEG DAY, CLIMAXXX */
.pop.trick { font: 900 clamp(26px, 4.2vw, 58px) Impact, 'Arial Black', sans-serif; letter-spacing: .04em; color: #ffe066;
  text-shadow: 0 0 2px #000, 0 3px 0 #7a2a00, 0 0 18px rgba(255, 160, 40, .8); animation: trickpop 1.5s cubic-bezier(.2, 1.4, .4, 1) forwards; z-index: 6; }
.pop.trick.bad { color: #ff4a3a; text-shadow: 0 0 2px #000, 0 3px 0 #500, 0 0 22px rgba(255, 30, 20, .9); }
.pop.trick.good { color: #6dff8a; text-shadow: 0 0 2px #000, 0 3px 0 #0a4a1a, 0 0 18px rgba(60, 255, 120, .8); }
@keyframes trickpop { 0% { transform: translate(-50%, -50%) scale(2.6) rotate(-6deg); opacity: 0; } 12% { transform: translate(-50%, -50%) scale(.9) rotate(2deg); opacity: 1; }
  22% { transform: translate(-50%, -50%) scale(1.08) rotate(-1deg); } 75% { transform: translate(-50%, -60%) scale(1); opacity: 1; } 100% { transform: translate(-50%, -90%) scale(.9); opacity: 0; } }

/* the title card between stages, over black: the stage, its line, the route with this stage lit */
#card { position: fixed; left: 0; right: 0; top: 38%; text-align: center; pointer-events: none; opacity: 0; z-index: 7; }
#card.show { animation: cardin 1.8s ease forwards; }
#card b { display: block; font-size: clamp(34px, 6.4vw, 80px); color: var(--gold); letter-spacing: 6px; text-shadow: 0 4px 0 #000, 0 0 24px rgba(255, 200, 60, .45); }
#card span { display: block; margin-top: 6px; font: italic 600 clamp(14px, 1.8vw, 22px) Georgia, serif; color: #e8e2d4; }
#card i { display: block; margin-top: 22px; font: 700 clamp(10px, 1.2vw, 14px) system-ui, sans-serif; letter-spacing: 2px; color: #777; font-style: normal; }
#card i em { font-style: normal; } #card i em.done { color: #bbb; } #card i em.now { color: var(--gold); } #card i s { text-decoration: none; margin: 0 10px; color: #555; }
@keyframes cardin { 0% { opacity: 0; transform: scale(1.12); letter-spacing: 14px; } 25% { opacity: 1; transform: scale(1); } 85% { opacity: 1; } 100% { opacity: 1; } }

.pop.trick.climax { font-size: clamp(34px, 6vw, 84px); background: linear-gradient(180deg, #fff8c0, #ffb030 55%, #ff4a1a); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 3px 0 #5a1000) drop-shadow(0 0 22px rgba(255, 120, 20, .9)); animation-duration: 1.9s; }

/* the verdict on the results screen */
.verdict { margin: 10px 0 14px; padding: 12px 16px; border: 1px solid rgba(255, 210, 80, .35); border-radius: 8px; background: rgba(0, 0, 0, .35); }
.verdict small { display: block; font: 700 11px system-ui, sans-serif; letter-spacing: 3px; color: #aaa; }
.verdict b { display: block; margin: 4px 0; font: 900 clamp(26px, 4vw, 46px) Impact, 'Arial Black', sans-serif; letter-spacing: 2px; color: var(--gold); text-shadow: 0 3px 0 #000; }
.verdict em { display: block; font: italic 15px Georgia, serif; color: #e8e2d4; }
.verdict .tricks { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 10px; }
.verdict .tricks span { font: 700 11px system-ui, sans-serif; letter-spacing: 1px; padding: 3px 7px; border-radius: 4px; background: rgba(255, 255, 255, .06); color: #777; }
.verdict .tricks span.on { color: #fff; background: rgba(255, 190, 60, .2); }
.verdict .tricks i { font-style: normal; color: var(--gold); margin-left: 3px; }

/* ---- phones (body.touch): jagggo's floating joystick + FIRE / RELOAD, the HUD clear of the thumbs and the notch ---- */
:root { --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px); }
.lbl-touch { display: none; } body.touch .lbl-mouse { display: none; } body.touch .lbl-touch { display: inline; }
#stick { position: fixed; left: -60px; top: -60px; width: 120px; height: 120px; border-radius: 50%; border: 2px solid #fff8eeb3;
  background: radial-gradient(circle, #0e162252, #0e16222e 70%); box-shadow: 0 0 0 1px #0000002e, 0 2px 14px #00000040; opacity: 0; transition: opacity .12s; pointer-events: none; z-index: 8; }
#stick.active { opacity: 1; }
#knob { position: absolute; left: 36px; top: 36px; width: 48px; height: 48px; border-radius: 50%; background: #fff8eee6; box-shadow: 0 2px 8px #0006; }
#thumbs { display: none; position: fixed; right: calc(18px + var(--safe-r)); bottom: calc(18px + var(--safe-b)); width: 190px; height: 110px; pointer-events: none; z-index: 8; }
body.touch #thumbs { display: block; }
#thumbs button { position: absolute; pointer-events: auto; border-radius: 50%; font: 900 14px "Arial Black", Impact, sans-serif; color: #fff8e6; touch-action: none; -webkit-tap-highlight-color: transparent; }
#fireBtn { right: 0; bottom: 0; width: 96px; height: 96px; font-size: 17px; background: radial-gradient(circle at 40% 35%, #ff6a5a, #c2261e); border: 3px solid #fff8; box-shadow: 0 5px 0 #6a120d, 0 8px 18px #0008; }
#fireBtn.down { transform: translateY(3px); box-shadow: 0 2px 0 #6a120d, 0 4px 10px #0008; }
#reloadBtn { right: 108px; bottom: 6px; width: 64px; height: 64px; font-size: 10px; background: #0009; border: 2px solid #fff8; }
#reloadBtn:active { background: #fff3; }
body.touch #weapon { bottom: calc(132px + var(--safe-b)); right: calc(22px + var(--safe-r)); }
body.touch #score { left: calc(16px + var(--safe-l)); top: calc(10px + var(--safe-t)); font-size: 22px; }
body.touch #lives { right: calc(16px + var(--safe-r)); top: calc(10px + var(--safe-t)); font-size: 22px; }
body.touch #talk { top: calc(46px + var(--safe-t)); bottom: auto; max-width: 42vw; }
body.touch #stage { cursor: none; }
/* portrait phones: the picture full width at the top under the score row, the thumbs' room below it */
body.touch.portrait #wrap { place-items: start center; padding-top: calc(48px + var(--safe-t)); }
body.touch.portrait #stage { width: 100vw !important; }
body.touch.portrait #weapon { top: calc(58px + 56.25vw + var(--safe-t)); bottom: auto; right: calc(16px + var(--safe-r)); }
body.touch.portrait #talk { top: calc(58px + 56.25vw + var(--safe-t)); bottom: auto; left: calc(16px + var(--safe-l)); max-width: 58vw; }
body.touch.portrait #banner, body.touch.portrait #card { top: calc(48px + var(--safe-t) + 9vw); }
body.touch.portrait #banner b, body.touch.portrait #card b { font-size: 9vw; }
body.touch.portrait #reload { bottom: auto; top: calc(48px + var(--safe-t) + 40vw); font-size: 26px; }
body.touch.portrait #pad { display: block; }
#pad { display: none; position: fixed; left: calc(20px + var(--safe-l)); bottom: calc(26px + var(--safe-b)); width: 120px; height: 120px; border-radius: 50%; border: 2px dashed #fff4; color: #fff6; font: 900 11px "Arial Black", Impact, sans-serif; letter-spacing: 1px; text-align: center; line-height: 120px; pointer-events: none; }
body.touch.portrait #stick.active ~ #pad, body.touch.menu #pad { display: none; }
@media (max-height: 500px) { #banner b { font-size: clamp(28px, 6vw, 54px); } .pop.trick { font-size: clamp(22px, 5vw, 40px); } .screen h1 { font-size: 44px; } .screen .help { font-size: 12px; } }
body.touch.menu #thumbs, body.touch.menu #cross, body.touch.portrait.menu #weapon { display: none; }
