.main {
  display: flex;
  width: 90%;
  justify-content: end;
  padding: 15px;
  position: absolute;
  top: 95px;
  left: 8%;
  align-items: start;
}
.main .set {
  /* border-radius:50px; */
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 16px;
  font-weight: bold;
}
.end-card {
  display: flex;
  width: 90%;
  height: 100vh;
  margin: auto;
  justify-content: space-between;
  align-items: center;
}
.end-card .btns {
  display: flex;
  flex-direction: column;
}
.end-card .btns a,
.end-card .pack a {
  display: flex;
  /* font-family: 'Exo'; */
  font-style: italic;
  font-weight: 800;
  font-size: 20px;
  display: flex;
  padding: 5px 16px;
  align-items: flex-end;
  text-align: center;
  text-transform: uppercase;
  /* color: #2C3754; */
  /* background:#fff; */
  border-radius: 50px;
  margin-bottom: 20px;
  justify-content: center;
}
.end-card .card img {
  border-radius: 10px;
}
.end-card .pack img {
  width: 150px;
  transform: rotate(7deg);
  margin-bottom: 20px;
}
.slide.end-card .card img {
  width: 150px;
  height: 200px;
}
.turn.end-card .card img {
  width: 120px;
  height: 160px;
}
@media (max-width: 650px) {
  .cm-bg {
    min-height: 100%;
    height: 100%;
  }
  .end-card {
    flex-direction: column;
    justify-content: center;
    gap: 20px;
  }
  .end-card .card {
    width: 180px;
  }
  .end-card .pack img {
    width: 100px;
  }
}
@media (min-width: 1024px) {
  .flip.end-card .card img {
    width: 240px;
    height: 300px;
  }
}

@media (min-width: 1299px) {
  .slide.end-card .card img {
    width: 240px;
    height: 300px;
  }
  .turn.end-card .card img {
    width: 155px;
    height: 205px;
  }
}

@media (min-width: 1919px) {
  .flip.end-card .card img {
    width: 360px;
    height: 480px;
  }
  .turn.end-card .card img {
    width: 210px;
    height: 300px;
  }
}

@media (min-width: 1999px) {
  .slide.end-card .card img {
    width: 300px;
    height: 400px;
  }
}

@media (min-width: 2599px) {
  .slide.end-card .card img {
    width: 420px;
    height: 560px;
  }
  .turn.end-card .card img {
    width: 300px;
    height: 400px;
  }
}

/* 🔊 Sound button – fixed top center */
.sound-btn-fixed {
  position: fixed;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  padding: 5px;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);

  display: grid;
  place-items: center;
  color: white;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.2s ease;
}

.sound-btn-fixed:hover {
  transform: translateX(-50%) scale(1.05);
  background: rgba(0, 0, 0, 0.7);
}

/* ❌ Close button – fixed top left */
.close-btn-fixed {
  position: fixed;
  top: 10px;
  right: 20px;
  z-index: 9999999;

  padding: 6px 14px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);

  color: white;
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;

  transition:
    background 0.2s ease,
    transform 0.15s ease;
}

.close-btn-fixed:hover {
  background: rgba(0, 0, 0, 0.75);
  transform: scale(1.04);
}

.pack-cut-stage {
  position: relative;
  width: 100%;
  height: 100%;
}

.pack-cut-stage canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* overlay jo pack image ko "2 pieces" me cut dikhayega */
.pack-cut-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 240px; /* pack size (adjust if needed) */
  height: 340px; /* pack size (adjust if needed) */
  transform: translate(-50%, -50%);
  background-size: cover;
  background-position: center;
  border-radius: 14px;
  cursor: pointer;
  pointer-events: auto;
  z-index: 50;
}

/* two halves using pseudo elements */
.pack-cut-overlay::before,
.pack-cut-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: inherit;
  background-size: cover;
  background-position: center;
  border-radius: 14px;
  will-change: transform, clip-path, opacity;
}

/* left half */
.pack-cut-overlay::before {
  clip-path: polygon(0 0, 70% 0, 45% 100%, 0 100%);
}

/* right half */
.pack-cut-overlay::after {
  clip-path: polygon(70% 0, 100% 0, 100% 100%, 45% 100%);
}

/* cut animation */
@keyframes cutLeft {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(-22px, 10px) rotate(-4deg);
    opacity: 0.15;
  }
}
@keyframes cutRight {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(22px, -10px) rotate(4deg);
    opacity: 0.15;
  }
}

