/* Codename Red Star. The game picture is a 16:9 "stage"; everything on it is sized in em, and main.js sets the
   stage's font-size from its width, so the HUD and the menus scale with the picture on any screen. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #070b18; color: #e9f1ff; overflow: hidden; overscroll-behavior: none;
  font-family: Fredoka, "Segoe UI", system-ui, sans-serif; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; }
#app { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
body.portrait #app { justify-content: flex-start; padding-top: max(8px, env(safe-area-inset-top)); }
.stage { position: relative; flex: none; overflow: hidden; background: #2a60c8; }
canvas { display: block; width: 100%; height: 100%; }
[hidden] { display: none !important; }
kbd { display: inline-block; min-width: 1.7em; padding: .08em .42em; margin: 0 .12em; border-radius: .35em; background: #f2f5fb; color: #101a33; border-bottom: .16em solid #9aa6c2;
  font: 700 .9em/1.45 Fredoka, system-ui, sans-serif; text-align: center; }

/* ---- the top bar while you play ---- */
.hud { position: absolute; left: 0; right: 0; top: 0; padding: .5em .6em; display: flex; justify-content: space-between; align-items: flex-start; gap: .5em; pointer-events: none; }
.hud > div { display: flex; align-items: center; gap: .35em; }
.pill { display: inline-flex; align-items: center; gap: .3em; height: 1.9em; padding: 0 .7em; border-radius: 999px; background: rgba(8, 12, 24, .74); border: 1px solid rgba(160, 190, 255, .3);
  color: #fff; font: 700 1em/1 Fredoka, system-ui, sans-serif; }
button.pill { pointer-events: auto; cursor: pointer; }
.hp { display: inline-flex; gap: .16em; }
.hp i { width: .55em; height: 1em; border-radius: .14em; background: #3a2a36; }
.hp i.on { background: linear-gradient(#ff8a8f, #ff3b50); box-shadow: 0 0 .35em #ff3b50; }
.ic { width: 1.25em; height: 1.25em; background: center / contain no-repeat; }
.ic.life { background: none; width: auto; height: auto; }
.ic.life::before { content: "♥"; color: #ff5a6a; }
.ic.gren { background-image: var(--i-gren); } .ic.rocket { background-image: var(--i-rocket); }
.pill.none { opacity: .45; }
.hm { flex-direction: column; gap: .2em !important; }
.hm span { font: 700 .82em/1 "Russo One", sans-serif; letter-spacing: .06em; text-transform: uppercase; text-shadow: 0 .1em .2em #000; }
.prog { position: relative; width: 15em; height: .55em; border-radius: 999px; background: rgba(8, 12, 24, .74); border: 1px solid rgba(160, 190, 255, .35); }
.prog i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, #58b02a, #c7f04a); }
.prog em { position: absolute; right: -.2em; top: -1.15em; font: 700 .7em/1 "Russo One", sans-serif; color: #ffe45c; text-shadow: 0 .1em .2em #000; }
.hint { position: absolute; left: 50%; top: 3.5em; transform: translateX(-50%); max-width: 92%; padding: .4em 1em; border-radius: 999px; background: rgba(8, 12, 24, .82);
  border: 1px solid #ffe45c; color: #ffe45c; font-weight: 700; text-align: center; pointer-events: none; }
.prompt { position: absolute; left: 50%; bottom: 3.6em; transform: translateX(-50%); padding: .45em 1.1em; border-radius: .7em; background: #ffe45c; color: #201800; font-weight: 700; font-size: 1.15em;
  box-shadow: 0 0 1.2em rgba(255, 228, 92, .7); pointer-events: none; white-space: nowrap; animation: pulse .7s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: translateX(-50%) scale(1.06); } }
/* the controls, always on screen along the bottom (keyboard) */
.keys { position: absolute; left: 50%; bottom: .4em; transform: translateX(-50%); display: flex; gap: .3em; padding: .3em .5em; border-radius: .7em; background: rgba(8, 12, 24, .74);
  border: 1px solid rgba(160, 190, 255, .3); font-weight: 600; font-size: .86em; white-space: nowrap; pointer-events: none; }
.keys span { display: inline-flex; align-items: center; gap: .15em; padding: .1em .45em; border-radius: .5em; }
.keys span.lit { background: #ffe45c; color: #201800; box-shadow: 0 0 .9em rgba(255, 228, 92, .8); }
.keys span.dim { opacity: .4; }

/* ---- menus and cards ---- */
.ui { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: .6em; pointer-events: none; }
.ui.on { background: rgba(5, 8, 20, .58); pointer-events: auto; }
.ui.clear.on { background: linear-gradient(90deg, rgba(5, 8, 20, .82) 0%, rgba(5, 8, 20, .5) 55%, rgba(5, 8, 20, .12) 100%); }
.panel { max-width: 36em; max-height: 100%; overflow-y: auto; padding: 1.1em 1.5em; border-radius: 1em; background: rgba(12, 18, 40, .95); border: 2px solid rgba(120, 160, 255, .45);
  box-shadow: 0 1em 3em rgba(0, 0, 0, .55); text-align: center; touch-action: pan-y; }
.panel.wide { max-width: 44em; width: 100%; }
.panel.title { background: none; border: 0; box-shadow: none; text-align: left; max-width: 30em; margin-right: auto; margin-left: 3%; padding: .4em 1em; }
h1 { margin: 0 0 .1em; font: 400 3.3em/.95 "Russo One", sans-serif; letter-spacing: .02em; color: #ffe45c; text-shadow: 0 .06em 0 #7a4a00, 0 .14em .3em rgba(0, 0, 0, .7); }
h1 .red { color: #ff5340; text-shadow: 0 .06em 0 #5a0c0c, 0 .14em .3em rgba(0, 0, 0, .7); }
h1 small { display: block; font-size: .32em; letter-spacing: .3em; color: #9dff5a; text-shadow: 0 .1em .2em #000; margin-bottom: .4em; }
h2 { margin: 0 0 .4em; font: 400 1.6em/1.1 "Russo One", sans-serif; color: #ffe45c; }
h3 { margin: .2em 0 .5em; font: 400 1em/1.2 "Russo One", sans-serif; letter-spacing: .12em; color: #9dff5a; text-transform: uppercase; }
p { margin: .4em 0; line-height: 1.35; }
.tag { font-size: 1.15em; font-weight: 600; text-shadow: 0 .1em .3em #000; }
.note { font-size: .88em; color: #b9c6e6; }
.row { display: flex; flex-wrap: wrap; gap: .5em; justify-content: center; margin-top: .7em; }
.title .row { justify-content: flex-start; }
button, .btn { font: 700 1em/1 Fredoka, system-ui, sans-serif; color: #e9f1ff; background: #26345f; border: 0; border-bottom: .2em solid #131b38; border-radius: .7em; padding: .7em 1.1em; cursor: pointer;
  -webkit-tap-highlight-color: transparent; text-decoration: none; display: inline-block; }
button:hover, button:focus-visible { background: #34467e; outline: none; }
button:focus-visible { box-shadow: 0 0 0 .18em #9dff5a; }
button.primary { background: linear-gradient(#ffe45c, #ffb21e); color: #2a1800; border-bottom-color: #9a5a00; font-size: 1.25em; padding: .7em 1.5em; }
button.primary:hover, button.primary:focus-visible { background: linear-gradient(#fff08a, #ffc23e); }
button:disabled { opacity: .45; cursor: default; }
.steps { list-style: none; margin: .5em 0; padding: 0; text-align: left; display: grid; gap: .45em; }
.steps li { display: flex; gap: .7em; align-items: center; padding: .5em .7em; border-radius: .7em; background: rgba(255, 255, 255, .06); line-height: 1.5; }
.steps li > b:first-child { flex: none; width: 1.7em; height: 1.7em; border-radius: 50%; background: #ffe45c; color: #201800; display: grid; place-items: center; font-family: "Russo One", sans-serif; }
.tb { display: inline-block; padding: .05em .5em; border-radius: .5em; background: #ffe45c; color: #201800; font-weight: 700; font-size: .88em; }
label.tick { display: inline-flex; gap: .5em; align-items: center; margin-top: .6em; font-size: .9em; color: #b9c6e6; cursor: pointer; }
label.tick input { width: 1.2em; height: 1.2em; }
.grid { display: grid; grid-template-columns: repeat(10, 1fr); gap: .35em; margin: .6em 0; }
.grid button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.grid button { padding: .55em .3em; display: grid; gap: .25em; justify-items: center; }
.grid button b { font: 400 1.5em/1 "Russo One", sans-serif; color: #ffe45c; }
.grid button span { font-size: .72em; font-weight: 600; }
.grid button em { font-size: .7em; font-style: normal; color: #9dff5a; }
.tally { width: 100%; border-collapse: collapse; margin: .4em 0; }
.tally td { padding: .22em .4em; text-align: left; } .tally td:last-child { text-align: right; font-weight: 700; }
.tally tr.sum td { border-top: 2px solid rgba(160, 190, 255, .4); font-size: 1.3em; color: #ffe45c; padding-top: .35em; }
.tabs { display: flex; gap: .4em; justify-content: center; margin-bottom: .5em; }
.tabs button.on { background: #ffe45c; color: #201800; border-bottom-color: #9a5a00; }
.board { width: 100%; border-collapse: collapse; font-size: .95em; }
.board th { font-size: .78em; color: #9fb0d8; text-align: left; padding: .2em .4em; }
.board td { padding: .26em .4em; text-align: left; border-top: 1px solid rgba(160, 190, 255, .16); }
.board td:last-child, .board th:last-child { text-align: right; }
.board tr.me td { background: rgba(157, 255, 90, .16); font-weight: 700; }
.namebox { margin-top: .7em; padding: .6em; border-radius: .7em; background: rgba(255, 255, 255, .05); }
input[type=text], .namebox input { font: 600 1em Fredoka, system-ui, sans-serif; padding: .55em .7em; border-radius: .6em; border: 2px solid #4a5d99; background: #0b1126; color: #fff; min-width: 0; flex: 1 1 9em;
  -webkit-user-select: text; user-select: text; }
details { margin-top: .5em; font-size: .9em; } summary { cursor: pointer; color: #b9c6e6; }
.code { letter-spacing: .12em; color: #ffe45c; }
.hero { position: absolute; right: 6%; bottom: 9%; height: 46%; filter: drop-shadow(0 .5em 1em rgba(0, 0, 0, .6)); pointer-events: none; }
.wip { position: absolute; right: .6em; top: .6em; padding: .2em .7em; border-radius: 999px; background: #e8402e; color: #fff; font-weight: 700; font-size: .8em; }
.bar { height: .7em; width: 14em; max-width: 60vw; border-radius: 999px; background: rgba(255, 255, 255, .15); overflow: hidden; margin: .6em auto 0; }
.bar i { display: block; height: 100%; width: 0; background: #ffe45c; }

/* ---- touch controls ---- */
.pad { position: fixed; left: 0; right: 0; bottom: 0; height: 0; z-index: 20; --b: clamp(52px, 17vh, 86px); }
body[data-kind=keys] .pad, body[data-kind=touch] .keys { display: none; }
.dpad { position: absolute; left: max(12px, env(safe-area-inset-left)); bottom: max(12px, env(safe-area-inset-bottom)); width: calc(var(--b) * 2.25); height: calc(var(--b) * 2.25); border-radius: 50%;
  background: rgba(8, 12, 24, .32); border: 2px solid rgba(200, 220, 255, .35); touch-action: none; }
.pb { position: absolute; width: 34%; height: 34%; display: grid; place-items: center; color: rgba(255, 255, 255, .85); font-size: calc(var(--b) * .42); pointer-events: none; }
.pb.u { left: 33%; top: 1%; } .pb.d { left: 33%; bottom: 1%; } .pb.l { left: 1%; top: 33%; } .pb.r { right: 1%; top: 33%; }
.pb.on { color: #ffe45c; text-shadow: 0 0 .5em #ffe45c; }
.acts { position: absolute; right: max(12px, env(safe-area-inset-right)); bottom: max(12px, env(safe-area-inset-bottom)); width: calc(var(--b) * 3.4); height: calc(var(--b) * 2.4); }
.ab { position: absolute; width: var(--b); height: var(--b); padding: 0; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .55); background: rgba(8, 12, 24, .42); color: #fff;
  font: 700 calc(var(--b) * .17)/1 Fredoka, system-ui, sans-serif; touch-action: none; }
.ab.on { background: rgba(255, 228, 92, .85); color: #201800; }
.ab.lit { border-color: #ffe45c; box-shadow: 0 0 1em #ffe45c; }
.ab.fire { right: 0; bottom: 0; width: calc(var(--b) * 1.2); height: calc(var(--b) * 1.2); background: rgba(232, 64, 46, .5); font-size: calc(var(--b) * .24); }
.ab.jump { right: calc(var(--b) * 1.32); bottom: 0; background: rgba(60, 130, 255, .45); }
.ab.gren { right: calc(var(--b) * .1); bottom: calc(var(--b) * 1.32); background: rgba(88, 176, 42, .5); }
.ab.rocket { right: calc(var(--b) * 1.2); bottom: calc(var(--b) * 1.12); background: rgba(217, 162, 28, .55); }
.ab.use { right: calc(var(--b) * 2.36); bottom: calc(var(--b) * .5); background: rgba(255, 228, 92, .9); color: #201800; border-color: #fff; box-shadow: 0 0 1.2em #ffe45c; }
.turn { display: none; margin-top: 10px; padding: 6px 14px; border-radius: 999px; background: rgba(255, 255, 255, .1); font-size: 14px; color: #b9c6e6; }
body.portrait[data-kind=touch] .turn { display: block; }
@media (max-width: 560px) { .grid { grid-template-columns: repeat(4, 1fr); } }

/* ---- an upright phone: the picture sits at the top, the controls below it, and the menus use the whole screen ---- */
body.portrait .ui.on { position: fixed; inset: 0; z-index: 25; font-size: 15px; padding: 70px 12px 16px; align-items: flex-start; overflow-y: auto; background: rgba(5, 8, 20, .86); }
body.portrait .panel.title { margin: 0 auto; text-align: center; background: rgba(12, 18, 40, .95); border: 2px solid rgba(120, 160, 255, .45); padding: 1.1em 1.2em; border-radius: 1em; }
body.portrait .title .row { justify-content: center; }
body.portrait .hero, body.portrait .wip { display: none; }
body.portrait h1 { font-size: 2.5em; }
body.portrait .pad { --b: clamp(46px, 16.5vw, 72px); }

/* round 2 (2026-11-26): the code-chip counter, the guns he carries, the GUN button */
.ic.chip { width: 1em; height: .75em; border-radius: .15em; background: #20262f; box-shadow: 0 0 .5em #ff4a3a; position: relative; }
.ic.chip::after { content: "★"; position: absolute; inset: 0; color: #ff4a3a; font-size: .7em; line-height: 1.07em; text-align: center; }
.inv { position: absolute; left: .6em; top: 2.7em; display: flex; gap: .3em; pointer-events: none; }
.inv .gun { display: flex; align-items: center; gap: .15em; padding: .1em .4em .1em .2em; border-radius: .5em; background: rgba(8, 12, 24, .62); border: 1px solid rgba(160, 190, 255, .25); color: #fff; font-size: .78em; opacity: .7; }
.inv .gun img { width: 2.2em; height: 1.1em; }
.inv .gun.sel { opacity: 1; border-color: #8fe3ff; box-shadow: 0 0 .6em rgba(143, 227, 255, .6); }
.ab.swap { right: calc(var(--b) * 2.36); bottom: calc(var(--b) * 1.62); background: rgba(143, 227, 255, .45); font-size: calc(var(--b) * .22); }
