/* Game layer: the match HUD (thin timer ring, line-icon "?" and sound buttons, toggle switches), overlays, sheets,
   coach marks. Loaded after style.css and scenes.css; uses the same tokens. */

/* ---------- the game window's top strip (#gameTop, index.html) ----------
   The page's top bar is the same as on every page; everything about the match sits INSIDE the game window, over the
   top of the scene: "?" (rules; "Rules" in a tutorial) and mute on the left, the scoreboard in the middle, Forfeit (a
   flag + "Forfeit"; the flag alone in a small game window) in the top-right corner with a quick confirm under it, the
   stake small under the scoreboard. One row in every game window (phones play in landscape): it scales down with the
   window (the container queries on .match-card at the end of the match section). */
.game-top {
  position: absolute; left: 0; right: 0; top: 0; z-index: 6; padding: 10px 12px 0;
  display: grid; grid-template-columns: minmax(max-content, 1fr) minmax(0, 820px) minmax(max-content, 1fr); align-items: start; gap: 4px 10px;
  pointer-events: none;
}
.game-top > * { pointer-events: auto; }
.game-top .hud { grid-column: 2; grid-row: 1; width: 100%; max-width: none; margin: 0; }
.gt-left, .gt-right { grid-row: 1; display: flex; align-items: center; gap: 8px; min-width: 0; }
.gt-left { grid-column: 1; justify-content: flex-start; }
.gt-right { grid-column: 3; justify-content: flex-end; position: relative; }
.gt-btn, .gt-forfeit {
  flex: none; height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--ui-cream); color: var(--ui-ink); border: var(--ink-line); box-shadow: var(--ledge-sm);
  transition: transform .08s ease, box-shadow .08s ease;
}
.gt-btn { width: 42px; border-radius: 50%; padding: 0; }
/* "How to play": a framed text button (the same frame and height as Forfeit) */
.gt-btn.gt-text { width: auto; padding: 0 14px; border-radius: 999px; font: 600 15px/1 var(--font-display); white-space: nowrap; }
.gt-btn img { width: 26px; height: 26px; object-fit: contain; pointer-events: none; }
.gt-btn .vi { width: 22px; height: 22px; }
.gt-btn:hover, .gt-forfeit:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ledge-c); }
.gt-btn:active, .gt-forfeit:active, .gt-forfeit[aria-expanded="true"] { transform: translateY(2px); box-shadow: 0 1px 0 var(--ledge-c); }
.gt-btn .ico-off, .gt-btn.muted .ico-on { display: none; }
.gt-btn.muted .ico-off { display: block; }
.gt-btn.pulse { animation: help-pulse 1.4s ease-in-out infinite; }
#mRules { display: none; width: auto; padding: 0 14px; border-radius: 999px; font: 600 15px/1 var(--font-display); text-decoration: none; }
body.is-tutorial #mRules { display: inline-flex; }       /* a tutorial has no "?": its rules are one tap away */
body.is-tutorial #mHelp { display: none; }
.gt-forfeit { padding: 0 16px 0 11px; border-radius: 999px; font: 600 16px/1 var(--font-display); }
.gt-forfeit svg { width: 22px; height: 22px; flex: none; }
.gt-forfeit .vi { fill: var(--shoe-lace); }   /* Lucide flag filled white: surrender (white in both themes, outlined) */
/* the quick confirm under Forfeit */
.gt-confirm {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 8; width: 250px; padding: 12px 12px 10px;
  border-radius: var(--r-md); background: var(--ui-cream); color: var(--ui-ink); border: var(--ink-line); box-shadow: var(--ledge-sm), var(--float);
  animation: ov-in .18s cubic-bezier(.2, .8, .3, 1) both;
}
.gt-confirm.hidden { display: none; }
.gt-confirm p { margin: 0 0 10px; font-weight: 700; font-size: 15px; line-height: 1.3; }
.gt-confirm-btns { display: flex; justify-content: flex-end; gap: 8px; }
.gt-confirm .btn-danger { background: var(--ui-opponent); color: var(--ui-on-play); }
/* the stake, small under the scoreboard */
.gt-stake {
  grid-column: 2; grid-row: 2; justify-self: center; max-width: 100%; padding: 2px 12px 3px; border-radius: 999px;
  background: var(--ui-cream); border: 2px solid var(--edge); color: var(--ui-ink-2);
  font: 700 12.5px/1.25 var(--font-body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gt-stake:empty { display: none; }
.gt-stake b { color: var(--ui-money); font-family: var(--font-display); }
.gt-stake.is-demo { background: var(--accent-soft); }

/* ---------- the scoreboard (#hud, js/scenes/hud.js) ----------
   You on the left, the opponent on the right (mirrored): the mascot head ringed in the side color (a "thinking…" / lock
   badge on it, the role chip beside it), the real name (+ a small AI tag), the game's pieces under it (Penalty kick
   tracker, Shootout ammo, round pips). In the middle: your score, the timer ring, their score, the round under it.
   The cabinet (final): one framed arcade bar, the two player plates joined to a raised center whose dark screen shows
   the score. */
.hud {
  --hud-av: 46px;
  width: 100%; max-width: 820px; min-width: 0; margin-inline: auto;
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center;
  color: var(--ui-ink);
}
.hud.hidden { display: none; }
.hud-side {
  --side: var(--ui-player);
  position: relative; min-width: 0; height: 60px; display: flex; align-items: center; gap: 9px; padding: 0 28px 0 6px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--side) 22%, var(--ui-cream)), var(--ui-cream) 62%);
  border: 2.5px solid var(--ui-line); border-right: 0; border-radius: 22px 0 0 22px;
  box-shadow: var(--frame-in), inset 0 -3px 0 color-mix(in srgb, var(--side) 70%, transparent), var(--ledge-sm);
}
.hud-opp {
  --side: var(--ui-opponent); flex-direction: row-reverse; padding: 0 6px 0 28px;
  background: linear-gradient(270deg, color-mix(in srgb, var(--side) 22%, var(--ui-cream)), var(--ui-cream) 62%);
  border-right: 2.5px solid var(--ui-line); border-left: 0; border-radius: 0 22px 22px 0;
}
.hud-av { position: relative; flex: none; display: flex; align-items: center; gap: 6px; }
.hud-opp .hud-av { flex-direction: row-reverse; }
.hud .hud-avatar {
  --size: var(--hud-av); --side-ring: var(--side);
  border: 3px solid var(--side); background: color-mix(in srgb, var(--side) 24%, var(--ui-cream-2));
  box-shadow: 0 0 0 2px var(--ui-cream-2), 0 0 12px color-mix(in srgb, var(--side) 40%, transparent);
}
.avatar.mascot-avatar.hud-avatar > svg { width: 116%; height: 116%; margin-top: 8%; }   /* the head with its hat */
.hud-id { min-width: 0; flex: 1 1 auto; display: grid; gap: 4px; justify-items: start; }
.hud-opp .hud-id { justify-items: end; }
.hud-name { display: flex; align-items: center; gap: 5px; min-width: 0; max-width: 100%; }
.hud-opp .hud-name { flex-direction: row-reverse; }
.hud-name b, .hud-name .name-link {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 700 17px/1.15 var(--font-display); color: var(--ui-ink);
}
.hud-name .name-link { padding: 0; border: 0; background: none; cursor: pointer; text-decoration: underline 1.5px color-mix(in srgb, var(--ui-ink) 30%, transparent); text-underline-offset: 3px; }
.hud-ai {
  flex: none; padding: 2px 5px 1px; border-radius: 6px; background: var(--ui-ink); color: var(--ui-cream);
  font: 700 10.5px/1.1 var(--font-body); font-style: normal; letter-spacing: .04em;
}
.hud .scout-btn { flex: none; padding: 1px 8px; font-size: 12px; }
.hud-extra:empty { display: none; }
/* the middle: your score, the timer and their score on a dark screen, the round under it */
.hud-mid {
  position: relative; z-index: 1; margin: 0 -14px; display: grid; justify-items: center; gap: 3px; padding: 5px 7px 4px; border-radius: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--ui-cream) 86%, var(--ui-frame-hi)), var(--ui-cream));
  border: 2.5px solid var(--ui-line); box-shadow: var(--frame-in), var(--ledge), var(--float);
}
.hud-nums {
  justify-self: stretch; display: grid; grid-template-columns: minmax(1.2ch, 1fr) auto minmax(1.2ch, 1fr); align-items: center; gap: 10px; padding: 3px 12px; border-radius: 14px;
  background: var(--ui-cream-2); box-shadow: inset 0 2px 0 color-mix(in srgb, var(--ui-sky) 70%, transparent), inset 0 0 0 1.5px var(--ui-line);
}
.hud-score { min-width: 1ch; font: 700 36px/1 var(--font-display); font-variant-numeric: tabular-nums; text-align: center; }
.hud-score-you { color: var(--ui-player); text-shadow: 0 0 14px color-mix(in srgb, var(--ui-player) 45%, transparent); }
.hud-score-opp { color: var(--ui-opponent); text-shadow: 0 0 14px color-mix(in srgb, var(--ui-opponent) 45%, transparent); }
.hud-score.bump { animation: hud-bump .55s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes hud-bump { 30% { transform: scale(1.4); color: var(--ui-win); } }
.hud-clock { display: grid; place-items: center; }
.hud-clock > * { grid-area: 1 / 1; }
.hud-dash { display: none; font-style: normal; font: 700 22px/1 var(--font-display); color: var(--ui-ink-2); }
body.is-tutorial .hud-dash, body:not([data-view]) .hud-dash { display: block; }
body:not([data-view]) .hud .timer-ring { display: none; }   /* the scene lab: no timer */
.hud-round {
  display: flex; align-items: baseline; gap: 6px; font: 700 11.5px/1.25 var(--font-body); letter-spacing: .05em; text-transform: uppercase;
  color: var(--ui-ink-2); white-space: nowrap;
}
.hud-round:empty { display: none; }
.hud-round .r-main { color: var(--ui-ink); }
.hud-round .r-note { margin-left: .55em; }   /* "Round 3  first to 4": spacing, no separator dot */
.hud-round .r-phase { padding: 0 6px; border-radius: 999px; background: var(--ui-ink); color: var(--ui-cream); }
.hud.is-alert .hud-round .r-main { color: var(--ui-play); }
/* the role chip: football boot = kicking, goalkeeper gloves = keeping (Penalty); pointer / looker (Look Away) */
.hud-role {
  --role-c: var(--ui-win);
  width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 50%;
  background: var(--role-c); border: 2px solid var(--edge); box-shadow: 0 2px 0 var(--ledge-c);
}
.hud-role[hidden] { display: none; }
.hud-role[data-role="keep"] { --role-c: var(--ui-money); }
.hud-role[data-role="point"], .hud-role[data-role="look"] { --role-c: var(--ui-cream-2); }
.hud-role .hud-ico { width: 84%; height: 84%; }
.hud-role img.hud-ico { width: 88%; height: 88%; object-fit: contain; }
.hud-role.flip { animation: hud-flip .45s cubic-bezier(.2, .9, .3, 1.3); }
@keyframes hud-flip { from { transform: rotateY(90deg) scale(.7); } }
/* "thinking…" (three dots) / locked in (a check mark) on the avatar: the only lock sign, the same in every game */
.hud-badge {
  position: absolute; bottom: -4px; left: -5px; z-index: 1; display: none; align-items: center; gap: 2px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: var(--ui-cream); border: 1.5px solid var(--edge); box-shadow: 0 1.5px 0 var(--ledge-c);
}
.hud-opp .hud-badge { left: auto; right: -5px; }   /* the outer corner of the avatar: clear of the name and the role chip */
.hud-badge i { width: 4px; height: 4px; border-radius: 50%; background: var(--ui-ink-2); animation: hud-dot 1.2s ease-in-out infinite; }
.hud-badge i:nth-child(2) { animation-delay: .15s; }
.hud-badge i:nth-child(3) { animation-delay: .3s; }
.hud-badge .hud-check { display: none; width: 13px; height: 13px; stroke-width: 3.2; color: var(--ui-cream); }
@keyframes hud-dot { 30% { transform: translateY(-3px); background: var(--ui-ink); } }
.hud-side[data-status="thinking"] .hud-badge, .hud-side[data-status="locked"] .hud-badge { display: flex; }
.hud-side[data-status="locked"] .hud-badge { padding: 0 2px; background: var(--ui-win); }
.hud-side[data-status="locked"] .hud-badge i { display: none; }
.hud-side[data-status="locked"] .hud-badge .hud-check { display: block; }
/* the side that just scored lights up (a glow, no size change: the plates are joined) */
.hud-side.pulse { animation: hud-pulse .9s ease-out; }
@keyframes hud-pulse { 30% { filter: brightness(1.25) drop-shadow(0 0 10px color-mix(in srgb, var(--side) 75%, transparent)); } }
/* Penalty: the kick tracker (● scored, ✗ missed or saved, ○ still to take; a bar before sudden death) */
.hud-marks { display: flex; align-items: center; gap: 4px; }
.hud-opp .hud-marks { flex-direction: row-reverse; }
.hud-marks .mk { width: 12px; height: 12px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--ui-ink) 38%, transparent); }
.hud-marks .mk-goal { background: var(--side); border-color: var(--side); box-shadow: 0 0 6px color-mix(in srgb, var(--side) 55%, transparent); }
.hud-marks .mk-miss {
  border: 0; border-radius: 0;
  background: linear-gradient(45deg, transparent 40%, var(--ui-ink-2) 40% 60%, transparent 60%), linear-gradient(-45deg, transparent 40%, var(--ui-ink-2) 40% 60%, transparent 60%);
}
.hud-marks .mk-sep { width: 2.5px; height: 13px; border-radius: 2px; background: var(--ui-play); margin: 0 1px; }
/* RPS, Minus One, Look Away: a pip per round to win (filled = won) */
.hud-pips { display: flex; align-items: center; gap: 4px; }
.hud-opp .hud-pips { flex-direction: row-reverse; }
.hud-pips .pp { width: 16px; height: 7px; border-radius: 4px; background: color-mix(in srgb, var(--ui-ink) 16%, transparent); transition: background .25s, box-shadow .25s; }
.hud-pips .pp.on { background: var(--side); box-shadow: 0 0 7px color-mix(in srgb, var(--side) 60%, transparent); }
/* Shootout: ammo, a cartridge per slot (loaded = brass, empty = a dashed outline) */
.hud-ammo { display: flex; align-items: flex-end; gap: 4px; height: 22px; }
.hud-opp .hud-ammo { flex-direction: row-reverse; }
.hud-ammo .am { width: 12px; height: 22px; display: block; }
.hud-bullet { display: block; width: 100%; height: 100%; overflow: visible; }
.hud-bullet path, .hud-bullet rect { fill: color-mix(in srgb, var(--ui-ink) 7%, transparent); stroke: color-mix(in srgb, var(--ui-ink) 42%, transparent); stroke-width: 1.3; stroke-dasharray: 2.2 1.4; }
.hud-ammo .am.on .hud-bullet path, .hud-ammo .am.on .hud-bullet rect { stroke: var(--ui-ink); stroke-dasharray: none; stroke-width: 1.4; }
.hud-ammo .am.on .b-tip { fill: var(--wood); }
.hud-ammo .am.on .b-case, .hud-ammo .am.on .b-rim { fill: var(--money); }
.hud-ammo .am.pop { animation: am-pop .4s cubic-bezier(.2, .9, .3, 1.4); }
.hud-ammo .am.drop { animation: am-drop .3s ease-out; }
@keyframes am-pop { from { transform: translateY(-10px) scale(.6); opacity: 0; } }
@keyframes am-drop { from { transform: translateY(-6px) rotate(20deg); opacity: .2; } }

