/* Bandicoot Candy Cash (Scratch UI)
   Minimal per-game CSS: provides default ScratchMainUI variables and reveal styling.
   Use the DEV editor (?editor=1) to export overrides and paste them here.
*/

.scratch-bg{
  background-image: url("../assets/background/bandicoot-candy-cash-BG.svg");
}

/* Random colourful background effect (Candy Cash only)
   Implemented as animated gradient overlays on ScratchUI's background mount.
   JS adds `.cc-colorfx` and randomizes CSS vars for a slightly different feel each load. */
#scratchBackgroundMount.cc-colorfx{
  /* Tunables (set by JS, with safe fallbacks) */
  --cc-fx-opacity: 0.66;
  --cc-fx-sat: 2.35;
  --cc-fx-blur: 0.6px;
  --cc-fx-hue-dur-a: 16s;
  --cc-fx-hue-dur-b: 22s;
  --cc-fx-shift-dur-a: 18s;
  --cc-fx-shift-dur-b: 26s;
  --cc-fx-delay-a: 0s;
  --cc-fx-delay-b: 0s;
}

#scratchBackgroundMount.cc-colorfx::before,
#scratchBackgroundMount.cc-colorfx::after{
  content: "";
  position: absolute;
  inset: -10%;
  pointer-events: none;
  opacity: var(--cc-fx-opacity);
  mix-blend-mode: screen;
  will-change: transform, filter, opacity;
}

#scratchBackgroundMount.cc-colorfx::before{
  background:
    radial-gradient(70% 60% at 18% 22%, rgba(255, 80, 200, 0.78), rgba(255,255,255,0) 66%),
    radial-gradient(62% 60% at 84% 18%, rgba(90, 230, 255, 0.74), rgba(255,255,255,0) 64%),
    radial-gradient(72% 66% at 72% 82%, rgba(255, 240, 120, 0.68), rgba(255,255,255,0) 68%),
    radial-gradient(58% 58% at 24% 84%, rgba(140, 255, 160, 0.62), rgba(255,255,255,0) 66%);
  filter: blur(var(--cc-fx-blur)) saturate(var(--cc-fx-sat)) hue-rotate(0deg);
  animation:
    ccFxShiftA var(--cc-fx-shift-dur-a) ease-in-out infinite,
    ccFxHueA var(--cc-fx-hue-dur-a) linear infinite;
  animation-delay: var(--cc-fx-delay-a);
}

#scratchBackgroundMount.cc-colorfx::after{
  opacity: calc(var(--cc-fx-opacity) * 0.85);
  background:
    conic-gradient(from 200deg at 55% 45%, rgba(255, 110, 60, 0.58), rgba(255,255,255,0) 18%, rgba(90, 120, 255, 0.62), rgba(255,255,255,0) 42%, rgba(255, 80, 200, 0.58), rgba(255,255,255,0) 68%, rgba(120, 255, 200, 0.54)),
    radial-gradient(90% 70% at 50% 50%, rgba(255,255,255,0.14), rgba(255,255,255,0) 70%);
  filter: blur(calc(var(--cc-fx-blur) * 1.25)) saturate(var(--cc-fx-sat)) hue-rotate(0deg);
  animation:
    ccFxShiftB var(--cc-fx-shift-dur-b) ease-in-out infinite,
    ccFxHueB var(--cc-fx-hue-dur-b) linear infinite;
  animation-delay: var(--cc-fx-delay-b);
}

@keyframes ccFxShiftA{
  0%, 100%{ transform: translate3d(-2.2%, -1.6%, 0) scale(1.05); }
  50%{ transform: translate3d(2.2%, 1.6%, 0) scale(1.10); }
}

@keyframes ccFxShiftB{
  0%, 100%{ transform: translate3d(1.6%, -2.2%, 0) scale(1.04); }
  50%{ transform: translate3d(-1.6%, 2.2%, 0) scale(1.12); }
}

@keyframes ccFxHueA{
  from{ filter: blur(var(--cc-fx-blur)) saturate(var(--cc-fx-sat)) hue-rotate(0deg); }
  to{ filter: blur(var(--cc-fx-blur)) saturate(var(--cc-fx-sat)) hue-rotate(360deg); }
}

