/* Gift Unfold Overlay (3 sides: TOP + FRONT + LEFT)
   - Non-destructive: only adds overlay on open; does not change prize logic.
   - Assumes your cube faces have classes: .face.top, .face.front, .face.left
   - The actual face images are read from your existing inline styles / CSS vars:
     The script will copy computed background-image from the cube faces.
*/

:root{
  --unfold-duration: 600ms;
  --unfold-ease: cubic-bezier(.2,.9,.2,1);
  --unfold-shadow: 0 18px 40px rgba(0,0,0,.45);
}

.mb-unfold-overlay{
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.mb-unfold-overlay.is-active{ display:flex; }

.mb-unfold-stage{
  width: min(520px, 86vw);
  aspect-ratio: 1 / 1;
  position: relative;
  transform: translateZ(0);
}

.mb-unfold-net{
  position:absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: perspective(900px) rotateX(18deg) rotateY(-18deg);
  filter: drop-shadow(var(--unfold-shadow));
}

/* Base tile */
.mb-unfold-tile{
  position:absolute;
  width: 50%;
  height: 50%;
  left: 25%;
  top: 25%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 10px;
  overflow: hidden;
}

/* TOP flap (opens upward) */
.mb-unfold-top{
  top: 0%;
  transform-origin: 50% 100%;
  transform: rotateX(90deg);
}

/* FRONT flap (opens downward) */
.mb-unfold-front{
  top: 50%;
  transform-origin: 50% 0%;
  transform: rotateX(-90deg);
}

/* LEFT flap (opens left) */
.mb-unfold-left{
  left: 0%;
  transform-origin: 100% 50%;
  transform: rotateY(-90deg);
}

/* Center (base) - optional */
.mb-unfold-center{
  background: rgba(255,255,255,.03);
  backdrop-filter: blur(2px);
}

/* Animate in */
.mb-unfold-overlay.is-active .mb-unfold-top,
.mb-unfold-overlay.is-active .mb-unfold-front,
.mb-unfold-overlay.is-active .mb-unfold-left{
  transition: transform var(--unfold-duration) var(--unfold-ease);
}

.mb-unfold-overlay.is-active .mb-unfold-top{ transform: rotateX(0deg); }
.mb-unfold-overlay.is-active .mb-unfold-front{ transform: rotateX(0deg); }
.mb-unfold-overlay.is-active .mb-unfold-left{ transform: rotateY(0deg); }

/* Prize badge in center (optional) */
.mb-unfold-prize{
  position:absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%,-50%);
  min-width: 180px;
  max-width: 90%;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0,0,0,.45);
  border: 1px solid rgba(255,255,255,.18);
  color: #fff;
  font-weight: 700;
  text-align: center;
  letter-spacing: .3px;
  display:none;
}

/* show prize if set */
.mb-unfold-overlay.has-prize .mb-unfold-prize{ display:block; }
