/* =========================================================
   Hộp quà bí ẩn – 5 hộp, chọn 1
   ========================================================= */
.box-stage {
  position: relative; overflow: hidden; padding: 30px 22px 26px; text-align: center;
  background:
    radial-gradient(70% 80% at 50% 60%, rgba(255, 42, 61, .2), transparent 70%),
    linear-gradient(180deg, rgba(20, 6, 9, .9), rgba(8, 8, 10, .92));
}
.box-status { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.box-pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; font-family: var(--display); font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; font-size: 14px;
  background: rgba(255, 42, 61, .12); box-shadow: inset 0 0 0 1px var(--line-red);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.box-pill b { color: var(--red); }
.box-hint { color: var(--muted); margin: 6px 0 0; min-height: 22px; }

.box-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; margin: 64px auto 6px; max-width: 980px; }
.box-status, .box-hint, .box-countdown { position: relative; z-index: 3; }
.mbox {
  position: relative; border: 0; background: none; padding: 0 0 8px; cursor: pointer; color: var(--text);
  transition: transform .25s, opacity .4s, filter .4s;
  animation: mbox-float 3.4s ease-in-out infinite; animation-delay: calc(var(--i) * -.55s);
}
@keyframes mbox-float { 50% { transform: translateY(-9px); } }
.mbox svg { width: 100%; height: auto; display: block; overflow: visible; filter: drop-shadow(0 14px 16px rgba(0, 0, 0, .6)); transition: filter .25s; }
.mbox .num {
  display: inline-block; margin-top: 4px; font-family: var(--display); font-weight: 700; font-size: 14px; letter-spacing: .2em; color: var(--muted);
}
.mbox:hover:not(:disabled) svg, .mbox:focus-visible svg { filter: drop-shadow(0 0 18px rgba(255, 42, 61, .85)) drop-shadow(0 14px 16px rgba(0, 0, 0, .6)); }
.mbox:hover:not(:disabled) { animation: mbox-wiggle .5s ease-in-out infinite; }
@keyframes mbox-wiggle { 0%, 100% { transform: translateY(-8px) rotate(0); } 25% { transform: translateY(-8px) rotate(-3deg); } 75% { transform: translateY(-8px) rotate(3deg); } }
.mbox:disabled { cursor: default; }
.mbox .q { animation: mbox-q 2s ease-in-out infinite; }
@keyframes mbox-q { 50% { opacity: .55; } }

/* chọn hộp */
.mbox.selected { animation: none; transform: translateY(-14px) scale(1.07); }
.mbox.selected svg { filter: drop-shadow(0 0 26px rgba(255, 42, 61, 1)) drop-shadow(0 0 6px #fff); }
.mbox.selected .num { color: #fff; }
.mbox.selected::after {
  content: ''; position: absolute; left: 50%; bottom: -4px; width: 60%; height: 4px; transform: translateX(-50%);
  background: var(--red); box-shadow: 0 0 12px var(--red);
}
.box-row.has-pick .mbox:not(.selected) { opacity: .55; }

/* mở hộp */
.box-row.opening .mbox:not(.selected) { opacity: .15; filter: grayscale(1) blur(1px); transform: scale(.9); animation: none; }
.mbox.shaking { animation: mbox-shake .09s linear infinite !important; }
@keyframes mbox-shake { 0%, 100% { transform: translateY(-14px) rotate(-6deg) scale(1.1); } 50% { transform: translateY(-16px) rotate(6deg) scale(1.13); } }
.mbox .lid { transition: transform .7s cubic-bezier(.2, 1.4, .4, 1); transform-origin: 60px 40px; }
.mbox.open .lid { transform: translate(-8px, -34px) rotate(-20deg); }
.mbox .burst { opacity: 0; transform-origin: 60px 50px; transition: opacity .3s; }
.mbox.open .burst { opacity: 1; animation: mbox-rays 6s linear infinite; }
@keyframes mbox-rays { to { transform: rotate(360deg); } }
.mbox.open { animation: none; transform: translateY(-6px) scale(1.08); z-index: 2; }

.box-actions { margin-top: 14px; display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* lớp sáng lóa khi mở */
.box-flash { position: absolute; inset: 0; pointer-events: none; opacity: 0; background: radial-gradient(circle at 50% 55%, #fff 0, rgba(255, 210, 120, .8) 12%, rgba(255, 42, 61, .4) 35%, transparent 65%); }
.box-flash.go { animation: box-flash .9s ease-out; }
@keyframes box-flash { 0% { opacity: 0; } 20% { opacity: 1; } 100% { opacity: 0; } }

/* thẻ kết quả */
.box-result {
  position: relative; max-width: 460px; margin: 22px auto 0; padding: 24px 22px;
  background: linear-gradient(180deg, #24070d, #0c0c10); box-shadow: inset 0 0 0 1px var(--line-red), 0 0 40px rgba(255, 42, 61, .35);
  clip-path: polygon(16px 0, 100% 0, 100% calc(100% - 16px), calc(100% - 16px) 100%, 0 100%, 0 16px);
  animation: pop .45s cubic-bezier(.2, 1.4, .4, 1);
}
.box-result .r-img { width: 120px; height: 120px; object-fit: contain; filter: drop-shadow(0 0 20px rgba(255, 207, 63, .6)); }
.box-result .r-emoji { font-size: 70px; line-height: 1.1; }
.box-result h2 { font-family: var(--display); text-transform: uppercase; margin: 8px 0 2px; font-size: 26px; }
.box-result .r-prize { font-family: var(--display); font-size: 28px; font-weight: 700; color: #ffcf3f; text-shadow: 0 0 18px rgba(255, 207, 63, .6); }
.box-result p { color: var(--muted); margin: 8px 0 0; }

.box-countdown { font-family: var(--display); font-size: 22px; letter-spacing: .08em; color: #fff; }

/* danh sách quà */
.box-prizes { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.bp { position: relative; padding: 14px 8px 12px; text-align: center; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.bp .bp-ico { height: 56px; display: grid; place-items: center; font-size: 38px; }
.bp .bp-ico img { max-height: 56px; max-width: 80%; object-fit: contain; }
.bp .bp-name { font-weight: 700; margin-top: 6px; font-size: 14px; }
.bp .bp-pct { color: var(--muted); font-size: 12px; margin-top: 2px; }
.bp .tag { position: absolute; top: 6px; right: 6px; }

@media (max-width: 760px) {
  .box-row { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
  .box-row .mbox { grid-column: span 2; }
  .box-row .mbox:nth-child(4) { grid-column: 2 / span 2; }
}
@media (prefers-reduced-motion: reduce) {
  .mbox, .mbox .q, .mbox.open .burst { animation: none !important; }
}

.box-multi { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 10px; width: 100%; }
