:root { --bg: #0d2a44; --panel: rgba(12, 36, 60, .9); --line: rgba(120, 190, 230, .45); --red: #c8322b; --blood: #9e2420; --paper: #ffd9a8; --ink: #f2f8fc; --dim: #a9c6da; --green: #8fe0c8; --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px); }
* { 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: "Noto Sans TC", system-ui, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: #ffcf6a; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.loading { position: fixed; inset: 0; display: grid; place-items: center; font-family: "Noto Serif TC", serif; font-size: 20px; color: var(--dim); background: var(--bg); z-index: 50; }
.entry { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, rgba(30, 90, 140, .4), rgba(0, 0, 0, .85)); z-index: 40; padding: 16px; }
.entry-card { width: min(400px, 100%); text-align: center; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 26px 20px; box-shadow: 0 0 60px rgba(80, 160, 220, .25); }
.eyebrow { margin: 0; letter-spacing: .3em; color: var(--dim); font-size: 13px; }
.entry h1 { font-family: "Noto Serif TC", serif; font-weight: 900; font-size: 52px; margin: 6px 0; color: #ffcf6a; text-shadow: 0 0 18px rgba(255, 200, 100, .55); letter-spacing: .1em; }
.slogan { color: var(--ink); line-height: 1.7; margin: 0 0 16px; }
.field { display: block; text-align: left; font-size: 13px; color: var(--dim); margin-bottom: 12px; }
input, select, textarea { width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(0, 0, 0, .45); color: var(--ink); font: inherit; font-size: 16px; }
.primary { background: linear-gradient(180deg, #e0503f, #a8241c); color: #fff; font-weight: 700; border-radius: 12px; padding: 12px 16px; width: 100%; box-shadow: 0 0 18px rgba(200, 50, 43, .45); }
.primary.big { font-size: 20px; letter-spacing: .2em; }
.primary:disabled { opacity: .5; }
.ghost { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; width: 100%; background: rgba(0, 0, 0, .3); }
.note { font-size: 12px; color: var(--dim); line-height: 1.6; margin: 10px 0 0; }
.hud { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 12px 10px; z-index: 20; pointer-events: none; }
.hud > * { pointer-events: auto; }
.brand { font-family: "Noto Serif TC", serif; font-weight: 900; font-size: 20px; color: #ffcf6a; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 12px; }
.brand small { font-family: "Noto Sans TC"; font-weight: 400; font-size: 11px; color: var(--dim); margin-left: 6px; }
.stats { display: flex; gap: 6px; margin: 0 auto; }
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px 10px; text-align: center; min-width: 58px; }
.stats b { display: block; font-size: 15px; } .stats span { font-size: 10px; color: var(--dim); }
.right { display: flex; gap: 6px; }
.pill { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; min-height: 34px; display: inline-flex; align-items: center; gap: 6px; }
.online i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); }
.online i.off { background: #666; box-shadow: none; }
.bar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(10px + var(--safe-b)); display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 6px; z-index: 20; }
.bar button { display: grid; justify-items: center; gap: 2px; width: 52px; padding: 4px 0; border-radius: 12px; }
.bar button i { font-style: normal; font-family: "Noto Serif TC", serif; font-weight: 900; width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: rgba(0, 0, 0, .4); color: #ffdca0; }
.bar button span { font-size: 11px; color: var(--dim); }
.bar button.gold i { background: var(--red); color: #fff; }
.bar button:active { background: rgba(120, 190, 230, .2); }
.sheet { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); width: min(480px, calc(100vw - 24px)); max-height: min(calc(100vh - 170px), 700px); overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 16px; z-index: 25; backdrop-filter: blur(8px); }
.sheet h2 { font-family: "Noto Serif TC", serif; margin: 0 0 4px; color: #ffcf6a; font-size: 20px; }
.sheet .sub { color: var(--dim); font-size: 13px; margin: 0 0 12px; }
.sheet .x { position: absolute; right: 10px; top: 8px; font-size: 22px; color: var(--dim); }
.sheet h3 { font-size: 14px; margin: 16px 0 8px; color: #ffdca0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; background: rgba(0, 0, 0, .35); }
.chip.on { background: var(--red); color: #fff; border-color: var(--red); }
.buys { display: grid; gap: 8px; }
.buy { display: grid; grid-template-columns: 1fr auto; text-align: left; gap: 2px 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(0, 0, 0, .35); }
.buy b { font-size: 15px; } .buy span { grid-column: 1; font-size: 12px; color: var(--dim); } .buy em { grid-row: 1 / 3; grid-column: 2; align-self: center; font-style: normal; font-weight: 700; color: #ffe2a0; }
.buy.own { opacity: .7; } .buy.on { border-color: var(--green); }
.card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: rgba(0, 0, 0, .3); margin-top: 10px; }
.card p { margin: 4px 0; font-size: 14px; }
.lamplist { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.lamplist div { border: 1px solid rgba(140, 200, 240, .25); border-radius: 8px; padding: 6px; font-size: 11px; text-align: center; background: rgba(20, 50, 80, .4); }
.lamplist div.flag { border-color: #ffcf6a; background: rgba(90, 60, 10, .5); }
.lamplist b { display: block; font-size: 12px; color: var(--green); }
.feed { position: fixed; left: 12px; top: calc(70px + var(--safe-t)); display: grid; gap: 4px; z-index: 15; max-width: min(320px, 70vw); pointer-events: none; }
.feed div { background: rgba(10, 30, 50, .72); border-left: 3px solid var(--red); border-radius: 6px; padding: 4px 8px; font-size: 12px; animation: in .3s ease; transition: opacity .6s; }
.chatlog { position: fixed; left: 12px; bottom: calc(92px + var(--safe-b)); display: grid; gap: 3px; z-index: 15; max-width: min(320px, 70vw); pointer-events: none; }
.chatlog div { background: rgba(10, 30, 50, .65); border-radius: 8px; padding: 4px 8px; font-size: 13px; transition: opacity .6s; }
.chatlog b { color: #ffdca0; margin-right: 4px; }
.chatbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + var(--safe-b)); width: min(420px, calc(100vw - 24px)); display: flex; gap: 6px; z-index: 26; }
.chatbar input { margin: 0; } .chatbar button { background: var(--red); border-radius: 10px; padding: 0 14px; color: #fff; }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(70px + var(--safe-t)); display: grid; gap: 6px; z-index: 60; width: min(420px, calc(100vw - 32px)); pointer-events: none; }
.toast { background: rgba(10, 32, 54, .94); border: 1px solid var(--red); border-radius: 12px; padding: 10px 14px; font-size: 14px; text-align: center; animation: in .25s ease; transition: opacity .4s; }
.toast.out { opacity: 0; }
@keyframes in { from { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 520px) {
  .brand small { display: none; } .brand { font-size: 17px; }
  .bar button { width: 46px; } .bar button i { width: 30px; height: 30px; }
  .stats div { min-width: 48px; padding: 3px 6px; }
}

.row-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); margin: 4px 0; }
.row-check input { width: auto; margin: 0; }
/* 海安宮 */
.brand small { color: #ffcf6a; opacity: .85; }
textarea { resize: none; height: 64px; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 6px 0 12px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #ffcf6a; }
.dots i.on { background: #ffcf6a; box-shadow: 0 0 8px #ffcf6a; }
.jiao { display: flex; justify-content: center; gap: 22px; margin: 14px 0 8px; min-height: 70px; }
.jiao span { width: 34px; height: 64px; border-radius: 34px 34px 6px 6px; background: linear-gradient(180deg, #d84a4a, #8e1b22); box-shadow: inset -6px 0 0 rgba(0, 0, 0, .25); }
.jiao span.flat { background: linear-gradient(180deg, #f2d2a0, #c8945a); border-radius: 6px; }
.jiao.toss span { animation: toss .7s ease; }
@keyframes toss { 0% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-60px) rotate(360deg); } 100% { transform: translateY(0) rotate(720deg); } }
.res { text-align: center; font-family: "Noto Serif TC", serif; font-size: 21px; color: #ffe2a0; min-height: 1.4em; }
.res small { display: block; font-family: "Noto Sans TC"; font-size: 13px; color: var(--dim); margin-top: 4px; }
.steps { display: grid; gap: 6px; margin: 8px 0 12px; }
.steps div { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--dim); }
.steps b { width: 22px; height: 22px; flex: none; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line); font-size: 12px; }
.steps .on { color: var(--ink); } .steps .on b { background: var(--red); border-color: var(--red); color: #fff; }
.steps .ok b { background: #2f8a5a; border-color: #2f8a5a; color: #fff; }
.notes { display: grid; gap: 6px; }
.notes div { font-size: 13px; border-left: 3px solid #ffcf6a; padding: 4px 8px; background: rgba(0, 0, 0, .25); border-radius: 6px; }
.notes small { color: var(--dim); margin-right: 6px; }
.charms { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.charms div { position: relative; border: 1px solid rgba(255, 120, 100, .35); border-radius: 6px; padding: 8px 4px 6px; font-size: 11px; text-align: center; background: linear-gradient(180deg, rgba(170, 30, 30, .55), rgba(110, 20, 20, .55)); }
.charms div.gold { border-color: #ffcf6a; background: linear-gradient(180deg, rgba(200, 150, 40, .6), rgba(130, 90, 10, .6)); }
.charms b { display: block; font-size: 12px; color: #ffe2a0; font-family: "Noto Serif TC", serif; }
.charms .pin { position: absolute; top: -7px; right: -4px; font-size: 10px; background: #ffcf6a; color: #5a2a00; border-radius: 6px; padding: 0 4px; }
.procBanner { position: fixed; left: 50%; transform: translateX(-50%); top: calc(64px + var(--safe-t)); z-index: 18; background: rgba(160, 30, 24, .92); border: 1px solid #ffcf6a; border-radius: 999px; padding: 6px 14px; font-size: 13px; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.procBanner button { background: #ffcf6a; color: #5a2a00; border-radius: 999px; padding: 3px 10px; font-weight: 700; font-size: 12px; }
.flash { position: fixed; inset: 0; pointer-events: none; z-index: 30; background: radial-gradient(circle at 50% 45%, rgba(255, 230, 150, .55), rgba(255, 200, 80, 0) 60%); animation: flash 2.4s ease forwards; }
@keyframes flash { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.amounts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tiers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.tier { min-height: 64px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 6px; background: rgba(0, 0, 0, .35); color: inherit; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; font-family: inherit; }
.tier b { font-size: 18px; color: #ffcf6a; }
.tier span { font-size: 14px; }
.tier small { font-size: 12px; color: var(--dim); }
.tier.on { background: rgba(160, 30, 24, .85); border-color: #ffcf6a; }
.tier.on small { color: #ffe9b8; }
.tpGets { font-size: 15px; line-height: 1.55; background: rgba(255, 207, 106, .12); border: 1px solid rgba(255, 207, 106, .4); border-radius: 10px; padding: 8px 10px; margin: 4px 0 6px; }
.tpCert { font-size: 15px; line-height: 1.55; margin: 0 0 8px; }
.tpCert button { min-height: 44px; padding: 0 14px; margin-left: 4px; border-radius: 10px; border: 1px solid rgba(255, 207, 106, .6); background: rgba(255, 207, 106, .16); color: inherit; font: inherit; font-weight: 700; cursor: pointer; }
.tpUse { font-size: 13px; line-height: 1.6; color: var(--dim); text-align: center; margin: 8px 0 4px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); margin: 8px 0 12px; }
.check input { width: auto; margin: 0; }
.disc { font-size: 11px; color: var(--dim); text-align: center; margin-top: 12px; }
.lamplist div.flag { border-color: #ffcf6a; }
@media (max-width: 520px) { .bar { gap: 2px; padding: 5px; } .bar button { width: 37px; } .bar button i { width: 28px; height: 28px; font-size: 14px; } .bar button span { font-size: 10px; } .stats div { min-width: 44px; } .procBanner { top: calc(58px + var(--safe-t)); font-size: 12px; } }

/* 右上角樂捐按鈕 */
.pill.donate { background: linear-gradient(180deg, #f3d27a, #c99a3a); color: #2a1a06; font-weight: 700; border: 0; cursor: pointer; }

/* 2F 觀海樓：望遠鏡視野 */
#scopeVig { position: fixed; inset: 0; z-index: 15; pointer-events: none; background: radial-gradient(circle at 50% 50%, transparent 0, transparent 34vmin, rgba(0, 0, 0, .92) 36vmin); animation: scopeIn .6s ease-out; }
#scopeVig::after { content: ""; position: absolute; left: 50%; top: 50%; width: 72vmin; height: 72vmin; transform: translate(-50%, -50%); border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(200, 160, 80, .8), inset 0 0 40px rgba(0, 0, 0, .6); }
@keyframes scopeIn { from { opacity: 0; } to { opacity: 1; } }
/* 手機：上方狀態列不換行（換宮廟、人數、音量擠在一起時會變直排） */
@media (max-width: 520px) {
  .hud { gap: 6px; padding-left: 8px; padding-right: 8px; }
  .brand { white-space: nowrap; padding: 6px 8px; font-size: 16px; }
  .hud .right { flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
  .hud .right > * { white-space: nowrap; }
  .stats b { white-space: nowrap; font-size: 15px; }
  #btnDonate { display: none; }
}

/* 手機隨喜浮動鈕（假設⑤：手機上方樂捐鈕被隱藏、底列樂捐只有 37px 寬）：只在 ≤520px 出現，右下角、拇指按得到 */
.tipFab { display: none; }
@media (max-width: 520px) {
  .tipFab:not([hidden]) { display: grid; place-items: center; gap: 1px; position: fixed; right: max(10px, env(safe-area-inset-right)); bottom: calc(84px + var(--safe-b)); z-index: 19; min-width: 76px; min-height: 56px; padding: 6px 10px; border-radius: 16px; border: 1px solid #ffe9b0; background: linear-gradient(180deg, #f3d27a, #c99a3a); color: #2a1a06; box-shadow: 0 3px 12px rgba(0, 0, 0, .45); cursor: pointer; line-height: 1.15; }
  .tipFab b { font-size: 17px; font-weight: 800; } .tipFab small { font-size: 12px; font-weight: 700; }
  .tipFab:active { transform: scale(.96); }
  body.shOpen .tipFab, body.chatOpen .tipFab { display: none; }
  .sheet .x { width: 44px; height: 44px; right: 4px; top: 2px; }
  .check { min-height: 44px; font-size: 15px; } .check input { width: 22px; height: 22px; }
}
/* 2026-11-23：平安小旗架、海邊淨灘；選項按鈕手機 ≥44px、字 ≥15px */
.chip.mzCh { min-height: 44px; padding: 8px 14px; font-size: 16px; touch-action: manipulation; }
.mzH { margin: 14px 0 6px; font-size: 16px; color: #ffd36a; font-weight: 700; }
.mzRes { border: 1px solid #ffd36a; border-radius: 12px; padding: 12px; background: rgba(110, 70, 20, .35); margin-top: 10px; }
.mzRes small { display: block; font-size: 15px; color: #ffe6a8; }
.mzRes p { margin: 6px 0; font-size: 17px; line-height: 1.5; }
.mzRes b { color: #ffd36a; font-size: 22px; }
.mzRes em { display: block; font-style: normal; font-size: 15px; color: #9fe8c0; }
.mzBcInfo { display: flex; justify-content: space-between; font-size: 17px; margin: 4px 0 10px; }
.mzBcInfo b { color: #ffd36a; font-size: 22px; }
.mzBcGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.mzBcBtn { min-height: 84px; aspect-ratio: 1; border-radius: 16px; font-size: 38px; background: linear-gradient(180deg, #e8d6a8, #c8b080); border: 2px solid #a8906a; touch-action: manipulation; transition: transform .08s; }
.mzBcBtn.lit { background: radial-gradient(circle, #fff7d8, #e8d6a8); border-color: #ffd36a; box-shadow: 0 0 18px rgba(255, 211, 106, .7); transform: scale(1.05); }
.mzBcBtn.miss { background: #8a5a3a; border-color: #d9443a; }
.mzBcTip { text-align: center; font-size: 16px; margin: 10px 0 0; color: #ffe6a8; min-height: 24px; }
