/* Apertura de sobres. Tres escenas: el sobre cerrado, la revelacion a pantalla
   completa y el resumen. La rotura vive en la variable --tear (0 cerrado, 1 abierto),
   asi que el arrastre y el boton comparten exactamente la misma animacion. */

.pack-hero {
  min-height: 640px;
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  align-items: center;
  gap: clamp(40px, 7vw, 100px);
  padding-block: 60px 90px;
}
.pack-copy h1 { margin: 0; font-size: clamp(3.4rem, 7vw, 6.2rem); line-height: .86; letter-spacing: -.07em; font-weight: 780; }
.pack-copy h1 em { color: transparent; -webkit-text-stroke: 1.5px var(--violet); font-style: normal; }
.pack-odds { margin: 34px 0 26px; padding: 20px 22px; border: 1px solid var(--line); background: #0d1019d9; }
.odds-title { margin: 0 0 14px; color: var(--muted); font: 800 .6rem/1 ui-monospace, monospace; letter-spacing: .18em; }
.pack-odds ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 7px; }
.pack-odds li { display: flex; align-items: center; gap: 10px; font-size: .72rem; text-transform: uppercase; font-weight: 800; letter-spacing: .08em; }
.pack-odds li i { width: 8px; height: 8px; border-radius: 50%; background: var(--frame); box-shadow: 0 0 9px var(--glow); }
.pack-odds li strong { margin-left: auto; font-family: ui-monospace, monospace; color: var(--ink-card); }
.odds-note { margin: 16px 0 0; color: var(--muted); font-size: .72rem; line-height: 1.5; }
.demo-warning { padding: 12px 14px; border-left: 2px solid var(--acid); color: #b8beca; font-size: .78rem; line-height: 1.55; }

.pack-stage { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.pack-hint { margin: 0; color: #626a7b; font-size: .62rem; text-transform: uppercase; letter-spacing: .14em; }

/* ---- El sobre ---- */
.sobre {
  --tear: 0;
  position: relative;
  width: min(330px, 76vw);
  aspect-ratio: 5 / 7.2;
  touch-action: pan-y;
  cursor: grab;
  transform: rotate(-3deg);
  transition: transform .5s;
}
.sobre.is-pulling { cursor: grabbing; transform: rotate(-3deg) scale(1.02); }
.sobre.is-open { transform: rotate(-3deg) scale(.94); opacity: .35; }

.sobre-body {
  position: absolute;
  inset: 0;
  overflow: hidden;
  /* Borde superior dentado: es lo que queda a la vista cuando la tira se va. */
  clip-path: polygon(0 5%, 4% 2%, 8% 5%, 12% 2%, 16% 5%, 20% 2%, 24% 5%, 28% 2%,
    32% 5%, 36% 2%, 40% 5%, 44% 2%, 48% 5%, 52% 2%, 56% 5%, 60% 2%, 64% 5%,
    68% 2%, 72% 5%, 76% 2%, 80% 5%, 84% 2%, 88% 5%, 92% 2%, 96% 5%, 100% 2%,
    100% 100%, 0 100%);
  background: linear-gradient(155deg, #2a2350, #120f24 45%, #1d1a3c 75%, #0c0a16);
  box-shadow: inset 0 0 0 2px #3d3670, inset 0 40px 90px #0009;
}
.sobre-foil {
  position: absolute;
  inset: -30%;
  opacity: .55;
  background: conic-gradient(from 210deg, #ff5ec7, #57ffe2, #ffe45c, #7c5cff, #ff5ec7);
  filter: blur(26px);
  animation: foil-drift 9s linear infinite;
}
@keyframes foil-drift { to { transform: rotate(360deg); } }
.sobre-face {
  position: absolute;
  inset: 12% 10% 8%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}
.sobre-kicker { margin: 0; color: #cdc6ff; font: 800 .62rem/1 ui-monospace, monospace; letter-spacing: .22em; }
.sobre-mark { font-size: 5.5rem; color: #b9aaff; text-shadow: 0 0 40px #7c5cffcc; }
.sobre-count { margin: 0; padding: 7px 12px; border: 1px solid #6d5fc4; color: #ded8ff; font: 900 .6rem/1 ui-monospace, monospace; letter-spacing: .16em; }
.sobre-seam { position: absolute; inset: 4% 4%; border: 1px dashed #ffffff1f; pointer-events: none; }
.sobre-glow {
  position: absolute; inset: -14%;
  background: radial-gradient(circle at 50% 45%, #7c5cff77, #0000 62%);
  filter: blur(24px);
  animation: sobre-breathe 3.4s ease-in-out infinite;
  pointer-events: none;
}
@keyframes sobre-breathe { 50% { opacity: .55; transform: scale(1.06); } }

/* La tira que se rasga. Sigue al dedo y sale volando al completarse. */
.sobre-strip {
  position: absolute;
  top: -2%;
  left: -3%;
  right: -3%;
  height: 13%;
  display: grid;
  place-items: center;
  background: linear-gradient(#3a3272, #241f4a);
  box-shadow: inset 0 -2px #5d52a8, 0 6px 16px #0007;
  transform: translateY(calc(var(--tear) * -145%)) rotate(calc(var(--tear) * -7deg));
  opacity: calc(1 - var(--tear) * .85);
  transition: transform .18s linear, opacity .18s linear;
}
.sobre-strip span { color: #a99ff0; font: 800 .55rem/1 ui-monospace, monospace; letter-spacing: .2em; }
.sobre.is-tearing .sobre-strip {
  transition: transform .5s cubic-bezier(.3, .8, .3, 1), opacity .5s;
  transform: translateY(-260%) rotate(-24deg);
  opacity: 0;
}
.sobre-burst {
  position: absolute;
  inset: -20%;
  border-radius: 50%;
  background: radial-gradient(circle, #fff, #cdbcff 26%, #7c5cff00 62%);
  opacity: 0;
  transform: scale(.2);
  pointer-events: none;
}
.sobre.is-tearing .sobre-burst { animation: burst .75s ease-out forwards; }
@keyframes burst {
  35% { opacity: .95; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* ---- Revelacion ---- */
body.is-locked { overflow: hidden; }
.reveal-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 18px;
  padding: 22px;
  background: radial-gradient(circle at 50% 40%, #171331f2, #04050af8 70%);
  backdrop-filter: blur(8px);
}
.reveal-layer[hidden] { display: none; }
.reveal-top { display: flex; align-items: center; justify-content: space-between; }
.reveal-count { color: var(--acid); font: 800 .8rem/1 ui-monospace, monospace; letter-spacing: .16em; }
.reveal-skip { border: 0; padding: 8px; background: transparent; color: #8890a0; font-size: .68rem; text-transform: uppercase; letter-spacing: .12em; cursor: pointer; }
.reveal-skip:hover { color: var(--text); }
.reveal-stage { position: relative; display: grid; place-items: center; min-height: 0; }

.reveal-card {
  position: absolute;
  display: grid;
  justify-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(46px) scale(.82);
  transition: opacity .42s, transform .42s cubic-bezier(.2, .9, .3, 1);
}
.reveal-card.is-in { opacity: 1; transform: none; }
.reveal-card.is-leaving { opacity: 0; transform: translateY(-60px) scale(.86); }
.reveal-card .card3d { --card-width: min(330px, 68vw); }
.reveal-badge {
  margin: 0;
  padding: 6px 12px;
  border: 1px solid var(--frame);
  color: var(--ink-card);
  font: 900 .58rem/1 ui-monospace, monospace;
  letter-spacing: .16em;
}
.reveal-card[data-duplicate] .reveal-badge { border-color: #4b5262; color: #79808f; }

/* Las rarezas altas anuncian su llegada. */
.reveal-card:before {
  content: "";
  position: absolute;
  inset: -12% -18%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--glow), #0000 62%);
  opacity: 0;
  pointer-events: none;
}
.reveal-card[data-rarity="epico"].is-in:before,
.reveal-card[data-rarity="legendario"].is-in:before { animation: halo 1.5s ease-out; }
@keyframes halo {
  20% { opacity: .9; transform: scale(1.04); }
  100% { opacity: 0; transform: scale(1.35); }
}
.reveal-card[data-rarity="legendario"].is-in:after {
  content: "";
  position: fixed;
  inset: 0;
  background: #fff;
  pointer-events: none;
  animation: flash .6s ease-out;
}
@keyframes flash { 0% { opacity: .5; } 100% { opacity: 0; } }

.reveal-cta {
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 18px;
  min-height: 52px;
  padding: 0 26px;
  border: 1px solid var(--acid);
  background: var(--acid);
  color: #10130c;
  text-transform: uppercase;
  font-weight: 900;
  font-size: .74rem;
  letter-spacing: .09em;
  cursor: pointer;
}

/* ---- Resumen ---- */
.pack-summary { padding-bottom: 110px; }
.pack-summary[hidden] { display: none; }
.summary-head { padding-bottom: 34px; border-top: 1px solid var(--line); padding-top: 60px; }
.summary-head h2 { margin: 0 0 10px; font-size: clamp(2.4rem, 5vw, 4rem); letter-spacing: -.05em; }
.summary-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 22px; align-items: start; }
.summary-cell { display: grid; gap: 10px; }
.summary-cell .card3d { --card-width: 100%; gap: 9px; }
/* En la rejilla de cinco columnas no cabe la ayuda: el boton de girar basta. */
.summary-cell .card3d-hint { display: none; }
.summary-cell .card3d-button { min-height: 34px; padding: 0 10px; font-size: .54rem; letter-spacing: .08em; }
.summary-cell[data-duplicate] { opacity: .62; }
.summary-label { margin: 0; text-align: center; color: var(--frame); font: 800 .58rem/1 ui-monospace, monospace; letter-spacing: .14em; text-transform: uppercase; }
.summary-cell[data-duplicate] .summary-label { color: #6f7687; }
.summary-actions { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 40px; }

@media (max-width: 900px) {
  .pack-hero { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 650px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .reveal-card .card3d-hint { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .sobre-foil, .sobre-glow { animation: none; }
  .reveal-card, .reveal-card:before, .reveal-card:after { animation: none; transition: opacity .15s; transform: none; }
  .sobre-burst { display: none; }
}
