/* =====================================================
   脆卜寶 CBB — 額外功能樣式
   限時優惠、格仔舖、返圖牆、角色詳情、IG 分享圖、PWA
   （全部用清晰實色字＋硬邊影，唔用模糊發光）
   ===================================================== */

/* ---------- ⚡ 限時優惠橫額 ---------- */
.flash-banner {
  position: relative; z-index: 29;
  background: repeating-linear-gradient(-45deg, #c4232b 0 22px, #b31d25 22px 44px);
  border-bottom: 3px solid var(--brown); color: #fff;
}
.fb-inner {
  max-width: 1120px; margin: 0 auto; padding: .5rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem .9rem;
}
.fb-title {
  font-family: var(--font-cute); font-size: 1.15rem; color: var(--bulb);
  -webkit-text-stroke: 4px #2a1209; paint-order: stroke fill; text-shadow: 0 2px 0 #2a1209;
  animation: fbPulse 1.2s ease-in-out infinite;
}
@keyframes fbPulse { 50% { transform: scale(1.08) rotate(-2deg); } }
.fb-text { font-family: var(--font-cute); font-size: 1.05rem; color: #fff; -webkit-text-stroke: 3px #2a1209; paint-order: stroke fill; }
.fb-clock { display: inline-flex; gap: .25rem; font-weight: 700; font-size: .85rem; }
.fb-unit { display: inline-flex; align-items: baseline; gap: .1rem; }
.fb-unit b {
  display: inline-block; min-width: 2.1em; text-align: center; padding: .1em .25em;
  background: #2a1209; color: var(--bulb); border-radius: 6px; border: 2px solid var(--gold);
  font-family: var(--font-sign); font-weight: 400; font-size: 1rem; font-variant-numeric: tabular-nums;
}
.fb-btn {
  border: 3px solid var(--brown); border-radius: 999px; background: var(--bulb); color: var(--brown);
  font-weight: 900; padding: .3em 1em; box-shadow: 0 3px 0 var(--brown); font-size: .9rem;
}
.fb-btn b { font-family: var(--font-sign); font-weight: 400; color: var(--red); }
.fb-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--brown); }
@media (max-width: 560px) {
  /* 手機：限時優惠縮做一行，唔好霸住半個畫面 */
  .fb-text { display: none; }
  .fb-inner { flex-wrap: nowrap; gap: .35rem; padding: .3rem .45rem; }
  .fb-title { font-size: .92rem; -webkit-text-stroke: 3px #2a1209; white-space: nowrap; animation: none; }
  .fb-clock { gap: .12rem; font-size: .7rem; white-space: nowrap; }
  .fb-unit b { min-width: 1.75em; font-size: .78rem; padding: .05em .15em; border-width: 1.5px; }
  .fb-btn { font-size: 0; padding: .2em .55em; white-space: nowrap; flex: none; }
  .fb-btn b { font-size: .78rem; }
  .fb-btn b::before { content: "🎟️ "; }
}

/* ---------- 🏪 格仔舖 ---------- */
.booth-card {
  max-width: 820px; margin: 1.4rem auto 0; background: linear-gradient(#fffaf0, var(--paper));
  border: 4px solid var(--brown); border-radius: 26px; padding: 0 1.3rem 1.4rem; text-align: center;
  box-shadow: 0 0 0 8px var(--green), 0 0 0 11px var(--brown), 0 16px 30px rgba(74,36,20,.25);
}
.booth-sign {
  position: relative; display: inline-block; margin: -1.2rem auto 1rem; padding: .8rem 1.6rem .7rem;
  background: linear-gradient(180deg, #e3343c, var(--red)); border: 4px solid var(--brown); border-radius: 18px;
  box-shadow: 0 0 0 3px var(--gold) inset, 0 5px 0 var(--brown);
}
.booth-sign::before, .booth-sign::after {
  content: ""; position: absolute; top: -14px; width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle, var(--pink) 0 35%, #3a2216 37%); border: 2px solid #2a1209;
}
.booth-sign::before { left: 10px; } .booth-sign::after { right: 10px; }
.booth-tag { display: block; font-size: .75rem; font-weight: 900; color: var(--bulb); letter-spacing: .2em; }
.booth-name { margin: .1rem 0; font-family: var(--font-cute); font-weight: 400; font-size: clamp(1.4rem, 4vw, 2rem); color: #fff; -webkit-text-stroke: 5px #2a1209; paint-order: stroke fill; text-shadow: 0 3px 0 #2a1209; }
.booth-box { display: inline-block; background: #2a1209; color: var(--cream); border-radius: 999px; padding: .1em .8em; font-size: .85rem; }
.booth-box b { font-family: var(--font-sign); font-weight: 400; color: var(--bulb); }
.booth-info { display: grid; gap: .5rem; margin: 0 0 1rem; text-align: left; }
.booth-row { display: grid; grid-template-columns: 7.5em 1fr; gap: .6rem; background: #fff; border: 3px solid var(--brown); border-radius: 14px; padding: .55rem .8rem; }
.booth-row dt { font-weight: 900; }
.booth-row dd { margin: 0; }
@media (max-width: 480px) { .booth-row { grid-template-columns: 1fr; gap: .1rem; } }
.booth-note { font-family: var(--font-hand); font-size: 1.1rem; margin: 0 0 1rem; }
.booth-compare { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-bottom: 1.2rem; text-align: left; }
.bc-col { background: #fff; border: 3px solid var(--brown); border-radius: 16px; padding: .7rem .9rem; }
.bc-col h4 { margin: 0 0 .3rem; font-family: var(--font-cute); font-weight: 400; font-size: 1.15rem; }
.bc-col ul { margin: 0; padding-left: 1.1rem; line-height: 1.7; font-size: .92rem; }
.bc-online { background: var(--pink-soft); }
@media (max-width: 520px) { .booth-compare { grid-template-columns: 1fr; } }
.booth-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; }

.booth-welcome {
  position: fixed; left: 50%; top: 90px; z-index: 88; translate: -50% 0; width: min(420px, 92vw);
  display: flex; align-items: center; gap: .7rem; background: var(--cream); border: 4px solid var(--brown);
  border-radius: 20px; padding: .6rem .8rem; box-shadow: 0 0 0 5px var(--green), 0 12px 30px rgba(0,0,0,.25);
  animation: popIn .5s;
}
.booth-welcome img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 3px solid var(--brown); flex: none; }
.booth-welcome b { display: block; font-family: var(--font-cute); font-weight: 400; font-size: 1.15rem; color: var(--red); }
.booth-welcome span { font-size: .9rem; }
.booth-welcome button { margin-left: auto; border: 0; background: none; font-size: 1.2rem; color: var(--brown); align-self: flex-start; }
.booth-welcome.bye { opacity: 0; transform: translateY(-20px); transition: .4s; }

/* ---------- 📸 返圖牆 ---------- */
.ugc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: .9rem; }
.ugc-item {
  margin: 0; background: #fff; border: 3px solid var(--brown); border-radius: 16px; padding: .45rem .45rem .6rem;
  box-shadow: 0 4px 0 var(--brown); cursor: zoom-in; transition: transform .15s;
}
.ugc-item:nth-child(odd) { rotate: -1.5deg; } .ugc-item:nth-child(even) { rotate: 1.2deg; }
.ugc-item:hover, .ugc-item:focus-visible { transform: translateY(-4px) scale(1.03); rotate: 0deg; outline: none; }
.ugc-item img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: var(--paper); }
.ugc-item figcaption { margin-top: .35rem; font-size: .8rem; line-height: 1.3; }
.ugc-item figcaption b { display: block; font-family: var(--font-en); color: var(--red); }
.lightbox {
  position: fixed; inset: 0; z-index: 95; background: rgba(42,18,9,.85); display: grid; place-items: center; padding: 1rem;
  animation: fade .2s;
}
.lightbox figure { margin: 0; max-width: min(92vw, 720px); text-align: center; color: #fff; }
.lightbox img { max-height: 78vh; width: auto; margin: 0 auto; border-radius: 16px; border: 4px solid #fff; }
.lightbox figcaption { margin-top: .6rem; }
.lightbox > button { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; border-radius: 50%; border: 3px solid #fff; background: var(--red); color: #fff; font-size: 1.2rem; }

/* ---------- 🐼 角色詳情 ---------- */
.char-card { position: relative; max-width: 440px; padding-top: 1.2rem; }
.cm-close { position: absolute; top: 10px; right: 10px; z-index: 3; width: 38px; height: 38px; border-radius: 50%; border: 3px solid var(--brown); background: #fff; font-weight: 900; }
.cs { position: relative; overflow: hidden; border-radius: 20px; border: 3px solid var(--brown); background: radial-gradient(circle at 50% 40%, #fff, var(--paper)); touch-action: pan-y; }
.cs-track { display: flex; transition: transform .35s cubic-bezier(.3,1.2,.5,1); }
.cs-slide { flex: 0 0 100%; aspect-ratio: 1; display: grid; place-items: center; position: relative; }
.cs-slide img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }
.cs-3d img { width: 82%; height: 82%; object-fit: contain; }
.cs-3d .emoji { font-size: 7rem; }
.cs-note { position: absolute; bottom: 8px; left: 50%; translate: -50% 0; font-size: .72rem; background: rgba(255,255,255,.85); border: 2px solid var(--brown); border-radius: 99px; padding: .1em .7em; white-space: nowrap; }
.cs-arrow { position: absolute; top: 50%; translate: 0 -50%; width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--brown); background: #fff; font-size: 1.6rem; line-height: 1; font-weight: 900; color: var(--brown); box-shadow: 0 3px 0 var(--brown); }
.cs-arrow.prev { left: 8px; } .cs-arrow.next { right: 8px; }
.cs-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.cs-dots button { width: 10px; height: 10px; padding: 0; border-radius: 50%; border: 2px solid var(--brown); background: #fff; }
.cs-dots button.on { background: var(--red); width: 22px; border-radius: 6px; }
.cm-name { margin: .8rem 0 .3rem; font-size: 1.8rem; }
.cm-badges { display: flex; justify-content: center; gap: .4rem; flex-wrap: wrap; }
.cbadge { border: 2.5px solid var(--brown); border-radius: 999px; padding: .1em .75em; font-weight: 900; font-size: .85rem; background: #fff; }
.cbadge.in { background: #dff3e7; } .cbadge.low { background: var(--bulb); }
.cbadge.out { background: #777; color: #fff; } .cbadge.qty { background: var(--red); color: #fff; }
.cbadge.ltd { background: #2a1209; color: var(--bulb); }
.cm-desc { margin: .7rem 0 .2rem; line-height: 1.7; }
.cm-video { width: 100%; margin-top: .7rem; border-radius: 16px; border: 3px solid var(--brown); background: #000; }
.dex-card[data-char] { cursor: pointer; }
.dex-card[data-char]:hover .dex-pic, .dex-card[data-char]:focus-visible .dex-pic { transform: translateY(-4px) rotate(-3deg); }
.dex-card[data-char]:focus-visible { outline: none; }

/* 售罄晶片（app.js：.chip.sold，撳一下登記到貨通知） */
.chip.sold { background: repeating-linear-gradient(-45deg, #eee 0 6px, #e2e2e2 6px 12px); color: #777; }
.chip.sold:hover { background: var(--bulb); color: var(--brown); }

/* ---------- 📤 IG 分享圖 ---------- */
.share-card { max-width: 420px; }
.share-title { margin: 0 0 .6rem; font-size: 1.6rem; }
.share-preview { display: block; margin: 0 auto; width: auto; max-width: 100%; max-height: min(56vh, 520px); border-radius: 16px; border: 3px solid var(--brown); box-shadow: 0 6px 0 var(--brown); }
.share-tip { margin: .9rem 0 .3rem; font-size: .9rem; line-height: 1.6; }
.share-loading { display: grid; place-items: center; gap: .6rem; padding: 3rem 0; font-weight: 700; }
.share-spin { width: 48px; height: 48px; border-radius: 50%; border: 6px solid var(--paper); border-top-color: var(--red); animation: spin .8s linear infinite; }
.share-card a.btn { text-align: center; }

/* ---------- 📲 加到主畫面 ---------- */
.install-pill {
  position: fixed; left: 50%; bottom: calc(5.2rem + env(safe-area-inset-bottom)); z-index: 26; translate: -50% 0;
  display: flex; align-items: center; background: #fff; border: 3px solid var(--brown); border-radius: 999px;
  box-shadow: 0 4px 0 var(--brown), 0 10px 24px rgba(0,0,0,.2); animation: slideUp .4s; white-space: nowrap;
}
.install-pill .ip-add { border: 0; background: none; padding: .55em .4em .55em 1.1em; font-weight: 900; color: var(--brown); }
.install-pill .ip-x { border: 0; background: none; padding: .55em 1em .55em .4em; color: #999; font-weight: 900; }

@media (prefers-reduced-motion: reduce) {
  .fb-title, .booth-welcome, .install-pill { animation: none; }
  .cs-track { transition: none; }
}
