/* ==========================================================================
   Prize celebrations — the layer prize/celebrate.js draws in: the small "+N"
   pill and its transient wallet, the big card with its stamp, the coin and
   confetti canvas, and the ghost-final counting numbers (.cu-*). Ported from
   Mahjong Pa More's css/prize.css: its colours, sizes and layout as they are,
   with Baraha's fonts, coin and gem.

   No keyframes here on purpose: every moving style (transform, opacity, the
   pulse's --prize-s / --prize-g) is written each frame from the job's elapsed
   time, so the numbers stay prize_timing.js's and reduced motion is decided in
   JS (app.css's reduced-motion clamp does not reach rAF writes). Mirror:
   app/lib/design/prize/celebrate.dart.
   ========================================================================== */

/* On document.body, above the whole app (#app's toast 60, boot 100, the store
   sheet 80). Taps pass through unless a card is up. */
.prize-layer { position: fixed; inset: 0; z-index: 480; pointer-events: none; --prize-scale: 1;
  font-family: var(--font-text); color: #EDE3CE; }

/* The permanent screen-reader line, outside #app[aria-live], and the card's hint. */
.prize-sr, .prize-vh { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* Baraha's currency look: a plain gold coin (no glyph) and the rotated gilt gem. */
.prize-coin { display: inline-block; flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #F7CF69, #E0A42C 70%); box-shadow: inset 0 0 0 1.5px rgba(120,80,10,.35); }
.prize-gem { display: inline-block; flex: 0 0 auto; width: 13px; height: 13px; border-radius: 3px;
  transform: rotate(45deg); background: linear-gradient(135deg, #F6D46B, #C98A12); }
.prize-emoji { font-size: 34px; line-height: 1; }
.prize-medal { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 16px; box-shadow: inset 0 1px 0 rgba(255,255,255,.55); }

/* ---- small: the pill ---- */
.prize-pill { position: fixed; left: 0; top: 0; z-index: 3; box-sizing: border-box; max-width: 320px;
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 14px; border-radius: 999px;
  background: rgba(6,35,26,.94); border: 2px solid #E0A42C;
  box-shadow: 0 0 18px rgba(224,164,44,.55), 0 8px 22px rgba(0,0,0,.45); will-change: transform, opacity; }
.prize-pill__l1 { max-width: 100%; text-align: center; overflow-wrap: anywhere; color: #F2E7CE;
  font: 700 calc(11.5px * var(--prize-scale))/1.25 var(--font-text); }
.prize-pill__l2 { display: flex; align-items: center; white-space: nowrap; }
.prize-pill__l2 .prize-coin { margin-right: 6px; }
/* The gem's box is its side; rotated, it reaches ~3 px past each edge. */
.prize-pill__l2 .prize-gem { margin: 0 8px 0 13px; }
.prize-pill__l2 .prize-gem:first-child { margin-left: 3px; }
.prize-pill__n { color: #F7CF69; font: 800 calc(22px * var(--prize-scale))/1.05 var(--font-display); font-variant-numeric: tabular-nums; }
.prize-pill__g { color: #F7CF69; font: 800 calc(18px * var(--prize-scale))/1.05 var(--font-display); font-variant-numeric: tabular-nums; }

/* ---- small: the transient wallet, the .wallet pills at the safe top-right ----
   The screens' own ink and weight, not the layer's bone: the pill is cream in
   the light theme. */
.prize-tw { position: fixed; z-index: 3; display: flex; gap: 10px; align-items: center; transform-origin: top right; }
.prize-tw .wallet { color: var(--text); box-shadow: 0 0 16px rgba(224,164,44,.45); }
.prize-tw .wallet b { font-weight: inherit; }

/* ---- big: the scrim and the card ---- */
.prize-scrim { position: absolute; inset: 0; z-index: 1; background: #000; opacity: 0; pointer-events: auto; }
.prize-card { position: fixed; z-index: 2; box-sizing: border-box; padding: 18px 18px 16px; border-radius: 22px;
  background: linear-gradient(155deg, #26221C, #0C0B09); border: 1.5px solid rgba(224,164,44,.52);
  box-shadow: 0 24px 60px rgba(0,0,0,.5), 0 0 40px rgba(224,164,44,.18);
  overflow: visible; text-align: center; pointer-events: auto; cursor: pointer; will-change: transform, opacity; }
.prize-card__inner { display: flex; flex-direction: column; align-items: center; }
.prize-card__emblem { height: 40px; margin-bottom: 6px; display: flex; align-items: center; justify-content: center; }
.prize-card__head { display: flex; align-items: baseline; justify-content: center; white-space: nowrap; }
.prize-coin.prize-coin--lg { width: 30px; height: 30px; margin-right: 8px; align-self: center; }
.prize-gem.prize-gem--lg { width: 20px; height: 20px; border-radius: 4px; margin: 0 12px 0 4px; align-self: center; }
.prize-card__num { color: #F7CF69; font: 800 calc(40px * var(--prize-scale))/1 var(--font-display);
  font-variant-numeric: tabular-nums; letter-spacing: -.4px; }
.prize-card__unit { margin-left: 6px; color: #EDE3CE; font: 700 calc(17px * var(--prize-scale))/1 var(--font-text); }
.prize-card__ginto { margin-top: 4px; display: flex; align-items: baseline; justify-content: center; white-space: nowrap; }
.prize-gem.prize-gem--sm { width: 15px; height: 15px; margin: 0 9px 0 3px; align-self: center; }
.prize-card__gnum { color: #F7CF69; font: 800 calc(24px * var(--prize-scale))/1 var(--font-display); font-variant-numeric: tabular-nums; }
.prize-card__gunit { margin-left: 5px; color: #EDE3CE; font: 700 calc(14px * var(--prize-scale))/1 var(--font-text); }
.prize-card__title { color: #F7CF69; font: 800 calc(30px * var(--prize-scale))/1.05 var(--font-display); }
.prize-card__sub { margin-top: 4px; color: #F2E7CE; font: 800 calc(22px * var(--prize-scale))/1.1 var(--font-display); }
.prize-card__caption { margin-top: 10px; max-width: 100%; color: #EDE3CE; font: 600 calc(14px * var(--prize-scale))/1.35 var(--font-text);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
/* The marigold OK, styled here so it never follows a .btn variant or the theme. */
.prize-card__ok { display: block; margin-top: 14px; width: 100%; padding: 12px 18px; border-radius: 14px;
  background: #E0A42C; color: #3A2A06; font: 800 calc(15px * var(--prize-scale))/1.2 var(--font-display);
  box-shadow: 0 6px 18px rgba(224,164,44,.28); }
.prize-card__ok:focus-visible { outline: 2px solid #F7CF69; outline-offset: 2px; }

/* The stamp hangs off the card's top-right corner (the card never clips it):
   outlined lacquer red on the dark card, rotated −8°. */
.prize-stamp { position: absolute; top: -6px; right: -10px; padding: 4px 12px; border: 3px solid #D2503E; border-radius: 8px;
  color: #D2503E; font: 800 calc(22px * var(--prize-scale))/1.1 var(--font-display); letter-spacing: 1.2px; white-space: nowrap;
  transform: rotate(-8deg); opacity: 0; pointer-events: none; }
.prize-card--narrow .prize-stamp { font-size: calc(18px * var(--prize-scale)); }
.prize-stamp__ring { position: absolute; inset: -3px; border: 3px solid #D2503E; border-radius: 8px; opacity: 0; }

/* ---- the canvas: coins and confetti, over the card ---- */
.prize-fx { position: absolute; inset: 0; z-index: 4; width: 100%; height: 100%; pointer-events: none; }

/* ---- ghost-final: the final number stays in the tree (hidden by colour only,
   never visibility, so screen readers still read it); the counting one is
   drawn over it, right-aligned, and hidden from them. The weight is the
   host's, so a <b> host looks like the text it replaced. ---- */
.cu-host { position: relative; font-weight: inherit; }
.cu-host.is-counting > .cu-final { color: transparent; }
.cu-live { position: absolute; top: 0; right: 0; white-space: nowrap; }

/* ---- what a burst lands on: a coin's bump and the land pulse (scale + glow),
   and the reduced-motion ring. Transforms only — no layout moves. ---- */
.wallet.prize-hit { transform: scale(var(--prize-s, 1)); box-shadow: 0 0 18px rgba(247,207,105,var(--prize-g, 0)); }
.prize-tw .wallet.prize-hit { box-shadow: 0 0 16px rgba(224,164,44,.45), 0 0 18px rgba(247,207,105,var(--prize-g, 0)); }
.results__earn.prize-hit { box-shadow: inset 0 0 0 1.5px rgba(247,207,105,var(--prize-g, 0)); }
.wallet.prize-ring { box-shadow: 0 0 0 2px #F7CF69; }
.results__earn.prize-ring { box-shadow: 0 0 0 2px #F7CF69; }
