/* ===== "Try it" demos, set D: Horse Race, Memory Match, Penalty Shootout, Safe Cracker =====
   JS: assets/demo-game-horse-race.js, -memory-match.js, -penalty-shootout.js, -safe-cracker.js.
   Each game is recreated from its real source (webapp/frontend/src/components/instant-games/<key>/), restyled to the
   site's Matinee 2 look: a flat ticket-stock stage (the same tint as the game's card on the page), navy ink, ticket
   red, orange, gold. No pink, purple, violet or teal; green only on a win. No gradient containers.
   Every selector is scoped under .dgd. Motion is transform/opacity only. Reduced motion: competitions.js passes
   opts.reduce and the demos add .is-reduced; site.css also turns every animation and transition off, so every end
   state below is reached without one. */

.dgd { position: relative; width: 100%; max-width: 520px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; font-family: var(--f-body); color: var(--text); }
.dgd p { margin: 0; }
.dgd [hidden] { display: none !important; }
.dgd button { font-family: inherit; }
.dgd *, .dgd *::before, .dgd *::after { box-sizing: border-box; }

/* Top row: a red pen note pointing at the game, and the real host's "Skip to result" (RevealGameHost.tsx:40-53) */
.dgd-bar { display: flex; align-items: flex-end; gap: 10px; min-height: 34px; }
.dgd-pen { flex: 1 1 auto; min-width: 0; margin: 0 0 -6px; font: 400 1.08rem/1.15 var(--f-hand); color: var(--accent); transform: rotate(-1.5deg); transform-origin: 0 50%; }
.dgd-pen::after { content: ""; display: inline-block; width: 30px; height: 20px; margin-left: 8px; vertical-align: -9px; background: currentColor;
  --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 44 30' fill='none' stroke='%23000' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3C7 17 20 24 39 22M39 22l-8-6M39 22l-9 5'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: var(--m); mask: var(--m); }
.dgd-skip { flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border: 1px solid var(--line-2); border-radius: 999px; background: var(--surface);
  color: var(--muted); font: 500 .75rem/1.2 var(--f-body); cursor: pointer; transition: color .1s ease-in-out, border-color .1s ease-in-out; }
.dgd-skip:hover { color: var(--text); border-color: var(--ink); }
.dgd-skip svg { width: 16px; height: 16px; flex: none; }

/* The game's window: a flat stock-tint ticket (tint set per game below) */
.dgd-stage { position: relative; display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 16px 10px 12px; overflow: hidden;
  background: var(--tint, var(--st0)); border: 1px solid var(--line); border-radius: var(--r-m); -webkit-user-select: none; user-select: none; }
/* Fixed two-line room, as every real game's hint: it changes during play and must never move the controls */
.dgd-hint { width: 100%; min-height: 2.8em; font-size: 14px; line-height: 1.4; text-align: center; color: var(--muted); }
.dgd-hint b { font-family: var(--f-display); font-weight: 800; color: var(--accent); }
.dgd-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---------- the result that follows the game (RevealPrizePopup.tsx:94-204 + RevealOutcomeMessage.tsx:234-239) ---------- */
.dgd-result { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 18px 18px; background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-soft); animation: dgd-result-in .45s cubic-bezier(.16,1.2,.3,1) both; }
.dgd-result.is-win { border: 2px solid var(--ga); }
.dgd-r-kicker { font: 700 1.125rem/1.2 var(--f-display); margin-bottom: 4px !important; }
.dgd-r-head { font: 900 1.6rem/1.1 var(--f-display); margin-bottom: 12px !important; }
.dgd-result.is-win .dgd-r-kicker, .dgd-result.is-win .dgd-r-head { color: var(--good); }
.dgd-result.is-loss .dgd-r-kicker { color: var(--faint); }
.dgd-result.is-loss .dgd-r-head { color: var(--bad); }
.dgd-r-prize { font-size: .95rem; font-weight: 500; color: var(--text); }
.dgd-r-prize b { font-weight: 900; color: var(--accent); }
.dgd-r-note, .dgd-r-lines { max-width: 28rem; font-size: .8rem; line-height: 1.5; color: var(--muted); }
.dgd-r-note { margin-top: 14px !important; }
.dgd-again { width: 100%; margin-top: 16px; }
@keyframes dgd-result-in { from { opacity: 0; transform: scale(.92) translateY(8px); } }
.dgd.is-reduced .dgd-result { animation: none; }
@media (min-width: 520px) {
  .dgd-r-kicker { font-size: 1.5rem; }
  .dgd-r-head { font-size: 2.1rem; }
  .dgd-r-prize { font-size: 1.15rem; }
}


