/* PingMee Games: the look both games share (founder, 2026-10-31: "make it consistent… use a shared styling").
   A portrait phone app: the top bar (the game's name on the left, the round ☰ on the right), the game screen under it with
   two round thumb buttons inside its bottom corners, and the ☰ menu, sheets and game explainer ("How to play") over it.
   PingMee Run's menu and pills are the model. Each game's page keeps only its own colours in its inline <style>.
   Served from the site itself, as the games' security header allows (web/next.config.ts). Single night theme by choice. */
:root {
  --night: #0d0820;
  --cabinet: #1b1036;
  --sheet: #170d30;
  --line: #4a3285;
  --ink: #f4ecff;
  --muted: #a99ccc;
  --pink: #ec4899;
  --purple: #8b5cf6;
  --gold: #ffd23c;
  --mint: #2ee6c4;
  --pixel: "Press Start 2P", ui-monospace, "Courier New", monospace;
  --term: "VT323", ui-monospace, "Courier New", monospace;
  /* Pills as in the PingMee app (ui/theme: PILL, TYPOGRAPHY.pillLabel, BRAND_RING). */
  --pill-font: "Inter Tight", system-ui, -apple-system, sans-serif;
  --pill-label: 600 17px/24px var(--pill-font);
  --pill-height: 44px;
  --pill-pad: 16px;
  --pill-compact: 36px;
  --pill-compact-pad: 12px;
  --pill-border: 1px;
  --brand-ramp: linear-gradient(90deg, #e0245e, #a83b8f, #7c3aed);
  /* Multiplayer: the FASTEST LAP purple, as the app's lap table (ui/theme: BRAND_COLORS.primaryLight; a test keeps them equal). */
  --fastest-lap: #a78bfa;
  /* Multiplayer: the height of the app's versus bar (ui/theme/games.ts GAME_MATCH.barHeight; a test keeps them equal). */
  --mp-bar-height: 56px;
  /* Each game sets these three (its page's inline <style>). */
  --halo: #2a1450;
  --screen: #0c0722;
  --glow: rgba(236, 72, 153, 0.25);
  color-scheme: dark;
}
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--night);
  background-image: radial-gradient(ellipse at 50% 15%, var(--halo) 0%, var(--night) 60%);
  color: var(--ink);
  font-family: var(--term);
  font-size: 21px;
  line-height: 1.3;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  padding-block: 8px;
  box-sizing: border-box;
  overflow: hidden;
  overscroll-behavior: none;
}
.app { height: 100%; max-width: 460px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; position: relative; }

/* The top bar. Inside the PingMee app, the app's own round back button sits over the top left corner (8px down, 16px in,
   44px: ui/app/games/[game].tsx), so the name starts after it, on the same line. */
.bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: var(--pill-height); }
html.in-app .bar { padding-left: 56px; }
/* Multiplayer (the page adds "mp" to <html>): the app draws its versus bar over this row, so the row keeps exactly the
   bar's room but shows nothing (and its ☰ leaves the tab order and the accessibility tree). */
html.mp .bar { visibility: hidden; min-height: var(--mp-bar-height); }
h1 {
  font-family: var(--pixel); font-size: clamp(11px, 3.9vw, 16px); margin: 0; line-height: 1.2; white-space: nowrap; min-width: 0; overflow: hidden;
  background: linear-gradient(90deg, var(--purple), var(--pink));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* The game screen keeps a clear gap from the phone's edges and the top bar, its glowing frame included (founder,
   2026-10-31: "a bit more of a respectful gap"). The games size the screen inside this padding. */
.stage { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; padding: 12px; box-sizing: border-box; }
.screen { position: relative; }
canvas { display: block; image-rendering: pixelated; image-rendering: crisp-edges; -webkit-tap-highlight-color: transparent; outline: none; }
#game {
  border-radius: 10px; background: var(--screen); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 0 0 3px #3b2670, 0 0 0 9px #2a1a52, 0 0 36px 6px var(--glow);
}
#game:focus-visible { box-shadow: 0 0 0 3px var(--gold), 0 0 0 9px #2a1a52; }

