/* ============ 守護神.台灣 — 廟宇夜色 × 金光 ============ */
:root {
  --bg: #120c07;
  --wood: #2a1a10;
  --wood-dark: #1a120b;
  --gold: #d4a94e;
  --gold-bright: #f0c96c;
  --red: #9c3434;
  --red-deep: #6e1f1f;
  --cream: #f3e7d3;
  --dim: #b7a893;
  --shadow: rgba(0, 0, 0, .55);
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 17px; }   /* font1 base */
body {
  background: var(--bg);
  color: var(--cream);
  font-family: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
}
h1, h2, h3, .serif { font-family: 'Noto Serif TC', serif; }
a { color: var(--gold-bright); text-decoration: none; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }

.btn {
  display: inline-block; border: none; border-radius: 999px;
  padding: .8rem 2.1rem; font-size: 1rem; font-weight: 700; letter-spacing: .12em;
  background: linear-gradient(160deg, var(--gold-bright), var(--gold) 55%, #a87f2f);
  color: #241505; box-shadow: 0 4px 18px rgba(212, 169, 78, .35);
  transition: transform .15s, box-shadow .15s;
}
.btn:active { transform: scale(.96); }
.btn-with-icon { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.btn-icon-img {
  width: 1.55em; height: 1.55em; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
  box-shadow: 0 1px 4px rgba(36, 21, 5, .32);
}
#drawBtn.btn-with-icon {
  min-height: 60px; padding: .9rem 2.25rem; font-size: 1.1rem;
}
#drawBtn .btn-icon-img { width: 1.8em; height: 1.8em; }
.btn-ghost {
  background: transparent; color: var(--gold);
  border: 1px solid rgba(212, 169, 78, .55); box-shadow: none;
}
.btn[disabled] { opacity: .45; pointer-events: none; }

/* ============ 神殿：兩牆合頁轉角（仿 Codrops 1.html，連續無限）
   靜止＝當前牆平面顯示（可點）；轉動時 JS 加 .turning 開 preserve-3d 做轉角 3D。 ============ */
.stage {
  position: fixed; inset: 0;
  overflow: hidden; touch-action: pan-y;
  perspective: 1200px; perspective-origin: 50% 42%;
}
.room {
  position: absolute; inset: 0;
  --H: 100vh; --H: 100lvh;   /* 牆高＝最大視口：iOS 網址列收合也不露黑底 */
}
.room.turning { transform-style: preserve-3d; }   /* 轉動中才 3D（preserve-3d 會擋點擊，靜止不開） */
.wall {
  position: absolute; left: 0; top: 0;
  width: 100vw; height: 100vh; height: 100lvh;
  background:
    linear-gradient(rgba(14, 8, 4, .72), rgba(14, 8, 4, .78)),
    url('/assets/textures/wall.jpg');
  background-size: cover;
  backface-visibility: hidden;
  display: none;
}
.wall.active, .wall.aux { display: block; }   /* 只顯示當前牆＋轉動中的來牆 */
.wall-scroll {
  position: absolute; inset: 0;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;   /* 子元素 margin:auto 安全置中；內容過高時整面牆自然垂直捲動 */
}
.wall::after { /* 邊角暗角 */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 18vmin 4vmin rgba(0, 0, 0, .75);
}
.wall-n { --i: 0; }
.wall-e { --i: 1; }
.wall-s { --i: 2; }
.wall-w { --i: 3; }
.floor, .ceilglow { display: none; }   /* 3D 房間地板/頂光已不適用平面輪播 */
.floor-x { display: none; }
.floor {
  position: absolute; left: 50%; top: 50%;
  width: calc(var(--R) * 2.02); height: calc(var(--R) * 2.02);
  margin-left: calc(var(--R) * -1.01); margin-top: calc(var(--R) * -1.01);
  transform: rotateX(90deg) translateZ(calc(var(--H) / -2));
  background:
    radial-gradient(circle, rgba(30, 18, 8, .35), rgba(8, 4, 2, .92) 75%),
    url('/assets/textures/floor.jpg');
  background-size: 34% auto;
}
.ceilglow {
  position: absolute; left: 50%; top: 50%;
  width: calc(var(--R) * 2.02); height: calc(var(--R) * 2.02);
  margin-left: calc(var(--R) * -1.01); margin-top: calc(var(--R) * -1.01);
  transform: rotateX(-90deg) translateZ(calc(var(--H) / -2));
  background: radial-gradient(circle, rgba(240, 201, 108, .16), rgba(10, 5, 2, .95) 70%);
}

/* 外殿北面：正殿入口與牆面摘要 */
.outer-north-portal {
  position: relative; z-index: 1; width: min(calc(100% - 2rem), 680px); margin: auto;
  padding: calc(108px + env(safe-area-inset-top)) 1rem calc(120px + env(safe-area-inset-bottom));
  text-align: center;
}
.outer-north-portal::before {
  content: ''; position: absolute; z-index: -1; inset: calc(92px + env(safe-area-inset-top)) 0 calc(104px + env(safe-area-inset-bottom));
  border: 1px solid rgba(212, 169, 78, .34); border-radius: 24px;
  background: radial-gradient(circle at 50% 20%, rgba(212, 169, 78, .13), rgba(20, 12, 6, .72) 66%);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .42), inset 0 0 38px rgba(0, 0, 0, .3);
}
.outer-north-kicker, .inner-wall-kicker {
  color: var(--gold); font-size: .82rem; letter-spacing: .24em; font-weight: 700;
}
.outer-north-portal h1 {
  margin-top: .45rem; color: var(--gold-bright); font-family: 'Noto Serif TC', serif;
  font-size: clamp(1.55rem, 6vw, 2.35rem); line-height: 1.35; letter-spacing: .08em;
  text-shadow: 0 0 26px rgba(240, 201, 108, .24);
}
.outer-north-guardian {
  width: fit-content; max-width: 100%; margin: .8rem auto 0; padding: .5rem .75rem .5rem .5rem;
  display: inline-flex; align-items: center; gap: .75rem; border: 1px solid rgba(212, 169, 78, .34); border-radius: 14px;
  background: rgba(20, 12, 6, .64); box-shadow: 0 8px 26px rgba(0, 0, 0, .32), inset 0 0 18px rgba(212, 169, 78, .06);
}
.outer-north-guardian-frame {
  display: block; padding: 4px; border: 1px solid var(--gold); border-radius: 6px 6px 2px 2px;
  background: rgba(42, 24, 10, .72); box-shadow: 0 0 18px rgba(240, 201, 108, .15);
}
.outer-north-guardian-frame img {
  display: block; width: clamp(52px, 7vw, 72px); aspect-ratio: 3 / 4; object-fit: cover; border-radius: 3px 3px 1px 1px;
}
.outer-north-guardian-copy { min-width: 6.8rem; display: grid; text-align: left; }
.outer-north-guardian-copy small { color: var(--dim); font-size: .68rem; letter-spacing: .16em; }
.outer-north-guardian-copy strong {
  margin-top: .12rem; color: var(--gold-bright); font-family: 'Noto Serif TC', serif; font-size: 1.12rem; letter-spacing: .12em;
}
.outer-north-guardian-copy em { margin-top: .12rem; color: var(--gold); font-size: .72rem; font-style: normal; letter-spacing: .12em; }
.outer-north-copy { margin-top: .55rem; color: var(--cream); font-size: 1rem; }
.outer-north-summary {
  display: flex; justify-content: center; flex-wrap: wrap; gap: .45rem; margin: 1.2rem auto;
  max-width: 560px; max-height: 24vh; overflow-y: auto; overscroll-behavior: contain;
}
.outer-north-summary span {
  padding: .32rem .65rem; border: 1px solid rgba(212, 169, 78, .34); border-radius: 999px;
  background: rgba(20, 12, 6, .58); color: var(--cream); font-size: .8rem; line-height: 1.4;
}
.outer-north-enter { min-width: min(88%, 300px); min-height: 58px; }
.outer-north-enter[disabled] { cursor: not-allowed; opacity: .68; }
.outer-north-hint { margin-top: .7rem; color: var(--dim); font-size: .78rem; }

/* 參拜內殿：動態牆面只重綁一份神龕與供桌 */
.inner-hall[hidden] { display: none; }
.inner-hall {
  position: fixed; z-index: 22; inset: 0; overflow: hidden;
  perspective: 1200px;
  background:
    radial-gradient(circle at 50% 17%, rgba(212, 169, 78, .16), transparent 36%),
    linear-gradient(rgba(14, 8, 4, .72), rgba(14, 8, 4, .82)),
    url('/assets/textures/wall.jpg');
  background-size: auto, auto, cover;
}
.inner-hall::before {
  content: ''; position: absolute; z-index: 24; inset: 0; opacity: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(255, 231, 150, .32), rgba(143, 91, 27, .14) 28%, transparent 58%),
    linear-gradient(90deg, rgba(8, 4, 2, .86), rgba(28, 16, 7, .72) 35%, rgba(74, 45, 14, .48) 50%, rgba(28, 16, 7, .72) 65%, rgba(8, 4, 2, .86));
}
body.inner-hall-mode .stage { visibility: hidden; pointer-events: none; }
body.inner-hall-mode .wall-nav { display: none; }
body.inner-hall-mode .hud-icon { visibility: hidden; pointer-events: none; }
.inner-hall-stage {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; touch-action: pan-y;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: inherit; background-size: inherit;
  transform: translate3d(0, 0, 0) rotateY(0deg); transform-origin: 50% 42%;
  transform-style: preserve-3d; backface-visibility: hidden;
  opacity: 1; will-change: transform;
  transition: transform 360ms ease-in-out;
  view-transition-name: inner-shrine-wall;
}
.inner-hall.is-turning .inner-hall-stage { pointer-events: none; }
.inner-hall.turning-out[data-turn-direction="next"] .inner-hall-stage {
  transform-origin: 100% 50%;
  transform: translate3d(-100vw, 0, 0) rotateY(90deg);
}
.inner-hall.turning-out[data-turn-direction="prev"] .inner-hall-stage {
  transform-origin: 0% 50%;
  transform: translate3d(100vw, 0, 0) rotateY(-90deg);
}
.inner-hall.turning-enter .inner-hall-stage { transition: none; }
.inner-hall.turning-enter[data-turn-direction="next"] .inner-hall-stage {
  transform-origin: 0% 50%;
  transform: translate3d(100vw, 0, 0) rotateY(-90deg);
}
.inner-hall.turning-enter[data-turn-direction="prev"] .inner-hall-stage {
  transform-origin: 100% 50%;
  transform: translate3d(-100vw, 0, 0) rotateY(90deg);
}
.inner-hall.turning-settle[data-turn-direction="next"] .inner-hall-stage { transform-origin: 0% 50%; }
.inner-hall.turning-settle[data-turn-direction="prev"] .inner-hall-stage { transform-origin: 100% 50%; }
.inner-hall.turning-settle .inner-hall-stage {
  transform: translate3d(0, 0, 0) rotateY(0deg); opacity: 1;
  transition: transform 360ms ease-in-out;
}
.inner-hall.is-turning .inner-wall-nav { opacity: .42; pointer-events: none; }

/* 支援 View Transition 的瀏覽器：保留新舊神牆快照，完整沿用外殿雙牆 90° 合頁幾何。 */
::view-transition-old(root),
::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
::view-transition-group(inner-shrine-wall) {
  animation: none; perspective: 1200px; transform-style: preserve-3d;
}
::view-transition-image-pair(inner-shrine-wall) {
  isolation: isolate; perspective: 1200px; transform-style: preserve-3d;
}
::view-transition-old(inner-shrine-wall),
::view-transition-new(inner-shrine-wall) {
  animation-duration: var(--inner-hinge-duration, 720ms);
  animation-timing-function: ease-in-out;
  animation-fill-mode: both;
  backface-visibility: hidden;
  mix-blend-mode: normal;
}
html[data-inner-turn-direction="next"]::view-transition-old(inner-shrine-wall) {
  transform-origin: 100% 50%; animation-name: inner-hinge-old-next;
}
html[data-inner-turn-direction="next"]::view-transition-new(inner-shrine-wall) {
  transform-origin: 0% 50%; animation-name: inner-hinge-new-next;
}
html[data-inner-turn-direction="prev"]::view-transition-old(inner-shrine-wall) {
  transform-origin: 0% 50%; animation-name: inner-hinge-old-prev;
}
html[data-inner-turn-direction="prev"]::view-transition-new(inner-shrine-wall) {
  transform-origin: 100% 50%; animation-name: inner-hinge-new-prev;
}
@keyframes inner-hinge-old-next {
  from { transform: translate3d(0, 0, 0) rotateY(0deg); }
  to { transform: translate3d(-100vw, 0, 0) rotateY(90deg); }
}
@keyframes inner-hinge-new-next {
  from { transform: translate3d(100vw, 0, 0) rotateY(-90deg); }
  to { transform: translate3d(0, 0, 0) rotateY(0deg); }
}
@keyframes inner-hinge-old-prev {
  from { transform: translate3d(0, 0, 0) rotateY(0deg); }
  to { transform: translate3d(100vw, 0, 0) rotateY(-90deg); }
}
@keyframes inner-hinge-new-prev {
  from { transform: translate3d(-100vw, 0, 0) rotateY(90deg); }
  to { transform: translate3d(0, 0, 0) rotateY(0deg); }
}
.inner-deity-mount { min-height: 100%; display: flex; }
.inner-deity-mount[hidden], .inner-light-stage[hidden] { display: none !important; }
.inner-deity-mount .altar { margin: auto; }
.inner-deity-mount .altar-row { grid-template-columns: auto; }
.inner-deity-mount .altar-side[hidden] { display: none; }
.inner-hall-back {
  position: fixed; z-index: 33; top: calc(.72rem + env(safe-area-inset-top)); left: max(.65rem, env(safe-area-inset-left));
  min-height: 44px; padding: .45rem .8rem; border: 1px solid rgba(212, 169, 78, .55); border-radius: 999px;
  background: rgba(20, 12, 6, .88); color: var(--gold-bright); font-size: .82rem; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
}
.inner-light-stage {
  width: min(calc(100% - 2rem), 600px); min-height: min(68vh, 610px); margin: auto;
  padding: calc(132px + env(safe-area-inset-top)) 1.3rem calc(130px + env(safe-area-inset-bottom));
  text-align: center;
}
.inner-light-aura {
  width: min(46vw, 210px); aspect-ratio: 1; margin: 0 auto 1.1rem; display: grid; place-items: center;
  border: 2px solid var(--gold); border-radius: 50%; color: var(--gold-bright);
  background: radial-gradient(circle, rgba(255, 231, 145, .36), rgba(212, 169, 78, .1) 45%, transparent 68%);
  font-family: 'Noto Serif TC', serif; font-size: clamp(2.4rem, 14vw, 5rem); font-weight: 900;
  box-shadow: 0 0 55px rgba(240, 201, 108, .24), inset 0 0 34px rgba(240, 201, 108, .16);
}
.inner-light-stage h2 {
  margin-top: .35rem; color: var(--gold-bright); font-family: 'Noto Serif TC', serif;
  font-size: clamp(1.6rem, 6vw, 2.1rem); letter-spacing: .16em;
}
.inner-light-stage > p:not(.inner-wall-kicker) { margin-top: .8rem; color: var(--cream); line-height: 1.8; }
.inner-light-stage .inner-light-note { color: var(--dim); font-size: .8rem; }
.inner-wall-position {
  position: fixed; z-index: 25; left: 50%; bottom: calc(1.1rem + env(safe-area-inset-bottom));
  transform: translateX(-50%); max-width: calc(100vw - 10rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--dim); font-size: .72rem; letter-spacing: .06em; pointer-events: none;
}
.inner-wall-nav {
  position: fixed; z-index: 27; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(212, 169, 78, .45);
  background: rgba(20, 12, 6, .72); color: var(--gold); font-size: 1.25rem;
}
.inner-wall-nav.prev { left: max(.6rem, env(safe-area-inset-left)); }
.inner-wall-nav.next { right: max(.6rem, env(safe-area-inset-right)); }

