/* ═══════════════════════════════════════════════════════════════════════
   泊樂娛樂城 · sportgame 神秘寶箱開箱彈窗  (prefix: box-)
   self-contained · 與其他站不共用 class / 配色 / 機制
   配色:黑金木質寶箱 + 金色光束(刻意區別於試點紫金)
   ═══════════════════════════════════════════════════════════════════════ */

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

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

/* ── Footer banner ────────────────────────────────────────────────── */
.box-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, 197, 66, 0.5);
  border-radius: 10px;
  background: #0a0703;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transform: translateY(18px);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}
.box-footer-promo.is-visible { transform: translateY(0); opacity: 1; }
.box-footer-promo a { display: block; min-height: 64px; }
.box-footer-promo img { display: block; width: 100%; height: auto; }

.box-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;
}
.box-footer-badge {
  padding: 2px 8px; border-radius: 999px; background: #c0392b;
  color: #fff; font-size: 12px; font-weight: 800;
}
.box-footer-cta-pill {
  padding: 4px 12px; border-radius: 999px;
  background: linear-gradient(180deg, #ffe790, #ff9e2c);
  color: #160d05; font-size: 13px; font-weight: 900; white-space: nowrap;
}

.box-footer-close,
.box-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;
}
.box-footer-close { top: 6px; right: 6px; }

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

