/* ═══════════════════════════════════════════════════════════════════════
   泊樂娛樂城 · dzboma 骰盅開盅彈窗  (prefix: dice-)
   self-contained · 酒紅賭桌氈 + 金 · 與其他站不共用 class / 配色 / 機制
   ═══════════════════════════════════════════════════════════════════════ */

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

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

/* ── Footer banner ────────────────────────────────────────────────── */
.dice-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.45);
  border-radius: 10px;
  background: #2a0a10;
  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;
}
.dice-footer-promo.is-visible { transform: translateY(0); opacity: 1; }
.dice-footer-promo a { display: block; min-height: 64px; }
.dice-footer-promo img { display: block; width: 100%; height: auto; }

.dice-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;
}
.dice-footer-badge {
  padding: 2px 8px; border-radius: 999px; background: #b8121f;
  color: #fff; font-size: 12px; font-weight: 800;
}
.dice-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;
}

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

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

/* ── Card (酒紅賭桌氈) ─────────────────────────────────────────────── */
.dice-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.42);
  border-radius: 16px;
  background:
    radial-gradient(circle at 82% 6%, rgba(245, 210, 100, 0.22), transparent 32%),
    linear-gradient(160deg, #4a0d16 0%, #6e1320 50%, #2a070d 100%);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  transform: translateY(14px) scale(0.985);
  transition: transform 180ms ease;
}
.dice-backdrop.is-visible .dice-card { transform: translateY(0) scale(1); }
.dice-close { top: 10px; right: 10px; }

