/* عصير الحظ — الندى · match-3 booth game. Alnada palette: orange #F15A25, maroon #7A0C0E, ink #3B0D0A, cream #FFF6EA · Cairo.
 * Geometry (board, counter line, mascot size) is measured in game.js layout() and handed over as CSS variables. */
@font-face {
  font-family: "Cairo"; font-style: normal; font-weight: 400 1000; font-display: swap;
  src: url("../assets/fonts/cairo.woff2") format("woff2");
}
:root {
  --orange: #F15A25; --orange-hi: #FF8A3D; --orange-dk: #C9431A; --maroon: #7A0C0E; --ink: #3B0D0A; --cream: #FFF6EA;
  --fg: #3B0D0A; --fg-2: rgba(59, 13, 10, .72); --fg-3: rgba(59, 13, 10, .5);
  --line: rgba(59, 13, 10, .08); --line-2: rgba(59, 13, 10, .15); --danger: #D2473E;
  --ease-out: cubic-bezier(.22, 1, .36, 1); --spring: cubic-bezier(.34, 1.4, .64, 1);
  --cell: 48px; --bs: 336px; --bx: 12px; --by: 220px; --u: 3.36px; --hd: 48px;
  --feet: 180px; --charH: 80px; --crewL: 8px; --crewT: 0px; --crewW: 344px; --crewH: 180px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; background: #FCE9D6; color: var(--fg);
  font-family: "Cairo", "Segoe UI", Tahoma, system-ui, sans-serif; line-height: 1.5;
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  overscroll-behavior: none; -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { -webkit-user-drag: none; }
[hidden] { display: none !important; }
.g-safe { position: fixed; visibility: hidden; pointer-events: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }

/* ---------------------------------------------------------------- background (size + position from layout()) */
.g-bg { position: fixed; inset: 0; z-index: 0; background-color: #FCE9D6; background-repeat: no-repeat; }
.g-plank { display: none; }
/* landscape without its own art: sky + orchard tint and a CSS counter */
.g-bg.fallback { background-image: linear-gradient(180deg, #CFEAF7 0, #E9F3D2 calc(var(--feet) - 60px), #F6D9B4 var(--feet), #FFF1E2 calc(var(--feet) + 40px), #FCE3CB 100%) !important; }
.g-bg.fallback .g-plank { display: block; position: absolute; inset-inline: 0; top: calc(var(--feet) - var(--charH) * .14); height: calc(var(--charH) * .34);
  background: linear-gradient(180deg, #F2A35C 0, #E3843D 42%, #C25A1E 44%, #A9481A 100%); box-shadow: 0 10px 24px -8px rgba(122, 12, 14, .4); }

/* ---------------------------------------------------------------- header: badge · moves · sound (positions from layout()) */
.g-top > * { position: fixed; z-index: 6; transform: translate(-50%, -50%); }
.g-badge { height: calc(var(--hd) * .86); aspect-ratio: 2.05; display: grid; place-items: center; border-radius: calc(var(--hd) * .24);
  background: linear-gradient(180deg, #FF7A3D 0%, #F15A25 60%, #DB4D1C 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 calc(var(--hd) * .08) calc(var(--hd) * .2) -4px rgba(122, 12, 14, .45), 0 0 0 calc(var(--hd) * .05) rgba(255, 255, 255, .85); }
.g-badge img { width: 78%; height: auto; display: block; }
.g-moves { min-width: calc(var(--hd) * 1.25); padding: calc(var(--hd) * .06) calc(var(--hd) * .22); border-radius: calc(var(--hd) * .3); display: flex; flex-direction: column; align-items: center; line-height: 1.05;
  background: rgba(255, 255, 255, .94); color: var(--maroon); box-shadow: 0 calc(var(--hd) * .1) calc(var(--hd) * .3) -6px rgba(122, 12, 14, .45), inset 0 0 0 2px rgba(241, 90, 37, .25); transition: opacity .3s, box-shadow .3s; }
.g-moves strong { font-size: calc(var(--hd) * .5); font-weight: 900; font-variant-numeric: tabular-nums; }
.g-moves span { order: -1; font-size: calc(var(--hd) * .2); font-weight: 800; color: var(--fg-3); }
.g-moves.low { color: #fff; background: linear-gradient(180deg, #FF7A3D, #F15A25); box-shadow: 0 0 0 3px rgba(255, 255, 255, .9), 0 12px 28px -10px rgba(241, 90, 37, .9); }
.g-moves.low span { color: rgba(255, 255, 255, .85); }
.g-moves.tick strong { animation: tickPop .35s var(--spring); }
@keyframes tickPop { 40% { transform: scale(1.25); } }
body.s-start .g-moves, body.p-open .g-moves { opacity: 0; pointer-events: none; }
body[data-lay="land"] .g-moves { min-width: calc(var(--hd) * 1.9); padding: calc(var(--hd) * .16) calc(var(--hd) * .3); border-radius: calc(var(--hd) * .4); }
body[data-lay="land"] .g-moves strong { font-size: calc(var(--hd) * .9); }
body[data-lay="land"] .g-moves span { font-size: calc(var(--hd) * .28); }
.g-mute { width: calc(var(--hd) * .78); height: calc(var(--hd) * .78); border-radius: 50%; border: 0; display: grid; place-items: center; padding: 0;
  background: rgba(255, 255, 255, .9); color: var(--maroon); box-shadow: 0 6px 16px -8px rgba(122, 12, 14, .5); }
.g-mute svg { width: 56%; height: 56%; fill: currentColor; }
.g-mute svg .w { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.g-mute .off, .g-mute[aria-pressed="true"] .on { display: none; }
.g-mute[aria-pressed="true"] .off { display: block; }
.g-mute:focus-visible, .btn:focus-visible { outline: 3px solid rgba(241, 90, 37, .5); outline-offset: 3px; }

/* ---------------------------------------------------------------- the crew: four mascots standing on the counter, each with an order bubble */
.g-crew { position: fixed; z-index: 3; left: var(--crewL); top: var(--crewT); width: var(--crewW); height: var(--crewH); display: flex; align-items: flex-end; justify-content: space-around; pointer-events: none; }
body[data-lay="side"] .g-crew { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; align-items: end; justify-items: center; }
.mate { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1 1 0; min-width: 0; }
.mate .char { display: block; height: var(--charH); width: auto; max-width: 118%; margin-bottom: calc(var(--charH) * -.035); transform-origin: 50% 96%;
  animation: breathe 3.6s ease-in-out infinite; animation-delay: calc(var(--i) * -.9s); filter: drop-shadow(0 calc(var(--charH) * .02) calc(var(--charH) * .025) rgba(122, 12, 14, .3)); }
@keyframes breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.015, .975); } }
body.s-start .mate .char { animation: bob 2.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.6s); }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(0); } 25% { transform: translateY(-5%) rotate(-2deg); } 50% { transform: translateY(0) rotate(0); } 75% { transform: translateY(-3%) rotate(2deg); } }
.mate.yay .char { animation: yay .7s var(--spring) 1; }
@keyframes yay { 0% { transform: translateY(0) scale(1); } 30% { transform: translateY(-22%) scale(1.04, .98); } 55% { transform: translateY(0) scale(1.08, .9); } 75% { transform: translateY(-6%); } 100% { transform: none; } }
body.s-won .mate .char { animation: cheer .9s ease-in-out infinite; animation-delay: calc(var(--i) * -.22s); }
@keyframes cheer { 0%, 100% { transform: translateY(0) scale(1.05, .95); } 45% { transform: translateY(-18%) scale(.97, 1.04) rotate(-3deg); } 60% { transform: translateY(-18%) rotate(3deg); } }
body.s-lost .mate:not(.done) .char { animation: none; transform: translateY(2%) rotate(-3deg); filter: saturate(.85) drop-shadow(0 4px 6px rgba(122, 12, 14, .25)); }
/* the matching Nadoo carton standing on the counter beside each friend (Farah 12-03) */
.mate .pack { position: absolute; z-index: 1; bottom: calc(var(--charH) * -.07); right: calc(50% - var(--charH) * .47); height: calc(var(--charH) * .44); width: auto;
  transform-origin: 50% 100%; transform: rotate(6deg); filter: drop-shadow(0 calc(var(--charH) * .02) calc(var(--charH) * .02) rgba(122, 12, 14, .35)); pointer-events: none; }
.mate.yay .pack { animation: packHop .6s var(--spring) 1; }
@keyframes packHop { 40% { transform: translateY(-14%) rotate(-4deg); } 100% { transform: rotate(6deg); } }


.bubble { position: relative; display: flex; align-items: center; gap: calc(var(--charH) * .04); height: calc(var(--charH) * .36); padding: 0 calc(var(--charH) * .1) 0 calc(var(--charH) * .06);
  margin-bottom: calc(var(--charH) * .08); border-radius: calc(var(--charH) * .18); background: #fff; color: var(--maroon);
  box-shadow: 0 calc(var(--charH) * .04) calc(var(--charH) * .1) -2px rgba(122, 12, 14, .35), inset 0 0 0 2px rgba(241, 90, 37, .18); transform-origin: 50% 120%; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: calc(var(--charH) * -.07); width: calc(var(--charH) * .14); height: calc(var(--charH) * .14); background: #fff; transform: translateX(-50%) rotate(45deg); border-radius: 0 0 4px 0; box-shadow: 3px 3px 4px -2px rgba(122, 12, 14, .18); }
.b-icon { width: calc(var(--charH) * .3); height: calc(var(--charH) * .3); object-fit: contain; position: relative; z-index: 1; }
.b-count { position: relative; z-index: 1; font-weight: 900; font-size: calc(var(--charH) * .22); line-height: 1; font-variant-numeric: tabular-nums; min-width: 1.2em; text-align: center; }
.b-check { display: none; position: relative; z-index: 1; width: calc(var(--charH) * .24); height: calc(var(--charH) * .24); border-radius: 50%; background: #3FAE49; padding: 3%; }
.b-check path { fill: none; stroke: #fff; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.mate.done .b-count { display: none; }
.mate.done .b-check { display: block; animation: checkIn .5s var(--spring); }
.mate.done .bubble { box-shadow: 0 6px 14px -6px rgba(63, 174, 73, .6), inset 0 0 0 2px rgba(63, 174, 73, .45); }
@keyframes checkIn { from { transform: scale(0) rotate(-30deg); } }
.bubble.bump { animation: bump .28s var(--ease-out); }
@keyframes bump { 40% { transform: scale(1.14); } }

/* ---------------------------------------------------------------- board */
.g-board { position: fixed; z-index: 2; left: var(--bx); top: var(--by); width: var(--bs); height: var(--bs); touch-action: none; border-radius: calc(var(--cell) * .3);
  background-color: rgba(255, 250, 244, .9);
  background-image: conic-gradient(rgba(241, 90, 37, .075) 25%, transparent 0 50%, rgba(241, 90, 37, .075) 0 75%, transparent 0);
  background-size: calc(var(--cell) * 2) calc(var(--cell) * 2);
  box-shadow: 0 0 0 calc(var(--cell) * .1) rgba(255, 255, 255, .92), 0 0 0 calc(var(--cell) * .1 + 2px) rgba(241, 90, 37, .22), 0 calc(var(--cell) * .4) calc(var(--cell) * .9) calc(var(--cell) * -.3) rgba(122, 12, 14, .42);
  transition: opacity .4s var(--ease-out), filter .4s; }
body.s-start .g-board { opacity: 0; pointer-events: none; }
body.s-won .g-board, body.s-lost .g-board { opacity: .45; filter: saturate(.7); pointer-events: none; }
.g-tiles { position: absolute; inset: 0; clip-path: polygon(-20% 0, 120% 0, 120% 120%, -20% 120%); }
.tile { position: absolute; left: 0; top: 0; width: var(--cell); height: var(--cell); will-change: transform; }
.face { position: absolute; inset: 5%; transition: transform .18s var(--ease-out); }
.face::before { content: ""; position: absolute; left: 16%; right: 16%; bottom: -3%; height: 16%; border-radius: 50%; background: radial-gradient(closest-side, rgba(122, 12, 14, .28), rgba(122, 12, 14, 0)); }
.face img, .face svg { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.tile.sel { z-index: 2; }
.tile.sel .face { transform: scale(1.12); }
.tile.sel::after { content: ""; position: absolute; inset: 1%; border-radius: 28%; box-shadow: 0 0 0 3px #fff, 0 0 0 5px rgba(241, 90, 37, .75), 0 0 calc(var(--cell) * .4) rgba(241, 90, 37, .55); animation: selPulse 1s ease-in-out infinite; pointer-events: none; }
@keyframes selPulse { 50% { opacity: .55; } }
.face.hint { animation: hint 1.15s ease-in-out infinite; }
@keyframes hint { 0%, 55%, 100% { transform: translate(0, 0) scale(1); } 15% { transform: translate(calc(var(--hx) * 9%), calc(var(--hy) * 9%)) scale(1.06); } 30% { transform: translate(calc(var(--hx) * -3%), calc(var(--hy) * -3%)) scale(1); } 42% { transform: translate(calc(var(--hx) * 6%), calc(var(--hy) * 6%)) scale(1.04); } }

/* line tile: candy stripes masked to the fruit + a juice streak across it (direction = what it clears) */
.tile .sp { position: absolute; inset: 0; pointer-events: none; }
.tile .sp::after { content: ""; position: absolute; inset: 0; -webkit-mask: var(--img) center / contain no-repeat; mask: var(--img) center / contain no-repeat; opacity: .75;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, .85) 0 7%, rgba(255, 255, 255, 0) 7% 19%); }
.tile.s-v .sp::after { background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .85) 0 7%, rgba(255, 255, 255, 0) 7% 19%); }
.tile .sp::before { content: ""; position: absolute; z-index: 1; border-radius: 99px; left: -8%; right: -8%; top: 42%; height: 16%;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--fc) 16%, #fff 50%, var(--fc) 84%, rgba(255, 255, 255, 0));
  box-shadow: 0 0 calc(var(--cell) * .14) var(--fc); animation: streakGlow 1.3s ease-in-out infinite; }
.tile.s-v .sp::before { left: 42%; right: auto; width: 16%; top: -8%; height: 116%; background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--fc) 16%, #fff 50%, var(--fc) 84%, rgba(255, 255, 255, 0)); }
@keyframes streakGlow { 50% { opacity: .55; transform: scale(.94); } }
.tile.s-h .face, .tile.s-v .face { filter: drop-shadow(0 0 calc(var(--cell) * .07) var(--fc)); }
/* bottle: a rotating ring of the four fruit colours behind زجاجة الندى */
.tile .ring { position: absolute; inset: -2%; border-radius: 50%; pointer-events: none;
  background: conic-gradient(#F7931E, #FFC23A, #8CC63F, #EF3F56, #F7931E);
  -webkit-mask: radial-gradient(closest-side, transparent 66%, #000 69% 86%, transparent 90%); mask: radial-gradient(closest-side, transparent 66%, #000 69% 86%, transparent 90%);
  animation: spin 2.6s linear infinite; }
.tile.s-b .face { inset: -3% 3%; animation: bottleBob 2.2s ease-in-out infinite; }
.tile.s-b .face img { filter: drop-shadow(0 calc(var(--cell) * .03) calc(var(--cell) * .03) rgba(122, 12, 14, .35)); }
.tile.s-b .face::before { display: none; }
.tile.s-b::before { content: ""; position: absolute; inset: 6%; border-radius: 50%; background: radial-gradient(closest-side, rgba(255, 214, 150, .9), rgba(255, 214, 150, 0)); }
@keyframes spin { to { transform: rotate(1turn); } }
@keyframes bottleBob { 50% { transform: translateY(-4%) rotate(-5deg); } }

/* effects */
.g-fx { position: absolute; inset: 0; pointer-events: none; }
.fx-splash { position: absolute; width: var(--cell); height: var(--cell); border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0) 52%, var(--fc) 60%, rgba(255, 255, 255, .0) 74%); }
.fx-drop { position: absolute; width: calc(var(--cell) * .16); height: calc(var(--cell) * .16); border-radius: 50% 50% 50% 0; background: var(--fc); pointer-events: none; }
.fx-streak { position: absolute; pointer-events: none; border-radius: 99px; background: linear-gradient(90deg, rgba(255, 255, 255, 0), var(--fc) 12%, #fff 50%, var(--fc) 88%, rgba(255, 255, 255, 0)); box-shadow: 0 0 calc(var(--cell) * .3) var(--fc); }
.fx-streak.v { background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--fc) 12%, #fff 50%, var(--fc) 88%, rgba(255, 255, 255, 0)); }
.fx-burst { position: absolute; width: calc(var(--cell) * 2); height: calc(var(--cell) * 2); border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 255, 255, .95), rgba(255, 200, 120, .7) 40%, rgba(241, 90, 37, 0) 72%); }
.fx-zap { position: absolute; height: calc(var(--cell) * .08); left: 0; top: 0; transform-origin: 0 50%; border-radius: 99px; background: linear-gradient(90deg, #fff, var(--fc)); pointer-events: none; box-shadow: 0 0 8px var(--fc); }
.g-combo { position: absolute; left: 50%; top: 42%; margin: 0; transform: translate(-50%, -50%); pointer-events: none; white-space: nowrap; opacity: 0; z-index: 5;
  font-weight: 900; font-size: calc(var(--cell) * .95); color: var(--orange); letter-spacing: 0;
  text-shadow: 0 2px 0 #fff, 2px 0 0 #fff, -2px 0 0 #fff, 0 -2px 0 #fff, 2px 2px 0 #fff, -2px -2px 0 #fff, 2px -2px 0 #fff, -2px 2px 0 #fff, 0 calc(var(--cell) * .12) calc(var(--cell) * .24) rgba(122, 12, 14, .45); }
.g-combo.info { font-size: calc(var(--cell) * .55); color: var(--maroon); }

/* flying fruit → order bubble */
.g-fly { position: fixed; inset: 0; z-index: 8; pointer-events: none; }
.g-fly img { position: absolute; left: 0; top: 0; will-change: transform; }

/* ---------------------------------------------------------------- panels over the board: start · win · lose */
.g-panel { position: fixed; z-index: 7; left: calc(var(--bx) + var(--bs) / 2); top: calc(var(--by) + var(--bs) / 2); transform: translate(-50%, -50%);
  width: min(calc(100vw - 16px), calc(var(--bs) * 1.04)); max-height: calc(100dvh - 16px); overflow: hidden;
  display: none; flex-direction: column; align-items: center; text-align: center; gap: calc(var(--u) * 2.6);
  padding: calc(var(--u) * 6) calc(var(--u) * 6.4); border-radius: calc(var(--u) * 7); background: rgba(255, 255, 255, .95);
  box-shadow: 0 0 0 calc(var(--u) * 1.2) rgba(255, 255, 255, .55), 0 calc(var(--u) * 6) calc(var(--u) * 14) calc(var(--u) * -5) rgba(122, 12, 14, .45); }
body.s-start .p-start, body.s-won .p-win, body.s-lost .p-lose { display: flex; animation: panelIn .55s var(--spring) both; }
body.p-open .g-panel { display: none !important; }
@keyframes panelIn { from { opacity: 0; transform: translate(-50%, -46%) scale(.94); } }
.g-title { margin: 0; font-weight: 900; line-height: 1.2; color: var(--maroon); font-size: calc(var(--u) * 12.5); }
.g-title em { font-style: normal; color: var(--orange); }
.g-sub { margin: 0; font-weight: 700; color: var(--fg-2); font-size: calc(var(--u) * 4.6); line-height: 1.45; }
.g-eyebrow { margin: 0; display: inline-flex; align-items: center; gap: .5em; padding: .25em 1em; border-radius: 99px; color: var(--orange-dk); background: rgba(241, 90, 37, .1);
  border: 1px solid rgba(241, 90, 37, .2); font-weight: 800; font-size: calc(var(--u) * 3.8); }
.g-how { list-style: none; margin: calc(var(--u) * .5) 0; padding: 0; display: flex; flex-direction: column; gap: calc(var(--u) * 2); width: 100%; text-align: start; }
.g-how li { display: flex; align-items: center; gap: calc(var(--u) * 3); font-size: calc(var(--u) * 4.1); font-weight: 700; color: var(--ink); line-height: 1.4; }
.g-how .ic { flex: none; width: calc(var(--u) * 10); height: calc(var(--u) * 10); border-radius: 30%; background: var(--cream) center / 72% no-repeat; box-shadow: inset 0 0 0 2px rgba(241, 90, 37, .2); }
.ic-swap { background-image: url("assets/t-mango.webp") !important; background-size: 52% !important; background-position: 18% 30% !important; position: relative; }
.ic-swap::after { content: ""; position: absolute; inset: 0; background: url("assets/t-orange.webp") 82% 72% / 52% no-repeat; }
.ic-three { background-image: url("assets/t-strawberry.webp"), url("assets/t-strawberry.webp"), url("assets/t-strawberry.webp") !important; background-size: 34% !important; background-position: 6% 50%, 50% 50%, 94% 50% !important; background-repeat: no-repeat !important; }
.ic-order { background-image: url("assets/c-guava.webp") !important; background-size: 86% !important; background-position: 50% 80% !important; }
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .5em; border: 0; border-radius: 999px; font-weight: 800; white-space: nowrap;
  transition: transform .16s var(--ease-out), box-shadow .2s, opacity .2s; min-height: 54px; padding: 0 1.6em; font-size: 18px; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { color: #fff; background: linear-gradient(180deg, #FF8A3D 0%, #F15A25 55%, #C9431A 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .38), inset 0 -2px 0 rgba(60, 22, 0, .12), 0 16px 32px -14px rgba(241, 90, 37, .75), 0 3px 8px -2px rgba(110, 50, 15, .25); }
.btn-primary::after { content: ""; position: absolute; inset: 1px 1px 50%; border-radius: 99px 99px 40% 40% / 99px 99px 30% 30%; pointer-events: none; background: linear-gradient(180deg, rgba(255, 255, 255, .2), rgba(255, 255, 255, 0)); }
.btn-primary:active { transform: translateY(1px) scale(.97); }
.g-panel .btn-xl { width: 100%; min-height: calc(var(--u) * 15); font-size: calc(var(--u) * 6.2); margin-top: calc(var(--u) * 1.5); }
.btn .spark { width: .8em; height: .8em; fill: currentColor; animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { transform: scale(1) rotate(0); opacity: .95; } 50% { transform: scale(.78) rotate(45deg); opacity: .7; } }
.btn-text { min-height: 0; padding: .35em 1em; background: none; color: var(--fg-3); font-weight: 800; font-size: 16px; }
.g-panel .btn-text { font-size: calc(var(--u) * 4.4); }
#playBtn { animation: nudge 2.8s ease-in-out 1.2s infinite; }
@keyframes nudge { 0%, 70%, 100% { transform: scale(1); } 80% { transform: scale(1.04); } 90% { transform: scale(.99); } }
.g-left { display: flex; gap: calc(var(--u) * 2.4); flex-wrap: wrap; justify-content: center; }
.g-left span { display: inline-flex; align-items: center; gap: calc(var(--u) * 1); padding: calc(var(--u) * 1) calc(var(--u) * 2.6) calc(var(--u) * 1) calc(var(--u) * 1.6); border-radius: 99px; background: var(--cream);
  font-weight: 900; font-size: calc(var(--u) * 5); color: var(--maroon); box-shadow: inset 0 0 0 2px rgba(241, 90, 37, .18); }
.g-left img { width: calc(var(--u) * 8); height: calc(var(--u) * 8); object-fit: contain; }
.g-left span.ok { color: #2F8A3A; box-shadow: inset 0 0 0 2px rgba(63, 174, 73, .35); }
.dots { display: none; gap: 6px; }
.dots i { width: .32em; height: .32em; border-radius: 50%; background: currentColor; animation: dot 1s infinite ease-in-out; }
.dots i:nth-child(2) { animation-delay: .15s; } .dots i:nth-child(3) { animation-delay: .3s; }
.dots.big { display: inline-flex; color: var(--orange); font-size: calc(var(--u) * 7); }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: scale(.7); } 40% { opacity: 1; transform: none; } }
.btn.loading .lbl { display: none; } .btn.loading .dots { display: inline-flex; }

/* ---------------------------------------------------------------- prize card (same look as the wheel's win card) */
.g-prize { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain; padding: 16px;
  padding-top: calc(env(safe-area-inset-top) + 16px); padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
  background: rgba(252, 233, 214, .55); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); animation: fadeIn .3s var(--ease-out) both; }
@keyframes fadeIn { from { opacity: 0; } }
.pcard { position: relative; margin: auto; flex: none; width: min(94vw, 760px); overflow: hidden; text-align: center; border-radius: 34px; background: #fff;
  padding: clamp(24px, 4.4vmin, 60px) clamp(20px, 4.4vmin, 64px) clamp(26px, 4.6vmin, 60px); display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.6vmin, 20px);
  box-shadow: 0 2px 4px rgba(80, 39, 15, .06), 0 50px 120px -30px rgba(100, 44, 12, .45); animation: cardIn .6s var(--spring) both; font-size: clamp(15px, 2.1vmin, 28px); }
@keyframes cardIn { from { opacity: 0; transform: translateY(26px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes emblemIn { from { opacity: 0; transform: scale(.6) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes objFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3.5%); } }
.p-wait, .p-msg, .p-main, .p-prize, .p-side, .p-claimed { display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 1.6vmin, 20px); width: 100%; min-width: 0; }
.p-wait-art img, .p-msg-art img { width: clamp(110px, 20vmin, 230px); height: auto; display: block; animation: bob 2.2s ease-in-out infinite; transform-origin: 50% 95%; }
.p-wait { padding: clamp(10px, 3vmin, 40px) 0; }
.p-emblem { position: relative; width: clamp(150px, 26vmin, 320px); aspect-ratio: 1; display: grid; place-items: center; animation: emblemIn .8s var(--spring) .1s both; }
.p-emblem::before { content: ""; position: absolute; inset: 4%; border-radius: 50%; z-index: 0; background: radial-gradient(closest-side, rgba(224, 152, 111, .55), rgba(244, 233, 227, .5) 55%, rgba(244, 233, 227, 0) 100%); }
.p-emblem.gold::before { background: radial-gradient(closest-side, rgba(251, 222, 150, .75), rgba(255, 244, 214, .55) 55%, rgba(255, 244, 214, 0) 100%); }
.p-emblem img { position: relative; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 18px 22px rgba(80, 34, 8, .28)); animation: objFloat 5s ease-in-out .9s infinite; }
.p-eyebrow { margin: 0; color: var(--orange-dk); font-weight: 800; font-size: clamp(15px, 2.3vmin, 28px); animation: riseIn .5s var(--ease-out) .2s both; }
.p-title { margin: 0; font-size: clamp(28px, 6.4vmin, 84px); font-weight: 900; line-height: 1.25; color: var(--ink); animation: riseIn .55s var(--ease-out) .28s both; overflow-wrap: anywhere; }
.p-lead { margin: 0; color: var(--fg-2); font-weight: 700; text-align: center; font-size: clamp(15px, 2.2vmin, 26px); line-height: 1.5; }
.p-form { display: flex; flex-direction: column; align-items: stretch; gap: clamp(8px, 1.4vmin, 18px); text-align: start; width: 100%; animation: riseIn .5s var(--ease-out) .36s both; }
.field { display: flex; flex-direction: column; gap: 6px; width: 100%; }
.label { font-weight: 700; color: var(--fg-2); font-size: clamp(14px, 1.9vmin, 24px); }
.field input { width: 100%; min-height: clamp(52px, 7vmin, 84px); padding: 0 .85em; border-radius: 14px; background: #FCF9F7; border: 1px solid rgba(59, 13, 10, .12); outline: none; color: var(--fg);
  font-size: clamp(18px, 2.7vmin, 34px); transition: border-color .15s, box-shadow .15s; -webkit-user-select: text; user-select: text; }
.field input::placeholder { color: rgba(59, 13, 10, .32); }
.field input:focus { background: #fff; border-color: var(--orange); box-shadow: 0 0 0 4px rgba(241, 90, 37, .16); }
.field input[dir="ltr"] { text-align: left; letter-spacing: .05em; font-variant-numeric: tabular-nums; }
.field.bad input { border-color: var(--danger); box-shadow: 0 0 0 4px rgba(210, 71, 62, .12); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(5px); } 75% { transform: translateX(-5px); } }
.err { color: var(--danger); font-size: clamp(13px, 1.7vmin, 21px); }
.err:empty { display: none; }
.pcard .btn { min-height: clamp(54px, 7.2vmin, 90px); font-size: clamp(17px, 2.5vmin, 32px); }
.pcard .btn-text { min-height: 0; font-size: clamp(14px, 1.9vmin, 22px); align-self: center; }
#pGo { width: 100%; margin-top: clamp(2px, .6vmin, 8px); }
.fine { margin: 0; color: var(--fg-3); font-size: clamp(12px, 1.6vmin, 19px); text-align: center; }
.p-claimed { animation: riseIn .45s var(--ease-out) both; }
.p-code { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: clamp(12px, 2vmin, 24px) clamp(26px, 5vmin, 68px); border-radius: 20px; background: #FAF6F2; border: 1px dashed rgba(241, 90, 37, .45); animation: riseIn .5s var(--ease-out) .36s both; }
.p-code strong { font-size: clamp(38px, 8vmin, 110px); line-height: 1.2; letter-spacing: .14em; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; margin-inline-start: .14em; }
.muted { color: var(--fg-2); margin: 0; } .small { font-size: .82em; text-align: center; }
.p-note { margin: 0; color: var(--fg-2); } .p-note:empty { display: none; }
#pDone { min-width: 52%; }
#pDone .check { width: 1.05em; height: 1.05em; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.p-timer { position: absolute; inset-inline: 0; bottom: 0; height: 4px; background: rgba(241, 90, 37, .1); }
.p-timer i { display: block; height: 100%; background: linear-gradient(90deg, #F15A25, #FFB07A); transform-origin: right; transform: scaleX(0); }
body[data-prize="claimed"] .p-emblem { width: clamp(120px, 20vmin, 260px); }
@media (orientation: landscape) and (min-width: 900px) {
  .pcard { width: min(94vw, 1180px); }
  .p-main { display: grid; grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr); align-items: center; gap: clamp(20px, 4vmin, 72px); }
  .p-side { padding-inline-start: clamp(20px, 4vmin, 64px); border-inline-start: 1px solid rgba(241, 90, 37, .14); }
}
@media (orientation: portrait) {
  .p-emblem { width: clamp(120px, 22vh, 340px); max-width: 46vw; }
}
@media (orientation: portrait) and (max-width: 640px) {
  .g-prize { padding: 12px; }
  .pcard { padding: 22px 18px 24px; border-radius: 28px; gap: 10px; }
  .p-emblem { width: min(40vw, 22vh); }
  .p-title { font-size: clamp(26px, 8vw, 40px); }
}

/* ---------------------------------------------------------------- toast, confetti, on-screen keyboard (booth) */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 30; pointer-events: none; visibility: hidden; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: calc(env(safe-area-inset-bottom) + clamp(16px, 4vmin, 48px)); transform: translate(-50%, 24px); max-width: min(92vw, 900px);
  padding: clamp(12px, 1.8vmin, 20px) clamp(18px, 3vmin, 34px); border-radius: 14px; background: #fff; color: var(--fg); border: 1px solid var(--line); box-shadow: 0 24px 60px -20px rgba(100, 44, 12, .45);
  font-size: clamp(15px, 2.2vmin, 28px); text-align: center; opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease-out); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.warn { border-color: rgba(183, 121, 31, .4); }
.osk { position: fixed; z-index: 26; bottom: 0; inset-inline: 0; margin-inline: auto; width: min(1180px, 96vw); padding: clamp(10px, 1.4vmin, 18px) clamp(10px, 1.6vmin, 22px) calc(env(safe-area-inset-bottom) + clamp(10px, 1.6vmin, 22px));
  background: rgba(249, 243, 240, .96); border-top: 1px solid rgba(255, 255, 255, .9); box-shadow: 0 -24px 60px -20px rgba(100, 44, 12, .35); animation: sheetIn .3s var(--ease-out) both; border-radius: 22px 22px 0 0; }
@keyframes sheetIn { from { transform: translateY(100%); } }
.osk-row { display: flex; gap: clamp(5px, .8vmin, 10px); justify-content: center; margin-bottom: clamp(5px, .8vmin, 10px); }
.osk-key { flex: 1 1 0; min-width: 0; height: clamp(54px, 7.2vmin, 90px); border-radius: 14px; border: 1px solid rgba(59, 13, 10, .07); background: #fff; color: var(--fg);
  font-size: clamp(20px, 2.9vmin, 34px); font-weight: 700; box-shadow: 0 2px 0 rgba(80, 39, 15, .1); transition: transform .08s, background-color .12s; }
.osk-key:active { background: #FFF6EA; transform: translateY(1px) scale(.97); box-shadow: none; }
.osk-key.wide { flex-grow: 2.2; } .osk-key.xwide { flex-grow: 5; }
.osk-key.act { background: linear-gradient(180deg, #FF8A3D, #F15A25); color: #fff; border-color: transparent; }
.osk.num { width: min(560px, 96vw); }
.osk.num .osk-key { height: clamp(62px, 8.2vmin, 100px); font-size: clamp(26px, 3.8vmin, 46px); }
body.osk-open .g-prize { justify-content: flex-start; padding-top: clamp(12px, 2vmin, 28px); padding-bottom: 46vh; }
body.osk-open .pcard { margin-top: 0; }
body.osk-open .p-lead, body.osk-open .p-form .fine { display: none; }
body.osk-open .p-emblem { width: clamp(90px, 12vh, 200px); }

/* ---------------------------------------------------------------- lite: the kiosk screen (/kiosk → ?kiosk=1, weak Mali GPU at 4K)
   no filters / blur / box-shadow animations; the friends still move (transform only, cheap on the compositor) */
html.lite *, html.lite *::before, html.lite *::after { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html.lite .mate .char, html.lite .mate .pack, html.lite .tile .face, html.lite .tile.s-b .face img, html.lite .p-emblem img,
html.lite body.s-won .g-board, html.lite body.s-lost .g-board, html.lite body.s-lost .mate:not(.done) .char { filter: none !important; }
html.lite .mate .char { animation: none; }
html.lite body.s-start .mate .char { animation: bob 3s ease-in-out infinite; animation-delay: calc(var(--i) * -.75s); }
html.lite .mate.yay .char { animation: yay .7s var(--spring) 1; }
html.lite body.s-won .mate .char { animation: cheer 1s ease-in-out infinite; animation-delay: calc(var(--i) * -.25s); }
html.lite .tile.sel::after { animation: none; box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(241, 90, 37, .85); }
html.lite .tile .sp::before { animation: none; box-shadow: none; }
html.lite .g-prize { background: rgba(252, 233, 214, .9); }
html.lite .pcard { box-shadow: 0 30px 60px -30px rgba(100, 44, 12, .45); }
html.lite .btn .spark { animation: none; }
html.kiosk, html.kiosk body { overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
html.kiosk input { -webkit-user-select: text; user-select: text; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .face.hint { animation: none !important; outline: 3px solid rgba(241, 90, 37, .7); outline-offset: -2px; border-radius: 30%; }
}
