:root {
  --bg: #06150f;
  --g900: #0a2a20;
  --g800: #0e3a2c;
  --g600: #1b6b50;
  --g400: #3fae86;
  --gold: #e2bf6a;
  --gold2: #f6e2a2;
  --ink: #eaf4ee;
  --muted: rgba(234, 244, 238, 0.66);
  --glass: rgba(8, 36, 27, 0.64);
  --glass2: rgba(12, 50, 38, 0.78);
  --line: rgba(226, 191, 106, 0.3);
  --danger: #e07a6a;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --serif: 'Noto Serif TC', 'Songti TC', 'PingFang TC', 'Microsoft JhengHei', serif;
  --sans: 'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHei', system-ui, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: var(--sans); overscroll-behavior: none; }
body { position: fixed; inset: 0; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; user-select: none; -webkit-user-select: none; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold2); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
.center { text-align: center; }
h1, h2, h3, h4 { font-family: var(--serif); margin: 0; }
h4 { margin: 18px 0 8px; color: var(--gold2); font-size: 0.98rem; }

/* 載入 */
.loading { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 12px; background: radial-gradient(ellipse at 50% 40%, #11402f, var(--bg) 70%); font-family: var(--serif); color: var(--gold2); }
.loading-icon { animation: breathe 2.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.06); opacity: 0.85; } }

