/* ============================================================
   gift.css — Regalo del Pase Dorado
   ============================================================
   SECUENCIA DE APERTURA (la orquesta pass-gift.js con 3 clases):
     .fase-agita   0–420 ms   la caja se encoge y tiembla (anticipación)
     .fase-abre    420 ms     la tapa sale disparada, destello + onda + confeti
     .fase-revela  980 ms     la medalla sube DESDE DENTRO y entra el texto
   La caja no desaparece: se queda abierta debajo, así el premio se ve salir
   de ella en vez de aparecer de la nada.
   ============================================================ */

.gift-overlay {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 1.2rem;
  background: radial-gradient(ellipse at 50% 45%, rgba(38,28,6,0.94), rgba(5,5,16,0.985));
  backdrop-filter: blur(7px); -webkit-backdrop-filter: blur(7px);
  animation: gift-fade 0.4s ease both;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
}
@keyframes gift-fade { from { opacity: 0 } to { opacity: 1 } }

/* ── Rayos de fondo ── */
.gift-rays {
  position: absolute; top: 50%; left: 50%; width: 200vmax; height: 200vmax;
  margin: -100vmax 0 0 -100vmax; pointer-events: none;
  background: conic-gradient(from 0deg,
    transparent 0deg, rgba(245,200,66,0.13) 10deg, transparent 20deg,
    transparent 30deg, rgba(245,200,66,0.09) 40deg, transparent 50deg);
  animation: gift-spin 26s linear infinite;
  opacity: 0; transition: opacity 1s ease;
}
.fase-abre .gift-rays { opacity: 1; }
@keyframes gift-spin { to { transform: rotate(360deg) } }

/* ── Destello y onda expansiva del momento de abrir ── */
.gift-flash, .gift-shock {
  position: absolute; top: 44%; left: 50%; pointer-events: none;
  transform: translate(-50%, -50%); opacity: 0;
}
.gift-flash {
  width: 60vmax; height: 60vmax; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,248,220,0.95) 0%,
              rgba(245,200,66,0.55) 25%, transparent 62%);
}
.gift-shock {
  width: 120px; height: 120px; border-radius: 50%;
  border: 3px solid rgba(255,240,190,0.9);
}
.fase-abre .gift-flash { animation: gift-flash 0.75s ease-out forwards; }
.fase-abre .gift-shock { animation: gift-shock 0.85s cubic-bezier(.16,.9,.3,1) forwards; }
@keyframes gift-flash {
  0%   { opacity: 0;    transform: translate(-50%, -50%) scale(0.15) }
  18%  { opacity: 1 }
  100% { opacity: 0;    transform: translate(-50%, -50%) scale(1) }
}
@keyframes gift-shock {
  0%   { opacity: 0.95; transform: translate(-50%, -50%) scale(0.2);  border-width: 4px }
  100% { opacity: 0;    transform: translate(-50%, -50%) scale(7);    border-width: 0.5px }
}

.gift-panel {
  position: relative; z-index: 3;
  width: min(440px, 100%); text-align: center;
}

/* ── ESCENA: caja + medalla ─────────────────────────────── */
.gift-scene {
  position: relative; height: 210px;
  display: flex; align-items: flex-end; justify-content: center;
  perspective: 800px;
}

/* Luz que sale del interior al abrirse */
.gift-glow {
  position: absolute; bottom: 34px; left: 50%; width: 190px; height: 190px;
  transform: translateX(-50%) scale(0.2); opacity: 0;
  background: radial-gradient(circle, rgba(255,236,170,0.85), transparent 66%);
  transition: opacity 0.5s ease, transform 0.6s ease;
}
.fase-abre .gift-glow { opacity: 1; transform: translateX(-50%) scale(1); }

