/* Interactive mode (public/js/player/interactive.js; art/ui/web/watch/desktop2.html section C = d2-c-choice.png, new/new-player.html = new-player.png; spec 4.1, 8.1).
   Two layers the size of the picture's frame (`.pl-cbox` is sized exactly as `.pl-stage` is: the whole screen on a phone, the tall 9:16 box of a wide window): the PINS' layer under the
   controls (a control wins any overlap with a pin, and a tap on a pin is a pick, never the picture's play/pause tap under it) and the NOTES' layer over them (the question, the
   outcome's line and the chip; the controls' shades must not dim them). A pin is laid where the script says (`--cx`, `--cy`: the fractions of the DRAWN picture, the one place the
   layer uses a coordinate); everything else flows. Sizes are the mockups' at their own width (the pins' em is 20 px at a 506 px picture and shrinks with it: a phone is 390), so a
   mockup's numbers come out exactly at its own width. Only transform and opacity move: the pulse is a keyframe on a transform, the glow and the gold fill are pre-drawn layers whose
   opacity moves (a box-shadow is paint), the dip is an opacity. The pulse stands still under the debug entries' hold and under reduced motion. */
.pl-pins, .pl-notes { position: absolute; inset: 0; display: flex; justify-content: center; pointer-events: none; }
.pl-pins[hidden], .pl-notes[hidden] { display: none; }
.pl-cbox { position: relative; width: 100%; height: 100%; }
@container pl (width >= 700px) { .pl-cbox { width: auto; aspect-ratio: 9 / 16; max-width: 100%; } }          /* the stage's own rule (player.css) */
.pl-cin { position: absolute; inset: 0; container: cb / size; }                                                /* the box's size, for the em of the pins and the question */
/* the call's scrim (interactive.js): the first thing in the pins' layer, so the size of the drawn picture and under the pins, the controls, the question and the bar. Dark enough that a choice
   card drawn into the picture no longer reads as a second set of words, see-through enough that the scene is still faintly there. Its opacity is the call's fade. */
.pl-pins { --pl-call-scrim: rgba(6, 6, 8, .88); }
.pl-call-scrim { position: absolute; inset: 0; background: var(--pl-call-scrim); opacity: 0; pointer-events: none; }