/* =========================== HORSE RACE (HorseGame.tsx + HorseGame.module.css) =========================== */
/* The app's turf is green; here the track is flat sand stock (green is kept for wins only) */
.dgd--horse { --tint: var(--st3); --hr-lane: 44px; --hr-horse: 74px; }
@media (max-width: 480px) { .dgd--horse { --hr-lane: 36px; --hr-horse: 56px; } }
.dgd-hr-wrap { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.dgd-hr-banner { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--surface); border: 1.5px solid var(--ink); }
.dgd-hr-banner small { display: block; font: 600 10px var(--f-body); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); }
.dgd-hr-banner b { font: 700 16px var(--f-display); color: var(--ink); }
.dgd-hr-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dgd-hr-odds { font: 600 12px var(--f-body); color: var(--faint); white-space: nowrap; }
.dgd-hr-silk { width: 30px; height: 30px; border-radius: 8px; flex: none; display: flex; justify-content: center; align-items: center;
  font: 700 15px var(--f-display); box-shadow: inset 0 -3px 0 rgba(0,0,0,.2); }
.dgd-hr-track { position: relative; height: calc(var(--hr-lane) * 5 + 26px); border-radius: 14px; overflow: hidden; background: #e0d9c7; border: 1.5px solid var(--ink); }
.dgd-hr-rail { position: absolute; left: 0; right: 0; top: 0; height: 22px; z-index: 1; background: var(--ink); }
.dgd-hr-rail::before { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 3px; background: #f4f5f8; }
.dgd-hr-rail::after { content: ""; position: absolute; left: 0; right: 0; top: 9px; height: 13px;
  background: repeating-linear-gradient(90deg, #f4f5f8 0 3px, transparent 3px 34px); }
.dgd-hr-lane { position: absolute; left: 0; right: 0; height: var(--hr-lane); border-top: 1px solid rgba(19,24,54,.12); }
.dgd-hr-lane.mine { background: var(--st0); box-shadow: inset 0 1px 0 rgba(19,24,54,.25), inset 0 -1px 0 rgba(19,24,54,.25); }
.dgd-hr-laneno { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 700 11px var(--f-display); color: rgba(19,24,54,.4); }
.dgd-hr-horse { position: absolute; left: 0; bottom: 1px; width: var(--hr-horse); will-change: transform; }
.dgd-hr-svg { display: block; width: 100%; height: auto; overflow: visible; }
.dgd-hr-horse.run .l1 { animation: dgd-hr-gallop .4s linear infinite; }
.dgd-hr-horse.run .l3 { animation: dgd-hr-gallop .4s linear infinite -.07s; }
.dgd-hr-horse.run .l2 { animation: dgd-hr-hind .4s linear infinite -.2s; }
.dgd-hr-horse.run .l4 { animation: dgd-hr-hind .4s linear infinite -.27s; }
.dgd-hr-horse.run .dgd-hr-bob { animation: dgd-hr-bob .2s ease-in-out infinite alternate; }
.dgd-hr-horse.slow .dgd-hr-leg, .dgd-hr-horse.slow .dgd-hr-bob { animation-duration: .8s !important; }
@keyframes dgd-hr-gallop { 0% { transform: rotate(-34deg); } 50% { transform: rotate(26deg); } 100% { transform: rotate(-34deg); } }
@keyframes dgd-hr-hind { 0% { transform: rotate(30deg); } 50% { transform: rotate(-30deg); } 100% { transform: rotate(30deg); } }
@keyframes dgd-hr-bob { from { transform: translateY(0); } to { transform: translateY(-2.5px); } }
.dgd-hr-you { position: absolute; left: 44%; top: -15px; transform: translateX(-50%); padding: 1px 6px; border-radius: 99px; z-index: 2;
  font: 700 9px var(--f-body); letter-spacing: .1em; color: #fff; background: var(--ga); white-space: nowrap; }
.dgd-hr-place { position: absolute; left: 44%; top: -15px; transform: translateX(-50%) scale(0); z-index: 3; padding: 1px 6px; border-radius: 99px;
  font: 700 10px var(--f-display); color: #fff; background: var(--ink); border: 1px solid #fff; white-space: nowrap; transition: transform .25s cubic-bezier(.3,1.6,.5,1); }
.dgd-hr-place.on { transform: translateX(-50%) scale(1); }
.dgd-hr-place.first { color: var(--ink); background: #f0c24e; border-color: var(--ink); }
.dgd-hr-gates { position: absolute; left: 0; top: 22px; width: calc(var(--hr-horse) + 14px); bottom: 4px; z-index: 3; pointer-events: none; transition: opacity .6s ease-out .9s; }
.dgd-hr-gates.open { opacity: .35; }
.dgd-hr-stall { position: absolute; left: 0; right: 0; height: var(--hr-lane); border-right: 4px solid #aeb1b6; background: rgba(19,24,54,.3); box-shadow: inset 0 -2px 0 #5b5f70; }
.dgd-hr-stall b { position: absolute; right: 6px; top: 3px; font: 700 9px var(--f-display); color: #fff; background: #5b5f70; border-radius: 3px; padding: 0 4px; }
.dgd-hr-door { position: absolute; right: -4px; top: 0; bottom: 0; width: 6px; background: repeating-linear-gradient(180deg, #f4f5f8 0 5px, var(--ga) 5px 10px);
  transform-origin: 50% 0; transition: transform .25s cubic-bezier(.5,0,.5,1.4); }
.dgd-hr-gates.open .dgd-hr-door { transform: scaleY(0); }
.dgd-hr-post { position: absolute; left: 86%; top: 6px; bottom: 0; width: 5px; margin-left: -2px; z-index: 2;
  background: repeating-linear-gradient(180deg, #fff 0 6px, #111 6px 12px); box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.dgd-hr-post::before { content: ""; position: absolute; left: 50%; top: -1px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%;
  background: var(--ga); border: 5px solid var(--ga); box-shadow: inset 0 0 0 2px #fff, 0 2px 4px rgba(0,0,0,.3); }
.dgd-hr-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; z-index: 5; }
.dgd-hr-flash.on { animation: dgd-hr-flash .5s ease-out; }
@keyframes dgd-hr-flash { 0% { opacity: .9; } 100% { opacity: 0; } }
.dgd-hr-photo { position: absolute; right: 10px; top: 28px; z-index: 6; padding: 3px 8px; border-radius: 6px; font: 700 11px var(--f-display); letter-spacing: .08em;
  color: var(--ink); background: #fff; border: 1.5px solid var(--ink); transform: rotate(-4deg) scale(0); transition: transform .3s cubic-bezier(.3,1.6,.5,1); }
.dgd-hr-photo.on { transform: rotate(-4deg) scale(1); }
.dgd-hr-ticker { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: var(--ink); min-height: 40px; }
.dgd-hr-ticker i { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ga); animation: dgd-hr-live 1s ease-in-out infinite; }
@keyframes dgd-hr-live { 50% { opacity: .3; } }
.dgd-hr-ticker span { font: 500 14px var(--f-body); color: #fff; min-width: 0; }
.dgd-hr-ticker span.new { animation: dgd-hr-tick .35s ease-out; }
@keyframes dgd-hr-tick { from { opacity: 0; transform: translateY(6px); } }
.dgd-hr-board { position: absolute; inset: 10px; z-index: 7; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; justify-content: center;
  background: var(--surface); border: 1.5px solid var(--ink); opacity: 0; transform: scale(.96); transition: opacity .3s, transform .3s; pointer-events: none; }
.dgd-hr-board.on { opacity: 1; transform: none; }
.dgd-hr-row { display: flex; align-items: center; gap: 10px; padding: 3px 8px; border-radius: 8px; font-size: 14px; color: var(--text); }
.dgd-hr-row .dgd-hr-silk { width: 20px; height: 20px; border-radius: 5px; font-size: 11px; }
.dgd-hr-row em { font: 700 13px var(--f-display); font-style: normal; width: 30px; color: var(--faint); }
.dgd-hr-row.mine { background: var(--st0); outline: 1.5px solid var(--ink); }
.dgd-hr-row.mine em, .dgd-hr-row.mine span { color: var(--ink); font-weight: 600; }
.dgd-hr-prize { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 0 8px 2px; font: 600 12px var(--f-body);
  color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgd-hr-prize b { font: 800 16px var(--f-display); color: var(--ink); }
@media (max-width: 480px) {
  .dgd-hr-row { font-size: 12px; padding: 2px 6px; }
  .dgd-hr-banner b { font-size: 14px; }
  .dgd-hr-prize b { font-size: 14px; }
}
/* Reduced motion: no gallop, bob, flash, pops or ticker slide; the horses step every 500 ms instead of gliding (HorseGame.tsx) */
.dgd.is-reduced .dgd-hr-horse .dgd-hr-leg, .dgd.is-reduced .dgd-hr-horse .dgd-hr-bob { animation: none !important; }
.dgd.is-reduced .dgd-hr-flash.on, .dgd.is-reduced .dgd-hr-ticker span.new, .dgd.is-reduced .dgd-hr-ticker i { animation: none; }
.dgd.is-reduced .dgd-hr-door, .dgd.is-reduced .dgd-hr-place, .dgd.is-reduced .dgd-hr-photo, .dgd.is-reduced .dgd-hr-board, .dgd.is-reduced .dgd-hr-gates { transition: none; }


/* =========================== MEMORY MATCH (MemoryGame.tsx + MemoryGame.module.css) =========================== */
.dgd--memory { --tint: var(--st4); }
.dgd-mm-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: min(340px, 100%); }
.dgd-mm-goes { display: flex; align-items: center; gap: 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.dgd-mm-goes i { width: 12px; height: 12px; border-radius: 50%; background: var(--ga); transition: background .3s; }
.dgd-mm-goes i.bonus { background: #f0c24e; box-shadow: 0 0 0 1.5px var(--ink); }
.dgd-mm-goes i.used, .dgd-mm-goes i.bonus.used { background: var(--surface-2); box-shadow: none; }
.dgd-mm-goal { font-size: 12px; color: var(--faint); }
.dgd-mm-goal b { color: var(--ink); background: #f0c24e; padding: 0 5px; border-radius: 4px; }
.dgd-mm-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; width: min(340px, 100%); }
.dgd-mm-card { position: relative; aspect-ratio: 3 / 4; padding: 0; border: 0; background: none; perspective: 700px; cursor: pointer; border-radius: 10px;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.dgd-mm-card[disabled] { cursor: default; }
.dgd-mm-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dgd-mm-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform .5s cubic-bezier(.3,1.2,.5,1); }
.dgd-mm-card.flipped .dgd-mm-inner { transform: rotateY(180deg); }
.dgd-mm-side { position: absolute; inset: 0; border-radius: 10px; backface-visibility: hidden; -webkit-backface-visibility: hidden; display: flex; justify-content: center; align-items: center; }
.dgd-mm-back { background: var(--ink); box-shadow: inset 0 0 0 4px #1d2346, inset 0 0 0 5px rgba(240,194,78,.45), 0 6px 14px -6px rgba(19,24,54,.6); transition: transform .15s; }
.dgd-mm-back svg { width: 46%; height: auto; }
.dgd-mm-card:not([disabled]):hover .dgd-mm-back { transform: translateY(-2px); }
.dgd-mm-front { transform: rotateY(180deg); background: var(--surface); border: 1px solid var(--line-2); box-shadow: 0 6px 14px -6px rgba(19,24,54,.6); }
.dgd-mm-face { width: 100%; height: 100%; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2px; border-radius: 10px; }
.dgd-mm-face svg { width: 58%; height: auto; }
.dgd-mm-face.gold { background: #f0c24e; }
.dgd-mm-face.gold span { font: 700 9px var(--f-display); letter-spacing: .14em; color: #6b4a00; }
/* Marks: an ordinary pair dims, a wrong pair rings red, the gold pair rings ink and bounces */
.dgd-mm-card.pair .dgd-mm-front { opacity: .55; }
.dgd-mm-card.wrong .dgd-mm-front { box-shadow: 0 0 0 2.5px var(--ga), 0 6px 14px -6px rgba(19,24,54,.6); }
.dgd-mm-card.match .dgd-mm-front { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #f0c24e; }
.dgd-mm-card.match .dgd-mm-inner { animation: dgd-mm-bounce .6s ease-out; }
@keyframes dgd-mm-bounce { 40% { transform: rotateY(180deg) scale(1.1); } }
/* Bonus go: the gold cards already seen glow through their backs (a gold ring; its halo pulses with opacity) */
.dgd-mm-card.glow .dgd-mm-back { box-shadow: inset 0 0 0 4px #1d2346, inset 0 0 0 6px #f0c24e, 0 6px 14px -6px rgba(19,24,54,.6); }
.dgd-mm-card.glow::after { content: ""; position: absolute; inset: -5px; border-radius: 13px; border: 3px solid #f0c24e; pointer-events: none; animation: dgd-mm-glow 1.2s ease-in-out infinite; }
@keyframes dgd-mm-glow { 50% { opacity: .25; } }
.dgd-mm-card.flipped.glow::after { display: none; }
/* End-of-game reveal: turned-over cards are dimmed ghosts; on a loss the gold ones stay bright */
.dgd-mm-card.ghost .dgd-mm-front { opacity: .42; }
.dgd-mm-card.ghost.was-gold .dgd-mm-front { opacity: 1; }
.dgd-mm-card.was-gold .dgd-mm-front { box-shadow: 0 0 0 3px var(--ink), 0 0 0 6px #f0c24e; }
.dgd.is-reduced .dgd-mm-inner, .dgd.is-reduced .dgd-mm-back, .dgd.is-reduced .dgd-mm-goes i { transition: none; }
.dgd.is-reduced .dgd-mm-card.match .dgd-mm-inner, .dgd.is-reduced .dgd-mm-card.glow::after { animation: none; }


/* =========================== PENALTY SHOOTOUT (PenaltyGame.tsx + PenaltyGame.module.css) =========================== */
/* The app's pitch is green; here it is flat sand stock under a navy stand (green is kept for wins only) */
.dgd--penalty { --tint: var(--st2); }
.dgd-pk-score { display: flex; justify-content: center; align-items: center; gap: 10px; }
.dgd-pk-slot { width: 30px; height: 30px; border-radius: 50%; padding: 3px; border: 2px solid var(--line-2); background: var(--surface); opacity: .45; transition: opacity .3s, border-color .3s; }
.dgd-pk-slot svg { width: 100%; height: 100%; display: block; }
.dgd-pk-slot.scored { opacity: 1; border-color: var(--ink); box-shadow: 0 0 0 3px #f0c24e; }
.dgd-pk-slot.saved { opacity: 1; border-color: var(--ga); }
.dgd-pk-slot.saved svg { opacity: .5; }
.dgd-pk-pitch { position: relative; width: min(440px, 100%); aspect-ratio: 360 / 260; border-radius: 12px; overflow: hidden; border: 1.5px solid var(--ink); }
.dgd-pk-scene { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.dgd-pk-net { transform-box: fill-box; transform-origin: 50% 50%; }
.dgd-pk-net.ripple { animation: dgd-pk-ripple .45s ease-out; }
@keyframes dgd-pk-ripple { 30% { transform: scale(1.025, 1.04); } 60% { transform: scale(.995); } }
.dgd-pk-zones { position: absolute; left: 11.6%; right: 11.6%; top: 12.3%; height: 45.4%; display: grid; grid-template-columns: repeat(3, 1fr); z-index: 3; }
.dgd-pk-zone { position: relative; display: flex; justify-content: center; align-items: center; padding: 0; border: 0; background: transparent; cursor: crosshair;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.dgd-pk-zone:focus-visible { outline: 2px solid #f0c24e; outline-offset: -4px; border-radius: 8px; }
.dgd-pk-zone span { position: relative; width: 34%; aspect-ratio: 1; border-radius: 50%; border: 2px dashed rgba(255,255,255,.7);
  animation: dgd-pk-pulse 1.6s ease-in-out infinite; transition: border-color .2s, background-color .2s, opacity .2s; }
.dgd-pk-zone span::after { content: ""; position: absolute; left: 50%; top: 50%; width: 5px; height: 5px; margin: -2.5px; border-radius: 50%; background: #fff; }
.dgd-pk-zone:hover span, .dgd-pk-zone:focus-visible span { border-style: solid; border-color: #f0c24e; background: rgba(240,194,78,.2); }
.dgd-pk-zones.busy .dgd-pk-zone { cursor: default; }
.dgd-pk-zones.busy .dgd-pk-zone span { opacity: 0; animation: none; }
@keyframes dgd-pk-pulse { 50% { transform: scale(1.12); } }
.dgd-pk-keeper { position: absolute; left: 50%; top: 26.6%; width: 20%; z-index: 2; transform: translateX(-50%); transition: transform .42s cubic-bezier(.2,.8,.3,1); }
.dgd-pk-keeper svg { width: 100%; height: auto; display: block; }
.dgd-pk-keeper.dive0 { transform: translate(calc(-50% - 128%), 10%) rotate(-74deg); }
.dgd-pk-keeper.dive1 { transform: translate(-50%, -14%); }
.dgd-pk-keeper.dive2 { transform: translate(calc(-50% + 128%), 10%) rotate(74deg); }
/* The ball rides two full-pitch layers so a translate in % is a % of the pitch: X across, Y up (the app animates left/top) */
.dgd-pk-bx, .dgd-pk-by { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.dgd-pk-bx { transition: transform .48s cubic-bezier(.25,.7,.35,1); }
.dgd-pk-by { transition: transform .48s cubic-bezier(.3,.55,.4,1); }
.dgd-pk-ball { position: absolute; left: 0; top: 0; width: 8.5%; transform: translate(-50%, -50%); transition: transform .48s ease-out; }
.dgd-pk-ball svg { width: 100%; height: auto; display: block; }
.dgd-pk-ball.flying svg { animation: dgd-pk-spin .48s linear; }
@keyframes dgd-pk-spin { to { transform: rotate(540deg); } }
.dgd-pk-pitch.still .dgd-pk-bx, .dgd-pk-pitch.still .dgd-pk-by, .dgd-pk-pitch.still .dgd-pk-ball, .dgd-pk-pitch.still .dgd-pk-keeper { transition: none !important; }
.dgd-pk-call { position: absolute; left: 50%; top: 66%; z-index: 5; transform: translate(-50%, -50%); padding: 4px 16px; border-radius: 12px; pointer-events: none; white-space: nowrap;
  font: 800 clamp(26px, 7vw, 38px) var(--f-display); letter-spacing: .04em; animation: dgd-pk-call .9s ease-out forwards; }
.dgd-pk-call.goal { color: #fff; background: var(--ink); border: 2px solid #f0c24e; }
.dgd-pk-call.save { color: #fff; background: var(--ga); }
@keyframes dgd-pk-call { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 25% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; } 80% { opacity: 1; } 100% { transform: translate(-50%, -62%) scale(1); opacity: 0; } }
/* Reduced motion: the keeper and ball jump to their spots; nothing pulses, spins, ripples or pops (the call shows still, then goes) */
.dgd.is-reduced .dgd-pk-zone span, .dgd.is-reduced .dgd-pk-ball.flying svg, .dgd.is-reduced .dgd-pk-net.ripple, .dgd.is-reduced .dgd-pk-call { animation: none; }
.dgd.is-reduced .dgd-pk-keeper, .dgd.is-reduced .dgd-pk-bx, .dgd.is-reduced .dgd-pk-by, .dgd.is-reduced .dgd-pk-ball, .dgd.is-reduced .dgd-pk-slot { transition: none; }


/* =========================== SAFE CRACKER (SafeGame.tsx + SafeGame.module.css) =========================== */
.dgd--safe { --tint: var(--st0); }
.dgd-sc-target { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); }
.dgd-sc-target span { width: 30px; height: 36px; display: flex; justify-content: center; align-items: center; border-radius: 8px; letter-spacing: 0;
  background: var(--ink); border: 1.5px solid #f0c24e; color: #f0c24e; font: 700 20px var(--f-display); }
.dgd-sc-safe { position: relative; width: min(268px, 100%); aspect-ratio: 1; border-radius: 22px; perspective: 900px; background: #1d2346;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.14), inset 0 -3px 0 rgba(0,0,0,.35), 0 24px 40px -24px rgba(19,24,54,.7); }
.dgd-sc-bolt { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: #aeb1b6; }
.dgd-sc-bolt.tl { left: 12px; top: 12px; } .dgd-sc-bolt.tr { right: 12px; top: 12px; }
.dgd-sc-bolt.bl { left: 12px; bottom: 12px; } .dgd-sc-bolt.br { right: 12px; bottom: 12px; }
.dgd-sc-vault { position: absolute; inset: 26px; border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 6px;
  background: #0a0d1f; box-shadow: inset 0 0 0 2px rgba(240,194,78,.35); }
.dgd-sc-vault svg { width: 58%; height: auto; }
.dgd-sc-vault b { font: 800 26px var(--f-display); color: #f0c24e; text-align: center; }
.dgd-sc-vault small { max-width: 90%; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #ffe08a; text-align: center; }
.dgd-sc-hinge { position: absolute; left: 12px; width: 12px; height: 34px; border-radius: 4px; background: #aeb1b6; z-index: 1; }
.dgd-sc-door { position: absolute; inset: 22px; z-index: 2; border-radius: 14px; transform-origin: left center; transition: transform 1.1s cubic-bezier(.3,.75,.25,1);
  background: #2b3254; border: 1px solid #5b5f70; box-shadow: inset 0 1px 0 rgba(255,255,255,.18), inset 0 0 0 6px rgba(0,0,0,.12), 6px 0 18px rgba(0,0,0,.4);
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; }
.dgd-sc-door.open { transform: rotateY(-78deg); }
/* Two identical clunks so each lock restarts the animation (as the app) */
.dgd-sc-door.clunk-a { animation: dgd-sc-clunk-a .18s ease-out; }
.dgd-sc-door.clunk-b { animation: dgd-sc-clunk-b .18s ease-out; }
.dgd-sc-door.rattle { animation: dgd-sc-rattle .45s ease-in-out; }
@keyframes dgd-sc-clunk-a { 40% { transform: translate(1px, 2px); } }
@keyframes dgd-sc-clunk-b { 40% { transform: translate(1px, 2px); } }
@keyframes dgd-sc-rattle { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
.dgd-sc-digits { display: flex; gap: 6px; }
.dgd-sc-digits span { width: 30px; height: 38px; display: flex; justify-content: center; align-items: center; border-radius: 6px;
  background: #0a0d1f; border: 1.5px solid #5b5f70; color: #aeb1b6; font: 700 21px var(--f-display); font-variant-numeric: tabular-nums; transition: border-color .2s, color .2s; }
.dgd-sc-digits span.locked { color: #f0c24e; border-color: #f0c24e; }
.dgd-sc-digits span.wrong { color: #fff; background: var(--ga); border-color: var(--ga); }
.dgd-sc-dial { width: 112px; height: 112px; display: block; }
.dgd-sc-face { transform-box: fill-box; transform-origin: center; }
.dgd-sc-handle { position: absolute; right: 14px; top: 50%; width: 12px; height: 54px; margin-top: -27px; border-radius: 6px; background: #e8e2d3; box-shadow: 0 3px 8px rgba(0,0,0,.45);
  transform-origin: 50% 50%; transition: transform .5s cubic-bezier(.3,1.4,.5,1); }
.dgd-sc-handle.turn { transform: rotate(90deg); }
/* The lamp: green only when the safe opens (the win), red on a miss */
.dgd-sc-lamp { position: absolute; right: 16px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: #3a2124; box-shadow: inset 0 1px 2px #000; }
.dgd-sc-lamp.green { background: var(--good); box-shadow: 0 0 0 2px rgba(10,138,96,.35); }
.dgd-sc-lamp.red { background: var(--ga); box-shadow: 0 0 0 2px rgba(224,32,42,.35); animation: dgd-sc-blink .5s steps(2) 3; }
@keyframes dgd-sc-blink { 50% { opacity: .3; } }
@media (max-width: 420px) {
  .dgd-sc-dial { width: 92px; height: 92px; }
  .dgd-sc-digits span { width: 26px; height: 34px; font-size: 18px; }
}
/* Reduced motion: short spins, no ticking, clunk, rattle or blink; the door and handle move without a swing (SafeGame.tsx) */
.dgd.is-reduced .dgd-sc-door, .dgd.is-reduced .dgd-sc-handle, .dgd.is-reduced .dgd-sc-digits span { transition: none; }
.dgd.is-reduced .dgd-sc-lamp.red, .dgd.is-reduced .dgd-sc-door.clunk-a, .dgd.is-reduced .dgd-sc-door.clunk-b, .dgd.is-reduced .dgd-sc-door.rattle { animation: none; }