/* 雙地圖：外殿為羅盤，內殿為可跳轉的牆面序列 */
.shrine-map {
  position: fixed; z-index: 36; right: max(.65rem, env(safe-area-inset-right));
  bottom: calc(1.65rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: .45rem;
}
.shrine-map-toggle {
  order: 2; min-height: 44px; padding: .45rem .72rem; display: inline-flex; align-items: center; gap: .38rem;
  border: 1px solid rgba(212, 169, 78, .55); border-radius: 999px;
  background: rgba(20, 12, 6, .9); color: var(--gold-bright); font-size: .76rem; font-weight: 700;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4);
}
.shrine-map-toggle > span:first-child { font-size: 1.05rem; line-height: 1; }
#shrineMapToggleText { max-width: min(42vw, 170px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shrine-map-mini-compass {
  position: relative; display: block; width: 34px; height: 34px; flex: 0 0 34px;
  border: 1px solid rgba(212, 169, 78, .35); border-radius: 50%;
}
.shrine-map-mini-compass i { position: absolute; color: var(--dim); font-size: .5rem; font-style: normal; line-height: 1; }
.shrine-map-mini-compass i.is-current { color: var(--gold-bright); font-weight: 900; text-shadow: 0 0 6px rgba(240, 201, 108, .55); }
.shrine-map-mini-compass .north { top: 3px; left: 50%; transform: translateX(-50%); }
.shrine-map-mini-compass .east { top: 50%; right: 3px; transform: translateY(-50%); }
.shrine-map-mini-compass .south { bottom: 3px; left: 50%; transform: translateX(-50%); }
.shrine-map-mini-compass .west { top: 50%; left: 3px; transform: translateY(-50%); }
.shrine-map-mini-inner {
  min-width: 34px; height: 34px; padding: 0 .35rem; display: grid; place-items: center; flex: 0 0 auto;
  border: 1px solid rgba(212, 169, 78, .35); border-radius: 999px; color: var(--gold-bright); font-size: .65rem;
}
.shrine-map-mini-inner[hidden], .shrine-map-mini-compass[hidden] { display: none; }
.shrine-map-panel {
  order: 1; width: min(calc(100vw - 1.3rem), 350px); padding: .85rem;
  border: 1px solid rgba(212, 169, 78, .45); border-radius: 17px;
  background: rgba(18, 10, 5, .96); box-shadow: 0 16px 42px rgba(0, 0, 0, .6);
  backdrop-filter: blur(12px);
}
.shrine-map-title { color: var(--gold-bright); font-size: .82rem; font-weight: 700; letter-spacing: .15em; }
.outer-compass {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(3, minmax(54px, auto));
  align-items: stretch; gap: .3rem; margin-top: .55rem;
}
.outer-map-point {
  min-width: 0; padding: .3rem; border: 1px solid rgba(212, 169, 78, .23); border-radius: 10px;
  background: rgba(255, 255, 255, .035); color: var(--dim); line-height: 1.25;
}
.outer-map-point b { display: block; color: var(--gold); font-size: .86rem; }
.outer-map-point span { display: block; margin-top: .08rem; font-size: .68rem; }
.outer-map-point[aria-pressed="true"] {
  border-color: var(--gold-bright); background: rgba(212, 169, 78, .16); color: var(--cream);
  box-shadow: inset 0 0 14px rgba(212, 169, 78, .08);
}
.outer-map-point.north { grid-area: 1 / 2; }
.outer-map-point.east { grid-area: 2 / 3; }
.outer-map-point.south { grid-area: 3 / 2; }
.outer-map-point.west { grid-area: 2 / 1; }
.outer-compass-center {
  grid-area: 2 / 2; align-self: center; justify-self: center; width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid rgba(212, 169, 78, .35); border-radius: 50%; color: var(--gold); font-family: 'Noto Serif TC', serif;
}
.inner-map-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.inner-map-head > span { color: var(--dim); font-size: .65rem; }
.inner-map-list {
  max-height: min(52svh, 460px); margin-top: .55rem; overflow-y: auto; overscroll-behavior: contain;
  display: grid; gap: .35rem; list-style: none;
}
.inner-map-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .3rem;
  border: 1px solid rgba(212, 169, 78, .2); border-radius: 11px; background: rgba(255, 255, 255, .025);
}
.inner-map-item.is-current { border-color: var(--gold-bright); background: rgba(212, 169, 78, .12); }
.inner-map-item.is-primary { border-style: double; }
.inner-map-item.is-dragging { opacity: .45; }
.inner-map-jump {
  min-width: 0; min-height: 44px; padding: .42rem .5rem; display: flex; align-items: center; gap: .45rem;
  border: 0; background: transparent; color: var(--cream); text-align: left;
}
.inner-map-jump > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .78rem; }
.inner-map-icon {
  width: 28px; height: 28px; flex: 0 0 28px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(212, 169, 78, .13); color: var(--gold-bright); font-size: .7rem; font-weight: 900;
}
.inner-map-order-actions { display: flex; gap: .2rem; padding-right: .35rem; }
.inner-map-order-actions button {
  width: 34px; height: 34px; border: 1px solid rgba(212, 169, 78, .28); border-radius: 8px;
  background: rgba(20, 12, 6, .74); color: var(--gold); font-size: .85rem;
}
.inner-map-order-actions button[disabled] { opacity: .28; }
.inner-map-status { min-height: 1.2rem; margin-top: .45rem; color: var(--dim); font-size: .68rem; line-height: 1.5; }
.inner-map-status.is-error { color: #f0a3a3; }
.shrine-map button:focus-visible, .inner-hall button:focus-visible {
  outline: 2px solid var(--gold-bright); outline-offset: 2px;
}

/* 主牆：神龕 */
.altar { text-align: center; transform: translateZ(1px); margin: auto;
  padding: calc(104px + env(safe-area-inset-top)) 1rem calc(128px + env(safe-area-inset-bottom));
  max-width: 96%; width: 100%;
  display: flex; flex-direction: column; align-items: center; }  /* flex column：矮屏可用 order 重排，確保 CTA 在首屏 */
.altar > * { width: 100%; }
.altar .altar-row, .altar .cta-row, .altar .wall-dots.flow { width: auto; }

/* 三欄格線：兩側 1fr、主神 auto → 主神永遠正中央，側欄內容不推擠 */
.altar-row {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: end; gap: min(2.6vw, 20px); width: 100%;
}
.altar-side { display: flex; align-items: flex-end; gap: min(2.6vw, 16px); }
.altar-side.left  { justify-self: end; }
.altar-side.right { justify-self: start; }
.flank { flex: 0 0 auto; }
.flank-frame {
  padding: 6px; border: 2px solid var(--gold); border-radius: 6px 6px 0 0;
  background: linear-gradient(rgba(42, 24, 10, .6), rgba(42, 24, 10, .6)), url('/assets/textures/frame.jpg');
  background-size: cover;
  box-shadow: 0 6px 22px var(--shadow), 0 0 26px rgba(240, 201, 108, .14);
}
.flank-frame img {
  display: block; width: min(21vw, 128px); width: min(21vw, 128px, 11svh); aspect-ratio: 3 / 4;
  object-fit: cover; border-radius: 3px 3px 0 0;
}
.flank-name {
  margin-top: .4rem; font-family: 'Noto Serif TC', serif; font-weight: 700;
  font-size: .95rem; letter-spacing: .18em; color: var(--gold);
}
/* 候駕中：神位未解鎖 */
.flank.pending .flank-frame { position: relative; }
.flank.pending .flank-frame img { filter: grayscale(1) brightness(.42); }
.flank.pending .flank-frame::after {
  content: '🔒'; position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; text-shadow: 0 2px 8px #000;
}
.flank.pending .flank-name { color: var(--dim); }
/* 主神尺寸＝高度預算公式：可視高 − 固定內容(header+名號+匾+圓點+CTA≈402px) 的 3/4 寬
   任何機型、工具列開合，參拜鈕都保證在第一屏 */
.altar-row .deity-frame img { width: min(70vw, 340px); }
.altar-row .deity-frame img { width: clamp(150px, min(70vw, calc((100svh - 560px) * .75)), 340px); }
.altar-row:has(.flank) .deity-frame img { width: min(40vw, 260px); }
.altar-row:has(.flank) .deity-frame img { width: clamp(110px, min(40vw, calc((100svh - 560px) * .58)), 260px); }

/* 名號金字＋兩側金線（可點看介紹） */
.deity-name {
  background: none; border: none; cursor: pointer;
  margin-top: .8rem; display: flex; align-items: center; justify-content: center; gap: 1rem;
  font-family: 'Noto Serif TC', serif; font-size: 2rem; font-weight: 900;
  letter-spacing: .3em; color: var(--gold-bright);
  text-shadow: 0 0 26px rgba(240, 201, 108, .35);
}
.deity-name::before, .deity-name::after {
  content: ''; width: 44px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.deity-name::after { background: linear-gradient(90deg, var(--gold), transparent); }

/* 祈願橫匾（金標紅匾） */
.wish-banner {
  cursor: pointer;
  position: relative; margin: 1rem auto 0; max-width: min(86vw, 520px);
  padding: 1.15rem 1.4rem .85rem; border: 2px solid var(--gold); border-radius: 14px;
  background:
    linear-gradient(rgba(126, 42, 42, .92), rgba(90, 28, 28, .95)),
    url('/assets/textures/damask.jpg');
  background-size: 260px;
  font-family: 'Noto Serif TC', serif; font-size: 1.3rem; font-weight: 900;
  letter-spacing: .14em; color: var(--gold-bright); text-align: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
  box-shadow: 0 10px 34px var(--shadow), 0 0 26px rgba(240, 201, 108, .12);
}
.wish-banner .more {
  margin-left: .5rem; color: rgba(240, 201, 108, .7); font-family: 'Noto Sans TC', sans-serif; font-weight: 400;
}
.wish-banner .wish-label {
  position: absolute; top: -15px; left: 50%; transform: translateX(-50%);
  padding: .12rem 1.1rem; border-radius: 999px;
  background: linear-gradient(160deg, var(--gold-bright), var(--gold));
  color: #241505; font-size: .85rem; font-weight: 700; letter-spacing: .3em;
  font-family: 'Noto Sans TC', sans-serif; box-shadow: 0 3px 10px rgba(0, 0, 0, .45);
}

/* 矮視窗緊湊模式（瀏覽器列吃高度的實機） */
@media (max-height: 700px) {
  .altar { padding-top: calc(92px + env(safe-area-inset-top)); }
  .deity-name { font-size: 1.6rem; margin-top: .4rem; }
  .altar-sub { margin-top: .2rem; }
  .wish-banner { margin-top: .7rem; padding: .8rem 1rem .6rem; font-size: 1.15rem; }
  .altar .wall-dots.flow { margin: .7rem 0 .5rem; }
}

/* 祥雲裝飾 */
.cloud { position: absolute; width: 110px; color: var(--gold); opacity: .14; pointer-events: none; }
.cloud.c1 { left: 6%; top: 16%; }
.cloud.c2 { right: 5%; top: 42%; transform: scaleX(-1) scale(.8); }

/* 祈願牌：直式木牌掛在側欄（不佔主神置中） */
.wish-plaque {
  align-self: center; flex: 0 0 auto;
  writing-mode: vertical-rl; text-orientation: upright;
  max-height: min(46vw, 300px); overflow: hidden;
  padding: 1rem .5rem; border: 2px solid var(--gold); border-radius: 8px;
  background: linear-gradient(160deg, var(--red), var(--red-deep));
  font-family: 'Noto Serif TC', serif; font-weight: 900;
  font-size: 1rem; letter-spacing: .3em; color: var(--gold-bright);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
  box-shadow: 0 6px 22px var(--shadow), 0 0 20px rgba(240, 201, 108, .12);
}
@media (max-width: 400px) { .wish-plaque { font-size: .95rem; padding: .8rem .4rem; } }
.deity-frame {
  position: relative; display: inline-block;
  padding: 12px; border-radius: 8px 8px 0 0;
  background:
    linear-gradient(rgba(42, 24, 10, .55), rgba(42, 24, 10, .55)),
    url('/assets/textures/frame.jpg');
  background-size: cover;
  border: 3px solid var(--gold);
  box-shadow:
    0 0 0 1px #5c431c, 0 10px 40px var(--shadow),
    0 0 55px rgba(240, 201, 108, .22);
}
.deity-frame img {
  display: block; width: min(46vw, 300px); aspect-ratio: 3 / 4;
  object-fit: cover; border-radius: 4px 4px 0 0;
}
.deity-halo {
  position: absolute; inset: -18%; z-index: -1; pointer-events: none;
  background: radial-gradient(circle, rgba(240, 201, 108, .30), transparent 62%);
  animation: halo 5s ease-in-out infinite;
}
@keyframes halo { 50% { opacity: .55; transform: scale(1.06); } }
.altar-plaque {
  display: inline-block; margin-top: .9rem; padding: .35rem 1.4rem;
  background: linear-gradient(160deg, var(--red), var(--red-deep));
  border: 1.5px solid var(--gold); border-radius: 6px;
  font-family: 'Noto Serif TC', serif; font-size: 1.25rem; font-weight: 900;
  letter-spacing: .3em; color: var(--gold-bright);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .6);
}
.altar-sub { margin-top: .45rem; color: var(--dim); font-size: .95rem; letter-spacing: .18em; }

/* 3D 供桌：載入成功前保留可用的 2D 供品層 */
.offering-table-scene {
  position: relative; width: min(100%, 560px); max-width: 560px;
  aspect-ratio: 16 / 7; min-height: 210px; margin: .65rem auto .25rem;
  overflow: hidden; border-radius: 18px;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(ellipse at 50% 62%, rgba(240, 201, 108, .20), rgba(82, 43, 16, .12) 48%, transparent 74%),
    radial-gradient(ellipse at 50% 100%, rgba(156, 52, 52, .16), transparent 68%);
}
.offering-table-scene canvas {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  opacity: 0; pointer-events: none; touch-action: pan-y;
  outline: none; -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  transition: opacity .22s ease;
}
.offering-table-scene.is-3d-ready canvas { opacity: 1; pointer-events: auto; }
.offering-table-edit-actions {
  position: absolute; z-index: 4; border: 1px solid rgba(212, 169, 78, .62);
  background: rgba(24, 13, 7, .88); color: var(--cream); backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, .3);
}
.offering-table-scene::after {
  content: ''; position: absolute; z-index: 3; inset: .42rem; pointer-events: none;
  border: 1.5px solid rgba(240, 201, 108, .7); border-radius: 14px;
  box-shadow: inset 0 0 24px rgba(240, 201, 108, .18), 0 0 18px rgba(240, 201, 108, .12);
  opacity: 0; transform: scale(.985); transition: opacity .6s ease, transform .6s ease;
}
.offering-table-scene.is-long-pressing::after { opacity: 1; transform: scale(1); }
.offering-table-edit-actions {
  left: .45rem; right: .45rem; bottom: .35rem; display: flex; align-items: center;
  justify-content: center; gap: .35rem; min-height: 48px; padding: .35rem .45rem; border-radius: 14px;
}
.offering-table-edit-actions[hidden] { display: none; }
.offering-table-edit-actions span { margin-right: auto; color: var(--gold-bright); font-size: .78rem; }
.offering-table-edit-actions button {
  min-height: 44px; padding: .35rem .65rem; border: 1px solid rgba(212, 169, 78, .4);
  border-radius: 999px; background: rgba(54, 31, 15, .92); color: var(--cream); font-size: .78rem;
}
.offering-table-edit-actions button.is-primary { background: var(--gold); color: #251506; font-weight: 800; }
.offering-table-edit-actions button:disabled { opacity: .55; }
.offering-table-scene.is-editing canvas { touch-action: none; cursor: grab; }
.offering-table-scene.is-dragging canvas { cursor: grabbing; }
.offer-shelf {
  display: flex; justify-content: center; align-items: center; gap: .65rem;
  flex-wrap: wrap; min-height: 48px; margin-top: .25rem;
}
.offer-shelf-primary {
  position: absolute; inset: 0; z-index: 1; align-content: center;
  margin: 0; padding: 2.5rem 1rem 1rem;
}
.offering-table-scene.is-3d-ready .offer-shelf-primary {
  inset: auto; top: 0; left: 0; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.offer-item {
  position: relative; display: inline-flex; flex-direction: column; align-items: center;
  font-size: 1.35rem; line-height: 1; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .45));
}
.offer-item img { width: 1.5em; height: 1.5em; object-fit: contain; vertical-align: bottom; }
.offer-item.fading { opacity: .45; }
.offer-item .od {
  display: block; margin-top: .3rem; color: var(--dim);
  font-size: .72rem; font-style: normal; line-height: 1.25; white-space: nowrap;
}
.offering-table-detail {
  position: absolute; z-index: 3; left: 50%; bottom: .3rem; transform: translateX(-50%);
  display: flex; align-items: center; justify-content: center; min-width: min(88%, 260px); min-height: 48px;
  padding: .55rem 1rem; border: 1px solid rgba(212, 169, 78, .55); border-radius: 999px;
  background: rgba(24, 13, 7, .88); color: var(--cream); font-size: 1rem; line-height: 1.35;
  box-shadow: 0 5px 18px rgba(0, 0, 0, .35); pointer-events: none;
  transition: opacity .18s ease;
}
.offering-table-detail[hidden] { display: none; }
.offering-waiting {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  width: min(100%, 560px); margin: .2rem auto .55rem; color: var(--dim);
  font-size: .85rem; line-height: 1.4;
}
.offering-waiting[hidden] { display: none; }
.offering-waiting > span { flex: 0 0 auto; color: var(--gold); letter-spacing: .12em; }
.offering-waiting .offer-shelf { justify-content: flex-start; min-height: 48px; margin: 0; }

#offerModal {
  position: fixed; inset: 0; z-index: 85; display: none;
  align-items: center; justify-content: center;
  padding: max(1.2rem, env(safe-area-inset-top)) 1.2rem max(1.2rem, env(safe-area-inset-bottom));
  background: rgba(0, 0, 0, .78);
}
#offerModal.show { display: flex; }
#offerModal .modal-box {
  position: relative; width: min(100%, 420px); max-height: 82svh; overflow-y: auto;
  padding: 1.35rem 1.1rem 1.2rem; border: 1.5px solid var(--gold); border-radius: 16px;
  background: linear-gradient(180deg, #2c1c0e, #1a100a); text-align: center;
  box-shadow: 0 16px 60px rgba(0, 0, 0, .7), 0 0 34px rgba(240, 201, 108, .14);
}
#offerModal .modal-x {
  position: absolute; top: .55rem; right: .65rem; z-index: 1;
  width: 42px; height: 42px; border: 1px solid rgba(212, 169, 78, .5); border-radius: 50%;
  background: rgba(20, 12, 6, .88); color: var(--gold-bright); font-size: 1rem;
}

