/* The game page (/play). Same colours and type as the site, its own layout:
   a full-screen canvas with the menus as cards on top of it. */
:root {
  --bg: #0b0b0a;
  --ink: #f4f1e8;
  --ink-2: #b3afa3;
  --ink-3: #86837a;
  --ink-4: #5b5952;
  --line: rgba(244, 241, 232, .16);
  --line-soft: rgba(244, 241, 232, .09);
  --card: rgba(17, 17, 16, .82);
  --acc: #ffc85c;
  --soul: #ff4b5c;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "Geist", -apple-system, "Helvetica Neue", sans-serif;
  --pixel: "VT323", "Geist Mono", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); color-scheme: dark; overflow: hidden; }
body { font-family: var(--sans); line-height: 1.5; -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-user-select: none; user-select: none; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
h1, h2, p, ol, dl, dd { margin: 0; padding: 0; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; image-rendering: pixelated; }
body.playing #game { cursor: none; }

.pl-back { position: fixed; top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); z-index: 5; font-family: var(--mono); font-size: .75rem; letter-spacing: .02em; color: var(--ink-3); text-decoration: none; padding: 6px 0; transition: color .15s; }
.pl-back:hover { color: var(--ink); }
body.playing .pl-back { opacity: .35; }

/* ── HUD ── */
.pl-hud { position: fixed; top: max(12px, env(safe-area-inset-top)); right: max(16px, env(safe-area-inset-right)); z-index: 4; display: flex; align-items: center; gap: 18px; font-family: var(--pixel); pointer-events: none; }
.pl-hud[hidden] { display: none; }
.pl-score { font-weight: 400; font-size: 2.4rem; line-height: 1; min-width: 4ch; text-align: right; font-variant-numeric: tabular-nums; }
.pl-stars { font-size: 1.5rem; color: var(--acc); }
.pl-lives { display: flex; gap: 5px; }
.pl-lives i { width: 18px; height: 16px; background: var(--soul); clip-path: polygon(0 25%, 12% 0, 38% 0, 50% 18%, 62% 0, 88% 0, 100% 25%, 100% 50%, 50% 100%, 0 50%); }
.pl-lives i.off { background: var(--ink-4); opacity: .5; }
.pl-combo { font-size: 1.5rem; color: #5ec8ff; min-width: 2.5ch; text-align: right; }
.pl-combo.hot { color: var(--acc); }
.pl-dash { width: 34px; height: 6px; background: var(--line); position: relative; overflow: hidden; }
.pl-dash i { position: absolute; inset: 0; background: #5ec8ff; transform-origin: left; transform: scaleX(var(--k, 1)); }
.pl-dash.ready i { background: var(--ink); }
.pl-bars { display: grid; gap: 4px; }
.pl-super { width: 34px; height: 6px; background: var(--line); position: relative; overflow: hidden; }
.pl-super i { position: absolute; inset: 0; background: #ff9a3c; transform-origin: left; transform: scaleX(var(--k, 0)); }
.pl-super.full i { background: var(--acc); animation: glow .5s steps(2) infinite; }
@keyframes glow { 50% { opacity: .45; } }
.pl-boss { position: fixed; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 4; display: grid; gap: 4px; justify-items: center; font-family: var(--pixel); font-size: 1.25rem; letter-spacing: .06em; color: var(--soul); pointer-events: none; width: min(420px, 50vw); }
.pl-boss[hidden] { display: none; }
.pl-bossbar { width: 100%; height: 8px; background: rgba(255, 75, 92, .18); border: 1px solid rgba(255, 75, 92, .5); }
.pl-bossbar i { display: block; height: 100%; background: var(--soul); transform-origin: left; transform: scaleX(var(--k, 1)); transition: transform .12s; }
.pl-ammo { font-size: 1.4rem; font-variant-numeric: tabular-nums; color: var(--ink-2); min-width: 5ch; text-align: right; }
.pl-ammo.low { color: var(--soul); }
.pl-ammo.reload { color: var(--ink-4); }
/* touch controls: fire (held), dash and super, under the right thumb */
.pl-pad-btns { position: fixed; z-index: 6; right: max(14px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: auto auto; gap: 10px; align-items: end; touch-action: none; -webkit-user-select: none; user-select: none; }
.pl-pad-btns[hidden] { display: none; }
.pl-tbtn { width: 68px; height: 68px; border-radius: 50%; border: 2px solid var(--line); background: rgba(17, 17, 16, .55); font-family: var(--pixel); font-size: 1.15rem; letter-spacing: .04em; color: var(--ink-2); touch-action: none; }
.pl-tbtn.fire { width: 84px; height: 84px; border-color: var(--acc); color: var(--acc); }
.pl-tbtn.on { background: rgba(255, 200, 92, .25); }
.pl-tbtn.super { grid-column: 1 / -1; justify-self: end; width: auto; height: auto; border-radius: 0; padding: 10px 16px; background: var(--acc); border-color: var(--acc); color: var(--bg); animation: glow .6s steps(2) infinite; }
.pl-tbtn[hidden] { display: none; }
.pl-sound { position: fixed; bottom: max(12px, env(safe-area-inset-bottom)); left: max(16px, env(safe-area-inset-left)); z-index: 5; font-family: var(--mono); font-size: .7rem; color: var(--ink-3); padding: 6px 0; }
.pl-sound[aria-pressed="false"] { text-decoration: line-through; color: var(--ink-4); }
.pl-sound:hover { color: var(--ink); }
.pl-pausebtn { pointer-events: auto; display: flex; gap: 4px; align-items: center; justify-content: center; width: 34px; height: 34px; border: 1px solid var(--line); opacity: .6; transition: opacity .15s; }
.pl-pausebtn:hover { opacity: 1; }
.pl-pausebtn i { width: 4px; height: 12px; background: var(--ink); }
.pl-banner { position: fixed; left: 50%; top: 18%; transform: translateX(-50%); z-index: 4; font-family: var(--pixel); font-size: clamp(1.6rem, 5vw, 2.6rem); color: var(--acc); letter-spacing: .04em; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity .3s; text-shadow: 0 0 18px rgba(255, 200, 92, .35); }
.pl-banner.on { opacity: 1; }

/* ── screens: title, pause, game over ── */
.pl-screen { position: fixed; inset: 0; z-index: 6; display: flex; align-items: center; justify-content: center; gap: 20px; padding: 64px 24px 32px; overflow-y: auto; }
.pl-screen[hidden] { display: none; }
#title { justify-content: flex-start; padding-left: max(6vw, 24px); }
.pl-card { background: var(--card); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); border: 1px solid var(--line); padding: 28px 30px; width: min(440px, 100%); animation: rise .45s cubic-bezier(.19, 1, .22, 1) both; }
.pl-rank { width: min(300px, 100%); animation-delay: .06s; align-self: center; }
.pl-mini { text-align: center; width: auto; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
/* the loading screen: the card sits low, lipp waits on his moon above it (drawn on the canvas) */
#loading { align-items: flex-end; padding-bottom: max(14vh, 48px); }
.pl-loading .pl-card { width: min(380px, 100%); text-align: left; }
.pl-load-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--pixel); font-size: 1.6rem; letter-spacing: .06em; color: var(--acc); }
.pl-load-head b { font-weight: 400; color: var(--ink); font-variant-numeric: tabular-nums; }
.pl-loadbar { display: block; margin-top: 10px; height: 10px; border: 1px solid var(--line); background: rgba(244, 241, 232, .04); }
.pl-loadbar i { display: block; height: 100%; background: var(--acc); transform-origin: left; transform: scaleX(var(--k, 0)); transition: transform .2s; }
.pl-load-mb { margin-top: 8px; min-height: 1.2em; font-family: var(--mono); font-size: .72rem; color: var(--ink-3); }
.pl-load-tip { margin-top: 10px; font-size: .8rem; color: var(--ink-4); }
.pl-name { font-family: var(--pixel); font-weight: 400; font-size: clamp(2.6rem, 7vw, 3.6rem); line-height: .95; letter-spacing: .02em; color: var(--acc); }
.pl-lead { margin-top: 12px; color: var(--ink-2); font-size: .95rem; }
.pl-btn { margin-top: 22px; display: inline-flex; align-items: baseline; gap: 12px; padding: 12px 18px; background: var(--ink); color: var(--bg); font-family: var(--pixel); font-size: 1.6rem; line-height: 1; letter-spacing: .04em; box-shadow: 0 0 0 0 var(--ink); transition: box-shadow .2s cubic-bezier(.19, 1, .22, 1); }
.pl-btn small { font-family: var(--mono); font-size: .65rem; letter-spacing: .02em; color: var(--ink-4); }
.pl-btn:hover, .pl-btn:focus-visible { box-shadow: 0 0 0 3px var(--ink); outline: none; }
.pl-btn.small { margin: 0; font-size: 1.3rem; padding: 10px 14px; }
.pl-btn:disabled { opacity: .5; cursor: default; }
.pl-controls { margin-top: 24px; display: grid; gap: 4px; font-family: var(--mono); font-size: .72rem; }
.pl-controls div { display: grid; grid-template-columns: 9ch 1fr; gap: 12px; }
.pl-tips { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 6px 14px; font-family: var(--mono); font-size: .68rem; color: var(--ink-3); }
.pl-tips span::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 6px; background: var(--c); }
.pl-controls dt { color: var(--ink-4); text-transform: uppercase; letter-spacing: .04em; }
.pl-controls dd { color: var(--ink-2); }
.pl-practice { margin-top: 16px; font-family: var(--mono); font-size: .7rem; color: var(--ink-4); }
.pl-practice a { color: var(--ink-2); padding: 2px 4px; }
.pl-practice a:hover { color: var(--acc); }
.pl-tag { font-size: 1.2rem; color: var(--acc); letter-spacing: .06em; }
.pl-pad { margin-top: 16px; font-size: .8rem; color: var(--ink-3); }
.pl-pad a { color: #36ca90; text-decoration: none; }
.pl-pad a:hover { text-decoration: underline; }

.pl-rank h2, .pl-enter label { font-family: var(--mono); font-weight: 400; font-size: .72rem; letter-spacing: .06em; color: var(--ink-3); }
.pl-list { list-style: none; margin-top: 12px; font-family: var(--pixel); font-size: 1.45rem; line-height: 1.25; }
.pl-list li { display: grid; grid-template-columns: 2.2ch 4ch 1fr; gap: 10px; padding: 1px 0; }
.pl-list .pos { color: var(--ink-4); text-align: right; }
.pl-list .pts { text-align: right; font-variant-numeric: tabular-nums; }
.pl-list li:first-child .who, .pl-list li:first-child .pts { color: var(--acc); }
.pl-list li.me { background: rgba(255, 200, 92, .14); box-shadow: -6px 0 0 rgba(255, 200, 92, .14), 6px 0 0 rgba(255, 200, 92, .14); }
.pl-list .pl-none { display: block; font-family: var(--sans); font-size: .9rem; color: var(--ink-3); }

.pl-final { margin-top: 14px; font-family: var(--pixel); font-size: 1.6rem; color: var(--ink-3); }
.pl-final b { font-weight: 400; font-size: 3.4rem; color: var(--ink); line-height: 1; }
.pl-best { margin-top: 4px; font-family: var(--mono); font-size: .75rem; color: var(--ink-3); }
.pl-best.new { color: var(--acc); }
.pl-enter { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line-soft); }
.pl-enter[hidden] { display: none; }
.pl-enter > div { margin-top: 10px; display: flex; gap: 12px; align-items: center; }
.pl-enter input { width: 5.2ch; padding: 4px 0 4px .5ch; background: transparent; border: 0; border-bottom: 2px solid var(--acc); color: var(--ink); font-family: var(--pixel); font-size: 2.6rem; line-height: 1; letter-spacing: .5ch; text-transform: uppercase; caret-color: var(--acc); -webkit-user-select: text; user-select: text; }
.pl-enter input:focus { outline: none; }
.pl-msg { margin-top: 8px; min-height: 1.2em; font-size: .8rem; color: var(--ink-3); }
.pl-msg.bad { color: var(--soul); }
.pl-secret { margin-top: 14px; font-family: var(--mono); font-size: .72rem; color: var(--acc); }
.pl-secret[hidden] { display: none; }
.pl-acts { display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap; }
.pl-exit { font-family: var(--mono); font-size: .75rem; color: var(--ink-3); }
.pl-exit:hover { color: var(--ink); }

@media (max-width: 760px) {
  .pl-screen, #title { flex-direction: column; justify-content: flex-start; padding: 56px 16px 24px; gap: 12px; }
  .pl-card { padding: 22px 20px; }
  .pl-rank { width: min(440px, 100%); }
  .pl-controls div:first-child, .pl-controls div:nth-child(2) { display: none; }   /* keyboard and mouse, on a phone */
  body.playing .pl-back, body.playing .pl-sound { display: none; }               /* the HUD needs the top row */
  .pl-hud { left: 16px; right: 16px; justify-content: space-between; gap: 10px; }
  .pl-score { font-size: 1.9rem; min-width: 0; }
  .pl-ammo { font-size: 1.2rem; min-width: 0; }
  .pl-ammo .lbl { display: none; }
  .pl-lives i { width: 15px; height: 13px; }
  .pl-boss { top: 62px; width: calc(100vw - 32px); font-size: 1.05rem; }
}
@media (hover: hover) and (pointer: fine) {
  .pl-controls div:nth-child(4) { display: none; }      /* the phone line, with a mouse */
}
@media (prefers-reduced-motion: reduce) { .pl-card { animation: none; } }