@keyframes ccFxHueB{
  from{ filter: blur(calc(var(--cc-fx-blur) * 1.25)) saturate(var(--cc-fx-sat)) hue-rotate(0deg); }
  to{ filter: blur(calc(var(--cc-fx-blur) * 1.25)) saturate(var(--cc-fx-sat)) hue-rotate(-360deg); }
}

@media (prefers-reduced-motion: reduce){
  #scratchBackgroundMount.cc-colorfx::before,
  #scratchBackgroundMount.cc-colorfx::after{
    animation: none;
    opacity: calc(var(--cc-fx-opacity) * 0.35);
    filter: blur(var(--cc-fx-blur)) saturate(1.15);
  }
}

/* Always-on coin cursor (Candy Cash only) */
.scratch-app[data-scratch-game="bandicoot-candy-cash"],
.scratch-app[data-scratch-game="bandicoot-candy-cash"] *{
  cursor: url("../assets/coin-scratch-cursor/bandicoot-scratch-coin-scratcher.png") 16 16, auto !important;
}

/* Subtle sparkle overlay (Candy Cash only) */
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage::before,
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage::after{
  content: "";
  position: absolute;
  inset: -6%;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  mix-blend-mode: screen;
  filter: blur(0.15px) drop-shadow(0 0 10px rgba(255,255,255,0.18));
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage::before{
  background-image:
    radial-gradient(14px 14px at 18% 22%, rgba(255,255,255,0.72), rgba(255,255,255,0) 72%),
    radial-gradient(16px 16px at 76% 18%, rgba(255,255,255,0.62), rgba(255,255,255,0) 74%),
    radial-gradient(12px 12px at 62% 74%, rgba(255,255,255,0.52), rgba(255,255,255,0) 72%),
    radial-gradient(18px 18px at 28% 78%, rgba(255,255,255,0.42), rgba(255,255,255,0) 76%),
    radial-gradient(12px 12px at 88% 66%, rgba(255,255,255,0.40), rgba(255,255,255,0) 72%),
    radial-gradient(10px 10px at 46% 38%, rgba(255,255,255,0.48), rgba(255,255,255,0) 72%),
    radial-gradient(9px 9px at 8% 40%, rgba(255,255,255,0.36), rgba(255,255,255,0) 72%),
    radial-gradient(11px 11px at 94% 44%, rgba(255,255,255,0.44), rgba(255,255,255,0) 72%);
  animation: dvSparkleA 2.9s ease-in-out infinite;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage::after{
  background-image:
    radial-gradient(12px 12px at 12% 56%, rgba(255,255,255,0.44), rgba(255,255,255,0) 72%),
    radial-gradient(18px 18px at 44% 16%, rgba(255,255,255,0.46), rgba(255,255,255,0) 76%),
    radial-gradient(14px 14px at 92% 34%, rgba(255,255,255,0.58), rgba(255,255,255,0) 74%),
    radial-gradient(11px 11px at 54% 88%, rgba(255,255,255,0.40), rgba(255,255,255,0) 72%),
    radial-gradient(18px 18px at 72% 58%, rgba(255,255,255,0.36), rgba(255,255,255,0) 78%),
    radial-gradient(10px 10px at 36% 66%, rgba(255,255,255,0.42), rgba(255,255,255,0) 72%),
    radial-gradient(9px 9px at 66% 46%, rgba(255,255,255,0.34), rgba(255,255,255,0) 72%),
    radial-gradient(12px 12px at 22% 12%, rgba(255,255,255,0.40), rgba(255,255,255,0) 74%);
  animation: dvSparkleB 4.2s ease-in-out infinite;
}

@keyframes dvSparkleA{
  0%, 100%{ opacity: 0.06; transform: translate3d(0, 0, 0) scale(1); }
  12%{ opacity: 0.62; }
  24%{ opacity: 0.12; transform: translate3d(0.55%, -0.25%, 0) scale(1.012); }
  42%{ opacity: 0.54; }
  58%{ opacity: 0.14; transform: translate3d(-0.45%, 0.55%, 0) scale(1.007); }
  74%{ opacity: 0.48; }
}

@keyframes dvSparkleB{
  0%, 100%{ opacity: 0.05; transform: translate3d(0, 0, 0) scale(1); }
  9%{ opacity: 0.44; }
  20%{ opacity: 0.10; transform: translate3d(-0.55%, 0.3%, 0) scale(1.012); }
  40%{ opacity: 0.56; }
  54%{ opacity: 0.12; transform: translate3d(0.5%, 0.2%, 0) scale(1.008); }
  82%{ opacity: 0.42; }
}

/* Paid-action latency cover + deck UI hooks (Candy Cash only) */
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage{
  position: relative;
}

/* Lock scratch interaction while a new card is being prepared. */
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage[data-cc-lock="1"] .scratch-surface,
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage[data-cc-lock="1"] .scratch-surface canvas{
  pointer-events: none;
}

/* ===== Deck Stack (visual-only) =====
   Background cards show a proper card back (SVG) for a real deck feel. */

.scratch-app[data-scratch-game="bandicoot-candy-cash"]{
  --cc-card-back-img: url("../assets/images/scratch-card/candy-cash-card-back.svg");
  --cc-card-front-img: url("../assets/images/scratch-card/bandicoot-candy-cash-scratch-card.svg");
}

.cc-deckStack{
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5; /* behind ticket (10) */
}

.cc-deckCard{
  position: absolute;
  left: 50%;
  top: 50%;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;

  border-radius: 22px;
  box-shadow: 0 16px 34px rgba(0,0,0,0.30);

  /* Depth / stack effect (i=1..N) */
  opacity: calc(0.96 - (var(--i, 1) * 0.11));
  transform:
    translate(-50%, -50%)
    translate3d(0, calc(var(--i, 1) * 10px), 0)
    rotate(calc(var(--i, 1) * -0.8deg))
    scale(calc(1 - (var(--i, 1) * 0.04)));
}

.cc-deckCardInner{
  position: absolute;
  inset: 0;
  border-radius: inherit;
  transform-style: preserve-3d;
  will-change: transform;
}

.cc-deckCardFace{
  position: absolute;
  inset: 0;
  border-radius: inherit;
  backface-visibility: hidden;
  overflow: hidden;
}

/* Back face (branded card back SVG) */
.cc-deckCardBack{
  background: var(--cc-card-back-img) center/cover no-repeat;
  border: 1px solid rgba(255,255,255,0.10);
}

/* Subtle glossy shine */
.cc-deckCardBack::after{
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255,255,255,0.15), transparent 40%);
  opacity: 0.9;
  transform: translate3d(-18%, 0, 0);
}

