/* Sprinkle Catch (js/game-catch.js): the game page, its HUD meters, the ready and end panels.
   Builds on tokens.css and the shared .play-* stage, HUD and panel parts in play.css. Logical properties for RTL. */

.play-game { padding-block: clamp(28px, 4vw, 56px) clamp(40px, 6vw, 80px); }
.play-game .play-wrap { max-width: calc(1080px + 2 * var(--gut)); }
.play-game[data-state="play"] canvas { cursor: grab; }
.catch .play-stage { height: clamp(560px, 76svh, 780px); background: var(--pearl); }
.catch .play-stage .play-over canvas, .catch .play-stage .play-hud canvas { position: static; display: block; touch-action: auto; }

/* HUD: the combo ring fills towards the next multiplier; the power-up ring drains while it lasts */
.catch .play-hud { align-items: center; }
.catch-combo, .catch-pow { position: relative; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--paper); color: var(--ink); box-shadow: var(--sh-card); }
.catch-combo svg, .catch-pow svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.catch-combo circle, .catch-pow circle { fill: none; stroke-width: 3; }
.catch-combo circle:first-child, .catch-pow circle:first-child { stroke: var(--line); }
.catch-combo circle + circle, .catch-pow circle + circle { stroke: var(--ink); stroke-dasharray: 0 100; }
.catch-combo circle + circle { transition: stroke-dasharray .35s var(--ease); }
.catch-combo b { font: 600 15px/1 var(--f-mono); }
.catch-combo[data-m="1"] b { color: var(--ink-2); }
.catch-combo[data-m="3"] { background: var(--ink); color: var(--pearl); }
.catch-combo[data-m="3"] circle + circle { stroke: #F3CB67; }
.catch-combo.bump { animation: catch-bump .5s var(--ease); }
@keyframes catch-bump { from { transform: scale(1.4); } }
.catch-pow { position: absolute; top: 0; inset-inline: 0; width: 54px; height: 54px; margin-inline: auto; margin-block-start: -4px; }
.catch-pow[hidden] { display: none; }
.catch-pow canvas { width: 32px; height: 32px; }
.catch-rush .play-timebar { background: #BF3A47; }
.catch-rush .play-hud-time { color: #BF3A47; }

/* panels */
.catch .play-over { overflow-y: auto; }
.catch-panel { gap: 16px; width: min(100%, 500px); }
.catch-legend { display: flex; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.catch-legend li { display: grid; justify-items: center; gap: 2px; width: 62px; padding: 6px 4px 8px; border-radius: var(--r-chip); background: var(--pearl); }
.catch-legend li.is-bad { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.catch-legend canvas { width: 44px; height: 44px; }
.catch-legend .num { font-size: 15px; font-weight: 600; }
.catch-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 18px; }
.catch-today { display: grid; grid-template-columns: auto minmax(0, auto) auto; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; text-align: start; }
.catch-today i { flex: none; width: 18px; height: 24px; border-radius: 5px; background: var(--c); box-shadow: inset 0 0 0 1px rgba(37, 22, 27, .14); }
.catch-today b { padding: 3px 8px; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1.5px currentColor; font-size: 13px; }
.catch-cups { display: grid; gap: 12px; justify-items: center; width: 100%; padding-block-start: 14px; border-block-start: 1px solid var(--line); }
.catch-cups > p { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 4px 12px; font-size: 15px; }
.catch-cups > p span { font-size: 14px; color: var(--ink-2); }
.catch-combo b, .catch-legend .num, .catch-today b, .catch-jar-line .num, .catch-skin small { direction: ltr; unicode-bidi: isolate; }
.catch-skins { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 8px; }
.catch-skin { position: relative; display: grid; place-items: center; width: 52px; height: 52px; padding: 0; border: 0; border-radius: var(--r-chip);
  background: var(--pearl); cursor: pointer; transition: transform .45s var(--spring), box-shadow .3s var(--ease), background-color .3s; }
.catch-skin canvas { width: 46px; height: 46px; }
.catch-skin:hover { transform: translateY(-3px); }
.catch-skin[aria-pressed="true"] { background: var(--paper); box-shadow: var(--sh-lift), 0 0 0 2px var(--ink); transform: translateY(-4px); }
.catch-skin.is-locked { cursor: default; background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.catch-skin.is-locked:hover { transform: none; }
.catch-skin small { position: absolute; bottom: -9px; inset-inline: 0; width: max-content; margin-inline: auto; padding: 2px 6px; border-radius: var(--r-pill);
  background: var(--paper); box-shadow: inset 0 0 0 1px var(--line); font: 600 10px/1.2 var(--f-mono); color: var(--ink-2); }

/* end panel: stars land one by one, the score rolls, the jar fills */
.catch-final { gap: 12px; }
.catch-stars { display: flex; align-items: flex-end; gap: 4px; }
.catch-star { display: grid; }
.catch-star svg { grid-area: 1 / 1; display: block; width: clamp(44px, 9vw, 56px); height: auto; }
.catch-star:nth-child(2) svg { width: clamp(56px, 11vw, 70px); }
.catch-star:nth-child(2) { transform: translateY(-8px); }
.catch-star path { fill: var(--pearl); stroke: rgba(37, 22, 27, .16); stroke-width: 1.5; stroke-linejoin: round; }
.catch-star svg + svg { visibility: hidden; }
.catch-star.is-on svg + svg { visibility: visible; animation: catch-land .7s var(--ease) backwards; animation-delay: calc(520ms + var(--k) * 380ms); }
.catch-star.is-on svg + svg path { fill: #F3CB67; stroke: #5E3F04; stroke-width: 2; }
@keyframes catch-land { from { opacity: 0; transform: translateY(-44px) scale(1.9) rotate(-28deg); } }
.play-final .play-roll { font-size: clamp(3.6rem, 11vw, 6.4rem); font-weight: 500; letter-spacing: -.05em; }
.play-newbest { padding: 7px 12px; border-radius: var(--r-pill); background: var(--ink); color: var(--pearl); }
.catch-jar { display: grid; gap: 8px; width: min(100%, 320px); font-size: 14px; }
.catch-jar-line { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.catch-jar-line .num { font-size: 18px; }
.catch-meter { display: block; height: 10px; border-radius: var(--r-pill); background: var(--pearl); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.catch-meter i { display: block; height: 100%; border-radius: inherit; background: var(--c); box-shadow: inset 0 0 0 1px rgba(37, 22, 27, .16);
  transform: scaleX(var(--p)); transform-origin: 0 50%; transition: transform 1.2s var(--ease) .9s; }
[dir=rtl] .catch-meter i { transform-origin: 100% 50%; }
.catch-next { color: var(--ink-2); }
.catch-unlock { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 15px; }
.catch-unlock canvas { width: 46px; height: 46px; }
.catch-dot { flex: none; width: 16px; height: 16px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 1px rgba(37, 22, 27, .2); }

@media (max-width: 640px) {
  .catch .play-stage { height: clamp(580px, 80svh, 700px); }
  .catch-panel { gap: 12px; padding: 20px 16px; }
  .catch .play-panel-lead { font-size: 15px; }
  .catch-legend { gap: 6px; }
  .catch-legend li { width: 54px; }
  .catch-legend canvas { width: 38px; height: 38px; }
  .catch-final .play-actions-c .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .catch-star.is-on svg + svg, .catch-combo.bump { animation: none !important; }
  .catch-meter i { transition: none; }
}