/* 按鈕 */
.btn { min-height: 46px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.07); font-weight: 600; letter-spacing: 0.04em; transition: background 0.15s, transform 0.1s; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }
.btn:active:not(:disabled) { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: linear-gradient(180deg, #f1d583, #c99a3c); color: #2a1d05; border-color: #f6e2a2; box-shadow: 0 6px 20px rgba(201, 154, 60, 0.35); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #f7e0a0, #d3a548); }
.btn.big { min-height: 54px; font-size: 1.1rem; width: 100%; }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(224, 122, 106, 0.6); color: #ffc9bf; }
.btn small { opacity: 0.75; font-weight: 400; }
.input { width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.28); }
.input::placeholder { color: rgba(234, 244, 238, 0.4); }
.area { resize: vertical; min-height: 84px; line-height: 1.5; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); }
.chip.on { background: var(--gold); color: #2a1d05; border-color: var(--gold2); font-weight: 700; }
.chip:disabled { opacity: 0.45; }
.tabs { display: flex; gap: 6px; background: rgba(0, 0, 0, 0.25); padding: 4px; border-radius: 14px; }
.tab { flex: 1; min-height: 40px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; }
.tab.on { background: var(--gold); color: #2a1d05; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin: 12px 0; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0; }

/* 進入畫面 */
.entry { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l)); overflow-y: auto; background: radial-gradient(ellipse at 50% 100%, rgba(5, 20, 14, 0.5), rgba(5, 20, 14, 0.15)); }
.card { width: min(100%, 420px); padding: 18px 22px 20px; text-align: center; border-radius: 26px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px) saturate(1.25); -webkit-backdrop-filter: blur(16px) saturate(1.25); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
.preview { width: 150px; height: 180px; margin: -4px auto -2px; display: block; touch-action: pan-y; cursor: grab; }
.card h1 { font-size: clamp(2rem, 8vw, 2.5rem); font-weight: 900; letter-spacing: 0.18em; padding-left: 0.18em; background: linear-gradient(180deg, #fff2c0, #d9a947); -webkit-background-clip: text; background-clip: text; color: transparent; text-shadow: none; }
.sub { margin: 4px 0 10px; color: var(--gold); letter-spacing: 0.3em; padding-left: 0.3em; font-family: var(--serif); }
.mantra { margin: 0 0 14px; font-family: var(--serif); color: var(--gold2); font-size: 1.02rem; line-height: 1.6; letter-spacing: 0.08em; }
.field { display: block; text-align: left; margin-bottom: 12px; }
.field span { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; margin-bottom: 10px; background: rgba(0, 0, 0, 0.28); border-radius: 14px; }
.seg button { min-height: 44px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; }
.seg button.on { background: var(--gold); color: #2a1d05; }
.check { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 12px 0 4px; min-height: 40px; }
.check input { width: 22px; height: 22px; accent-color: var(--gold); }
#nameHint { margin: 4px 0 14px; }
.legal { margin: 14px 0 0; font-size: 0.78rem; color: var(--muted); }

/* HUD */
.hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; }
.hud > * { pointer-events: auto; }
.topbar { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 10px calc(12px + var(--safe-l)); pointer-events: none; }
.topbar > * { pointer-events: auto; }
.who { display: grid; gap: 2px; padding: 8px 14px; border-radius: 16px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); min-width: 0; }
.who-name { font-family: var(--serif); font-weight: 600; color: var(--gold2); max-width: 36vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-net { font-size: 0.78rem; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #999; display: inline-block; }
.dot.ok { background: #5be3a0; box-shadow: 0 0 8px #5be3a0; }
.dot.wait { background: #e3c25b; animation: breathe 1.2s infinite; }
.dot.solo { background: #8aa; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pill { min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-size: 0.88rem; font-weight: 600; }
.pill b { color: var(--gold2); margin-left: 4px; }
.pill[aria-pressed='true'] { background: var(--gold); color: #2a1d05; }
.feed { position: absolute; left: calc(12px + var(--safe-l)); top: calc(74px + var(--safe-t)); display: grid; gap: 4px; max-width: min(64vw, 340px); pointer-events: none !important; }
.feed-item { font-size: 0.8rem; line-height: 1.35; padding: 3px 10px; border-radius: 10px; background: rgba(5, 25, 18, 0.55); color: #f1ead0; text-shadow: 0 1px 2px #000; animation: feedin 0.4s ease-out; transition: opacity 0.8s; width: fit-content; max-width: 100%; overflow-wrap: anywhere; }
.feed-item.out { opacity: 0; }
@keyframes feedin { from { transform: translateX(-14px); opacity: 0; } }
.lap { position: absolute; top: calc(70px + var(--safe-t)); left: 50%; transform: translateX(-50%); padding: 6px 16px; border-radius: 999px; background: var(--glass2); border: 1px solid var(--line); color: var(--gold2); font-family: var(--serif); pointer-events: none !important; }
.joy { position: absolute; left: calc(18px + var(--safe-l)); bottom: calc(112px + var(--safe-b)); width: 118px; height: 118px; border-radius: 50%; background: rgba(8, 36, 27, 0.45); border: 1px solid var(--line); touch-action: none; display: none; }
@media (pointer: coarse), (hover: none) { .joy { display: block; } }
.joy-knob { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff1bd, #c99a3c); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4); pointer-events: none; }

/* 儀式列 */
.ritualbar { position: absolute; left: 0; right: 0; bottom: 0; padding: 0 0 calc(8px + var(--safe-b)); pointer-events: none; }
.ritual-scroll { display: flex; gap: 8px; overflow-x: auto; padding: 8px calc(12px + var(--safe-r)) 6px calc(12px + var(--safe-l)); scrollbar-width: none; scroll-snap-type: x proximity; pointer-events: auto; -webkit-overflow-scrolling: touch; mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 20px), transparent 100%); -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 20px), transparent 100%); }
.ritual-scroll::-webkit-scrollbar { display: none; }
.rbtn { position: relative; flex: 0 0 auto; width: 64px; min-height: 68px; padding: 8px 4px 6px; display: grid; justify-items: center; gap: 4px; border-radius: 18px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); scroll-snap-align: start; transition: transform 0.12s, background 0.15s; }
.rbtn:hover { background: var(--glass2); }
.rbtn:active { transform: scale(0.95); }
.rbtn.busy { background: var(--gold); color: #2a1d05; }
.rglyph { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; font-family: var(--serif); font-weight: 900; font-size: 1.1rem; color: #2a1d05; background: radial-gradient(circle at 35% 30%, #fff1bd, #d3a548); }
.rlabel { font-size: 0.7rem; line-height: 1.15; white-space: nowrap; }
.rbadge { position: absolute; top: 2px; right: 4px; font-size: 0.65rem; background: var(--danger); border-radius: 8px; padding: 0 5px; }

/* toast */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(100px + var(--safe-b)); z-index: 60; display: grid; justify-items: center; gap: 6px; pointer-events: none; padding: 0 16px; }
.toast { max-width: min(92vw, 420px); padding: 9px 16px; border-radius: 14px; background: rgba(6, 28, 21, 0.9); border: 1px solid var(--line); color: var(--gold2); font-size: 0.9rem; line-height: 1.45; text-align: center; opacity: 0; transform: translateY(8px); transition: opacity 0.3s, transform 0.3s; overflow-wrap: anywhere; }
.toast.in { opacity: 1; transform: none; }

/* 面板 */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(2, 10, 7, 0.5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet-card { position: relative; width: min(100%, 460px); max-height: min(86vh, 760px); max-height: min(86dvh, 760px); display: flex; flex-direction: column; border-radius: 26px 26px 0 0; background: var(--glass2); border: 1px solid var(--line); border-bottom: 0; backdrop-filter: blur(20px) saturate(1.3); -webkit-backdrop-filter: blur(20px) saturate(1.3); box-shadow: 0 -14px 50px rgba(0, 0, 0, 0.5); animation: rise 0.28s ease-out; padding-bottom: var(--safe-b); }
.sheet-card.wide { width: min(100%, 560px); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px 22px; }
.sheet-title { font-size: 1.25rem; color: var(--gold2); letter-spacing: 0.12em; }
.sheet-close { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.06); font-size: 1.5rem; line-height: 1; }
.sheet-body { overflow-y: auto; padding: 6px 22px 22px; -webkit-overflow-scrolling: touch; }
@media (min-width: 700px) {
  .sheet { align-items: center; }
  .sheet-card { border-radius: 26px; border-bottom: 1px solid var(--line); padding-bottom: 0; }
  .rbtn { width: 72px; }
}

/* 持咒 */
.mantra-panel { display: grid; justify-items: center; gap: 4px; }
.mantra-panel .tabs { width: 100%; }
.mantra-name { margin-top: 12px; color: var(--muted); font-size: 0.9rem; letter-spacing: 0.1em; }
.mantra-text { margin: 4px 0 8px; text-align: center; font-family: var(--serif); font-weight: 600; font-size: clamp(1.3rem, 6vw, 1.7rem); line-height: 1.5; color: var(--gold2); letter-spacing: 0.1em; }
.tap { position: relative; width: 190px; height: 190px; border-radius: 50%; border: 0; background: radial-gradient(circle at 50% 40%, rgba(63, 174, 134, 0.35), rgba(10, 42, 32, 0.6)); display: grid; place-items: center; box-shadow: 0 0 40px rgba(63, 174, 134, 0.25); transition: transform 0.08s; }
.tap:active:not(:disabled) { transform: scale(0.96); }
.tap:disabled { filter: saturate(0.5); }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.12); stroke-width: 6; }
.ring-fg { fill: none; stroke: var(--gold); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 0.2s; }
.ring-count { position: relative; text-align: center; font-family: var(--serif); }
.ring-count b { display: block; font-size: 3rem; line-height: 1; color: #fff3c9; }
.ring-count span { color: var(--muted); font-size: 0.95rem; }

/* 經幡、祝福語 */
.flag-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 14px; }
.flag-btn { display: grid; justify-items: center; gap: 6px; padding: 10px 2px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); }
.flag-swatch { width: 34px; height: 44px; border-radius: 3px 3px 12px 3px; border: 1px solid rgba(255, 255, 255, 0.3); }
.flag-name { font-size: 0.8rem; }
.say-list { display: grid; gap: 8px; margin-top: 12px; }
.say-btn { min-height: 46px; padding: 8px 14px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); text-align: left; font-family: var(--serif); }
.say-btn:hover { background: rgba(255, 255, 255, 0.12); }

/* 許願 */
.wish-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.wish-list li { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }
.wish-theme { flex: 0 0 auto; font-size: 0.75rem; padding: 2px 8px; border-radius: 999px; background: var(--gold); color: #2a1d05; }
.wish-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, 0.08); }