/* ── La caja ── */
.gift-box {
  position: relative; width: 156px; height: 128px;
  cursor: pointer; background: none; border: 0; padding: 0;
  transform-style: preserve-3d;
  animation: gift-flota 2.6s ease-in-out infinite;
}
.gift-box:focus-visible {
  outline: 3px solid var(--gold, #f5c842); outline-offset: 10px; border-radius: 14px;
}
@keyframes gift-flota {
  0%, 100% { transform: translateY(0)     rotate(-1.6deg) }
  50%      { transform: translateY(-9px)  rotate(1.6deg)  }
}
.gift-box:hover { animation-play-state: paused; }

/* Sombra en el suelo, se encoge cuando la caja sube */
.gift-shadow {
  position: absolute; left: 50%; bottom: -16px;
  width: 118px; height: 16px; margin-left: -59px; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0,0,0,0.55), transparent 70%);
  animation: gift-sombra 2.6s ease-in-out infinite;
}
@keyframes gift-sombra {
  0%, 100% { transform: scale(1);    opacity: 0.55 }
  50%      { transform: scale(0.84); opacity: 0.33 }
}

/* Cuerpo y tapa */
.gift-body, .gift-lid {
  position: absolute; left: 0; right: 0;
  background: linear-gradient(150deg, #ffd76b 0%, #f5c842 38%, #c98f11 100%);
  border-radius: 7px;
  box-shadow: inset 0 -10px 18px rgba(122,90,6,0.42),
              inset 0 3px 8px rgba(255,255,255,0.55);
}
.gift-body { top: 40px; bottom: 0; }
.gift-lid  { top: 0; height: 42px; z-index: 3; transform-origin: 50% 100%; }

/* Cintas: la vertical va alineada en tapa y cuerpo, por eso se ve continua */
.gift-ribbon-v {
  position: absolute; top: 0; bottom: 0; left: 50%;
  width: 26px; margin-left: -13px;
  background: linear-gradient(90deg, #a30d1c, #e0273c 45%, #a30d1c);
  box-shadow: 0 0 6px rgba(0,0,0,0.3);
}
.gift-ribbon-h {
  position: absolute; left: 0; right: 0; top: 30px; height: 20px;
  background: linear-gradient(180deg, #a30d1c, #e0273c 45%, #a30d1c);
  opacity: 0.92;
}
.gift-bow {
  position: absolute; left: 50%; top: -14px;
  transform: translateX(-50%); font-size: 2.1rem; z-index: 4;
  filter: drop-shadow(0 3px 5px rgba(0,0,0,0.45));
}

/* Brillo que recorre la tapa */
.gift-sheen {
  position: absolute; inset: 0; border-radius: 7px; overflow: hidden;
}
.gift-sheen::after {
  content: ""; position: absolute; top: -80%; left: -130%;
  width: 55%; height: 260%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
  transform: rotate(20deg); animation: gift-sweep 3.4s ease-in-out infinite;
}
@keyframes gift-sweep {
  0%, 62% { left: -130% }
  100%    { left: 170% }
}

/* Línea de luz que se abre en la juntura justo antes de estallar */
.gift-seam {
  position: absolute; left: 6px; right: 6px; top: 40px; height: 3px;
  border-radius: 3px; background: #fff8dc; opacity: 0; z-index: 2;
  box-shadow: 0 0 12px 3px rgba(255,236,170,0.95);
}
.fase-agita .gift-seam { animation: gift-seam 0.42s ease-in forwards; }
@keyframes gift-seam {
  0%   { opacity: 0; transform: scaleY(0.3) }
  100% { opacity: 1; transform: scaleY(2.6) }
}

/* Anticipación: se encoge y tiembla */
.fase-agita .gift-box    { animation: gift-tiembla 0.42s ease-in-out; }
.fase-agita .gift-shadow { animation: none; transform: scale(1.06); opacity: 0.6; }
@keyframes gift-tiembla {
  0%   { transform: translateY(0)   rotate(0deg)    scale(1)          }
  25%  { transform: translateY(3px) rotate(-5deg)   scale(1.05, 0.94) }
  50%  { transform: translateY(4px) rotate(5deg)    scale(1.07, 0.92) }
  75%  { transform: translateY(3px) rotate(-4deg)   scale(1.05, 0.94) }
  100% { transform: translateY(5px) rotate(0deg)    scale(1.1, 0.88)  }
}

/* Apertura: la tapa sale disparada girando; el cuerpo rebota y se queda */
.fase-abre .gift-box    { animation: gift-rebote 0.6s cubic-bezier(.2,1.5,.4,1) forwards; }
.fase-abre .gift-shadow { animation: none; }
.fase-abre .gift-seam   { opacity: 0; transition: opacity 0.2s ease; }
.fase-abre .gift-lid    { animation: gift-tapa 0.85s cubic-bezier(.3,.7,.4,1) forwards; }
@keyframes gift-rebote {
  0%   { transform: scale(1.1, 0.88) translateY(5px) }
  45%  { transform: scale(0.95, 1.06) translateY(-4px) }
  100% { transform: scale(1, 1) translateY(0) }
}
@keyframes gift-tapa {
  0%   { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1 }
  35%  { transform: translate(14px, -132px) rotate(-32deg) scale(1.03); opacity: 1 }
  100% { transform: translate(52px, -240px) rotate(-104deg) scale(0.72); opacity: 0 }
}
/* El interior queda oscuro y luminoso por dentro */
.fase-abre .gift-body::after {
  content: ""; position: absolute; left: 5px; right: 5px; top: -6px; height: 14px;
  border-radius: 50%;
  background: radial-gradient(ellipse, #fff6d5, rgba(245,200,66,0.35) 60%, transparent);
  animation: gift-boca 0.4s ease-out both;
}
@keyframes gift-boca { from { opacity: 0; transform: scaleX(0.3) } to { opacity: 1 } }

/* ── La medalla: sale DESDE DENTRO de la caja ── */
.gift-medal {
  position: absolute; left: 50%; bottom: 30px;
  transform: translate(-50%, 0) scale(0.2);
  font-size: 3.4rem; line-height: 1; color: var(--gold, #f5c842);
  opacity: 0; z-index: 2; pointer-events: none;
  text-shadow: 0 0 30px rgba(245,200,66,0.9), 0 0 60px rgba(245,200,66,0.5);
}
.fase-abre .gift-medal { animation: gift-sube 1.05s cubic-bezier(.18,1.3,.35,1) 0.16s forwards; }
@keyframes gift-sube {
  0%   { opacity: 0; transform: translate(-50%, 20px)   scale(0.2) }
  30%  { opacity: 1 }
  70%  { transform: translate(-50%, -118px) scale(1.18) }
  100% { opacity: 1; transform: translate(-50%, -104px) scale(1) }
}
/* Una vez arriba, respira */
.fase-revela .gift-medal { animation: gift-late 3s ease-in-out infinite; }
@keyframes gift-late {
  0%, 100% { transform: translate(-50%, -104px) scale(1)    }
  50%      { transform: translate(-50%, -110px) scale(1.09) }
}

/* ── Texto ── */
.gift-tap {
  font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold, #f5c842); margin-top: 1.4rem;
  animation: gift-pulse 1.8s ease-in-out infinite;
}
@keyframes gift-pulse { 0%, 100% { opacity: 0.35 } 50% { opacity: 1 } }
.fase-agita .gift-tap { animation: none; opacity: 0; transition: opacity 0.2s ease; }
.fase-abre  .gift-tap { display: none; }

.gift-reveal { display: none; margin-top: -0.4rem; }
.fase-revela .gift-reveal { display: block; }

/* Cada línea entra escalonada */
.fase-revela .gift-reveal > * {
  animation: gift-entra 0.55s cubic-bezier(.22,1,.36,1) both;
}
.fase-revela .gift-reveal > *:nth-child(1) { animation-delay: 0.00s }
.fase-revela .gift-reveal > *:nth-child(2) { animation-delay: 0.09s }
.fase-revela .gift-reveal > *:nth-child(3) { animation-delay: 0.18s }
.fase-revela .gift-reveal > *:nth-child(4) { animation-delay: 0.27s }
.fase-revela .gift-reveal > *:nth-child(5) { animation-delay: 0.36s }
@keyframes gift-entra {
  from { opacity: 0; transform: translateY(16px) }
  to   { opacity: 1; transform: none }
}

.gift-title {
  font-family: var(--font-display, serif); font-size: 1.55rem; font-weight: 800;
  color: var(--gold, #f5c842); margin: 0 0 0.35rem;
  text-shadow: 0 2px 22px rgba(245,200,66,0.45);
}
.gift-from   { font-size: 1rem; color: var(--text, #e8e8f0); margin-bottom: 0.5rem; }
.gift-from b { color: var(--gold, #f5c842); }
.gift-note {
  font-size: 0.88rem; font-style: italic; color: var(--text, #e8e8f0);
  background: rgba(245,200,66,0.09); border-left: 3px solid var(--gold, #f5c842);
  border-radius: 0 8px 8px 0; padding: 0.55rem 0.75rem;
  margin: 0.7rem auto 0.2rem; max-width: 340px; text-align: left;
  overflow-wrap: anywhere;
}
.gift-sub {
  font-size: 0.8rem; color: var(--muted, #9aa0b5);
  line-height: 1.5; margin: 0.75rem auto 1.15rem; max-width: 330px;
}
.gift-actions { display: flex; gap: 0.55rem; justify-content: center; flex-wrap: wrap; }
.gift-btn {
  cursor: pointer; font-family: inherit; font-size: 0.86rem; font-weight: 700;
  padding: 0.62rem 1.15rem; border-radius: 10px; text-decoration: none;
  background: rgba(255,255,255,0.07); color: var(--text, #e8e8f0);
  border: 1px solid rgba(255,255,255,0.16);
  transition: background 0.15s ease, transform 0.15s ease;
}
.gift-btn:hover:not(:disabled) { background: rgba(255,255,255,0.13); transform: translateY(-1px); }
.gift-btn.primary {
  background: linear-gradient(135deg, #ffd76b, #d19a17);
  border-color: #f5c842; color: #26210a;
  box-shadow: 0 4px 20px rgba(245,200,66,0.3);
}
.gift-btn.primary:hover { filter: brightness(1.08); }
.gift-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.gift-btn.block { display: block; width: 100%; margin-top: 0.9rem; }

/* ── Confeti: sale disparado de la caja y cae ── */
.gift-confetti { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.gift-confetti i {
  position: absolute; width: var(--w, 8px); height: var(--h, 13px); border-radius: 2px;
  animation: gift-estalla var(--d, 1.8s) cubic-bezier(.13,.62,.35,1) var(--dl, 0s) forwards;
}
@keyframes gift-estalla {
  0%   { opacity: 1; transform: translate(0, 0) rotate(0deg) }
  22%  { opacity: 1;
         transform: translate(calc(var(--vx) * 0.55), calc(var(--vy) * 0.85)) rotate(calc(var(--r) * 0.3)) }
  100% { opacity: 0;
         transform: translate(var(--vx), var(--caida)) rotate(var(--r)) }
}

/* ── Botón de regalar en la página del pase ── */
.bp-gift-btn {
  cursor: pointer; font-family: inherit; font-size: 0.8rem; font-weight: 700;
  padding: 0.55rem 1rem; border-radius: 10px; margin-top: 0.5rem;
  background: rgba(245,200,66,0.10); color: var(--gold, #f5c842);
  border: 1px dashed rgba(245,200,66,0.45);
  transition: background 0.15s ease, transform 0.15s ease;
}
.bp-gift-btn:hover { background: rgba(245,200,66,0.18); transform: translateY(-1px); }

/* ── Modal de envío ── */
.gift-send-box {
  width: min(400px, 94vw); max-height: 90vh; overflow-y: auto;
  background: var(--bg-glass, rgba(13,13,36,0.97));
  border: 1px solid rgba(245,200,66,0.32); border-radius: 16px;
  padding: 1.4rem 1.2rem 1.2rem; position: relative; text-align: center;
  -webkit-overflow-scrolling: touch;
}
.gs-icon  { font-size: 2.4rem; line-height: 1; }
.gs-title {
  font-family: var(--font-display, serif); font-size: 1.2rem; font-weight: 800;
  color: var(--gold, #f5c842); margin: 0.35rem 0 0.4rem; padding-right: 1.6rem;
}
.gs-sub { font-size: 0.8rem; color: var(--muted, #9aa0b5); line-height: 1.5; margin-bottom: 1rem; }
.gs-label {
  display: block; text-align: left; font-size: 0.62rem; font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted, #9aa0b5); margin-bottom: 0.3rem;
}
.gs-input {
  width: 100%; box-sizing: border-box; margin-bottom: 0.85rem;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px; padding: 0.62rem 0.8rem;
  color: var(--text, #e8e8f0); font-family: inherit; font-size: 0.9rem; outline: none;
  transition: border-color 0.15s ease;
}
.gs-input:focus { border-color: var(--gold, #f5c842); }
.gs-cost {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.6rem 0.8rem; border-radius: 10px; margin-top: 0.3rem;
  background: rgba(245,200,66,0.10); border: 1px solid rgba(245,200,66,0.28);
  font-size: 0.85rem;
}
.gs-cost b { color: var(--gold, #f5c842); font-size: 0.95rem; }
.gs-cost.short { background: rgba(204,17,34,0.10); border-color: rgba(204,17,34,0.35); }
.gs-balance { font-size: 0.74rem; color: var(--muted, #9aa0b5); margin-top: 0.4rem; }
.gs-err {
  margin-top: 0.7rem; padding: 0.5rem 0.7rem; border-radius: 8px;
  background: rgba(204,17,34,0.14); border: 1px solid rgba(204,17,34,0.4);
  color: #ffb3bb; font-size: 0.78rem; line-height: 1.45; overflow-wrap: anywhere;
}

/* ── Móvil ── */
@media (max-width: 430px) {
  .gift-scene  { height: 182px; }
  .gift-box    { width: 132px; height: 110px; }
  .gift-lid    { height: 36px; }
  .gift-body   { top: 34px; }
  .gift-seam   { top: 34px; }
  .gift-shadow { width: 100px; margin-left: -50px; }
  .gift-glow   { width: 160px; height: 160px; }
  .gift-title  { font-size: 1.3rem; }
  .gift-from   { font-size: 0.92rem; }
  .gift-medal  { font-size: 2.8rem; }
  .gift-actions .gift-btn { flex: 1 1 100%; }
  @keyframes gift-sube {
    0%   { opacity: 0; transform: translate(-50%, 18px) scale(0.2) }
    30%  { opacity: 1 }
    70%  { transform: translate(-50%, -100px) scale(1.18) }
    100% { opacity: 1; transform: translate(-50%, -88px) scale(1) }
  }
  @keyframes gift-late {
    0%, 100% { transform: translate(-50%, -88px) scale(1)    }
    50%      { transform: translate(-50%, -94px) scale(1.09) }
  }
}

/* Pantallas bajas (móvil en horizontal) */
@media (max-height: 620px) {
  .gift-scene { height: 150px; }
  .gift-box   { width: 112px; height: 92px; }
  .gift-lid   { height: 30px; }
  .gift-body  { top: 28px; }
  .gift-seam  { top: 28px; }
  .gift-sub   { display: none; }
}

/* ── Accesibilidad: sin movimiento ── */
/* Se salta toda la coreografía y enseña el resultado directamente. */
@media (prefers-reduced-motion: reduce) {
  .gift-overlay, .gift-overlay *, .gift-overlay *::after, .gift-overlay *::before {
    animation: none !important; transition: none !important;
  }
}
.gift-overlay.no-anim .gift-rays  { opacity: 1; }
.gift-overlay.no-anim .gift-medal { opacity: 1; transform: translate(-50%, -104px) scale(1); }
.gift-overlay.no-anim .gift-lid   { display: none; }
.gift-overlay.no-anim .gift-tap   { display: none; }