/* ---- the dip: a black over the picture that hides a seek ---------------------------------------------------------------------------------------------------------------------- */
.pl-dip { position: absolute; inset: 0; background: #000; opacity: 0; pointer-events: none; }

/* ---- the question and YOUR CALL (d2-c-choice.png: top 108, 46 px Baloo 2 800, the row 14 px under it) -------------------------------------------------------------------------- */
.pl-ask { position: absolute; left: 0; right: 0; top: calc(var(--pl-top) + 84px); text-align: center; color: #fff; pointer-events: none; }        /* a phone: under the top row */
.pl-ask[hidden] { display: none; }
@container pl (width >= 700px) { .pl-ask { top: 108px; } }
.pl-ask-q { font: 800 min(46px, 9.087cqw) / .95 var(--display); text-wrap: balance; padding: 0 .3em; }
.pl-ask-call { display: inline-flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 14px; font-weight: 700; letter-spacing: .14em; color: #e4e4e7; font-variant-numeric: tabular-nums; }
.pl-ask-bar { display: block; width: 120px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .25); overflow: hidden; }
.pl-ask-fill { display: block; width: 100%; height: 100%; background: var(--gold); transform-origin: 0 50%; }

/* ---- a pin (d2-c-choice.png: a capsule with its number, a stem and a dot; 20 px at the mockup's 506 px picture) ----------------------------------------------------------------- */
.pl-pin-hit { position: absolute; left: var(--cx, 50%); top: var(--cy, 50%); translate: -50% -50%; width: max-content; max-width: 80cqw; font-size: min(20px, 3.953cqw); }      /* (an absolute box shrinks to what is left of its parent from its `left`: max-content keeps a label on one line unless it is wider than the picture allows) */
.pl-pin-hit[hidden] { display: none; }
.pl-pin { position: relative; display: block; margin: 0; padding: 0; border: 0; border-radius: 999px; background: none; color: #fff; font: inherit; cursor: pointer; pointer-events: auto; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pl-pin::after { content: ""; position: absolute; inset: -6px; }                                              /* a thumb's reach, with no box of its own */
.pl-pin:disabled { cursor: default; }
.pl-pin:focus-visible { outline: 2px solid var(--gold); outline-offset: 5px; }
.pl-pin-body { position: relative; display: flex; align-items: center; gap: .4em; padding: .3em .7em .3em .35em; border: .1em solid rgba(255, 255, 255, .75); border-radius: 999px; background: rgba(15, 15, 18, .88);
  font: 800 1em var(--display); white-space: nowrap; animation: pl-pulse var(--pin-pulse-ms) ease-in-out infinite; }
.pl-pin-label { position: relative; white-space: normal; text-wrap: balance; transition: color var(--fade-ms); }
.pl-pin-n { position: relative; display: grid; place-items: center; flex: none; box-sizing: border-box; width: 1.647em; height: 1.647em; border-radius: 50%; padding-top: .12em; font-size: .85em;          /* 28 px at 20 */
  transition: background-color var(--fade-ms), color var(--fade-ms); }
.pl-pin[data-n="1"] .pl-pin-n { background: var(--red); color: #fff; }
.pl-pin[data-n="2"] .pl-pin-n { background: var(--gold); color: #111; }
.pl-pin[data-state="picked"] .pl-pin-n { background: #111; color: var(--gold); }
.pl-pin[data-state="picked"] .pl-pin-label { color: var(--ink); }
/* the three layers a pin's states are drawn in, each pre-drawn and shown by its opacity: the gold ring and glow of a hover or a press, the gold fill of a pick, the ring of the pulse */
.pl-pin-fill, .pl-pin-glow, .pl-pin-halo { position: absolute; inset: -.1em; border-radius: inherit; pointer-events: none; opacity: 0; }
.pl-pin-fill { background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, var(--gold-lo)); }
.pl-pin-glow { border: .1em solid var(--gold); box-shadow: 0 0 0 .3em rgba(255, 197, 61, .25), 0 0 1.5em rgba(255, 197, 61, .45); }
.pl-pin-halo { border: .08em solid rgba(255, 255, 255, .55); animation: pl-halo var(--pin-pulse-ms) ease-out infinite; }
.pl-pin-stem { position: absolute; left: 50%; top: calc(100% - .4em); width: 2px; height: 3em; margin-left: -1px; background: rgba(255, 255, 255, .75); pointer-events: none; }
.pl-pin-dot { position: absolute; left: 50%; top: calc(100% + 2.6em); width: .6em; height: .6em; box-sizing: border-box; margin-left: -.3em; border: 2px solid #fff; border-radius: 50%; background: rgba(0, 0, 0, .4); pointer-events: none; }
.pl-pin-hit[data-flip="up"] .pl-pin-stem { top: auto; bottom: calc(100% - .4em); }                              /* a low pin hangs its stem upward: below it are the controls */
.pl-pin-hit[data-flip="up"] .pl-pin-dot { top: auto; bottom: calc(100% + 2.6em); }
.pl-pin-hit :is(.pl-pin-body, .pl-pin-halo) { animation-delay: calc(var(--pin-pulse-ms) * var(--i, 0) / var(--n, 1) * -1); }       /* the pins breathe evenly apart, the second half a breath behind the first (--i: its place, --n: how many) */
.pl-pin:disabled :is(.pl-pin-body, .pl-pin-halo) { animation: none; }                                          /* a pick is made: nothing breathes any more */
.pl[data-hold="true"] :is(.pl-pin-body, .pl-pin-halo) { animation: none; }                                     /* the debug entries hold a still frame: the gate measures it */
@keyframes pl-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(var(--pin-pulse-scale)); } }
@keyframes pl-halo { 0% { transform: scale(1); opacity: .4; } 100% { transform: scale(1.16); opacity: 0; } }

/* ---- the outcome: "YOU PICKED: ..." and the chip (new-player.png: the line at the top, centred on the picture; the chip 20 px from the picture's left, 81 px over the bar) -------- */
.pl-pickline { position: absolute; left: 50%; top: var(--row-cy, 41px); translate: -50% -50%; width: max-content; max-width: calc(100% - 24px); display: flex; align-items: center; gap: 8px; margin: 0; color: #fff; font: 800 16px var(--display); letter-spacing: .04em; white-space: nowrap; pointer-events: none; }
.pl-pickline[hidden] { display: none; }
.pl-pickline[data-row="below"] { top: calc(var(--row-bottom, 42px) + 14px); translate: -50% 0; white-space: normal; text-align: left; }      /* under the top row where the row leaves no room */
.pl-pickline-n { display: grid; place-items: center; flex: none; box-sizing: border-box; width: 22px; height: 22px; border-radius: 50%; padding-top: 1px; background: var(--gold); color: #111; font-size: 13px; letter-spacing: 0; }
.pl-chip { position: absolute; left: 20px; bottom: calc(var(--pl-bar-bottom) + 49px); display: flex; align-items: center; gap: 8px; margin: 0; padding: 8px 14px 7px 10px; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px;
  background: rgba(15, 15, 18, .9); color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; pointer-events: auto; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }        /* a phone: over the bar's cluster */
.pl-chip[hidden] { display: none; }
@container pl (width >= 700px) { .pl-chip { bottom: calc(var(--pl-bar-bottom) + 81px); } }
.pl-chip::after { content: ""; position: absolute; inset: -6px; }
.pl-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
.pl-chip-rw { display: grid; place-items: center; flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--red); }
.pl-chip-rw .pl-ic { width: 14px; height: 14px; }

/* ---- the Interactive switch in the phone's Parts drawer (the desktop's own is in the top row): in the drawer's head, between the title and the close ----------------------------------- */
.pl-drawer-head .pl-switch { margin-left: auto; margin-right: 14px; }

@media (prefers-reduced-motion: reduce) {
  .pl-pin-body, .pl-pin-halo { animation: none; }
}