/* 供桌管理：殿主長按後開啟的 mobile-safe bottom sheet */
.owner-quick-actions[hidden], .altar-management[hidden], .altar-management-panel[hidden],
.altar-selected-item[hidden], #offerGo[hidden] { display: none !important; }
.altar-management {
  position: fixed; z-index: 88; inset: 0;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
.altar-management-backdrop {
  position: absolute; inset: 0; width: 100%; min-height: 100%; border: 0; border-radius: 0;
  background: rgba(5, 3, 2, .76); backdrop-filter: blur(3px); touch-action: manipulation;
}
.altar-management-sheet {
  position: absolute; left: 50%; bottom: 0; display: flex; flex-direction: column;
  width: min(100%, 620px); max-height: min(88svh, 760px);
  transform: translateX(-50%); overflow: hidden; outline: none;
  border: 1.5px solid rgba(240, 201, 108, .75); border-bottom: 0; border-radius: 24px 24px 0 0;
  background: linear-gradient(180deg, rgba(49, 29, 14, .99), rgba(22, 13, 8, .995));
  color: var(--cream); text-align: left;
  box-shadow: 0 -18px 70px rgba(0, 0, 0, .7), 0 -2px 28px rgba(240, 201, 108, .1);
  animation: altar-sheet-in .24s ease-out;
}
@keyframes altar-sheet-in {
  from { transform: translate(-50%, 24px); opacity: .35; }
}
.altar-management-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  min-height: 72px; padding: .8rem 1rem .65rem 1.15rem;
  border-bottom: 1px solid rgba(212, 169, 78, .2);
}
.altar-management-kicker {
  margin: 0 0 .12rem; color: var(--gold); font-size: .75rem; line-height: 1.25; letter-spacing: .18em;
}
.altar-management-head h2 {
  margin: 0; color: var(--gold-bright); font-family: 'Noto Serif TC', serif;
  font-size: 1.12rem; line-height: 1.35; letter-spacing: .06em;
}
.altar-management-close {
  flex: 0 0 44px; width: 44px; height: 44px; padding: 0;
  border: 1px solid rgba(212, 169, 78, .5); border-radius: 50%;
  background: rgba(20, 12, 6, .88); color: var(--gold-bright); font-size: 1rem;
  touch-action: manipulation;
}
.altar-management-tabs {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .35rem;
  padding: .55rem .75rem; border-bottom: 1px solid rgba(212, 169, 78, .18);
}
.altar-management-tabs button {
  min-width: 0; min-height: 44px; padding: .45rem .25rem;
  border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--dim); font-size: .84rem; line-height: 1.3;
  touch-action: manipulation;
}
.altar-management-tabs button[aria-selected="true"] {
  border-color: rgba(240, 201, 108, .52); background: rgba(212, 169, 78, .14);
  color: var(--gold-bright); font-weight: 800;
}
.altar-management-scroll {
  min-height: 180px; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch; touch-action: pan-y;
  padding: .75rem 1rem calc(1rem + env(safe-area-inset-bottom));
}
.altar-management-status {
  min-height: 1.35rem; margin-bottom: .45rem; color: var(--dim); font-size: .78rem; line-height: 1.45;
}
.altar-management-status.is-error { color: #f0a3a3; }
.altar-management-intro {
  margin: 0 0 .6rem; color: var(--dim); font-size: .86rem; line-height: 1.6;
}
.altar-management-intro #offerPts { color: var(--gold-bright); }
.offer-grid {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin: .7rem 0;
}
.offer-opt {
  min-width: 0; min-height: 92px; padding: .6rem .3rem; border: 1px solid rgba(212, 169, 78, .25);
  border-radius: 12px; background: rgba(255, 255, 255, .06); color: inherit;
  font: inherit; text-align: center; cursor: pointer; touch-action: manipulation;
}
.offer-opt .oe { display: block; font-size: 1.7rem; }
.offer-opt .oe img { width: 1.7rem; height: 1.7rem; object-fit: contain; }
.offer-opt .on { display: block; margin-top: .2rem; font-size: .85rem; }
.offer-opt .oc { display: block; margin-top: .1rem; color: var(--gold-bright); font-size: .75rem; }
.offer-opt .os { display: block; color: var(--dim); font-size: .75rem; line-height: 1.35; }
.offer-opt.sel { border-color: var(--gold-bright); background: rgba(212, 169, 78, .16); }
.offer-opt:disabled { opacity: .42; cursor: not-allowed; }
.altar-management-primary { width: 100%; min-height: 48px; }
.altar-inventory { display: grid; gap: .9rem; }
.altar-inventory-group {
  padding: .7rem; border: 1px solid rgba(212, 169, 78, .22); border-radius: 14px;
  background: rgba(255, 255, 255, .035);
}
.altar-inventory-group h3 {
  margin: 0 0 .55rem; color: var(--gold-bright); font-size: .92rem; line-height: 1.4; letter-spacing: .08em;
}
.altar-inventory-list { display: grid; gap: .45rem; }
.altar-inventory-empty { margin: 0; color: var(--dim); font-size: .82rem; line-height: 1.5; }
.altar-inventory-item {
  display: flex; align-items: center; gap: .65rem; min-height: 52px; padding: .45rem .55rem;
  border: 1px solid rgba(212, 169, 78, .15); border-radius: 11px; background: rgba(16, 9, 5, .5);
}
.altar-inventory-visual {
  display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; font-size: 1.45rem;
}
.altar-inventory-visual img { width: 34px; height: 34px; object-fit: contain; }
.altar-inventory-copy { flex: 1 1 auto; min-width: 0; }
.altar-inventory-copy b { display: block; color: var(--cream); font-size: .86rem; line-height: 1.35; }
.altar-inventory-copy span { display: block; margin-top: .08rem; color: var(--dim); font-size: .75rem; line-height: 1.4; }
.altar-inventory-action {
  flex: 0 0 auto; min-width: 84px; min-height: 44px; padding: .4rem .6rem;
  border: 1px solid rgba(212, 169, 78, .48); border-radius: 10px;
  background: rgba(91, 51, 20, .72); color: var(--gold-bright); font-size: .78rem; line-height: 1.3;
  touch-action: manipulation;
}
.altar-inventory-action:disabled { opacity: .48; cursor: wait; }
.altar-inventory-state {
  flex: 0 0 auto; padding: .28rem .5rem; border: 1px solid rgba(212, 169, 78, .2); border-radius: 999px;
  color: var(--dim); font-size: .75rem; line-height: 1.35; white-space: nowrap;
}
.altar-layout-card, .altar-selected-item {
  padding: .9rem; border: 1px solid rgba(212, 169, 78, .28); border-radius: 14px;
  background: rgba(255, 255, 255, .045);
}
.altar-layout-card { display: grid; gap: .75rem; }
.altar-layout-card h3, .altar-selected-item h3 {
  margin: 0; color: var(--gold-bright); font-size: 1rem; line-height: 1.4;
}
.altar-layout-card p, .altar-selected-item p {
  margin: .25rem 0 0; color: var(--dim); font-size: .82rem; line-height: 1.55;
}
.altar-layout-card button { width: 100%; min-height: 46px; }
.altar-selected-item { margin-top: .8rem; }
.altar-selected-item-meta { color: var(--dim); }
.altar-selected-item-note { min-height: 1.25rem; }
.altar-selected-item-note.is-warning { color: #efc37a; }
.altar-selected-item-note.is-error { color: #f0a3a3; }
.altar-selected-item-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; margin-top: .8rem; }
.altar-selected-item-actions button { min-height: 44px; padding: .5rem .65rem; }
.altar-selected-item-actions .is-danger {
  border-color: rgba(222, 112, 104, .65); background: rgba(129, 44, 39, .42); color: #ffd8d5;
}
.altar-management button:focus-visible {
  outline: 2px solid var(--gold-bright); outline-offset: 2px;
}
body.altar-management-open { overflow: hidden; }

/* 側牆內容 */
.wall-panel { max-width: 78%; text-align: center; transform: translateZ(1px); margin: auto;
  padding: calc(104px + env(safe-area-inset-top)) 0 calc(128px + env(safe-area-inset-bottom)); }
.wall-panel h2 {
  font-size: 1.5rem; letter-spacing: .35em; color: var(--gold-bright);
  margin-bottom: 1.1rem; font-weight: 900;
}
.outer-wall-kicker {
  margin-bottom: .35rem; color: var(--gold); font-size: .78rem; font-weight: 700; letter-spacing: .16em;
}
.wish-board {
  padding: 1.6rem 1.9rem; border: 2px solid var(--gold); border-radius: 10px;
  background:
    linear-gradient(rgba(30, 16, 8, .82), rgba(30, 16, 8, .82)),
    url('/assets/textures/damask.jpg');
  background-size: 300px;
  font-family: 'Noto Serif TC', serif; font-size: 1.35rem; letter-spacing: .12em;
  box-shadow: 0 8px 30px var(--shadow);
}
.streak-big { font-size: 3.6rem; font-weight: 900; color: var(--gold-bright); font-family: 'Noto Serif TC', serif; line-height: 1.15; }
.streak-label { color: var(--dim); letter-spacing: .25em; font-size: .95rem; }
.dots { display: flex; gap: 7px; justify-content: center; margin-top: 1rem; flex-wrap: wrap; }
.dots i {
  width: 13px; height: 13px; border-radius: 50%;
  background: rgba(255, 255, 255, .12); border: 1px solid rgba(212, 169, 78, .3);
}
.dots i.on { background: var(--gold); box-shadow: 0 0 8px rgba(240, 201, 108, .8); }
.blessing-list { margin-top: 1.1rem; font-size: 1rem; color: var(--dim); }
.blessing-list li { list-style: none; margin: .3rem 0; }

/* HUD（三欄：宮印｜名號＋副標｜香火） */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: .4rem;
  padding: calc(.8rem + env(safe-area-inset-top)) .7rem 1.3rem;
  background: linear-gradient(rgba(10, 5, 2, .92), rgba(10, 5, 2, .55) 70%, transparent);
  pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.hud-icon {
  justify-self: start;
  width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(212, 169, 78, .55); background: rgba(20, 12, 6, .6);
  font-size: 1.25rem; color: var(--gold); flex: 0 0 auto;
}
.hud-right { justify-self: end; display: flex; align-items: center; gap: .4rem; }
.hud-center { text-align: center; min-width: 0; }   /* auto 欄置中於兩側等寬 1fr 之間 */
.hud-name {
  font-family: 'Noto Serif TC', serif; font-weight: 900;
  font-size: clamp(1rem, 4.4vw, 1.4rem); letter-spacing: .05em;
  color: var(--gold-bright); white-space: nowrap;   /* JS 自動縮字，不裁切 */
}
.hud-url {
  font-size: .78rem; letter-spacing: .02em; color: var(--dim); margin-top: .1rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hud-login {
  padding: .3rem .85rem; border-radius: 999px; font-size: .88rem; letter-spacing: .12em;
  border: 1.5px solid rgba(212, 169, 78, .5); background: rgba(20, 12, 6, .6); color: var(--gold);
}
.hud-manage {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid rgba(212, 169, 78, .5); background: rgba(20, 12, 6, .6);
  font-size: 1.2rem; color: var(--gold);
}
.hud-streak {
  font-weight: 900; color: var(--gold-bright); font-size: 1rem; white-space: nowrap;
  padding: .25rem .7rem; border: 1px solid rgba(212, 169, 78, .5); border-radius: 999px;
  background: rgba(20, 12, 6, .6); flex: 0 0 auto;
}

.hud-hint { font-size: .95rem; color: var(--dim); letter-spacing: .1em; }
.cta-row { display: flex; align-items: center; gap: .7rem; }
.altar .cta-row .btn:not(.btn-ghost) { font-size: 1.2rem; padding: .9rem 2.2rem; letter-spacing: .14em; }
.altar .cta-row .btn-ghost { padding: .75rem 1.3rem; font-size: .95rem; }
.cta-mine { padding: .45rem 1.3rem; font-size: .9rem; }

/* 神殿主操作：參拜優先，其他儀式等寬並列 */
.shrine-primary {
  width: min(100%, 720px); margin-top: .05rem;
}
.altar .shrine-primary { width: min(100%, 720px); }
.shrine-primary .btn {
  width: 100%; min-height: 72px; padding: 1rem 1.5rem;
  font-size: clamp(1.15rem, 4.8vw, 1.35rem); letter-spacing: .1em;
  border: 1px solid #f4d477; box-shadow: inset 0 0 18px rgba(255, 248, 201, .28), 0 8px 24px rgba(135, 85, 18, .38);
}
.shrine-secondary {
  width: min(100%, 720px); display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem;
  margin-top: .7rem;
}
.altar .shrine-secondary { width: min(100%, 720px); }
.altar .shrine-secondary .btn-ghost {
  width: 100%; min-width: 0; min-height: 48px; padding: .55rem .3rem;
  font-size: clamp(.8rem, 3.5vw, .95rem); letter-spacing: .03em;
  white-space: nowrap;
}
.owner-quick-actions { margin-top: .55rem; }
.altar-growth {
  width: min(100%, 720px); margin-top: .85rem; padding: .8rem;
  border: 1px solid rgba(212, 169, 78, .24); border-radius: 14px;
  background: rgba(20, 12, 6, .36);
}
.altar-growth-copy { color: var(--dim); font-size: .92rem; line-height: 1.65; }
.altar-growth-copy span { color: var(--gold-bright); }
.altar-growth .btn { margin-top: .55rem; padding: .5rem 1.1rem; font-size: .9rem; }
.visitor-acquisition {
  width: min(100%, 720px); margin-top: 1.15rem; padding-top: 1rem;
  border-top: 1px solid rgba(212, 169, 78, .28); text-align: center;
}
.visitor-acquisition-title { color: var(--cream); font-size: 1rem; font-weight: 700; letter-spacing: .05em; }
.visitor-acquisition-note { margin-top: .12rem; color: var(--dim); font-size: .88rem; }
.altar .visitor-acquisition .cta-mine {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; margin-top: .65rem; padding: .55rem 1.35rem; font-size: .95rem;
}
@media (max-width: 360px) {
  .altar .shrine-secondary .btn-ghost { padding-inline: .15rem; font-size: .78rem; }
}
/* 錄影儲存鈕（iOS 分享需使用者手勢，錄完點此才觸發） */
/* 儲存影片鈕＋提示：在完成畫面流內（不再絕對定位浮動） */
.save-rec { margin-top: 0; }
.save-rec-hint {
  max-width: 100%; margin: .35rem auto 0; text-align: center;
  font-size: .75rem; line-height: 1.5; color: #f0b48a; text-shadow: 0 1px 6px #000;
  animation: hint-pulse 1.8s ease-in-out infinite;
}
@keyframes hint-pulse { 50% { opacity: .55; } }
/* 參拜留影：處理中→預覽→儲存 */
.rec-keepsake { width: 100%; display: flex; flex-direction: column; align-items: center; gap: .35rem; margin: 1rem 0 .85rem; }
.rec-status {
  color: var(--gold-bright); font-size: .875rem; line-height: 1.55; letter-spacing: .04em; margin: .5rem 0;
  text-shadow: 0 1px 6px #000; animation: hint-pulse 1.6s ease-in-out infinite;
}
.rec-actions { width: 100%; flex-direction: column; gap: .55rem; align-items: stretch; margin: .3rem 0 .2rem; }
/* 直式影片縮成小視窗會變長條 → 預覽一律全螢幕播放 */
.rec-fullscreen { position: fixed; inset: 0; z-index: 90; display: none; align-items: center; justify-content: center; background: #000; }
.rec-fullscreen.show { display: flex; }
.rec-fullscreen video { max-width: 100%; max-height: 100%; background: #000; }
.rec-full-close {
  position: absolute; top: max(1rem, env(safe-area-inset-top, 1rem)); right: 1rem; z-index: 2;
  width: 42px; height: 42px; border-radius: 50%; font-size: 1.15rem; line-height: 1;
  background: rgba(0, 0, 0, .55); border: 1px solid rgba(255, 255, 255, .45); color: #fff;
}
.wall-nav { position: fixed; z-index: 30; top: 50%; transform: translateY(-50%);
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid rgba(212,169,78,.45);
  background: rgba(20, 12, 6, .55); color: var(--gold); font-size: 1.2rem; }
.wall-nav.prev { left: .6rem; } .wall-nav.next { right: .6rem; }
.wall-dots { display: flex; gap: 8px; }
.wall-dots.flow { justify-content: center; margin: 1rem 0 .9rem; }
.altar .cta-row { justify-content: center; }
.altar .cta-mine { display: inline-block; margin-top: .7rem; padding: .45rem 1.3rem; font-size: .9rem; }
.altar .hud-hint { margin-top: .9rem; }
.wall-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(243, 231, 211, .25); transition: .2s; }
.wall-dots i.on { background: var(--gold-bright); transform: scale(1.25); }

/* ============ 山門（入殿宣示） ============ */
.gate { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.gate-door {
  position: absolute; top: 0; bottom: 0; width: 50.5%;
  background:
    linear-gradient(rgba(26, 14, 6, .88), rgba(14, 8, 4, .92)),
    url('/assets/textures/wall.jpg');
  background-size: cover;
  transition: transform 1.15s cubic-bezier(.72, 0, .3, 1);
}
.gate-door.left  { left: 0;  border-right: 3px solid var(--gold); box-shadow: inset -30px 0 60px rgba(0,0,0,.6); }
.gate-door.right { right: 0; border-left: 3px solid var(--gold);  box-shadow: inset 30px 0 60px rgba(0,0,0,.6); }
.gate-door::after { /* 門環（避開中央宣示文，置於下方） */
  content: ''; position: absolute; top: 72%; width: 46px; height: 46px;
  border: 5px solid var(--gold); border-radius: 50%; opacity: .85;
  box-shadow: 0 4px 14px rgba(0,0,0,.7), inset 0 2px 6px rgba(240,201,108,.4);
}
.gate-door.left::after  { right: 26px; transform: translateY(-50%); }
.gate-door.right::after { left: 26px;  transform: translateY(-50%); }
.gate.open .gate-door.left  { transform: translateX(-103%); }
.gate.open .gate-door.right { transform: translateX(103%); }
.inner-hall.gate-reveal .inner-hall-stage {
  animation: inner-gate-arrival 1.25s cubic-bezier(.16, .72, .2, 1) both;
}
@keyframes inner-gate-arrival {
  0% { transform: translate3d(0, 0, -180px) scale(.9); opacity: .58; filter: brightness(.48) blur(2px); }
  58% { transform: translate3d(0, 0, -36px) scale(.975); opacity: .88; filter: brightness(.8) blur(.4px); }
  100% { transform: translate3d(0, 0, 0) scale(1); opacity: 1; filter: brightness(1) blur(0); }
}
/* 山門匾額：不透明看板掛在門中央，門縫不切字 */
.gate-inner {
  position: relative; z-index: 2; text-align: center;
  width: min(88vw, 420px); padding: 2.2rem 1.6rem 2rem;
  background:
    linear-gradient(165deg, rgba(40, 23, 10, .98), rgba(22, 13, 7, .99)),
    url('/assets/textures/frame.jpg');
  background-size: cover;
  border: 3px solid var(--gold); border-radius: 14px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, .75), 0 0 0 1px #5c431c,
    inset 0 0 40px rgba(0, 0, 0, .5), 0 0 46px rgba(240, 201, 108, .16);
  transition: opacity .45s, transform .45s;
}
.gate-inner::before {   /* 懸掛繩：匾額往上連到門楣 */
  content: ''; position: absolute; left: 50%; top: -46px; transform: translateX(-50%);
  width: 2px; height: 46px; background: linear-gradient(var(--gold), rgba(212,169,78,.2));
}
.gate-inner::after {    /* 掛環 */
  content: ''; position: absolute; left: 50%; top: -52px; transform: translateX(-50%);
  width: 14px; height: 14px; border: 2px solid var(--gold); border-radius: 50%;
}
.gate.open .gate-inner { opacity: 0; transform: translateY(-10px) scale(.96); pointer-events: none; }
.gate-crest {
  display: inline-block; padding: .28rem 1.2rem; margin-bottom: 1rem;
  background: linear-gradient(160deg, var(--red), var(--red-deep));
  border: 2px solid var(--gold); border-radius: 6px;
  font-family: 'Noto Serif TC', serif; font-size: 1.25rem; font-weight: 900;
  letter-spacing: .3em; color: var(--gold-bright);
}
.gate-title {
  font-family: 'Noto Serif TC', serif; font-size: 1.7rem; font-weight: 900;
  letter-spacing: .16em; color: var(--gold-bright);
  text-shadow: 0 0 30px rgba(240, 201, 108, .4);
}
.gate-line { margin-top: 1rem; font-size: 1.05rem; letter-spacing: .18em; color: var(--cream); }
.gate-warn {
  margin-top: .6rem; font-size: 1rem; letter-spacing: .2em;
  color: #e08a6a; font-family: 'Noto Serif TC', serif; font-weight: 700;
}
.gate .btn { margin-top: 1.6rem; }
.gate-note { margin-top: .7rem; font-size: .88rem; letter-spacing: .22em; color: var(--dim); }

/* ============ 上香 overlay ============ */
.worship-overlay {
  position: fixed; inset: 0; z-index: 60; display: none;
  background: #000; flex-direction: column; align-items: center; justify-content: center;
}
.worship-overlay.open { display: flex; }
.worship-overlay #wVideo, .worship-overlay canvas.fx {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; transform: scaleX(-1);
}
/* 桌面/寬螢幕：鏡頭收成置中直式（不然橫向網路攝影機會鋪滿整個寬螢幕爆版） */
@media (min-aspect-ratio: 1/1) {
  .worship-overlay #wVideo, .worship-overlay canvas.fx {
    left: 50%; right: auto; width: auto; height: 100%;
    aspect-ratio: 3 / 4; transform: translateX(-50%) scaleX(-1);
  }
}
.worship-overlay canvas.fx { pointer-events: none; }
.worship-vignette { position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 32vmin 8vmin rgba(0, 0, 0, .85); }
.worship-status {
  position: absolute; top: calc(1.4rem + env(safe-area-inset-top)); left: 0;
  right: calc(1.4rem + min(26vw, 118px));   /* 讓出右上角守護神像，指示文字不被蓋住 */
  text-align: center; font-size: 1.1rem; letter-spacing: .18em; color: var(--cream);
  text-shadow: 0 1px 8px #000; z-index: 3; padding: 0 .8rem; line-height: 1.5;
}
/* 桌面鏡頭是置中直式欄（寬 75vh）：指示文字左緣對齊影片框左緣、靠左排，右側讓出神像 */
@media (min-aspect-ratio: 1/1) {
  .worship-status {
    left: max(1.4rem, calc(50vw - 37.5vh));
    right: max(1.4rem, calc(50vw - 37.5vh + min(14vh, 118px) + 1.6rem));
    text-align: left;
  }
}
/* 上香時的守護神像：面前的神，光暈隨進度增強（--glow: 0~1） */
/* 上香時守護神像＝右上角小框＋下方名牌（不蓋到信士頭部；與拍攝印記一致） */
.worship-deity {
  position: absolute; z-index: 3;
  top: calc(1rem + env(safe-area-inset-top)); right: 1rem;
  width: min(26vw, 118px); pointer-events: none; --glow: 0; text-align: center;
}
/* 桌面：鏡頭是置中直式欄（寬＝75vh），神像貼齊鏡頭右上角，而非瀏覽器右上角 */
@media (min-aspect-ratio: 1/1) {
  .worship-deity { right: max(1rem, calc(50vw - 37.5vh + 0.8rem)); width: min(14vh, 118px); }
}
.worship-deity img {
  display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  border: 3px solid var(--gold); border-radius: 8px;
  box-shadow:
    0 6px 22px rgba(0, 0, 0, .65),
    0 0 calc(14px + var(--glow) * 44px) calc(2px + var(--glow) * 10px) rgba(240, 201, 108, calc(.25 + var(--glow) * .55));
  filter: brightness(calc(.92 + var(--glow) * .18));
  transition: box-shadow .25s, filter .25s;
  animation: deity-breathe 4.5s ease-in-out infinite;
}
@keyframes deity-breathe { 50% { transform: scale(1.015); } }
.worship-deity .wname {
  display: inline-block; margin-top: .35rem; padding: .12rem .7rem;
  background: linear-gradient(160deg, var(--red), var(--red-deep));
  border: 1.5px solid var(--gold); border-radius: 6px;
  font-family: 'Noto Serif TC', serif; font-weight: 900; font-size: .82rem;
  letter-spacing: .12em; color: var(--gold-bright); white-space: nowrap;
}
.worship-deity::after { /* 頂光 */
  content: ''; position: absolute; inset: -24% -30% 30%; z-index: -1;
  background: radial-gradient(ellipse at 50% 30%, rgba(240, 201, 108, calc(.18 + var(--glow) * .4)), transparent 65%);
}
/* 神性回應：照片背後緩緩旋轉的放射金光（誠心越深越顯，~21s/圈）＋呼吸明滅；與影片端 drawDeityAura 視覺一致 */
.worship-deity::before {
  content: ''; position: absolute; z-index: -1; inset: -32%;
  pointer-events: none; border-radius: 50%;
  background: repeating-conic-gradient(from 0deg,
    rgba(255, 236, 175, 0) 0deg, rgba(255, 236, 175, .3) 4deg,
    rgba(255, 236, 175, 0) 12deg, rgba(255, 236, 175, 0) 30deg);
  -webkit-mask: radial-gradient(circle, #000 6%, rgba(0,0,0,.5) 44%, transparent 72%);
          mask: radial-gradient(circle, #000 6%, rgba(0,0,0,.5) 44%, transparent 72%);
  filter: opacity(var(--glow));                 /* 隨誠心 0→1 淡入 */
  animation: deity-rays 21s linear infinite, aura-breathe 4.5s ease-in-out infinite;
}
@keyframes deity-rays { to { transform: rotate(360deg); } }
@keyframes aura-breathe { 0%, 100% { opacity: .5; } 50% { opacity: .95; } }
/* 神性回應：金色靈光上升環繞（香火意象），隨誠心淡入 */
.w-aura {
  position: absolute; z-index: 1; inset: -25% -8% 5%;
  pointer-events: none; mix-blend-mode: screen;
  background-repeat: no-repeat;
  background-image:
    radial-gradient(circle 2.5px at 22% 88%, rgba(255, 244, 200, .95), transparent 60%),
    radial-gradient(circle 2px   at 50% 94%, rgba(255, 236, 175, .9),  transparent 60%),
    radial-gradient(circle 2.5px at 76% 90%, rgba(255, 244, 200, .95), transparent 60%),
    radial-gradient(circle 2px   at 36% 92%, rgba(255, 236, 175, .85), transparent 60%),
    radial-gradient(circle 2px   at 64% 86%, rgba(255, 244, 200, .9),  transparent 60%);
  filter: opacity(var(--glow));                 /* 隨誠心 0→1 淡入 */
  animation: aura-rise 4.4s linear infinite;
}
@keyframes aura-rise {
  0%   { transform: translateY(8%);   opacity: 0; }
  22%  { opacity: .9; }
  80%  { opacity: .9; }
  100% { transform: translateY(-58%); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .worship-deity::before { animation: none; }
  .w-aura { animation: none; opacity: .5; }
}
.done-deity-wrap {
  position: relative; width: min(38vw, 150px); aspect-ratio: 3 / 4; margin-top: .25rem;
}
.done-deity-wrap::before {
  content: ''; position: absolute; inset: -2.3rem; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 215, 115, .55), rgba(212, 150, 43, .14) 48%, transparent 72%);
  filter: blur(4px); pointer-events: none;
}
.worship-done .done-deity {
  position: relative; width: 100%; height: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  border: 2px solid var(--gold-bright); border-radius: 18px;
  box-shadow: 0 0 0 3px rgba(110, 68, 15, .7), 0 0 36px rgba(239, 190, 77, .45);
}
/* 至誠圓滿稱號（拜滿 60 秒完成畫面顯示） */
.done-zhicheng {
  display: inline-flex; align-items: center; min-height: 34px; margin: .95rem 0 .5rem; padding: .42rem 1rem;
  background: linear-gradient(160deg, var(--red), var(--red-deep));
  border: 1.5px solid var(--gold-bright); border-radius: 6px;
  font-family: 'Noto Serif TC', serif; font-size: .8125rem; font-weight: 900; letter-spacing: .08em;
  color: #ffe193; box-shadow: 0 4px 18px rgba(0, 0, 0, .35), 0 0 18px rgba(240, 201, 108, .22);
  animation: deity-breathe 3s ease-in-out infinite;
}
/* 電影感片尾卡（黑金）：收尾播完，用不透明層直接蓋掉相機畫面；錄影端另由 canvas drawEndCard 畫（WYSIWYG）
   iOS 相機 video 是硬體合成層，opacity/visibility 切換會被穿透（完成畫面 display:none→flex 則沒事）
   → 比照完成畫面用 display 硬切換＋translateZ(0) 強制自身合成層，淡入改用 animation（display 觸發可靠） */
.worship-endcard {
  position: absolute; inset: 0; z-index: 7; display: none; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 42%, #3c2a12, #0a0704 72%);
  pointer-events: none; transform: translateZ(0); -webkit-transform: translateZ(0);
}
.worship-endcard.show { display: flex; animation: ec-fadein .5s ease; }
.worship-endcard #wOutroVid {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  display: none; background: #000;
}
.worship-endcard.playing-video #wOutroVid { display: block; }
.worship-endcard.playing-video .ec-inner { display: none; }
@keyframes ec-fadein { from { opacity: 0; } to { opacity: 1; } }
.ec-inner { text-align: center; padding: 1rem; }
.ec-deity { width: min(46vw, 200px); aspect-ratio: 3/4; object-fit: cover;
  border: 3px solid var(--gold); border-radius: 8px; box-shadow: 0 0 45px 8px rgba(240, 201, 108, .7); }
.ec-ask { margin-top: 1rem; font-family: 'Noto Serif TC', serif; font-weight: 900;
  font-size: clamp(1.6rem, 8vw, 2.4rem); color: var(--gold-bright); text-shadow: 0 2px 14px #000; }
.ec-day { margin-top: .5rem; font-family: 'Noto Serif TC', serif; font-weight: 700; font-size: 1.05rem; color: var(--gold); }
.ec-brand { margin-top: 1.4rem; font-family: 'Noto Serif TC', serif; font-weight: 900; font-size: 1.3rem; letter-spacing: .06em; color: var(--gold-bright); }
.ec-tagline { margin-top: .45rem; font-family: 'Noto Sans TC', sans-serif; font-weight: 600;
  font-size: .92rem; letter-spacing: .08em; color: rgba(240, 201, 108, .85); }
@media (max-height: 640px) { .worship-deity { width: min(32vw, 150px); } }

.ring-wrap { position: absolute; bottom: 12vh; left: 50%; transform: translateX(-50%); z-index: 3; }
.ring-wrap svg { width: 118px; height: 118px; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, .18); stroke-width: 7; }
.ring-fg { fill: none; stroke: var(--gold-bright); stroke-width: 7; stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(240, 201, 108, .9)); }
.ring-emoji { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.3rem; }
.worship-cancel { position: absolute; top: calc(1rem + env(safe-area-inset-top)); right: 1rem; z-index: 4;
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4);
  background: rgba(0, 0, 0, .45); color: #fff; font-size: 1.1rem; }
.worship-fallback {
  position: absolute; bottom: calc(2.2vh + env(safe-area-inset-bottom)); left: 50%;
  transform: translateX(-50%); z-index: 4;
  /* 長按穩定性：禁掉 iOS 長按選取/放大鏡，避免按壓被系統取消 */
  touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* .btn:active 的 scale 會蓋掉置中位移 → 按下往右跑；此規則保留位移 */
.worship-fallback:active { transform: translateX(-50%) scale(.96); }

/* 信士照（請神合十禮擷取）：上香畫面左下 */
.worshipper {
  position: absolute; left: 1rem; bottom: calc(4.6rem + env(safe-area-inset-bottom));
  z-index: 3; text-align: center; pointer-events: none;
}
.worshipper img {
  display: block; width: 72px; aspect-ratio: 3 / 4; object-fit: cover;
  border: 2px solid var(--gold); border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .6), 0 0 18px rgba(240, 201, 108, .2);
}
.worshipper span {
  display: block; margin-top: .3rem; font-size: .78rem; letter-spacing: .1em;  /* Font1 最小字級 */
  color: var(--gold); text-shadow: 0 1px 4px #000;
}

/* 祈願選擇（圖形按鈕） */
.bless-sheet {
  position: absolute; inset: 0; z-index: 6; display: none;
  align-items: center; justify-content: center; overflow-y: auto;
  background: rgba(10, 5, 2, .82); backdrop-filter: blur(4px);
}
.bless-sheet.show { display: flex; }
.bless-box { text-align: center; padding: 1.5rem; margin: auto; }
.bless-box h3 {
  font-family: 'Noto Serif TC', serif; font-size: 1.4rem; font-weight: 900;
  letter-spacing: .3em; color: var(--gold-bright); margin-bottom: 1.2rem;
}
/* 22 個所求選項：分組排列，整張面板可捲動 */
.bless-box { padding-block: 2.2rem 2.6rem; }
.bless-group { margin-top: 1.15rem; }
.bless-group h4 {
  font-family: 'Noto Serif TC', serif; font-size: .85rem; font-weight: 700;
  letter-spacing: .45em; color: var(--dim); margin-bottom: .55rem;
  display: flex; align-items: center; gap: .6rem; justify-content: center;
}
.bless-group h4::before, .bless-group h4::after {
  content: ''; width: 34px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212, 169, 78, .45));
}
.bless-group h4::after { transform: scaleX(-1); }
/* 鎏金線 icon（獨立 PNG：--i 指定 /assets/wishes/<拼音>.png，新增求願不必重排 sheet） */
.wico {
  display: block; width: 54px; height: 36px;
  background-image: var(--i);
  background-repeat: no-repeat; background-size: contain; background-position: center;
}
/* 籤後祈安／祝福他人／誠心懺悔：特殊寬版祈願 */
.bless-fortune, .bless-other, .bless-repent, .bless-sincere {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  width: min(100%, 302px); margin: 0 auto; padding: .9rem 1rem .8rem;
  border-radius: 14px; transition: .15s;
  background: linear-gradient(160deg, rgba(18, 30, 52, .95), rgba(10, 18, 34, .9));
  border: 1.5px solid var(--gold-bright); color: var(--cream);
  box-shadow: 0 0 14px rgba(240, 201, 108, .18);
}
.bless-fortune {
  margin: 0 auto .7rem;
  background: linear-gradient(160deg, rgba(56, 25, 8, .96), rgba(25, 12, 5, .94));
  box-shadow: 0 0 22px rgba(240, 201, 108, .26);
}
.bless-fortune[hidden] { display: none !important; }
.bless-repent {
  margin: 1.15rem auto 0;
  background: linear-gradient(160deg, rgba(29, 26, 23, .94), rgba(14, 12, 11, .92));
  border-color: rgba(212, 169, 78, .48);
}
.bless-sincere {
  margin: .7rem auto 0;
}
.bless-fortune .wico, .bless-other .wico, .bless-repent .wico, .bless-sincere .wico { width: 66px; height: 44px; }
.bless-fortune span, .bless-other span, .bless-repent span, .bless-sincere span { font-size: 1.05rem; font-weight: 700; letter-spacing: .25em; color: var(--gold-bright); }
.bless-fortune small, .bless-other small, .bless-repent small, .bless-sincere small { font-size: .74rem; letter-spacing: .12em; color: var(--dim); }
.bless-fortune:active, .bless-other:active, .bless-repent:active, .bless-sincere:active { transform: scale(.96); box-shadow: 0 0 24px rgba(240, 201, 108, .45); }
.bless-grid { display: grid; grid-template-columns: repeat(3, 96px); gap: .7rem; justify-content: center; }
.bless-grid button {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: .7rem 0 .6rem; border-radius: 14px;
  background: rgba(11, 21, 38, .88); border: 1.5px solid rgba(212, 169, 78, .5);
  color: var(--cream); transition: .15s;
}
.bless-grid button span { font-size: 1.05rem; font-weight: 700; letter-spacing: .25em; color: var(--gold-bright); }
.bless-grid button:active { transform: scale(.94); border-color: var(--gold-bright); box-shadow: 0 0 20px rgba(240, 201, 108, .4); }

