/*
  設計稿基準：寬 720 單位。1rem = 100 設計單位（html font-size = 畫面寬 / 7.2）。
  不用更小的 rem，避免部分 Android WebView 最小字級把 rem 夾住。
*/
:root {
  --app-w: min(100vw, 540px);
  --red: #c8000b;
  --red-2: #d9363e;
  --red-text: #d0262f;
  --head: #8d1b25;
  --sub-head: #96222d;
  --ink: #222;
  --vh: 1vh;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: calc(var(--app-w) / 7.2); background: #3a0a0f; }
html, body { margin: 0; height: 100%; overscroll-behavior: none; }
body {
  font-family: "Noto Sans TC", "PingFang TC", "Heiti TC", "Microsoft JhengHei", sans-serif;
  color: var(--ink); -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
  font-size: .24rem; line-height: 1.5;
}
img { display: block; max-width: none; user-select: none; -webkit-user-drag: none; }
button { font: inherit; border: 0; padding: 0; background: none; color: inherit; cursor: pointer; }
p { margin: 0; }
[hidden] { display: none !important; }

#app {
  position: relative; width: var(--app-w); height: calc(var(--vh) * 100);
  margin: 0 auto; overflow: hidden; background: #a01a24;
}
.screen {
  position: absolute; inset: 0; display: none; overflow: hidden;
  background: #9b1f29 url(../img/bg.webp) center top / cover no-repeat;
}
.screen.on { display: block; }
.screen.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.stage { position: relative; width: 7.2rem; min-height: 100%; }
.abs { position: absolute; }
.abs-b { position: absolute; }
.btn-img { display: block; }
.btn-img img, .abs > img { width: 100%; }
.btn-img:active { transform: scale(.96); }
.hit { position: absolute; display: block; }

/* ---------- 轉場 ---------- */
#s-splash { background: #b3151f; }
#s-splash .kv { position: absolute; inset: 0; background: url(../img/kv.webp) center / cover no-repeat; }
#s-splash .kv-slogan {
  position: absolute; left: 50%; top: 32.4%; width: 6.66rem; transform: translateX(-50%);
  animation: sloganIn 1.2s ease-out both .2s;
}
@keyframes sloganIn { from { opacity: 0; transform: translateX(-50%) scale(.85); filter: blur(6px); } to { opacity: 1; transform: translateX(-50%) scale(1); filter: blur(0); } }

/* ---------- 主頁 ---------- */
#s-home .stage { height: 100%; min-height: 12.8rem; }
.home-art {
  position: relative; width: 7.2rem; height: 10.76rem;
  margin-top: max(0px, calc((var(--vh) * 100 - 12.82rem) * .3));
  -webkit-mask-image: linear-gradient(transparent, #000 1.5%, #000 92%, transparent);
  mask-image: linear-gradient(transparent, #000 1.5%, #000 92%, transparent);
}
.home-art .btn-img { -webkit-mask-image: none; }
.banner { position: absolute; left: 0; bottom: 0; width: 7.2rem; height: 2.06rem; overflow: hidden; }
.banner .slides { display: flex; height: 100%; transition: transform .6s ease; }
.banner .slides a, .banner .slides div { flex: 0 0 7.2rem; height: 100%; }
.banner img { width: 7.2rem; height: 2.06rem; }
.banner .dots { position: absolute; bottom: .1rem; left: 0; right: 0; display: flex; justify-content: center; gap: .1rem; }
.banner .dots i { width: .1rem; height: .1rem; border-radius: 50%; background: rgba(255,255,255,.5); }
.banner .dots i.on { background: #fff; }
.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.04); } }

