:root { --bg: #070d22; --panel: rgba(12, 22, 52, .9); --line: rgba(232, 190, 90, .4); --red: #d9a441; --blood: #a8742a; --paper: #ffe6a8; --ink: #f4f0e6; --dim: #a9b6d6; --green: #ffd36a; --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: #ffd36a; }
#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, 60, 140, .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(232, 190, 90, .22); }
.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: #ffd36a; text-shadow: 0 0 18px rgba(255, 211, 106, .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, #f6cf72, #b8862e); color: #1a1206; font-weight: 700; border-radius: 12px; padding: 12px 16px; width: 100%; box-shadow: 0 0 18px rgba(232, 190, 90, .4); }
.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: #ffd36a; 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: #ffe6a8; }
.bar button span { font-size: 11px; color: var(--dim); }
.bar button.gold i { background: var(--red); color: #fff; }
.bar button:active { background: rgba(232, 190, 90, .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: #ffd36a; 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: #ffe6a8; }
.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: #ffe6a8; }
.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(255, 211, 106, .25); border-radius: 8px; padding: 6px; font-size: 11px; text-align: center; background: rgba(20, 34, 70, .5); }
.lamplist div.flag { border-color: #ffd36a; 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, 18, 44, .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, 18, 44, .65); border-radius: 8px; padding: 4px 8px; font-size: 13px; transition: opacity .6s; }
.chatlog b { color: #ffe6a8; 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(12, 20, 48, .95); 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; }
}


/* 歲安宮・太歲殿 */
.disc { position: fixed; right: 12px; top: calc(56px + var(--safe-t)); font-size: 11px; color: var(--dim); background: rgba(7, 13, 34, .6); border-radius: 8px; padding: 2px 8px; z-index: 15; pointer-events: none; }
.chip.on { color: #1a1206; }
.zgrid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.zgrid .chip { padding: 6px 0; text-align: center; font-family: "Noto Serif TC", serif; font-size: 15px; }
.zgrid .chip.hit { border-color: #ff9a6a; }
.row { display: flex; gap: 8px; align-items: flex-end; }
.row .field { flex: 1; margin: 0; }
.row button { flex: none; width: auto; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); margin: 8px 0 12px; }
.check input { width: auto; margin: 0; }
.big-z { display: flex; align-items: center; gap: 14px; margin: 10px 0; }
.big-z b { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-family: "Noto Serif TC", serif; font-size: 34px; color: #1a1206; background: radial-gradient(circle at 40% 35%, #ffe6a8, #c8902e); box-shadow: 0 0 18px rgba(255, 211, 106, .5); flex: none; }
.big-z p { margin: 0; line-height: 1.6; }
.tag { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 12px; margin: 2px 4px 2px 0; background: rgba(255, 154, 106, .18); border: 1px solid rgba(255, 154, 106, .6); color: #ffd2b8; }
.tag.ok { background: rgba(120, 200, 160, .15); border-color: rgba(120, 200, 160, .6); color: #c8f0dc; }
.rel { margin: 6px 0; font-size: 14px; line-height: 1.7; }
.zones { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.zones div { border: 1px solid rgba(255, 211, 106, .25); border-radius: 8px; padding: 6px; font-size: 11px; background: rgba(20, 34, 70, .5); }
.zones div b { display: block; font-family: "Noto Serif TC", serif; font-size: 14px; color: var(--green); }
.zones span { display: inline-block; margin: 1px 4px 1px 0; } .zones span.gold { color: #ffd36a; font-weight: 700; } .zones span.front::before { content: '★'; color: #ffd36a; }
.steps { display: flex; gap: 4px; margin: 0 0 12px; }
.steps i { flex: 1; height: 5px; border-radius: 9px; background: rgba(255, 255, 255, .12); }
.steps i.on { background: linear-gradient(90deg, #f0c060, #ffd36a); }
.incense { display: flex; justify-content: center; gap: 26px; height: 120px; align-items: flex-end; margin: 6px 0 12px; }
.incense span { position: relative; width: 6px; height: 96px; border-radius: 3px; background: linear-gradient(180deg, #8a3a2a 0 70%, #c8a060 70%); }
.incense span.lit::before { content: ''; position: absolute; top: -5px; left: -2px; width: 10px; height: 10px; border-radius: 50%; background: #ff7a3a; box-shadow: 0 0 12px #ff9a4a, 0 0 22px #ff6a2a; }
.incense span.lit::after { content: ''; position: absolute; top: -48px; left: 1px; width: 4px; height: 42px; background: linear-gradient(0deg, rgba(220, 220, 240, .55), transparent); border-radius: 4px; animation: smoke 3s ease-in-out infinite; }
@keyframes smoke { 50% { transform: translateX(6px) scaleY(1.15); opacity: .6; } }
.shu { font-family: "Noto Serif TC", serif; line-height: 1.9; background: linear-gradient(180deg, #f7e7c0, #e8cf96); color: #3a1a0a; border-radius: 6px; padding: 12px 14px; font-size: 15px; border: 2px solid #b8322b; transition: transform 1.2s, opacity 1.2s, filter 1.2s; }
.shu.burn { transform: translateY(-60px) scale(.8); opacity: 0; filter: sepia(1) brightness(1.6); }
.firebar { position: relative; height: 34px; border-radius: 99px; background: linear-gradient(90deg, #3a1a10, #7a2a10, #3a1a10); margin: 12px 0; overflow: hidden; border: 1px solid rgba(255, 154, 106, .5); }
.firebar .zone { position: absolute; top: 0; bottom: 0; background: rgba(255, 211, 106, .45); border-left: 2px solid #ffd36a; border-right: 2px solid #ffd36a; }
.firebar .mk { position: absolute; top: 3px; width: 26px; height: 26px; margin-left: -13px; border-radius: 50%; background: radial-gradient(circle, #fff6c0, #ff9a3a); box-shadow: 0 0 14px #ff8a2a; }
.coals { display: flex; justify-content: center; gap: 6px; margin: 6px 0; }
.coals i { width: 26px; height: 14px; border-radius: 6px; background: #3a2a2a; }
.coals i.on { background: radial-gradient(circle, #ffd36a, #ff6a2a); box-shadow: 0 0 10px #ff6a2a; }
.cardimg { display: block; width: 100%; max-width: 300px; margin: 8px auto; border-radius: 10px; box-shadow: 0 0 24px rgba(255, 211, 106, .35); }
.items { display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 8px; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; background: rgba(0, 0, 0, .3); }
.item b { font-size: 15px; } .item span { font-size: 12px; color: var(--dim); grid-column: 1; }
.item button { grid-row: 1 / 3; grid-column: 2; border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; background: rgba(0, 0, 0, .35); }
.item button.on { background: var(--red); color: #1a1206; }
.amounts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.story p { margin: 0; font-size: 15px; line-height: 1.8; }
@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; } .disc { top: calc(52px + var(--safe-t)); } }

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

/* 2F 星斗閣・渾天儀：六十甲子表 */
.jzgrid { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 10px 0; }
.jz { display: grid; place-items: center; padding: 4px 0; border-radius: 8px; border: 1px solid rgba(232, 190, 90, .25); background: rgba(0, 0, 0, .25); font: 700 14px "Noto Serif TC", serif; color: #e8d8b0; }
.jz small { font: 400 10px "Noto Sans TC", sans-serif; color: var(--dim); }
.jz.mine { background: rgba(80, 120, 220, .3); }
.jz.nx { border-color: #e05030; }
.jz.cur { border-color: #ffd36a; background: rgba(255, 211, 106, .25); color: #fff3c0; }
@media (max-width: 520px) { .jz { font-size: 12px; } .jz small { font-size: 8px; } }
/* 手機窄螢幕：HUD 一行排得下（換宮廟、樂捐按鈕加入後會擠） */
@media (max-width: 520px) {
  .hud { gap: 5px; padding-left: 8px; padding-right: 8px; }
  .brand { font-size: 15px; padding: 5px 8px; white-space: nowrap; }
  .stats { gap: 4px; } .stats div { min-width: 38px; padding: 3px 5px; } .stats b { font-size: 13px; }
  .hud .right { display: flex; gap: 4px; flex-wrap: nowrap; }
  .hud .pill, .hud .tn-btn { padding: 5px 8px; font-size: 12px; white-space: nowrap; min-height: 32px; }
}
@media (max-width: 400px) { .brand { font-size: 0; padding: 5px 7px; } .brand::before { content: "歲"; font-size: 16px; } }
/* 第 91 輪：今日安歲五件事、替身祭解 */
.tsToday { position: fixed; left: max(8px, env(safe-area-inset-left)); top: calc(50% - 124px); z-index: 20; width: 52px; min-height: 52px; border-radius: 14px; border: 1px solid #d9a441; background: rgba(12, 16, 40, .88); color: #fff6dc; 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; }
.tsToday b { display: block; font-size: 16px; }
.tsToday.done { border-color: #ffd36a; background: rgba(90, 64, 14, .92); }
body.sheetOpen .tsToday, body.sheetOpen .flbar, body.sheetOpen .tevBtn { display: none; }
.tdRow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid rgba(217, 164, 65, .25); font-size: 16px; }
.tdRow i { font-style: normal; font-family: "Noto Serif TC", serif; font-weight: 900; width: 30px; text-align: center; color: #ffd36a; }
.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, #c8463a, #7a1a16); color: #fff; }
.tdRow em { font-style: normal; color: #ffe6a8; font-weight: 700; min-width: 92px; text-align: center; font-size: 15px; }
.tsParts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tsParts button { min-height: 64px; border-radius: 14px; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); color: #fff6dc; font: 600 14px "Noto Sans TC", sans-serif; padding: 6px; }
.tsParts button b { display: block; font: 900 24px "Noto Serif TC", serif; color: #ffd36a; }
.tsParts button.on { background: rgba(154, 42, 42, .75); border-color: #ffd36a; }
.tsParts small { font-size: 14px; }
.amounts .chip { min-height: 44px; min-width: 72px; font-size: 15px; }
/* 第 107 輪：打春牛、平安印台 */
.tsBig { min-height: 56px; font-size: 17px; width: 100%; }
.yinKinds .chip { min-height: 44px; min-width: 88px; font-size: 15px; }
.tdMore { margin: 14px 0 2px; font-size: 15px; color: #ffe6a8; }
.tdRow span small { display: block; font-size: 13px; color: #ffe6a8; opacity: .85; }
/* 第 129 輪：添油香對象、選生肖格子手機好按（≥44px） */
.oilFor { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.sheet .oilFor .chip { min-height: 46px; font-size: 16px; padding: 6px 0; text-align: center; }
.zgrid .chip { min-height: 44px; }
/* 第 151 輪：謝太歲感恩牌、星盤接福星＋③長輩友善（面板字放大、選項與關閉鈕 ≥44px） */
.sheet .sub { font-size: 15px; line-height: 1.6; }
.sheet h3 { font-size: 16px; }
.sheet .note { font-size: 14px; }
.sheet .card p { font-size: 15px; line-height: 1.6; }
.sheet .chip { font-size: 15px; min-height: 44px; }
.sheet .x { min-width: 44px; min-height: 44px; font-size: 26px; right: 4px; top: 2px; }
.toast { font-size: 15px; }
.xieChips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.xieChips .chip { min-height: 46px; font-size: 16px; padding: 6px 4px; text-align: center; }
.fxInfo { display: flex; justify-content: space-between; font-size: 17px; margin: 4px 0 10px; }
.fxInfo b { color: #ffd36a; font-size: 22px; }
.fxGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.fxBtn { height: 84px; border-radius: 16px; border: 2px solid #3a4a7a; background: #101a3a; color: #3a4a7a; font-size: 34px; touch-action: manipulation; transition: background .12s, transform .08s; }
.fxBtn.lit { background: radial-gradient(circle, #fff3c0, #e8a830); color: #7a4a00; border-color: #ffe08a; box-shadow: 0 0 18px rgba(255, 224, 138, .7); }
.fxBtn.miss { background: #8a1a16; border-color: #ff6a5a; }
.fxBtn:active { transform: scale(.94); }
.fxTip { text-align: center; font-size: 16px; color: #ffe6a8; margin: 10px 0 0; min-height: 24px; }
