/*
 * Copyright (c) 2026 AwaCloud SAS
 * Author: Matthieu Bouilloux
 * SPDX-License-Identifier: AGPL-3.0-only
 */

/* A35 art tokens */
/* The palette and the line weights of the design record (3.5). The same list is view/tokens.js, for the
   shaded faces of the scene; a test holds the two together. The strokes are in the arena's view units. */
:root {
    --pg-backdrop: #120e0c;
    --pg-floor: #1d1714;
    --pg-anvil-top: #38332f;
    --pg-anvil-side: #26221f;
    --pg-anvil-edge: #9a8f84;
    --pg-danger: #ff8a3d;
    --pg-cooled: #5b6787;
    --pg-cooled-top: #20232c;
    --pg-text: #f5efe6;
    --pg-muted: #b8ada0;
    --pg-ink: #1a1210;
    --pg-ember: #ff9f43;
    --pg-spark: #ffcf6b;
    --pg-p1: #ff6a4d;
    --pg-p1-shade: #b83a26;
    --pg-p2: #ffd23f;
    --pg-p2-shade: #b88a14;
    --pg-p3: #45c8e6;
    --pg-p3-shade: #1f7f99;
    --pg-p4: #b08cff;
    --pg-p4-shade: #6a48c2;
    --pg-heat-cold: #4f9be8;
    --pg-heat-dull: #b5452f;
    --pg-heat-orange: #ff8a3d;
    --pg-heat-yellow: #ffd166;
    --pg-heat-white: #fff4d6;
    --pg-stroke-hatch: 2.5;
    --pg-stroke-rim: 5;
    --pg-stroke-glow: 16;
    --pg-stroke-ring: 7;
    --pg-stroke-mark: 3;
    --pg-stroke-needle: 7;
    --pg-stroke-notch: 12;
}
/* !A35 */