/* 添酥油 */
.oil-zone { display: grid; justify-items: center; gap: 14px; margin-top: 12px; touch-action: none; user-select: none; -webkit-user-select: none; }
.oil-jar { position: relative; width: 120px; height: 150px; border-radius: 16px 16px 40px 40px; border: 2px solid var(--gold); background: rgba(0, 0, 0, 0.3); overflow: hidden; box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5); }
.oil-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(180deg, #ffe58a, #e0a62c); box-shadow: 0 -4px 14px rgba(255, 220, 120, 0.6); }
.oil-zone .btn { width: 100%; touch-action: none; }
.btn.active { background: var(--gold) !important; color: #2a1d05; }

/* 日曆 */
.cal-today { margin: 0 0 4px; font-family: var(--serif); color: var(--gold2); }
.cal-panel h3 { margin: 14px 0 8px; font-size: 1.05rem; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-w { text-align: center; font-size: 0.75rem; color: var(--muted); padding: 2px 0; }
.cal-c { position: relative; min-height: 44px; border-radius: 8px; padding: 3px 2px; text-align: center; background: rgba(255, 255, 255, 0.04); display: grid; align-content: center; }
.cal-c.empty { background: transparent; }
.cal-c .g { font-size: 0.92rem; line-height: 1.1; }
.cal-c .l { font-size: 0.62rem; color: var(--muted); line-height: 1.1; }
.cal-c.hot { background: rgba(226, 191, 106, 0.18); border: 1px solid var(--line); }
.cal-c .dot { position: absolute; top: 3px; right: 4px; width: 6px; height: 6px; background: var(--gold); }
.cal-c.today { outline: 2px solid var(--g400); }
.cal-list { margin: 8px 0 0; padding-left: 18px; font-size: 0.86rem; line-height: 1.7; }

/* 排行 */
.rank-list { list-style: none; padding: 0; margin: 12px 0; display: grid; gap: 6px; }
.rank-list li { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }
.rk { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: rgba(255, 255, 255, 0.1); flex: 0 0 auto; }
.rk.r1 { background: #e6c15a; color: #2a1d05; } .rk.r2 { background: #cfd5d6; color: #222; } .rk.r3 { background: #c98b55; color: #2a1d05; }
.rank-list .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-list .n { color: var(--gold2); font-variant-numeric: tabular-nums; }

/* 手帳、任務 */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stats.small { grid-template-columns: repeat(3, 1fr); }
.stat { display: grid; gap: 2px; padding: 10px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); text-align: center; }
.stat b { font-family: var(--serif); font-size: 1.3rem; color: var(--gold2); overflow-wrap: anywhere; }
.stat span { font-size: 0.78rem; color: var(--muted); }
.task-list { list-style: none; margin: 10px 0; padding: 0; display: grid; gap: 8px; }
.task-list li { position: relative; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; padding: 10px 12px 14px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); }
.task-list .ck { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: 0.9rem; }
.task-list li.done .ck { background: var(--gold); color: #2a1d05; border-color: var(--gold); }
.task-list .bar { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.task-list .bar i { display: block; height: 100%; background: var(--gold); }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.badge { display: grid; justify-items: center; gap: 2px; padding: 10px 6px; border-radius: 14px; background: rgba(0, 0, 0, 0.22); text-align: center; opacity: 0.5; }
.badge.got { opacity: 1; background: rgba(226, 191, 106, 0.14); border: 1px solid var(--line); }
.badge .bi { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 900; background: rgba(255, 255, 255, 0.1); }
.badge.got .bi { background: radial-gradient(circle at 35% 30%, #fff1bd, #d3a548); color: #2a1d05; }
.badge .bn { font-size: 0.82rem; font-weight: 600; }
.badge .bd { font-size: 0.68rem; line-height: 1.3; }

/* 設定 */
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.set-label { font-weight: 600; }
.switch { position: relative; flex: 0 0 auto; width: 54px; height: 32px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.1); padding: 0; }
.switch::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #ddd; transition: transform 0.2s; }
.switch[aria-checked='true'] { background: var(--g400); }
.switch[aria-checked='true']::after { transform: translateX(22px); background: #fff; }
.help ul { margin: 0; padding-left: 20px; line-height: 1.8; font-size: 0.9rem; color: var(--muted); }
.settings .btn.danger { width: 100%; margin-top: 16px; }
.legal-note { margin: 14px 0 0; text-align: center; font-size: 0.82rem; color: var(--gold); }

/* 導覽 */
.tutorial { position: fixed; inset: 0; z-index: 45; display: grid; place-items: end center; padding: 16px 16px calc(120px + var(--safe-b)); background: rgba(2, 10, 7, 0.45); }
.tut-card { width: min(100%, 400px); padding: 18px 20px; border-radius: 22px; background: var(--glass2); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.tut-card h3 { margin: 4px 0 6px; color: var(--gold2); }
.tut-card p { margin: 0 0 14px; line-height: 1.6; }
.tut-step { color: var(--muted); font-size: 0.8rem; }
.tut-actions { display: flex; gap: 10px; justify-content: flex-end; }
@media (min-width: 700px) { .tutorial { place-items: center; padding-bottom: 16px; } }

@media (max-width: 380px) { .who-name { max-width: 28vw; } .pill { padding: 0 10px; } .tap { width: 170px; height: 170px; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* 聲音模式、唐卡、素材來源 */
.seg3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; margin: 14px 0 10px; background: rgba(0, 0, 0, 0.28); border-radius: 14px; }
.seg3 button { min-height: 48px; border: 0; border-radius: 10px; background: transparent; font-weight: 600; }
.seg3 button.on { background: var(--gold); color: #2a1d05; }
.tk { display: grid; gap: 4px; }
.tk-frame { display: grid; place-items: center; min-height: 200px; max-height: 42vh; border-radius: 16px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); overflow: hidden; }
.tk-img { max-width: 100%; max-height: 42vh; object-fit: contain; display: block; }
.tk-deity { margin-top: 8px; color: var(--gold2); font-family: var(--serif); font-weight: 700; font-size: 1.05rem; }
.tk-title { line-height: 1.5; }
.tk a, .credits a { color: var(--gold2); }
.credits h5 { margin: 12px 0 4px; font-size: 0.9rem; color: var(--gold); }
.credit-list { margin: 0; padding-left: 18px; display: grid; gap: 8px; font-size: 0.85rem; line-height: 1.5; }
.cr-title { font-weight: 600; }

/* 藏傳儀式：曼達、供水、哈達、四加行 */
.session { position: absolute; top: calc(112px + var(--safe-t)); left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 6px 8px 6px 16px; border-radius: 999px; background: var(--glass2); border: 1px solid var(--line); color: var(--gold2); font-family: var(--serif); white-space: nowrap; }
.session .btn { min-height: 36px; padding: 0 14px; }
.mandala-panel { display: grid; gap: 6px; }
.mandala { width: min(100%, 300px); margin: 6px auto; display: block; }
.mp-plate { fill: rgba(226, 191, 106, 0.16); stroke: var(--gold); stroke-width: 3; }
.mp-ring { fill: none; stroke: rgba(226, 191, 106, 0.4); stroke-width: 1.5; }
.heap { cursor: pointer; outline: none; }
.mp-heap { fill: rgba(255, 255, 255, 0.08); stroke: rgba(226, 191, 106, 0.55); stroke-width: 2; transition: fill 0.2s; }
.heap.on .mp-heap { fill: #f2dca0; stroke: #fff2c0; }
.heap.next .mp-heap { stroke: #fff2c0; stroke-width: 3; animation: pulse 1.2s ease-in-out infinite; }
.heap:focus-visible .mp-heap { stroke: #fff; stroke-width: 3; }
.mp-label { fill: #f4ecd2; font-size: 11px; font-family: var(--serif); font-weight: 700; pointer-events: none; }
.heap.on .mp-label { fill: #2a1d05; }
.grain { fill: #fffbe8; animation: rice 0.7s ease-in both; }
@keyframes rice { from { transform: translateY(-26px); opacity: 0; } 30% { opacity: 1; } to { transform: translateY(14px); opacity: 0.9; } }
@keyframes pulse { 50% { stroke-width: 5; opacity: 0.8; } }
.bowls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 14px 0; }
.bowl { position: relative; width: 70px; height: 52px; padding: 0; border: 2px solid var(--gold); border-radius: 6px 6px 34px 34px / 6px 6px 30px 30px; background: rgba(0, 0, 0, 0.3); overflow: hidden; }
.bowl.next { box-shadow: 0 0 0 3px rgba(246, 226, 162, 0.5); animation: pulse2 1.2s ease-in-out infinite; }
.bowl:disabled { opacity: 1; }
.bowl-water { position: absolute; inset: 0; }
.bowl-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: linear-gradient(180deg, #bfe8ff, #6ab4e0); transition: height 0.5s; }
.bowl.full .bowl-fill { height: 82%; }
.bowl-n { position: absolute; inset: 0; display: grid; place-items: center; font-size: 0.8rem; color: rgba(255, 255, 255, 0.85); text-shadow: 0 1px 2px #000; }
@keyframes pulse2 { 50% { box-shadow: 0 0 0 6px rgba(246, 226, 162, 0.15); } }
.khata-art { position: relative; height: 140px; margin: 10px 0; display: grid; justify-items: center; }
.khata-cloth { width: 210px; height: 34px; border-radius: 6px; background: linear-gradient(180deg, #fff, #e8e5da); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4); }
.khata-tail { width: 54px; height: 100px; margin-top: -6px; border-radius: 0 0 6px 6px; background: linear-gradient(180deg, #e8e5da, #fff); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35); }
.prelim { display: grid; gap: 10px; }
.bar2 { height: 6px; border-radius: 6px; background: rgba(255, 255, 255, 0.1); overflow: hidden; margin-top: 4px; }
.bar2 i { display: block; height: 100%; min-width: 2px; background: linear-gradient(90deg, var(--g400), var(--gold)); }
.wish-theme { max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mantra-panel .tab { font-size: 0.86rem; padding: 0 2px; }

/* 圖片檢視器 */
.viewer { position: fixed; inset: 0; z-index: 80; background: rgba(2, 8, 6, 0.96); display: grid; }
.vw-stage { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.vw-stage:active { cursor: grabbing; }
.vw-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; will-change: transform; pointer-events: none; }
.vw-top { position: absolute; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 24px calc(14px + var(--safe-l)); background: linear-gradient(180deg, rgba(2, 8, 6, 0.8), transparent); pointer-events: none; }
.vw-top > * { pointer-events: auto; }
.vw-title { min-width: 0; font-family: var(--serif); }
.vw-cap { font-weight: 700; color: var(--gold2); line-height: 1.4; overflow-wrap: anywhere; }
.vw-sub { margin-top: 2px; overflow-wrap: anywhere; }
.vw-bottom { position: absolute; bottom: 0; left: 0; right: 0; display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 10px; padding: 24px calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l)); background: linear-gradient(0deg, rgba(2, 8, 6, 0.85), transparent); pointer-events: none; }
.vw-bottom > * { pointer-events: auto; }
.vw-btn { min-height: 46px; min-width: 46px; padding: 0 16px; border-radius: 14px; border: 1px solid var(--line); background: rgba(10, 36, 28, 0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-weight: 600; }
.vw-btn.round { border-radius: 50%; padding: 0; font-size: 1.3rem; }
.vw-btn:disabled { opacity: 0.4; }
.vw-close { width: 46px; padding: 0; font-size: 1.6rem; line-height: 1; border-radius: 50%; flex: 0 0 auto; }
.vw-zoom { display: flex; align-items: center; gap: 6px; }
.vw-status { flex-basis: 100%; text-align: center; min-height: 1em; }
.tk-img { cursor: zoom-in; }

/* ---------- 供養互動面板（供香、供燈、添酥油、供花） ---------- */
.offer-panel { display: grid; gap: 12px; justify-items: center; }
.offer-panel > * { width: 100%; }
.sh-head { text-align: center; }
.orn { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--gold); }
.orn i { width: 46px; height: 1px; background: linear-gradient(90deg, transparent, var(--gold)); }
.orn i:last-child { transform: scaleX(-1); }
.eyebrow { margin-top: 4px; font-size: 0.78rem; color: var(--gold); }
.sh-head h2 { font-size: 1.35rem; color: var(--gold2); margin-top: 2px; }
.what { font-size: 0.88rem; color: var(--muted); }
.what summary { cursor: pointer; text-align: center; color: var(--gold); min-height: 32px; display: grid; place-items: center; }
.what-b { padding: 6px 4px; line-height: 1.65; }
.sec h3 { font-size: 0.95rem; color: var(--gold2); margin: 4px 0 6px; }
.note { margin: 0; font-size: 0.8rem; color: var(--muted); text-align: center; }
.f { display: grid; gap: 4px; text-align: left; margin-bottom: 8px; }
.f span { font-size: 0.82rem; color: var(--muted); }
.stage { position: relative; width: 100%; max-width: 340px; margin: 0 auto; border-radius: 16px; border: 1px solid var(--line); overflow: hidden; background: radial-gradient(circle at 50% 30%, #3a2a1c, #120c08 75%); touch-action: none; user-select: none; -webkit-user-select: none; }
.dragging { z-index: 20; cursor: grabbing; filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.5)); }
.hot { box-shadow: 0 0 0 3px var(--gold2), 0 0 24px rgba(227, 196, 126, 0.6) !important; }
.step-hint { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 30px; font-size: 0.9rem; text-align: center; }
.step-hint b { flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--g400); color: #fff; font-family: var(--serif); font-size: 0.82rem; }
.done-card { display: grid; gap: 10px; justify-items: center; text-align: center; padding: 10px 0; }
.done-card > b { font-family: var(--serif); font-size: 1.3rem; color: var(--gold2); }
.done-card > span { color: var(--muted); }
.done-card .list { width: 100%; display: grid; gap: 6px; }
.done-card .list > div { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }
.done-card .stat { color: var(--gold2); }
.done-card .row2 { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.burst-ring { width: 56px; height: 56px; border-radius: 50%; border: 2px solid var(--gold); animation: ringout 1s ease-out; }
@keyframes ringout { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.4); opacity: 0.5; } }
@keyframes flick { to { transform: scale(1.06, 0.94) translateY(-1px); } }
@keyframes glowIn { from { opacity: 0; } }
@keyframes smk { 0% { transform: translateY(0) scale(0.6); opacity: 0.7; } 100% { transform: translateY(-60px) scale(1.7); opacity: 0; } }

/* 供燈 */
.lamp-stage { height: 300px; }
.lamp-altar { position: absolute; left: 50%; top: 18px; width: 150px; height: 150px; margin-left: -75px; border-radius: 50%; background: radial-gradient(circle, rgba(226, 191, 106, 0.3), transparent 70%); }
.lamp-holder { position: absolute; left: 50%; top: 96px; width: 76px; height: 58px; margin-left: -38px; border: 2px dashed rgba(227, 196, 126, 0.7); border-radius: 12px; display: grid; place-items: center; transition: box-shadow 0.2s; }
.lamp-holder > span { font-size: 0.75rem; color: var(--gold2); letter-spacing: 0.2em; }
.lamp-holder.filled { border-color: transparent; }
.lamp-holder.filled > span { display: none; }
.lamp-item { position: absolute; left: 50%; bottom: 24px; width: 64px; height: 60px; margin-left: -32px; cursor: grab; touch-action: none; }
.lamp-item.placed { top: -6px; bottom: auto; }
.lamp-cup { position: absolute; left: 6px; right: 6px; bottom: 0; height: 30px; background: linear-gradient(#f0cf7a, #a8812c); clip-path: polygon(0 0, 100% 0, 82% 100%, 18% 100%); border-radius: 0 0 6px 6px; }
.lamp-wick { position: absolute; left: 50%; bottom: 28px; width: 3px; height: 10px; margin-left: -1.5px; background: #3a2318; border-radius: 2px; }
.lamp-flame { position: absolute; left: 50%; bottom: 34px; width: 18px; height: 30px; margin-left: -9px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff6d8, #ffd27a 45%, #ff9a3a 75%, rgba(255, 120, 40, 0)); animation: flick 0.18s infinite alternate; }
.lamp-glow { position: absolute; left: 50%; bottom: 10px; width: 200px; height: 200px; margin-left: -100px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 200, 110, 0.5), transparent 65%); animation: glowIn 1.6s ease; pointer-events: none; }
.lamp-stage.lit { background: radial-gradient(circle at 50% 35%, #5a3a1c, #170f0a 75%); }
.taper { position: absolute; right: 30px; bottom: 26px; width: 22px; height: 80px; cursor: grab; touch-action: none; }
.taper-stick { position: absolute; left: 8px; top: 22px; width: 6px; height: 58px; background: linear-gradient(90deg, #c9b48a, #efe3c3); border-radius: 3px; }
.taper-flame { position: absolute; left: 3px; top: 0; width: 16px; height: 26px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff6d8, #ffd27a 45%, #ff9a3a 75%, rgba(255, 120, 40, 0)); animation: flick 0.2s infinite alternate; }

/* 供藏香 */
.inc-stage { height: 250px; }
.inc-box { position: absolute; left: 50%; top: 84px; width: 230px; height: 62px; margin-left: -115px; border-radius: 6px 6px 12px 12px; background: linear-gradient(#a87a3a, #6a4a22); border: 2px solid #d9b25a; box-shadow: inset 0 10px 14px rgba(0, 0, 0, 0.45); }
.inc-box > span { position: absolute; left: 0; right: 0; bottom: -30px; font-size: 0.75rem; letter-spacing: 0.2em; color: #f3dfa6; text-align: center; }
.inc-box::before, .inc-box::after { content: ''; position: absolute; bottom: -20px; width: 12px; height: 20px; background: #6a4a22; border-radius: 0 0 4px 4px; }
.inc-box::before { left: 18px; } .inc-box::after { right: 18px; }
.inc-ash { position: absolute; left: 8px; right: 8px; top: 14px; height: 14px; border-radius: 4px; background: #d9cfb8; }
.inc-laid { position: absolute; left: 18px; right: 18px; top: 10px; height: 16px; opacity: 0; transition: opacity 0.3s; }
.inc-box.filled .inc-laid { opacity: 1; background: linear-gradient(#8a3a22, #8a3a22) 0 2px / 100% 3px no-repeat; }
.inc-box.three .inc-laid { background: linear-gradient(#8a3a22, #8a3a22) 0 0 / 100% 3px no-repeat, linear-gradient(#8a3a22, #8a3a22) 0 6px / 100% 3px no-repeat, linear-gradient(#8a3a22, #8a3a22) 0 12px / 100% 3px no-repeat; }
.inc-box.filled .inc-laid::after { content: ''; position: absolute; left: -6px; top: -2px; width: 10px; height: 18px; border-radius: 50%; background: radial-gradient(circle, #ff8a3a, rgba(255, 120, 40, 0) 70%); }
.inc-lid { position: absolute; left: -4px; right: -4px; top: -8px; height: 10px; border-radius: 4px; background: repeating-radial-gradient(circle at 12px 5px, #1a120a 0 3px, #d9b25a 3px 13px), #d9b25a; border: 1px solid #f3dfa6; transform: translateY(-34px); transition: transform 0.5s ease; }
.inc-box.closed .inc-lid { transform: none; }
.inc-bundle { position: absolute; left: 50%; bottom: 14px; width: 200px; height: 34px; margin-left: -100px; display: flex; flex-direction: column; justify-content: center; gap: 6px; cursor: grab; touch-action: none; }
.inc-bundle i { position: relative; display: block; width: 200px; height: 5px; border-radius: 3px; background: linear-gradient(90deg, #ff7a3a 0 4%, #8a3a22 4%); }
.inc-bundle i::after { content: ''; position: absolute; left: -8px; top: -6px; width: 16px; height: 16px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 170, 90, 0.9), rgba(255, 120, 40, 0) 70%); }
.inc-bundle.one i:nth-child(1), .inc-bundle.one i:nth-child(3) { display: none; }
.inc-smoke { position: absolute; left: 50%; top: 10px; width: 220px; height: 80px; margin-left: -110px; pointer-events: none; opacity: 0; transition: opacity 1s; }
.inc-stage.lit .inc-smoke { opacity: 1; }
.inc-smoke i { position: absolute; bottom: 0; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle, rgba(230, 225, 215, 0.5), transparent 70%); animation: smk 3s infinite ease-out; }
.inc-smoke i:nth-child(1) { left: 12%; } .inc-smoke i:nth-child(2) { left: 36%; animation-delay: 0.8s; } .inc-smoke i:nth-child(3) { left: 60%; animation-delay: 1.6s; } .inc-smoke i:nth-child(4) { left: 82%; animation-delay: 2.3s; }

/* 添酥油 */
.bt-stage { height: 280px; }
.bt-lamp { position: absolute; left: 50%; top: 70px; width: 150px; height: 190px; margin-left: -75px; }
.bt-bowl { position: absolute; left: 0; top: 34px; width: 150px; height: 60px; border-radius: 0 0 75px 75px; background: linear-gradient(#e3c47e, #a87a2a); border-top: 4px solid #f3dfa6; overflow: hidden; }
.bt-oil { position: absolute; left: 6px; right: 6px; top: 10px; height: 14px; border-radius: 50%; background: #f2dfa0; transition: top 1.6s ease; }
.bt-stage.lit .bt-oil { top: 2px; }
.bt-stem { position: absolute; left: 50%; top: 94px; width: 22px; height: 90px; margin-left: -11px; background: linear-gradient(90deg, #a87a2a, #e3c47e, #a87a2a); border-radius: 4px; }
.bt-flame { position: absolute; left: 50%; top: -6px; width: 26px; height: 42px; margin-left: -13px; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; background: radial-gradient(circle at 50% 70%, #fff6d8, #ffd27a 45%, #ff9a3a 75%, rgba(255, 120, 40, 0)); animation: flick 0.2s infinite alternate; transition: transform 1.6s; }
.bt-stage.lit .bt-flame { transform: scale(1.5) translateY(-6px); }
.bt-jug { position: absolute; right: 22px; bottom: 20px; width: 64px; height: 60px; border-radius: 12px 12px 22px 22px; background: linear-gradient(#c9a35a, #7a5420); border: 2px solid #f3dfa6; cursor: grab; touch-action: none; }
.bt-spout { position: absolute; left: -20px; top: 6px; width: 26px; height: 10px; border-radius: 6px; background: #a87a2a; transform: rotate(-20deg); }
.bt-pour { display: none; }
.bt-jug.pouring { right: auto; left: 50%; bottom: auto; top: 24px; margin-left: 30px; transform: rotate(-45deg); transition: transform 0.4s; }
.bt-jug.pouring .bt-pour { display: block; position: absolute; left: -16px; top: 14px; width: 6px; height: 60px; border-radius: 3px; background: linear-gradient(#f2dfa0, rgba(242, 223, 160, 0.2)); transform: rotate(45deg); transform-origin: top; }

/* 供花 */
.flower-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fpk { display: grid; justify-items: center; gap: 6px; padding: 10px 4px; border-radius: 14px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.05); }
.fpk i { width: 30px; height: 30px; border-radius: 50% 50% 50% 8%; transform: rotate(-20deg); box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4); }
.fpk.on { background: rgba(226, 191, 106, 0.2); border-color: var(--gold2); }
.fpk span { font-size: 0.82rem; }
.offer-panel .list { display: grid; gap: 6px; }
.offer-panel .list > div { display: flex; justify-content: space-between; padding: 8px 12px; border-radius: 12px; background: rgba(0, 0, 0, 0.22); }

/* 半高面板：上半部看角色動作，下半部操作 */
.sheet.half .sheet-backdrop { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none; }
.sheet.half .sheet-card { max-height: 58vh; max-height: 58dvh; }
.sheet.half .sh-head, .sheet.half .what, .sheet.half .note { display: none; }
.sheet.half .lamp-stage { height: 210px; }
.sheet.half .lamp-holder { top: 26px; }
.sheet.half .lamp-altar { display: none; }
.sheet.half .inc-stage { height: 220px; }
.sheet.half .inc-box { top: 70px; }
.sheet.half .bt-stage { height: 230px; }
.sheet.half .bt-lamp { top: 40px; }
@media (min-width: 700px) { .sheet.half { align-items: flex-end; } .sheet.half .sheet-card { border-radius: 26px 26px 0 0; border-bottom: 0; } }

/* 置頂提示卡、前往提示、繞行進度環 */
.banner { position: absolute; top: calc(70px + var(--safe-t)); left: 50%; transform: translateX(-50%); z-index: 12; width: min(92vw, 440px); padding: 14px 20px; border-radius: 20px; text-align: center; background: rgba(6, 34, 26, 0.88); border: 1.5px solid var(--gold); color: var(--gold2); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); cursor: pointer; animation: bannerIn 0.35s ease-out; }
.bn-title { font-family: var(--serif); font-weight: 700; font-size: 1.3rem; line-height: 1.4; }
.bn-text { margin-top: 4px; font-size: 0.98rem; color: #f3ecd0; line-height: 1.5; }
.banner.bad { border-color: #e07a6a; color: #ffc9bf; }
@keyframes bannerIn { from { opacity: 0; transform: translate(-50%, -10px) scale(0.96); } }
.walk-hint { position: absolute; top: calc(70px + var(--safe-t)); left: 50%; transform: translateX(-50%); padding: 5px 16px; border-radius: 999px; background: rgba(6, 34, 26, 0.75); border: 1px solid var(--line); color: var(--gold2); font-size: 0.88rem; pointer-events: none !important; }
.kora-ring { position: absolute; top: calc(112px + var(--safe-t)); right: calc(12px + var(--safe-r)); width: 76px; display: grid; justify-items: center; gap: 4px; pointer-events: none !important; }
.kora-ring svg { width: 76px; height: 76px; }
.kr-bg { fill: rgba(6, 34, 26, 0.7); stroke: rgba(255, 255, 255, 0.15); stroke-width: 6; }
.kr-fg { fill: none; stroke: var(--gold); stroke-width: 6; stroke-linecap: round; stroke-dasharray: 169.6; stroke-dashoffset: 169.6; transition: stroke-dashoffset 0.15s linear, stroke 0.2s; }
.kora-ring.bad .kr-fg { stroke: #e0574a; }
.kr-mid { position: absolute; top: 0; left: 0; width: 76px; height: 76px; display: grid; place-content: center; text-align: center; font-family: var(--serif); }
.kr-mid b { font-size: 1.05rem; color: var(--gold2); line-height: 1.1; }
.kr-mid small { font-size: 0.68rem; color: var(--muted); }
.kr-msg { font-size: 0.78rem; color: #ffc9bf; text-align: center; min-height: 1em; background: rgba(60, 12, 8, 0.7); border-radius: 8px; padding: 0 6px; }
.kr-msg:empty { display: none; }

/* 發願面板：大按鈕 */
.wish-chips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.wish-chips .chip { min-height: 56px; border-radius: 16px; font-size: 1rem; line-height: 1.35; padding: 8px 12px; white-space: normal; }