/* ── Card (black-gold wood chest theme) ───────────────────────────── */
.box-card {
  position: relative;
  width: min(94vw, 420px);
  max-height: min(92vh, 760px);
  display: flex;
  flex-direction: column;
  color: #fff;
  border: 1px solid rgba(245, 197, 66, 0.46);
  border-radius: 16px;
  background:
    radial-gradient(circle at 82% 4%, rgba(245, 197, 66, 0.28), transparent 32%),
    linear-gradient(160deg, #1c1407 0%, #2a1c08 48%, #0a0703 100%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.56);
  overflow: hidden;
  transform: translateY(14px) scale(0.985);
  transition: transform 180ms ease;
}
.box-backdrop.is-visible .box-card { transform: translateY(0) scale(1); }
.box-close { top: 10px; right: 10px; }

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

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

/* ── Mystery-box stage ────────────────────────────────────────────── */
.box-stage { position: relative; display: grid; place-items: center; }

.box-chest-wrap {
  position: relative;
  width: min(64vw, 240px);
  aspect-ratio: 1 / 1;
  display: grid; place-items: center;
  filter: drop-shadow(0 14px 26px rgba(0, 0, 0, 0.5));
}

/* light beam shooting up out of the open chest */
.box-beam {
  position: absolute;
  left: 50%; bottom: 38%;
  width: 64%;
  height: 90%;
  transform: translateX(-50%) scaleY(0);
  transform-origin: bottom center;
  background: linear-gradient(to top,
    rgba(255, 224, 130, 0.55) 0%,
    rgba(255, 216, 107, 0.28) 40%,
    rgba(255, 216, 107, 0) 100%);
  clip-path: polygon(38% 100%, 62% 100%, 100% 0, 0 0);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  transition: transform 360ms ease, opacity 360ms ease;
}
.box-chest-wrap.box-opening .box-beam { transform: translateX(-50%) scaleY(1); opacity: 1; }

/* chest built from CSS shapes: lid (top) + base (bottom) */
.box-chest {
  position: relative;
  width: 78%;
  height: 70%;
  align-self: end;
  margin-bottom: 8%;
  z-index: 3;
}
.box-lid {
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 42%;
  border-radius: 50% 50% 12px 12px / 90% 90% 12px 12px;
  background:
    linear-gradient(180deg, #6b4a1c 0%, #4a3112 60%, #3a2710 100%);
  border: 2px solid #2a1c0a;
  border-bottom: none;
  box-shadow: inset 0 4px 8px rgba(255, 224, 130, 0.25);
  transform-origin: 50% 100%;
  transform: rotateX(0deg);
  transition: transform 420ms cubic-bezier(.34,1.4,.5,1);
  z-index: 4;
}
.box-chest-wrap.box-opening .box-lid { transform: rotateX(-118deg); }
.box-lid-band {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 16%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #f5c542, #c9962f);
  border-radius: 4px;
}
.box-lock {
  position: absolute; left: 50%; bottom: -6px; width: 22%; height: 30%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 35%, #ffe790, #c9962f);
  border: 2px solid #8a6418; border-radius: 5px;
  z-index: 5;
}
.box-base {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 64%;
  border-radius: 10px 10px 14px 14px;
  background:
    linear-gradient(180deg, #5a3d16 0%, #3a2710 70%, #2a1c0a 100%);
  border: 2px solid #2a1c0a;
  box-shadow: inset 0 -6px 10px rgba(0, 0, 0, 0.4),
              inset 0 3px 6px rgba(255, 224, 130, 0.18);
  z-index: 2;
}
.box-base-band {
  position: absolute; left: 50%; top: 0; bottom: 0; width: 16%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #c9962f, #8a6418);
}
.box-keyhole {
  position: absolute; left: 50%; top: 26%; width: 14%; height: 22%;
  transform: translateX(-50%);
  background: radial-gradient(circle at 50% 30%, #ffe790, #c9962f);
  border: 2px solid #8a6418;
  border-radius: 5px 5px 3px 3px;
}

/* golden 588 plaque that floats up out of the chest */
.box-plaque {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, 10%) scale(0.6);
  display: grid; place-items: center; line-height: 1;
  width: 46%; aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 34%, #fff3c4, #f5c542 45%, #c9962f 100%);
  border: 3px solid #fff7df;
  box-shadow: 0 8px 22px rgba(245, 197, 66, 0.6), 0 0 0 4px rgba(201, 150, 47, 0.4);
  color: #3a2400;
  opacity: 0;
  z-index: 2;
  transition: transform 520ms cubic-bezier(.22,1,.36,1), opacity 360ms ease;
}
.box-chest-wrap.box-plaque-up .box-plaque {
  opacity: 1;
  transform: translate(-50%, -78%) scale(1);
}
.box-plaque-num { font-size: clamp(26px, 9vw, 40px); font-weight: 900; }
.box-plaque-tag { font-size: clamp(10px, 3vw, 13px); font-weight: 800; margin-top: 1px; }

/* coin burst particles */
.box-burst { position: absolute; inset: 0; pointer-events: none; z-index: 6; overflow: visible; }
.box-coin {
  position: absolute; left: 50%; top: 46%;
  width: 14px; height: 14px; margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, #fff3c4, #f5c542 55%, #c9962f 100%);
  border: 1px solid #8a6418;
  opacity: 0;
}
@keyframes boxCoinPop {
  0%   { transform: translate(0, 0) scale(0.4); opacity: 0; }
  20%  { opacity: 1; }
  60%  { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.1), calc(var(--dy) + 80px)) scale(0.85); opacity: 0; }
}

.box-open {
  margin-top: 12px;
  min-width: clamp(120px, 42%, 200px);
  padding: 11px 26px;
  border-radius: 999px;
  border: 2px solid #fff7df; cursor: pointer; z-index: 4;
  color: #3a2400; font-size: clamp(15px, 4.6vw, 18px); font-weight: 900; letter-spacing: 1px;
  background: radial-gradient(circle at 50% 30%, #ffe790, #ff9e2c);
  box-shadow: 0 6px 18px rgba(255, 158, 44, 0.5);
  transition: transform 120ms ease;
}
.box-open:hover:not(:disabled) { transform: scale(1.05); }
.box-open:disabled { cursor: default; opacity: 0.92; }

.box-hint {
  margin-top: 8px; font-size: 12.5px; color: rgba(255, 255, 255, 0.6);
  transition: opacity 200ms ease;
}

/* ── Prize reveal ─────────────────────────────────────────────────── */
.box-prize {
  position: absolute; inset: 0; display: grid; place-content: center;
  text-align: center; gap: 4px;
  background: radial-gradient(circle at 50% 45%, rgba(28, 20, 7, 0.96), rgba(10, 7, 3, 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;
}
.box-prize.box-shown { opacity: 1; visibility: visible; transform: scale(1); }
.box-congrats { font-size: 16px; font-weight: 800; color: #ffd86b; padding: 0 12px; }
.box-amount {
  font-size: 64px; font-weight: 900; line-height: 1; color: #ffce3f;
  text-shadow: 0 4px 16px rgba(255, 206, 63, 0.42);
}
.box-amount small { font-size: 22px; margin-left: 4px; }
.box-prize-tag { margin-top: 6px; font-size: 13px; color: rgba(255, 255, 255, 0.82); }

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

/* ── 活動總覽 ─────────────────────────────────────────────────────── */
.box-list-title {
  margin: 18px 0 10px; text-align: center; font-size: 13px; font-weight: 800;
  color: rgba(255, 255, 255, 0.7); letter-spacing: 0.04em;
}
.box-acts { display: grid; gap: 8px; }
.box-act {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.24);
}
.box-act.box-feat { border-color: rgba(245, 197, 66, 0.52); background: rgba(245, 197, 66, 0.09); }
.box-badge {
  flex: none; width: 24px; height: 24px; display: grid; place-items: center;
  border-radius: 999px; background: rgba(255, 255, 255, 0.12);
  font-size: 13px; font-weight: 800; color: #ffd86b;
}
.box-act-main { flex: 1 1 auto; min-width: 0; }
.box-act-label { font-size: 13.5px; font-weight: 800; }
.box-tag {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 999px;
  background: #f5c542; color: #3a2400; font-size: 10.5px; font-weight: 800;
}
.box-act-desc { margin-top: 2px; font-size: 12px; color: rgba(255, 255, 255, 0.66); }
.box-act-reward { flex: none; font-size: 22px; font-weight: 900; color: #ffce3f; }
.box-act-reward small { font-size: 11px; color: rgba(255, 255, 255, 0.6); margin-left: 2px; }

/* ── Sticky footer ────────────────────────────────────────────────── */
.box-foot {
  flex: none;
  padding: 12px 18px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.3);
}
.box-timer-wrap { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; }
.box-timer-label { font-size: 12px; color: rgba(255, 255, 255, 0.66); }
.box-timer { display: flex; gap: 6px; }
.box-tunit {
  min-width: 38px; padding: 4px 0; border-radius: 8px; text-align: center;
  background: rgba(245, 197, 66, 0.14); border: 1px solid rgba(245, 197, 66, 0.32);
}
.box-tnum { font-size: 17px; font-weight: 900; color: #ffd86b; line-height: 1.1; }
.box-tlbl { font-size: 10px; color: rgba(255, 255, 255, 0.6); }
.box-timer-done { font-size: 14px; font-weight: 800; color: #ff8a8a; }

.box-cta {
  display: flex; align-items: center; justify-content: center;
  min-height: 50px; border-radius: 10px;
  color: #160d05; 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;
}
.box-pulse { animation: boxPulse 1.1s ease-in-out 3; }
@keyframes boxPulse {
  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); }
}

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

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

@media (prefers-reduced-motion: reduce) {
  .box-footer-promo, .box-backdrop, .box-card, .box-prize, .box-pulse, .box-conf,
  .box-lid, .box-beam, .box-plaque, .box-coin { transition: none; animation: none; }
}
