/* Layout: one landscape stage, 360 units high, scaled to fit and turned on its side on upright phones.
   The level is a canvas; every menu, the HUD and the fact sheet are ordinary HTML on top of it. */
:root {
  --bg: #0b0e14;
  --panel: rgba(12, 15, 22, .84);
  --card: rgba(239, 230, 210, .07);
  --ink: #efe6d2;
  --mute: #b3ad9b;
  --line: rgba(239, 230, 210, .28);
  --orange: #f08a3c;
  --red: #ff5a36;
  --green: #86d680;
  --cyan: #7fe0ff;
  --ua-blue: #1f5fbf;
  --ua-yellow: #ffd21f;
  --ua-ink: #0c2a5c;
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--ink); font-family: var(--font-body); overflow: hidden;
  box-sizing: border-box; overscroll-behavior: none;
  padding-inline: env(safe-area-inset-left, 0px) env(safe-area-inset-right, 0px);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
#app { position: relative; width: 100%; height: 100%; overflow: hidden; background: var(--bg); touch-action: none; }
#stage { visibility: hidden; position: absolute; left: 0; top: 0; width: 640px; height: 360px; transform-origin: 0 0; overflow: hidden; background: var(--bg); font-size: 13px; line-height: 1.3; }
#stage *, #stage *::before, #stage *::after { box-sizing: border-box; }
#world { position: absolute; inset: 0; touch-action: none; }
#world canvas { display: block; width: 100%; height: 100%; }
#stage h2, #stage p { margin: 0; }
#stage button { font: inherit; color: inherit; cursor: pointer; touch-action: manipulation; }
#stage button:focus-visible, #stage a:focus-visible { outline: 2px solid var(--ua-yellow); outline-offset: 2px; }