/* Front face (only used during the brief promotion flip; real active card is ScratchUI). */
.cc-deckCardFront{
  transform: rotateY(180deg);
  background: var(--cc-card-front-img) center/cover no-repeat;
  border: 1px solid rgba(255,255,255,0.10);
  filter: saturate(1.05) contrast(1.02);
}

/* Shuffle: slight jostle + a quick back→front→back flip tease on the top background card. */
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-deck-shuffling .cc-deckStack{
  animation: ccDeckJostle var(--cc-deck-shuffle-ms, 650ms) cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-deck-shuffling .cc-deckCard--next .cc-deckCardInner{
  animation: ccDeckPromoteFlip var(--cc-deck-shuffle-ms, 650ms) cubic-bezier(0.2, 0.85, 0.2, 1) both;
}

@keyframes ccDeckJostle{
  0%{ transform: translate3d(0, 0, 0) rotate(0deg); }
  40%{ transform: translate3d(0, 2px, 0) rotate(-0.2deg); }
  70%{ transform: translate3d(0, -1px, 0) rotate(0.15deg); }
  100%{ transform: translate3d(0, 0, 0) rotate(0deg); }
}

@keyframes ccDeckPromoteFlip{
  0%{ transform: rotateY(0deg) scale(1); }
  52%{ transform: rotateY(180deg) scale(1.02); }
  100%{ transform: rotateY(0deg) scale(1); }
}

@media (prefers-reduced-motion: reduce){
  .scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-deck-shuffling .cc-deckStack,
  .scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-deck-shuffling .cc-deckCard--next .cc-deckCardInner{
    animation: none;
  }
}

/* Paid new-card animation (Candy Cash)
   Replace the default spin with a smooth “falling card” sequence.
   - Exit runs during ScratchUI flip phase
   - Entry/settle runs when JS adds `.cc-card-entering` */

/* Disable the shared multi-colour vortex for this game (we use the premium shimmer overlay instead). */
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.is-processing[data-aps-paid-phase="flip"]::before,
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.is-processing[data-aps-paid-phase="flip"]::after{
  display: none;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.is-processing[data-aps-paid-phase="flip"] .scratch-ticket,
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.is-processing[data-aps-paid-phase="flip"][data-aps-paid-late="1"] .scratch-ticket{
  animation: ccCardFallExit 650ms cubic-bezier(0.18, 0.92, 0.18, 1) both;
}

@keyframes ccCardFallExit{
  0%{ transform: translate3d(0, 0, 0) rotateZ(0deg) scale(1); opacity: 1; }
  25%{ transform: translate3d(0, 8px, 0) rotateZ(3deg) scale(0.998); opacity: 1; }
  100%{ transform: translate3d(0, 145%, 0) rotateZ(6deg) scale(0.988); opacity: 0; }
}

/* Entry + settle (the “weight” detail: translateY(0) scale(1.02 → 1)) */
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-card-entering .scratch-ticket,
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-card-entering .scratch-reveal,
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-card-entering .scratch-surface{
  animation: ccCardFallEnter var(--cc-card-enter-ms, 700ms) cubic-bezier(0.12, 0.95, 0.18, 1) both;
}

@keyframes ccCardFallEnter{
  0%{ transform: translate3d(0, -120%, 0) rotateZ(-5deg) scale(0.988); opacity: 0; }
  45%{ opacity: 1; }
  78%{ transform: translate3d(0, 0, 0) rotateZ(0deg) scale(1.02); opacity: 1; }
  100%{ transform: translate3d(0, 0, 0) rotateZ(0deg) scale(1); opacity: 1; }
}

@media (prefers-reduced-motion: reduce){
  .scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.is-processing[data-aps-paid-phase="flip"] .scratch-ticket,
  .scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.is-processing[data-aps-paid-phase="flip"][data-aps-paid-late="1"] .scratch-ticket,
  .scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-card-entering .scratch-ticket,
  .scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-card-entering .scratch-reveal,
  .scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-card-entering .scratch-surface{
    animation: none;
  }
}

/* Casino Loading FX overlay (Candy Cash only)
   Covers the ticket during paid-action latency (spin -> result). */
.cc-fx-overlay{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 999;

  /* IMPORTANT: scratch ticket uses 3D transforms while spinning (rotateY).
     Pull the whole overlay forward in the same 3D stacking context so it renders above the card. */
  transform: translate3d(0, 0, 60px);
  transform-style: preserve-3d;
  backface-visibility: hidden;
  will-change: opacity, transform;

  opacity: 0;
  transition: opacity var(--cc-fx-fade-ms, 460ms) ease;

  mix-blend-mode: screen;
  filter: drop-shadow(0 0 12px rgba(255, 190, 110, 0.14)) drop-shadow(0 0 18px rgba(255, 255, 255, 0.06));
}

.cc-fx-overlay.is-active{
  opacity: 1;
}

/* During fade-out we keep it present (no `hidden` yet) while opacity transitions to 0. */
.cc-fx-overlay.is-stopping{
  opacity: 0;
}

.cc-fx-canvas{
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.cc-fx-overlay .glowLayer,
.cc-fx-overlay .shimmerLayer{
  position: absolute;
  inset: 0;
}

/* Subtle pulsing “charged” glow */
.cc-fx-overlay .glowLayer{
  opacity: var(--cc-fx-glow-opacity, 0.22);
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 200, 120, 0.42) 0%, rgba(255, 110, 50, 0.12) 28%, rgba(255, 255, 255, 0) 62%);
  animation: ccGlowPulse 1.65s ease-in-out infinite;
  mix-blend-mode: screen;
  filter: blur(0.2px);
}

@keyframes ccGlowPulse{
  0%{ transform: scale(1.00); }
  55%{ transform: scale(1.05); }
  100%{ transform: scale(1.00); }
}

/* Gold shimmer sweep (very subtle) */
.cc-fx-overlay .shimmerLayer{
  opacity: var(--cc-fx-shimmer-opacity, 0.12);
  overflow: hidden;
  mix-blend-mode: screen;
}

.cc-fx-overlay .shimmerLayer::before{
  content: "";
  position: absolute;
  top: -35%;
  left: -65%;
  width: 230%;
  height: 170%;
  background: linear-gradient(120deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 215, 140, 0.00) 35%,
    rgba(255, 195, 90, 0.20) 50%,
    rgba(255, 110, 40, 0.08) 56%,
    rgba(255, 255, 255, 0) 70%
  );
  transform: translateX(-18%) rotate(8deg);
  animation: ccShimmerSweep var(--cc-fx-shimmer-dur, 2.15s) linear infinite;
  will-change: transform;
}