.timer-ring { width: 42px; height: 42px; flex-shrink: 0; transform: rotate(-90deg); }
.timer-ring.idle { visibility: hidden; }   /* no timer running: nothing floats in the middle */
.timer-ring .track { fill: var(--ui-cream-2); stroke: var(--ink-soft); stroke-width: 3; }
.timer-ring .fill { fill: none; stroke: var(--ui-player); stroke-width: 3.5; stroke-linecap: round; }
.timer-ring.low .fill { stroke: var(--ui-play); }
.timer-ring text { transform: rotate(90deg); transform-origin: 22px 22px; fill: var(--ui-ink); font: 700 15px var(--font-display); text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }
@keyframes hud-bump-sk { 30% { transform: skewX(var(--sk)) scale(1.18); filter: brightness(1.2); } }
@media (min-width: 861px) {
}
@keyframes hud-bump-flat { 30% { filter: brightness(1.3); transform: scale(1.12); } }

/* the "?" pulse (how to play); the mute icons are Lucide volume-2 / volume-x (public/js/icons.js) */
.help-btn.pulse { animation: help-pulse 1.4s ease-in-out infinite; }
@keyframes help-pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--ui-sun) 70%, transparent), var(--ledge-sm); } }
body.is-tutorial .help-btn, body.is-tutorial .timer-ring { display: none; }