button {
  font: var(--pill-label); color: var(--ink);
  background: var(--cabinet); border: var(--pill-border) solid var(--line); border-radius: 999px;
  min-height: var(--pill-height); padding: 0 var(--pill-pad); cursor: pointer;
  touch-action: manipulation; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
button:hover { border-color: var(--purple); }
button:active { filter: brightness(0.85); }
button:disabled { opacity: 0.4; cursor: default; }
button:focus-visible, input:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* The two round thumb buttons (founder, 2026-10-31: "inside the game frame at the bottom… one on left and one on right as
   circles so it's easy for thumbs"): the same size, see-through so the game shows behind them. The How to play films draw
   the same button (PingMeeExplainer.pad in games-kit/explainer.js): its fill, ring and glyph colours, plain and lit (.on),
   must match these. */
.pad {
  position: absolute; bottom: 3.5%; width: clamp(52px, 19%, 80px); aspect-ratio: 1; min-height: 0; padding: 0; box-sizing: border-box;
  display: grid; place-items: center; border-radius: 50%;
  font: var(--pill-label); font-size: 15px; line-height: 1; color: var(--ink);
  background: rgba(23, 13, 48, 0.55); border: 2px solid rgba(201, 184, 242, 0.55);
  touch-action: none; -webkit-touch-callout: none;
}
.pad.glyph { font-size: 22px; }   /* a pad that shows a glyph (◀ ▶) rather than a word (Jump, Duck) */
.pad.l { left: 4%; }
.pad.r { right: 4%; }
.pad:hover { border-color: rgba(201, 184, 242, 0.55); }
.pad:active, .pad.on { filter: none; background: rgba(139, 92, 246, 0.6); border-color: var(--gold); color: var(--gold); }

/* "How to play" on the start screen; each game sets how far down (--howto-top). */
.howto {
  position: absolute; left: 50%; top: var(--howto-top, 62%); transform: translateX(-50%); width: max-content;
  min-height: var(--pill-compact); padding: 0 var(--pill-compact-pad); background: rgba(23, 13, 48, 0.85); border-color: var(--gold); color: var(--gold);
}
/* Game over on the website: post the score in the app. Above the thumb buttons. */
.post-cta {
  position: absolute; left: 50%; bottom: 25%; transform: translateX(-50%); width: max-content; max-width: calc(100% - 24px);
  min-height: var(--pill-compact); padding: 0 var(--pill-compact-pad); background: rgba(23, 13, 48, 0.92); border-color: var(--gold); color: var(--gold);
}

/* The ☰ menu: a round button top right; the menu drops down from it, over the scrim. */
.menu-wrap { position: relative; }
.menu-wrap.open { z-index: 5; }
#menu-btn { width: var(--pill-height); min-width: var(--pill-height); padding: 0; display: grid; place-items: center; }
#menu-btn .bars { display: block; width: 18px; height: 14px; background: linear-gradient(currentColor 0 0) top / 100% 2px no-repeat, linear-gradient(currentColor 0 0) center / 100% 2px no-repeat, linear-gradient(currentColor 0 0) bottom / 100% 2px no-repeat; }
#menu-btn[aria-expanded="true"] { border-color: var(--gold); color: var(--gold); }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px; display: grid; gap: 6px; padding: 8px;
  background: var(--sheet); border: var(--pill-border) solid var(--line); border-radius: 22px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.menu button { text-align: left; }
.menu button.hot { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 12px rgba(255, 210, 60, 0.35); }

/* Sheets: Runner / Pilot, Scores and Share come up from the bottom over the game. */
.scrim { position: absolute; inset: 0; background: rgba(8, 4, 20, 0.6); border-radius: 12px; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 82%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--sheet); border: 2px solid var(--line); border-radius: 16px 16px 12px 12px;
  padding: 14px; display: grid; gap: 12px; box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}
.sheet-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
h2 { font-family: var(--pixel); font-size: 12px; letter-spacing: 0.06em; margin: 0; color: var(--gold); font-weight: normal; }
.chars { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.chars button { padding: 8px 4px 6px; display: grid; justify-items: center; gap: 4px; border-radius: 12px; font: inherit; }
.chars button canvas { width: 100%; max-width: 48px; height: auto; }
.chars button[aria-checked="true"] { border-color: var(--gold); background: #2c1a55; box-shadow: 0 0 14px rgba(255, 210, 60, 0.35); }
.chars .n { font-size: 9px; color: var(--muted); }
.chars button[aria-checked="true"] .n { color: var(--gold); }
.where { margin: 0; font-family: var(--pixel); font-size: 9px; color: var(--muted); }
.note { margin: 0; color: var(--muted); font-size: 19px; }
.note.good { color: var(--mint); }
textarea#share-text {
  width: 100%; box-sizing: border-box; resize: none; font-family: var(--term); font-size: 21px; line-height: 1.25;
  background: #0f0826; color: var(--ink); border: 2px solid var(--line); border-radius: 8px; padding: 10px;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row button { flex: 1 1 auto; }
#share-native { background: var(--brand-ramp); border: none; }
/* Scores on the website: the leaderboard is in the PingMee app, for members. */
.lock { margin: 0; color: var(--ink); }
ol.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; counter-reset: step; }
ol.steps li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; align-items: center; color: var(--muted); counter-increment: step; }
ol.steps li::before { content: counter(step); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--gold); color: var(--night); font-family: var(--pixel); font-size: 11px; }
ol.steps b { color: var(--ink); font-weight: normal; }
a.pill {
  flex: 1 1 auto; display: inline-flex; align-items: center; justify-content: center; text-decoration: none;
  font: var(--pill-label); color: var(--ink); background: var(--cabinet); border: var(--pill-border) solid var(--line);
  border-radius: 999px; min-height: var(--pill-height); padding: 0 var(--pill-pad); -webkit-tap-highlight-color: transparent;
}
a.pill.go { background: var(--brand-ramp); border: none; }
a.pill:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
/* The store badges in a locked sheet (games-kit/stores.js): Apple's and Google's, unaltered, at the pill's height, a
   quarter of it clear between them (both stores' rules); under them the small "I have PingMee" line. */