@keyframes ccShimmerSweep{
  0%{ transform: translateX(-28%) rotate(8deg); }
  100%{ transform: translateX(28%) rotate(8deg); }
}

/* ===== Win/Lose result feedback (Candy Cash) ===== */
.cc-resultOverlay{
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 1300;
  pointer-events: none;

  /* Keep above 3D ticket context */
  transform: translate3d(0, 0, 90px);
  transform-style: preserve-3d;
  backface-visibility: hidden;

  opacity: 0;
}

.cc-resultOverlay.is-active{
  opacity: 1;
}

.cc-resultPopup{
  position: relative;
  width: min(86%, 360px);
  border-radius: 18px;
  padding: 18px 16px 16px;
  text-align: center;

  background: rgba(16, 12, 24, 0.72);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 18px 48px rgba(0,0,0,0.50);

  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);

  will-change: transform, opacity;
}

.cc-resultOverlay.is-win .cc-resultPopup{
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 215, 140, 0.26), rgba(255, 110, 200, 0.10) 45%, rgba(16, 12, 24, 0.74) 72%),
    rgba(16, 12, 24, 0.72);
  border-color: rgba(255, 215, 140, 0.22);
  box-shadow: 0 18px 56px rgba(0,0,0,0.52), 0 0 36px rgba(255, 195, 90, 0.18);
}