/* 拍照留念 */
.snap-btn {
  position: absolute; right: 1rem; bottom: calc(11vh + env(safe-area-inset-bottom));
  z-index: 4; width: 56px; height: 56px; border-radius: 50%; font-size: 1.5rem;
  background: rgba(20, 12, 6, .65); border: 2px solid var(--gold);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .5);
}
.snap-btn:active { transform: scale(.9); }
.snap-btn.rec { bottom: calc(11vh + 66px + env(safe-area-inset-bottom)); font-size: 1.35rem; }
.snap-btn.rec.on {
  border-color: #e05555; background: rgba(90, 15, 15, .75);
  animation: rec-pulse 1.1s ease-in-out infinite;
}
@keyframes rec-pulse { 50% { box-shadow: 0 0 0 8px rgba(224, 85, 85, .25); } }
.snap-thumbs {
  position: absolute; right: 1.05rem; bottom: calc(11vh + 132px + env(safe-area-inset-bottom));
  z-index: 4; display: flex; flex-direction: column-reverse; gap: 6px; max-height: 40vh; overflow: hidden;
}
.snap-thumbs img {
  width: 52px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 6px;
  border: 1.5px solid var(--gold); box-shadow: 0 2px 8px rgba(0, 0, 0, .6);
  animation: snapin .3s ease-out;
}
@keyframes snapin { from { transform: scale(1.6); opacity: 0; } }

