/* ═══════════════════════════════════════════════════════════════════════
   泊樂娛樂城 · success-sport 紅包雨彈窗  (prefix: env-)
   self-contained · 喜慶紅金配色 · 與其他站不共用 class / 配色 / 機制
   ═══════════════════════════════════════════════════════════════════════ */

.env-promo-active {
  padding-bottom: clamp(86px, 17vw, 128px);
}

.env-footer-promo,
.env-backdrop {
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Microsoft JhengHei", "Segoe UI", sans-serif;
}
.env-footer-promo *,
.env-backdrop * { box-sizing: border-box; }

/* ── Footer banner ────────────────────────────────────────────────── */
.env-footer-promo {
  position: fixed;
  z-index: 2147483000;
  right: max(12px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  left: max(12px, env(safe-area-inset-left));
  max-width: 980px;
  margin: 0 auto;
  border: 1px solid rgba(245, 210, 100, 0.5);
  border-radius: 10px;
  background: #2a0707;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.44);
  overflow: hidden;
  transform: translateY(18px);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}
.env-footer-promo.is-visible { transform: translateY(0); opacity: 1; }
.env-footer-promo a { display: block; min-height: 64px; }
.env-footer-promo img { display: block; width: 100%; height: auto; }

.env-footer-text {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 14px 46px 14px 16px;
  color: #fff; font-size: 15px; font-weight: 700; flex-wrap: wrap; text-decoration: none;
}
.env-footer-badge {
  padding: 2px 8px; border-radius: 999px; background: #ff2d2d;
  color: #fff; font-size: 12px; font-weight: 800;
}
.env-footer-cta-pill {
  padding: 4px 12px; border-radius: 999px;
  background: linear-gradient(180deg, #ffe790, #ff9e2c);
  color: #3a1505; font-size: 13px; font-weight: 900; white-space: nowrap;
}

.env-footer-close,
.env-close {
  position: absolute; z-index: 2; display: grid; place-items: center;
  width: 34px; height: 34px; border: 0; border-radius: 999px;
  color: #fff; background: rgba(0, 0, 0, 0.62); cursor: pointer;
  font-size: 22px; line-height: 1;
}
.env-footer-close { top: 6px; right: 6px; }

/* ── Backdrop ─────────────────────────────────────────────────────── */
.env-backdrop {
  position: fixed; inset: 0; z-index: 2147483001;
  display: grid; place-items: center; padding: 18px;
  background: rgba(30, 4, 4, 0.66);
  opacity: 0; transition: opacity 180ms ease;
}
.env-backdrop.is-visible { opacity: 1; }

/* ── Card ─────────────────────────────────────────────────────────── */
.env-card {
  position: relative;
  width: min(94vw, 420px);
  max-height: min(92vh, 760px);
  display: flex;
  flex-direction: column;
  color: #fff;
  border: 1px solid rgba(245, 210, 100, 0.5);
  border-radius: 16px;
  background:
    radial-gradient(circle at 82% 6%, rgba(255, 198, 92, 0.3), transparent 32%),
    linear-gradient(160deg, #6e0d0d 0%, #a51212 48%, #4a0606 100%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: translateY(14px) scale(0.985);
  transition: transform 180ms ease;
}
.env-backdrop.is-visible .env-card { transform: translateY(0) scale(1); }
.env-close { top: 10px; right: 10px; }

/* ── Sticky header ────────────────────────────────────────────────── */
.env-head {
  flex: none;
  padding: 16px 18px 12px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
}
.env-brand { font-size: 18px; font-weight: 900; letter-spacing: 0.5px; color: #ffe89b; }
.env-sub   { margin-top: 4px; font-size: 12.5px; color: rgba(255, 255, 255, 0.82); }

/* ── Scrollable body ──────────────────────────────────────────────── */
.env-body {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 18px 8px;
}
.env-cap {
  text-align: center; font-size: 13px; line-height: 1.6;
  color: rgba(255, 255, 255, 0.86); margin-bottom: 12px;
}
.env-cap b { color: #ffd84f; font-weight: 900; }
.env-cap strong { color: #ffe89b; }

/* ── Red envelope stage ───────────────────────────────────────────── */
.env-stage {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  min-height: clamp(220px, 60vw, 300px);
  padding: 6px 0 4px;
  border-radius: 12px;
  overflow: hidden;                       /* contain rain — no horizontal scroll */
  background:
    radial-gradient(circle at 50% 30%, rgba(255, 198, 92, 0.14), transparent 60%),
    linear-gradient(180deg, rgba(0,0,0,0.18), rgba(0,0,0,0.34));
}

/* falling envelope rain */
.env-rain {
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 1;
}
.env-drop {
  position: absolute; top: -10%;
  font-size: clamp(18px, 6vw, 28px); line-height: 1;
  transform: scale(var(--env-scale, 1));
  will-change: transform, top;
}
@keyframes envDrop {
  0%   { top: -12%;  opacity: 0; }
  10%  { opacity: 1; }
  90%  { opacity: 1; }
  100% { top: 108%;  opacity: 0; }
}

/* central large 紅包 */
.env-pack {
  position: relative; z-index: 2;
  width: min(56vw, 188px);
  aspect-ratio: 3 / 4;
  margin-top: clamp(14px, 5vw, 26px);
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.5));
}
.env-pack-body {
  position: absolute; inset: 0;
  border-radius: 12px;
  background: linear-gradient(160deg, #ff3b3b 0%, #d11616 55%, #a30f0f 100%);
  border: 1px solid rgba(255, 220, 120, 0.55);
  overflow: visible;
}
/* envelope flap (rotates up on open) */
.env-pack-flap {
  position: absolute; top: 0; left: 0; right: 0; height: 46%;
  border-radius: 12px 12px 40% 40% / 12px 12px 100% 100%;
  background: linear-gradient(160deg, #ff5e5e 0%, #e21d1d 100%);
  border-bottom: 2px solid rgba(255, 220, 120, 0.6);
  transform-origin: top center;
  transition: transform 520ms cubic-bezier(.34,1.4,.5,1);
  z-index: 4;
}
.env-pack-seal {
  position: absolute; top: 38%; left: 50%; transform: translate(-50%, -50%);
  width: clamp(34px, 13vw, 46px); height: clamp(34px, 13vw, 46px);
  display: grid; place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #ffe790, #ffb52c);
  color: #8a0f0f; font-size: clamp(16px, 5.5vw, 22px); font-weight: 900;
  box-shadow: 0 3px 10px rgba(0,0,0,0.35);
  z-index: 5;
  transition: opacity 240ms ease;
}
/* golden 588 slip — hidden behind flap, floats up on open */
.env-slip {
  position: absolute; left: 50%; bottom: 16%;
  transform: translate(-50%, 0) scale(0.7);
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 14px; border-radius: 8px;
  background: linear-gradient(180deg, #fff4cf, #ffd84f);
  border: 1px solid #c9962f;
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  opacity: 0; z-index: 3;
  transition: transform 620ms cubic-bezier(.2,1,.3,1), opacity 360ms ease;
}
.env-slip-num { font-size: clamp(26px, 9vw, 38px); font-weight: 900; color: #b21111; line-height: 1; }
.env-slip-unit { font-size: 12px; font-weight: 800; color: #8a0f0f; margin-top: 2px; }

/* open state */
.env-pack.env-open .env-pack-flap { transform: rotateX(165deg); }
.env-pack.env-open .env-pack-seal { opacity: 0; }
.env-pack.env-open .env-slip {
  opacity: 1;
  transform: translate(-50%, -64%) scale(1);
}

.env-grab {
  position: relative; z-index: 6;
  margin-top: clamp(14px, 5vw, 22px);
  min-height: 46px; padding: 0 26px;
  border: 2px solid #fff; border-radius: 999px; cursor: pointer;
  color: #5a0606; font-size: clamp(15px, 4.6vw, 18px); font-weight: 900;
  background: radial-gradient(circle at 50% 30%, #ffe790, #ff9e2c);
  box-shadow: 0 6px 16px rgba(255, 158, 44, 0.5);
  transition: transform 120ms ease;
}
.env-grab:hover:not(:disabled) { transform: scale(1.05); }
.env-grab:disabled { cursor: default; opacity: 0.92; }

.env-hint {
  position: relative; z-index: 2;
  margin-top: 8px; font-size: 12.5px; color: rgba(255, 255, 255, 0.7);
  transition: opacity 200ms ease;
}

/* ── Prize reveal ─────────────────────────────────────────────────── */
.env-prize {
  position: absolute; inset: 0; display: grid; place-content: center;
  text-align: center; gap: 4px;
  background: radial-gradient(circle at 50% 45%, rgba(120, 14, 14, 0.96), rgba(74, 6, 6, 0.98));
  border-radius: 12px;
  opacity: 0; visibility: hidden; transform: scale(0.9);
  transition: opacity 240ms ease, transform 240ms ease, visibility 240ms;
  z-index: 8;
}
.env-prize.env-shown { opacity: 1; visibility: visible; transform: scale(1); }
.env-congrats { font-size: 16px; font-weight: 800; color: #ffe89b; padding: 0 14px; }
.env-amount {
  font-size: 64px; font-weight: 900; line-height: 1; color: #ffd84f;
  text-shadow: 0 4px 16px rgba(255, 216, 79, 0.4);
}
.env-amount small { font-size: 22px; margin-left: 4px; }
.env-prize-tag { margin-top: 6px; font-size: 13px; color: rgba(255, 255, 255, 0.86); }

/* ── Confetti ─────────────────────────────────────────────────────── */
.env-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 9; }
.env-conf { position: absolute; top: -16px; border-radius: 2px; }
@keyframes envFall {
  0%   { transform: translateY(0) rotate(0); opacity: 1; }
  100% { transform: translateY(360px) rotate(540deg); opacity: 0; }
}

/* ── 活動總覽 ─────────────────────────────────────────────────────── */
.env-list-title {
  margin: 18px 0 10px; text-align: center; font-size: 13px; font-weight: 800;
  color: rgba(255, 255, 255, 0.74); letter-spacing: 0.04em;
}
.env-acts { display: grid; gap: 8px; }
.env-act {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.24);
}
.env-act.env-feat { border-color: rgba(245, 210, 100, 0.55); background: rgba(245, 210, 100, 0.1); }
.env-badge {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 999px; background: rgba(255, 255, 255, 0.14);
  font-size: 13px; font-weight: 800; color: #ffe89b;
}
.env-act-main { flex: 1 1 auto; min-width: 0; }
.env-act-label { font-size: 13.5px; font-weight: 800; }
.env-tag {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 999px;
  background: #f5d264; color: #5a0606; font-size: 10.5px; font-weight: 800;
}
.env-act-desc { margin-top: 2px; font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.env-act-reward { flex: none; font-size: 22px; font-weight: 900; color: #ffd84f; }
.env-act-reward small { font-size: 11px; color: rgba(255, 255, 255, 0.64); margin-left: 2px; }

/* ── Sticky footer ────────────────────────────────────────────────── */
.env-foot {
  flex: none;
  padding: 12px 18px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.3);
}
.env-timer-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.env-timer-label { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.env-timer { display: flex; gap: 6px; }
.env-tunit {
  min-width: 38px; padding: 4px 0; border-radius: 8px; text-align: center;
  background: rgba(255, 214, 94, 0.16); border: 1px solid rgba(245, 210, 100, 0.34);
}
.env-tnum { font-size: 17px; font-weight: 900; color: #ffe89b; line-height: 1.1; }
.env-tlbl { font-size: 10px; color: rgba(255, 255, 255, 0.64); }
.env-timer-done { font-size: 14px; font-weight: 800; color: #ffb0b0; }

.env-cta {
  display: flex; align-items: center; justify-content: center;
  min-height: 50px; border-radius: 10px;
  color: #3a1505; text-decoration: none;
  background: linear-gradient(180deg, #ffe790, #ff9e2c);
  box-shadow: 0 10px 24px rgba(255, 157, 43, 0.3);
  font-size: 17px; font-weight: 900;
}
.env-pulse { animation: envPulse 1.1s ease-in-out 3; }
@keyframes envPulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 10px 24px rgba(255, 157, 43, 0.3); }
  50%      { transform: scale(1.03); box-shadow: 0 14px 32px rgba(255, 157, 43, 0.55); }
}

.env-terms { margin: 10px 0 0; font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.env-terms summary { cursor: pointer; color: rgba(255, 255, 255, 0.82); }
.env-terms p { margin: 6px 0 0; line-height: 1.55; }
.env-compliance { margin-top: 8px; text-align: center; font-size: 11.5px; color: rgba(255, 255, 255, 0.64); }

/* ── Mobile: bottom drawer ────────────────────────────────────────── */
@media (max-width: 520px) {
  .env-promo-active { padding-bottom: clamp(72px, 23vw, 106px); }
  .env-footer-promo { right: 8px; bottom: 8px; left: 8px; }
  .env-backdrop { place-items: end center; padding: 0; }
  .env-card {
    width: 100%;
    max-height: 94vh;
    border-radius: 18px 18px 0 0;
    transform: translateY(100%);
  }
  .env-backdrop.is-visible .env-card { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .env-footer-promo, .env-backdrop, .env-card, .env-prize, .env-pulse, .env-conf,
  .env-drop, .env-pack-flap, .env-slip { transition: none; animation: none; }
}