.cc-resultOverlay.is-lose .cc-resultPopup{
  background:
    radial-gradient(circle at 50% 45%, rgba(255, 255, 255, 0.08), rgba(16, 12, 24, 0.76) 64%),
    rgba(16, 12, 24, 0.72);
}

.cc-resultOverlay.is-entering .cc-resultPopup{
  animation: ccResultIn 260ms cubic-bezier(0.18, 0.92, 0.18, 1) both;
}

.cc-resultOverlay.is-leaving .cc-resultPopup{
  animation: ccResultOut 240ms ease both;
}

@keyframes ccResultIn{
  0%{ opacity: 0; transform: translate3d(0, 10px, 0) scale(0.92); }
  68%{ opacity: 1; transform: translate3d(0, 0, 0) scale(1.06); }
  100%{ opacity: 1; transform: translate3d(0, 0, 0) scale(1.00); }
}

@keyframes ccResultOut{
  0%{ opacity: 1; transform: translate3d(0, 0, 0) scale(1.00); }
  100%{ opacity: 0; transform: translate3d(0, 8px, 0) scale(0.98); }
}

.cc-resultTitle{
  font-weight: 900;
  letter-spacing: 0.08em;
  font-size: 18px;
  line-height: 1.1;
  text-transform: uppercase;
  color: rgba(255,255,255,0.92);
  text-shadow: 0 2px 10px rgba(0,0,0,0.45);
}

.cc-resultOverlay.is-win .cc-resultTitle{
  background: linear-gradient(90deg, rgba(255, 235, 170, 1), rgba(255, 130, 215, 1));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cc-resultAmount{
  margin-top: 10px;
  font-weight: 950;
  font-size: 34px;
  line-height: 1.0;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.98);
  text-shadow: 0 2px 16px rgba(0,0,0,0.55);
}