/* 參拜相簿 */
.album-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; max-height: 50vh; overflow-y: auto; }
.album-grid img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; border: 1px solid rgba(212, 169, 78, .5); }
.album-grid .empty { grid-column: 1 / -1; color: var(--dim); font-size: .9rem; padding: 1.5rem 0; }

/* 完成畫面 */
.worship-done {
  position: absolute; inset: 0; z-index: 8; display: none;
  flex-direction: column; align-items: center; justify-content: flex-start;
  background: radial-gradient(circle at 50% 18%, rgba(126, 78, 20, .64), rgba(27, 16, 7, .97) 36%, #080503 72%);
  text-align: center; padding: max(2rem, env(safe-area-inset-top)) 1rem max(1.4rem, env(safe-area-inset-bottom)); overflow-y: auto;
}
.worship-done.show { display: flex; }
.done-content {
  width: min(100%, 390px); margin: auto; display: flex; flex-direction: column; align-items: center; text-align: center;
}
/* 完成畫面出現時，隱藏底層上香控制項（進度環、長按鈕、狀態、拍照鈕、神像）避免穿透造成混亂 */
.worship-overlay.done .ring-wrap,
.worship-overlay.done .worship-fallback,
.worship-overlay.done .worship-status,
.worship-overlay.done .snap-btn,
.worship-overlay.done .snap-thumbs,
.worship-overlay.done .worship-deity { display: none; }
.worship-done .big {
  margin-left: .2em; font-size: clamp(2rem, 9vw, 2.2rem); font-family: 'Noto Serif TC', serif; font-weight: 900;
  color: var(--gold-bright); letter-spacing: .2em; text-shadow: 0 0 15px rgba(255, 205, 91, .45);
}
.worship-done .streak-line { margin-top: .4rem; font-size: 1rem; line-height: 1.6; color: var(--cream); }
.done-media-primary {
  width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; text-align: center;
}
.done-media-action {
  min-height: 70px; padding: .6rem .45rem; border: 1px solid #f3cd6e; border-radius: 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; letter-spacing: 0;
  background: linear-gradient(150deg, #ffe394, #cf932b); color: #251605;
  box-shadow: inset 0 0 18px rgba(255, 248, 201, .35), 0 5px 18px rgba(135, 85, 18, .25);
}
.done-media-action .done-action-note { color: rgba(37, 22, 5, .7); }
.rec-first-privacy {
  width: 100%; margin: 0 0 .7rem; padding: .75rem .8rem;
  border: 1px solid rgba(212, 169, 78, .38); border-radius: 12px;
  background: rgba(30, 18, 8, .74); color: #ead9b7; font-size: .8rem; line-height: 1.65; text-align: left;
}
.rec-first-privacy[hidden] { display: none !important; }
.rec-first-privacy b { display: block; margin-bottom: .2rem; color: var(--gold-bright); }
.rec-first-privacy p { margin: 0; }
.rec-first-privacy button {
  display: block; min-height: 40px; margin: .55rem 0 0 auto; padding: .35rem .8rem;
  border: 1px solid rgba(212, 169, 78, .55); border-radius: 999px;
  background: transparent; color: var(--gold-bright); font: inherit;
}
.done-media-extra { display: flex; flex-wrap: wrap; justify-content: center; gap: .55rem; }
.done-media-extra .btn { min-height: 44px; padding: .55rem 1rem; font-size: .875rem; }
.done-upload-purpose { flex-basis: 100%; margin-top: -.05rem; font-size: .75rem; line-height: 1.6; color: #dbc79f; }
.done-privacy {
  display: inline-flex; align-items: center; margin-top: .25rem; padding: .16rem .55rem;
  border: 1px solid rgba(194, 173, 135, .28); border-radius: 999px;
  font-size: .75rem; line-height: 1.5; color: #c2ad87;
}
.done-action-list { width: 100%; display: grid; gap: .5rem; }
.done-action {
  width: 100%; min-height: 44px; display: flex; align-items: center; padding: .65rem .8rem;
  border: 1px solid rgba(212, 158, 55, .58); border-radius: 14px;
  background: linear-gradient(90deg, rgba(52, 34, 14, .82), rgba(19, 13, 7, .72)); color: var(--gold-bright); text-align: left;
}
.done-action-icon { width: 2rem; flex: 0 0 2rem; text-align: center; color: var(--gold); }
.done-action-title { display: block; font-size: 1rem; font-weight: 700; line-height: 1.35; }
.done-action-note { display: block; margin-top: .1rem; font-size: .75rem; line-height: 1.5; color: #c2ad87; }
.done-back {
  min-height: 44px; margin-top: .55rem; padding: .5rem 1rem; border: 0; background: none;
  color: #b59a70; font-size: .875rem; text-decoration: underline; text-underline-offset: .2rem;
}
.done-footer {
  width: 100%; margin-top: .7rem; color: #c49a48; font-family: 'Noto Serif TC', serif; font-size: .875rem; letter-spacing: .08em;
}
.done-footer::before, .done-footer::after { content: ' — '; color: rgba(196, 154, 72, .48); }
.worship-done button:focus-visible { outline: 3px solid var(--gold-bright); outline-offset: 3px; }
@media (max-width: 340px) { .done-media-primary { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .done-zhicheng, .rec-status, .save-rec-hint { animation: none; }
}

/* ============ 主站 landing ============ */
.landing { min-height: 100svh; background:
  radial-gradient(60% 42% at 50% 0%, rgba(156, 52, 52, .28), transparent),
  radial-gradient(52% 40% at 50% 100%, rgba(212, 169, 78, .13), transparent), var(--bg); }
.wrap { max-width: 720px; margin: 0 auto; padding: 0 1.2rem; }
.hero { text-align: center; padding: 4.2rem 0 2.6rem; }
.hero .logo { font-size: 2.35rem; font-weight: 900; letter-spacing: .22em; color: var(--gold-bright);
  font-family: 'Noto Serif TC', serif; text-shadow: 0 0 30px rgba(240, 201, 108, .35); }
.hero .tagline { margin-top: .9rem; font-size: 1.12rem; color: var(--cream); letter-spacing: .12em; }
.hero .sub { margin-top: .5rem; color: var(--dim); font-size: 1rem; }
.steps3 { display: flex; gap: .8rem; margin: 2rem 0; }
.steps3 > div { flex: 1; text-align: center; padding: 1.1rem .6rem; border: 1px solid rgba(212, 169, 78, .25);
  border-radius: 12px; background: rgba(38, 24, 12, .45); }
.steps3 b { display: block; color: var(--gold); margin-bottom: .3rem; font-size: 1rem; }
.steps3 span { font-size: .9rem; color: var(--dim); }

/* wizard */
.wizard { padding-bottom: 4rem; }
.wz-step { display: none; }
.wz-step.on { display: block; animation: fadein .35s; }
@keyframes fadein { from { opacity: 0; transform: translateY(10px); } }
.wz-title { font-size: 1.3rem; font-weight: 900; color: var(--gold-bright); letter-spacing: .2em;
  margin: 1.6rem 0 1.1rem; font-family: 'Noto Serif TC', serif; text-align: center; }
.deity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .9rem; }
.deity-card { position: relative; border: 2px solid rgba(212, 169, 78, .3); border-radius: 12px; overflow: hidden;
  background: var(--wood-dark); transition: .18s; }
.deity-card img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.deity-card figcaption { padding: .5rem .4rem .7rem; text-align: center; }
.deity-card b { display: block; font-size: 1rem; color: var(--cream); }
.deity-card span { font-size: .85rem; color: var(--dim); }
.deity-card.sel { border-color: var(--gold-bright); box-shadow: 0 0 22px rgba(240, 201, 108, .4); transform: translateY(-3px); }
.deity-card[data-slot]::before {
  content: attr(data-slot); position: absolute; top: 6px; left: 6px; z-index: 2;
  padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700;
  letter-spacing: .12em; background: linear-gradient(160deg, var(--gold-bright), var(--gold));
  color: #241505; box-shadow: 0 2px 8px rgba(0, 0, 0, .45);
}
.deity-card[data-slot="同祀"]::before { background: rgba(20, 12, 6, .85); color: var(--gold); border: 1px solid var(--gold); }
.deity-card.upload-card { display: flex; align-items: center; justify-content: center; aspect-ratio: auto; min-height: 200px;
  border-style: dashed; color: var(--dim); text-align: center; font-size: 1rem; cursor: pointer; }
.field { margin: 1rem 0; }
.field label { display: block; font-size: .95rem; color: var(--dim); margin-bottom: .4rem; letter-spacing: .1em; }
.field input, .field textarea, .field select {
  width: 100%; padding: .85rem 1rem; border-radius: 10px; font-size: 1.15rem;
  border: 1.5px solid rgba(212, 169, 78, .4); background: rgba(18, 10, 5, .7); color: var(--cream);
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--gold-bright); }
.url-preview { text-align: center; margin: 1rem 0; padding: 1rem; border-radius: 12px;
  background: rgba(38, 24, 12, .5); border: 1px dashed rgba(212, 169, 78, .4);
  font-size: 1.25rem; font-family: 'Noto Serif TC', serif; color: var(--gold-bright); word-break: break-all; }
.check-msg { text-align: center; font-size: .95rem; min-height: 1.4em; }
.check-msg.ok { color: #8fd18f; } .check-msg.bad { color: #e08585; }
.wz-nav { display: flex; justify-content: space-between; gap: 1rem; margin-top: 1.6rem; }
.footer { text-align: center; padding: 2.2rem 1rem 3rem; color: #6d5f4d; font-size: .95rem; line-height: 2; }

/* ============ BLESS.TW English landing — Sacred Encounter ============ */
.landing-en {
  --en-ink: #090706;
  --en-panel: #17100c;
  --en-panel-light: #21160f;
  --en-gold: #d8ad57;
  --en-gold-bright: #f0d38a;
  --en-vermilion: #8f2f26;
  --en-cream: #f4ead8;
  --en-muted: #b8aa96;
  min-height: 100svh;
  background:
    radial-gradient(circle at 75% 7%, rgba(160, 104, 34, .2), transparent 29rem),
    radial-gradient(circle at 5% 46%, rgba(117, 34, 27, .12), transparent 30rem),
    linear-gradient(180deg, #100b08, #080605 72%);
  color: var(--en-cream);
  font-family: 'Noto Sans TC', 'Helvetica Neue', Arial, sans-serif;
}
.landing-en::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .28;
  background-image: linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 88%); mask-image: linear-gradient(to bottom, #000, transparent 88%);
}
.landing-en main { display: block; }
.landing-en .en-skip {
  position: fixed; left: 1rem; top: 1rem; z-index: 100; transform: translateY(-180%);
  padding: .6rem 1rem; border-radius: 999px; background: var(--en-gold-bright); color: var(--en-ink); font-weight: 700;
}
.landing-en .en-skip:focus { transform: none; }
.landing-en .en-nav {
  position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  width: min(1180px, calc(100% - 2rem)); min-height: 76px; margin: 0 auto; padding: .8rem 0;
  border-bottom: 1px solid rgba(216, 173, 87, .2);
}
.landing-en .en-nav::before {
  content: ''; position: fixed; left: 0; right: 0; top: 0; height: 76px; z-index: -1;
  background: rgba(12, 8, 6, .78); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.landing-en .en-brand {
  display: inline-flex; align-items: center; gap: .65rem; width: max-content;
  color: var(--en-gold-bright); font-family: 'Noto Serif TC', Georgia, serif; font-size: 1.02rem; font-weight: 900;
  letter-spacing: .18em;
}
.landing-en .en-brand-mark {
  position: relative; display: inline-block; width: 24px; height: 24px; border: 1px solid rgba(240, 211, 138, .7); transform: rotate(45deg);
}
.landing-en .en-brand-mark::after {
  content: ''; position: absolute; inset: 5px; border: 1px solid rgba(240, 211, 138, .75);
}
.landing-en .en-nav-links { display: flex; align-items: center; justify-content: center; gap: 1.6rem; }
.landing-en .en-nav-links a {
  color: var(--en-muted); font-size: .76rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  transition: color .2s ease;
}
.landing-en .en-nav-links a:hover { color: var(--en-gold-bright); }
.landing-en .en-language {
  justify-self: end; padding: .4rem .9rem; border: 1px solid rgba(216, 173, 87, .36); border-radius: 999px;
  color: var(--en-gold-bright); font-size: .85rem; letter-spacing: .08em;
}
.landing-en .en-hero {
  position: relative; display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(300px, .92fr); align-items: center; gap: clamp(2rem, 6vw, 6rem);
  width: min(1180px, calc(100% - 2rem)); min-height: min(800px, calc(100svh - 76px)); margin: 0 auto; padding: clamp(3.5rem, 7vw, 6rem) 0 6rem;
}
.landing-en .en-hero-copy { position: relative; z-index: 2; animation: en-rise .75s ease both; }
.landing-en .en-eyebrow, .landing-en .en-kicker {
  color: var(--en-gold); font-size: .72rem; font-weight: 700; letter-spacing: .22em; line-height: 1.5; text-transform: uppercase;
}
.landing-en .en-eyebrow { display: flex; align-items: center; gap: .8rem; margin-bottom: 1.5rem; }
.landing-en .en-eyebrow::before { content: ''; width: 42px; height: 1px; background: var(--en-gold); }
.landing-en .en-hero h1 {
  max-width: 13.2ch; color: var(--en-cream); font-family: 'Noto Serif TC', Georgia, serif;
  font-size: clamp(2.65rem, 5.6vw, 5.55rem); font-weight: 900; line-height: 1.03; letter-spacing: -.045em;
}
.landing-en .en-hero h1 span { display: block; margin-top: .34em; color: var(--en-gold-bright); }
.landing-en .en-lead {
  max-width: 610px; margin-top: 1.7rem; color: var(--en-muted); font-size: clamp(1rem, 1.25vw, 1.12rem); line-height: 1.8;
}
.landing-en .en-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 1rem 1.5rem; margin-top: 2rem; }
.landing-en .en-button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: .8rem 1.45rem;
  border: 1px solid var(--en-gold-bright); border-radius: 2px;
  background: linear-gradient(135deg, var(--en-gold-bright), #bd8b37); color: #1b1108;
  font-size: .78rem; font-weight: 900; letter-spacing: .13em; text-transform: uppercase;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .28), 0 0 24px rgba(216, 173, 87, .12); transition: transform .2s ease, box-shadow .2s ease;
}
.landing-en .en-button:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(0, 0, 0, .35), 0 0 32px rgba(216, 173, 87, .2); }
.landing-en .en-text-link {
  position: relative; padding: .7rem 0; color: var(--en-cream); font-size: .8rem; font-weight: 700; letter-spacing: .08em;
}
.landing-en .en-text-link::after { content: ''; position: absolute; left: 0; right: 0; bottom: .45rem; height: 1px; background: rgba(216, 173, 87, .55); }
.landing-en .en-hero-guardian {
  position: relative; align-self: center; justify-self: center; width: min(100%, 430px); padding: 1.2rem 1.2rem 1.5rem;
  text-align: center; animation: en-rise .9s .1s ease both;
}
.landing-en .en-halo {
  position: absolute; left: 50%; top: 42%; width: 112%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 211, 138, .3), rgba(216, 173, 87, .08) 45%, transparent 69%);
  filter: blur(2px); animation: en-halo 5s ease-in-out infinite;
}
.landing-en .en-guardian-frame {
  position: relative; padding: 10px; border: 1px solid rgba(216, 173, 87, .48);
  background: linear-gradient(145deg, rgba(216, 173, 87, .1), rgba(0,0,0,.42));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5), 0 0 60px rgba(216, 173, 87, .08);
}
.landing-en .en-guardian-frame::before, .landing-en .en-guardian-frame::after {
  content: ''; position: absolute; width: 34px; height: 34px; border-color: var(--en-gold-bright); opacity: .72;
}
.landing-en .en-guardian-frame::before { left: -7px; top: -7px; border-left: 1px solid; border-top: 1px solid; }
.landing-en .en-guardian-frame::after { right: -7px; bottom: -7px; border-right: 1px solid; border-bottom: 1px solid; }
.landing-en .en-guardian-frame img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; object-position: center; filter: saturate(.9) contrast(1.04); }
.landing-en .en-hero-guardian > p {
  position: relative; margin-top: 1.25rem; color: var(--en-gold-bright); font-family: 'Noto Serif TC', Georgia, serif; font-size: 1rem; font-weight: 900; letter-spacing: .22em;
}
.landing-en .en-hero-guardian > p span { margin-left: .5rem; color: var(--en-muted); font-size: .82rem; letter-spacing: .12em; }
.landing-en .en-hero-guardian > small { position: relative; display: block; margin-top: .35rem; color: var(--en-muted); font-size: .74rem; letter-spacing: .08em; }
.landing-en .en-scroll-note {
  position: absolute; left: 0; bottom: 1.5rem; display: flex; align-items: center; gap: .75rem;
  color: rgba(184, 170, 150, .65); font-size: .65rem; font-weight: 700; letter-spacing: .2em;
}
.landing-en .en-scroll-note span { display: block; width: 48px; height: 1px; background: rgba(216, 173, 87, .5); }
.landing-en .en-section {
  width: min(1120px, calc(100% - 2rem)); margin: 0 auto; padding: clamp(4.8rem, 9vw, 8.5rem) 0; scroll-margin-top: 5rem;
}
.landing-en .en-section h2, .landing-en .en-closing h2 {
  color: var(--en-cream); font-family: 'Noto Serif TC', Georgia, serif; font-size: clamp(2.1rem, 4.2vw, 4.4rem); font-weight: 900; line-height: 1.08; letter-spacing: -.035em;
}
.landing-en .en-kicker { margin-bottom: 1.25rem; }
.landing-en .en-intro {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 2rem 7vw; align-items: end;
  border-top: 1px solid rgba(216, 173, 87, .2); border-bottom: 1px solid rgba(216, 173, 87, .2);
}
.landing-en .en-intro > .en-kicker { grid-column: 1 / -1; }
.landing-en .en-intro-copy { display: grid; gap: 1rem; padding-bottom: .4rem; }
.landing-en .en-intro-copy p, .landing-en .en-section-heading > p, .landing-en .en-address-copy > p, .landing-en .en-taiwan-copy > p {
  color: var(--en-muted); font-size: 1rem; line-height: 1.85;
}
.landing-en .en-section-heading { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(240px, .65fr); align-items: end; gap: 2rem 6vw; margin-bottom: 2.5rem; }
.landing-en .en-section-heading > p { max-width: 440px; padding-bottom: .25rem; }
.landing-en .en-guardian-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.landing-en .en-guardian-card {
  overflow: hidden; border: 1px solid rgba(216, 173, 87, .2); background: linear-gradient(165deg, rgba(34, 22, 14, .9), rgba(15, 10, 7, .96));
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.landing-en .en-guardian-card:hover { transform: translateY(-4px); border-color: rgba(240, 211, 138, .55); box-shadow: 0 22px 50px rgba(0,0,0,.35); }
.landing-en .en-guardian-image { position: relative; overflow: hidden; background: #130d09; }
.landing-en .en-guardian-image img { display: block; width: 100%; aspect-ratio: 4 / 4.7; object-fit: cover; object-position: center 20%; transition: transform .55s ease; }
.landing-en .en-guardian-card:hover .en-guardian-image img { transform: scale(1.025); }
.landing-en .en-guardian-image::after { content: ''; position: absolute; inset: auto 0 0; height: 34%; background: linear-gradient(transparent, rgba(10, 7, 5, .84)); }
.landing-en .en-guardian-image > span {
  position: absolute; right: .9rem; bottom: .7rem; z-index: 1; color: rgba(240, 211, 138, .78); font-family: 'Noto Serif TC', Georgia, serif; font-size: .76rem; letter-spacing: .12em;
}
.landing-en .en-guardian-content { padding: 1.25rem 1.3rem 1.5rem; }
.landing-en .en-domain { color: var(--en-gold); font-size: .64rem; font-weight: 700; letter-spacing: .17em; }
.landing-en .en-guardian-name { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; margin: .4rem 0 .75rem; }
.landing-en .en-guardian-name h3 { color: var(--en-cream); font-family: 'Noto Serif TC', Georgia, serif; font-size: 1.45rem; letter-spacing: -.02em; }
.landing-en .en-guardian-name > p { flex: 0 0 auto; color: var(--en-gold-bright); font-family: 'Noto Serif TC', serif; font-size: .9rem; letter-spacing: .08em; }
.landing-en .en-guardian-content > p:last-child { color: var(--en-muted); font-size: .86rem; line-height: 1.75; }
.landing-en .en-practice {
  position: relative; width: 100%; max-width: none; padding-inline: max(1rem, calc((100vw - 1120px) / 2));
  background: linear-gradient(135deg, rgba(119, 35, 28, .16), rgba(35, 23, 13, .36));
  border-top: 1px solid rgba(216, 173, 87, .13); border-bottom: 1px solid rgba(216, 173, 87, .13);
}
.landing-en .en-practice-intro { max-width: 770px; }
.landing-en .en-practice-stories {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 3rem;
}
.landing-en .en-practice-story {
  overflow: hidden; border: 1px solid rgba(216, 173, 87, .22); background: #100b08;
}
.landing-en .en-practice-photo { position: relative; overflow: hidden; background: #17100c; }
.landing-en .en-practice-photo::after {
  content: ''; position: absolute; inset: auto 0 0; height: 35%; pointer-events: none;
  background: linear-gradient(transparent, rgba(16, 11, 8, .82));
}
.landing-en .en-practice-photo img {
  display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; filter: saturate(.88) contrast(1.04);
  transition: transform .55s ease, filter .55s ease;
}
.landing-en .en-practice-story:hover .en-practice-photo img { transform: scale(1.025); filter: saturate(1) contrast(1.03); }
.landing-en .en-practice-story figcaption { padding: 1.35rem 1.4rem 1.6rem; }
.landing-en .en-practice-story figcaption > span {
  color: var(--en-gold); font-size: .65rem; font-weight: 700; letter-spacing: .18em;
}
.landing-en .en-practice-story h3 {
  margin-top: .65rem; color: var(--en-cream); font-family: 'Noto Serif TC', Georgia, serif; font-size: 1.28rem; line-height: 1.35;
}
.landing-en .en-practice-story p { margin-top: .65rem; color: var(--en-muted); font-size: .86rem; line-height: 1.75; }
.landing-en .en-practice-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 3rem; background: rgba(216, 173, 87, .2); }
.landing-en .en-practice-grid article { min-height: 245px; padding: 1.6rem; background: #100b08; }
.landing-en .en-practice-grid article > span { color: var(--en-gold); font-family: 'Noto Serif TC', Georgia, serif; font-size: .7rem; letter-spacing: .16em; }
.landing-en .en-practice-grid h3 { margin-top: 4.2rem; color: var(--en-cream); font-family: 'Noto Serif TC', Georgia, serif; font-size: 1.25rem; }
.landing-en .en-practice-grid p { margin-top: .7rem; color: var(--en-muted); font-size: .86rem; line-height: 1.75; }
.landing-en .en-address-section { display: grid; grid-template-columns: minmax(0, .85fr) minmax(420px, 1.15fr); align-items: center; gap: 3rem 7vw; }
.landing-en .en-address-copy > p { max-width: 540px; margin-top: 1.5rem; }
.landing-en .en-address-visual { position: relative; padding: 2rem; border: 1px solid rgba(216, 173, 87, .28); background: rgba(27, 18, 12, .62); box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.landing-en .en-address-visual::before { content: ''; position: absolute; inset: 9px; pointer-events: none; border: 1px solid rgba(216, 173, 87, .1); }
.landing-en .en-address-label { position: relative; color: var(--en-muted); font-size: .65rem; font-weight: 700; letter-spacing: .2em; }
.landing-en .en-address-card {
  position: relative; margin: 2.3rem 0; color: var(--en-cream); font-family: 'Noto Serif TC', Georgia, serif;
  font-size: clamp(1.5rem, 3.7vw, 3.15rem); font-weight: 900; letter-spacing: -.025em; white-space: nowrap;
}
.landing-en .en-address-card span { color: var(--en-gold-bright); }
.landing-en .en-address-contents { position: relative; display: flex; flex-wrap: wrap; gap: .55rem; }
.landing-en .en-address-contents span { padding: .38rem .7rem; border: 1px solid rgba(216, 173, 87, .22); color: var(--en-muted); font-size: .7rem; letter-spacing: .06em; }
.landing-en .en-taiwan { display: grid; grid-template-columns: minmax(260px, .65fr) minmax(0, 1.35fr); align-items: center; gap: 3rem 8vw; border-top: 1px solid rgba(216, 173, 87, .2); }
.landing-en .en-taiwan-mark {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; border: 1px solid rgba(216, 173, 87, .28); border-radius: 50%;
  background: radial-gradient(circle, rgba(216, 173, 87, .16), rgba(216, 173, 87, .02) 55%, transparent 72%);
}
.landing-en .en-taiwan-mark::before, .landing-en .en-taiwan-mark::after { content: ''; position: absolute; border: 1px solid rgba(216, 173, 87, .18); border-radius: 50%; }
.landing-en .en-taiwan-mark::before { inset: 9%; }
.landing-en .en-taiwan-mark::after { inset: 20%; }
.landing-en .en-taiwan-mark span { position: absolute; top: 23%; color: var(--en-gold); font-size: .65rem; font-weight: 700; letter-spacing: .3em; }
.landing-en .en-taiwan-mark strong { color: var(--en-gold-bright); font-family: 'Noto Serif TC', serif; font-size: clamp(2.3rem, 5vw, 4.1rem); letter-spacing: .12em; }
.landing-en .en-taiwan-copy > p:not(.en-kicker) { max-width: 680px; margin-top: 1.2rem; }
.landing-en .en-closing {
  position: relative; overflow: hidden; width: min(1180px, calc(100% - 2rem)); margin: 0 auto 4rem; padding: clamp(5rem, 10vw, 9rem) 1rem;
  border: 1px solid rgba(216, 173, 87, .24); background: radial-gradient(circle at 50% 30%, rgba(216, 173, 87, .16), transparent 44%), rgba(20, 13, 9, .7); text-align: center;
}
.landing-en .en-closing-lines { position: absolute; inset: 1rem; pointer-events: none; border: 1px solid rgba(216, 173, 87, .1); }
.landing-en .en-closing h2 { position: relative; max-width: 13ch; margin: 0 auto; }
.landing-en .en-closing > p:not(.en-kicker) { position: relative; max-width: 540px; margin: 1.2rem auto 2rem; color: var(--en-muted); line-height: 1.75; }
.landing-en .en-closing .en-button { position: relative; }
.landing-en .en-footer {
  display: grid; grid-template-columns: 1fr minmax(280px, 1.4fr) 1fr; align-items: center; gap: 1rem;
  width: min(1180px, calc(100% - 2rem)); margin: 0 auto; padding: 1.5rem 0 4rem; border-top: 1px solid rgba(216, 173, 87, .18);
  color: rgba(184, 170, 150, .68); font-size: .72rem; line-height: 1.6;
}
.landing-en .en-footer > p:nth-child(2) { text-align: center; }
.landing-en .en-footer > p:last-child { justify-self: end; }
.landing-en .en-footer a:not(.en-brand) { color: var(--en-muted); }
.landing-en a:focus-visible { outline: 2px solid var(--en-gold-bright); outline-offset: 4px; }
@keyframes en-rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes en-halo { 0%, 100% { opacity: .75; transform: translate(-50%, -50%) scale(.98); } 50% { opacity: 1; transform: translate(-50%, -50%) scale(1.04); } }
@media (max-width: 900px) {
  .landing-en .en-nav { grid-template-columns: 1fr auto; }
  .landing-en .en-nav-links { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; gap: 1.3rem; overflow-x: auto; padding: .65rem 0 .1rem; scrollbar-width: none; }
  .landing-en .en-nav-links::-webkit-scrollbar { display: none; }
  .landing-en .en-nav::before { height: 112px; }
  .landing-en .en-hero { grid-template-columns: minmax(0, 1fr) minmax(250px, .72fr); min-height: auto; padding-top: 5rem; }
  .landing-en .en-hero h1 { font-size: clamp(2.5rem, 6.8vw, 4.5rem); }
  .landing-en .en-guardian-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-en .en-practice-stories { grid-template-columns: 1fr; }
  .landing-en .en-practice-story { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(240px, .82fr); align-items: stretch; }
  .landing-en .en-practice-photo img { height: 100%; aspect-ratio: auto; }
  .landing-en .en-practice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .landing-en .en-address-section { grid-template-columns: 1fr; }
  .landing-en .en-address-visual { width: min(100%, 680px); }
}
@media (max-width: 620px) {
  .landing-en .en-nav { width: min(100% - 1.25rem, 1180px); min-height: 68px; }
  .landing-en .en-nav::before { height: 105px; }
  .landing-en .en-brand { font-size: .9rem; }
  .landing-en .en-nav-links { gap: 1.05rem; }
  .landing-en .en-nav-links a { font-size: .67rem; }
  .landing-en .en-language { padding: .3rem .65rem; font-size: .78rem; }
  .landing-en .en-hero { grid-template-columns: 1fr; width: min(100% - 1.5rem, 1180px); gap: 3.3rem; padding: 4.2rem 0 5.5rem; }
  .landing-en .en-hero h1 { max-width: 14ch; font-size: clamp(2.45rem, 12vw, 3.55rem); }
  .landing-en .en-lead { font-size: .96rem; }
  .landing-en .en-actions { align-items: stretch; flex-direction: column; }
  .landing-en .en-button { width: 100%; }
  .landing-en .en-text-link { width: max-content; align-self: center; }
  .landing-en .en-hero-guardian { width: min(88vw, 370px); }
  .landing-en .en-scroll-note { display: none; }
  .landing-en .en-section { width: min(100% - 1.5rem, 1120px); padding-block: 5.5rem; }
  .landing-en .en-intro, .landing-en .en-section-heading, .landing-en .en-taiwan { grid-template-columns: 1fr; }
  .landing-en .en-intro { align-items: start; }
  .landing-en .en-guardian-grid { grid-template-columns: 1fr; }
  .landing-en .en-guardian-image img { aspect-ratio: 4 / 4.35; }
  .landing-en .en-practice { width: 100%; padding-inline: .75rem; }
  .landing-en .en-practice-stories { gap: .8rem; }
  .landing-en .en-practice-story { display: block; }
  .landing-en .en-practice-photo img { height: auto; aspect-ratio: 3 / 2; }
  .landing-en .en-practice-grid { grid-template-columns: 1fr; }
  .landing-en .en-practice-grid article { min-height: 205px; }
  .landing-en .en-practice-grid h3 { margin-top: 2.8rem; }
  .landing-en .en-address-visual { padding: 1.4rem; }
  .landing-en .en-address-card { margin: 1.8rem 0; font-size: clamp(1.28rem, 7.4vw, 2.1rem); }
  .landing-en .en-taiwan-mark { width: min(75vw, 310px); justify-self: center; }
  .landing-en .en-closing { width: calc(100% - 1.5rem); margin-bottom: 2rem; padding-inline: 1.2rem; }
  .landing-en .en-footer { grid-template-columns: 1fr; width: calc(100% - 1.5rem); text-align: center; }
  .landing-en .en-footer .en-brand, .landing-en .en-footer > p:last-child { justify-self: center; }
}
@media (prefers-reduced-motion: reduce) {
  .landing-en *, .landing-en *::before, .landing-en *::after {
    scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
  }
}

/* 成功頁 / 通用卡 */
.holy-card { max-width: 560px; margin: 8vh auto; padding: 2.2rem 1.6rem; text-align: center;
  border: 2px solid var(--gold); border-radius: 16px; background: rgba(30, 18, 9, .72);
  box-shadow: 0 12px 60px var(--shadow), 0 0 60px rgba(240, 201, 108, .12); }

/* PWA 安裝引導 */
.pwa-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; transform: translateY(105%);
  transition: transform .38s cubic-bezier(.2, .9, .3, 1);
  background: linear-gradient(180deg, #2c1c0e, #1a100a); border-radius: 20px 20px 0 0;
  border-top: 2px solid var(--gold); padding: 1.4rem 1.3rem calc(1.6rem + env(safe-area-inset-bottom));
  text-align: center; }
.pwa-sheet.show { transform: none; }
.pwa-sheet h3 { color: var(--gold-bright); letter-spacing: .2em; font-size: 1.15rem; margin-bottom: .5rem; }
.pwa-sheet p { font-size: 1rem; color: var(--cream); }
.pwa-sheet .install-steps { text-align: left; margin: .8rem auto 0; max-width: 330px; font-size: .95rem; color: var(--dim); line-height: 1.8; }

/* 分享 modal */
.share-modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .78); padding: 1.2rem; }
.share-modal.show { display: flex; }
.share-box { text-align: center; max-width: 340px; }
.share-box img { border-radius: 14px; border: 1px solid rgba(212, 169, 78, .5); max-height: 62vh; }
.share-actions { display: flex; gap: .7rem; justify-content: center; margin-top: 1rem; }

/* 眾神祈願列表（東牆） */
.wish-row { display: flex; gap: .8rem; align-items: baseline; padding: .35rem 0; }
.wish-row + .wish-row { border-top: 1px dashed rgba(212, 169, 78, .25); }
.wish-row b { flex: 0 0 auto; font-size: 1rem; color: var(--gold-bright); letter-spacing: .1em; }
.wish-row span { font-size: 1.05rem; }

/* 分享模板選擇 */
.theme-chips { display: flex; gap: .6rem; justify-content: center; margin-top: .8rem; }
.theme-chips button {
  padding: .45rem 1.1rem; border-radius: 999px; font-size: .92rem; letter-spacing: .1em;
  background: rgba(38, 24, 12, .8); border: 1.5px solid rgba(212, 169, 78, .4); color: var(--dim);
}
.theme-chips button.on { color: #241505; background: linear-gradient(160deg, var(--gold-bright), var(--gold)); border-color: var(--gold-bright); font-weight: 700; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 16vh; transform: translateX(-50%) translateY(20px);
  z-index: 90; background: rgba(20, 12, 6, .92); border: 1px solid var(--gold); color: var(--cream);
  padding: .6rem 1.3rem; border-radius: 999px; font-size: 1rem; opacity: 0; transition: .3s; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%); }
body::before {
  content: 'v207';
  position: fixed; right: calc(.65rem + env(safe-area-inset-right)); bottom: calc(.5rem + env(safe-area-inset-bottom));
  z-index: 30; color: rgba(183, 168, 147, .62); font-size: .68rem; line-height: 1; letter-spacing: .05em;
  pointer-events: none; user-select: none;
}

@media (max-width: 640px) {
  /* Font1：基準 17px 不分裝置，手機不得降級 */
  .stage { perspective: 900px; }
  .deity-frame img { width: min(62vw, 260px); }
  .steps3 { flex-direction: column; }
  .wall-nav { display: none; }
  .inner-wall-nav { display: none; }
  .outer-north-portal {
    width: min(calc(100% - 1rem), 680px);
    padding: calc(94px + env(safe-area-inset-top)) .75rem calc(108px + env(safe-area-inset-bottom));
  }
  .outer-north-portal::before {
    inset: calc(82px + env(safe-area-inset-top)) 0 calc(94px + env(safe-area-inset-bottom)); border-radius: 18px;
  }
  .outer-north-summary { max-height: 19vh; margin-block: .9rem; }
  .inner-hall-back { max-width: 118px; overflow: hidden; white-space: nowrap; }
  .inner-wall-position { max-width: calc(100vw - 8.5rem); }
  .shrine-map { bottom: calc(1.35rem + env(safe-area-inset-bottom)); }
  .shrine-map-panel { max-height: calc(100svh - 8.5rem - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto; }
  .offering-table-scene { min-height: 250px; }
  .offering-table-edit-actions { flex-wrap: wrap; }
  .offering-table-edit-actions span { flex: 1 1 100%; margin: 0; text-align: center; }
  .altar-management-sheet {
    max-height: calc(100svh - max(12px, env(safe-area-inset-top)));
  }
}
@media (prefers-reduced-motion: reduce) {
  .room.snap { transition: none; }
  .deity-halo { animation: none; }
  .offering-table-scene canvas, .offering-table-detail { transition: none; }
  .altar-management-sheet { animation: none; }
  .room.turning .wall, .inner-hall, .shrine-map-panel { transition: none; animation: none; }
  .inner-hall-stage,
  .inner-hall.turning-out .inner-hall-stage,
  .inner-hall.turning-enter .inner-hall-stage,
  .inner-hall.turning-settle .inner-hall-stage {
    transform: none; transition: opacity 90ms linear;
  }
  .inner-hall.gate-reveal .inner-hall-stage { animation: none; }
  .inner-hall.turning-out .inner-hall-stage,
  .inner-hall.turning-enter .inner-hall-stage { opacity: .12; }
  .inner-hall.turning-settle .inner-hall-stage { opacity: 1; }
  .inner-light-aura { box-shadow: inset 0 0 34px rgba(240, 201, 108, .16); }
}

@media (max-width: 340px) {
  .outer-north-copy { font-size: .9rem; }
  .outer-north-summary span { font-size: .72rem; padding-inline: .5rem; }
  .shrine-map-panel { width: calc(100vw - 1rem); padding: .65rem; }
  .outer-compass { grid-template-rows: repeat(3, minmax(50px, auto)); }
  .inner-map-head > span { display: none; }
}

/* ============ 求籤／擲筊 儀式 ============ */
.rite-overlay {
  position: fixed; inset: 0; z-index: 70; display: none;
  align-items: center; justify-content: center; overflow: hidden;   /* 揭曉推近不外溢→無 scrollbar */
  background: radial-gradient(circle at 50% 35%, rgba(60, 38, 12, .96), rgba(8, 5, 2, .99) 75%);
}
.rite-overlay.open { display: flex; }
#fortuneOverlay.open:not(.has-result) {
  align-items: flex-start; justify-content: center; overflow-y: auto;
}
.rite-overlay .worship-cancel { left: 1rem; right: auto; }   /* ✕ 移左上，讓右上給守護神 */
/* 守護神像＋名牌：貼在儀式面板（rite-inner）右上角，非螢幕右上 */
.rite-deity {
  position: absolute; z-index: 4; top: -1.6rem; right: -.4rem;
  width: 84px; text-align: center; pointer-events: none;
}
.rite-deity img {
  display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover;
  border: 2.5px solid var(--gold); border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .6), 0 0 26px rgba(240, 201, 108, .2);
}
.rite-deity span {
  display: inline-block; margin-top: .3rem; padding: .08rem .55rem;
  background: linear-gradient(160deg, var(--red), var(--red-deep));
  border: 1.5px solid var(--gold); border-radius: 5px;
  font-family: 'Noto Serif TC', serif; font-weight: 900; font-size: .76rem;
  letter-spacing: .08em; color: var(--gold-bright); white-space: nowrap;
}
/* .rite-inner 不裁切（守護神名牌 .rite-deity 掛在右上角、稍微溢出面板）；捲動交給內層 .rite-scroll */
.rite-inner { position: relative; text-align: center; width: min(92vw, 420px); }
.rite-scroll { max-height: 92svh; overflow-y: auto; padding: 3.4rem 1.5rem 1.5rem; }
.rite-hint { color: var(--cream); font-size: 1.05rem; letter-spacing: .12em; margin: 1rem 0; }
/* 求籤時守護神是儀式主角：置中放大，不再縮在右上角。 */
#fortuneOverlay .fortune-deity {
  position: relative; top: auto; right: auto; width: clamp(139px, 38vw, 182px); margin: 0 auto;
  isolation: isolate;
}
#fortuneOverlay:not(.has-result) .fortune-deity {
  position: absolute; top: calc(1rem + env(safe-area-inset-top)); left: 50%; right: auto;
  transform: translateX(-50%); margin: 0; width: clamp(139px, 38vw, 182px);
}
#fortuneOverlay:not(.has-result) .fortune-deity::before,
#fortuneOverlay:not(.has-result) .fortune-deity::after {
  content: ''; position: absolute; pointer-events: none; border-radius: 50%; z-index: -1;
  left: 50%; top: 42%; transform: translate(-50%, -50%);
}
#fortuneOverlay:not(.has-result) .fortune-deity::before {
  width: 178%; aspect-ratio: 1;
  background: repeating-conic-gradient(from 0deg,
    rgba(255, 236, 175, 0) 0deg,
    rgba(255, 236, 175, .34) 4deg,
    rgba(255, 236, 175, 0) 13deg,
    rgba(255, 236, 175, 0) 28deg);
  -webkit-mask: radial-gradient(circle, transparent 0 16%, rgba(0, 0, 0, .72) 30%, transparent 72%);
          mask: radial-gradient(circle, transparent 0 16%, rgba(0, 0, 0, .72) 30%, transparent 72%);
  opacity: .72; mix-blend-mode: screen;
  animation: deity-rays 24s linear infinite, fortune-aura-breathe 6.8s ease-in-out infinite;
}
#fortuneOverlay:not(.has-result) .fortune-deity::after {
  width: 152%; aspect-ratio: 1;
  background: radial-gradient(circle,
    rgba(255, 244, 205, .38) 0%,
    rgba(240, 201, 108, .24) 34%,
    rgba(240, 201, 108, .09) 58%,
    transparent 74%);
  filter: blur(1px); mix-blend-mode: screen;
  animation: fortune-aura-spread 5.8s ease-in-out infinite;
}
#fortuneOverlay .fortune-deity img {
  position: relative; z-index: 1;
  border: 3px solid var(--gold); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .68), 0 0 38px rgba(240, 201, 108, .3);
}
#fortuneOverlay .fortune-deity span { position: relative; z-index: 2; margin-top: .45rem; padding: .16rem .8rem; font-size: .9rem; }
@keyframes fortune-aura-breathe { 0%, 100% { opacity: .48; } 50% { opacity: .9; } }
@keyframes fortune-aura-spread {
  0%, 100% { opacity: .42; transform: translate(-50%, -50%) scale(.9); }
  52% { opacity: .86; transform: translate(-50%, -50%) scale(1.18); }
}
#fortuneOverlay .rite-scroll { padding-top: calc(1rem + env(safe-area-inset-top)); padding-bottom: calc(2.2rem + env(safe-area-inset-bottom)); }
#fortuneOverlay:not(.has-result) .rite-scroll {
  max-height: none; overflow: visible;
  padding-top: calc(1rem + env(safe-area-inset-top) + clamp(185px, 51vw, 243px) + 4.2rem);
}
.fortune-intent {
  padding: 1.2rem 1rem 1rem; border: 1.5px solid rgba(240, 201, 108, .68); border-radius: 16px;
  background: linear-gradient(160deg, rgba(56, 34, 14, .92), rgba(22, 13, 7, .95));
  box-shadow: 0 16px 40px rgba(0, 0, 0, .4), inset 0 0 24px rgba(240, 201, 108, .07);
}
.fortune-kicker { color: var(--gold); font-size: .82rem; font-weight: 700; letter-spacing: .3em; }
.fortune-intent h2 { margin-top: .2rem; font-family: 'Noto Serif TC', serif; font-size: 1.45rem; letter-spacing: .16em; color: var(--gold-bright); }
.fortune-intent-note { margin: .35rem auto .95rem; color: var(--cream); font-size: .92rem; line-height: 1.75; letter-spacing: .08em; }
.fortune-intent-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .55rem; }
.fortune-intent-options button {
  min-height: 44px; border: 1px solid rgba(212, 169, 78, .5); border-radius: 10px;
  background: rgba(15, 10, 6, .6); color: var(--cream); font: inherit; font-size: .94rem; letter-spacing: .08em;
}
.fortune-intent-options button.on {
  border-color: var(--gold-bright); background: linear-gradient(160deg, var(--gold-bright), var(--gold));
  color: #241505; font-weight: 700; box-shadow: 0 0 18px rgba(240, 201, 108, .26);
}
.fortune-custom {
  margin-top: .75rem; padding: .75rem .8rem; border: 1px solid rgba(212, 169, 78, .36); border-radius: 12px;
  background: rgba(12, 7, 3, .48); text-align: left;
}
.fortune-custom label {
  display: block; margin-bottom: .45rem; color: var(--gold); font-size: .78rem; font-weight: 700; letter-spacing: .12em;
}
.fortune-custom input {
  width: 100%; min-height: 44px; border: 1px solid rgba(240, 201, 108, .42); border-radius: 10px;
  background: rgba(8, 5, 3, .72); color: var(--cream); padding: 0 .8rem; font: inherit; font-size: .94rem;
  outline: none;
}
.fortune-custom input:focus { border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(240, 201, 108, .14); }
#intentContinueBtn { width: 100%; min-height: 52px; margin-top: 1rem; }
.rite-intent, .sc-ask {
  display: flex; align-items: center; justify-content: center; gap: .45rem; margin: 0 auto .9rem;
  color: var(--cream); font-size: .9rem; letter-spacing: .12em;
}
.rite-intent span, .sc-ask span { color: var(--dim); }
.rite-intent b, .sc-ask b { color: var(--gold-bright); font-family: 'Noto Serif TC', serif; font-size: 1.08rem; letter-spacing: .2em; }
/* 手機窄面板時，擲筊提示是首列會頂到右上守護神名牌 → 下移避開（求籤提示在籤筒之後不受影響） */
@media (max-width: 460px) {
  #jiaoOverlay .rite-hint { margin-top: 3.6rem; }
}
@media (max-height: 700px) {
  #fortuneOverlay:not(.has-result) .fortune-deity { width: clamp(125px, 34vw, 161px); }
  #fortuneOverlay:not(.has-result) .rite-scroll { padding-top: calc(1rem + env(safe-area-inset-top) + clamp(167px, 45vw, 215px) + 2.8rem); }
  .fortune-intent { padding: .8rem .8rem; }
}