/* ---------- 次頁共用（地圖 / 獎勵 / 辦法） ---------- */
.sub-head {
  position: sticky; top: 0; z-index: 5; height: 1.0rem; background: var(--sub-head);
}
.sub-head .btn-home { position: absolute; left: .40rem; top: .28rem; width: 1.59rem; }
.sub-head .logo, .game-head .logo { position: absolute; left: 3.02rem; top: .35rem; width: 1.16rem; }
.page { padding: .13rem 0 .9rem; display: flex; flex-direction: column; align-items: center; }
.title-img { width: 5.11rem; }
.title-my { width: 5.9rem; margin-top: .02rem; }
.card {
  width: 5.86rem; background: #fff; border-radius: .26rem;
  box-shadow: 0 .04rem 0 #7c121a, 0 .1rem .3rem rgba(80,0,0,.25);
}
.tag {
  display: inline-block; min-width: 1.32rem; padding: 0 .3rem; height: .44rem; line-height: .44rem;
  background: var(--red-2); color: #fff; font-weight: 700; font-size: .26rem; letter-spacing: .06em; text-align: center;
}
.btn-top { width: 1.71rem; margin-top: .55rem; }

/* 地圖 */
.map-list { width: 5.86rem; margin-top: .23rem; display: flex; flex-direction: column; gap: .18rem; }
.region { background: #fff; border-radius: .26rem; box-shadow: 0 .04rem 0 #7c121a, 0 .08rem .2rem rgba(80,0,0,.2); overflow: hidden; }
.region-bar {
  position: relative; width: 100%; height: .95rem; color: var(--red-2); font-weight: 700; font-size: .36rem;
  letter-spacing: .35em; text-indent: .35em; text-align: center;
}
.region-bar .icon { position: absolute; right: .28rem; top: .32rem; width: .32rem; transition: transform .25s; }
.region.open .region-bar { display: none; }
.region-body { display: none; padding: .18rem .26rem .26rem; text-align: center; }
.region.open .region-body { display: block; }
.region-body .tag { letter-spacing: .3em; text-indent: .3em; font-size: .24rem; height: .4rem; line-height: .4rem; }
.tbl { width: 100%; border-collapse: collapse; margin-top: .14rem; text-align: center; }
.tbl th { color: var(--red-2); font-weight: 500; font-size: .2rem; letter-spacing: .2em; height: .5rem; border-bottom: 2px solid var(--red-2); }
.tbl td { height: .645rem; font-size: .21rem; font-weight: 700; color: #222; border-bottom: 1px solid #efc3c6; letter-spacing: .04em; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-map td:first-child { width: 42%; }
.tbl-map td:last-child, .tbl-map th:last-child { width: 15%; }
.pin { display: inline-block; width: .36rem; vertical-align: middle; }
.pin img { width: 100%; }

/* 獎勵 */
.slots { width: 6.14rem; margin-top: .13rem; display: flex; flex-direction: column; gap: .07rem; }
.slot { position: relative; width: 6.14rem; }
.slot img { width: 100%; }
.slot .slot-name {
  position: absolute; left: 0; right: 0; top: .62rem; text-align: center;
  font-size: .44rem; font-weight: 900; color: var(--red); letter-spacing: .01em; white-space: nowrap;
}
.slot .slot-name.long { font-size: .34rem; top: .68rem; }
.title-prizes { margin-top: .22rem; }
.prize-card { margin-top: .25rem; padding: .16rem .26rem .5rem; display: flex; flex-direction: column; align-items: center; border: 2px solid #8a1c22; }
.prize-card .tag { font-size: .26rem; height: .5rem; line-height: .5rem; min-width: 1.92rem; }
.tbl-prize th { letter-spacing: .3em; }
.tbl-prize td { height: .59rem; font-size: .22rem; }
.tag-super { margin-top: .5rem; letter-spacing: .1em; }
.prize-img { display: block; }

.notes { width: 100%; padding: 0 .1rem; margin-top: .45rem; font-size: .21rem; line-height: 1.5; color: #333; text-align: left; }
.notes h3 { font-size: .22rem; margin: 0 0 .06rem; font-weight: 700; color: #222; }
.notes ol { margin: 0; padding: 0; list-style: none; }
.notes li { margin-bottom: .28rem; }
.notes li.hl { color: var(--red-text); font-weight: 700; }

/* 活動辦法 */
.rules-card { margin-top: .24rem; padding: .3rem .26rem .5rem; display: flex; flex-direction: column; align-items: center; border: 2px solid #8a1c22; }
.rules-head { width: 5.18rem; }
.rules-line { width: 100%; border: 0; border-top: 1px solid #e3b5b8; margin: .1rem 0 0; }
.rules-card .notes { margin-top: .25rem; }

/* ---------- 相機頁 ---------- */
.cam-screen { background: #000; touch-action: manipulation; }
.cam-screen .stage { height: 100%; min-height: 0; }
.cam-video, .cam-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam-shade { position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.25), transparent 25%, transparent 75%, rgba(0,0,0,.35)); pointer-events: none; }
.game-head { position: absolute; left: 0; top: 0; z-index: 3; width: 7.2rem; height: .8rem; background: var(--head); }
.game-head .logo { top: .22rem; }
.game-head.sticky { position: sticky; }
.mid {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  display: flex; justify-content: center; pointer-events: none; z-index: 2;
}
.hint { animation: hintIn .5s ease-out both; filter: drop-shadow(0 .02rem .06rem rgba(0,0,0,.5)); }
@keyframes hintIn { from { opacity: 0; transform: translateY(.2rem) scale(.95); } }
#hint-scan { animation: hintIn .5s ease-out both, breathe 2.4s ease-in-out infinite .5s; }
@keyframes breathe { 50% { opacity: .85; } }
.score { z-index: 3; }
.score-num {
  position: absolute; left: .82rem; top: .23rem; width: .9rem; text-align: right;
  font-size: .5rem; line-height: .66rem; font-weight: 900; color: var(--red-text); font-family: "Noto Sans TC", sans-serif;
}
.score.bump { animation: bump .35s; }
@keyframes bump { 40% { transform: scale(1.12); } }
.props { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
/* 透明圖層不擋按鈕，只有禮物本身可點 */
.prop { position: absolute; pointer-events: auto; transform: translate(-50%, -50%); animation: propIn .45s cubic-bezier(.2,1.6,.4,1) both; }
.prop img { width: 100%; animation: bob 2.6s ease-in-out infinite; filter: drop-shadow(0 0 .12rem rgba(255,240,170,.9)); }
.prop.got { animation: propOut .45s ease-in forwards; pointer-events: none; }
#s-scan .btn-img { z-index: 4; }
@keyframes propIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.2); } }
@keyframes propOut { 40% { transform: translate(-50%, -50%) scale(1.25); opacity: 1; } to { transform: translate(-50%, -50%) scale(.2); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(-.14rem) rotate(2deg); } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.confetti i { position: absolute; top: -.3rem; width: .14rem; height: .3rem; border-radius: .04rem; animation: fall linear forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), calc(var(--vh) * 110), 0) rotate(var(--rot)); } }

/* 拍照 */
.frame-top { position: absolute; left: 0; top: 0; width: 7.2rem; pointer-events: none; }
.frame-bottom { position: absolute; left: 0; bottom: 0; width: 7.2rem; pointer-events: none; }
.face-tip {
  position: absolute; left: 50%; top: 45%; transform: translateX(-50%); padding: .12rem .3rem; border-radius: .4rem;
  background: rgba(0,0,0,.55); color: #fff; font-size: .24rem; letter-spacing: .1em; white-space: nowrap;
}
.flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.flash.on { animation: flash .4s; }
@keyframes flash { 10% { opacity: .9; } }

/* 結尾頁 */
.result-stage { height: 16.39rem; min-height: 0; }
.result-photo { object-fit: cover; background: #b0101a; box-shadow: 0 0 0 1px rgba(255,255,255,.55); -webkit-touch-callout: default; user-select: auto; }

/* 輪盤 */
#s-wheel .stage { height: 100%; min-height: 12.8rem; }
.wheel-wrap { position: absolute; left: 0; top: .80rem; width: 7.2rem; height: 11.2rem; }
.wheel { position: absolute; left: .06rem; top: 2.46rem; width: 7.35rem; height: 8.05rem; transform: scale(.9796); transform-origin: 0 0; }
.wheel img { position: absolute; }
/* 設計提供的三層：圓盤（轉）在下、外框＋底座（中空）蓋住圓盤邊緣、蝴蝶結指針在最上 */
.wheel-disc { left: .985rem; top: .722rem; width: 5.257rem; will-change: transform; }
.wheel-base { left: .015rem; top: .2395rem; width: 7.222rem; pointer-events: none; }
.wheel-pointer { left: 1.505rem; top: -.0555rem; width: 4.225rem; pointer-events: none; }
.go { z-index: 2; }
.go.spinning { pointer-events: none; }
.twinkle { animation: twinkle 2s ease-in-out infinite; }
@keyframes twinkle { 50% { opacity: .6; transform: scale(.92); } }

/* 遮罩 / 彈窗 */
.dim { position: absolute; inset: 0; z-index: 20; background: rgba(30,0,4,.62); overflow-y: auto; animation: fadeIn .25s; }
@keyframes fadeIn { from { opacity: 0; } }
.pop-wrap { position: relative; width: 7.2rem; min-height: 100%; }
.pop { position: absolute; left: 0; top: 2.69rem; width: 7.2rem; animation: popIn .4s cubic-bezier(.2,1.4,.4,1); }
#confirm-dim .pop { top: 3.74rem; }
@keyframes popIn { from { opacity: 0; transform: scale(.8); } }
.pop-small-name {
  position: absolute; left: .6rem; right: .6rem; top: 3.06rem; text-align: center;
  font-size: .48rem; font-weight: 900; letter-spacing: .02em; color: #111; white-space: nowrap;
}
.pop-big-img { position: absolute; left: 50%; top: 2.98rem; width: 2.1rem; transform: translateX(-50%); }
.pop-big-name {
  position: absolute; left: .6rem; right: .6rem; top: 5.36rem; text-align: center;
  font-size: .44rem; line-height: 1.22; font-weight: 900; color: #111; letter-spacing: .03em;
}

/* 白卡 / 抽獎次數 */
.white-card { background: #fff; border-radius: .26rem; box-shadow: 0 .06rem .24rem rgba(80,0,0,.3); }
.draw-count { z-index: 2; }
.draw-count .n {
  position: absolute; left: .18rem; top: .27rem; width: .5rem; text-align: center;
  font-size: .56rem; line-height: .7rem; font-weight: 900; color: var(--red-text);
}
.code-body { text-align: center; }
.code-t1 { font-size: .3rem; font-weight: 700; letter-spacing: .14em; color: #222; }
.code-t2 { margin-top: .02rem; font-size: .26rem; font-weight: 700; letter-spacing: .06em; }
.code-t2 b { color: var(--red-text); font-size: .38rem; font-weight: 900; margin-left: .06rem; }
.code-box {
  display: flex; align-items: center; justify-content: center; gap: .2rem;
  width: 4.9rem; height: .96rem; margin: .16rem auto 0; border: .035rem solid var(--red-text); border-radius: .2rem;
  font-size: .46rem; font-weight: 900; letter-spacing: .04em; color: var(--red-text);
}
.code-box img { width: .3rem; }
.code-t3 { margin-top: .3rem; font-size: .23rem; line-height: 1.55; color: #333; }

/* 登記表單 */
.reg-form { padding: 0 .42rem; text-align: center; }
.reg-title { margin: 0; font-size: .36rem; font-weight: 900; letter-spacing: .14em; color: #222; }
.reg-desc { margin-top: .14rem; font-size: .19rem; line-height: 1.6; color: #777; }
.reg-prize { display: inline-block; margin-top: .14rem; padding: 0 .1rem .04rem; border-bottom: 2px solid #ccc; font-size: .21rem; color: #555; letter-spacing: .05em; }
.reg-prize b { color: var(--red-text); font-size: .29rem; font-weight: 900; margin-left: .05rem; }
.reg-label { display: block; margin-top: .2rem; text-align: left; font-size: .22rem; font-weight: 700; letter-spacing: .05em; }
.reg-label small { font-size: .18rem; font-weight: 700; }
.reg-input {
  display: block; width: 100%; height: .66rem; margin-top: .1rem; border: .035rem solid var(--red-text); border-radius: .16rem;
  background: #fff; text-align: center; font: inherit; font-size: .3rem; font-weight: 700; color: #222; outline: none;
  -webkit-appearance: none; appearance: none;
}
.reg-input::placeholder { color: #bbb; font-weight: 500; }
.reg-input.bad { background: #fff2f2; }
.reg-select-wrap { position: relative; }
.reg-select-wrap::after {
  content: ""; position: absolute; right: .22rem; top: 50%; margin-top: -.04rem; border: .12rem solid transparent;
  border-top: .16rem solid var(--red-text); border-bottom: 0; pointer-events: none;
}
.reg-select { text-align-last: center; padding: 0 .5rem; }
.reg-note { margin-top: .1rem; text-align: left; font-size: .18rem; line-height: 1.55; color: var(--red-text); }
.reg-err { min-height: .3rem; margin-top: .06rem; font-size: .2rem; color: var(--red-text); font-weight: 700; }
.form-stage { min-height: 12.8rem; height: 12.8rem; }

/* 訊息 */
.msg-dim { display: flex; align-items: center; justify-content: center; z-index: 50; }
.msg-card { width: 5.6rem; padding: .5rem .4rem .42rem; border-radius: .26rem; background: #fff; text-align: center; box-shadow: 0 .1rem .4rem rgba(0,0,0,.3); animation: popIn .35s; }
.msg-title { font-size: .32rem; font-weight: 500; color: var(--red-text); letter-spacing: .08em; }
.msg-text { margin-top: .2rem; font-size: .24rem; line-height: 1.6; color: #333; white-space: pre-line; }
.msg-btns { margin-top: .36rem; display: flex; gap: .2rem; justify-content: center; }
.msg-btns button {
  min-width: 2rem; height: .66rem; padding: 0 .3rem; border-radius: .4rem; font-size: .24rem; font-weight: 700; letter-spacing: .08em;
  background: var(--red); color: #fff;
}
.msg-btns button.ghost { background: #fff; color: var(--red); box-shadow: inset 0 0 0 .03rem var(--red); }
.toast {
  position: absolute; left: 50%; bottom: 1.6rem; z-index: 60; transform: translateX(-50%); padding: .14rem .34rem; border-radius: .4rem;
  background: rgba(0,0,0,.75); color: #fff; font-size: .24rem; white-space: nowrap; animation: fadeIn .2s;
}

/* 不在 LINE 裡打開時的提示 */
.gate { position: absolute; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: .4rem; background: rgba(30,0,4,.72); overflow-y: auto; animation: fadeIn .25s; }
.gate-card { width: 6rem; padding: .5rem .44rem .46rem; border-radius: .26rem; background: #fff; text-align: center; box-shadow: 0 .1rem .4rem rgba(0,0,0,.35); animation: popIn .35s; }
.gate-title { font-size: .36rem; font-weight: 700; color: var(--red-text); letter-spacing: .08em; }
.gate-text { margin-top: .18rem; font-size: .23rem; line-height: 1.65; color: #333; white-space: pre-line; }
.gate-btn {
  display: flex; align-items: center; justify-content: center; height: .84rem; margin: .38rem auto 0; width: 4.2rem;
  border-radius: .5rem; background: #06c755; color: #fff; font-size: .3rem; font-weight: 700; letter-spacing: .1em; text-decoration: none;
}
.gate-help { margin-top: .3rem; font-size: .21rem; line-height: 1.6; color: #666; white-space: pre-line; }
.gate-link { margin-top: .2rem; font-size: .24rem; font-weight: 700; color: var(--red-text); text-decoration: underline; text-underline-offset: .05rem; }
.gate-qr { width: 3.6rem; height: 3.6rem; margin: .3rem auto .06rem; display: flex; align-items: center; justify-content: center; font-size: .2rem; color: #888; }
.gate-qr img { width: 100%; image-rendering: pixelated; }

/* 開發用：疊 layout 比對（?debug=1） */
.debug-overlay { position: absolute; left: 0; top: 0; width: 7.2rem; z-index: 99; opacity: .45; pointer-events: none; }

@media (min-width: 541px) {
  html { background: #2a0509; }
  #app { box-shadow: 0 0 40px rgba(0,0,0,.6); }
}