.screen { position: absolute; inset: 0; }
.eyebrow { font: 600 10px/1 var(--font-display); letter-spacing: .16em; text-transform: uppercase; color: var(--orange); }
.cta, .ghost {
  height: 32px; padding: 0 18px; border-radius: 5px; font: 700 15px/1 var(--font-display) !important; letter-spacing: .04em; text-transform: uppercase;
}
.cta { background: var(--orange); border: 1px solid #ffc08a; color: #1a0f05 !important; }
.ghost { background: rgba(10, 12, 20, .6); border: 1px solid var(--line); }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.panel .row { justify-content: center; }

/* ---------------------------------------------------------------- HUD */
#hud { position: absolute; inset: 0; pointer-events: none; font-family: var(--font-display); }
#hud button { pointer-events: auto; }
/* a faint shade behind the top row keeps the read-outs legible over a bright sky */
#hud::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 84px; background: linear-gradient(rgba(8, 10, 16, .5), rgba(8, 10, 16, 0)); }
.hud-tl { position: absolute; left: 10px; top: 8px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; max-width: 46%; }
.hud-row { display: flex; align-items: center; gap: 9px; }
.pips { display: flex; gap: 3px; }
.pips i { width: 12px; height: 13px; background: rgba(255, 255, 255, .16); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.pips i.on { background: var(--orange); }
.pips.shield i.on { background: var(--cyan); }
.tag { font-weight: 700; font-size: 14px; letter-spacing: .03em; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.tag.gold { color: #ffd66b; }
.radio { display: flex; gap: 6px; align-items: baseline; padding: 3px 9px 4px 8px; background: rgba(10, 12, 20, .72); border-left: 3px solid var(--green); border-radius: 3px; font-size: 13px; font-weight: 500; line-height: 1.2; }
.radio b { font-weight: 700; letter-spacing: .05em; color: var(--green); white-space: nowrap; }
.radio.cmd { border-left-color: var(--orange); }
.radio.cmd b { color: var(--orange); }
.hbtn { background: rgba(10, 12, 20, .62); border: 1px solid var(--line); border-radius: 5px; }
.hbtn.icon { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; }
.hbtn.icon svg { width: 16px; height: 16px; fill: currentColor; }
.hbtn.order { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); height: 26px; padding: 0 12px; font: 700 12px/1 var(--font-display) !important; letter-spacing: .05em; white-space: nowrap; border-color: var(--green); color: #c9f2c4 !important; }
.hbtn.order.attack { border-color: var(--red); color: #ffc7ba !important; }
.hud-tr { position: absolute; right: 8px; top: 8px; display: flex; align-items: center; gap: 6px; }
.km { display: flex; align-items: baseline; gap: 4px; margin-right: 4px; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.km span { font-size: 10px; font-weight: 600; letter-spacing: .12em; color: #d9d2bf; }
.km b { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1; }
.hud-status { position: absolute; right: 10px; top: 44px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.meter { display: flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 600; letter-spacing: .1em; color: #d9d2bf; }
.meter .bar { width: 74px; height: 5px; background: rgba(0, 0, 0, .5); border-radius: 2px; overflow: hidden; }
.meter .bar i { display: block; height: 100%; width: 100%; background: var(--ink); }
.meter .bar i.low { background: var(--red); }
.meter b { min-width: 30px; text-align: right; font-size: 11px; color: var(--ink); font-variant-numeric: tabular-nums; }
.lost { font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--orange); }
.jump { position: absolute; right: 22px; bottom: 20px; width: 66px; height: 66px; border-radius: 50%; background: rgba(10, 12, 20, .5); border: 1.5px solid rgba(255, 222, 170, .7); font: 700 17px/1 var(--font-display) !important; letter-spacing: .06em; }
.jump.air { background: rgba(240, 138, 60, .35); }
/* Ivan's aim dial: the dot on the ring points where the gun points */
.stick { position: absolute; z-index: 2; width: 60px; height: 60px; margin: -30px 0 0 -30px; border: 1.5px solid rgba(255, 222, 170, .6); border-radius: 50%; background: rgba(10, 12, 20, .25); }
.stick i { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: rgba(255, 222, 170, .75); }
.hint { position: absolute; left: 50%; top: 52%; transform: translate(-50%, -50%); width: min(300px, 70%); padding: 8px 12px; text-align: center; background: rgba(10, 12, 20, .62); border-radius: 6px; transition: opacity .6s; }
.hint b { display: block; font-size: 15px; font-weight: 700; }
.hint span { font-size: 13px; color: #e3d6bd; }

/* ---------------------------------------------------------------- title */
.title-bg { position: absolute; inset: -30px; background: url(../img/start.jpg) center / cover; filter: blur(16px) brightness(.45); }
.title-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.start { position: absolute; inset: 0; background: none; border: 0; padding: 0 0 16px; display: flex; align-items: flex-end; justify-content: center; }
.start span { padding: 7px 20px; border-radius: 5px; background: rgba(10, 12, 20, .68); border: 1px solid var(--line); font: 700 16px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.title-sub { position: absolute; left: 12px; bottom: 16px; font: 600 11px/1.2 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink); text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
.title-give { position: absolute; right: 12px; bottom: 14px; height: 30px; padding: 0 12px; border-radius: 5px; background: var(--ua-yellow); border: 0; color: var(--ua-ink) !important; font: 700 13px/1 var(--font-display) !important; letter-spacing: .04em; text-transform: uppercase; }
/* The fullscreen button: one button, in the same place on every screen between levels and in the pause menu.
   view.js places it (--fs-x) on the top right corner of the 16:9 picture area, so it does not move on the
   picture when fullscreen makes the stage longer, and keeps it clear of the phone's fullscreen message. */
#btn-full { position: absolute; left: var(--fs-x, auto); top: 10px; z-index: 7; }
#stage:not(.can-full) #btn-full, #stage.playing:not(.paused) #btn-full { display: none; }
#btn-full .fs-out, .full #btn-full .fs-in { display: none; }
.full #btn-full .fs-out { display: inline; }
.paused .hud-tr, .paused .hud-status { visibility: hidden; }
.ios-tip { position: absolute; left: 12px; bottom: 34px; max-width: 30%; font: 500 11px/1.25 var(--font-display); color: var(--mute); text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }

/* ---------------------------------------------------------------- role select */
.shade-bg { position: absolute; inset: -30px; background: url(../img/hostomel.jpg) center / cover; filter: blur(10px) brightness(.32); }
.select { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; }
.select > * { position: relative; }
.select h2 { font: 700 26px/1 var(--font-display); letter-spacing: .06em; text-transform: uppercase; }
.select .sub { font-size: 13px; color: var(--mute); margin-top: -4px; }
.roles { display: flex; gap: 14px; justify-content: center; width: 100%; }
.role { position: relative; flex: 1 1 0; max-width: 260px; min-width: 0; padding: 10px 14px 12px; text-align: left; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 2px; }
.role canvas { display: block; width: 100%; height: 80px; border-radius: 5px; background: linear-gradient(#27304a, #6a4a4c 70%, #c2633a); margin-bottom: 6px; }
.role .rank { position: absolute; right: 22px; top: 18px; padding: 2px 9px 3px; border-radius: 10px; background: rgba(12, 15, 22, .75); border: 1px solid var(--green); color: var(--green); font: 700 10px/1.2 var(--font-display); letter-spacing: .1em; text-transform: uppercase; }
.role[data-role="ground"] .rank { border-color: var(--red); color: #ff9a80; }
.role strong { font: 700 26px/1 var(--font-display); letter-spacing: .03em; text-transform: uppercase; }
.role em { font: 600 12px/1.2 var(--font-display); font-style: normal; letter-spacing: .08em; text-transform: uppercase; color: var(--orange); }
.role .lines { font-size: 12.5px; line-height: 1.3; color: #e3d6bd; margin-top: 4px; }
.role small { font-size: 11.5px; color: var(--mute); margin-top: 5px; padding-top: 5px; border-top: 1px solid rgba(239, 230, 210, .14); }
.levels { display: flex; align-items: center; gap: 6px; font: 600 11px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.chip { height: 24px; padding: 0 10px; border-radius: 12px; background: rgba(10, 12, 20, .6); border: 1px solid var(--line); font: 600 12px/1 var(--font-display) !important; letter-spacing: .05em; text-transform: uppercase; }
.chip.on { background: var(--orange); border-color: #ffc08a; color: #1a0f05 !important; }
.best { font: 500 12px/1 var(--font-display); letter-spacing: .06em; color: var(--mute); min-height: 12px; }

/* ---------------------------------------------------------------- level intro */
.intro-bg { position: absolute; inset: 0; background: #0b0e14 center / cover; }
.intro-bg canvas { display: block; width: 100%; height: 100%; }
.intro::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(8, 10, 16, .94) 0%, rgba(8, 10, 16, .82) 46%, rgba(8, 10, 16, .1) 82%); }
.intro-panel { position: absolute; z-index: 1; left: 22px; top: 0; bottom: 0; width: min(380px, 62%); display: flex; flex-direction: column; justify-content: center; gap: 8px; }
.intro-panel h2 { font: 700 32px/1 var(--font-display); letter-spacing: .03em; text-transform: uppercase; }
.intro-text p { font-size: 13.5px; line-height: 1.4; margin-bottom: 5px !important; max-width: 46ch; }
.radio.big { align-self: flex-start; font-family: var(--font-display); font-size: 14px; padding: 6px 12px 7px 10px; pointer-events: none; }
.intro-panel .cta { align-self: flex-start; margin-top: 4px; }

/* ---------------------------------------------------------------- fact sheet (inspired by the daily loss cards, not copied) */
.fact { background: linear-gradient(160deg, #1b2230, #0f131b 60%); padding: 12px 16px; display: flex; flex-direction: column; gap: 7px; }
.fs-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px; padding-right: calc(var(--fs-gap, 118px) - 6px); }
.fs-head h2 { font: 700 25px/1 var(--font-display); letter-spacing: .03em; text-transform: uppercase; margin-top: 4px !important; }
.fs-sub { font: 500 12px/1.2 var(--font-display); letter-spacing: .04em; color: var(--mute); margin-top: 3px !important; }
.fs-hero { display: grid; grid-template-columns: auto auto; column-gap: 8px; align-items: baseline; justify-content: end; text-align: right; max-width: 48%; }
.fs-hero .lab { grid-column: 1 / -1; font: 600 10px/1 var(--font-display); letter-spacing: .14em; text-transform: uppercase; color: var(--mute); }
.fs-hero b { font: 700 34px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.fs-hero .unit { font: 700 15px/1 var(--font-display); text-transform: uppercase; letter-spacing: .04em; text-align: left; }
.fs-hero small { grid-column: 1 / -1; font-size: 10.5px; line-height: 1.25; color: var(--mute); }
.fs-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; flex: 1 1 auto; min-height: 0; }
.card { display: flex; gap: 8px; align-items: center; padding: 6px 8px; background: var(--card); border-radius: 6px; min-width: 0; }
.card svg { flex: 0 0 24px; width: 24px; height: 24px; fill: var(--ink); opacity: .9; }
.card div { min-width: 0; display: flex; flex-direction: column; }
.card .lab { font: 600 10px/1.15 var(--font-display); letter-spacing: .07em; text-transform: uppercase; color: var(--mute); }
.card b { font: 700 21px/1.05 var(--font-display); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card small { font: 500 10.5px/1.15 var(--font-display); letter-spacing: .02em; color: var(--orange); }
.fs-foot { display: flex; gap: 14px; align-items: flex-end; justify-content: space-between; }
/* phones with a 16:9 screen have a narrower stage: the fact sheet tightens up to fit */
.narrow .fact { padding: 9px 14px; gap: 5px; }
.narrow .fs-head h2 { font-size: 22px; }
.narrow .fs-hero b { font-size: 28px; }
.narrow .card { padding: 4px 7px; gap: 6px; }
.narrow .card svg { flex-basis: 20px; width: 20px; height: 20px; }
.narrow .card .lab { font-size: 9px; }
.narrow .card b { font-size: 18px; }
.narrow .card small { font-size: 9.5px; line-height: 1.1; }
.narrow .fs-notes { font-size: 10.5px; line-height: 1.25; }
.narrow .fs-notes .src { font-size: 8.5px; }
.fs-act { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.code-box { display: flex; align-items: baseline; gap: 7px; padding: 4px 10px 5px; border: 1px solid var(--ua-yellow); border-radius: 5px; background: rgba(255, 210, 31, .08); font-family: var(--font-display); white-space: nowrap; }
.code-box span { font-size: 10px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.code-box b { font-size: 20px; font-weight: 700; letter-spacing: .14em; color: var(--ua-yellow); -webkit-user-select: text; user-select: text; }
.code-box small { font-size: 11px; font-weight: 600; color: var(--ink); }
.fs-notes { min-width: 0; display: flex; flex-direction: column; gap: 2px; font-size: 11.5px; line-height: 1.3; }
.fs-notes .lie { color: var(--mute); }
.fs-notes .lie::before { content: "Radioen "; font: 700 10px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--orange); }
.fs-notes .boss::before { content: "Bossen "; font: 700 10px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ua-yellow); }
.fs-notes .own { color: var(--orange); font-weight: 500; }
.fs-notes .src { font-size: 9.5px; color: var(--mute); -webkit-user-select: text; user-select: text; }
.fs-notes a { color: inherit; }

/* ---------------------------------------------------------------- end screen */
.end-bg { position: absolute; inset: 0; background: url(../img/end.jpg) center 30% / cover; }
.end::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8, 10, 16, 0) 18%, rgba(8, 10, 16, .78) 62%, rgba(8, 10, 16, .94) 100%); }
.end-body { position: absolute; z-index: 1; left: 18px; right: 18px; bottom: 14px; display: flex; gap: 16px; align-items: flex-end; justify-content: space-between; }
.end-left { min-width: 0; flex: 1 1 0; display: flex; flex-direction: column; gap: 6px; }
.end-left h2 { font: 700 27px/1.02 var(--font-display); letter-spacing: .02em; text-transform: uppercase; text-wrap: balance; text-shadow: 0 2px 6px rgba(0, 0, 0, .7); }
.end-sum { font-size: 13px; line-height: 1.35; max-width: 48ch; }
.stats { font: 600 12px/1.3 var(--font-display); letter-spacing: .06em; text-transform: uppercase; color: var(--orange); }
.stats.code { color: var(--ua-yellow); -webkit-user-select: text; user-select: text; }
.stats.code:empty { display: none; }
.give { flex: 0 0 auto; width: 238px; padding: 10px 12px 9px; background: rgba(12, 22, 44, .9); border: 1px solid rgba(255, 210, 31, .55); border-radius: 8px; display: flex; flex-direction: column; gap: 4px; }
.give-cta { font: 700 17px/1 var(--font-display); letter-spacing: .04em; text-transform: uppercase; color: var(--ua-yellow); }
.give-mp { display: grid; grid-template-columns: 1fr auto; align-items: center; column-gap: 8px; row-gap: 2px; }
.give-mp span { grid-column: 1 / -1; }
.give-mp span { font: 600 11px/1 var(--font-display); letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.give-mp b { font: 700 24px/1 var(--font-display); letter-spacing: .04em; font-variant-numeric: tabular-nums; -webkit-user-select: text; user-select: text; }
.copy { height: 22px; padding: 0 8px; border-radius: 4px; background: none; border: 1px solid var(--line); font: 600 10px/1 var(--font-display) !important; letter-spacing: .08em; text-transform: uppercase; }
.give-link { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 7px 8px; border-radius: 5px; background: var(--ua-yellow); color: var(--ua-ink); text-align: center; text-decoration: none; font: 700 13px/1 var(--font-display); letter-spacing: .02em; }
.give-org { font: 600 11px/1.2 var(--font-display); letter-spacing: .04em; color: var(--ink); }
.give-note { font-size: 9.5px; line-height: 1.25; color: var(--mute); }

/* ---------------------------------------------------------------- overlays */
.overlay { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; background: rgba(6, 7, 12, .66); }
.panel { min-width: 240px; padding: 16px 20px; background: #10141c; border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.panel h2 { font: 700 22px/1 var(--font-display); letter-spacing: .08em; text-transform: uppercase; }
.panel .give { border: 0; background: none; padding: 0; width: 230px; }
/* code entry */
.keypad { gap: 8px; padding: 12px 18px 14px; }
.slots { display: flex; gap: 8px; }
.slots i { width: 34px; height: 38px; display: grid; place-items: center; border: 1.5px solid var(--line); border-radius: 5px; background: rgba(239, 230, 210, .06); font: 700 24px/1 var(--font-display); font-style: normal; color: var(--ua-yellow); }
.code-msg { min-height: 14px; font: 600 12px/1.15 var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--orange); }
.keys { display: grid; grid-template-columns: repeat(8, 32px); gap: 4px; }
.keys button { height: 30px; padding: 0; border-radius: 4px; background: rgba(239, 230, 210, .08); border: 1px solid var(--line); font: 700 16px/1 var(--font-display) !important; }
.keys button:active { background: var(--orange); color: #1a0f05 !important; }
.engine { font: 500 11px/1.3 var(--font-display); letter-spacing: .05em; color: var(--mute); text-align: center; }
.ghost.small { height: 24px; padding: 0 12px; font-size: 11px !important; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .start span { animation: none; } .hint { transition: none; } }

/* statistics page: a compact table that fits without scrolling */
.statp { width: min(97%, 780px); padding: 10px 12px 12px; gap: 6px; align-items: stretch; }
.statp h2 { font-size: 16px; text-align: center; }
.stat-dev, .stat-err { font: 500 10.5px/1.25 var(--font-body); color: var(--mute); text-align: center; min-height: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-table { width: 100%; border-collapse: collapse; table-layout: fixed; font: 500 11px/17px var(--font-body); }
.stat-table th, .stat-table td { padding: 0 3px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-table .c1 { width: 10.5%; } .stat-table .c2 { width: 6.5%; } .stat-table .c3 { width: 8.5%; } .stat-table .c4 { width: 5%; } .stat-table .c5 { width: 5%; } .stat-table .c6 { width: 6.5%; }
.stat-table .c7 { width: 21.5%; } .stat-table .c8 { width: 8%; } .stat-table .c9 { width: 10.5%; } .stat-table .c10 { width: 11%; } .stat-table .c11 { width: 7%; }
.stat-table th { font: 600 9.5px/16px var(--font-display); letter-spacing: .06em; text-transform: uppercase; color: var(--mute); border-bottom: 1px solid var(--line); }
.stat-table tr.dead td:nth-child(3), .stat-table tr.quit td:nth-child(3) { color: var(--orange); }
.stat-table .none { padding: 26px 0; text-align: center; color: var(--mute); }
.narrow .stat-table .x { display: none; }
.statp .row { gap: 6px; }
.statp button:disabled { opacity: .35; }