/* ── Sticky header ────────────────────────────────────────────────── */
.dice-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);
}
.dice-brand { font-size: 18px; font-weight: 900; letter-spacing: 0.5px; color: #ffe89b; }
.dice-sub   { margin-top: 4px; font-size: 12.5px; color: rgba(255, 255, 255, 0.8); }

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

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

/* Felt board the cup sits on */
.dice-board {
  position: relative;
  width: min(82vw, 300px);
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(0,0,0,0.36), transparent 62%),
    linear-gradient(180deg, #7d1422 0%, #5a0e1a 100%);
  border: 1px solid rgba(245, 210, 100, 0.28);
  box-shadow: inset 0 4px 18px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

/* Three dice sitting on the felt (hidden under cup initially) */
.dice-row {
  position: absolute;
  bottom: 14%;
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  display: flex;
  gap: clamp(6px, 2.4vw, 12px);
  opacity: 0;
  transition: opacity 320ms ease, transform 320ms ease;
  z-index: 2;
}
.dice-row.dice-row-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.dice-die {
  width: clamp(40px, 13vw, 58px);
  aspect-ratio: 1 / 1;
  border-radius: 22%;
  background: linear-gradient(155deg, #fff8ec 0%, #ffe9c7 100%);
  border: 1px solid rgba(150, 60, 20, 0.4);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4), inset 0 2px 4px rgba(255, 255, 255, 0.7);
  padding: 14%;
}
.dice-pip-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  width: 100%; height: 100%;
  place-items: center;
}
.dice-pip-grid i {
  width: 60%; aspect-ratio: 1 / 1; border-radius: 50%;
  background: #b8121f;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.35);
  visibility: hidden;
}
/* gold-red 豹子: face 6 shows all 6 pips (cells 0,2,3,5,6,8) */
.dice-die[data-face="6"] .dice-pip-grid i:nth-child(1),
.dice-die[data-face="6"] .dice-pip-grid i:nth-child(3),
.dice-die[data-face="6"] .dice-pip-grid i:nth-child(4),
.dice-die[data-face="6"] .dice-pip-grid i:nth-child(6),
.dice-die[data-face="6"] .dice-pip-grid i:nth-child(7),
.dice-die[data-face="6"] .dice-pip-grid i:nth-child(9) { visibility: visible; }

/* Golden 588 badge that floats up over the dice */
.dice-badge {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translate(-50%, 10px) scale(0.6);
  z-index: 3;
  padding: 6px 16px;
  border-radius: 999px;
  font-size: clamp(22px, 7vw, 30px);
  font-weight: 900;
  color: #3a2400;
  background: radial-gradient(circle at 50% 30%, #ffe790, #ff9e2c);
  border: 2px solid #fff3cf;
  box-shadow: 0 8px 20px rgba(255, 158, 44, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease, transform 520ms cubic-bezier(0.2, 1.2, 0.3, 1);
}
.dice-badge.dice-badge-up {
  opacity: 1;
  transform: translate(-50%, -8px) scale(1);
}

/* The dice cup — sits over the dice, shakes, then lifts */
.dice-cup {
  position: absolute;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  width: clamp(86px, 30vw, 124px);
  aspect-ratio: 3 / 4;
  z-index: 4;
  transition: transform 560ms cubic-bezier(0.34, 0.9, 0.3, 1), opacity 420ms ease;
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5));
}
.dice-cup-body {
  position: absolute; inset: 0;
  border-radius: 12% 12% 44% 44% / 8% 8% 22% 22%;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.32) 0%, transparent 22%, transparent 78%, rgba(0,0,0,0.32) 100%),
    linear-gradient(180deg, #8a1a28 0%, #5c0f1a 100%);
  border: 1px solid rgba(245, 210, 100, 0.45);
  box-shadow: inset 0 -10px 18px rgba(0, 0, 0, 0.4);
}
.dice-cup-rim {
  position: absolute; top: -4%; left: 50%;
  transform: translateX(-50%);
  width: 112%; height: 18%;
  border-radius: 50%;
  background: linear-gradient(180deg, #ffe790, #c9962f);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
@keyframes diceShake {
  0%, 100% { transform: translateX(-50%) rotate(0); }
  15% { transform: translateX(-62%) rotate(-7deg); }
  30% { transform: translateX(-38%) rotate(7deg); }
  45% { transform: translateX(-60%) rotate(-6deg); }
  60% { transform: translateX(-40%) rotate(6deg); }
  75% { transform: translateX(-56%) rotate(-4deg); }
  90% { transform: translateX(-44%) rotate(4deg); }
}
.dice-cup.dice-cup-shaking {
  animation: diceShake 0.42s ease-in-out infinite;
}
.dice-cup.dice-cup-lift {
  transform: translateX(-50%) translateY(-130%) scale(1.04);
  opacity: 0;
}

/* Shake / open button */
.dice-shake {
  margin-top: 12px;
  min-width: 140px;
  padding: 11px 26px;
  border-radius: 999px;
  border: 2px solid #fff;
  cursor: pointer;
  color: #3a2400;
  font-size: clamp(15px, 4.4vw, 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, box-shadow 160ms ease;
}
.dice-shake:hover:not(:disabled) { transform: scale(1.04); }
.dice-shake:disabled { cursor: default; opacity: 0.92; }
.dice-shake.dice-shake-open {
  box-shadow: 0 0 0 0 rgba(255, 158, 44, 0.7);
  animation: dicePulse 1.1s ease-in-out infinite;
}

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

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

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

/* ── 活動總覽 ─────────────────────────────────────────────────────── */
.dice-list-title {
  margin: 18px 0 10px; text-align: center; font-size: 13px; font-weight: 800;
  color: rgba(255, 255, 255, 0.72); letter-spacing: 0.04em;
}
.dice-acts { display: grid; gap: 8px; }
.dice-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);
}
.dice-act.dice-feat { border-color: rgba(245, 210, 100, 0.5); background: rgba(245, 210, 100, 0.08); }
.dice-badge-no {
  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: #ffe89b;
}
.dice-act-main { flex: 1 1 auto; min-width: 0; }
.dice-act-label { font-size: 13.5px; font-weight: 800; }
.dice-tag {
  display: inline-block; margin-right: 6px; padding: 1px 6px; border-radius: 999px;
  background: #f5d264; color: #3a2400; font-size: 10.5px; font-weight: 800;
}
.dice-act-desc { margin-top: 2px; font-size: 12px; color: rgba(255, 255, 255, 0.68); }
.dice-act-reward { flex: none; font-size: 22px; font-weight: 900; color: #ffd84f; }
.dice-act-reward small { font-size: 11px; color: rgba(255, 255, 255, 0.62); margin-left: 2px; }

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

.dice-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;
}
.dice-pulse { animation: dicePulse 1.1s ease-in-out 3; }
@keyframes dicePulse {
  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); }
}

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

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

@media (prefers-reduced-motion: reduce) {
  .dice-footer-promo, .dice-backdrop, .dice-card, .dice-prize, .dice-pulse,
  .dice-conf, .dice-cup, .dice-badge, .dice-row, .dice-shake { transition: none; animation: none; }
}