/* sound settings (in Wallet & settings, #dlgWallet .w-sound) */
.sound-btn .ico-off, .sound-btn.muted .ico-on { display: none; }
.sound-btn.muted .ico-off { display: block; }
.w-sound { display: grid; gap: 12px; }
/* one row each: the toggle on the left (Mute / Music), its volume slider beside it */
.w-snd-row { display: grid; grid-template-columns: 104px minmax(0, 1fr); align-items: center; gap: 14px; min-height: 36px; }
.w-sound label { display: grid; gap: 4px; margin: 0; font-size: 14px; font-weight: 700; color: var(--ui-ink-2); }
.w-sound label.sw { display: flex; align-items: center; justify-content: flex-start; gap: 8px; color: var(--ui-ink); }
.w-sound .w-vol { display: flex; align-items: center; gap: 12px; }
.w-sound .w-vol span { flex: none; font-size: 14px; white-space: nowrap; }
.w-sound input[type="range"] { accent-color: var(--ui-player); width: 100%; }
/* toggle switch (checkbox) */
.sw input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; order: 2; flex-shrink: 0; width: 40px; height: 22px; margin: 0; border-radius: 999px;
  background: var(--ui-cream-2); border: 2px solid var(--edge); position: relative; cursor: pointer; transition: background .15s;
}
.sw input[type="checkbox"]::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--ui-ink);
  transition: transform .15s, background .15s;
}
.sw input[type="checkbox"]:checked { background: var(--ui-player); }
.sw input[type="checkbox"]:checked::after { transform: translateX(18px); background: var(--ui-cream); }
/* ---------- match view: one scene card under the bar, the controls as an overlay at its bottom ----------
   The page is exactly one screen high (no scroll). .match-stage is the free space; .match-card is the scene's card,
   as wide as the scene can be so that the controls overlay (--ctl-h, measured by app.js) covers at most the
   scene's safeBottom (--safe, a fraction of the scene's height; declared by each scene). The scene (16:9, the one
   layout) sits at the top of the card; below it the art continues as a mirrored copy (.scene-ext, kit.js) where the
   controls sit when there is room. --b = the card's outline width. */
