:root { --bg: #08060b; --panel: rgba(18, 12, 16, .9); --line: rgba(192, 57, 43, .45); --red: #c0392b; --blood: #8e1b12; --paper: #e8c96a; --ink: #f1e6d6; --dim: #a8968a; --green: #7dffb0; --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: #e08a7a; }
#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, 10, 10, .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(192, 57, 43, .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: #e44a35; text-shadow: 0 0 18px rgba(228, 74, 53, .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, #d1442f, #8e1b12); color: #fff; font-weight: 700; border-radius: 12px; padding: 12px 16px; width: 100%; box-shadow: 0 0 18px rgba(192, 57, 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: #e44a35; 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: #f0b0a0; }
.bar button span { font-size: 11px; color: var(--dim); }
.bar button.gold i { background: var(--red); color: #fff; }
.bar button:active { background: rgba(192, 57, 43, .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: #ef6a55; font-size: 20px; }
.sheet .sub { color: var(--dim); font-size: 13px; margin: 0 0 12px; }
.sheet .x { position: absolute; right: 6px; top: 4px; font-size: 24px; color: var(--dim); min-width: 44px; min-height: 44px; display: grid; place-items: center; }
.sheet h3 { font-size: 14px; margin: 16px 0 8px; color: #f0b0a0; }
.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: #ffb4a4; }
.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(125, 255, 176, .25); border-radius: 8px; padding: 6px; font-size: 11px; text-align: center; background: rgba(10, 30, 20, .4); }
.lamplist div.flag { border-color: #e44a35; background: rgba(60, 10, 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, 6, 8, .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(10, 6, 8, .65); border-radius: 8px; padding: 4px 8px; font-size: 13px; transition: opacity .6s; }
.chatlog b { color: #f0b0a0; 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(18, 8, 10, .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); } }
/* 打小人遊戲 */
.game { position: fixed; inset: 0; z-index: 45; background: radial-gradient(circle at 50% 55%, rgba(60, 8, 8, .7), rgba(0, 0, 0, .94)); display: flex; flex-direction: column; align-items: center; padding: calc(10px + var(--safe-t)) 12px calc(12px + var(--safe-b)); }
.game-top { width: min(480px, 100%); display: flex; align-items: center; gap: 10px; }
.game-top span { background: var(--red); color: #fff; border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.game-top b { margin-left: auto; font-size: 18px; color: var(--paper); }
.game-top .x { font-size: 28px; color: var(--dim); padding: 0 6px; }
.chant { font-family: "Noto Serif TC", serif; font-weight: 900; font-size: clamp(18px, 5vw, 26px); color: #ff6b52; text-shadow: 0 0 12px rgba(255, 60, 40, .6); min-height: 1.6em; margin: 8px 0; text-align: center; }
#gCanvas { flex: 1; min-height: 0; max-width: 100%; aspect-ratio: 600 / 760; touch-action: none; cursor: none; }
.game-bot { width: min(420px, 100%); text-align: center; }
.shake { animation: shake .12s; }
@keyframes shake { 25% { transform: translate(4px, -3px); } 50% { transform: translate(-4px, 3px); } 75% { transform: translate(3px, 2px); } }
@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; }

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

/* 第 141 輪：貴人卡架、鹽米驅煞 */
.grKinds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 12px; }
.grKinds button { min-height: 48px; border-radius: 12px; border: 1px solid var(--line); background: rgba(0, 0, 0, .35); color: inherit; font: 700 15px "Noto Sans TC", sans-serif; padding: 6px 8px; text-align: left; touch-action: manipulation; }
.grKinds button.on { background: var(--red); border-color: var(--red); color: #fff; }
.grGo { position: sticky; bottom: 0; min-height: 52px; letter-spacing: .06em; font-size: 18px; }
/* 手機上打開面板時，左側樓層列、今日、今日活動按鈕先藏起來，不擋面板內容（關掉面板就回來） */
@media (max-width: 520px) { body.xrSheet .xrToday, body.xrSheet .flbar, body.xrSheet .tevBtn { visibility: hidden; } }
.grRes { background: rgba(255, 176, 74, .14); border: 1px solid rgba(255, 176, 74, .5); border-radius: 12px; padding: 10px 12px; font-size: 16px; line-height: 1.6; margin: 0 0 10px; }
.grRes span { font-size: 15px; color: #ffd9a0; }
.ymGrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 8px auto 4px; max-width: 246px; }
.ymGrid button { aspect-ratio: 1; min-height: 64px; border-radius: 18px; border: 1px solid rgba(244, 240, 230, .35); background: rgba(70, 60, 70, .55); touch-action: manipulation; transition: transform .12s; position: relative; }
.ymGrid button.on::after { content: '煞'; position: absolute; inset: 12%; border-radius: 50%; display: grid; place-items: center; font: 900 22px "Noto Serif TC", serif; color: #ff6a5a; background: radial-gradient(circle, #2a1830 0 45%, #120a14 75%, rgba(18, 10, 20, .3)); box-shadow: 0 0 14px rgba(120, 60, 160, .8); }
.ymGrid button.pop { transform: scale(.85); background: rgba(244, 240, 230, .55); }
.ymInfo { text-align: center; font-size: 16px; margin: 6px 0 10px; }
/* 11/28 驅邪鑼鼓：鑼鼓譜＋兩顆大按鈕 */
.lgSheet { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 10px 0 4px; }
.lgSheet i { font: 900 15px "Noto Serif TC", serif; font-style: normal; text-align: center; padding: 6px 0; border-radius: 8px; background: rgba(0, 0, 0, .35); border: 1px solid rgba(255, 255, 255, .12); transition: transform .1s; }
.lgSheet i.d { color: #ffb08a; } .lgSheet i.g { color: #ffe08a; } .lgSheet i.r { color: rgba(255, 255, 255, .3); }
.lgSheet i.demo { opacity: .6; }
.lgSheet i.now { transform: scale(1.18); background: #ff8a6a; color: #2a0800; opacity: 1; }
.lgSheet i.ok2 { background: #5aa83a; color: #fff; } .lgSheet i.ok1 { background: #8a9a3a; color: #fff; } .lgSheet i.bad, .lgSheet i.miss { background: rgba(120, 40, 40, .6); color: rgba(255, 255, 255, .6); }
.lgPads { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0 10px; }
.lgPads button { min-height: 84px; border-radius: 18px; border: 2px solid rgba(255, 200, 120, .5); background: rgba(90, 30, 20, .7); color: #fff3e0; font: 700 26px "Noto Sans TC", sans-serif; display: flex; flex-direction: column; align-items: center; justify-content: center; touch-action: manipulation; user-select: none; -webkit-user-select: none; transition: transform .1s; }
.lgPads button b { font: 900 22px "Noto Serif TC", serif; } .lgPads button small { font-size: 13px; opacity: .8; }
.lgPads button[data-p="g"] { background: rgba(110, 80, 20, .75); }
.lgPads button.pop { transform: scale(.92); background: #ffb04a; color: #2a0800; }
