:root { --bg: #10160c; --panel: rgba(24, 34, 14, .9); --line: rgba(170, 210, 110, .45); --red: #6e9a32; --blood: #4a6e1e; --paper: #f2e6c0; --ink: #f2f7e8; --dim: #b8c4a0; --green: #d4ecaa; --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: #c4e08a; }
#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(80, 110, 30, .35), 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(150, 200, 80, .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: #b8dc7a; text-shadow: 0 0 18px rgba(143, 216, 184, .6); 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, #8ab84a, #4a6e1e); color: #fff; font-weight: 700; border-radius: 12px; padding: 12px 16px; width: 100%; box-shadow: 0 0 18px rgba(170, 210, 110, .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: #b8dc7a; 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: #e0f0c4; }
.bar button span { font-size: 11px; color: var(--dim); }
.bar button.gold i { background: var(--red); color: #fff; }
.bar button:active { background: rgba(110, 154, 50, .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: #c8e690; 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: #e0f0c4; }
.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: #e8f4d0; }
.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(210, 232, 170, .25); border-radius: 8px; padding: 6px; font-size: 11px; text-align: center; background: rgba(34, 50, 16, .4); }
.lamplist div.flag { border-color: #b8dc7a; 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(20, 30, 10, .7); 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(20, 30, 10, .65); border-radius: 8px; padding: 4px 8px; font-size: 13px; transition: opacity .6s; }
.chatlog b { color: #e0f0c4; 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(26, 36, 14, .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; }
/* 保生大帝殿 */
.lamplist div.gold { border-color: #f0c040; background: rgba(90, 60, 10, .5); }
.lamplist b { color: #d4ecaa; }
.lv { display: flex; align-items: center; gap: 10px; margin: 6px 0 10px; }
.lv b { font-family: "Noto Serif TC", serif; font-size: 20px; color: #c8e690; }
.bar-wrap { height: 8px; border-radius: 99px; background: rgba(0, 0, 0, .4); overflow: hidden; flex: 1; }
.bar-wrap i { display: block; height: 100%; background: linear-gradient(90deg, #b8dc7a, #e8f4d0); }
textarea { resize: none; height: 78px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); margin: 8px 0 12px; }
.check input { width: auto; margin: 0; }
.diary { display: grid; gap: 6px; }
.diary div { font-size: 13px; border-left: 3px solid #b8dc7a; padding: 4px 8px; background: rgba(0, 0, 0, .25); border-radius: 6px; }
.diary small { color: var(--dim); margin-right: 6px; }
.jiao { display: flex; justify-content: center; gap: 22px; margin: 16px 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); transition: transform .5s; }
.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: 22px; color: #e8f4d0; min-height: 1.4em; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 6px 0 12px; }
.dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid #b8dc7a; }
.dots i.on { background: #b8dc7a; box-shadow: 0 0 8px #b8dc7a; }
.poem { text-align: center; font-family: "Noto Serif TC", serif; font-size: 19px; line-height: 1.9; color: #f2f7e8; margin: 10px 0; }
.poem h4 { margin: 0; color: #c8e690; font-size: 15px; letter-spacing: .3em; }
.cards { display: grid; gap: 8px; }
.cardx { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(210, 240, 170, .07); }
.cardx p { margin: 0 0 8px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.cardx .row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cardx .stk { border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; background: rgba(0, 0, 0, .3); }
.cardx .stk.on { background: var(--red); color: #fff; }
.cardx .rep { margin-left: auto; font-size: 11px; color: var(--dim); }
.cardx small { color: var(--dim); font-size: 11px; }
.story { display: flex; gap: 10px; align-items: flex-start; }
.story .who { flex: none; background: var(--red); color: #fff; border-radius: 8px; padding: 2px 8px; font-size: 13px; }
.story p { margin: 0; font-size: 15px; line-height: 1.7; }
.care p { font-size: 15px; line-height: 1.8; }
.care a { display: block; text-align: center; margin: 8px 0; padding: 10px; border-radius: 12px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); color: #fff; text-decoration: none; font-size: 16px; }
.amounts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
@media (max-width: 520px) { .bar { gap: 2px; padding: 5px; } .bar button { width: 40px; } .bar button i { width: 28px; height: 28px; font-size: 14px; } .bar button span { font-size: 10px; } .stats div { min-width: 44px; } #hudLv { font-size: 12px; } }

/* 靜坐 */
.zen-mins { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 6px 0 12px; }
.breath { width: 180px; height: 180px; margin: 10px auto 6px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.breath::before { content: ""; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle, rgba(200, 240, 150, .55), rgba(110, 150, 50, .15) 65%, transparent 70%); transform: scale(var(--s, .6)); transition: transform var(--d, 4s) ease-in-out; }
.breath span { position: relative; font-family: "Noto Serif TC", serif; font-size: 22px; color: #f2f7e8; }
.timer { text-align: center; font-size: 34px; font-weight: 700; letter-spacing: .08em; color: #e8f4d0; font-variant-numeric: tabular-nums; }
.zen-n { text-align: center; color: var(--dim); font-size: 13px; margin: 4px 0 10px; }
.letgo-fx { text-align: center; font-family: "Noto Serif TC", serif; font-size: 18px; color: #d4ecaa; min-height: 1.5em; transition: opacity 2.5s, transform 2.5s; }
.letgo-fx.go { opacity: 0; transform: translateY(30px) scale(.9); filter: blur(3px); }

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

/* 窄手機：HUD 多一格數字，縮小間距讓右上角樂捐按鈕留在畫面內 */
@media (max-width: 420px) {
  .hud { gap: 5px; padding-left: 8px; padding-right: 8px; }
  .brand { font-size: 15px; padding: 6px 8px; }
  .stats { gap: 3px; }
  .stats div { min-width: 38px; padding: 3px 4px; }
  .stats b { font-size: 13px; }
  .hud .pill { padding: 5px 8px; font-size: 12px; gap: 4px; }
}

/* 保生大帝殿 */
.bar { bottom: calc(24px + var(--safe-b)); }
.sheet, .chatbar { bottom: calc(100px + var(--safe-b)); }
.chatlog { bottom: calc(106px + var(--safe-b)); }
.disc { position: fixed; left: 0; right: 0; bottom: calc(3px + var(--safe-b)); text-align: center; font-size: 10.5px; color: rgba(232, 244, 208, .78); z-index: 19; pointer-events: none; text-shadow: 0 1px 3px rgba(0, 0, 0, .8); padding: 0 8px; }
.medical { border: 1px solid #e8c060; background: rgba(90, 64, 10, .45); border-radius: 12px; padding: 10px 12px; font-size: 13px; line-height: 1.6; color: #fbe8b8; margin: 10px 0; }
.entry .medical { text-align: left; }
.plaques { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.plaques div { border: 1px solid rgba(220, 190, 120, .45); border-radius: 6px; padding: 6px; text-align: center; background: rgba(110, 80, 30, .35); font-size: 12px; }
.plaques b { display: block; color: #f4dca0; font-family: "Noto Serif TC", serif; font-size: 14px; }
.plaques button { margin-top: 4px; font-size: 11px; color: var(--dim); text-decoration: underline; }
.kin { display: flex; flex-wrap: wrap; gap: 5px; max-height: 128px; overflow: auto; }
.kin .chip { padding: 5px 10px; }
.lotcard { text-align: center; border: 1px solid rgba(200, 230, 140, .5); border-radius: 14px; padding: 14px 12px; background: linear-gradient(180deg, rgba(140, 190, 70, .16), rgba(0, 0, 0, .25)); }
.lotcard h4 { margin: 0 0 6px; color: #c8e690; letter-spacing: .3em; font-size: 14px; }
.lotcard .bless { font-family: "Noto Serif TC", serif; font-size: 20px; line-height: 1.8; margin: 6px 0; }
.lotcard .habit { font-size: 15px; margin: 10px 0 0; color: #fbf3d8; }
.cups { display: flex; justify-content: center; gap: 6px; margin: 10px 0; flex-wrap: wrap; }
.cups i { width: 26px; height: 32px; border: 2px solid #b8dc7a; border-top: 0; border-radius: 0 0 8px 8px; }
.cups i.on { background: linear-gradient(180deg, #bfe6ff, #6ab4e8); }
@media (max-width: 420px) { .bar { bottom: calc(26px + var(--safe-b)); } .disc { font-size: 9.5px; } }
/* 窄手機：右上角要放換宮廟、人數、音量、樂捐，統計數字收起來（點燈／名牌面板裡都看得到） */
.brand { white-space: nowrap; }
@media (max-width: 440px) { .hud .stats { display: none; } .hud .right { margin-left: auto; } }

/* 第 87 輪：今日康寧五件事按鈕與清單、深呼吸圓圈；面板打開時收起左側按鈕避免蓋字 */
.bsToday { position: fixed; left: max(8px, env(safe-area-inset-left)); top: calc(50% - 124px); z-index: 45; width: 52px; min-height: 52px; border-radius: 14px; border: 1px solid #a8d86a; background: rgba(30, 50, 18, .85); color: #f2f7e8; font: 700 12px/1.25 "Noto Sans TC", system-ui, sans-serif; padding: 4px 2px; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); cursor: pointer; touch-action: manipulation; }
.bsToday b { display: block; font-size: 16px; }
.bsToday.done { border-color: #ffd36a; background: rgba(110, 80, 20, .88); }
body.sheetOpen .bsToday, body.sheetOpen .flbar { display: none; }
.tdRow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(170, 210, 110, .25); font-size: 16px; }
.tdRow i { font-style: normal; font-family: "Noto Serif TC", serif; font-weight: 900; width: 30px; text-align: center; color: #c8e690; }
.tdRow span { flex: 1; line-height: 1.4; }
.tdRow button { min-width: 92px; min-height: 46px; border-radius: 12px; font: 700 15px "Noto Sans TC", sans-serif; background: linear-gradient(180deg, #8ab84a, #4a6e1e); color: #fff; }
.tdRow em { font-style: normal; color: #c8f090; font-weight: 700; min-width: 92px; text-align: center; font-size: 15px; }
.breath { display: grid; place-items: center; gap: 6px; padding: 18px 0 6px; }
.breath .ball { width: 110px; height: 110px; border-radius: 50%; background: radial-gradient(circle, rgba(216, 255, 160, .9), rgba(120, 180, 60, .35)); box-shadow: 0 0 30px rgba(170, 220, 110, .5); }
.breath b { font-size: 24px; color: #e0f6b8; margin-top: 18px; }
.breath span { font-size: 18px; color: var(--dim); }
/* 第 115 輪：平安香包、踢毽子 */
.bsBig .chip { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.kkBox { display: flex; gap: 14px; align-items: center; justify-content: center; margin: 8px 0 12px; }
.kkTrack { position: relative; width: 70px; height: 220px; border-radius: 35px; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); overflow: hidden; }
.kkZone { position: absolute; left: 0; right: 0; top: 51%; bottom: 0; background: rgba(120, 200, 90, .45); }
.kkBall { position: absolute; left: 50%; top: 0; transform: translate(-50%, 0); font-size: 30px; line-height: 1; }
.kkN { font-size: 18px; } .kkN b { font-size: 46px; color: #e8f8b0; }
.kkBtn { min-height: 72px; font-size: 26px !important; letter-spacing: .3em; touch-action: manipulation; }
/* 第 147 輪：樟樹下甩手操＋長輩友善字級（說明 ≥15px、選項按鈕 ≥44px） */
.swBox { text-align: center; }
.swCmd { font-size: 30px; font-weight: 900; padding: 14px 0; border-radius: 14px; background: rgba(0, 0, 0, .3); border: 2px solid #8ac860; margin-bottom: 8px; transition: background .2s; }
.swCmd i { font-style: normal; margin-right: 8px; } .swCmd.bad { background: rgba(160, 40, 30, .55); border-color: #e86a5a; }
.swInfo { font-size: 16px; margin-bottom: 10px; } .swInfo b { font-size: 22px; color: #c8e690; }
.swBtns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.swBtns button { min-height: 84px; border-radius: 14px; border: 2px solid var(--line); background: rgba(40, 70, 20, .7); font-size: 16px; font-weight: 700; touch-action: manipulation; user-select: none; }
.swBtns button i { display: block; font-style: normal; font-size: 30px; } .swBtns button:active { background: rgba(120, 180, 60, .7); }
.sheet .sub { font-size: 15px; } .note { font-size: 14px; } .card p { font-size: 15px; } .medical { font-size: 15px; } .toast { font-size: 15px; }
.chip { font-size: 15px; min-height: 44px; } .lotcard h4 { font-size: 16px; } .sheet h3 { font-size: 16px; } .row-check, .check { font-size: 15px; }
.sheet .x { min-width: 44px; min-height: 44px; right: 4px; top: 2px; font-size: 26px; }
