:root {
  --bg: #0f1626;
  --card: #1a2438;
  --line: #2c3a56;
  --text: #eef1f7;
  --dim: #98a3b8;
  --gold: #e0b85a;
  --good: #5aa9f0;
  --evil: #ef6b6b;
  --ok: #4fbf87;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 -apple-system, "PingFang TC", "Noto Sans TC", system-ui, sans-serif; -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
main { max-width: 520px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
main.remote { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
h1 { font-size: 40px; margin: 24px 0 0; color: var(--gold); text-align: center; letter-spacing: 6px; }
h2 { font-size: 17px; margin: 0 0 10px; }
h3 { font-size: 14px; margin: 14px 0 6px; color: var(--dim); }
p { margin: 6px 0; }
small { color: var(--dim); font-size: 12px; }
.sub, .center-text { text-align: center; color: var(--dim); }
.hint { color: var(--dim); font-size: 13px; }
.error, .warn { border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.error { background: #40202a; color: #ffb4b4; }
.warn { background: #3d3418; color: #ffe09a; }
.good { color: var(--good); }
.evil { color: var(--evil); }
.bigtext { font-size: 24px; text-align: center; font-weight: 700; }
.center { min-height: 80dvh; align-items: center; justify-content: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
details.card { display: block; }
details.card summary { cursor: pointer; color: var(--dim); }
label { display: flex; flex-direction: column; gap: 6px; color: var(--dim); font-size: 13px; }
input:not([type=checkbox]) { font: inherit; font-size: 18px; color: var(--text); background: #0c1220; border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; }
input:focus { outline: 2px solid var(--gold); }

button { font: inherit; color: var(--text); background: #26334d; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .4; cursor: default; }
button.primary { background: var(--gold); color: #201804; border-color: var(--gold); font-weight: 700; }
button.big { padding: 16px; font-size: 18px; width: 100%; }
button.ghost { background: none; border-color: transparent; color: var(--dim); }
button.yes { background: #1f5c43; border-color: var(--ok); font-weight: 700; }
button.no { background: #6a2530; border-color: var(--evil); font-weight: 700; }
button.cardbtn { background: #2b3a5a; border-color: var(--gold); font-weight: 700; padding: 28px 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.seg button.on { background: var(--gold); color: #201804; border-color: var(--gold); font-weight: 700; }

.roomhead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.code { font-size: 40px; font-weight: 800; letter-spacing: 8px; color: var(--gold); line-height: 1.1; }
.qr { width: 180px; margin: 0 auto; background: #fff; border-radius: 12px; padding: 6px; line-height: 0; }
.qr svg { width: 100%; height: auto; }

.plist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.plist li { display: flex; align-items: center; gap: 8px; background: #0c1220; border: 2px solid transparent; border-radius: 10px; padding: 8px 10px; min-height: 46px; }
.plist .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plist .off .nm, .chip.off { opacity: .45; }
.tag { font-size: 11px; background: var(--gold); color: #201804; border-radius: 6px; padding: 1px 6px; }
.tag.dim { background: var(--line); color: var(--dim); }
.rowbtns { display: flex; gap: 4px; }
.rowbtns button, button.mini { padding: 4px 9px; font-size: 13px; }
.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.opt { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 15px; background: #0c1220; border-radius: 10px; padding: 10px; }
.opt input { width: 20px; height: 20px; accent-color: var(--gold); }
.opt small { margin-left: auto; }

.score { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.quest { aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--line); background: var(--card); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.quest b { font-size: 22px; line-height: 1; }
.quest small { font-size: 10px; }
.quest.now { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(224, 184, 90, .25); }
.quest.win { background: #1d3f63; border-color: var(--good); }
.quest.lose { background: #5a222b; border-color: var(--evil); }
.rejects { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--dim); }
.rejects i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
.rejects i.x { background: var(--evil); border-color: var(--evil); }
.rejects small { margin-left: auto; }

.board { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.chip { display: flex; align-items: center; gap: 6px; background: #0c1220; border: 2px solid transparent; border-radius: 10px; padding: 8px 10px; min-height: 42px; }
.chip.me .nm { color: var(--gold); }
.chip .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .tags { font-size: 13px; white-space: nowrap; }
.speaking { border-color: var(--ok) !important; box-shadow: 0 0 8px rgba(79, 191, 135, .6); }

.picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pick { padding: 14px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick.on { background: var(--gold); color: #201804; border-color: var(--gold); font-weight: 700; }

.rolecard { border-radius: 12px; padding: 16px; text-align: center; border: 2px solid; color: var(--text); }
.rolecard.good { background: #15304d; border-color: var(--good); color: var(--text); }
.rolecard.evil { background: #4a1c25; border-color: var(--evil); color: var(--text); }
.rolecard.good .rname { color: var(--good); }
.rolecard.evil .rname { color: var(--evil); }
.rname { font-size: 30px; font-weight: 800; margin: 4px 0; }
.sees { font-size: 18px; font-weight: 700; margin-top: 10px; }
.hold { position: relative; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none; }
.hold .rolecard { visibility: hidden; }
.hold.show .rolecard { visibility: visible; }
.hold .cover { position: absolute; inset: 0; border-radius: 12px; background: #26334d; border: 2px dashed var(--gold); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 20px; font-weight: 700; color: var(--gold); }
.hold.show .cover { display: none; }

.hrow { border-top: 1px solid var(--line); padding: 8px 0; font-size: 14px; display: flex; flex-direction: column; gap: 2px; }
.reveal { list-style: none; margin: 0; padding: 0; }
.reveal li { display: flex; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }

.voicebar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; gap: 10px; justify-content: center; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(15, 22, 38, .94); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.vbtn { flex: 1; max-width: 240px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; font-size: 20px; border-radius: 999px; }
.vbtn span { font-size: 15px; }
.vbtn.on { background: #1f5c43; border-color: var(--ok); }

.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .65); display: flex; align-items: flex-end; justify-content: center; padding: 16px; z-index: 20; }
.sheet { width: 100%; max-width: 520px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: env(safe-area-inset-bottom); display: flex; flex-direction: column; gap: 6px; }
.sheet h2 { font-size: 22px; text-align: center; }
.toast { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); background: #000d; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 30; max-width: 90vw; text-align: center; }
.offline { position: sticky; top: 0; z-index: 10; background: #6a2530; text-align: center; font-size: 13px; padding: 6px; }