/* 求得籤後：神明退居右上，讓籤卡與解籤操作優先進入手機視線。 */
#fortuneOverlay.has-result .rite-inner { height: 100dvh; }
#fortuneOverlay.has-result {
  --fortune-scroll-pad: 1rem;
  --fortune-card-pad: 1.15rem;
  --fortune-deity-w: 81px;
  --fortune-head-gap: .85rem;
  --fortune-result-top: calc(3.6rem + env(safe-area-inset-top));
}
#fortuneOverlay.has-result .fortune-deity {
  position: absolute; top: calc(var(--fortune-result-top) + var(--fortune-card-pad)); right: calc(var(--fortune-scroll-pad) + var(--fortune-card-pad)); z-index: 4;
  width: var(--fortune-deity-w); margin: 0;
}
#fortuneOverlay.has-result .fortune-deity img {
  border: 2.5px solid var(--gold); border-radius: 8px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .6), 0 0 26px rgba(240, 201, 108, .2);
}
#fortuneOverlay.has-result .fortune-deity span { margin-top: .3rem; padding: .08rem .55rem; font-size: .76rem; }
#fortuneOverlay.has-result .rite-scroll {
  height: 100%; max-height: none; overflow-y: auto;
  padding: calc(3.6rem + env(safe-area-inset-top)) var(--fortune-scroll-pad) calc(1.25rem + env(safe-area-inset-bottom));
  touch-action: pan-y; overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
}
#fortuneOverlay.has-result .stick-card {
  position: relative; overflow: hidden;
  border: 1px solid rgba(212, 169, 78, .66); border-radius: 18px;
  padding: var(--fortune-card-pad) var(--fortune-card-pad) .95rem;
  background:
    linear-gradient(90deg, rgba(64, 35, 13, .26), transparent 19%, transparent 81%, rgba(64, 35, 13, .26)),
    radial-gradient(circle at 18% 10%, rgba(204, 133, 38, .09), transparent 31%),
    linear-gradient(165deg, rgba(51, 28, 11, .97), rgba(25, 13, 6, .985)),
    url('/assets/textures/frame.jpg');
  background-size: cover;
  box-shadow: 0 18px 42px rgba(0, 0, 0, .34), inset 0 0 0 1px rgba(255, 227, 151, .035), inset 0 -34px 80px rgba(0, 0, 0, .15);
}
#fortuneOverlay.has-result .stick-card::before,
#fortuneOverlay.has-result .stick-card::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 58px; opacity: .23; pointer-events: none;
  background:
    radial-gradient(circle at 50% 28px, transparent 0 9px, rgba(212, 169, 78, .16) 9px 10px, transparent 11px),
    radial-gradient(circle at 50% 76px, transparent 0 14px, rgba(212, 169, 78, .11) 14px 15px, transparent 16px);
  background-size: 58px 104px;
}
#fortuneOverlay.has-result .stick-card::before { left: 0; }
#fortuneOverlay.has-result .stick-card::after { right: 0; transform: scaleX(-1); }
#fortuneOverlay.has-result .sc-head {
  position: relative; z-index: 1;
  min-height: 118px; justify-content: flex-start; align-items: center;
  margin-bottom: .35rem; padding-right: calc(var(--fortune-deity-w) + var(--fortune-head-gap));
}
#fortuneOverlay.has-result .sc-head-meta {
  display: grid; grid-template-columns: max-content; grid-template-rows: auto auto;
  gap: .45rem; text-align: left;
}
#fortuneOverlay.has-result .sc-head-primary { display: flex; align-items: center; gap: .65rem; }
#fortuneOverlay.has-result .sc-level-summary {
  grid-row: 2; justify-self: start; display: flex; flex-direction: column;
  align-items: flex-start; gap: .2rem;
}
#fortuneOverlay.has-result .sc-level {
  display: inline-flex;
  padding: .12rem .7rem; font-size: .95rem;
}
#fortuneOverlay.has-result .sc-level-summary[hidden],
#fortuneOverlay.has-result .sc-guidance[hidden] { display: none !important; }
#fortuneOverlay.has-result .sc-poem {
  position: relative; z-index: 1;
  display: flex; flex-direction: row-reverse; align-items: stretch; justify-content: center;
  width: fit-content; max-width: 100%; margin: calc(1.45rem + 8px) auto .55rem;
  border: 1px solid rgba(221, 183, 96, .72); border-radius: 2px;
  background: rgba(24, 12, 5, .28);
  box-shadow: inset 0 0 0 3px rgba(255, 226, 153, .035), 0 7px 20px rgba(0, 0, 0, .14);
  font-size: 1.6rem; line-height: 1.35; letter-spacing: .26em;
  white-space: normal;
}
#fortuneOverlay.has-result .sc-poem .poem-line {
  display: block; box-sizing: border-box;
  min-width: 3.25rem; height: 10.2em; padding: .82rem .62rem .68rem;
  writing-mode: vertical-rl; text-orientation: upright;
  text-align: center; text-align-last: auto;
}
#fortuneOverlay.has-result .sc-poem .poem-line + .poem-line {
  border-right: 1px solid rgba(212, 169, 78, .42);
}
#fortuneOverlay.has-result .sc-guidance {
  position: relative; z-index: 1;
  max-width: 32rem; margin: .85rem auto .45rem; padding: .62rem .82rem;
  border-left: 2px solid rgba(212, 169, 78, .72); border-radius: 0 8px 8px 0;
  background: rgba(34, 21, 10, .58); color: #ead8b5;
  font-size: .88rem; line-height: 1.7; letter-spacing: .025em; text-align: left;
}
#fortuneOverlay.has-result .sc-story,
#fortuneOverlay.has-result .sc-deity,
#fortuneOverlay.has-result .sc-ask { position: relative; z-index: 1; }
#fortuneOverlay.has-result .sc-deity { margin: .45rem auto .3rem; font-size: .78rem; }
#fortuneOverlay.has-result .sc-ask { margin: .45rem auto 0; font-size: .82rem; }
#fortuneOverlay.has-result .fortune-result-details {
  margin-top: .9rem; padding-bottom: 0;
  text-align: center;
}
#fortuneOverlay.has-result .fortune-result-details .sc-jie-toggle {
  min-height: 42px; margin-bottom: .85rem; padding: 0 1.3rem;
  background: rgba(18, 11, 6, .55);
  box-shadow: 0 7px 18px rgba(0, 0, 0, .16);
}
#fortuneOverlay.has-result .fortune-result-details .sc-jie,
#fortuneOverlay.has-result .fortune-result-details .sc-ai,
#fortuneOverlay.has-result .fortune-result-details .sc-chat { margin-bottom: 1rem; }
#fortuneOverlay.has-result .sc-actions { gap: .65rem; }
#fortuneOverlay.has-result .sc-actions .btn { border-radius: 999px; }
#fortuneOverlay.has-result .sc-actions #aiBtn {
  min-height: 56px; margin-top: .05rem;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .27), inset 0 1px rgba(255, 247, 201, .45);
}
#fortuneOverlay.has-result .sc-actions .btn-ghost {
  min-height: 50px;
  background: rgba(12, 7, 3, .52);
  box-shadow: none;
}
#fortuneOverlay.has-result .fortune-result-details .sc-note { margin-top: .8rem; font-size: .72rem; }