.cc-winSparks{
  position: absolute;
  left: 50%;
  top: 44%;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.cc-spark{
  position: absolute;
  left: 0;
  top: 0;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255,255,255,1) 0%, rgba(255, 215, 140, 0.95) 35%, rgba(255, 110, 200, 0.0) 72%);
  filter: blur(0.2px);
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: ccSparkPop 420ms cubic-bezier(0.15, 0.9, 0.2, 1) both;
  will-change: transform, opacity;
}

@keyframes ccSparkPop{
  0%{ opacity: 0; transform: translate(-50%, -50%) scale(0.20); }
  16%{ opacity: 1; }
  100%{ opacity: 0; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% + var(--dy, 0px))) scale(1.00); }
}

/* Optional small shake on lose */
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-lose-shake .scratch-ticket{
  animation: ccLoseShake 420ms cubic-bezier(0.22, 0.9, 0.25, 1) both;
}

@keyframes ccLoseShake{
  0%{ transform: translate3d(0, 0, 0) rotateZ(0deg); }
  18%{ transform: translate3d(-5px, 0, 0) rotateZ(-1.2deg); }
  38%{ transform: translate3d(5px, 0, 0) rotateZ(1.2deg); }
  58%{ transform: translate3d(-3px, 0, 0) rotateZ(-0.8deg); }
  78%{ transform: translate3d(3px, 0, 0) rotateZ(0.8deg); }
  100%{ transform: translate3d(0, 0, 0) rotateZ(0deg); }
}

@media (prefers-reduced-motion: reduce){
  .cc-resultOverlay.is-entering .cc-resultPopup,
  .cc-resultOverlay.is-leaving .cc-resultPopup,
  .scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-stage.cc-lose-shake .scratch-ticket{
    animation: none;
  }
}

/* Export-friendly defaults (desktop/tablet) */
.scratch-app[data-scratch-game="bandicoot-candy-cash"]{
  --stage-max-width: 520px;
  --stage-top-offset: 0px;
  --stage-action-gap: 10px;

  --ticket-top: 50%;
  --ticket-left: 50%;
  --ticket-w: 100%;
  --ticket-rotate: 0deg;

  --surface-top: 50%;
  --surface-left: 50%;
  --surface-w: 86%;
  --surface-h: 62%;
  --surface-opacity: 1;

  --reveal-top: 50%;
  --reveal-left: 50%;
  --reveal-w: 80%;
  --reveal-h: 56%;
  --reveal-scale: 1;
  --reveal-padding: 10px;
  --reveal-radius: 14px;
  --reveal-align: center;

  --grid-cols: 3;
  --grid-rows: 3;
  --grid-gap: 10px;
  --grid-row-gap: 10px;
  --grid-col-gap: 10px;
}

/* Mobile profile scaffold (paste exported vars here) */
@media (max-width: 768px){
  .scratch-app[data-scratch-game="bandicoot-candy-cash"]{
    /* Example only; editor export will overwrite */
    --stage-max-width: 420px;
  }
}

/* Reveal layer styles (your numbers + winning numbers) */
.gf-reveal{
  width: 100%;
  height: 100%;
  display: grid;
  gap: 10px;
  align-content: start;
  justify-items: center;

  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.12));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--reveal-radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.gf-label{
  font-weight: 900;
  letter-spacing: 0.12em;
  font-size: 12px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  text-align: center;
  margin-top: 2px;
}

.gf-winning{
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.gf-grid{
  width: 100%;
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  grid-auto-rows: 1fr;
  row-gap: var(--grid-row-gap);
  column-gap: var(--grid-col-gap);
}

.gf-cell{
  height: clamp(40px, 7.4vmin, 58px);
  border-radius: 12px;
  display: grid;
  place-items: center;
  position: relative;
  background:
    radial-gradient(120% 120% at 30% 25%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.18));
  border: 1px solid rgba(255, 236, 190, 0.18);
}

.gf-num{
  font-size: clamp(14px, 3.2vmin, 20px);
  font-weight: 950;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #ffefb0, #f6d36b 55%, #8a5f14);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
}

