/* PEARL-MAN. Neon arcade: electric violet panels on a purple glow, a gold Lilita One logo with a deep purple outline
 * and a hot pink shadow, cyan and pink accents. Chunky game buttons; no paper, no print furniture, no brown
 * (Poop Troops owns the sunny lawn look, so the two games never look alike). */
:root {
  --bg: #2a1380; --panel: #2e1a96; --panel2: #4127c2; --line: #5f48e0; --line2: #8a72ff;
  --text: #ffffff; --sub: #cfc6ff; --dim: #9488da;
  --gold: #ffd31a; --gold-lip: #c27800; --outline: #1f0a5c; --pink: #ff3d9a; --cyan: #2fe0ff;
  --red: #ff3d6e; --blue: #2fb6ff; --green: #3fe07a; --piss: #ffe23a; --rage: #ff7a2f;
  --shade: #150748; --well: #1b0b5e;
  --glow: radial-gradient(130% 95% at 50% 0%, #7a45ff 0%, #4a22d0 38%, #2a1380 72%, #1d0c62 100%);
  --disp: 'Lilita One', 'Arial Black', Impact, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --bw: 640px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--glow) fixed, var(--bg); color: var(--text); font: 500 16px/1.35 var(--body); overflow: hidden;
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
kbd {
  display: inline-block; min-width: 1.7em; text-align: center; font: 700 .8em/1 var(--body); padding: 3px 5px 4px; margin: 0 1px;
  background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-bottom-width: 3px; border-radius: 5px; white-space: nowrap;
}
.k { display: block; font: 600 12px/1 var(--body); color: var(--sub); }
.panel { background: linear-gradient(180deg, #3d24bd, var(--panel) 60%); border: 2px solid var(--line2); border-radius: 14px; box-shadow: 0 5px 0 var(--shade); }

/* ───────────── buttons ───────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none;
  font: 400 20px/1 var(--disp); letter-spacing: .01em;
  background: var(--panel2); color: var(--text); border: 2px solid var(--line2); border-radius: 12px;
  box-shadow: 0 4px 0 var(--shade); padding: 12px 18px 13px; transition: transform .07s, box-shadow .07s, filter .1s;
}
.btn:hover { filter: brightness(1.12); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shade); }
.btn--go { background: var(--gold); color: var(--outline); border-color: var(--outline); box-shadow: 0 5px 0 var(--gold-lip); font-size: clamp(28px, 4vw, 36px); padding: 14px 28px 15px; }
.btn--go:active { box-shadow: 0 2px 0 var(--gold-lip); }
.btn--go kbd { background: rgba(42, 22, 4, .12); color: var(--outline); border-color: rgba(42, 22, 4, .45); font-size: 12px; }
.btn--sm { font-size: 16px; padding: 8px 12px 9px; border-radius: 10px; box-shadow: 0 3px 0 var(--shade); }
.btn--sm b { font: 700 13px/1 var(--body); color: var(--gold); margin-left: 2px; }
.btn:disabled { background: var(--panel2); color: var(--dim); border-color: var(--line); box-shadow: none; transform: none; filter: none; }

/* ───────────── play screen ───────────── */
.pm {
  position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: max(8px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
.hud, .meters { width: calc(var(--bw) + 6px); max-width: 100%; flex: none; }
.hud { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto auto; gap: 6px; }
.hud__cell {
  background: var(--panel); border: 2px solid var(--line); border-radius: 10px;
  padding: 5px 11px 6px; display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0;
}
.hud__score b, .hud__best b { font: 400 25px/1 var(--disp); color: var(--gold); font-variant-numeric: tabular-nums; }
.hud__best b { color: var(--text); }
.hud__score b { min-width: 5ch; }
.lives { display: flex; gap: 3px; height: 22px; align-items: center; }
.lives i { width: 25px; height: 22px; background: url(img/tom.webp) 0 0 / 300% 100% no-repeat; }
.lives[data-losing="1"] i:last-child { animation: blink .25s steps(2) infinite; }
.hud__obj .k { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud__obj b { font: 400 17px/1 var(--disp); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { display: block; height: 6px; background: var(--well); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: var(--f, 0%); background: var(--gold); border-radius: 3px; }
.hud__obj[data-kind="boss"] .bar i { background: var(--red); }
.hud__obj[data-kind="heli"] .bar i { background: var(--green); }
.hud__pause {
  background: var(--panel2); color: var(--text); border: 2px solid var(--line2); border-radius: 10px; box-shadow: 0 3px 0 var(--shade);
  width: 48px; font: 400 20px/1 var(--disp);
}
.hud__pause:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--shade); }

.arena { flex: 1 1 auto; width: 100%; min-height: 0; display: grid; place-items: center; touch-action: none; }
.board { position: relative; background: #000; border-radius: 6px; box-shadow: 0 0 0 3px var(--line2), 0 0 0 6px var(--outline), 0 0 34px 6px rgba(255, 61, 154, .35); }
.board canvas { display: block; width: 100%; height: 100%; outline: none; border-radius: 6px; }

.meters { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px 14px; align-items: center; }
.meter { display: grid; grid-template-columns: auto 1fr 4.4ch; align-items: center; gap: 8px; min-width: 0; }
.meter .k { font: 400 17px/1 var(--disp); color: var(--text); }
.meter > b { font: 700 13px/1 var(--body); color: var(--sub); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.meter__bar { position: relative; height: 14px; background: var(--well); border: 2px solid var(--line2); border-radius: 8px; overflow: hidden; }
.meter__bar i { position: absolute; left: 0; top: 0; bottom: 0; width: calc(100% * var(--p, 0)); background: var(--piss); border-radius: 6px; }
.meter__min { position: absolute; top: 0; bottom: 0; left: 12%; width: 2px; background: var(--text); opacity: .5; }
#m-bladder[data-s="low"] .meter__bar i, #m-bladder[data-s="release"] .meter__bar i { background: #8f88b8; }
#m-bladder[data-s="low"] > b, #m-bladder[data-s="release"] > b { color: var(--red); }
#m-bladder[data-s="on"] .meter__bar i { background: #fff3a6; }
.meter--rage .meter__bar i { background: var(--rage); }
.meter--rage[data-s="ready"] .meter__bar i { background: var(--red); animation: pulse .5s ease-in-out infinite alternate; }
.meter--rage[data-s="ready"] > b { color: var(--gold); }
.meter--rage[data-s="on"] .meter__bar i { background: var(--gold); }
.meter--power { grid-template-columns: auto 70px 3.6ch; }
.meter--power .meter__bar i { background: var(--gold); }
.meter--power[data-s="off"] { visibility: hidden; }
.meter.is-bump { animation: bump .4s; }

.ticker { grid-column: 1 / -1; margin: 0; min-height: 22px; font: 600 14px/1.3 var(--body); color: var(--sub); overflow: hidden; }
.ticker[data-kind="good"] { color: #8fd889; }
.ticker[data-kind="warn"] { color: var(--gold); }
.ticker[data-kind="boss"] { color: #ff8a73; }
.ticker span.is-new { display: inline-block; animation: tick-in .3s ease-out; }

/* touch buttons */
.pad { display: none; }
body.is-touch .pm { touch-action: none; }
.for-touch, body.is-touch .for-keys { display: none; }
body.is-touch .for-touch { display: block; }
body.is-touch .btn kbd { display: none; }
body.is-touch:not(.is-wide) .pad { margin-top: auto; }
body.is-touch .pad { display: flex; width: 100%; max-width: 560px; justify-content: space-between; align-items: center; gap: 12px; flex: none; padding: 0 6px; }
.pad__hint { margin: 0; font: 600 13px/1.3 var(--body); color: var(--dim); text-align: center; }
.pad__btn {
  touch-action: none; border: 3px solid var(--outline); border-radius: 50%; box-shadow: 0 5px 0 var(--shade);
  font: 400 19px/1 var(--disp); display: grid; place-content: center; gap: 3px;
}
.pad__btn small { font: 700 11px/1 var(--body); opacity: .7; }
.pad__btn--piss { width: 104px; height: 104px; background: var(--piss); color: var(--outline); font-size: 25px; }
.pad__btn--piss.is-down { background: #fff3a6; transform: translateY(4px); box-shadow: 0 1px 0 var(--shade); }
.pad__btn--piss[data-s="low"] { background: #8f88b8; }
.pad__btn--rage { width: 76px; height: 76px; background: var(--panel2); color: var(--dim); border-color: var(--line2); }
.pad__btn--rage[data-s="ready"] { background: var(--red); color: #fff; border-color: var(--outline); animation: pulse .5s ease-in-out infinite alternate; }

/* phone held sideways: HUD left, maze centre, meters and buttons right */
body.is-wide .pm {
  display: grid; grid-template-columns: 132px minmax(0, 1fr) 176px; grid-template-rows: minmax(0, 1fr) auto;
  grid-template-areas: "hud arena meters" "hud arena pad"; gap: 8px 10px; align-items: start;
}
body.is-wide .hud { grid-area: hud; width: auto; grid-template-columns: 1fr; align-content: start; }
body.is-wide .hud__best { display: none; }
body.is-wide .hud__pause { width: auto; height: 38px; }
body.is-wide .arena { grid-area: arena; height: 100%; }
body.is-wide .meters { grid-area: meters; width: auto; grid-template-columns: 1fr; }
body.is-wide .meter--power { grid-template-columns: auto 1fr 3.6ch; }
body.is-wide .ticker { font-size: 12px; }
body.is-wide .pad { grid-area: pad; flex-direction: row; padding: 0; align-items: end; }
body.is-wide .pad__hint { display: none; }

/* on-board overlays */
.toast {
  position: absolute; top: 3%; left: 50%; transform: translateX(-50%); width: min(92%, 430px); z-index: 3; pointer-events: none;
  background: rgba(38, 18, 132, .95); border: 2px solid var(--line2); border-radius: 12px; padding: 10px 16px 12px; text-align: center;
}
.toast.is-in { animation: drop .26s cubic-bezier(.2, 1.4, .4, 1); }
.toast p { margin: 0; }
.toast__k { font: 700 14px/1.1 var(--body); color: var(--sub); }
.toast[data-kind="bad"] .toast__k { color: #ff7aa8; }
.toast[data-kind="good"] .toast__k { color: #6dffa0; }
.toast__t { font: 400 clamp(22px, 3.4vw, 30px)/1.05 var(--disp); color: var(--gold); margin-top: 3px !important; }
.toast__l { font: 500 15px/1.3 var(--body); margin-top: 5px !important; }
.toast__l:empty, .toast__f:empty { display: none; }
.toast__f { font: 700 13px/1 var(--body); margin-top: 7px !important; color: var(--sub); }

.bossband {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); z-index: 3; pointer-events: none;
  background: rgba(38, 18, 132, .96); border-top: 4px solid var(--red); border-bottom: 4px solid var(--red);
  display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 4px 18px; padding: 14px 6%;
}
.bossband.is-in { animation: band 2.8s both; }
.bossband__face { grid-row: span 3; }
.bossband__k { margin: 0; font: 400 18px/1 var(--disp); color: var(--red); }
.bossband__name { margin: 0; font: 400 clamp(30px, 6vw, 56px)/.95 var(--disp); color: var(--gold); }
.bossband__line { margin: 0; font: 500 15px/1.3 var(--body); max-width: 46ch; }

/* big centre word: STAGE CLEAR / ESCAPED! */
.stamp {
  position: absolute; left: 50%; top: 44%; z-index: 4; margin: 0; pointer-events: none; white-space: nowrap;
  font: 400 clamp(40px, 8.5vw, 88px)/1 var(--disp); color: var(--gold);
  -webkit-text-stroke: .16em var(--outline); paint-order: stroke fill; text-shadow: 0 .08em 0 var(--outline);
  transform: translate(-50%, -50%);
}
.stamp.is-in { animation: stamp .4s cubic-bezier(.3, 1.6, .5, 1) both; }

/* first-run prompts: "hold E to piss", "press Space" */
.coach {
  position: absolute; left: 50%; bottom: 5%; z-index: 4; transform: translateX(-50%); pointer-events: none;
  display: flex; align-items: center; gap: 12px; padding: 10px 18px 11px; white-space: nowrap;
  background: rgba(38, 18, 132, .95); border: 3px solid var(--gold); border-radius: 14px;
  font: 400 clamp(18px, 2.6vw, 26px)/1.1 var(--disp); color: var(--text);
}
.coach.is-in { animation: coach-in .3s cubic-bezier(.2, 1.4, .4, 1) both, coach-nudge 1.2s .3s ease-in-out infinite; }
.coach kbd { font: 400 1em/1 var(--disp); padding: 4px 9px 6px; background: var(--gold); color: var(--outline); border-color: var(--outline); border-bottom-width: 4px; }
.coach small { display: block; font: 600 13px/1.2 var(--body); color: var(--sub); margin-top: 2px; white-space: normal; }
.coach[data-kind="rage"] { border-color: var(--red); }
.coach[data-kind="rage"] kbd { background: var(--red); color: #fff; }
body.is-touch .coach kbd { display: none; }
.pad__btn.is-coach { animation: coach-ring 1s ease-in-out infinite; }
/* phone held upright: the maze is small, so the prompt sits in the free space above the buttons */
body.is-touch:not(.is-wide) .coach { position: fixed; bottom: calc(132px + env(safe-area-inset-bottom, 0px)); }

.pops { position: absolute; left: 10px; bottom: 10px; z-index: 3; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.medal-pop {
  background: rgba(38, 18, 132, .95); border: 2px solid var(--gold); border-radius: 10px;
  padding: 7px 12px 8px; display: grid; animation: pop-in .3s ease-out, pop-out .3s 3.3s ease-in forwards; max-width: 300px;
}
.medal-pop--skin { border-color: var(--red); }
.medal-pop__k { font: 700 12px/1 var(--body); color: var(--gold); }
.medal-pop b { font: 400 20px/1.15 var(--disp); }
.medal-pop small { font: 500 13px/1.25 var(--body); color: var(--sub); }

/* ───────────── faces: the owner's cut-outs (cast.webp atlas, 12 cells), no background, no frame ───────────── */
.face {
  flex: none; display: inline-block; width: 46px; height: 46px;
  background: url(img/cast.webp?v=3) no-repeat; background-size: 1200% 100%; background-position: calc(var(--k, 0) * 100% / 11) 0;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .55));
}
.face--sm { width: 32px; height: 32px; }
.face--big { width: clamp(64px, 11vw, 108px); height: clamp(64px, 11vw, 108px); }
.face--secret { border-radius: 50%; filter: none; background: var(--panel2); color: var(--gold); font: 400 22px/46px var(--disp); text-align: center; box-shadow: 0 0 0 2.5px var(--line2), 0 0 0 5px var(--line); }
.face--sm.face--secret { font-size: 16px; line-height: 32px; box-shadow: 0 0 0 2px var(--line2); }

/* ───────────── shared overlay pieces ───────────── */
.pm-screen {
  position: fixed; inset: 0; z-index: 20; overflow: auto; display: flex; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  background: rgba(30, 12, 110, .72);
}
.pm-screen > article { margin: auto; position: relative; width: 100%; padding: 20px clamp(16px, 3vw, 28px) 22px; -webkit-user-select: text; user-select: text; }
.eyebrow { margin: 0; font: 700 14px/1.2 var(--body); color: var(--sub); }
.headline { margin: 2px 0 0; font: 400 clamp(32px, 5vw, 50px)/1 var(--disp); color: var(--gold); text-wrap: balance; }
.logo {
  margin: 0; font: 400 clamp(58px, 10vw, 118px)/.95 var(--disp); color: var(--gold); letter-spacing: .01em;
  -webkit-text-stroke: .14em var(--outline); paint-order: stroke fill; text-shadow: 0 .07em 0 var(--outline), 0 .13em 0 var(--pink);
}

/* ───────────── menu: title screen ───────────── */
.pm-menu { background: var(--bg); padding: 0; display: block; }
.menu-bg { position: fixed; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.75) saturate(1.1); pointer-events: none; }
.pm-menu::after { content: ''; position: fixed; inset: 0; pointer-events: none;
  background: radial-gradient(90% 70% at 50% 18%, rgba(122, 69, 255, .55), rgba(42, 19, 128, .82) 70%, rgba(29, 12, 98, .92)); }
.title { position: relative; z-index: 1; max-width: 1040px; margin: 0 auto; padding: max(12px, env(safe-area-inset-top)) 16px max(18px, env(safe-area-inset-bottom)); }
.title__top { display: flex; justify-content: space-between; }
.back { color: var(--sub); font: 700 14px/1 var(--body); text-decoration: none; padding: 8px 0; }
.back:hover { color: var(--text); }
.title__head { display: grid; justify-items: center; text-align: center; margin-top: 2px; }
.title__tom {
  width: 128px; height: 111px; margin-bottom: -30px; position: relative; z-index: 0;
  background: url(img/tom.webp) 0 0 / 300% 100% no-repeat; filter: drop-shadow(0 4px 0 rgba(0, 0, 0, .5));
}
.title__head .logo { position: relative; z-index: 1; }
.title__line { margin: 10px 0 0; max-width: 46ch; font: 600 clamp(15px, 1.9vw, 18px)/1.35 var(--body); color: var(--text); text-wrap: balance; }
.title__body { display: grid; grid-template-columns: minmax(280px, 340px) 1fr; gap: 16px; margin-top: 20px; align-items: start; }
.title__main { display: flex; flex-direction: column; gap: 14px; padding: 16px; }
#menu-play { width: 100%; }
.scores { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.scores div { background: var(--well); border-radius: 9px; padding: 8px 9px 9px; min-width: 0; }
.scores dt { font: 600 12px/1.1 var(--body); color: var(--sub); }
.scores dd { margin: 5px 0 0; font: 400 21px/1 var(--disp); color: var(--gold); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scores dd small { display: block; margin-top: 3px; font: 600 12px/1.2 var(--body); color: var(--sub); overflow: hidden; text-overflow: ellipsis; }
.menu-links { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.skins { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.skin {
  display: grid; justify-items: center; gap: 4px; padding: 7px 4px 8px; background: var(--well); border: 2px solid var(--line); border-radius: 10px; color: var(--text);
}
.skin.is-on { border-color: var(--gold); }
.skin.is-on .skin__name { color: var(--gold); }
.skin:disabled { opacity: .5; }
.skin__pic { width: 42px; height: 36px; background: url(img/tom.webp) 0 0 / 300% 100% no-repeat; }
.skin__pic--gold { filter: sepia(1) saturate(4.5) hue-rotate(-8deg) brightness(1.05); }
.skin__pic--troll { background: url(img/items.webp) 100% 0 / 300% 100% no-repeat; border-radius: 50%; width: 36px; }
.skin:disabled .skin__pic { filter: grayscale(1) contrast(.6); }
.skin__name { font: 400 14px/1 var(--disp); }
.skin small { font: 600 11px/1.15 var(--body); color: var(--sub); text-align: center; }
.stages { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stage-fig { margin: 0; min-width: 0; overflow: hidden; }
.stage-fig canvas { display: block; width: 100%; height: auto; aspect-ratio: 21 / 17; background: var(--well); }
.stage-fig figcaption { padding: 9px 11px 12px; }
.stage-fig .no { font: 700 12px/1 var(--body); color: var(--sub); }
.stage-fig h3 { margin: 3px 0 0; font: 400 21px/1.05 var(--disp); color: var(--text); }
.stage-fig .cast { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 10px; padding-left: 3px; }
.stage-fig.is-locked canvas { filter: grayscale(1) brightness(.45); }
.stage-fig.is-locked h3 { color: var(--dim); }
.stage-fig.is-locked .cast { display: none; }
.stage-fig.is-locked figcaption::after { content: 'Locked'; display: block; margin-top: 8px; font: 600 13px/1 var(--body); color: var(--dim); }
.title aside[data-tg-ad] { margin-top: 16px; }
.title__keys { margin: 16px 0 0; text-align: center; font: 600 13px/1.6 var(--body); color: var(--sub); }

/* ───────────── stage card, tally, pause ───────────── */
.card { max-width: 700px; }
.card__place { margin: 6px 0 0; font: 600 15px/1.3 var(--body); color: var(--sub); }
.lineup { list-style: none; margin: 16px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.lineup li { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.lineup b { display: block; font: 400 19px/1.05 var(--disp); }
.lineup .role { display: inline-block; margin-top: 4px; font: 700 12px/1 var(--body); color: var(--outline); background: var(--gold); padding: 3px 6px; border-radius: 5px; }
.lineup small { display: block; margin-top: 4px; font: 500 14px/1.3 var(--body); color: var(--sub); }
.lineup .is-secret .role { background: var(--red); color: #fff; }
.tip { margin: 18px 0 0; padding: 10px 12px; background: var(--well); border-radius: 10px; font: 500 16px/1.4 var(--body); }
.tip::before { content: 'Tip: '; font-weight: 800; color: var(--gold); }
.card__go { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 18px; }
.card__go p { margin: 0; font: 600 14px/1.6 var(--body); color: var(--sub); }

.tally { max-width: 460px; }
.rows { margin: 12px 0 0; }
.rows div { display: flex; align-items: baseline; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.rows dt { font: 600 15px/1 var(--body); }
.rows dd { margin: 0 0 0 auto; font: 400 18px/1 var(--disp); color: var(--gold); }
.tally__total { display: flex; justify-content: space-between; align-items: baseline; margin: 12px 0 0; }
.tally__total span { font: 400 20px/1 var(--disp); }
.tally__total b { font: 400 42px/1 var(--disp); color: var(--gold); }
.got { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.got li { background: var(--gold); color: var(--outline); border-radius: 6px; padding: 4px 9px; font: 700 13px/1.2 var(--body); }
.got li::before { content: '★ '; }
.tally .btn--go { margin-top: 18px; width: 100%; font-size: 26px; }

.pause { max-width: 420px; }
.pause__sum { display: flex; gap: 18px; margin: 10px 0 0; font: 600 15px/1 var(--body); color: var(--sub); }
.pause__sum b { font: 400 18px/1 var(--disp); color: var(--gold); margin-left: 4px; }
.pause__btns { display: grid; gap: 10px; margin-top: 16px; }
.pause__btns .btn { width: 100%; }
.pause__more { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.vol { display: grid; grid-template-columns: 6ch 1fr 4.6ch; gap: 10px; align-items: center; margin-top: 12px; font: 400 16px/1 var(--disp); }
.vol input { width: 100%; accent-color: var(--gold); }
.vol output { font: 700 13px/1 var(--body); color: var(--sub); text-align: right; }
.toggle { margin-top: 14px; }

/* ───────────── results ───────────── */
.over { max-width: 980px; }
.over__head { text-align: center; }
.over__head .headline { font-size: clamp(52px, 9vw, 96px); line-height: .95; color: var(--red); -webkit-text-stroke: .1em var(--outline); paint-order: stroke fill; }
.pm-screen.is-won .over__head .headline { color: var(--gold); }
.over__deck { text-wrap: balance; margin: 8px auto 0; max-width: 44ch; font: 600 clamp(16px, 2vw, 19px)/1.35 var(--body); color: var(--sub); text-align: center; }
.over__body { display: grid; grid-template-columns: 1fr minmax(0, 1.05fr); gap: 24px; margin-top: 18px; }
.over__main { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.score { display: grid; justify-items: start; }
.score b { display: block; margin-top: 4px; font: 400 clamp(54px, 8vw, 80px)/.95 var(--disp); color: var(--gold); font-variant-numeric: tabular-nums; }
.score .new-best { margin: 6px 0 0; padding: 4px 10px 5px; background: var(--gold); color: var(--outline); border-radius: 7px; font: 400 17px/1 var(--disp); }
.score p { margin: 6px 0 0; font: 700 14px/1.2 var(--body); color: var(--gold); min-height: 1em; }
.stats { margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stats div { background: var(--well); border-radius: 9px; padding: 8px 10px 9px; }
.stats dt { font: 600 12px/1.1 var(--body); color: var(--sub); }
.stats dd { margin: 5px 0 0; font: 400 19px/1 var(--disp); }
.over__medals h3, .over__board h3 { margin: 0; font: 400 21px/1 var(--disp); }
.over__medals ul { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 12px; }
.over__medals li { border-left: 4px solid var(--gold); padding: 2px 0 2px 10px; }
.over__medals b { display: block; font: 400 17px/1.1 var(--disp); color: var(--gold); }
.over__medals small { font: 500 13px/1.25 var(--body); color: var(--sub); }
.save { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.save label { font: 600 14px/1 var(--body); color: var(--sub); }
.save__row { display: flex; gap: 8px; }
.save input {
  flex: 1; min-width: 0; font: 700 18px/1 var(--body); padding: 10px 12px; background: var(--well); color: var(--text);
  border: 2px solid var(--line2); border-radius: 10px; text-transform: uppercase; -webkit-user-select: text; user-select: text;
}
.save input:focus { border-color: var(--gold); outline: none; }
.save .btn { flex: none; font-size: 18px; padding: 10px 14px; }
.status { margin: 0; font: 600 14px/1.3 var(--body); color: var(--sub); min-height: 1.2em; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.actions .btn--go { font-size: 24px; padding: 12px 20px 13px; }
.actions .btn { padding-left: 16px; padding-right: 16px; }
.over__board { min-width: 0; }
.over__board .tgb { margin-top: 8px; }
.over aside[data-tg-ad] { grid-column: 1 / -1; }

/* ───────────── sheets (help, practice, medals, sound, guestbook) ───────────── */
.pm-sheet { position: fixed; inset: 0; z-index: 40; display: flex; padding: 14px; background: rgba(30, 12, 110, .66); overflow: auto; }
.sheet { position: relative; margin: auto; width: 100%; max-width: 640px; padding: 20px clamp(16px, 3vw, 26px) 22px; -webkit-user-select: text; user-select: text; }
.sheet__close {
  position: absolute; top: 10px; right: 10px; width: 40px; height: 40px; background: var(--panel2); border: 2px solid var(--line2); border-radius: 10px;
  font: 400 24px/1 var(--disp); color: var(--text);
}
.sheet h2 { margin: 0 46px 0 0; font: 400 32px/1 var(--disp); color: var(--gold); }
.sheet h3 { margin: 20px 0 8px; font: 400 20px/1 var(--disp); }
.sheet p { margin: 6px 0 0; }
.rules { margin: 14px 0 0; padding: 0; list-style: none; counter-reset: r; display: grid; gap: 10px; }
.rules li { counter-increment: r; display: grid; grid-template-columns: 30px 1fr; gap: 10px; font: 500 15px/1.4 var(--body); }
.rules li::before { content: counter(r); display: grid; place-items: center; width: 28px; height: 28px; background: var(--gold); color: var(--outline); border-radius: 50%; font: 400 16px/1 var(--disp); }
.rules b { font-weight: 800; color: var(--gold); }
.keys { width: 100%; border-collapse: collapse; font: 500 15px/1.5 var(--body); }
.keys th { text-align: left; font: 400 16px/1 var(--disp); padding: 8px 12px 6px 0; vertical-align: top; white-space: nowrap; }
.keys td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.points { margin: 0; display: grid; grid-template-columns: 1fr auto; font: 500 15px/1.2 var(--body); }
.points dt, .points dd { padding: 6px 0; border-bottom: 1px solid var(--line); margin: 0; }
.points dd { font: 400 16px/1.2 var(--disp); color: var(--gold); text-align: right; padding-left: 12px; }
.practice { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 10px; }
.practice__stage {
  width: 100%; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 12px; text-align: left;
  background: var(--panel2); color: var(--text); border: 2px solid var(--line2); border-radius: 12px; box-shadow: 0 4px 0 var(--shade); padding: 10px 12px;
}
.practice__stage b { grid-row: span 2; font: 400 34px/1 var(--disp); color: var(--gold); text-align: center; }
.practice__stage span { font: 400 21px/1 var(--disp); }
.practice__stage small { font: 600 13px/1.2 var(--body); color: var(--sub); }
.practice__stage:disabled { box-shadow: none; opacity: .5; }
.practice__stage:not(:disabled):active { transform: translateY(3px); box-shadow: 0 1px 0 var(--shade); }
.medals { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; }
.medals li { display: grid; grid-template-columns: 28px 1fr; column-gap: 9px; align-items: start; opacity: .55; }
.medals li.is-got { opacity: 1; }
.medal__dot { grid-row: span 2; width: 26px; height: 26px; border: 2px solid var(--line2); border-radius: 50%; display: grid; place-items: center; font-size: 14px; }
.is-got .medal__dot { background: var(--gold); border-color: var(--gold); color: var(--outline); }
.medals b { font: 400 16px/1.15 var(--disp); }
.medals small { font: 500 13px/1.25 var(--body); color: var(--sub); }
.gb-form { display: grid; gap: 8px; margin-top: 12px; }
.gb-form input, .gb-form textarea {
  font: 500 16px/1.3 var(--body); padding: 9px 11px; background: var(--well); color: var(--text); border: 2px solid var(--line2); border-radius: 10px;
  -webkit-user-select: text; user-select: text;
}
.gb-form input:focus, .gb-form textarea:focus { border-color: var(--gold); outline: none; }
.gb-form textarea { min-height: 76px; resize: vertical; }
.gb-form .btn { justify-self: start; font-size: 18px; padding: 9px 14px; }
.gb { list-style: none; margin: 14px 0 0; padding: 0; max-height: 46vh; overflow: auto; }
.gb li { padding: 9px 0; border-bottom: 1px solid var(--line); }
.gb__who { margin: 0 !important; display: flex; gap: 10px; align-items: baseline; }
.gb__who b { font: 400 16px/1 var(--disp); color: var(--gold); }
.gb__who small { font: 600 12px/1 var(--body); color: var(--dim); }
.gb__msg { margin: 4px 0 0 !important; font: 500 15px/1.35 var(--body); overflow-wrap: anywhere; }

/* ───────────── the shared board, in the game's colours ───────────── */
.tgb.tgb--pearlman, .tgb--pearlman .tgb {   /* .tgb.tgb--: the results board is both classes on one node, and tg-board.css loads after this file */
  --tgb-bg: #2e1a96; --tgb-ink: #ffffff; --tgb-sub: #cfc6ff; --tgb-line: #5f48e0; --tgb-accent: #ffd31a;
  --tgb-me: #ffd31a; --tgb-me-ink: #1f0a5c; --tgb-tab: #4127c2; --tgb-tab-on: #ffd31a; --tgb-tab-on-ink: #1f0a5c;
  --tgb-font: system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif; --tgb-num: 'Lilita One', 'Arial Black', sans-serif; --tgb-size: 15px; --tgb-radius: 10px;
}
.tgb--pearlman .tgb-sheet { border: 2px solid #8a72ff; border-radius: 14px; }
.tgb--pearlman .tgb-title { font: 400 30px/1 'Lilita One', 'Arial Black', sans-serif; color: #ffd31a; }
.tgb--pearlman .tgb-close { color: #ffffff; }
.tgb--pearlman .tgb-tab { font-weight: 700; }
.tgb--pearlman .tgb-pic { display: none; }
.tgb--pearlman .tgb-more { color: #ffd31a; font-weight: 700; }

/* ───────────── small screens ───────────── */
@media (max-width: 760px) {
  .title__body { grid-template-columns: 1fr; }
  .stages { gap: 8px; }
  .stage-fig figcaption { padding: 7px 8px 9px; }
  .stage-fig h3 { font-size: 15px; }
  .stage-fig .cast { display: none; }
  .title__tom { width: 96px; height: 83px; margin-bottom: -22px; }
  .over__body { grid-template-columns: 1fr; }
  .lineup { grid-template-columns: 1fr; gap: 10px; }
  .medals { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .hud { grid-template-columns: auto auto minmax(0, 1fr) auto; gap: 5px; }
  .hud__best { display: none; }
  .hud__cell { padding: 4px 8px 5px; }
  .hud__score b { font-size: 21px; min-width: 4.4ch; }
  .hud__obj b { font-size: 15px; }
  .lives i { width: 19px; height: 17px; }
  .hud__pause { width: 40px; }
  .meters { grid-template-columns: 1fr 1fr; }
  .meter--power { grid-column: 1 / -1; grid-template-columns: auto 1fr 3.6ch; }
  .meter--power[data-s="off"] { display: none; }
  .meter { gap: 6px; }
  .ticker { font-size: 13px; }
  .scores dd { font-size: 18px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .actions .btn--go { grid-column: 1 / -1; }
  .coach { white-space: normal; width: max-content; max-width: 92%; }
}
@media (max-height: 560px) and (min-width: 600px) {
  .title__tom { display: none; }
  .logo { font-size: 60px; }
}

@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { from { filter: brightness(1); } to { filter: brightness(1.35); } }
@keyframes bump { 30% { transform: translateX(-4px); } 60% { transform: translateX(4px); } }
@keyframes tick-in { from { transform: translateY(60%); opacity: 0; } }
@keyframes drop { from { transform: translate(-50%, -24px); opacity: 0; } }
@keyframes band { 0% { clip-path: inset(0 100% 0 0); } 12%, 88% { clip-path: inset(0 0 0 0); } 100% { clip-path: inset(0 0 0 100%); } }
@keyframes stamp { from { transform: translate(-50%, -50%) scale(2.2); opacity: 0; } }
@keyframes pop-in { from { transform: translateX(-20px); opacity: 0; } }
@keyframes pop-out { to { transform: translateX(-20px); opacity: 0; } }
@keyframes coach-in { from { transform: translate(-50%, 20px); opacity: 0; } }
@keyframes coach-nudge { 50% { transform: translate(-50%, -4px); } }
@keyframes coach-ring { 50% { box-shadow: 0 5px 0 var(--shade), 0 0 0 7px rgba(255, 211, 26, .6); } }
@media (prefers-reduced-motion: reduce) {
  .bossband.is-in { animation: none; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