/* The page: one full-viewport screen. Pinch-zoom stays on the menus; only a round takes the touch (block A60). */
html, body { margin: 0; height: 100%; }
body { background: #10131c; color: #f2f3f7; font-family: system-ui, sans-serif; }
main { display: grid; place-items: center; height: 100vh; overflow: hidden; user-select: none; }
main > svg { width: min(100vw, 100vh); height: min(100vw, 100vh); }
[hidden] { display: none !important; }

/* A35 arena */
/* The arena (view/arena.js): the forge, the anvil's face and its marks, the footprints, the heat gauge.
   Every colour and line weight is an art token; the shaded faces of the meshes are painted by the view. */
.pg-arena > svg, main > svg { background: var(--pg-backdrop); }
[data-part="floor"] { fill: var(--pg-floor); }
[data-part="forge"] { fill: var(--pg-ember); fill-opacity: 0.1; }
[data-part="cooled"] { fill: var(--pg-cooled-top); stroke: var(--pg-cooled); stroke-width: var(--pg-stroke-hatch); stroke-linejoin: round; }
[data-part="cooled-hatch"] { fill: none; stroke: var(--pg-cooled); stroke-width: var(--pg-stroke-hatch); stroke-opacity: 0.7; }
[data-part="platform"] { fill: var(--pg-anvil-top); }
[data-part="danger"] { fill: var(--pg-danger); fill-opacity: 0.14; }
[data-part="danger-hatch"] { fill: none; stroke: var(--pg-danger); stroke-width: var(--pg-stroke-hatch); stroke-linecap: round; stroke-opacity: 0.75; }
[data-part="glow"] { fill: none; stroke: var(--pg-heat-orange); stroke-width: var(--pg-stroke-glow); stroke-linejoin: round; stroke-opacity: 0.3; transition: stroke 0.4s; }
[data-part="rim"] { fill: none; stroke: var(--pg-anvil-edge); stroke-width: var(--pg-stroke-rim); stroke-linejoin: round; }
[data-part="foot"] { fill-opacity: 0.5; stroke: var(--pg-ink); stroke-width: var(--pg-stroke-mark); stroke-opacity: 0.6; }
[data-part="mark"] { fill: var(--pg-ink); }
[data-part="ring"] { stroke-width: var(--pg-stroke-ring); stroke-linecap: round; }
/* A38b: a player that is out waits at the centre as a ghost in its emptying ring; the last second (`return`) it firms up. */
[data-part="ghost-body"] { fill-opacity: 0.16; }
[data-part="ghost-line"] { stroke-width: var(--pg-stroke-mark); stroke-opacity: 0.8; stroke-dasharray: 8 6; stroke-linecap: round; }
[data-pose="out"] > [data-part="foot"], [data-pose="return"] > [data-part="foot"] { fill-opacity: 0.12; stroke-dasharray: 9 7; }
[data-pose="out"] > [data-part="mark"], [data-pose="return"] > [data-part="mark"] { fill-opacity: 0; }
[data-pose="return"] [data-part="ghost-body"] { fill-opacity: 0.4; }
[data-pose="return"] [data-part="ghost-line"] { stroke-opacity: 1; stroke-dasharray: none; }
[data-pose="return"] > [data-part="ring"] { stroke-width: calc(var(--pg-stroke-ring) * 1.6); }
/* The heat of the time scale: the rim glow takes the state's colour (decoration); the gauge tells it by its needle. */
svg[data-heat="cold"] [data-part="glow"] { stroke: var(--pg-heat-cold); }
svg[data-heat="dull"] [data-part="glow"] { stroke: var(--pg-heat-dull); }
svg[data-heat="yellow"] [data-part="glow"] { stroke: var(--pg-heat-yellow); }
svg[data-heat="white"] [data-part="glow"] { stroke: var(--pg-heat-white); stroke-opacity: 0.45; }
[data-part="notch"] { fill: none; stroke-width: var(--pg-stroke-notch); stroke-opacity: 0.4; }
[data-part="notch"][data-heat="cold"] { stroke: var(--pg-heat-cold); }
[data-part="notch"][data-heat="dull"] { stroke: var(--pg-heat-dull); }
[data-part="notch"][data-heat="orange"] { stroke: var(--pg-heat-orange); }
[data-part="notch"][data-heat="yellow"] { stroke: var(--pg-heat-yellow); }
[data-part="notch"][data-heat="white"] { stroke: var(--pg-heat-white); }
svg[data-heat="cold"] [data-part="notch"][data-heat="cold"], svg[data-heat="dull"] [data-part="notch"][data-heat="dull"], svg[data-heat="orange"] [data-part="notch"][data-heat="orange"], svg[data-heat="yellow"] [data-part="notch"][data-heat="yellow"], svg[data-heat="white"] [data-part="notch"][data-heat="white"] { stroke-opacity: 1; }
[data-part="needle"] { fill: none; stroke: var(--pg-text); stroke-width: var(--pg-stroke-needle); stroke-linecap: round; }
[data-part="hub"] { fill: var(--pg-text); }
/* The round is over: the anvil goes dark. */
svg[data-over="true"] [data-part="platform"] { fill: var(--pg-anvil-side); }
svg[data-over="true"] [data-part="glow"] { stroke-opacity: 0; }
/* !A35 */

/* Lobby and scores. */
.pg-lobby, .pg-end { display: grid; gap: 1.5rem; justify-items: center; padding: 1rem; }
.pg-join { color: #f2f3f7; font-family: ui-monospace, monospace; font-size: 1.1rem; word-break: break-all; text-align: center; }
.pg-roster, .pg-scores { display: flex; gap: 1rem; list-style: none; margin: 0; padding: 0; }
/* The host's scores: the players of the next round who were not in this one (A28). */
.pg-late { opacity: 0.45; }
.pg-dot { display: inline-block; width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--pg-colour, #5b6787); }
[aria-current="true"] > .pg-dot { outline: 3px solid #f2f3f7; outline-offset: 3px; }
.pg-score { color: var(--pg-colour, #f2f3f7); font-size: 3rem; font-weight: 700; }
.pg-score[aria-current="true"] { text-decoration: underline; text-underline-offset: 0.3em; }
.pg-go { font-size: 2rem; width: 4.5rem; height: 4.5rem; border-radius: 50%; border: 0; background: #f2f3f7; color: #10131c; cursor: pointer; }
.pg-go:disabled { opacity: 0.35; cursor: default; }
.pg-go:focus-visible, .pg-hold:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.pg-end { position: fixed; inset: auto 0 2rem 0; }

/* The shell's screens (A23): home and the placeholder screens. */
.pg-menu { display: grid; gap: 1.5rem; justify-items: center; padding: 1rem; text-align: center; }
.pg-title { margin: 0; font-size: 2.5rem; }
.pg-title:focus { outline: none; }
.pg-entries { display: grid; gap: 0.75rem; list-style: none; margin: 0; padding: 0; }
.pg-entry { min-width: 14rem; min-height: 3rem; padding: 0.5rem 1.5rem; border-radius: 1.5rem; border: 2px solid #5b6787; background: #232a3d; color: #f2f3f7; font: inherit; font-size: 1.25rem; cursor: pointer; }
.pg-entry:hover { border-color: #f2f3f7; }
.pg-entry:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.pg-back { min-width: 8rem; }
/* The way out of a lobby and of the practice setup (P4 review): at the top left of the content, away from Start.
   On a wide screen it lines up with the widest block (the character choice, 34rem), not with the screen's edge. */
.pg-lobby > .pg-back { justify-self: start; margin-inline-start: max(0px, calc((100% - 34rem) / 2)); min-width: 0; min-height: 2.75rem; padding: 0.4rem 1.1rem; font-size: 1rem; }
.pg-lobby > .pg-back::before { content: "\2190\00a0"; }
.pg-soon { margin: 0; color: #aab3cc; }
/* The practice's way out over the arena (P4 review): the top left corner, away from the touch controls; not on the scores, which have Leave. */
.pg-quit { position: absolute; top: 0.5rem; left: 0.5rem; z-index: 2; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 2px solid #5b6787; background: rgb(16 19 28 / 0.82); color: #f2f3f7; font: inherit; font-size: 1.2rem; cursor: pointer; }
.pg-quit:hover { border-color: #f2f3f7; }
.pg-quit:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
[data-phase="scores"] .pg-quit { display: none; }

/* The round: the arena, and the touch controls over it on a phone. */
.pg-stage { position: relative; width: 100vw; height: 100vh; display: grid; place-items: center; background: var(--pg-backdrop); }
.pg-arena > svg { display: block; width: min(100vw, 100vh); height: min(100vw, 100vh); }
.pg-touch { display: none; }
@media (pointer: coarse) {
    .pg-touch { display: flex; position: absolute; inset: auto 0 0 0; justify-content: space-between; align-items: flex-end; padding: 1rem; pointer-events: none; }
    .pg-pad, .pg-hold { pointer-events: auto; }
}
.pg-pad { position: relative; width: min(38vw, 30vh); aspect-ratio: 1; border-radius: 50%; background: rgb(35 42 61 / 0.55); border: 2px solid #5b6787; touch-action: none; }
.pg-knob { position: absolute; left: 50%; top: 50%; width: 32%; height: 32%; border-radius: 50%; background: var(--pg-colour, #5b6787); transform: translate(calc(-50% + var(--pg-kx, 0) * 120%), calc(-50% + var(--pg-ky, 0) * 120%)); }
.pg-hold { width: min(24vw, 18vh); aspect-ratio: 1; border-radius: 50%; border: 0; font-size: 2.2rem; background: var(--pg-colour, #5b6787); color: #10131c; touch-action: none; }

/* The recorder's level meter; the rest of the recording is the A47 block. */
.pg-meter { width: 6rem; height: 0.5rem; border-radius: 0.25rem; background: linear-gradient(to right, #3ec1d3 calc(var(--pg-level, 0) * 100%), #232a3d 0); }

/* The end-of-round replay (A9): a cue over the arena, no touch controls. */
.pg-replay { display: none; }
[data-phase="replay"] .pg-replay { display: block; position: absolute; top: 1rem; right: 1rem; font-size: 2.5rem; line-height: 1; color: #ffd23f; }
[data-phase="replay"] .pg-touch { display: none; }

/* A guest's join state: hourglass while joining, a cross when the room cannot be reached. */
.pg-link-state { font-size: 2.5rem; line-height: 1; }
[data-state="failed"] .pg-link-state, [data-state="rejected"] .pg-link-state, [data-state="closed"] .pg-link-state { color: #ff5d73; }

/* The time scale (A13) is told by the heat of the arena (block A35) and by the HUD (block A31). */

/* A32 about */
.pg-about { gap: 1rem; max-width: 34rem; margin: 0 auto; }
.pg-about-text { margin: 0; line-height: 1.5; }
.pg-about-head { margin: 0.5rem 0 0; font-size: 1.25rem; }
.pg-about-links { display: grid; gap: 0.25rem; list-style: none; margin: 0; padding: 0; }
.pg-about-link { display: inline-block; padding: 0.6rem 0.75rem; color: #ffd23f; }
.pg-about-link:hover { color: #f2f3f7; }
.pg-about-link:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.pg-about-slot:empty { display: none; }
/* !A32 */

/* A26 title screen */
/* The forge palette of the design record (3.5), on home first: backdrop #120e0c, text #f5efe6 (16.80 on it),
   muted #b8ada0 (8.71), anvil top #38332f, anvil edge #9a8f84 (6.07 on the backdrop, 3.94 on the top),
   ember #ff9f43 (9.41), spark #ffcf6b (13.15), ink #1a1210 (9.04 on ember). */
main[data-screen="home"] { background: #120e0c; color: #f5efe6; }
.pg-home { box-sizing: border-box; max-height: 100vh; overflow-y: auto; touch-action: pan-y; gap: 1.25rem; }
.pg-home .pg-title { font-size: 2.75rem; letter-spacing: 0.02em; }
.pg-tagline { margin: -0.75rem 0 0; color: #b8ada0; font-size: 1rem; letter-spacing: 0.08em; }
.pg-home .pg-entry { border-color: #9a8f84; background: #38332f; color: #f5efe6; }
.pg-home .pg-entry:hover { border-color: #f5efe6; }
.pg-home .pg-entry:focus-visible { outline-color: #ffcf6b; }
.pg-home li:first-child .pg-entry { border-color: #ff9f43; background: #ff9f43; color: #1a1210; font-weight: 700; }
.pg-home li:first-child .pg-entry:hover { border-color: #ffcf6b; background: #ffcf6b; }
/* The logo: an anvil, the hot piece on its face and three sparks, drawn by shapes (the anvil of tools/make-icon.js). */
.pg-logo { position: relative; width: 9rem; height: 6.75rem; }
.pg-logo > span { position: absolute; display: block; }
.pg-logo-anvil { clip-path: polygon(0% 8%, 100% 8%, 100% 30%, 72% 38%, 64% 56%, 64% 70%, 86% 80%, 86% 100%, 14% 100%, 14% 80%, 36% 70%, 36% 56%, 30% 38%, 0% 12%); left: 0; bottom: 0; width: 100%; height: 60%; background: #9a8f84; }
.pg-logo-piece { left: 40%; top: 36%; width: 44%; height: 9%; border-radius: 0.15rem; background: #ff9f43; box-shadow: 0 0 0.9rem #ff8a3d; }
.pg-logo-spark { clip-path: polygon(50% 0%, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0% 50%, 38% 38%); aspect-ratio: 1; background: #ffcf6b; }
.pg-logo-spark-a { left: 58%; top: 0; width: 26%; }
.pg-logo-spark-b { left: 26%; top: 10%; width: 14%; background: #ff9f43; }
.pg-logo-spark-c { left: 86%; top: 24%; width: 9%; }
@media (max-height: 30rem) {
    .pg-home { gap: 0.6rem; padding: 0.5rem; }
    .pg-home .pg-title { font-size: 1.75rem; }
    .pg-tagline { margin-top: -0.4rem; }
    .pg-logo { width: 5rem; height: 3.75rem; }
}
/* A phone on its side: the entries in two columns, Host across both; the Tab order is unchanged. */
@media (max-height: 30rem) and (min-width: 34rem) {
    .pg-home .pg-entries { grid-template-columns: 1fr 1fr; gap: 0.6rem; }
    .pg-home li:first-child { grid-column: 1 / -1; }
    .pg-home li:first-child .pg-entry { width: 100%; }
}
/* !A26 */
/* A29 how to play */
/* The screen: it scrolls by itself on a small screen (the page never does). */
.pg-howto { box-sizing: border-box; width: 100%; max-height: 100vh; max-height: 100dvh; overflow-y: auto; touch-action: pan-y; gap: 1rem; }
.pg-howto .pg-title { font-size: 2rem; }
.pg-howto-goal { margin: 0; max-width: 40rem; line-height: 1.4; }
.pg-cards, .pg-controls { display: grid; gap: 0.75rem; width: 100%; margin: 0; padding: 0; list-style: none; }
.pg-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 54rem; }
.pg-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 54rem; }
.pg-card { display: grid; gap: 0.4rem; justify-items: center; align-content: start; padding: 0.75rem; border-radius: 1rem; border: 1px solid #3a4258; background: #1a1f2d; }
.pg-card h3 { margin: 0; font-size: 1.1rem; }
.pg-card p { margin: 0; color: #c9cfe0; font-size: 0.95rem; line-height: 1.35; }
@media (max-width: 44rem) {
    .pg-cards, .pg-controls { grid-template-columns: minmax(0, 1fr); max-width: 24rem; }
}

/* A drawing: a few plain elements in a 9 x 5.5 em box. Their resting styles are the static frame. */
.pg-draw { position: relative; width: 9em; height: 5.5em; overflow: hidden; border-radius: 0.75em; background: #10131c; }
.pg-draw * { box-sizing: border-box; }
.pg-draw-floor { position: absolute; left: 2em; top: 0.25em; width: 5em; height: 5em; border-radius: 50%; border: 2px solid #5b6787; background: #232a3d; }
.pg-draw-blob { position: absolute; left: 4em; top: 2.25em; width: 1em; height: 1em; border-radius: 50%; border: 2px solid #10131c; background: #ff5d73; }
.pg-draw-blob[data-role="other"] { background: #3ec1d3; }
.pg-draw-trail, .pg-draw-ring { position: absolute; }

/* Move: the blob goes round its dashed path. */
[data-draw="move"] .pg-draw-trail { left: 3.1em; top: 1.35em; width: 2.8em; height: 2.8em; border-radius: 50%; border: 2px dashed #5b6787; }
[data-draw="move"] .pg-draw-blob { transform: rotate(-40deg) translateX(1.4em); animation: pg-howto-move 4s linear infinite; }
@keyframes pg-howto-move {
    from { transform: rotate(-40deg) translateX(1.4em); }
    to { transform: rotate(320deg) translateX(1.4em); }
}

/* Charge and dash: the ring fills where the blob holds, then the blob is gone along its trail. */
[data-draw="dash"] .pg-draw-ring { left: 2.15em; top: 2em; width: 1.5em; height: 1.5em; border-radius: 50%; border: 3px solid #ff5d73; opacity: 0.55; animation: pg-howto-ring 3s ease-out infinite; }
[data-draw="dash"] .pg-draw-trail { left: 3em; top: 2.6em; width: 2.6em; height: 0.3em; border-radius: 0.15em; background: linear-gradient(to right, transparent, #ff5d73); opacity: 0.8; animation: pg-howto-trail 3s linear infinite; }
[data-draw="dash"] .pg-draw-blob { transform: translateX(1.6em); animation: pg-howto-dash 3s ease-out infinite; }
@keyframes pg-howto-ring {
    0% { opacity: 0; transform: scale(0.7); }
    45%, 50% { opacity: 1; transform: scale(1); }
    56%, 100% { opacity: 0; transform: scale(1); }
}
@keyframes pg-howto-trail {
    0%, 50% { opacity: 0; }
    58% { opacity: 0.9; }
    80%, 100% { opacity: 0; }
}
@keyframes pg-howto-dash {
    0%, 50% { transform: translateX(-1.6em); }
    60%, 88% { transform: translateX(1.6em); }
    100% { transform: translateX(-1.6em); }
}

/* Shove off: the platform's edge is in view; one blob dashes into the other, which goes over it. */
[data-draw="shove"] .pg-draw-floor { left: -1.5em; top: -0.75em; width: 7em; height: 7em; }
[data-draw="shove"] .pg-draw-trail { left: 1em; top: 2.6em; width: 2em; height: 0.3em; border-radius: 0.15em; background: linear-gradient(to right, transparent, #ff5d73); opacity: 0.8; animation: pg-howto-push 3s linear infinite; }
[data-draw="shove"] .pg-draw-blob { left: 0.5em; transform: translateX(2.4em); animation: pg-howto-strike 3s ease-out infinite; }
[data-draw="shove"] .pg-draw-blob[data-role="other"] { left: 3.9em; opacity: 0.45; transform: translateX(2.6em) scale(0.7); animation: pg-howto-fall 3s ease-out infinite; }
@keyframes pg-howto-push {
    0%, 28% { opacity: 0; }
    42% { opacity: 0.9; }
    65%, 100% { opacity: 0; }
}
@keyframes pg-howto-strike {
    0%, 25% { transform: translateX(0); }
    42%, 90% { transform: translateX(2.4em); }
    100% { transform: translateX(0); }
}
@keyframes pg-howto-fall {
    0%, 42% { opacity: 1; transform: translateX(0) scale(1); }
    65% { opacity: 1; transform: translateX(2.6em) scale(1); }
    82%, 100% { opacity: 0; transform: translateX(3em) scale(0.3); }
}

/* The keys, as they sit on a keyboard, and the touch layout of the round. */
.pg-draw-keys { display: flex; flex-wrap: wrap; gap: 0.6em; align-items: flex-end; justify-content: center; width: auto; height: auto; padding: 0.6em; overflow: visible; }
.pg-key-cluster { display: grid; gap: 0.2em; }
.pg-key-row { display: flex; gap: 0.2em; justify-content: center; }
.pg-key, .pg-key-gap { min-width: 1.9em; height: 1.9em; }
.pg-key { display: inline-grid; place-items: center; padding: 0 0.4em; border-radius: 0.35em; border: 2px solid #5b6787; background: #232a3d; color: #f2f3f7; font: inherit; font-size: 0.85em; }
.pg-key[data-code="Space"] { min-width: 5em; }
.pg-draw-touch { border: 2px solid #5b6787; }
.pg-draw-pad { position: absolute; left: 0.5em; bottom: 0.5em; width: 2.4em; height: 2.4em; border-radius: 50%; border: 2px solid #5b6787; background: rgb(35 42 61 / 0.55); }
.pg-draw-knob { position: absolute; left: 50%; top: 50%; width: 32%; height: 32%; border-radius: 50%; background: #ff5d73; transform: translate(10%, -90%); }
.pg-draw-hold { position: absolute; right: 0.6em; bottom: 0.6em; display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; background: #ff5d73; color: #10131c; font-size: 0.9em; line-height: 1; }

/* The first-round hints over the arena: one line for keys, one for touch, gone after the first dash. */
.pg-hints { position: absolute; top: 1rem; left: 50%; transform: translateX(-50%); box-sizing: border-box; width: max-content; max-width: min(80vmin, 34rem); margin: 0; padding: 0.5rem 1rem; border-radius: 1rem; background: rgb(16 19 28 / 0.82); color: #f2f3f7; font-size: 0.95rem; line-height: 1.35; text-align: center; pointer-events: none; transition: opacity 0.8s ease, visibility 0s linear 0.8s; }
.pg-hints[data-state="off"] { opacity: 0; visibility: hidden; }
.pg-hint-touch { display: none; }
@media (pointer: coarse) {
    .pg-hint-keys { display: none; }
    .pg-hint-touch { display: inline; }
}
[data-phase="replay"] .pg-hints { display: none; }

/* Reduced motion: by the Settings switch (<html data-pg-motion="reduce" | "full">), or by the system when the switch does not say "full". */
:root[data-pg-motion="reduce"] .pg-draw * { animation: none; }
:root[data-pg-motion="reduce"] .pg-hints { transition: none; }
@media (prefers-reduced-motion: reduce) {
    :root:not([data-pg-motion="full"]) .pg-draw * { animation: none; }
    :root:not([data-pg-motion="full"]) .pg-hints { transition: none; }
}
/* !A29 */
/* events: the arena events screen (P4 review), with the How to play cards and drawings; reduced motion stops them (A29). */
/* The shrink: the floor narrows to half, then starts again. */
[data-draw="shrink"] .pg-draw-floor { animation: pg-events-shrink 4s ease-in-out infinite; }
[data-draw="shrink"] .pg-draw-blob { left: 4em; top: 2.25em; }
@keyframes pg-events-shrink {
    0%, 25% { transform: scale(1); }
    70%, 90% { transform: scale(0.55); }
    100% { transform: scale(1); }
}
/* The time scale: the blob goes round, slowly, then fast. */
[data-draw="time"] .pg-draw-trail { left: 3.1em; top: 1.35em; width: 2.8em; height: 2.8em; border-radius: 50%; border: 2px dashed #5b6787; }
[data-draw="time"] .pg-draw-blob { transform: rotate(-40deg) translateX(1.4em); animation: pg-events-time 5s linear infinite; }
@keyframes pg-events-time {
    0% { transform: rotate(-40deg) translateX(1.4em); }
    60% { transform: rotate(50deg) translateX(1.4em); }
    100% { transform: rotate(320deg) translateX(1.4em); }
}
/* The gust: an arrow across the floor, then the blob drifts its way. */
.pg-draw-arrow { position: absolute; left: 2.6em; top: 0.9em; width: 3.4em; height: 0.3em; border-radius: 0.15em; background: #ffd23f; opacity: 0; animation: pg-events-arrow 4s linear infinite; }
.pg-draw-arrow::after { content: ""; position: absolute; right: -0.45em; top: -0.35em; border-left: 0.6em solid #ffd23f; border-top: 0.5em solid transparent; border-bottom: 0.5em solid transparent; }
[data-draw="gust"] .pg-draw-blob { left: 3.2em; animation: pg-events-drift 4s ease-in-out infinite; }
@keyframes pg-events-arrow {
    0% { opacity: 0; }
    10%, 40% { opacity: 1; }
    70%, 100% { opacity: 0; }
}
@keyframes pg-events-drift {
    0%, 40% { transform: translateX(0); }
    75%, 90% { transform: translateX(1.8em); }
    100% { transform: translateX(0); }
}
/* The hammer: its shadow grows on the centre, the shock rings out, a blob near the centre is thrown. */
.pg-draw-shadow { position: absolute; left: 3.6em; top: 1.85em; width: 1.8em; height: 1.8em; border-radius: 50%; background: #10131c; opacity: 0; animation: pg-events-shadow 4s ease-in infinite; }
[data-draw="hammer"] .pg-draw-ring { left: 3.6em; top: 1.85em; width: 1.8em; height: 1.8em; border-radius: 50%; border: 3px solid #ffd23f; opacity: 0; animation: pg-events-shock 4s ease-out infinite; }
[data-draw="hammer"] .pg-draw-blob { left: 4.6em; top: 2.25em; animation: pg-events-thrown 4s ease-out infinite; }
@keyframes pg-events-shadow {
    0% { opacity: 0; transform: scale(0.4); }
    40% { opacity: 0.9; transform: scale(1); }
    45%, 100% { opacity: 0; transform: scale(1); }
}
@keyframes pg-events-shock {
    0%, 42% { opacity: 0; transform: scale(0.5); }
    46% { opacity: 1; transform: scale(0.8); }
    70%, 100% { opacity: 0; transform: scale(2.6); }
}
@keyframes pg-events-thrown {
    0%, 44% { transform: translateX(0); }
    70%, 90% { transform: translateX(1.6em); }
    100% { transform: translateX(0); }
}
/* The sudden death: half the floor, two blobs; one goes over the edge. */
[data-draw="sudden"] .pg-draw-floor { left: 3.25em; top: 1.5em; width: 2.5em; height: 2.5em; border-color: #ffd23f; }
[data-draw="sudden"] .pg-draw-blob { left: 3.7em; top: 2.25em; }
[data-draw="sudden"] .pg-draw-blob[data-role="other"] { left: 4.4em; animation: pg-events-out 4s ease-in infinite; }
@keyframes pg-events-out {
    0%, 35% { opacity: 1; transform: translateX(0) scale(1); }
    60% { opacity: 1; transform: translateX(1.4em) scale(1); }
    80%, 100% { opacity: 0; transform: translateX(1.8em) scale(0.3); }
}
/* !events */

/* A30 settings */
.pg-set-rows { display: grid; gap: 1rem; justify-items: stretch; width: min(22rem, 90vw); }
.pg-set { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 3rem; font-size: 1.25rem; text-align: left; cursor: pointer; }
.pg-set-name { flex: 1; }
.pg-set-range { flex: 1; min-width: 6rem; height: 2rem; accent-color: #3ec1d3; }
.pg-set-value { min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; color: #aab3cc; }
.pg-set-check { width: 1.75rem; height: 1.75rem; accent-color: #3ec1d3; }
.pg-set-list { min-height: 2.5rem; padding: 0 0.75rem; border-radius: 0.5rem; border: 2px solid #5b6787; background: #232a3d; color: #f2f3f7; font: inherit; }
.pg-set-range:focus-visible, .pg-set-check:focus-visible, .pg-set-list:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.pg-set-rows > .pg-entry { justify-self: center; }
.pg-set-rows > .pg-entry[aria-pressed="true"] { border-color: #3ec1d3; }
/* Reduced motion (<html data-pg-motion>, kept by modes/settings.js): the arena's colour changes are instant. */
:root[data-pg-motion="reduce"] [data-part="glow"] { transition: none; }
@media (prefers-reduced-motion: reduce) {
    :root:not([data-pg-motion="full"]) [data-part="glow"] { transition: none; }
}
/* !A30 */

/* A33 join */
/* A guest's join screen: the invite, the progress, the failure. While it shows (data-join on the root), the game under it is out. */
[data-join] > :not(.pg-door) { display: none; }
.pg-door { width: min(30rem, 92vw); box-sizing: border-box; }
.pg-door .pg-title { font-size: 2rem; }
.pg-door-room { margin: 0; color: #aab3cc; font-family: ui-monospace, monospace; font-size: 1.1rem; word-break: break-all; }
.pg-door-hint { margin: 0; color: #aab3cc; }
.pg-door-status { margin: 0; min-height: 1.5em; font-size: 1.25rem; line-height: 1.4; }
.pg-door-glass { font-size: 1.5em; }
[data-join="failed"] .pg-door-why { color: #ffb3bd; }
.pg-door-go { border-color: #ff9f43; background: #ff9f43; color: #1a1210; font-weight: 700; }
.pg-door-go:hover { border-color: #ffcf6b; background: #ffcf6b; }
/* The note of a guest that waits for the next round (A28). */
.pg-waiting { margin: 0; max-width: min(30rem, 92vw); color: #f2f3f7; font-size: 1.25rem; text-align: center; }
/* !A33 */
/* A27 lobby */
/* The lobby scrolls by itself on a small screen (the page never does). */
.pg-lobby { box-sizing: border-box; width: 100%; max-height: 100vh; overflow-y: auto; touch-action: pan-y; gap: 1rem; }
/* The host's invite panel: the link itself, Copy, Share where the device shares, and what the copy did. */
.pg-invite { display: grid; gap: 0.6rem; justify-items: center; box-sizing: border-box; width: min(30rem, 92vw); padding: 0.9rem 1rem; border: 2px solid #5b6787; border-radius: 1rem; background: #1a1f2d; }
.pg-invite-title { margin: 0; font-size: 1.25rem; font-weight: 700; }
/* The link can be selected: that is the fallback of a copy the browser refused. */
.pg-invite .pg-join { font-size: 1rem; user-select: all; -webkit-user-select: all; touch-action: auto; }
.pg-invite .pg-join:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.pg-invite-acts { display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; }
.pg-invite-act { min-width: 9rem; font-size: 1.1rem; }
.pg-invite-status { margin: 0; min-height: 1.4em; color: #aab3cc; }
.pg-invite[data-copy="copied"] .pg-invite-status { color: #9be7a8; }
/* The player cards: the seat's colour, its label, and the "host", "you" and "next round" marks. */
.pg-seats { flex-wrap: wrap; justify-content: center; gap: 0.6rem; max-width: min(34rem, 96vw); }
.pg-seat { display: grid; justify-items: center; align-content: start; gap: 0.3rem; box-sizing: border-box; width: 7rem; min-height: 7.5rem; padding: 0.9rem 0.4rem 0.6rem; border: 2px solid #3a4258; border-radius: 1rem; background: #1a1f2d; }
.pg-seat[aria-current="true"] { border-color: #f2f3f7; }
.pg-seat-label { font-size: 0.95rem; }
.pg-seat-mark { padding: 0 0.5rem; border: 1px solid #5b6787; border-radius: 0.75rem; color: #aab3cc; font-size: 0.8rem; line-height: 1.5; }
/* A player that joins at the next round (A28): greyed, the mark says so. */
.pg-seat[data-waiting] { border-style: dashed; }
/* A62: faded to 0.62, not 0.45, so the name still reads at 4.5:1 (6.47 on the card; 4.07 before). */
.pg-seat[data-waiting] > .pg-dot, .pg-seat[data-waiting] > .pg-seat-label { opacity: 0.62; }
/* "Need 2 players" on the host, "waiting for the host" on a guest. */
.pg-lobby-note { margin: 0; max-width: min(30rem, 92vw); color: #aab3cc; font-size: 1.1rem; text-align: center; }
/* !A27 */
/* A34 end */
/* The end screen: a panel over the arena's last frame. Results, the waiting dots, the two slots, the actions. */
.pg-end { inset: auto 0 0 0; gap: 1rem; padding: 1rem 1rem 1.5rem; max-height: 100vh; box-sizing: border-box; overflow-y: auto; background: rgba(16, 19, 28, 0.88); border-top: 2px solid #5b6787; touch-action: pan-y; }
.pg-end .pg-title { font-size: 1.75rem; }
.pg-scores { flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 1.5rem; }
.pg-score { display: grid; justify-items: center; gap: 0.4rem; line-height: 1; }
.pg-score[aria-current="true"] { text-decoration: none; }
.pg-score .pg-dot { width: 1.5rem; height: 1.5rem; }
.pg-you { color: #f2f3f7; font-size: 1rem; font-weight: 400; }
.pg-end-slot { width: min(30rem, 92vw); }
/* A52: the quality report, a finding per player: the portrait, then the title of the award and the foreman's line. */
.pg-awards-title { margin: 0 0 0.5rem; font-size: 1.1rem; font-weight: 700; text-align: center; }
.pg-awards { display: grid; gap: 0.6rem; list-style: none; margin: 0; padding: 0; }
.pg-award { display: grid; grid-template-columns: auto 1fr; column-gap: 0.75rem; align-items: center; text-align: left; }
.pg-award > .pg-cast { grid-row: 1 / span 3; --pg-cast-h: 2.5rem; }
.pg-award > :not(.pg-cast) { grid-column: 2; }
.pg-award-who { color: var(--pg-text); font-size: 0.85rem; }
/* The title takes the character's colour; the line stays plain text, so nothing is told by colour alone. */
.pg-award-name { color: var(--pg-colour, var(--pg-text)); font-size: 1rem; }
.pg-award-line { color: var(--pg-text); font-size: 0.9rem; line-height: 1.3; }
.pg-award[aria-current="true"] > .pg-cast { border-radius: 0.5rem; outline: 2px solid var(--pg-text); outline-offset: 2px; }
/* !A52 */
/* A55: who won, and how, under the heading. */
.pg-end-verdict { margin: 0; max-width: min(30rem, 92vw); color: var(--pg-text); font-size: 1rem; line-height: 1.3; text-align: center; }
.pg-end-wait { margin: 0; font-size: 1.25rem; text-align: center; }
.pg-end-actions { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: center; }
.pg-end-actions .pg-entry { min-width: 9rem; }
@media (max-height: 30rem) {
    .pg-end { gap: 0.5rem; padding: 0.5rem 1rem 0.75rem; }
    .pg-end .pg-title { font-size: 1.25rem; }
    .pg-score { font-size: 2rem; }
    .pg-end-actions .pg-go { width: 3.5rem; height: 3.5rem; font-size: 1.5rem; }
}
/* !A34 */
/* A31 hud */
/* The round HUD: a bar over the top of the stage (timer, score strip, time scale), the shrink warning under it, the count in the middle. Nothing in it takes a tap. */
.pg-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.pg-hud-slot { display: contents; }
.pg-hud { position: absolute; inset: 0; display: grid; grid-template-rows: auto auto; align-content: start; justify-items: center; gap: 0.4rem; box-sizing: border-box; padding: 0.5rem; pointer-events: none; }
.pg-hud-bar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.4rem 0.6rem; max-width: 100%; }
.pg-hud-timer, .pg-hud-strip, .pg-hud-scale { border-radius: 1rem; background: rgb(16 19 28 / 0.82); color: #f2f3f7; line-height: 1.2; }
.pg-hud-timer { min-width: 2.6rem; padding: 0.25rem 0.7rem; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }
.pg-hud-timer[data-low="true"] { color: #ffd23f; box-shadow: inset 0 0 0 2px #ffd23f; }
.pg-hud-strip { display: flex; gap: 0.9rem; list-style: none; margin: 0; padding: 0.25rem 0.8rem; }
.pg-hud-chip { display: flex; align-items: center; gap: 0.4rem; font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.pg-hud-chip > .pg-dot { width: 1rem; height: 1rem; }
/* "You" is the white ring of the dot and the word, never the colour. */
.pg-hud-chip[aria-current="true"] > .pg-dot { outline-width: 2px; outline-offset: 2px; }
.pg-hud-you { order: 1; font-size: 0.8rem; font-weight: 400; }
.pg-hud-scale { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.7rem; font-size: 0.9rem; }
.pg-hud-scale-mark { font-weight: 700; }
.pg-hud-scale[data-warp="slow"] { color: #3ec1d3; }
.pg-hud-scale[data-warp="fast"] { color: #ff9f43; }
/* A55: the caption of a sudden death, over the arena for the whole round; the chips of those who watch are greyed. */
.pg-hud-sudden { display: grid; gap: 0.15rem; justify-items: center; margin: 0; padding: 0.4rem 0.9rem; max-width: min(30rem, 92vw); border-radius: 1rem; background: rgba(16, 19, 28, 0.88); border: 2px solid #ffd23f; color: var(--pg-text); text-align: center; }
.pg-hud-sudden:empty { display: none; }
.pg-hud-sudden-title { font-size: 1.1rem; font-weight: 700; }
.pg-hud-sudden-rule { font-size: 0.9rem; font-weight: 400; line-height: 1.3; }
.pg-hud-chip[data-watching] { opacity: 0.6; }   /* A62: 0.6, not 0.45: its name reads at 4.5:1 on the plate (3.34 before) */
.pg-hud-chip[data-watching] > .pg-cast { filter: grayscale(1); }
/* !A55 */
.pg-hud-warn { margin: 0; padding: 0.35rem 0.9rem; border-radius: 1rem; background: #ffd23f; color: #10131c; font-size: 1rem; font-weight: 700; text-align: center; }
.pg-count { position: absolute; inset: 0; display: grid; place-items: center; }
.pg-count-n { font-size: min(34vmin, 11rem); font-weight: 800; line-height: 1; color: #f2f3f7; text-shadow: 0 0 0.1em #10131c, 0 0.04em 0.25em #10131c; animation: pg-count-in 0.5s ease-out both; }
[data-count="go"] .pg-count-n { font-size: min(20vmin, 7rem); color: #ffd23f; }
@keyframes pg-count-in {
    from { transform: scale(1.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
/* The first-round hints (A29) sit under the bar. */
.pg-stage .pg-hints { top: 5.5rem; }
/* The scores have their own screen (A34). */
[data-phase="scores"] .pg-hud { display: none; }
/* Reduced motion: the numbers change, nothing zooms. */
:root[data-pg-motion="reduce"] .pg-count-n { animation: none; }
@media (prefers-reduced-motion: reduce) {
    :root:not([data-pg-motion="full"]) .pg-count-n { animation: none; }
}
/* !A31 */
/* A37 cast */
/* A seat's character (view/portrait.js): its still portrait over its seat mark, one pip per seat number. The size is the portrait's height. */
.pg-cast { --pg-cast-h: 4.5rem; display: inline-grid; justify-items: center; gap: 0.25rem; }
.pg-portrait { display: block; width: calc(var(--pg-cast-h) * 84 / 98); height: var(--pg-cast-h); }
/* The seat mark, besides colour: light pips with an ink line, the same on every background. */
.pg-pips { display: flex; justify-content: center; gap: 0.2rem; }
.pg-pip { width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--pg-text); box-shadow: 0 0 0 1px var(--pg-ink); }
/* The lobby card: the character's name under the seat. */
.pg-seat-cast { color: var(--pg-muted); font-size: 0.85rem; text-align: center; }
/* A player that joins at the next round (A28): no colour, faded; the silhouette and the pips still tell the seat. */
.pg-seat[data-waiting] > .pg-cast, .pg-late .pg-cast { filter: grayscale(1); }
.pg-seat[data-waiting] > .pg-cast, .pg-seat[data-waiting] > .pg-seat-cast { opacity: 0.45; }
.pg-late .pg-cast { --pg-cast-h: 2.5rem; }
/* The score strip: small, so the pips under the portrait carry the seat mark. */
.pg-hud-chip > .pg-cast { --pg-cast-h: 2rem; gap: 0.1rem; }
.pg-hud-chip .pg-pips { gap: 0.15rem; }
.pg-hud-chip .pg-pip { width: 0.3rem; height: 0.3rem; }
/* The results. */
.pg-score > .pg-cast { --pg-cast-h: 4rem; }
/* "You" is a light ring and the word, never the colour. */
.pg-hud-chip[aria-current="true"] > .pg-cast, .pg-score[aria-current="true"] > .pg-cast { border-radius: 0.5rem; outline: 2px solid var(--pg-text); outline-offset: 2px; }
@media (max-height: 30rem) {
    .pg-score > .pg-cast { --pg-cast-h: 2.5rem; }
}
/* !A37 */
/* A40 choice */
/* The lobby card: the name the host drew for the player, over the words of its character. */
.pg-seat-label { font-weight: 700; }
/* The character choice: four buttons under the cards. Mine is ringed and says "yours"; one of another player is dashed, grey, and says "taken". */
.pg-picks { display: grid; justify-items: center; gap: 0.5rem; box-sizing: border-box; width: min(34rem, 96vw); }
.pg-picks[hidden] { display: none; }
.pg-picks-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.pg-pick-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; }
.pg-pick { display: grid; justify-items: center; align-content: start; gap: 0.2rem; box-sizing: border-box; width: 5.2rem; min-height: 6.5rem; padding: 0.5rem 0.3rem; border: 2px solid #5b6787; border-radius: 1rem; background: #232a3d; color: var(--pg-text); font: inherit; font-size: 0.85rem; cursor: pointer; }
.pg-pick > .pg-cast { --pg-cast-h: 3rem; }
.pg-pick:hover:not(:disabled) { border-color: var(--pg-text); }
.pg-pick:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.pg-pick[aria-pressed="true"] { border-color: var(--pg-text); background: #2e3750; cursor: default; }
.pg-pick:disabled { border-style: dashed; cursor: not-allowed; }
.pg-pick:disabled > .pg-cast { filter: grayscale(1); opacity: 0.45; }
.pg-pick:disabled > .pg-pick-name { opacity: 0.6; }
.pg-pick-state { min-height: 1.2em; color: var(--pg-muted); font-size: 0.8rem; }
.pg-pick[aria-pressed="true"] > .pg-pick-state { color: var(--pg-text); font-weight: 700; }
/* A choice the host refused. */
.pg-pick-status { margin: 0; min-height: 1.4em; color: #ffd23f; text-align: center; }
/* The score strip: the name beside the portrait, on one line. */
.pg-hud-name { max-width: 5.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; font-weight: 400; }
/* The results: the name and the character, under the portrait. */
.pg-score-who:not(.pg-sr) { color: var(--pg-text); font-size: 1rem; font-weight: 400; line-height: 1.2; text-align: center; }
/* A phone: the chip stacks (the portrait and the score, the name under them), so four players fit the width. */
@media (max-width: 34rem) {
    .pg-pick { width: 4.6rem; }
    .pg-hud-strip { gap: 0.5rem; padding: 0.25rem 0.5rem; }
    .pg-hud-chip { display: grid; grid-template-columns: auto auto; justify-content: center; justify-items: center; align-items: center; gap: 0 0.25rem; }
    .pg-hud-name { grid-column: 1 / -1; grid-row: 2; max-width: 4rem; font-size: 0.75rem; }
    .pg-hud-you { grid-column: 1 / -1; grid-row: 3; font-size: 0.7rem; }
}
/* !A40 */
/* A41 finale */
/* The podium of the end screen (view/end.js): the round's players on the steps of their ranks, each as its posed
   portrait. A picture of the list under it, hidden from a screen reader. A tie shares a step. */
.pg-podium { --pg-cast-h: 4.5rem; display: flex; justify-content: center; align-items: flex-end; margin-bottom: -0.25rem; }
.pg-podium[hidden] { display: none; }
.pg-place { display: grid; justify-items: center; width: 4.75rem; }
/* The footprint stands on the step. */
.pg-place > .pg-cast { position: relative; z-index: 1; margin-bottom: -0.5rem; }
/* A posed portrait has a higher ceiling (FINALE_BOX of view/portrait.js): the same scale as a plain one. */
.pg-portrait[data-pose] { height: calc(var(--pg-cast-h) * 110 / 98); }
/* A step: the higher the better. The winner's is the anvil, one heat step hotter. */
.pg-step { box-sizing: border-box; display: grid; place-items: end center; width: 100%; height: calc(4rem - var(--pg-step, 0) * 1rem); padding-bottom: 0.15rem; border: 2px solid var(--pg-anvil-edge); border-bottom: 0; border-radius: 0.3rem 0.3rem 0 0; background: var(--pg-anvil-top); color: var(--pg-text); font-size: 1rem; font-weight: 700; line-height: 1; }
.pg-place[data-pose="win"] > .pg-step { border-color: var(--pg-ember); background: linear-gradient(var(--pg-anvil-top), var(--pg-anvil-side)); box-shadow: 0 -0.5rem 1.4rem -0.5rem var(--pg-ember); }
/* A tie: one step under two players, with no line between them. */
.pg-place[data-joined] > .pg-step { width: calc(100% + 2px); margin-left: -2px; border-left: 0; border-top-left-radius: 0; }
.pg-place:has(+ .pg-place[data-joined]) > .pg-step { border-top-right-radius: 0; }
/* "You" is a light ring, never the colour. */
.pg-place[data-you] > .pg-cast { border-radius: 0.5rem; outline: 2px solid var(--pg-text); outline-offset: -1px; }
/* What moves: a winner hops a few times, the others shrug once or twice. The poses themselves are stills. */
@keyframes pg-cheer { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-0.6rem); } }
@keyframes pg-shrug { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-4deg); } }
.pg-place[data-pose="win"] .pg-portrait { animation: pg-cheer 0.6s ease-out 0.2s 6; }
.pg-place[data-pose="lose"] .pg-portrait { transform-origin: 50% 85%; animation: pg-shrug 1.6s ease-in-out 0.6s 2; }
/* Reduced motion: one still pose each. */
:root[data-pg-motion="reduce"] .pg-place .pg-portrait { animation: none; }
@media (prefers-reduced-motion: reduce) {
    :root:not([data-pg-motion="full"]) .pg-place .pg-portrait { animation: none; }
}
/* A low screen (a phone lying down): a smaller podium. */
@media (max-height: 30rem) {
    .pg-podium { --pg-cast-h: 2.75rem; }
    .pg-place { width: 3.5rem; }
    .pg-place > .pg-cast { margin-bottom: -0.3rem; }
    .pg-step { height: calc(2.2rem - var(--pg-step, 0) * 0.5rem); font-size: 0.8rem; }
}
/* Six characters to choose among: the group stays inside the lobby's padding; on a phone, two rows of three. */
.pg-picks { width: min(34rem, calc(100vw - 2rem)); }
@media (max-width: 34rem) {
    .pg-pick-list { max-width: 15.5rem; }
}
/* !A41 */
/* A42 effects */
/* The effects layer of the arena (view/effects.js): outlines in the colour of their player (`color`), never a target of the pointer. */
[data-part="effects"] { pointer-events: none; }
[data-part="effects"] > path { fill: none; stroke: currentColor; stroke-width: var(--pg-stroke-mark); stroke-linecap: round; }
[data-fx="fall-mark"] { stroke-width: var(--pg-stroke-ring); }
/* !A42 */

/* A47 recording */
/* The sounds of a lobby: a button and a count. */
.pg-recorder { display: grid; gap: 0.5rem; justify-items: center; }
.pg-rec-line { margin: 0; max-width: min(32rem, 92vw); line-height: 1.45; text-align: center; }
.pg-recorder .pg-rec-line { color: #aab3cc; font-size: 1rem; }
.pg-rec-again { min-width: 9rem; }
/* The recording step: a dialog over the whole page, the lobby or the scores under it. */
.pg-recstep { position: fixed; inset: 0; z-index: 30; box-sizing: border-box; display: grid; gap: 1.25rem; align-content: center; justify-items: center; padding: 1.5rem 1rem; overflow-y: auto; background: #10131c; color: #f2f3f7; touch-action: pan-y; user-select: text; }
.pg-recstep .pg-title { font-size: 1.75rem; text-align: center; }
.pg-rec-part { display: grid; gap: 1rem; justify-items: center; }
.pg-rec-head { display: grid; gap: 0.5rem; justify-items: center; }
.pg-rec-count { color: #aab3cc; font-size: 1rem; letter-spacing: 0.04em; }
.pg-recstep #pg-rec-prompt { font-size: 1.25rem; }
.pg-recstep .pg-meter { width: min(18rem, 80vw); height: 0.9rem; border-radius: 0.45rem; border: 1px solid #5b6787; }
.pg-recstep [data-testid="pg-rec-status"] { min-height: 1.45em; color: #ffd23f; }
.pg-rec-acts { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }
.pg-recstep .pg-entry:disabled { opacity: 0.35; cursor: default; }
.pg-recstep [data-testid="pg-rec-record"], .pg-recstep [data-testid="pg-rec-begin"], .pg-recstep [data-testid="pg-rec-retry"] { border-color: #f2f3f7; background: #f2f3f7; color: #10131c; font-weight: 700; }
.pg-recstep[data-state="recording"] [data-testid="pg-rec-record"] { border-color: #ff5d73; background: #ff5d73; }
@media (max-width: 30rem), (max-height: 30rem) {
    .pg-recstep { gap: 0.75rem; padding: 1rem 0.75rem; align-content: start; }
    .pg-recstep .pg-title { font-size: 1.35rem; }
    .pg-rec-acts { display: grid; width: 100%; justify-items: stretch; }
    .pg-recstep .pg-entry { min-width: 0; width: min(20rem, 100%); justify-self: center; }
}
/* !A47 */

/* A48 mix */
/* !A48 */

/* A58 host tools */
/* On the host's card of each guest, under its mix: remove (two taps: the first one asks, in red). The lock under the invite. */
.pg-tools { display: flex; gap: 0.3rem; margin-top: 0.15rem; }
.pg-tool { box-sizing: border-box; min-width: 2.75rem; height: 2.75rem; padding: 0 0.4rem; border: 2px dashed #5b6787; border-radius: 0.75rem; background: #1a1f2d; color: #aab3cc; font: inherit; font-size: 1.15rem; line-height: 1; cursor: pointer; }
.pg-tool:focus-visible, .pg-lock:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.pg-tool-remove[data-armed] { border-style: solid; border-color: #ff5d73; background: #ff5d73; color: #10131c; font-size: 0.9rem; font-weight: 700; }
.pg-host-tools { display: grid; justify-items: center; gap: 0.35rem; }
.pg-lock[aria-pressed="true"] { border-color: #ffd23f; color: #ffd23f; }
.pg-lock-note, .pg-tools-status { margin: 0; max-width: min(30rem, 92vw); color: #aab3cc; font-size: 0.95rem; text-align: center; }
.pg-tools-status:empty { display: none; }
/* !A58 */

/* A43 particles */
/* The particles of the effects layer (view/effects.js): small flat shapes, filled, with no line. Dust in the colour of its player; sparks and embers in the forge's. */
[data-part="effects"] > [data-fx="dash-dust"] { fill: currentColor; stroke: none; }
[data-part="effects"] > [data-fx="hit-sparks"] { fill: var(--pg-spark); stroke: none; }
[data-part="effects"] > [data-fx="fall-embers"] { fill: var(--pg-ember); stroke: none; }
/* !A43 */

/* A45 captions */
/* The captions of the arena (view/effects.js): one word per sound, in the colour of its player on an ink edge, so it reads on the anvil, the forge and the backdrop. One size: 40 units of the 1000 of the scene, 15 px on a phone 375 px wide. Never a target of the pointer or of a selection. */
[data-part="captions"] { pointer-events: none; user-select: none; -webkit-user-select: none; }
[data-part="captions"] > text { font: 800 40px system-ui, sans-serif; text-anchor: middle; fill: currentColor; stroke: var(--pg-ink); stroke-width: 9px; stroke-linejoin: round; paint-order: stroke; }
/* !A45 */

/* A53 arena events */
/* The bellows gust (view/effects.js). Its arrow lies on the anvil, white-hot, so it reads on the live face, on the cooled part and over the danger band; its wind is pale streaks; its two words are nobody's colour. Nothing is animated here: the arrow beats by the ticks of the round, and keeps still with reduced motion. */
[data-part="effects"] > [data-fx="gust-arrow"] { stroke: var(--pg-heat-white); stroke-width: var(--pg-stroke-ring); stroke-linejoin: round; }
[data-part="effects"] > [data-fx="gust-wind"] { stroke: var(--pg-text); }
[data-part="captions"] > [data-fx^="gust-"] { color: var(--pg-heat-white); }
/* The hammer: its shadow on the centre, a dark disc whose size and depth come from the ticks; the rings of its strike, white-hot; its two words. */
[data-part="effects"] > [data-fx="hammer-shadow"] { fill: var(--pg-backdrop); stroke: none; }
[data-part="effects"] > [data-fx="hammer-ring"] { stroke: var(--pg-heat-white); stroke-width: var(--pg-stroke-ring); }
[data-part="captions"] > [data-fx^="hammer"] { color: var(--pg-heat-white); }
/* !A53 */

/* A50 replay */
/* The banner of the replay (view/screens.js): what it shows, under the score strip and its names. On the ticks of the slow beat (root[data-beat]) it stands out: colours only, no motion, so reduced motion has nothing to turn off. */
.pg-replay-banner { display: none; }
[data-phase="replay"] .pg-replay-banner:not([hidden]) { display: block; position: absolute; inset: 4.5rem 0 auto 0; width: fit-content; max-width: calc(100% - 2rem); margin: 0 auto; padding: 0.3rem 0.9rem; border-radius: 1rem; background: rgb(16 19 28 / 0.82); color: #ffd23f; font-weight: 700; line-height: 1.25; text-align: center; pointer-events: none; }
[data-phase="replay"][data-beat] .pg-replay-banner:not([hidden]) { background: #ffd23f; color: #10131c; }
/* A narrow screen stacks the names of the strip under its portraits: the banner goes a line lower. */
@media (max-width: 480px) { [data-phase="replay"] .pg-replay-banner:not([hidden]) { top: 5.9rem; } }
/* !A50 */

/* A62 accessibility */
/* Reduced motion, for every rule at once (the Settings switch, <html data-pg-motion="reduce">, or the system's
   preference when the switch does not say "full"): nothing the style sheet animates or eases moves, the rules of
   the rows that came before included and any rule to come. What the scene and the transitions move is the
   scripts' (view/arena.js, view/effects.js, scene/pose.js, view/transitions.js), off by the same switch. */
:root[data-pg-motion="reduce"] *, :root[data-pg-motion="reduce"] *::before, :root[data-pg-motion="reduce"] *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
@media (prefers-reduced-motion: reduce) {
    :root:not([data-pg-motion="full"]) *, :root:not([data-pg-motion="full"]) *::before, :root:not([data-pg-motion="full"]) *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* A still drawing still tells its event: the frames the animations only reached are shown at rest. The shrink:
   the outer part of the floor is gone (dashed, dark); the gust: its arrow; the hammer: its shadow on the centre;
   the sudden death: the other blob over the edge, faded. */
:root[data-pg-motion="reduce"] [data-draw="shrink"] .pg-draw-floor { border-style: dashed; box-shadow: inset 0 0 0 1.1em #10131c; }
:root[data-pg-motion="reduce"] .pg-draw-arrow { opacity: 1; }
:root[data-pg-motion="reduce"] .pg-draw-shadow { opacity: 0.9; }
:root[data-pg-motion="reduce"] [data-draw="sudden"] .pg-draw-blob[data-role="other"] { opacity: 0.45; transform: translateX(1.4em) scale(0.7); }
@media (prefers-reduced-motion: reduce) {
    :root:not([data-pg-motion="full"]) [data-draw="shrink"] .pg-draw-floor { border-style: dashed; box-shadow: inset 0 0 0 1.1em #10131c; }
    :root:not([data-pg-motion="full"]) .pg-draw-arrow { opacity: 1; }
    :root:not([data-pg-motion="full"]) .pg-draw-shadow { opacity: 0.9; }
    :root:not([data-pg-motion="full"]) [data-draw="sudden"] .pg-draw-blob[data-role="other"] { opacity: 0.45; transform: translateX(1.4em) scale(0.7); }
}
/* Besides colour: a toggle that is on says so by a mark, not by its edge's colour alone (Settings' fullscreen,
   the lock, the number of bots and their level); the icon-only fullscreen control by a second ring. The mark is
   hidden from a screen reader, which hears aria-pressed. */
.pg-entry[aria-pressed="true"]::after { content: "\00a0\2713" / ""; }
.pg-full[aria-pressed="true"] { box-shadow: inset 0 0 0 2px currentColor; }
/* Who watches a sudden death: a dashed ring on the portrait (the dashed "not in play" of the lobby's next-round
   seats and the taken picks), besides the grey; a screen reader hears it on the chip (view/hud.js). */
.pg-hud-chip[data-watching] > .pg-cast { border-radius: 0.5rem; outline: 2px dashed var(--pg-muted); outline-offset: 2px; }
/* !A62 */

/* A54: the practice setup. The number of bots is three round buttons, the chosen one lit; a bot card carries
   the bot mark, a dashed plate, so it is told from the "host" and "you" marks by more than its word. */
.pg-practice .pg-title { margin: 0; }
.pg-bots { display: grid; justify-items: center; gap: 0.5rem; }
.pg-bots-list { display: flex; gap: 0.6rem; }
.pg-bots-n { min-width: 3.5rem; padding: 0.5rem; font-weight: 700; }
.pg-bots-n[aria-pressed="true"] { border-color: var(--pg-text); background: #2e3750; }
.pg-level-n { min-width: 6.5rem; font-weight: 400; }
.pg-level-n[aria-pressed="true"] { font-weight: 700; }
.pg-bot-mark { border-style: dashed; color: var(--pg-text); }
/* !A54 */

/* A60 phone */
/* A phone upright or on its side, in or out of fullscreen (plan A60). The page fills the dynamic viewport (a
   mobile browser's bars come and go) and its content stays inside the safe area (the notch, the rounded
   corners, the home bar: `viewport-fit=cover` in index.html), in every screen. A screen taller than the
   phone scrolls by itself (the page never does). The orientation is never locked. */
main { box-sizing: border-box; height: 100dvh; grid-template: minmax(0, 1fr) / minmax(0, 1fr);
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px); }
main > .pg-menu, main > .pg-lobby { box-sizing: border-box; max-width: 100%; max-height: 100%; overflow-y: auto; }
/* Pinch-zoom is never taken from a menu (accessibility): the screens that scroll pan and zoom. */
.pg-home, .pg-howto, .pg-lobby, .pg-end, .pg-recstep, main > .pg-menu { touch-action: pan-y pinch-zoom; }
.pg-recstep { padding: max(1.5rem, env(safe-area-inset-top, 0px)) max(1rem, env(safe-area-inset-right, 0px)) max(1.5rem, env(safe-area-inset-bottom, 0px)) max(1rem, env(safe-area-inset-left, 0px)); }
/* The panels over the arena (the scores, the intermission) are fixed to the viewport: their own insets. */
.pg-end { max-height: 100dvh; padding-left: max(1rem, env(safe-area-inset-left, 0px)); padding-right: max(1rem, env(safe-area-inset-right, 0px)); padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px)); }
@media (max-height: 30rem) { .pg-end { padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px)); } }
/* The round: the stage fills the safe area; the arena is the largest square in it (container units: the
   stage is the container). Around the arena, the backdrop up to the screen's edges. */
main:is([data-phase="round"], [data-phase="replay"], [data-phase="intermission"], [data-phase="scores"]) { background: var(--pg-backdrop); }
.pg-stage { width: 100%; height: 100%; container-type: size; }
/* The stage holds the focus of a round (A66 B1) for the game keys: a container, not a control, so no ring. */
.pg-stage:focus { outline: none; }
.pg-arena > svg { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); }
/* No zoom, no pull-to-refresh, no double-tap zoom, no text selection or callout while a round runs: the stage
   (and the intermission's panel over it) takes every touch, and the page does not overscroll. */
main:is([data-phase="round"], [data-phase="replay"], [data-phase="intermission"]) > :is(.pg-stage, .pg-end) { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
html:has(> body > main:is([data-phase="round"], [data-phase="replay"], [data-phase="intermission"])),
html:has(> body > main:is([data-phase="round"], [data-phase="replay"], [data-phase="intermission"])) > body { overscroll-behavior: none; }
/* The touch controls, in the stage's units. Upright: under the arena, the pad left, the button right; on a short
   screen (a browser's bars showing) they shrink to the margin under the arena, never under 6.5rem and 4.5rem. */
.pg-pad { width: max(6.5rem, min(38cqw, 30cqh, calc(50cqh - 50cqw - 1rem))); }
.pg-hold { width: max(4.5rem, min(24cqw, 18cqh, calc((50cqh - 50cqw - 1rem) * 0.62))); }
/* On its side: beside the arena, low, as upright (owner ruling 2026-11-13: the thumbs rest at the bottom, not
   halfway up the screen), each as large as the margin by the arena lets it be. */
@media (pointer: coarse) and (orientation: landscape) {
    .pg-touch { align-items: flex-end; padding: 0 0.75rem 1rem; inset: 0; }
    .pg-pad { width: clamp(5.5rem, calc(50cqw - 50cqh - 1.5rem), 52cqh); }
    .pg-hold { width: clamp(4rem, calc((50cqw - 50cqh - 1.5rem) * 0.66), 34cqh); }
}
/* Left-handed (Settings, <html data-pg-hand="left">): the pad and the button change sides, in the round and
   in the drawing of How to play. */
:root[data-pg-hand="left"] .pg-touch { flex-direction: row-reverse; }
:root[data-pg-hand="left"] .pg-draw-pad { left: auto; right: 0.5em; }
:root[data-pg-hand="left"] .pg-draw-hold { right: auto; left: 0.6em; }
/* The fullscreen control (view/screens.js): a touch screen only, where the browser has fullscreen; the top
   right corner of the lobby and of the arena, away from the practice's ✕ (top left) and the touch controls.
   Its mark is four corners, drawn here. */
.pg-full { display: none; }
@media (pointer: coarse) {
    .pg-full { display: grid; place-items: center; position: absolute; top: 0.5rem; right: 0.5rem; z-index: 2; width: 2.75rem; height: 2.75rem; padding: 0; border-radius: 50%; border: 2px solid #5b6787; background: rgb(16 19 28 / 0.82); color: #f2f3f7; cursor: pointer; }
    .pg-lobby > .pg-full { position: fixed; top: calc(env(safe-area-inset-top, 0px) + 0.5rem); right: calc(env(safe-area-inset-right, 0px) + 0.5rem); }
    /* The bar of the HUD keeps clear of the corner controls; the replay's cue moves under the control. */
    .pg-stage:has(> .pg-full, > .pg-quit) .pg-hud { padding-inline: 3.5rem; }
    .pg-stage:has(> .pg-full) .pg-replay { top: 3.75rem; right: 0.75rem; }
    /* The scores are a panel over the arena: the touch controls go, as in the replay. */
    [data-phase="scores"] .pg-touch { display: none; }
}
/* Upright, that bar wraps on three lines (about 9.6rem): the first-round hints and the replay's banner go under it. */
@media (pointer: coarse) and (orientation: portrait) {
    .pg-stage:has(> .pg-full, > .pg-quit) .pg-hints { top: 10rem; }
    [data-phase="replay"] .pg-stage:has(> .pg-full, > .pg-quit) .pg-replay-banner:not([hidden]) { top: 10rem; }
}
.pg-full[aria-pressed="true"] { border-color: #3ec1d3; }
.pg-full:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
.pg-full-mark { width: 1.1rem; height: 1.1rem; background:
    linear-gradient(currentColor, currentColor) left top / 0.4rem 2px no-repeat, linear-gradient(currentColor, currentColor) left top / 2px 0.4rem no-repeat,
    linear-gradient(currentColor, currentColor) right top / 0.4rem 2px no-repeat, linear-gradient(currentColor, currentColor) right top / 2px 0.4rem no-repeat,
    linear-gradient(currentColor, currentColor) left bottom / 0.4rem 2px no-repeat, linear-gradient(currentColor, currentColor) left bottom / 2px 0.4rem no-repeat,
    linear-gradient(currentColor, currentColor) right bottom / 0.4rem 2px no-repeat, linear-gradient(currentColor, currentColor) right bottom / 2px 0.4rem no-repeat; }
/* !A60 */
/* A59 dead ends */
/* The host's question before it closes a room with players in it: the way out that asks reads as a warning (the colours of A58's ✕). */
.pg-entry[data-armed] { border-color: #ff5d73; background: #ff5d73; color: #10131c; font-weight: 700; }
.pg-lobby > .pg-back[data-armed]::before { content: none; }
/* The host's note when a newer page could not join: the line and its Reload, under the Back control. */
.pg-host-outdated { display: grid; justify-items: center; gap: 0.35rem; justify-self: center; max-width: min(30rem, 92vw); }
.pg-host-outdated[hidden] { display: none; }
.pg-host-outdated .pg-lobby-note { margin: 0; color: #ffcf6b; text-align: center; }
/* The error screen: the door's shape (A33), its line in the colour of a failure. */
.pg-fault .pg-door-hint { color: #ffb3bd; }
/* !A59 */
/* A57 sound */
/* The sound toggle (view/mute.js, owner ruling 2026-11-14): "sound off" in the lobby, on the HUD's bar and under the
   results, one state. Pressed, it says so by a mark besides its colour (A62): the ♫ struck through, the ✓ of an
   entry. The HUD takes no tap but this one. */
/* On the HUD's bar: ♫ on the plate, struck through and red when the sound is off. */
.pg-hud-sound { pointer-events: auto; box-sizing: border-box; width: 2.25rem; height: 2.25rem; padding: 0; border: 2px solid #5b6787; border-radius: 1rem; background: rgb(16 19 28 / 0.82); color: #f2f3f7; font: inherit; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.pg-hud-sound:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }
.pg-hud-sound[aria-pressed="true"] { border-color: #ff5d73; color: #ff5d73; text-decoration: line-through; text-decoration-thickness: 0.14em; }
/* In the lobby and under the results: an entry, with its ✓ when the sound is off (A62). */
.pg-sound { justify-self: center; }
/* !A57 */
/* A61 host away */
/* The banner of a guest whose host is in the background or silent (view/away.js): over the arena, under the HUD's
   bar, on the HUD's plate with a yellow edge; a stalled host's Home beside the line. It takes no tap but Home. */
.pg-away { position: absolute; inset: 7.5rem 0 auto 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 0.9rem; box-sizing: border-box; width: fit-content; max-width: calc(100% - 2rem); margin: 0 auto; padding: 0.5rem 1rem; border: 2px solid #ffd23f; border-radius: 1rem; background: rgb(16 19 28 / 0.82); color: #f2f3f7; font-weight: 700; line-height: 1.3; text-align: center; pointer-events: none; }
.pg-away[hidden], .pg-away-home[hidden] { display: none; }
.pg-away-home { pointer-events: auto; min-height: 2.75rem; padding: 0.3rem 1rem; border: 2px solid #f2f3f7; border-radius: 0.75rem; background: #232a3d; color: #f2f3f7; font: inherit; cursor: pointer; }
.pg-away-home:focus-visible { outline: 3px solid #ffd23f; outline-offset: 2px; }
@media (max-width: 480px) { .pg-away { top: 6.5rem; font-size: 0.95rem; } }
/* !A61 */
/* Legal footer */
/* The Appropriate Legal Notices of public/index.html (BL-3032, PGL-9): a direct child of <body> after <main>,
   in normal flow. <main> keeps its full viewport, so the footer sits under the first screen and is reached by
   scrolling the page. The forge palette: muted text #b8ada0 (8.71 on the backdrop), links #f5efe6 (16.80). */
#legal { padding: 1rem; font-size: 0.8rem; line-height: 1.4; color: #b8ada0; background: var(--pg-backdrop); overflow-wrap: anywhere; }
#legal a { color: #f5efe6; text-decoration: underline; }
#legal a:focus-visible { outline: 3px solid #ffd23f; outline-offset: 3px; }
/* !Legal footer */
