/* 節慶主題：互動效果（site-fx.js）、活動公告與後台預覽提示。主題色彩與外框由 SiteTheme::css() 內嵌輸出 */

/* ── 後台預覽提示 ── */
.wk-theme-preview {
  position: fixed; left: 50%; bottom: 12px; z-index: 10050;
  transform: translateX(-50%);
  max-width: calc(100% - 24px); padding: 6px 14px; border-radius: 999px;
  background: rgba(32, 20, 52, .9); color: #fff; font-size: 13px; line-height: 1.5;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wk-theme-preview span { opacity: .75; }
.wk-theme-preview a { margin-left: 8px; color: #ffd66b; text-decoration: underline; }

/* ── 活動公告（導覽列下方，顯示數秒後收起） ── */
.wk-announce {
  position: fixed; left: 50%; top: 60px; z-index: 1035;
  display: flex; align-items: center; gap: 6px;
  max-width: min(calc(100% - 24px), 560px); padding: 5px 5px 5px 16px; border-radius: 999px;
  background: var(--wk-primary, #279BCC); color: #fff; font-size: 14px; line-height: 1.4;
  box-shadow: 0 8px 22px rgba(40, 20, 80, .28);
  opacity: 0; transform: translate(-50%, -12px);
  transition: opacity .3s, transform .4s cubic-bezier(.2, .9, .3, 1.25);
}
.wk-announce.show { opacity: 1; transform: translate(-50%, 0); }
.wk-announce[hidden] { display: none; }
.wk-announce-text { min-width: 0; overflow: hidden; color: #fff !important; font-weight: 500; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.wk-announce-text span { margin-left: 6px; font-weight: 700; }
.wk-announce-close {
  flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .2); color: #fff; font-size: 18px; line-height: 28px; cursor: pointer;
}
.wk-announce-close:hover { background: rgba(255, 255, 255, .32); }

/* ── 圖層 ── */
.wkfx-back { position: fixed; top: 0; left: 0; z-index: -1; width: 100%; height: 100%; pointer-events: none; }
.wkfx-front { position: fixed; top: 0; left: 0; z-index: 9001; width: 100%; height: 100%; pointer-events: none; }
.wkfx-layer { position: fixed; top: 0; left: 0; z-index: 9000; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }

/* ── 飛行物 ── */
.wkfx-flyer { position: absolute; left: 0; top: 0; width: 76px; height: 52px; will-change: transform; pointer-events: auto; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.wkfx-flyer.poof { pointer-events: none; }
.wkfx-flyer svg, .wkfx-flyer img {
  display: block; width: 100%; height: 100%; object-fit: contain; overflow: visible;
  filter: drop-shadow(0 6px 8px rgba(40, 20, 60, .3));
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s;
}
.wkfx-flyer .flap-l { transform-box: fill-box; transform-origin: 100% 40%; animation: wkfxFlapL .28s ease-in-out infinite alternate; }
.wkfx-flyer .flap-r { transform-box: fill-box; transform-origin: 0% 40%; animation: wkfxFlapR .28s ease-in-out infinite alternate; }
.wkfx-flyer img { animation: wkfxFlutter .5s ease-in-out infinite alternate; }
.wkfx-flyer.poof svg, .wkfx-flyer.poof img { transform: scale(.15) rotate(40deg); opacity: 0; }

/* ── 吊飾 ── */
.wkfx-hanger {
  position: absolute; z-index: 1020; top: 0; right: 16px; width: 70px;
  transform-origin: 50% 0; pointer-events: none; will-change: transform;
}
.wkfx-hanger.is-small { width: 52px; }
.wkfx-thread {
  width: 2px; height: var(--len, 72px); margin: 0 auto;
  background: linear-gradient(rgba(255, 255, 255, .25), rgba(255, 255, 255, .95));
  box-shadow: 0 0 2px rgba(60, 30, 90, .45);
}
.wkfx-hanger-body {
  display: block; width: 70px; height: 62px; margin-top: -6px; padding: 0; border: 0;
  background: none; cursor: grab; touch-action: none; pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.wkfx-hanger.is-small .wkfx-hanger-body { width: 52px; height: 46px; }
.wkfx-hanger-body:focus-visible { outline: 2px solid #fff; outline-offset: 4px; border-radius: 12px; }
.wkfx-hanger-body.is-dragging { cursor: grabbing; }
.wkfx-hanger-body svg, .wkfx-hanger-body img {
  display: block; width: 100%; height: 100%; object-fit: contain; overflow: visible;
  filter: drop-shadow(0 8px 10px rgba(40, 20, 60, .35));
}
.wkfx-hanger-body .legs { transform-box: fill-box; transform-origin: 50% 45%; animation: wkfxLegs 1.5s ease-in-out infinite; }
.wkfx-hanger-body:hover .legs, .wkfx-hanger-body.is-dragging .legs { animation-duration: .32s; }

/* ── 對話泡泡（吊飾、探頭角色共用） ── */
.wkfx-bubble {
  position: absolute; left: 50%; top: calc(100% + 8px); z-index: 2;
  width: max-content; max-width: 180px; padding: 6px 12px; border-radius: 14px;
  background: #fff; color: #3b2a52; font-size: 13px; font-weight: 600; line-height: 1.4; text-align: center;
  box-shadow: 0 6px 16px rgba(40, 20, 80, .22);
  opacity: 0; transform: translateX(-50%) scale(.6); transform-origin: 50% 0;
  transition: opacity .2s, transform .3s cubic-bezier(.2, .9, .3, 1.4); pointer-events: none;
}
.wkfx-bubble::before {
  content: ""; position: absolute; top: -6px; left: 50%;
  border: 6px solid transparent; border-top: 0; border-bottom-color: #fff; transform: translateX(-50%);
}
.wkfx-bubble.show { opacity: 1; transform: translateX(-50%) scale(1); }
.wkfx-hanger .wkfx-bubble { left: auto; right: 0; transform: scale(.6); transform-origin: 80% 0; }
.wkfx-hanger .wkfx-bubble::before { left: auto; right: 22px; transform: none; }
.wkfx-hanger .wkfx-bubble.show { transform: scale(1); }

/* ── 探頭角色 ── */
.wkfx-peek {
  position: fixed; z-index: 9000; top: 40%; width: 84px; height: 92px; padding: 0; border: 0;
  background: none; cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: transform .55s cubic-bezier(.2, .9, .3, 1.15);
}
.wkfx-peek[hidden] { display: none; }
.wkfx-peek svg, .wkfx-peek img { display: block; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 12px rgba(60, 30, 100, .3)); }
.wkfx-peek.from-left { left: 0; transform: translateX(-110%) rotate(30deg); }
.wkfx-peek.from-right { right: 0; transform: translateX(110%) rotate(-30deg); }
.wkfx-peek.from-left.in { transform: translateX(-34%) rotate(18deg); }
.wkfx-peek.from-right.in { transform: translateX(34%) rotate(-18deg); }
.wkfx-peek.in svg, .wkfx-peek.in img { animation: wkfxPeekBob 1.4s ease-in-out infinite alternate; }
.wkfx-peek.boo svg, .wkfx-peek.boo img { animation: wkfxBoo .5s ease-out; }
.wkfx-peek .wkfx-bubble { top: -34px; }
.wkfx-peek.from-left .wkfx-bubble { left: 70%; transform: scale(.6); transform-origin: 0 100%; }
.wkfx-peek.from-right .wkfx-bubble { left: auto; right: 70%; transform: scale(.6); transform-origin: 100% 100%; }
.wkfx-peek .wkfx-bubble::before { display: none; }
.wkfx-peek.boo .wkfx-bubble { opacity: 1; transform: scale(1); }

/* ── 特效開關、糖果計數、提示 ── */
.wkfx-toggle {
  position: fixed; left: 14px; bottom: 18px; z-index: 9002;
  width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .92); box-shadow: 0 4px 12px rgba(40, 20, 80, .25);
  font-size: 18px; line-height: 40px; text-align: center; cursor: pointer;
  transition: transform .2s, opacity .2s, filter .2s;
}
.wkfx-toggle:hover { transform: scale(1.08); }
.wkfx-toggle[aria-pressed="false"] { opacity: .6; filter: grayscale(1); }
.wkfx-count {
  position: fixed; left: 60px; bottom: 25px; z-index: 9002;
  padding: 2px 10px; border-radius: 999px; background: rgba(255, 255, 255, .92);
  box-shadow: 0 3px 10px rgba(40, 20, 80, .2); color: #3b2a52; font-size: 13px; line-height: 22px;
}
.wkfx-count[hidden] { display: none; }
.wkfx-count.bump { animation: wkfxBump .45s cubic-bezier(.2, .9, .3, 1.6); }
.wkfx-toast {
  position: fixed; left: 50%; bottom: 72px; z-index: 9003;
  max-width: calc(100% - 32px); padding: 8px 16px; border-radius: 999px;
  background: rgba(32, 20, 52, .9); color: #fff; font-size: 14px; line-height: 1.4; text-align: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
  opacity: 0; transform: translate(-50%, 10px); transition: opacity .25s, transform .3s; pointer-events: none;
}
.wkfx-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── 萬聖免費抽：南瓜頭（頁面座標，跟著頁面捲動；層級比導覽列 1030 低）、任務達成提示 ── */
.wkfx-pumpkin {
  position: absolute; z-index: 1020; left: 0; top: 0; width: 72px; height: 72px; padding: 0; border: 0;
  background: none; opacity: .55; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: opacity .25s; animation: wkfxPumpkinFloat 3.2s ease-in-out infinite alternate;
}
.wkfx-pumpkin img {
  display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; user-select: none;
  filter: drop-shadow(0 6px 10px rgba(60, 30, 20, .3));
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.4);
}
.wkfx-pumpkin:hover, .wkfx-pumpkin:focus-visible { opacity: 1; }
.wkfx-pumpkin:hover img, .wkfx-pumpkin:focus-visible img { transform: scale(1.08); }
.wkfx-pumpkin:focus-visible { outline: 2px solid #f58220; outline-offset: 3px; border-radius: 16px; }
.wkfx-pumpkin.pop { opacity: 1; pointer-events: none; }
.wkfx-pumpkin.pop img { animation: wkfxPumpkinPop .45s ease-out forwards; }

.wkfx-reward {
  position: fixed; left: 50%; bottom: calc(130px + env(safe-area-inset-bottom, 0px)); z-index: 9004;
  display: flex; align-items: center; gap: 10px; box-sizing: border-box;
  width: max-content; max-width: min(420px, calc(100% - 32px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px)));
  padding: 8px 8px 8px 16px; border: 1px solid rgba(255, 204, 2, .6); border-radius: 16px;
  background: rgba(32, 20, 52, .95); color: #fff; font-size: 14px; line-height: 1.5;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .3);
  opacity: 0; transform: translate(-50%, 12px) scale(.96);
  transition: opacity .25s, transform .35s cubic-bezier(.2, .9, .3, 1.3);
}
.wkfx-reward.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.wkfx-reward[hidden] { display: none; }
.wkfx-reward-text { min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.wkfx-reward a.wkfx-reward-link, .wkfx-reward a.wkfx-reward-link:link, .wkfx-reward a.wkfx-reward-link:visited {
  flex: none; padding: 4px 12px; border-radius: 999px;
  background: #ffcc02; color: #4d3636; font-size: 13px; font-weight: 700; line-height: 1.5; text-decoration: none; white-space: nowrap;
}
.wkfx-reward a.wkfx-reward-link:hover, .wkfx-reward a.wkfx-reward-link:focus-visible { background: #ffd93d; color: #4d3636; }
.wkfx-reward a.wkfx-reward-link[hidden] { display: none; }
.wkfx-reward-close {
  flex: none; width: 28px; height: 28px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .16); color: #fff; font-size: 18px; line-height: 28px; cursor: pointer;
}
.wkfx-reward-close:hover { background: rgba(255, 255, 255, .3); }

/* 關閉特效：互動角色全部收起（開關按鈕、任務達成提示保留） */
.wkfx-off .wkfx-hanger, .wkfx-off .wkfx-peek, .wkfx-off .wkfx-layer, .wkfx-off .wkfx-count, .wkfx-off .wkfx-pumpkin { display: none !important; }

@media (max-width: 767px) {
  .wkfx-toggle { left: 10px; bottom: 14px; width: 34px; height: 34px; font-size: 15px; line-height: 34px; }
  .wkfx-count { left: 50px; bottom: 19px; font-size: 12px; }
  .wkfx-peek { width: 64px; height: 70px; }
  .wkfx-pumpkin { width: 58px; height: 58px; }
  .wkfx-reward { gap: 8px; padding: 7px 7px 7px 12px; font-size: 13px; }
  .wk-announce { font-size: 13px; }
}

@keyframes wkfxFlapL { from { transform: rotate(-24deg) scaleY(.8); } to { transform: rotate(14deg) scaleY(1.06); } }
@keyframes wkfxFlapR { from { transform: rotate(24deg) scaleY(.8); } to { transform: rotate(-14deg) scaleY(1.06); } }
@keyframes wkfxFlutter { from { transform: translateY(-3px) scaleX(1); } to { transform: translateY(3px) scaleX(.92); } }
@keyframes wkfxLegs { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.88); } }
@keyframes wkfxPeekBob { from { transform: translateY(-4px) rotate(-3deg); } to { transform: translateY(4px) rotate(3deg); } }
@keyframes wkfxBoo { 0% { transform: scale(1); } 40% { transform: scale(1.25) rotate(-8deg); } 100% { transform: scale(1); } }
@keyframes wkfxBump { 0% { transform: scale(1); } 50% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes wkfxPumpkinFloat { from { transform: translateY(-5px) rotate(-6deg); } to { transform: translateY(5px) rotate(6deg); } }
@keyframes wkfxPumpkinPop { 0% { transform: scale(1); opacity: 1; } 40% { transform: scale(1.22) rotate(-10deg); opacity: 1; } 100% { transform: scale(.2) rotate(30deg); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .wkfx-flyer .flap-l, .wkfx-flyer .flap-r, .wkfx-flyer img, .wkfx-hanger-body .legs, .wkfx-peek svg, .wkfx-peek img,
  .wkfx-pumpkin, .wkfx-pumpkin img { animation: none !important; }
  .wkfx-pumpkin.pop { opacity: 0; }
  .wkfx-pumpkin:hover img, .wkfx-pumpkin:focus-visible img { transform: none; }
}