.pack-cut-overlay.cut::before {
  animation: cutLeft 0.5s ease-in-out forwards;
}
.pack-cut-overlay.cut::after {
  animation: cutRight 0.5s ease-in-out forwards;
}

/* Center container */
.pack-container {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: visible;
}

/* 👇 REAL image size control */
.pack-box {
  width: 320px;
  aspect-ratio: 300 / 500;
  height: auto;
  position: relative;
}

.pack-container,
.pack-box {
  overflow: visible !important;
}

/* 
@media (width >= 48rem) {
  .pack-box {
    width: 215px;
    aspect-ratio: 215 / 330;
  }
} */

/* Canvas exact box ke andar */
.pack-canvas {
  width: 80%;
  height: 100%;
  transition: transform 250ms ease;
  transform-origin: center;
  cursor: pointer;

  display: block;
  position: relative;
  z-index: 1;
}
.pack-canvas img {
  object-fit: contain;
}

/* ✅ HOVER SIRF IMAGE PAR */
.pack-canvas:hover {
  transform: scale(1.03);
}

/* Bottom text */
.pack-text {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  font-size: 14px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 20px;
  pointer-events: none;
  user-select: none;
}

/* cards come from top -> settle in place */
.enter-wrap {
  opacity: 0;
  transform: translateY(-120vh) scale(0.92);
  animation: dropIn 520ms cubic-bezier(0.2, 0.9, 0.25, 1) forwards;
  animation-delay: calc(var(--i) * 15ms); /* 👈 one-by-one fast */
  will-change: transform, opacity;
}

@keyframes dropIn {
  0% {
    opacity: 0;
    transform: translateY(-120vh) scale(0.92);
  }
  70% {
    opacity: 1;
    transform: translateY(10px) scale(1.02); /* little overshoot */
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.stack-wrap {
  position: absolute; /* ✅ CHANGE */
  inset: 0; /* ✅ ADD */
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  z-index: 0; /* ✅ ADD (above canvas) */

  pointer-events: none; /* ✅ so canvas hover/click still works */
}

.card-stack {
  position: relative;

  pointer-events: auto; /* ✅ ADD */
  cursor: pointer;
  user-select: none;
}

/* @media (width >= 1440px ) {
  .card-stack {
    position: relative;
    width: 260px;
    height: 400px;
  }
} */
.fly-card {
  position: absolute;
  inset: 0; /* top:0 right:0 bottom:0 left:0 */
  /* width: 100%;
  height: 100%; */
  object-fit: contain;
  border-radius: 12px;

  /* smooth look */
  /* box-shadow: 0 10px 22px rgba(0, 0, 0, 0.18); */
  transition: transform 200ms ease;
  will-change: transform, opacity;
}

/* hover pe thora lift (optional) */
.card-stack:not(.is-flinging):hover .fly-card {
  transform: translateY(-2px);
}

/* CLICK -> one-by-one animation */
.card-stack.is-flinging .fly-card {
  animation: flyUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: var(--delay);
}

@keyframes flyUp {
  0% {
    transform: translate(0, 0);
    /* opacity: 1; */
    /* transform: translate(0, 0) rotate(0deg) scale(1); */
  }
  /* 70% {
    opacity: 0.9;
  } */
  100% {
    /* opacity: 0; */
    /* transform: translate(0, -260px) rotate(var(--rot)) scale(0.92); */
    transform: translate(0, -240px);
  }
}

@keyframes xlFlyUp {
  0% {
    transform: translate(0, 0);
    /* opacity: 1; */
    /* transform: translate(0, 0) rotate(0deg) scale(1); */
  }
  /* 70% {
    opacity: 0.9;
  } */
  100% {
    /* opacity: 0; */
    /* transform: translate(0, -260px) rotate(var(--rot)) scale(0.92); */
    transform: translate(0, -330px);
  }
}

@keyframes smFlyUp {
  0% {
    transform: translate(0, 0);
    /* opacity: 1; */
    /* transform: translate(0, 0) rotate(0deg) scale(1); */
  }
  /* 70% {
    opacity: 0.9;
  } */
  100% {
    /* opacity: 0; */
    /* transform: translate(0, -260px) rotate(var(--rot)) scale(0.92); */
    transform: translate(0, -180px);
  }
}

@media (width >= 85rem /* 1536px */) {
  .card-stack.is-flinging .fly-card {
    animation: xlFlyUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: var(--delay);
  }
}

@media (width <= 45rem /* 1536px */) {
  .card-stack.is-flinging .fly-card {
    animation: smFlyUp 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: var(--delay);
  }
}