body[data-view="match"] { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
body[data-view="match"] > .topbar { flex: none; }
.match { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; padding: 2px 10px 10px; position: relative; }
.match-stage { flex: 1 1 auto; min-height: 0; position: relative; container-type: size; }
.match-card {
  --r: 1.77778; --b: 3px;
  position: relative; height: 100%; margin: 0 auto; overflow: hidden;
  width: min(100cqw, calc((100cqh - 2 * var(--b)) * var(--r) + 2 * var(--b)),
    calc((100cqh - 2 * var(--b) - var(--ctl-h, 0px)) * var(--r) / (1 - var(--safe, 0)) + 2 * var(--b)));
  border: var(--b) solid var(--edge); border-radius: 26px; background: var(--ui-cream-2); box-shadow: var(--ledge), var(--float);
  container: card / inline-size;
}
/* the game window's strip (#gameTop) floats over the sky of the scene */
.match .scene-host { position: absolute; inset: 0; display: block; }
.match .scene-frame { width: 100%; border-radius: 0; box-shadow: none; overflow: visible; }
.match .controls:empty { display: none; }
/* the controls overlay: the panel at the bottom of the card, above the scene (the overlay box itself lets taps through) */
.match .controls { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; padding: 0 14px 14px; pointer-events: none; }
.match .controls .scene-controls { pointer-events: auto; max-width: 1040px; margin: 0 auto; }

/* the controls look (final: the compact floating pill; :root keeps these rules above the base ones in every @media) */
:root .match .controls { padding-bottom: 16px; }
:root .match .controls .scene-controls { width: fit-content; max-width: 100%; }
:root .match .ctl-panel { padding: 18px 10px 10px; border-radius: 34px; }
:root .match .ctl-row { gap: 8px; }
:root .match .ctl-chip .ctl-sub { display: none; }   /* the pill is narrow: the short prompt only */
:root .match .ctl {
  flex: 0 0 auto; width: auto; min-width: 104px; max-width: 168px; min-height: 0; padding: 8px 12px 9px;
  flex-direction: column; gap: 3px; border-radius: 22px; font-size: 15px;
}
:root .match .ctl-icon { width: 50px; height: 50px; }
/* the panel in the bottom-right corner (Penalty, def.controls = 'corner'), a little more compact */
#viewMatch[data-ctl="corner"] .controls { padding-right: 16px; }
:root #viewMatch[data-ctl="corner"] .controls .scene-controls { margin: 0 0 0 auto; }
:root #viewMatch[data-ctl="corner"] .ctl { min-width: 92px; padding: 7px 10px 8px; }
:root #viewMatch[data-ctl="corner"] .ctl-icon { width: 46px; height: 46px; }

/* Penalty: the panel shows your role, the same way as the role banner. Kicking = "KICK — pick a corner" (the ball in
   the chip, the goal-with-ball icons, green), keeping = "SAVE — pick a dive" (the gloves, the glove icons, gold): the
   chip, the panel's rim and tint, the picked button and the icons. --ui-on-play text on either accent passes AA in
   every palette (test/client.js). */
.scene-controls.penalty { --role-c: var(--ui-win); }
.scene-controls.penalty[data-role="keep"] { --role-c: var(--ui-money); }
.scene-controls.penalty .ctl-panel { border-color: var(--role-c); box-shadow: 0 4px 0 color-mix(in srgb, var(--role-c) 50%, transparent), var(--float); }
.scene-controls.penalty[data-state="open"] .ctl-chip { background: var(--role-c); color: var(--ui-on-play); }
.scene-controls.penalty .ctl-chip { align-items: center; }
.scene-controls.penalty .ctl-role { display: inline-grid; place-items: center; width: 24px; height: 24px; margin: -2px -4px -2px -10px; border-radius: 50%; background: var(--role-c); border: 1.5px solid var(--ui-cream); }
.scene-controls.penalty .ctl-role .hud-ico { width: 80%; height: 80%; }
.scene-controls.penalty .ctl-role .pen-ball-ico, .scene-controls.penalty .ctl-role .pen-glove-ico { width: 82%; height: 82%; object-fit: contain; display: block; }
.scene-controls.penalty .ctl-panel { background: color-mix(in srgb, var(--role-c) 9%, var(--ui-cream)); }
.scene-controls.penalty .ctl-prompt { letter-spacing: .02em; }
.scene-controls.penalty:not([data-state="open"]) .ctl-role { display: none; }
.scene-controls.penalty .ctl[aria-pressed="true"] { background: var(--role-c); box-shadow: 0 4px 0 var(--ledge-c), 0 0 0 5px color-mix(in srgb, var(--role-c) 28%, transparent); }
.scene-controls.penalty .ctl:hover:not(:disabled):not([aria-pressed="true"]) { background: color-mix(in srgb, var(--role-c) 14%, var(--ui-cream)); }
:root #viewMatch .scene-controls.penalty .ctl-icon { width: 64px; }
/* Penalty's panel is the big one (round 8): larger buttons and goal icons, a readable role label; still in the
   bottom-right corner on wide screens, clear of the goal (safeCorner). Touch targets stay >= 56 px everywhere. */
:root #viewMatch .scene-controls.penalty .ctl-chip { font-size: 20px; padding: 6px 20px 7px; gap: 12px; }
:root #viewMatch .scene-controls.penalty .ctl-role { width: 32px; height: 32px; margin: -4px -4px -4px -12px; }
:root #viewMatch .scene-controls.penalty .ctl-panel { padding: 22px 12px 12px; }
:root #viewMatch .scene-controls.penalty .ctl-row { gap: 10px; }
:root #viewMatch .scene-controls.penalty .ctl { min-width: 132px; max-width: 180px; min-height: 64px; padding: 10px 14px 11px; font-size: 18px; border-radius: 24px; gap: 5px; }
:root #viewMatch .scene-controls.penalty .ctl-icon { width: 92px; height: 66px; }
/* Penalty control sprites (icon-pen-*): the goal / the gloves, keep their shape inside the icon box */
.pk-ico { width: 100%; height: 100%; object-fit: contain; display: block; }

.match-overlay {
  position: absolute; left: 12px; right: 12px; top: 12px; bottom: max(12px, var(--ctl-h, 0px)); z-index: 6;
  display: grid; place-content: center; justify-items: center; gap: 12px; pointer-events: none; text-align: center;
}
.ov-matched {
  padding: 6px 24px 8px; border-radius: 999px; background: var(--ui-cream); color: var(--ui-ink); border: var(--ink-line); box-shadow: var(--ledge-sm);
  font: 700 clamp(22px, 3.4vw, 40px)/1.1 var(--font-display); letter-spacing: -.01em; animation: ov-in .4s cubic-bezier(.2, .8, .3, 1) both;
}
.ov-matched small { display: block; font: 700 13px/1.2 var(--font-body); letter-spacing: .14em; text-transform: uppercase; color: var(--ui-ink-2); margin-bottom: 2px; }
.ov-matched { border-radius: 22px; }
/* the stake confirmation of a real match: "Stake ≈ 1.8M $VERSO each", the win and the fee */
.ov-stake {
  padding: 8px 18px; border-radius: 14px; background: var(--ui-cream); color: var(--ui-money); border: var(--ink-line); box-shadow: var(--ledge-sm);
  font: 700 clamp(17px, 2.2vw, 22px)/1.2 var(--font-display); animation: ov-in .45s .1s cubic-bezier(.2, .8, .3, 1) both;
}
.ov-stake small { display: block; font: 700 13px/1.3 var(--font-body); color: var(--ui-ink-2); margin-top: 2px; }
.ov-count {
  font: 700 clamp(76px, 12vw, 140px)/1 var(--font-display); color: var(--ui-cream);
  -webkit-text-stroke: 5px var(--ui-ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ledge-c);
}
.ov-count.tick { animation: ov-tick .9s ease-out both; }
.ov-howto {
  max-width: min(520px, 90%); padding: 12px 18px; border-radius: var(--r-md); background: var(--ui-cream); color: var(--ui-ink);
  border: var(--ink-line); box-shadow: var(--ledge-sm), var(--float); animation: ov-in .45s .2s cubic-bezier(.2, .8, .3, 1) both;
}
.ov-howto b { color: var(--ui-ink); font-family: var(--font-display); font-size: 18px; }
.ov-howto.with-cover { display: flex; align-items: center; gap: 14px; text-align: left; padding: 10px 16px 10px 10px; }
.ov-howto .ov-cover { width: 96px; height: 64px; flex-shrink: 0; border-radius: var(--r-sm); object-fit: cover; border: 2px solid var(--edge); }
.ov-howto p { margin: 4px 0 0; color: var(--ui-ink-2); font-weight: 700; }
@keyframes ov-in { from { transform: translateY(10px) scale(.96); opacity: 0; } }
@keyframes ov-tick { 0% { transform: scale(1.4); opacity: 0; } 25% { transform: scale(1); opacity: 1; } 85% { opacity: 1; } 100% { transform: scale(.9); opacity: 0; } }

/* ---------- sheets above the controls (rules card, Scout, tutorial offer): cream cards ---------- */
.help-sheet, .scout {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 30; width: min(460px, calc(100vw - 24px)); overflow-y: auto;
  padding: 14px 16px; border-radius: var(--r-md); background: var(--ui-cream); color: var(--ui-ink); border: var(--ink-line); box-shadow: var(--ledge-sm), var(--float);
}
.scout { width: min(440px, calc(100vw - 24px)); border-color: var(--ui-opponent); }
.help-sheet h3 { font-size: 18px; }
.help-preview { position: relative; height: 150px; margin: 8px 0; border-radius: var(--r-sm); overflow: hidden; border: 2px solid var(--edge); }
.help-preview .cover-img { border-radius: 0; }
.help-sheet ol { margin: 0; padding-left: 20px; color: var(--ui-ink-2); font-size: 14px; font-weight: 700; }
.help-sheet li { margin-bottom: 4px; }
.help-sheet .note { color: var(--ui-money); font-weight: 700; }
/* the game's keyboard shortcuts (mouse / keyboard only: the control panel shows no key badges) */
.help-keys { margin: 10px 0 4px; padding-top: 8px; border-top: 1.5px dashed var(--ink-soft); }
.help-keys[hidden] { display: none; }
.help-keys h4 { margin: 0 0 6px; font: 700 14px/1.2 var(--font-display); color: var(--ui-ink); }
.help-keys dl { display: grid; grid-template-columns: auto 1fr; gap: 5px 10px; margin: 0; align-items: center; font-size: 14px; }
.help-keys dt { display: flex; gap: 3px; }
.help-keys dd { margin: 0; color: var(--ui-ink-2); font-weight: 700; }
.help-keys kbd {
  min-width: 22px; padding: 1px 6px; border-radius: 6px; text-align: center; background: var(--ui-cream-2); border: 1.5px solid var(--ui-ink-2);
  box-shadow: 0 1.5px 0 var(--ui-ink-2); font: 700 12.5px/1.3 var(--font-body); color: var(--ui-ink);
}
@media (hover: none), (pointer: coarse) { .help-keys { display: none; } }
.scout .rules-link, .help-sheet .rules-link { color: var(--ui-ink-2); }
.scout .note, .scout .summary .row, .scout .summary small { color: var(--ui-ink-2); }
.scout .summary .row b { color: var(--ui-ink); }
.scout .dist-row i { background: linear-gradient(90deg, var(--ui-opponent) var(--w), var(--ui-cream-2) var(--w)); border: 1px solid var(--ink-soft); }
.offer {
  position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 45; width: min(440px, calc(100vw - 24px));
  padding: 14px 16px; border-radius: var(--r-md); background: var(--ui-cream); color: var(--ui-ink); border: var(--ink-line);
  box-shadow: var(--ledge-sm), var(--float); animation: offer-in .3s cubic-bezier(.2, .8, .3, 1) both;
}
.offer p { margin: 0; font-size: 16px; }
.offer .row-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.offer .btn { padding: 10px 16px; }
@keyframes offer-in { from { transform: translate(-50%, 20px); opacity: 0; } }

/* ---------- tutorial coach marks ---------- */
.coach { position: fixed; inset: 0; z-index: 70; pointer-events: none; }
.coach-spot {
  position: fixed; border-radius: 16px; box-shadow: 0 0 0 9999px color-mix(in srgb, var(--bg) 62%, transparent); outline: 2px solid var(--money);
  animation: spot-pulse 1.6s ease-in-out infinite; transition: left .25s, top .25s, width .25s, height .25s;
}
@keyframes spot-pulse { 50% { outline-offset: 5px; outline-color: color-mix(in srgb, var(--money) 45%, transparent); } }
.coach-arrow {
  position: fixed; width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent;
  border-top: 18px solid var(--money); animation: arrow-bob .9s ease-in-out infinite;
}
.coach-arrow.up { border-top: 0; border-bottom: 18px solid var(--money); }
@keyframes arrow-bob { 50% { transform: translateY(5px); } }
.coach-arrow.up { animation-name: arrow-bob-up; }
@keyframes arrow-bob-up { 50% { transform: translateY(-5px); } }
.coach-bubble {
  position: fixed; pointer-events: auto; padding: 14px 16px 12px; border-radius: var(--r-md); background: var(--text); color: var(--bg);
  box-shadow: var(--lift); animation: ov-in .3s cubic-bezier(.2, .8, .3, 1) both;
}
.coach-text { margin: 0 0 10px; font-weight: 700; font-size: 16px; line-height: 1.35; }
.coach-cover { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: var(--r-sm); margin-bottom: 10px; }
.coach-cover[hidden] { display: none; }
.coach-row { display: flex; align-items: center; gap: 8px; }
.coach-steps { flex: 1; font-size: 13px; color: color-mix(in srgb, var(--bg) 70%, var(--text)); }
.coach-row .btn { padding: 8px 12px; font-size: 14px; box-shadow: none; }
.coach-row .btn[hidden] { display: none; }
.coach-row .btn-ghost { color: var(--bg); background: transparent; border-color: color-mix(in srgb, var(--bg) 35%, var(--text)); }
.coach-row .btn-primary { background: var(--bg); color: var(--text); }
.coach.waiting .coach-spot, .coach.waiting .coach-arrow, .coach.waiting .coach-bubble { opacity: 0; pointer-events: none; transition: opacity .15s; }
.coach:not(.has-target) .coach-spot { display: none; }
.coach:not(.has-target)::before { content: ''; position: fixed; inset: 0; background: color-mix(in srgb, var(--bg) 50%, transparent); }

/* ---------- smaller game windows: one layout, scaled ----------
   Phones play in landscape (portrait shows the rotate overlay, index.html #rotateOverlay), so the match keeps the
   desktop arrangement everywhere: the strip stays ONE row ("How to play" + mute, the scoreboard, Forfeit) and scales
   with the game window (container card = .match-card); the controls get compact on short screens (the media query at
   the end). */
@media (max-width: 860px) {
  .match { padding: 0 6px 6px; }
  .match-card { --b: 2.5px; border-radius: 22px; }
  .help-preview { height: 120px; }
}
@container card (max-width: 900px) {
  .game-top { padding: 7px 8px 0; gap: 3px 6px; }
  .gt-left, .gt-right { gap: 6px; }
  .gt-btn, .gt-forfeit { height: 36px; }
  .gt-btn { width: 36px; }
  .gt-btn.gt-text, #mRules { padding: 0 11px; font-size: 14px; }
  .gt-btn img, .gt-btn .vi { width: 20px; height: 20px; }
  .gt-forfeit { width: 36px; padding: 0; }
  .gt-forfeit .lbl { display: none; }
  .gt-forfeit svg { width: 20px; height: 20px; }
  .gt-confirm { width: min(250px, calc(100cqw - 24px)); }
  .gt-stake { padding: 1px 9px 2px; font-size: 11px; }
  .hud { --hud-av: 34px; }
  .hud-side { height: 46px; gap: 6px; padding: 0 22px 0 4px; border-radius: 18px 0 0 18px; }
  .hud-opp { padding: 0 4px 0 22px; border-radius: 0 18px 18px 0; }
  .hud-id { gap: 2px; }
  .hud-name b, .hud-name .name-link { font-size: 14px; }
  .hud-ai { padding: 1px 4px; border-radius: 5px; font-size: 9.5px; }
  .hud .scout-btn { padding: 0 6px; font-size: 10.5px; }
  .hud-role { width: 24px; height: 24px; border-width: 1.5px; }
  .hud-mid { margin: 0 -10px; padding: 3px 5px; gap: 1px; border-radius: 16px; }
  .hud-nums { gap: 6px; padding: 1px 8px; border-radius: 11px; }
  .hud-score { font-size: 26px; }
  .hud .timer-ring { width: 32px; height: 32px; }
  .hud-dash { font-size: 18px; }
  .hud-round { font-size: 10px; letter-spacing: .03em; }
  .hud-marks { gap: 3px; }
  .hud-marks .mk { width: 10px; height: 10px; border-width: 1.5px; }
  .hud-marks .mk-sep { height: 11px; width: 2px; }
  .hud-pips .pp { width: 13px; height: 6px; }
  .hud-ammo { height: 16px; gap: 3px; }
  .hud-ammo .am { width: 9px; height: 16px; }
}
/* a small game window (a landscape phone): the strip and the scoreboard at their smallest; the role chip and the
   status badge sit on the avatar's corners, the stake is left out (the forfeit confirm names it) */
@container card (max-width: 660px) {
  .game-top { padding: 6px 6px 0; gap: 2px 5px; }
  .gt-left, .gt-right { gap: 5px; }
  .gt-btn, .gt-forfeit { height: 32px; }
  .gt-btn, .gt-forfeit { width: 32px; }
  .gt-btn.gt-text, #mRules { width: auto; padding: 0 9px; font-size: 12.5px; }
  .gt-btn img, .gt-btn .vi, .gt-forfeit svg { width: 18px; height: 18px; }
  .gt-stake { display: none; }
  .hud { --hud-av: 28px; }
  .hud-side { height: 38px; gap: 5px; padding: 0 16px 0 3px; border-radius: 15px 0 0 15px; border-width: 2px; }
  .hud-opp { padding: 0 3px 0 16px; border-radius: 0 15px 15px 0; }
  .hud .hud-avatar { border-width: 2.5px; box-shadow: 0 0 0 1.5px var(--ui-cream-2); }
  .hud-name b, .hud-name .name-link { font-size: 12.5px; }
  .hud-role { position: absolute; top: -6px; right: -8px; width: 19px; height: 19px; box-shadow: none; }
  .hud-opp .hud-role { right: auto; left: -8px; }
  .hud-badge { height: 14px; bottom: -5px; left: -6px; }
  .hud-opp .hud-badge { right: -6px; }
  .hud-badge i { width: 3px; height: 3px; }
  .hud-mid { margin: 0 -8px; padding: 2px 4px; border-radius: 13px; border-width: 2px; }
  .hud-nums { gap: 5px; padding: 0 7px; border-radius: 9px; }
  .hud-score { font-size: 21px; }
  .hud .timer-ring { width: 26px; height: 26px; }
  .hud-round { font-size: 9px; gap: 4px; }
  .hud-round .r-note { display: none; }
  .hud-round:has(.r-phase) .r-main { display: none; }   /* Minus One: the phase says enough */
  .hud-marks .mk { width: 8px; height: 8px; }
  .hud-pips { gap: 3px; }
  .hud-pips .pp { width: 10px; height: 5px; }
  .hud-ammo { height: 13px; gap: 2px; }
  .hud-ammo .am { width: 7px; height: 13px; }
}
/* short screens (landscape phones): a compact controls panel, every button still a >= 44 px touch target (Penalty's
   >= 56 px); the icon sits beside the label so the panel stays low */
@media (max-height: 560px) {
  .match { padding: 0 6px 6px; }
  .match-card { --b: 2.5px; border-radius: 20px; }
  :root .match .controls { padding: 0 8px 6px; }
  :root .match .controls .scene-controls { width: fit-content; max-width: 100%; }
  .match .ctl-chip { margin-bottom: -11px; padding: 3px 12px 4px; font-size: 13px; border-width: 2px; }
  .match .ctl-chip::before, .match .ctl-chip::after { width: 10px; height: 3px; }
  :root .match .ctl-panel { padding: 13px 6px 6px; border-radius: 22px; border-width: 2px; }
  :root .match .ctl-row { gap: 6px; }
  :root .match .ctl {
    flex-direction: row; min-width: 0; max-width: none; min-height: 46px; padding: 4px 12px 5px 8px; gap: 6px;
    font-size: 13.5px; border-radius: 16px; border-width: 2px; box-shadow: 0 3px 0 var(--ledge-c);
  }
  :root .match .ctl-icon { width: 30px; height: 30px; }
  .match .ctl-lock { width: 24px; height: 24px; top: -9px; right: -6px; border-width: 2px; padding: 3px; }
  #viewMatch[data-ctl="corner"] .controls { padding-right: 8px; }
  :root #viewMatch .scene-controls.penalty .ctl-chip { font-size: 14px; padding: 3px 12px 4px; gap: 8px; }
  :root #viewMatch .scene-controls.penalty .ctl-role { width: 22px; height: 22px; margin: -2px -2px -2px -8px; }
  :root #viewMatch .scene-controls.penalty .ctl-panel { padding: 14px 6px 6px; }
  :root #viewMatch .scene-controls.penalty .ctl-row { gap: 6px; }
  :root #viewMatch .scene-controls.penalty .ctl {
    flex-direction: column; min-width: 78px; max-width: 104px; min-height: 58px; padding: 4px 6px 5px; gap: 2px; font-size: 13px; border-radius: 16px;
  }
  :root #viewMatch .scene-controls.penalty .ctl-icon { width: 54px; height: 34px; max-width: none; aspect-ratio: auto; }
  .help-sheet, .scout { max-height: calc(100dvh - 16px); top: 8px; bottom: auto !important; }
  .help-preview { height: 84px; }
  .ov-count { font-size: clamp(56px, 18vh, 96px); }
  .ov-howto { padding: 8px 12px; }
  .ov-howto .ov-cover { width: 72px; height: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .help-btn.pulse, .coach-spot, .coach-arrow, .hud-badge i, .hud-side.pulse, .hud-role.flip, .hud-score.bump, .hud-ammo .am { animation: none; }
  .hud-pips .pp { transition: none; }
}