.gf-cell.is-match{
  border-color: rgba(255, 239, 176, 0.7);
  box-shadow:
    0 0 0 2px rgba(255, 239, 176, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.gf-cell.is-match::after{
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: radial-gradient(70% 70% at 50% 50%, rgba(255, 232, 140, 0.22), rgba(255, 255, 255, 0) 68%);
  pointer-events: none;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .gf-cell.is-diamond{
  display: grid;
  place-items: center;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .dv-diamondIcon{
  width: 70%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .cc-symbol{
  width: 55%;
  height: auto;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 220ms ease, filter 220ms ease;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .gf-cell.is-match .cc-symbol{
  transform: scale(1.08);
  filter: drop-shadow(0 0 10px rgba(255, 232, 140, 0.85));
}

.gf-result{
  margin-top: 2px;
  font-weight: 950;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.96);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.5);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.14);
  justify-self: center;
}

/* Readability tweaks (Candy Cash only)
   - Make reveal text black (requested)
   - Add black outline to ScratchUI buttons */
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .gf-label,
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .gf-num,
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .gf-result{
  color: rgba(0, 0, 0, 0.92);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .gf-num{
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  filter: none;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .gf-result{
  background: rgba(255, 255, 255, 0.50);
  border-color: rgba(0, 0, 0, 0.65);
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-btn{
  border-color: rgba(0, 0, 0, 0.75);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.65) inset;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .scratch-ticket img{
  border-radius: 12px;
}

/* Wallet / bet mounts (Candy Cash only) */
.scratch-app[data-scratch-game="bandicoot-candy-cash"] .gf-hudLabel{
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.78);
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"] .gf-hudValue{
  margin-top: 4px;
  font-size: 14px;
  font-weight: 950;
  color: rgba(255,255,255,0.95);
}


.scratch-app[data-scratch-game="bandicoot-candy-cash"]{
  --grid-col-gap: 11px;
  --grid-cols: 3;
  --grid-gap: 0px;
  --grid-row-gap: 30px;
  --grid-rows: 3;
  --reveal-h: 29.5%;
  --reveal-left: 24%;
  --reveal-padding: 30px;
  --reveal-radius: 17px;
  --reveal-scale: 0.6;
  --reveal-top: 36.5%;
  --reveal-w: 52%;
  --stage-action-gap: 0px;
  --stage-max-width: 820px;
  --stage-top-offset: -40px;
  --surface-h: 49.5%;
  --surface-left: 50%;
  --surface-opacity: 0.4;
  --surface-rotate: 0deg;
  --surface-top: 53%;
  --surface-w: 63.5%;
  --ticket-rotate: 0deg;
  --ticket-top: 50%;
}

.scratch-app[data-scratch-game="bandicoot-candy-cash"]{
  --grid-col-gap: 11px;
  --grid-cols: 3;
  --grid-gap: 0px;
  --grid-row-gap: 5px;
  --grid-rows: 3;
  --reveal-h: 28.5%;
  --reveal-left: 49.5%;
  --reveal-padding: 22px;
  --reveal-radius: 2px;
  --reveal-scale: 0.6;
  --reveal-top: 42%;
  --reveal-w: 100%;
  --stage-action-gap: 0px;
  --stage-max-width: 410px;
  --stage-top-offset: -40px;
  --surface-h: 55.5%;
  --surface-left: 50%;
  --surface-opacity: 1;
  --surface-rotate: 0deg;
  --surface-top: 53%;
  --surface-w: 75%;
  --ticket-rotate: 0deg;
  --ticket-top: 50%;
  --ticket-w: 120%;
}

  @media (max-width: 768px){
  .scratch-app[data-scratch-game="bandicoot-candy-cash"]{
    --grid-col-gap: 5px;
    --grid-gap: 10px;
    --grid-row-gap: 11px;
    --reveal-align: center;
    --reveal-h: 60.5%;
    --reveal-left: 49.5%;
    --reveal-padding: 0px;
    --reveal-radius: 9px;
    --reveal-scale: 0.6;
    --reveal-top: 55%;
    --reveal-w: 87.5%;
    --stage-action-gap: 0px;
    --stage-max-width: 460px;
    --stage-top-offset: 20px;
    --surface-h: 50.5%;
    --surface-left: 50%;
    --surface-opacity: 1;
    --surface-top: 51%;
    --surface-w: 76%;
    --ticket-top: 50%;
  }
}
