@font-face { font-family: 'Silkscreen'; src: url('fonts/Silkscreen-Regular.woff') format('woff'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Pixelify Sans'; src: url('fonts/PixelifySans-Medium.woff') format('woff'); font-weight: 100 900; font-style: normal; font-display: swap; }
:root {
  --bg: #0f1420;
  --panel: #182033;
  --text: #f2f4f8;
  --muted: #9aa5b8;
  --accent: #ffd23f;
  --accent-2: #00a3e0;
  --ink: #12071f; --pink: #ff4fa3; --blue: #2b57d6; --ok: #3ddc84; --bad: #ff3355; --cyan: #00e5ff; --cyan-2: #bff3ff; --line: rgba(255,255,255,.14);
  --f-disp: 'Silkscreen', 'Pixelify Sans', ui-monospace, monospace;
  --f-text: 'Pixelify Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden; overscroll-behavior: none;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
body.popup, body.popup #stage { width: 640px; height: 400px; }

#stage { position: relative; width: 100vw; height: 100vh; height: 100dvh; display: flex; align-items: center; justify-content: center; background: var(--bg); touch-action: manipulation; -webkit-touch-callout: none; }
#stage.playing { touch-action: none; } /* the whole screen is the controller while a run is on; menus keep their scrolling */
canvas#game { display: block; touch-action: none; image-rendering: pixelated; image-rendering: crisp-edges; }
#scan { position: absolute; pointer-events: none; image-rendering: pixelated; image-rendering: crisp-edges; } /* the scanlines layer, painted by resize() over the picture */

/* Thumb zones on touch screens: the whole screen jumps, the bottom-left box ducks. Hidden on mouse devices and in the popup. */
.tz { position: absolute; display: none; align-items: center; justify-content: center; gap: 8px; pointer-events: none; z-index: 4; width: 42%; height: 22%; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); padding: 0 10px; border-radius: 18px; border: 2px dashed rgba(255,255,255,.3); background: rgba(8,11,18,.28); color: rgba(242,244,248,.9); font-weight: 800; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; }
.tz b { font-size: 30px; line-height: 1; }
#tz-duck { left: calc(12px + env(safe-area-inset-left, 0px)); border-color: rgba(0,229,255,.6); color: #bff3ff; }
#tz-jump { right: calc(12px + env(safe-area-inset-right, 0px)); border-color: rgba(255,210,63,.6); color: var(--accent); }
@media (pointer: coarse) { #stage.playing .tz { display: flex; } }
#stage.touch.playing .tz { display: flex; } /* a touch on a mouse-first device (touch laptop, iPad with a trackpad) shows the zones too */
/* When the picture fills the screen (landscape phone, squarish screen), the zones become low bars inside the road strip and never cover the runner. */
#stage.tz-bars .tz { width: 30%; height: 11%; min-height: 36px; bottom: 0; gap: 6px; border-radius: 10px 10px 0 0; border-bottom: 0; background: none; border-color: rgba(255,255,255,.22); font-size: 12px; }
#stage.tz-bars .tz b { font-size: 18px; }
body.popup .tz { display: none !important; }
.overlay, button { touch-action: manipulation; }

.hidden { display: none !important; }

.overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(8, 11, 18, .78); padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 10;
}
.panel {
  background: var(--panel); border-radius: 16px; padding: 22px 20px;
  width: min(400px, 100%); text-align: center;
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  max-height: 100%; overflow: auto;
}
.panel:focus { outline: none; }
.daily-week { letter-spacing: 2px; margin: 0 0 2px; }
#go-extra { font-size: 12px; }
details.about h2 { font-size: 14px; margin: 10px 0 2px; color: var(--text); }
h1 { margin: 0 0 6px; font-size: 36px; letter-spacing: 2px; color: #ff4fa3; text-shadow: 3px 3px 0 #2b57d6, 0 0 18px rgba(255,79,163,.6); font-family: 'Courier New', ui-monospace, monospace; text-transform: uppercase; }
h2 { margin: 0 0 10px; font-size: 22px; }
p { margin: 6px 0; color: var(--muted); font-size: 15px; line-height: 1.4; }
p.big { font-size: 40px; font-weight: 700; color: var(--text); margin: 2px 0; font-variant-numeric: tabular-nums; }
.day-line { color: var(--text); font-weight: 600; }
.record { color: var(--accent); font-weight: 700; }
.hint { font-size: 13px; }
.footer { font-size: 12px; margin-top: 12px; }
details.about { margin-top: 12px; text-align: left; font-size: 12px; color: var(--muted); }
details.about summary { cursor: pointer; text-align: center; color: var(--muted); font-size: 12px; }
details.about p { font-size: 12px; margin: 6px 0 0; }
details.about a { color: var(--muted); }
body.popup details.about { display: none; }
.footer a { color: var(--muted); }

button {
  display: block; width: 100%; margin: 10px auto 0; padding: 13px 18px;
  border: 0; border-radius: 12px; font-size: 17px; font-weight: 700;
  background: rgba(255,255,255,.08); color: var(--text); cursor: pointer;
  font-family: inherit;
}
button:active { transform: scale(.98); }
button.primary { background: var(--accent); color: #1a1a1a; }
button:disabled { opacity: .55; cursor: default; transform: none; }
.daily-sub { margin: 4px 0 2px; font-variant-numeric: tabular-nums; }

.choose-label { color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 12px; margin: 12px 0 4px; }
.chars { display: flex; gap: 10px; justify-content: center; margin-top: 4px; }
.chars button { width: 108px; margin: 0; padding: 6px 4px 8px; font-size: 13px; display: flex; flex-direction: column; align-items: center; gap: 4px; border: 3px solid rgba(255,255,255,.12); background: rgba(0,0,0,.25); }
.chars button canvas { width: 84px; height: 84px; image-rendering: pixelated; }
.chars button.active { border-color: var(--accent); background: rgba(255,210,63,.14); box-shadow: 0 0 0 2px rgba(255,210,63,.25), 0 0 18px rgba(255,210,63,.35); }
body.popup .chars button { width: 92px; } body.popup .chars button canvas { width: 64px; height: 64px; }

.diffs { display: flex; gap: 6px; justify-content: center; margin: 4px 0 8px; flex-wrap: wrap; }
.diffs button { width: auto; margin: 0; padding: 7px 10px; font-size: 12px; border: 2px solid rgba(255,255,255,.12); }
.diffs button.active { border-color: var(--accent); background: rgba(255,210,63,.14); }

.langs { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.langs button { width: auto; margin: 0; padding: 7px 12px; font-size: 13px; }
.langs button.active { background: var(--accent-2); color: #fff; }

#btn-mute {
  z-index: 11; /* above the overlays: always reachable */
  position: absolute; top: calc(8px + env(safe-area-inset-top, 0px)); right: calc(8px + env(safe-area-inset-right, 0px)); width: 36px; height: 36px; margin: 0; padding: 0;
  border-radius: 50%; font-size: 16px; background: rgba(0,0,0,.35);
}

button.secondary { background: rgba(0,229,255,.16); color: #bff3ff; border: 2px solid rgba(0,229,255,.35); }
.fro-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin: 10px 0 4px; }
.lvl.fro { border-color: rgba(0,229,255,.35); }
.lvl.fro .lvl-flag { font-size: 26px; }
p.how { text-align: left; color: var(--text); font-size: 15px; margin: 10px 0; }
.panel.wide { width: min(600px, 100%); }
#levels-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; margin-top: 8px; max-height: 52vh; overflow: auto; padding: 2px; }
.lvl-section { grid-column: 1 / -1; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; font-size: 11px; margin: 6px 0 0; text-align: left; }
.lvl { margin: 0; padding: 6px 4px; font-size: 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 2px solid rgba(255,255,255,.12); background: rgba(0,0,0,.25); }
.lvl .lvl-flag { font-size: 20px; }
.lvl .lvl-name { font-weight: 700; }
.lvl small { font-weight: 400; color: var(--muted); font-size: 11px; }
.lvl.locked { opacity: .75; }
.lvl.locked:not(.poor) small { color: var(--accent); }
.lvl.poor { opacity: .45; }
.lvl.sel { border-color: var(--accent); background: rgba(255,210,63,.14); }
body.popup #levels-grid { max-height: 46vh; }

.share-preview {
  margin-top: 12px; white-space: pre-line; text-align: left;
  background: rgba(0,0,0,.3); padding: 10px 12px; border-radius: 8px;
  font-size: 13px; color: var(--text); font-family: ui-monospace, Menlo, monospace;
}

/* Boss key: a fake spreadsheet */
#boss {
  position: fixed; inset: 0; z-index: 50; background: #fff; color: #222;
  font-family: Calibri, "Segoe UI", Arial, sans-serif; font-size: 13px;
}
.sheet-top { display: flex; justify-content: space-between; padding: 8px 12px; background: #217346; color: #fff; font-weight: 600; }
#sheet { border-collapse: collapse; width: 100%; }
#sheet td, #sheet th { border: 1px solid #d4d4d4; padding: 4px 8px; white-space: nowrap; }
#sheet th { background: #f3f3f3; font-weight: 600; text-align: center; color: #555; }
#sheet td.num { text-align: right; font-variant-numeric: tabular-nums; }
.sheet-hint { position: fixed; bottom: 10px; right: 12px; color: #767676; font-size: 11px; }

/* Privacy page */
body.privacy { overflow: auto; -webkit-user-select: text; user-select: text; }
body.privacy main { max-width: 640px; margin: 0 auto; padding: 32px 16px; }
body.privacy h1, body.privacy h2 { color: var(--text); }
body.privacy p { color: var(--muted); }
body.privacy a { color: var(--accent); }

/* Optional account (account.js, website only) */
button.account-btn { display: inline-block; width: auto; margin: 12px auto 0; padding: 7px 14px; font-size: 13px; font-weight: 600; }
.acct-card { margin-top: 12px; padding: 12px; border-radius: 12px; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.12); }
.acct-card p { margin: 0 0 4px; color: var(--text); font-size: 14px; }
button.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: #fff; color: #1f1f1f; font-size: 15px; font-weight: 600; }
button.google-btn img { width: 18px; height: 18px; flex: none; }
button.link-btn { background: none; color: var(--muted); font-size: 13px; font-weight: 400; padding: 8px; margin-top: 2px; text-decoration: underline; }
button.danger { background: rgba(255,51,85,.12); color: #ffc2cc; border: 2px solid rgba(255,51,85,.35); font-size: 14px; }
#account h3 { color: var(--accent); text-transform: uppercase; letter-spacing: 1px; font-size: 12px; margin: 18px 0 4px; }
#account .hint a { color: var(--muted); }
.acct-qr { display: block; width: 180px; height: 180px; margin: 10px auto; padding: 8px; background: #fff; border-radius: 8px; }
.acct-secret { font-family: ui-monospace, Menlo, monospace; word-break: break-all; color: var(--text); user-select: all; -webkit-user-select: all; }
.acct-code { display: block; width: 100%; box-sizing: border-box; margin-top: 10px; padding: 12px; border-radius: 12px; border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); color: var(--text); font: 700 22px ui-monospace, Menlo, monospace; letter-spacing: 6px; text-align: center; }
.acct-code:focus { outline: none; border-color: var(--accent); }
.acct-msg { color: var(--accent); }
.acct-sep { height: 1px; background: rgba(255,255,255,.1); margin: 18px 0 6px; }

/* ---------- Pixel UI (Silkscreen + Pixelify Sans). Everything below is scoped to #stage: city pages and privacy.html load this file too. ---------- */
#stage { font-family: var(--f-text); font-synthesis: none; font-variant-ligatures: none; font-feature-settings: "liga" 0, "dlig" 0; letter-spacing: 0; }
#stage, #stage * { font-weight: 400; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
#stage .panel { border-radius: 0; border: 4px solid #0a0e17; box-shadow: 0 0 0 4px #2a3450, 0 12px 40px rgba(0,0,0,.5); padding: 20px 18px; }
#stage h1 { font-family: var(--f-disp); font-size: 40px; line-height: 1; letter-spacing: 0; text-shadow: 5px 5px 0 #1b2e7a; margin: 0 0 8px; } /* a dark navy shadow: the lighter blue made the C of RACE read as a G */
#stage h2 { font-family: var(--f-disp); font-size: 24px; line-height: 1.1; text-transform: uppercase; margin: 0 0 12px; }
#stage details.about h2 { font-family: var(--f-text); font-size: 16px; text-transform: none; color: var(--text); margin: 10px 0 2px; }
#stage #account h3 { font-family: var(--f-disp); font-size: 16px; letter-spacing: 0; }
#stage p { font-size: 16px; line-height: 1.35; margin: 6px 0; }
#stage .lead { color: var(--muted); margin: 0 0 12px; }
#stage .note { font-size: 16px; color: var(--muted); }
#stage .hint, #stage .fine, #stage .footer, #stage details.about, #stage details.about p, #stage details.about summary { font-size: 14px; }
#stage .num { font-family: var(--f-disp); font-size: 16px; text-transform: uppercase; }
#stage .num.sp { padding-left: .125em; }
#stage .num, #stage p.big, #stage .tile, #stage .stats, #stage .lvl small { word-spacing: -.25em; } /* Silkscreen's space is half an em: thousands read as two numbers */
#stage .money { color: var(--accent); } #stage .rec { color: var(--pink); } #stage .ok { color: var(--ok); } #stage .bad { color: var(--bad); } #stage .warn { color: var(--accent); }
#stage button .money { color: inherit; }
#stage .label { font-family: var(--f-disp); font-size: 16px; color: var(--accent); text-transform: uppercase; margin: 16px 0 8px; }
#stage button { font-family: var(--f-disp); font-size: 16px; line-height: 1.25; text-transform: uppercase; border-radius: 0; padding: 12px; box-shadow: inset 0 -4px 0 rgba(0,0,0,.28); }
#stage button.primary { box-shadow: inset 0 -4px 0 #c79a00; }
#stage button:active { transform: translateY(2px); box-shadow: none; }
#stage button.mode { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
#stage .b-main { display: block; text-wrap: balance; } /* DE and LB wrap as two even lines, never '#7' alone */
#stage .b-sub { display: block; font-family: var(--f-text); font-size: 16px; text-transform: none; white-space: pre-line; opacity: .9; }
#stage button.link-btn { width: auto; margin: 0; padding: 8px 4px; background: none; box-shadow: none; color: var(--muted); text-decoration: none; }
#stage button.google-btn { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; font-size: 15px; font-weight: 600; text-transform: none; box-shadow: none; }
#stage button.google-btn span { font-weight: inherit; }
#stage details summary { cursor: pointer; list-style: none; }
#stage details summary::-webkit-details-marker { display: none; }
#stage details summary::before { content: ''; display: inline-block; border: 5px solid transparent; border-left-color: currentColor; margin-right: 6px; vertical-align: 1px; }
#stage details[open] > summary::before { transform: rotate(90deg); transform-origin: 25% 50%; }
#stage #btn-mute { padding: 0; border-radius: 0; font-size: 16px; text-transform: none; box-shadow: none; border: 2px solid rgba(255,255,255,.15); }
/* Run controls under the sound button (same column, so the HUD margin kept for it covers them too): pause while running,
   back to the menu on the ready screen and in the pause. Pixel icons, 7x7 art pixels at 2x. */
#stage #btn-pause, #stage #btn-quit { display: none; z-index: 11; position: absolute; top: calc(52px + env(safe-area-inset-top, 0px)); right: calc(8px + env(safe-area-inset-right, 0px)); width: 36px; height: 36px; margin: 0; padding: 0; border-radius: 0; box-shadow: none; border: 2px solid rgba(255,255,255,.15); background: rgba(0,0,0,.35) no-repeat center / 14px 14px; }
#stage #btn-pause { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23f2f4f8' d='M1 0h2v7H1zM4 0h2v7H4z'/%3E%3C/svg%3E"); }
#stage #btn-quit { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 7' shape-rendering='crispEdges'%3E%3Cpath fill='%23f2f4f8' d='M3 0h1v1H3zM2 1h3v1H2zM1 2h5v1H1zM0 3h7v1H0zM1 4h5v1H1zM1 5h2v2H1zM4 5h2v2H4z'/%3E%3C/svg%3E"); }
#stage.run-live #btn-pause, #stage.run-held #btn-quit { display: block; }
body.popup #btn-pause, body.popup #btn-quit { display: none !important; } /* the popup keeps P and Esc */
#stage .tz { font-family: var(--f-disp); font-size: 16px; letter-spacing: 0; flex-direction: column; gap: 6px; }
#stage.tz-bars .tz { flex-direction: row; font-size: 16px; }
#stage .share-preview { font-family: var(--f-text); font-size: 14px; border-radius: 0; -webkit-user-select: text; user-select: text; }
#stage .copy-by-hand { -webkit-user-select: text; user-select: text; white-space: pre-line; color: var(--text); } /* share text shown for a manual copy when the clipboard is blocked */
#stage .acct-card, #stage .acct-code, #stage .acct-qr { border-radius: 0; }
#stage .acct-card button.link-btn { margin: 4px auto 0; }
#stage .acct-card { margin-top: 12px; padding: 12px 10px 2px; border: 2px solid var(--line); background: rgba(0,0,0,.18); }
#stage .acct-card button.google-btn { min-height: 48px; margin-top: 0; }
#stage .acct-card p { font-family: var(--f-text); font-size: 16px; line-height: 1.35; margin: 0 0 8px; }
#stage .acct-card p.acct-later { display: flex; justify-content: center; gap: 0 20px; flex-wrap: wrap; margin: 6px 0 0; }
#stage .acct-card p.acct-later button.link-btn { margin: 0; min-height: 44px; padding: 8px 4px; font-size: 14px; } /* Later, Never: two quiet answers side by side */

/* Start screen: one daily card, one mode row, the start city, the runners, a quiet foot */
#stage .card { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px; margin: 0 0 8px; border: 2px solid var(--line); background: rgba(0,0,0,.18); }
#stage .card > * { grid-column: 1 / -1; margin: 0; }
#stage #btn-daily { min-height: 64px; }
#stage .card.done > button { grid-column: auto; order: 3; min-height: 48px; }
#stage .card.done > #btn-install { grid-column: 1 / -1; order: 4; min-height: 0; margin: 0 auto; }
#stage .card.done > #install-ios { order: 4; font-size: 14px; }
#stage .daily-row { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px 12px; } /* the week strip and the calendar reminder share one row */
#stage .daily-row > p { margin: 0; }
#stage #daily-remind { font-size: 14px; line-height: 12px; white-space: nowrap; } /* as tall as the week squares: the row never grows */
#stage #daily-ics { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
#stage #daily-ics:hover, #stage #daily-ics:focus-visible { color: var(--text); }
#stage .daily-sub { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 8px; }
#stage .tiles { display: inline-flex; gap: 6px; }
#stage .tile { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 24px; padding: 0 6px; font-family: var(--f-disp); font-size: 16px; line-height: 1; color: var(--text); border: 2px dashed rgba(255,255,255,.25); }
#stage .tile.bad { background: var(--bad); border: 2px solid var(--bad); color: var(--ink); } /* ink on red: 5.4:1 */
#stage .tile.ok { background: var(--ok); border: 2px solid var(--ok); color: var(--ink); }
#stage .tile.zero { background: #2a3450; border: 2px solid #2a3450; color: var(--muted); }
#stage .tile.cur { outline: 2px solid #fff; outline-offset: 1px; }
#stage .streak { font-family: var(--f-disp); font-size: 16px; color: var(--accent); }
#stage .streak:empty { display: none; }
#stage .week { display: flex; justify-content: center; gap: 4px; }
#stage .wk { width: 12px; height: 12px; border: 2px solid rgba(255,255,255,.25); }
#stage .wk.ok { background: var(--ok); border-color: var(--ok); } #stage .wk.bad { background: linear-gradient(var(--ink), var(--ink)) center / 4px 4px no-repeat, var(--bad); border-color: var(--bad); } /* a dark centre: late days differ by shape, not only by colour */
#stage .wk.today { outline: 2px solid #fff; outline-offset: 1px; }
#stage .modes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
#stage .modes button { margin: 0; min-height: 64px; padding: 12px 6px; }
#stage button.chip { display: inline-flex; align-items: center; gap: 8px; width: auto; max-width: 100%; margin: 10px auto 0; padding: 8px 12px; background: transparent; border: 2px solid var(--line); box-shadow: none; color: var(--text); }
#stage button.chip::after { content: ''; border: 5px solid transparent; border-top-color: var(--muted); margin-top: 5px; }
#stage .chars { gap: 6px 8px; margin-top: 10px; }
#stage .chars button { width: 84px; padding: 4px 2px 4px; border-width: 2px; box-shadow: none; }
#stage .chars button canvas { width: 56px; height: 56px; }
#stage .chars button.active { box-shadow: none; }
#stage .chars { flex-wrap: wrap; max-width: 268px; margin-left: auto; margin-right: auto; position: relative; } /* three per row (3 + 2): every runner keeps its name under it */
#stage .chars button { position: relative; }
#stage .chars button.locked canvas { filter: grayscale(1) brightness(1.7); opacity: .6; } /* lifted grey: a locked runner reads as a light silhouette on the dark card */
#stage .chars button.locked[data-char="lion"] canvas, #stage .chars button.locked[data-char="bike"] canvas { filter: grayscale(1) brightness(2.6); } /* red is darker than orange once grey: the same light grey as the fox */
#stage .chars button.locked span { color: var(--muted); word-spacing: -.25em; }
#stage .chars button.locked::after { content: ''; position: absolute; top: 4px; right: 4px; width: 14px; height: 16px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 7 8' shape-rendering='crispEdges'%3E%3Cpath fill='%23c9d1de' d='M2 0h3v1H2zM1 1h1v2H1zM5 1h1v2H5zM0 3h7v5H0z'/%3E%3Cpath fill='%23182033' d='M3 5h1v2H3z'/%3E%3C/svg%3E") no-repeat center / 14px 16px; }
#stage .chars button.nope { animation: nope .32s steps(1, end) 1; }
#stage .chars button.nope span { color: var(--accent); }
@keyframes nope { 0% { transform: translateX(-4px); } 25% { transform: translateX(4px); } 50% { transform: translateX(-2px); } 75% { transform: translateX(2px); } 100% { transform: none; } }
@media (prefers-reduced-motion: reduce) { #stage .chars button.nope { animation: none; } }
@media (max-width: 440px) and (max-height: 900px) { #stage .chars { row-gap: 4px; } #stage .chars button canvas { width: 48px; height: 48px; } } /* phones: two rows of runners still leave the top corner to the sound button; 48 px = 2 px per sprite pixel, crisp */
@media (max-width: 440px) and (max-height: 900px) { #stage #start .panel { padding-top: 12px; padding-bottom: 12px; } #stage #start h1 { margin-bottom: 4px; } #stage #start .lead { margin-bottom: 6px; } #stage #start .card { gap: 6px; padding: 6px 8px; margin-bottom: 6px; } #stage #start button.chip { margin-top: 6px; } #stage #start .chars { margin-top: 6px; row-gap: 2px; } #stage #start .chars button { padding: 2px 2px 1px; } #stage #start .start-foot { margin-top: 4px; } #stage #start details.about { margin-top: 4px; } #stage #start .footer { margin: 4px 0 0; } } /* short phones (360x800, 360x740): the second row of runners is paid for with tighter margins, the runners keep their crisp 48 px */
/* Landscape phones, the 640x400 popup and laptops (up to 870 px high: the single column needs about 868 px once the Daily is done): the start screen in two columns (daily and modes left, runners right), so it fits without scrolling. */
@media (orientation: landscape) and (max-height: 500px), (orientation: landscape) and (min-width: 800px) and (max-height: 870px) {
  #stage #start .panel { width: min(760px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "h1 h1" "card chars" "modes foot" "chip about" "chip footer"; column-gap: 16px; row-gap: 6px; align-content: start; align-items: start; padding-top: 12px; padding-bottom: 12px; }
  #stage #start h1 { grid-area: h1; margin: 0; font-size: 32px; text-shadow: 4px 4px 0 #1b2e7a; }
  #stage #start #tagline { display: none; }
  #stage #start #daily-card { grid-area: card; margin: 0; gap: 6px; padding: 6px 8px; }
  #stage #start #btn-daily { min-height: 56px; }
  #stage #start .modes { grid-area: modes; }
  #stage #start .modes button { min-height: 52px; }
  #stage #start #btn-levels { grid-area: chip; margin-top: 0; }
  #stage #start .chars { grid-area: chars; margin-top: 0; row-gap: 4px; }
  #stage #start .chars button canvas { width: 48px; height: 48px; }
  #stage #start .start-foot { grid-area: foot; margin-top: 0; }
  #stage #start details.about { grid-area: about; margin-top: 0; }
  #stage #start .footer { grid-area: footer; margin: 0; }
}
/* Laptops keep the tagline (or the champion line) in its own row: there is room for it. */
@media (orientation: landscape) and (max-height: 500px) { #stage #start .footer { font-size: 12px; } } /* the credit keeps the footer on one line on a phone held sideways */
@media (orientation: landscape) and (min-width: 800px) and (min-height: 501px) and (max-height: 870px) {
  #stage #start .panel { grid-template-areas: "h1 h1" "tag tag" "card chars" "modes foot" "chip about" "chip footer"; }
  #stage #start #tagline { display: block; grid-area: tag; margin: 0; }
}
@media (max-width: 440px) and (max-height: 700px) { #stage #start #tagline { display: none; } #stage #start .footer { margin-top: 1px; } } /* 375x667 (iPhone SE): the tagline gives its line to the attempts-left note, as in the popup */
@media (max-width: 440px) and (max-height: 760px) { #stage #start #tagline { display: none; } } /* 360x740: the leaderboard link puts the foot on two rows (and the DE and LB note takes two lines): the tagline gives its line */
#stage #char-hint { position: absolute; z-index: 2; top: calc(100% + 6px); left: 50%; transform: translateX(-50%); width: max-content; max-width: min(314px, calc(100vw - 76px)); margin: 0; padding: 6px 10px; background: #0a0e17; border: 2px solid var(--accent); color: var(--text); text-wrap: balance; cursor: pointer; } /* a bubble under the row: the screen never grows or jumps; it takes its own taps (one closes it), so nothing under it is clicked blind */
#stage button:focus-visible, #stage summary:focus-visible, #stage a:focus-visible { outline: 3px solid var(--text); outline-offset: 3px; } /* keyboard focus: a near-white square frame, apart from the yellow selected state */
#stage .panel:focus-visible { outline: none; }
#stage .start-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-top: 12px; }

/* Settings and help */
#stage .diffs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0; }
#stage .diffs button { margin: 0; min-height: 52px; padding: 8px; white-space: pre-line; border-radius: 0; }
#stage .langs { gap: 8px; margin: 0; }
#stage .langs button { margin: 0; min-height: 44px; padding: 8px 12px; }
#stage .langs button.active { background: rgba(255,210,63,.14); color: var(--text); box-shadow: inset 0 0 0 2px var(--accent); } /* same selected state as .diffs */
#stage p.how { text-align: left; color: var(--text); font-size: 16px; margin: 10px 0; }
#stage .how-k { display: block; font-family: var(--f-disp); font-size: 16px; color: var(--accent); text-transform: uppercase; margin-bottom: 2px; }

/* Cities, folded by tier */
#stage .stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-family: var(--f-disp); font-size: 16px; text-transform: uppercase; color: var(--text); margin: 6px 0 8px; }
#stage .stats:empty { display: none; }
#stage #levels-grid { display: block; max-height: 52vh; overflow: auto; padding: 2px; margin-top: 8px; }
#stage details.tier { margin-top: 8px; border: 2px solid var(--line); }
#stage details.tier > summary { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 8px 10px; text-align: left; }
#stage .tier-name { flex: 1; font-family: var(--f-text); font-size: 16px; color: var(--text); }
#stage .tier-count { font-family: var(--f-disp); font-size: 16px; color: var(--muted); }
#stage .tier-ready { font-family: var(--f-disp); font-size: 16px; color: var(--accent); }
#stage .tier-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; padding: 0 6px 8px; } /* 112: Constantinople and Konstantinopel fit on one line */
#stage .lvl { border-radius: 0; box-shadow: none; text-transform: none; padding: 6px 4px; }
#stage .lvl .lvl-num { font-family: var(--f-disp); font-size: 16px; color: var(--muted); }
#stage .lvl .lvl-name { font-family: var(--f-text); font-size: 16px; }
#stage .lvl small { font-family: var(--f-disp); font-size: 16px; color: var(--muted); text-transform: uppercase; }
#stage .lvl.locked:not(.poor) small, #stage .lvl.sel small { color: var(--accent); }
#stage .lvl:not(.got):not(.fro) .lvl-flag { filter: grayscale(1); opacity: .6; }
#stage .lvl.arm { outline: 3px solid var(--accent); outline-offset: -3px; } #stage .lvl.locked.arm small { color: var(--ink); background: var(--accent); padding: 0 4px; } /* armed: the next tap buys */
#stage .pxflag { display: block; image-rendering: pixelated; image-rendering: crisp-edges; margin: 2px 0; }
#stage #btn-levels-fro { margin-top: 10px; }

/* Frontalier */
#stage #fro-title { color: var(--cyan); }
#stage .fro-cards { grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 6px; } /* 2 across on phones, so Diddenuewen (LB) clears its borders */
#stage .lvl.fro { padding: 6px 4px; }
#stage .lvl.fro .lvl-name { color: var(--cyan-2); }
#stage .pips { display: inline-flex; gap: 2px; }
#stage .pip { display: inline-block; width: 6px; height: 6px; border: 2px solid var(--cyan); }
#stage .pip.on { background: var(--cyan); }
#stage .lvl-km { color: var(--muted); }
#stage .lvl.fro small.rec { color: var(--pink); }

/* Game over */
#stage .kicker { font-family: var(--f-disp); font-size: 16px; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
#stage .kicker.bad { color: var(--bad); } #stage .kicker.ok { color: var(--ok); } #stage .kicker.warn { color: var(--accent); }
#stage #go-title { font-family: var(--f-text); font-size: 24px; line-height: 1.2; text-transform: none; margin: 0 0 8px; }
#stage #go-title .cause { color: var(--pink); }
#stage .badge { font-family: var(--f-disp); font-size: 16px; color: var(--pink); text-transform: uppercase; margin: 4px 0; }
#stage #go-unlock .line { display: block; text-wrap: balance; }
#stage #go-unlock .nowrap { white-space: nowrap; }
#stage p.big { font-family: var(--f-disp); font-size: 40px; line-height: 1; color: var(--text); margin: 8px 0 6px; font-variant-numeric: normal; }
#stage p.big.ok { color: var(--ok); }
#stage p.big small { display: inline-block; font-size: 16px; color: var(--muted); margin-left: 6px; text-transform: uppercase; word-spacing: -.25em; } /* its own em: an inherited -.25em of the 40 px hero would glue the words */
#stage .go-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
#stage .go-btns button { flex: 1 1 0; margin: 0; min-height: 52px; }
#stage .go-btns #btn-again { flex-grow: 2; } /* Run again and Menu on one row, Run again twice as wide */
#stage #gameover.fresh .panel { pointer-events: none; } /* 500 ms after it appears: a late jump tap lands on the backdrop, never on Share, Menu or Google */
#stage details.share-box { margin-top: 10px; }
#stage .share-box summary { font-family: var(--f-disp); font-size: 16px; text-transform: uppercase; color: var(--muted); text-align: center; }
/* Share block (18/10/2026): the share sheet on one wide button, then X, WhatsApp, LinkedIn / Facebook, Reddit, Copy in a 3 x 2
   grid of square tiles, each with its 12 x 12 pixel glyph drawn at 2 px per pixel. Yellow frame after a record, a win or the last attempt. */
#stage .share-block { margin-top: 12px; padding: 10px 10px 10px; border: 2px solid var(--line); background: rgba(0,0,0,.18); }
#stage .share-block.hot { border-color: var(--accent); }
#stage .share-block .label { margin: 0 0 8px; }
#stage .share-block button.share-sheet { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0 0 6px; min-height: 48px; }
#stage .share-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#stage .sh { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: auto; min-height: 62px; margin: 0; padding: 8px 2px 10px; border: 2px solid var(--line); background: rgba(255,255,255,.06); box-shadow: inset 0 -4px 0 rgba(0,0,0,.28); color: var(--text); font-family: var(--f-text); font-size: 15px; font-weight: 400; line-height: 1; text-transform: none; text-decoration: none; cursor: pointer; }
#stage .sh:hover { border-color: rgba(255,255,255,.4); background: rgba(255,255,255,.1); }
#stage .sh:active { transform: translateY(2px); box-shadow: none; }
#stage .sh-ic { display: block; width: 24px; height: 24px; flex: none; }
#stage .sh-ic svg { display: block; }
#stage .sh-t { white-space: nowrap; }
#stage .sh[data-net="w"] .sh-ic { color: var(--ok); }
#stage .sh[data-net="l"] .sh-ic { color: var(--accent-2); }
#stage .sh[data-net="f"] .sh-ic { color: #6f8cff; }
#stage .sh[data-net="r"] .sh-ic { color: var(--text); } #stage .sh[data-net="r"] .ic2 { fill: #ff8c1a; } /* a light head with orange eyes, never mistaken for a pumpkin */
#stage .sh[data-net="c"] .sh-ic { color: var(--accent); }
#stage .sh.ok { border-color: var(--ok); } #stage .sh.ok .sh-t { color: var(--ok); }
#stage .sh.solo { grid-column: 1 / -1; flex-direction: row; gap: 10px; min-height: 48px; } /* the extension: the clipboard alone */
#stage .sh-status { margin: 8px 0 0; font-family: var(--f-text); font-size: 15px; color: var(--ok); }
#stage .sh-status:empty { display: none; }
#stage .share-block details.share-box { margin-top: 8px; }

/* Chrome popup (640x400) */
body.popup #stage h1 { font-size: 32px; text-shadow: 4px 4px 0 #1b2e7a; }
body.popup #stage #tagline { display: none; }
body.popup #stage p.big { font-size: 32px; }
body.popup #stage .panel { padding: 14px 16px; }
body.popup #stage .chars button { width: 84px; } /* as wide as elsewhere: RENARD is 72 px of Silkscreen */
body.popup #stage .chars button canvas { width: 48px; height: 48px; }
body.popup #stage p.how { margin: 6px 0; }
body.popup #stage .how-k { display: inline; margin-right: 8px; } /* 400 px of height: the label runs into its line */

/* Leaderboard (leaderboard.js, website only): the best players under every game over, and a dialog with every board */
#stage .lb { margin-top: 12px; padding: 8px; border: 2px solid var(--line); background: rgba(0,0,0,.18); }
#stage .lb .label, #stage #board .label { margin: 0 0 6px; }
#stage .lb-rows { list-style: none; margin: 0; padding: 0; text-align: left; }
#stage .lb-rows li { display: grid; grid-template-columns: 2.4em minmax(0, 1fr) auto; gap: 8px; align-items: baseline; padding: 3px 6px; font-size: 16px; line-height: 1.3; color: var(--text); }
#stage .lb-rows li:nth-child(odd) { background: rgba(255,255,255,.04); }
#stage .lb-rows .rk { font-family: var(--f-disp); color: var(--muted); }
#stage .lb-rows .rk1 { color: var(--accent); } #stage .lb-rows .rk2 { color: #dfe6ee; } #stage .lb-rows .rk3 { color: #f0a868; } /* gold, silver, bronze */
#stage .lb-rows .ps { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#stage .lb-rows .vl { font-family: var(--f-disp); word-spacing: -.25em; white-space: nowrap; }
#stage .lb-rows li.me { outline: 2px solid var(--accent); outline-offset: -2px; background: rgba(255,210,63,.12); }
#stage .lb-rows li.ghost .ps { color: var(--accent); }
#stage .lb-rows li.gap, #stage .lb-rows li.empty { display: block; text-align: center; color: var(--muted); background: none; }
#stage .lb .note { margin: 6px 0 0; }
#stage #go-board-note { margin: 0 0 4px; }
#stage .lb button.link-btn { display: block; margin: 4px auto 0; text-decoration: underline; text-underline-offset: 3px; }
#stage #go-board-cta:empty { display: none; }
#stage #go-board-cta button { margin-top: 6px; }
#stage .lb-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
#stage .lb-tabs button { margin: 0; padding: 8px 6px; font-size: 16px; border: 2px solid var(--line); background: transparent; box-shadow: none; }
#stage .lb-tabs button.on { border-color: var(--accent); background: rgba(255,210,63,.14); }
#stage .lb-sub { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0; }
#stage .lb-sub:empty { display: none; }
#stage .lb-sub .note { flex-basis: 100%; margin: 0; }
#stage .lb-sub button.chip { margin: 0; padding: 6px 8px; font-family: var(--f-text); text-transform: none; }
#stage .lb-sub button.chip::after { display: none; }
#stage .lb-sub button.chip.on { border-color: var(--accent); background: rgba(255,210,63,.14); }
#stage #board-rows { margin-top: 8px; }
#stage .lb-me { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.1); }
#stage .lb-me .hint a { color: var(--muted); }
#stage .lb-row { display: flex; gap: 8px; align-items: center; }
#stage .lb-input { flex: 1; min-width: 0; padding: 10px 12px; border: 2px solid rgba(255,255,255,.2); background: rgba(0,0,0,.3); color: var(--text); font: 16px var(--f-text); -webkit-user-select: text; user-select: text; }
#stage .lb-input:focus { outline: none; border-color: var(--accent); }
/* v4 guest leaderboard: the day of each best result under its value, the all-time record line, the one-tap form */
#stage .lb-rows .vl .dt { display: block; font: 12px/1.2 var(--f-text); word-spacing: normal; color: var(--muted); text-align: right; }
#stage .lb .record, #stage #board .record { margin: 0 0 6px; color: var(--accent); overflow-wrap: anywhere; }
#stage .lb-row .dice { flex: none; margin: 0; padding: 6px 8px; font-size: 20px; line-height: 1; text-decoration: none; }
#stage #go-board-cta .lb-row { margin-top: 6px; }
#stage #go-board-cta { margin-bottom: 8px; }
#stage #go-board .lb-rows .vl { font-size: 14px; }
#stage #go-board-cta button.secondary { width: 100%; margin-top: 6px; }
#stage #go-board-cta .hint { margin: 6px 0 0; font-size: 13px; line-height: 1.35; }
#stage #go-board-cta .hint a { color: var(--muted); }
#stage .lb .on-board { margin: 8px 0 0; }
#stage .lb button.link-btn.inline { display: inline; margin: 0; padding: 0; }
#stage .lb-consent { display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 0; text-align: left; font-size: 14px; line-height: 1.35; color: var(--muted); cursor: pointer; }
#stage .lb-consent input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
#stage .lb-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 16px; }
#stage #go-unlock .power { font-family: var(--f-text); text-transform: none; color: var(--accent); }
@media (max-width: 440px) and (max-height: 700px) { #stage #start #btn-daily { min-height: 48px; } #stage #start .modes button { min-height: 48px; padding: 8px 6px; } #stage #start .start-foot { row-gap: 0; } #stage #start .start-foot button.link-btn { padding: 4px; } #stage #start details.about { display: none; } #stage #start button.chip { margin-top: 4px; padding-top: 6px; padding-bottom: 6px; } #stage #start .chars { margin-top: 4px; } } /* 375x667: the leaderboard link puts the foot on two rows; the big buttons and the folded About line give back the height (search engines render at 412 px or more, never this short) */
#stage #daily-note.risk { color: #ffd6dc; background: rgba(255,51,85,.2); padding: 0 6px; } /* the streak at risk: a red band, no extra height */
#stage .lb-rows .rn { width: 20px; height: 20px; image-rendering: pixelated; vertical-align: -4px; margin-right: 6px; }
#stage .share-img { display: block; width: 100%; height: auto; margin-top: 10px; image-rendering: auto; border: 2px solid var(--line); }
#stage .share-dl { display: inline-block; margin-top: 8px; color: var(--accent); font-family: var(--f-disp); font-size: 16px; text-transform: uppercase; }
#stage #go-vs.ok { color: var(--ok); } #stage #go-vs.bad { color: var(--bad); }
#stage #tagline button.champ { display: inline-block; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; width: auto; margin: 0; padding: 2px 4px; font-family: var(--f-text); text-transform: none; color: var(--accent); }
#stage #tagline button.champ .rn { width: 20px; height: 20px; image-rendering: pixelated; vertical-align: -4px; margin-right: 6px; }
#stage #btn-music { margin: 0 auto; }
#stage #btn-music::after { display: none; }
#stage .ach { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; text-align: left; max-height: 34vh; overflow: auto; }
#stage .ach-item { display: flex; gap: 8px; align-items: flex-start; padding: 6px; border: 2px solid var(--line); opacity: .8; }
#stage .ach-item.got { opacity: 1; border-color: rgba(255,210,63,.5); background: rgba(255,210,63,.08); }
#stage .ach-i { font-size: 20px; line-height: 1; }
#stage .ach-t { min-width: 0; overflow-wrap: anywhere; }
#stage .ach-t b { display: block; font-family: var(--f-text); font-size: 15px; color: var(--text); }
#stage .ach-t small { display: block; font-size: 13px; line-height: 1.25; color: var(--muted); }
#stage .lvl.fro.alz { grid-column: 1 / -1; border-color: rgba(61,220,132,.5); }
#stage .lvl.fro.alz .lvl-name { color: var(--ok); }
#stage .modes-right { display: flex; flex-direction: column; gap: 6px; min-width: 0; } /* Frontalier and the Alzette mission share the second column: the row keeps its height */
#stage .modes-right button { flex: 1; min-height: 0; margin: 0; padding: 6px; }
#stage #btn-alz { background: rgba(61,220,132,.14); color: #c8ffd9; border: 2px solid rgba(61,220,132,.45); box-shadow: none; }
#stage #btn-alz .b-sub { display: none; }
#stage #start .modes-right button { min-height: 0; padding: 4px 6px; line-height: 1; } /* wins over the short-phone rules for .modes button */
#stage .trains a { color: var(--cyan-2); text-underline-offset: 3px; }
@media (orientation: landscape) and (max-height: 500px) { #stage #start .modes-right { gap: 4px; } #stage #start .modes-right button { padding: 2px 6px; } } /* landscape phones and the popup: the stack stays as tall as the Run button */
body.popup #stage #help .panel { width: min(560px, 100%); } body.popup #stage p.how { margin: 3px 0; } /* the Bonus row: the help still fits the 400 px popup */
@media (max-width: 440px) and (max-height: 900px) { #stage #start .b-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; } } /* best score and difficulty on one line on phones */
#stage details.ach-box > summary { margin: 16px 0 8px; }
#stage details.ach-box > summary .label { display: inline; margin: 0; }

/* ---------- Halloween night, bonus shop, daily gift, goals (07/10/2026) ---------- */
#stage .px-icon { display: block; image-rendering: pixelated; image-rendering: crisp-edges; flex: none; }
/* The Halloween button: a jack-o'-lantern, ember orange on night violet, same flat pixel button as the others */
#stage button.hw-btn { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 10px; min-height: 48px; margin: 0 0 8px; padding: 4px 12px; background: #24102f; color: #ffb15c; border: 2px solid #ff8c1a; box-shadow: inset 0 -4px 0 #140820; }
#stage button.hw-btn .px-icon { width: 33px; height: 33px; }
#stage .hw-txt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; min-width: 0; }
#stage .hw-btn .b-sub { color: #e8c9ff; }
#stage .kicker.hw { color: #ff8c1a; }
/* Bonus row: the gift, the bonuses owned (tap: armed for the next run), the shop with the wallet */
#stage .bonus-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin: 8px 0 0; }
#stage .start-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 10px 0 0; }
#stage .start-row > #btn-levels { margin: 0; }
#stage .start-row > .bonus-row { display: contents; }
/* Two-column start screen (landscape phones, the popup, laptops): the Halloween button under the Daily card, the start city and the bonus tiles under the modes */
@media (orientation: landscape) and (max-height: 500px), (orientation: landscape) and (min-width: 800px) and (max-height: 870px) {
  #stage #start .panel { grid-template-areas: "h1 h1" "inapp inapp" "card chars" "hw chars" "modes foot" "chip about" "note footer"; }
  #stage #start #inapp { grid-area: inapp; margin: 0; }
  #stage #start .hw-btn { grid-area: hw; margin: 0; }
  #stage #start .start-row { grid-area: chip; margin-top: 0; }
  #stage #start #bonus-note { grid-area: note; margin: 0; }
}
@media (orientation: landscape) and (min-width: 800px) and (min-height: 501px) and (max-height: 870px) {
  #stage #start .panel { grid-template-areas: "h1 h1" "tag tag" "inapp inapp" "card chars" "hw chars" "modes foot" "chip about" "note footer"; }
}
@media (orientation: landscape) and (max-height: 500px) { /* the 640x400 popup and phones held sideways: the Halloween button goes right, under the runners */
  #stage #start .panel { grid-template-areas: "h1 h1" "inapp inapp" "card chars" "modes hw" "modes bonus" "chip foot" "chip about" "chip footer"; } /* every named area exists: an unknown one would add implicit columns */
  #stage #start .bn-k { display: none; }
  #stage #start #bonus-note { display: none; }
  #stage #start .hw-btn { align-self: center; }
  #stage #start .start-row { display: contents; } /* the start city stays left, the bonus tiles go right */
  #stage #start .start-row > .bonus-row { display: flex; grid-area: bonus; margin: 0; align-self: center; }
  #stage #start .start-row > #btn-levels { grid-area: chip; align-self: start; }
}
@media (max-width: 440px) and (max-height: 900px) { #stage #start .start-row { margin-top: 4px; gap: 4px 6px; } #stage #start button.hw-btn { margin-bottom: 6px; } }
@media (max-height: 760px) { #stage #start .hw-btn .b-sub { display: none; } #stage #start button.hw-btn { min-height: 40px; } #stage #start .hw-btn .px-icon { width: 22px; height: 22px; } }
#stage .bonus-row:empty { display: none; }
#stage button.bn { display: inline-flex; align-items: center; gap: 2px; width: auto; min-height: 36px; margin: 0; padding: 2px 6px 2px 2px; border: 2px solid var(--line); background: rgba(0,0,0,.25); box-shadow: none; text-transform: none; }
#stage button.bn .px-icon { width: 28px; height: 28px; }
#stage .bn-l { font-family: var(--f-text); font-size: 16px; color: var(--text); white-space: nowrap; }
#stage .bn-l .num { font-size: 14px; }
#stage button.bn.on { border-color: var(--accent); background: rgba(255,210,63,.14); }
#stage button.bn.on::after { content: ''; width: 10px; height: 8px; margin-left: 2px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 4' shape-rendering='crispEdges'%3E%3Cpath fill='%23ffd23f' d='M4 0h1v1H4zM3 1h1v1H3zM0 2h1v1H0zM2 2h1v1H2zM1 3h1v1H1z'/%3E%3C/svg%3E") no-repeat center / 10px 8px; }
#stage button.bn.gift { border-color: var(--pink); background: rgba(255,79,163,.14); animation: gift 1.2s steps(2, jump-none) infinite; }
@keyframes gift { 0% { transform: translateY(0); } 50% { transform: translateY(-2px); } 100% { transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { #stage button.bn.gift { animation: none; } }
#stage button.bn.shop .bn-l { color: var(--accent); }
#stage #bonus-note { margin: 4px 0 0; font-size: 14px; line-height: 1.3; }
/* Goals: label, name, value, and a thin pixel bar */
#stage .goals { display: grid; gap: 4px; margin-top: 10px; text-align: left; }
#stage .goals:empty { display: none; }
#stage .goal { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 8px; align-items: baseline; width: 100%; margin: 0; padding: 2px 0; background: none; border: 0; box-shadow: none; text-transform: none; text-align: left; color: var(--text); font-family: var(--f-text); font-size: 14px; line-height: 1.25; }
#stage button.goal { cursor: pointer; }
#stage button.goal:active { transform: none; }
#stage .goal-k { font-family: var(--f-disp); font-size: 12px; color: var(--muted); text-transform: uppercase; }
#stage .goal-n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
#stage .goal-v { font-size: 14px; color: var(--muted); white-space: nowrap; }
#stage .goal-v .num { font-size: 14px; }
#stage .goal.ready .goal-v { color: var(--ok); }
#stage .goal-bar { grid-column: 1 / -1; display: block; height: 4px; margin-top: 2px; background: rgba(255,255,255,.1); }
#stage .goal-bar i { display: block; height: 100%; background: var(--accent); }
#stage .goal.ready .goal-bar i { background: var(--ok); }
/* The shop */
#stage .shop-list { display: grid; gap: 6px; margin-top: 6px; text-align: left; }
#stage .shop-item { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto auto; align-items: center; column-gap: 8px; padding: 4px 6px; border: 2px solid var(--line); background: rgba(0,0,0,.18); }
#stage .shop-item.on { border-color: rgba(255,210,63,.6); }
#stage .shop-item .px-icon { width: 42px; height: 42px; }
#stage .shop-t { min-width: 0; }
#stage .shop-t b { display: block; font-family: var(--f-text); font-size: 16px; color: var(--text); }
#stage .shop-t small { display: block; font-size: 13px; line-height: 1.25; color: var(--muted); }
#stage .shop-own { color: var(--accent); font-size: 14px; }
#stage button.shop-buy { width: auto; min-width: 70px; margin: 0; padding: 8px 8px; font-size: 16px; background: var(--accent); color: var(--ink); box-shadow: inset 0 -3px 0 #c79a00; word-spacing: -.25em; }
#stage button.shop-buy.poor { background: rgba(255,255,255,.08); color: var(--muted); box-shadow: none; }
#stage button.shop-buy.arm { background: var(--ok); box-shadow: inset 0 -3px 0 #1f9a55; }
#stage #shop-hint { margin-top: 8px; }
/* Game over: the Daily commute button, or tomorrow's countdown */
#stage button.go-daily { margin-top: 8px; min-height: 52px; }
#stage button.go-daily.wait { opacity: 1; background: rgba(0,0,0,.2); color: var(--muted); border-color: var(--line); }
#stage button.go-daily.wait .b-sub { color: var(--text); }
#stage #go-extra:empty { display: none; }
/* Challenge the team, on the Daily card before the attempts are done */
#stage button.team-btn { display: inline; width: auto; margin: 0; padding: 0 2px; box-shadow: none; background: none; font-family: var(--f-text); font-size: 16px; text-transform: none; color: var(--cyan-2); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
/* In-app browser hint */
#stage .inapp { margin: 0 0 8px; padding: 4px 8px; border: 2px solid var(--accent); color: var(--text); font-size: 14px; line-height: 1.3; text-align: left; }
#stage #go-inapp { margin-top: 10px; }
/* The slow-motion bonus in a run: an hourglass under the pause button, while a charge is held */
#stage #btn-slow { display: none; z-index: 11; position: absolute; top: calc(96px + env(safe-area-inset-top, 0px)); right: calc(8px + env(safe-area-inset-right, 0px)); width: 44px; height: 56px; margin: 0; padding: 2px 0 0; flex-direction: column; align-items: center; justify-content: center; gap: 0; border-radius: 0; border: 2px solid #7fdcff; background: rgba(0,0,0,.45); box-shadow: none; }
#stage #btn-slow .px-icon { width: 24px; height: 24px; }
#stage #btn-slow .slow-k { font-family: var(--f-disp); font-size: 12px; color: #bff3ff; word-spacing: -.25em; }
#stage.slow-ready #btn-slow { display: flex; }
body.popup #stage #btn-slow { top: 8px; right: 52px; }
@media (max-width: 440px) and (max-height: 900px) { body.hw-offer #stage #start #tagline { display: none; } #stage button.bn { min-height: 32px; } #stage button.bn .px-icon { width: 24px; height: 24px; } }
@media (max-width: 440px) and (max-height: 760px) { #stage #start #bonus-note { display: none; } }
#stage .bn-k { font-family: var(--f-text); }
@media (max-width: 440px) and (max-height: 760px) { #stage #start .from-k, #stage #start .bn-k { display: none; } }
/* Support link at the foot of the game-over panel: small, muted, after every button */
#stage .support { margin: 14px 0 0; font-size: 13px; text-align: center; }
#stage .support a { color: var(--muted); }