/* 桌面版讓結果區使用整個視窗捲動，避免 AI 解籤展開後的捲軸卡在中央。 */
@media (min-width: 640px) {
  #fortuneOverlay.has-result .rite-inner { width: 100%; }
  #fortuneOverlay.has-result .rite-scroll {
    scrollbar-gutter: stable both-edges;
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 169, 78, .5) transparent;
  }
  #fortuneOverlay.has-result .rite-scroll::-webkit-scrollbar { width: 8px; }
  #fortuneOverlay.has-result .rite-scroll::-webkit-scrollbar-track { background: transparent; }
  #fortuneOverlay.has-result .rite-scroll::-webkit-scrollbar-thumb {
    border: 2px solid transparent; border-radius: 999px;
    background: rgba(212, 169, 78, .48); background-clip: padding-box;
  }
  #fortuneOverlay.has-result .stick-card,
  #fortuneOverlay.has-result .fortune-result-details {
    width: 420px; max-width: calc(100vw - var(--fortune-scroll-pad) - var(--fortune-scroll-pad));
    margin-left: auto; margin-right: auto;
  }
  #fortuneOverlay.has-result .fortune-deity {
    right: calc(50% - 210px + var(--fortune-card-pad));
  }
}

/* 自訂照片轉 3D：嵌入供品商店，預覽層獨立於 bottom sheet 上方 */
.custom3d-panel { margin-top:1rem; padding:1rem; border:1px solid rgba(212,169,78,.35); border-radius:14px; background:rgba(25,15,8,.7); }
.custom3d-panel h3 { color:var(--gold-bright); margin:0 0 .35rem; }
.custom3d-panel p { color:var(--dim); line-height:1.55; }
.custom3d-file { display:grid; gap:.45rem; margin:.85rem 0; color:var(--cream); }
.custom3d-file input { min-height:44px; max-width:100%; color:var(--cream); }
.custom3d-actions { display:flex; flex-wrap:wrap; gap:.6rem; }
.custom3d-actions .btn, .custom3d-job button { min-height:44px; }
.custom3d-message[data-state="error"] { color:#ff9d91; }
.custom3d-message[data-state="ok"] { color:#b9dc9d; }
.custom3d-jobs { display:grid; gap:.65rem; margin-top:.8rem; }
.custom3d-job { display:flex; flex-wrap:wrap; align-items:center; gap:.5rem; padding:.75rem; border-radius:10px; background:rgba(255,255,255,.05); }
.custom3d-job strong, .custom3d-job p { flex-basis:100%; margin:0; }
.custom3d-job button { border:1px solid rgba(212,169,78,.45); border-radius:999px; padding:.45rem .8rem; background:rgba(20,12,6,.9); color:var(--cream); }
.custom3d-preview { position:fixed; inset:0; z-index:330; display:grid; place-items:center; padding:1rem; -webkit-user-select:none; user-select:none; }
.custom3d-preview[hidden] { display:none; }
.custom3d-preview-backdrop { position:absolute; inset:0; border:0; background:rgba(3,2,1,.82); }
.custom3d-preview > section { position:relative; width:min(92vw,480px); border:1px solid rgba(212,169,78,.55); border-radius:18px; overflow:hidden; background:#160e08; box-shadow:0 20px 70px #000; }
.custom3d-preview header { display:flex; align-items:center; justify-content:space-between; padding:.75rem 1rem; }
.custom3d-preview h2 { margin:0; color:var(--gold-bright); font-size:1.05rem; }
.custom3d-preview header button { width:44px; height:44px; border:0; background:transparent; color:var(--cream); font-size:1.6rem; }
#custom3dPreviewCanvas { display:block; width:100%; aspect-ratio:1/1; touch-action:none; background:radial-gradient(circle at 50% 38%,#5b3b20,#120b07 68%); }
#custom3dPreviewStatus { min-height:1.5em; margin:.65rem 1rem 1rem; color:var(--dim); text-align:center; }

/* 神光乍現：求籤賜籤／擲筊聖筊的即時回饋，與上香完成的金光同一套視覺語言 */
.divine-burst { position: absolute; left: 50%; top: 50%; width: 0; height: 0; z-index: 8; pointer-events: none; }
.divine-burst > span { position: absolute; left: 0; top: 0; opacity: 0; transform: translate(-50%, -50%); border-radius: 50%; mix-blend-mode: screen; }
.divine-burst .db-flash {
  width: 62vmin; height: 62vmin; animation: db-flash .9s ease-out forwards;
  background: radial-gradient(circle, rgba(255, 244, 206, .95) 0%, rgba(240, 201, 108, .55) 32%, rgba(240, 201, 108, 0) 66%);
}
.divine-burst .db-ring { width: 24vmin; height: 24vmin; border: 2px solid rgba(255, 228, 158, .9); animation: db-ring 1s ease-out forwards; }
.divine-burst .db-ring.r2 { animation-delay: .12s; }
.divine-burst .db-rays {
  width: 84vmin; height: 84vmin; animation: db-rays 1s ease-out forwards;
  background: repeating-conic-gradient(from 0deg, rgba(255, 231, 160, 0) 0deg, rgba(255, 231, 160, .5) 2.5deg, rgba(255, 231, 160, 0) 8deg);
  -webkit-mask: radial-gradient(circle, #000 22%, rgba(0, 0, 0, .6) 40%, transparent 70%);
          mask: radial-gradient(circle, #000 22%, rgba(0, 0, 0, .6) 40%, transparent 70%);
}
.divine-burst.soft .db-rays, .divine-burst.dim .db-rays { display: none; }
.divine-burst.soft .db-flash { background: radial-gradient(circle, rgba(255, 236, 196, .7) 0%, rgba(224, 178, 96, .35) 36%, transparent 68%); }
.divine-burst.dim .db-ring { border-color: rgba(180, 184, 196, .5); }
.divine-burst.dim .db-flash { background: radial-gradient(circle, rgba(200, 205, 220, .34) 0%, rgba(120, 130, 150, .16) 40%, transparent 70%); }
@keyframes db-flash { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.25); } 22% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1.12); } }
@keyframes db-ring { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3); } 25% { opacity: .95; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(2.6); } }
@keyframes db-rays { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.2) rotate(0deg); } 30% { opacity: .7; } 100% { opacity: 0; transform: translate(-50%, -50%) scale(1) rotate(16deg); } }
@media (prefers-reduced-motion: reduce) {
  .divine-burst { display: none; }
  #fortuneOverlay .fortune-deity::before,
  #fortuneOverlay .fortune-deity::after { animation: none; }
}