.stores { display: grid; justify-items: center; gap: calc(var(--pill-height) / 4); }
.store-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: calc(var(--pill-height) / 4); }
.store-badge { display: block; -webkit-tap-highlight-color: transparent; }
.store-badge img { display: block; height: var(--pill-height); width: auto; }
.store-have {
  display: inline-flex; align-items: center; min-height: var(--pill-height); color: var(--muted); text-decoration: underline;
  -webkit-tap-highlight-color: transparent;
}
.store-badge:active, .store-have:active { filter: brightness(0.85); }
.store-badge:focus-visible, .store-have:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
kbd { font-family: var(--pixel); font-size: 9px; color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; }
html.in-app .web-only, html:not(.in-app) .app-only { display: none; }

/* The game explainer (founder, 2026-10-31): "How to play" as a pop-out box with a round ✕. A film of the game across the
   top shows each step; under it the step, the thumb button it uses (lit up) and Back / Next. games-kit/explainer.js. */
/* Hung from a fixed height, so a longer step only grows it downwards: the film never jumps between steps. */
.sheet.explainer {
  top: 9%; bottom: auto; max-height: 89%; padding: 0; gap: 0; border-radius: 20px; overflow-x: hidden;
}
.ex-film { position: relative; background: var(--screen); border-bottom: 2px solid var(--line); touch-action: pan-y; }
.ex-film canvas { width: 100%; height: auto; aspect-ratio: 16 / 9; }
.ex-x {
  position: absolute; top: 8px; right: 8px; width: var(--pill-height); min-width: var(--pill-height); padding: 0;
  display: grid; place-items: center; background: rgba(13, 8, 32, 0.72); font-size: 18px;
}
.ex-body { padding: 14px; display: grid; gap: 10px; }
.ex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ex-count { font-family: var(--pixel); font-size: 9px; color: var(--muted); }
.ex-steps { list-style: none; margin: 0; padding: 0; }
.ex-steps li { display: grid; gap: 8px; }
.ex-steps h3 { font: var(--pill-label); font-size: 20px; margin: 0; color: var(--ink); }
.ex-steps p { margin: 0; color: var(--muted); }
.ex-steps p b { color: var(--ink); font-weight: normal; }
.ex-pads { display: flex; align-items: center; gap: 10px; }
.ex-pads > span:not(.pad) { flex: 1 1 auto; min-width: 0; }
.ex-pads .pad { position: static; width: 52px; flex: none; border-color: var(--gold); color: var(--gold); animation: ex-lit 1.2s ease-in-out infinite; }
@keyframes ex-lit { 50% { box-shadow: 0 0 0 4px rgba(255, 210, 60, 0.25), 0 0 16px rgba(255, 210, 60, 0.5); } }
.ex-nav { display: flex; align-items: center; gap: 8px; }
.ex-dots { flex: 1 1 auto; display: flex; justify-content: center; gap: 6px; }
.ex-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.ex-dots i.on { background: var(--gold); }
.ex-next { background: var(--brand-ramp); border: none; }
.keys { margin: 0; color: var(--muted); font-size: 18px; }
@media (hover: none) { .keys { display: none; } }
@media (prefers-reduced-motion: reduce) { .ex-pads .pad { animation: none; box-shadow: 0 0 0 3px rgba(255, 210, 60, 0.35); } }