/* 籤筒 */
.tube { position: relative; width: 120px; height: 170px; margin: 0 auto; }
.tube-body {
  position: absolute; bottom: 0; left: 0; right: 0; height: 130px;
  background: linear-gradient(90deg, #5a3a1a, #8a5c2c 30%, #a8763c 50%, #8a5c2c 70%, #4a2f14);
  border: 2px solid var(--gold); border-radius: 10px 10px 16px 16px;
  display: flex; align-items: center; justify-content: center;
}
.tube-body span {
  font-family: 'Noto Serif TC', serif; font-size: 2.2rem; font-weight: 900; color: var(--gold-bright);
  border: 2px solid rgba(240, 201, 108, .6); border-radius: 50%; width: 64px; height: 64px;
  display: flex; align-items: center; justify-content: center; background: rgba(60, 34, 12, .55);
}
.tsticks { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 86px; height: 52px; }
.tsticks i {
  position: absolute; bottom: 0; width: 7px; height: 48px; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, #e8c98e, #b98d4f);
}
.tsticks i:nth-child(1){left:2px;height:40px;transform:rotate(-8deg)} .tsticks i:nth-child(2){left:15px;height:50px;transform:rotate(-4deg)}
.tsticks i:nth-child(3){left:28px;height:44px} .tsticks i:nth-child(4){left:41px;height:52px;transform:rotate(2deg)}
.tsticks i:nth-child(5){left:54px;height:42px;transform:rotate(5deg)} .tsticks i:nth-child(6){left:66px;height:48px;transform:rotate(8deg)}
.tsticks i:nth-child(7){left:76px;height:38px;transform:rotate(11deg)}
.tube.shaking { animation: tube-shake .18s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes tube-shake {
  0%,100% { transform: rotate(-6deg) translateY(0); }
  25% { transform: rotate(5deg) translateY(-3px); }
  50% { transform: rotate(-4deg) translateY(-1px); }
  75% { transform: rotate(6deg) translateY(-3px); }
}
.tube.shaking .tsticks i { animation: stick-jump .22s ease-in-out infinite alternate; }
@keyframes stick-jump { to { transform: translateY(-9px); } }

/* 籤紙卡 */
.stick-card {
  background:
    linear-gradient(165deg, rgba(52, 30, 12, .97), rgba(28, 16, 8, .99)),
    url('/assets/textures/frame.jpg'); background-size: cover;
  border: 3px solid var(--gold); border-radius: 14px; padding: 1.4rem 1.2rem 1rem;
  box-shadow: 0 24px 60px rgba(0,0,0,.7), 0 0 44px rgba(240,201,108,.16);
  animation: card-in .5s cubic-bezier(.2,.9,.3,1.2);
  text-align: center;
}
@keyframes card-in { from { transform: translateY(26px) scale(.92); opacity: 0; } }
.sc-head { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-bottom: .8rem; }
.sc-no { font-family: 'Noto Serif TC', serif; font-size: 1.15rem; font-weight: 900; letter-spacing: .2em; color: var(--cream); }
.sc-level {
  padding: .18rem .9rem; border-radius: 6px; border: 2px solid var(--gold);
  font-family: 'Noto Serif TC', serif; font-weight: 900; font-size: 1.05rem; letter-spacing: .2em;
  background: linear-gradient(160deg, var(--red), var(--red-deep)); color: var(--gold-bright);
}
.sc-level-source {
  color: rgba(230, 215, 190, .7); font-size: .7rem; line-height: 1.45;
  letter-spacing: .04em;
}
/* 三套籤系吉凶用語（關帝 大吉/上上…、觀音 上/中/下籤）統一為六色階 */
.sc-level.lv-top { border-color: var(--gold-bright); box-shadow: 0 0 12px rgba(212, 169, 78, .4); }
.sc-level.lv-good { background: linear-gradient(160deg, var(--red), var(--red-deep)); color: var(--gold-bright); }
.sc-level.lv-midgood { background: linear-gradient(160deg, #6e3a1e, #4a2413); color: var(--gold); }
.sc-level.lv-mid { background: rgba(40, 28, 14, .9); color: var(--cream); }
.sc-level.lv-lowmid { background: rgba(50, 30, 14, .92); color: #e6c79a; border-color: #a9803f; }
.sc-level.lv-low { background: rgba(60, 30, 10, .95); color: #f0b48a; border-color: #c98a5a; }
.sc-code { font-family: 'Noto Serif TC', serif; font-size: .95rem; font-weight: 700; color: var(--gold); letter-spacing: .25em; }
.sc-poem {
  font-family: 'Noto Serif TC', serif; font-size: 1.2rem; font-weight: 700; line-height: 2.05;
  letter-spacing: .18em; color: var(--gold-bright); margin: .4rem 0 .6rem; white-space: pre-line;
}
.sc-story { color: var(--dim); font-size: .82rem; letter-spacing: .12em; margin: -.1rem 0 .7rem; }
.sc-deity { color: var(--dim); font-size: .9rem; letter-spacing: .25em; margin-bottom: .8rem; }
.sc-jie-toggle {
  display: inline-block; margin: 0 0 .6rem; cursor: pointer;
  padding: .32rem 1rem; font-size: .82rem; letter-spacing: .12em; color: var(--gold);
  background: rgba(20, 13, 7, .5); border: 1px dashed rgba(212, 169, 78, .55); border-radius: 999px;
}
.sc-jie {
  text-align: left; background: rgba(18, 11, 6, .66); border-left: 3px solid var(--gold);
  border-radius: 8px; padding: .8rem 1rem; margin: 0 0 .8rem;
  color: var(--cream); font-family: 'Noto Serif TC', serif; font-size: .92rem; line-height: 1.95;
  letter-spacing: .06em; white-space: pre-line;
}
.sc-ai {
  text-align: left; background: rgba(14, 9, 5, .72); border: 1px solid rgba(212, 169, 78, .35);
  border-radius: 10px; padding: .9rem 1rem; margin: .4rem 0 .8rem;
  color: var(--cream); font-size: .98rem; line-height: 1.85;
}
.sc-ai.loading { text-align: center; color: var(--gold); animation: hint-pulse 1.6s ease-in-out infinite; }
.sc-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.sc-actions .btn { min-width: 0; min-height: 48px; padding: .7rem .55rem; white-space: nowrap; }
.sc-actions #aiBtn { grid-column: 1 / -1; }
.sc-note { margin-top: .6rem; font-size: .78rem; color: var(--dim); letter-spacing: .15em; }

/* 擲筊：雙面 3D 筊杯（結果烘進旋轉角度，落地即正確面）＋自然拋物＋揭曉推近 */
.jiao-pit {
  position: relative; height: 230px; display: flex; gap: 2.4rem;
  align-items: flex-end; justify-content: center; padding-bottom: 1.2rem;
  transition: transform .5s cubic-bezier(.2, .9, .3, 1.25);
}
.jiao-pit.reveal { transform: scale(1.55) translateY(-16px); }
.jiao-pit::before {   /* 揭曉金光 */
  content: ''; position: absolute; inset: -30%; pointer-events: none; opacity: 0;
  background: radial-gradient(circle at 50% 68%, rgba(240, 201, 108, .4), transparent 60%);
  transition: opacity .4s;
}
.jiao-pit.reveal::before { opacity: 1; }
.jiao-slot { position: relative; }
.jiao {
  position: relative; width: 92px; height: 44px;
  transform-style: preserve-3d; will-change: transform;
}
.jiao i { position: absolute; inset: 0; backface-visibility: hidden; }
.jiao .fd {   /* 凸面（覆／反） */
  border-radius: 52px 52px 12px 12px;
  background: linear-gradient(180deg, #d0584a 0%, #a03428 55%, #7c241a 100%);
  box-shadow: inset 0 3px 8px rgba(255,255,255,.18), inset 0 -4px 8px rgba(0,0,0,.3);
}
.jiao .ff {   /* 平面（仰／正） */
  transform: rotateX(180deg);
  border-radius: 12px 12px 52px 52px;
  background: linear-gradient(180deg, #ecA08c 0%, #c25a48 40%, #93301f 100%);
  box-shadow: inset 0 2px 4px rgba(255,255,255,.4), inset 0 -3px 8px rgba(0,0,0,.25);
}
.jshadow {
  width: 74px; height: 13px; margin: 8px auto 0; border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, .6), transparent 70%);
}
.jiao-result {
  min-height: 3.2rem; font-family: 'Noto Serif TC', serif; font-weight: 900;
  font-size: 1.5rem; letter-spacing: .25em; color: var(--gold-bright); margin: 1rem 0 .2rem;
}
.jiao-result small { display: block; font-family: 'Noto Sans TC', sans-serif; font-weight: 400; font-size: .95rem; letter-spacing: .1em; color: var(--cream); margin-top: .3rem; }
.jiao-streak { min-height: 1.6rem; color: var(--gold); font-size: .95rem; letter-spacing: .2em; margin-bottom: .6rem; }
.jiao-result.holy { animation: holy-pop .5s cubic-bezier(.2,.9,.3,1.4); }
@keyframes holy-pop { from { transform: scale(.6); opacity: 0; } }

/* 求籤 AI 對話 */
.sc-chat { margin: .2rem 0 .8rem; }
.chat-log { text-align: left; max-height: 34vh; overflow-y: auto; }
.chat-msg { margin: .4rem 0; display: flex; }
.chat-msg.u { justify-content: flex-end; }
.chat-bubble {
  max-width: 84%; padding: .55rem .8rem; border-radius: 12px; font-size: .95rem; line-height: 1.7;
}
.chat-msg.u .chat-bubble { background: linear-gradient(160deg, var(--gold), #a87f2f); color: #241505; border-bottom-right-radius: 4px; }
.chat-msg.a .chat-bubble { background: rgba(14, 9, 5, .8); border: 1px solid rgba(212, 169, 78, .35); color: var(--cream); border-bottom-left-radius: 4px; }
.chat-msg.a.think .chat-bubble { color: var(--gold); animation: hint-pulse 1.6s ease-in-out infinite; }
.chat-row { display: flex; gap: .4rem; margin-top: .5rem; }
.chat-row input {
  flex: 1; min-width: 0; padding: .55rem .8rem; border-radius: 999px;
  background: rgba(20, 12, 6, .8); border: 1.5px solid rgba(212, 169, 78, .4); color: var(--cream); font-size: .92rem;
}
.chat-send {
  flex: 0 0 auto; width: 42px; border-radius: 50%; font-size: 1.1rem;
  background: linear-gradient(160deg, var(--gold-bright), var(--gold)); color: #241505; border: none;
}
.chat-send:disabled { opacity: .5; }

/* 次列儀式鈕 */
.cta-row.sub { margin-top: .6rem; }
.cta-row.sub .btn-ghost { padding: .5rem 1.4rem; font-size: .95rem; }

/* ===== site-nav：sticky 毛玻璃頂欄（手機優先） ===== */
.site-nav {
  position: sticky; top: 0; z-index: 50;
  margin: 0 calc(-1 * var(--wrap-pad, 1rem)); padding: 0 var(--wrap-pad, 1rem);
  background: rgba(26,18,11,.82);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(212,169,78,.25);
}
.site-nav-inner { max-width: 960px; margin: 0 auto; }
.site-nav-top {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem; padding: .6rem 0 .35rem;
}
.site-nav-brand {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--gold-bright); font-weight: 700; text-decoration: none;
  font-size: 1.05rem; white-space: nowrap;
}
.site-nav-brand .torii { font-size: 1.15rem; line-height: 1; }
.site-nav-login {
  color: var(--gold); text-decoration: none; font-size: .88rem; white-space: nowrap;
  padding: .3rem .85rem; border: 1px solid rgba(212,169,78,.45); border-radius: 999px;
}
.site-nav-links {
  display: flex; gap: .25rem; overflow-x: auto; padding: .1rem 0 .5rem;
  scrollbar-width: none; -ms-overflow-style: none;
}
.site-nav-links::-webkit-scrollbar { display: none; }
.site-nav-links a {
  display: inline-flex; align-items: center; gap: .3rem;
  color: var(--cream); text-decoration: none; font-size: .92rem; white-space: nowrap;
  padding: .3rem .7rem; border-radius: 999px; background: rgba(255,255,255,.05);
}
.site-nav-links a:active { background: rgba(212,169,78,.22); }
@media (min-width: 640px) {
  .site-nav-top { padding: .7rem 0 .4rem; }
  .site-nav-links { justify-content: center; }
  .site-nav-links a:hover { background: rgba(212,169,78,.18); color: var(--gold-bright); }
}
