body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 60% at 50% -10%, rgba(47,109,83,.28), transparent 60%),
    radial-gradient(80% 40% at 50% 110%, rgba(201,164,92,.10), transparent 70%),
    var(--bg);
  font-size: 17px;
}
#app { max-width: 520px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom)); }
.boot { text-align: center; padding-top: 30vh; font-size: 28px; color: var(--gold); }

h1.brand { font-family: var(--display); font-weight: 900; color: var(--gold); text-align: center; letter-spacing: .12em; margin: 18px 0 0; font-size: 30px; }
.brand-sub { font-family: var(--display); text-align: center; color: var(--cream); letter-spacing: .32em; font-size: 12px; margin: 6px 0 22px; opacity: .8; }

.card { background: linear-gradient(180deg, var(--panel2), var(--panel)); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 12px 0; }
.card h2, .card h3 { font-family: var(--display); color: var(--gold); margin: 0 0 8px; font-weight: 700; letter-spacing: .06em; }
.card h2 { font-size: 20px; } .card h3 { font-size: 16px; }
.card p { line-height: 1.45; margin: 6px 0; }
.lead { font-family: var(--serif); font-size: 21px; line-height: 1.35; color: var(--cream); }

label.fld { display: block; font-size: 14px; color: var(--muted); margin: 14px 0 6px; }
input.txt, textarea.txt {
  width: 100%; font-size: 20px; padding: 14px; border-radius: 12px; border: 1px solid var(--line);
  background: #0e1411; color: var(--cream); outline: none;
}
input.txt:focus, textarea.txt:focus { border-color: var(--gold); }
.btn.big { width: 100%; padding: 17px; font-size: 19px; border-radius: 14px; margin-top: 14px; }

.symgrid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.symgrid button { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line); background: #0e1411; color: var(--gold2); font-size: 26px; font-family: 'Segoe UI Symbol','Apple Symbols','Noto Sans Symbols 2',serif; }
.symgrid button.on { border-color: var(--gold); background: #23302a; box-shadow: 0 0 0 2px var(--gold) inset; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.colors button { width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent; }
.colors button.on { border-color: var(--gold2); box-shadow: 0 0 0 3px #0b0f0d inset; }
.preview { display: flex; justify-content: center; margin: 8px 0 4px; }

.top { display: flex; align-items: center; gap: 12px; padding: 4px 0 10px; border-bottom: 1px solid var(--line); }
.top .who { flex: 1; min-width: 0; }
.top .name { font-weight: 700; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.chip.gold { border-color: var(--gold); color: var(--gold2); }
.chip.red { border-color: var(--blood2); color: #e79a9a; }
.pot { text-align: right; font-family: var(--display); color: var(--gold2); font-size: 18px; }
.pot small { display: block; font-size: 10px; color: var(--muted); letter-spacing: .2em; }

.phase { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0 4px; }
.phase .t { font-family: var(--display); color: var(--gold); font-size: 15px; letter-spacing: .1em; }
.phase .clock { font-family: var(--display); font-size: 26px; color: var(--cream); font-variant-numeric: tabular-nums; }
.phase .clock.paused { color: var(--muted); }
.phase .round { color: var(--muted); font-size: 13px; }

.identity { position: relative; overflow: hidden; text-align: center; cursor: pointer; user-select: none; min-height: 92px; }
.identity .cover { font-family: var(--display); letter-spacing: .14em; color: var(--muted); padding: 18px 0; }
.identity .cover b { display: block; color: var(--gold); font-size: 15px; margin-bottom: 4px; }
.identity .role { font-family: var(--display); font-size: 34px; font-weight: 900; letter-spacing: .12em; margin: 6px 0 2px; }
.identity .role.traitor { color: #d76a6a; text-shadow: 0 0 18px rgba(155,47,47,.6); }
.identity .role.faithful { color: var(--gold2); text-shadow: 0 0 18px rgba(201,164,92,.4); }
.identity ul { text-align: left; padding-left: 20px; margin: 10px 0 0; line-height: 1.5; }
.identity .bar { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--gold); transition: width linear; }

.picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; }
.picker button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 4px; border-radius: 14px; border: 1px solid var(--line); background: #0e1411; font-size: 14px; color: var(--text); min-height: 96px; }
.picker button span.nm { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.picker button.on { border-color: var(--gold); background: #24322b; box-shadow: 0 0 0 2px var(--gold) inset; }
.picker button:disabled { opacity: .35; }

.steps { display: flex; gap: 6px; justify-content: center; margin: 6px 0 2px; }
.steps i { width: 30px; height: 5px; border-radius: 3px; background: var(--line); }
.steps i.done { background: var(--gold); }
.steps i.cur { background: var(--cream); }

.opts { display: grid; gap: 10px; margin-top: 12px; }
.opts button { text-align: left; padding: 15px; border-radius: 12px; border: 1px solid var(--line); background: #0e1411; font-size: 17px; }
.opts button.right { border-color: var(--ok); background: #1a3326; }
.opts button.wrong { border-color: var(--blood2); background: #351c1c; }

.chat { max-height: 38vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: #0b100d; border-radius: 10px; border: 1px solid var(--line); }
.chat .m { font-size: 15px; line-height: 1.35; }
.chat .m b { color: var(--gold2); }
.chat .m.sys { color: var(--muted); font-style: italic; font-family: var(--serif); font-size: 17px; }
.chatrow { display: flex; gap: 8px; margin-top: 8px; }
.chatrow input { flex: 1; font-size: 17px; padding: 12px; }
.chatrow .btn { padding: 0 16px; }

.sealed { text-align: center; padding: 26px 10px; }
.sealed .candle { font-size: 40px; display: block; margin-bottom: 8px; animation: flick 2.6s infinite; }
@keyframes flick { 0%,100% { opacity: .85; } 50% { opacity: 1; } 70% { opacity: .7; } }

.big-choice { display: grid; gap: 12px; margin-top: 12px; }
.big-choice .btn { padding: 22px; font-size: 20px; font-family: var(--display); letter-spacing: .08em; }

.mission { border-left: 3px solid var(--gold); padding: 8px 0 8px 12px; margin: 10px 0; }
.mission .rw { font-size: 13px; color: var(--muted); margin-top: 4px; }
.inbox .msg { font-size: 15px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.inbox .msg:last-child { border: 0; }
.inbox .msg.bad { color: #e79a9a; } .inbox .msg.good { color: var(--gold2); }

.team { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.team .mem { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; width: 64px; text-align: center; }
.pre { white-space: pre-wrap; font-family: var(--serif); font-size: 19px; line-height: 1.4; }

.lobbylist { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 8px; }
.lobbylist .mem { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; width: 62px; text-align: center; overflow: hidden; }

.modal { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,.72); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.modal .sheet { width: 100%; max-width: 480px; background: var(--panel2); border: 1px solid var(--gold); border-radius: 18px; padding: 22px; text-align: center; margin-bottom: env(safe-area-inset-bottom); }
.modal .sheet h2 { font-family: var(--display); color: var(--gold); margin: 6px 0 4px; }
.modal .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }

.winner { text-align: center; padding: 18px 0; }
.winner .w { font-family: var(--display); font-weight: 900; font-size: 30px; letter-spacing: .1em; color: var(--gold); }
table.roles { width: 100%; border-collapse: collapse; font-size: 15px; }
table.roles td { padding: 6px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tr { color: #e07a7a; font-weight: 700; } .fa { color: var(--gold2); }
.hint { font-size: 14px; color: var(--muted); }
details summary { cursor: pointer; color: var(--gold); font-size: 15px; padding: 4px 0; }

.chbanner { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; padding: 12px; margin: -4px 0 12px; border-radius: 12px; border: 1px solid var(--gold); background: #2a2616; }
.chbanner b { font-family: var(--display); font-size: 26px; letter-spacing: .14em; color: var(--gold2); }
.chbanner span { font-size: 14px; color: var(--muted); }
.chbanner.go { background: #13261c; border-color: var(--ok); } .chbanner.go b { color: #9fe0b8; }
.myteam { margin: 12px 0; padding: 12px; border-radius: 12px; background: #0e1411; border: 1px solid var(--line); }
.myteam .tname { font-family: var(--display); font-size: 22px; color: var(--gold); letter-spacing: .08em; margin: 2px 0 6px; }

/* v2.3: twists, points, toasts */
.card.twist { border-color: var(--ember, #e08a3c); box-shadow: 0 0 18px rgba(224,138,60,.18); }
.lotrow { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.lotrow .txt { margin: 0; }
.twistbox { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 12px 0; }
.adv { padding: 6px 0; } .adv.spent { opacity: .55; }
.inbox .msg.toast { color: #f0d9a8; font-style: italic; }
.inbox .msg.toast::before { content: '🥂\FE0E  '; }

/* v2.4: app shell, alerts, readiness */
#splash { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; background: radial-gradient(80% 60% at 50% 40%, #13201a, #050706); color: var(--gold); text-align: center; }
#splash .display { font-size: 30px; letter-spacing: .2em; }
#splash .sub { font-family: var(--serif); font-style: italic; color: var(--cream); font-size: 18px; }
#splash .flicker { margin-top: 18px; color: var(--muted); font-size: 13px; letter-spacing: .15em; animation: pulse 1.8s ease-in-out infinite; }
#fm-banner { position: fixed; left: 10px; right: 10px; top: calc(10px + env(safe-area-inset-top)); z-index: 90; display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; background: rgba(15,22,18,.97); border: 1px solid var(--gold); box-shadow: 0 10px 40px rgba(0,0,0,.6), 0 0 24px rgba(201,164,92,.25); }
#fm-banner.show { animation: bnIn .35s ease both; }
@keyframes bnIn { from { transform: translateY(-120%); } to { transform: none; } }
#fm-banner .bn-text { flex: 1; font-family: var(--serif); font-size: 17px; color: var(--cream); }
#fm-banner .bn-text small { display: block; font-family: var(--display); color: var(--gold); font-size: 10px; letter-spacing: .25em; }
#fm-banner .bn-x { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 4px 6px; }
.pending { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.pend { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--gold); background: rgba(201,164,92,.12); color: var(--cream); font: inherit; }
.pend.opt { border-color: var(--line); background: transparent; }
.pend .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 8px var(--gold); animation: pulse 1.4s ease-in-out infinite; }
.pend.opt .dot { background: var(--muted); box-shadow: none; animation: none; }
.pend .pl { flex: 1; font-weight: 600; } .pend .pt { font-variant-numeric: tabular-nums; color: var(--gold2); }
.phonecard .chk { display: grid; grid-template-columns: 26px 1fr; gap: 6px; padding: 9px 0; border-top: 1px solid var(--line); }
.phonecard .chk .mark { width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); }
.phonecard .chk.ok .mark { background: var(--gold); color: #1a1408; border-color: var(--gold); }
.phonecard .chk.warn .mark { border-color: #e08a3c; color: #e08a3c; }
.phonecard .row { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.phonecard .prefs { display: flex; gap: 16px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.seat { letter-spacing: .12em; font-family: ui-monospace, Menlo, Consolas, monospace; }
.inbox .unread { margin-left: 8px; font-size: 12px; background: var(--gold); color: #1a1408; border-radius: 99px; padding: 2px 8px; font-family: var(--ui, sans-serif); letter-spacing: 0; }
.inbox .msg.new { border-left: 3px solid var(--gold); padding-left: 8px; }
@keyframes pulse { 50% { opacity: .55; } }

/* v2.5: the portrait picker and nameplates */
.pt-modal { position: fixed; inset: 0; z-index: 120; background: radial-gradient(90% 70% at 50% 35%, #13201a, #040605); display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.pt-card { width: 100%; max-width: 420px; text-align: center; }
.pt-card h2 { font-family: var(--display); color: var(--gold); letter-spacing: .08em; }
.pt-choices { display: flex; flex-direction: column; gap: 10px; margin: 18px 0; }
.pt-stage { position: relative; width: min(280px, 78vw); aspect-ratio: 1; margin: 14px auto; }
.pt-canvas, .pt-video { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; touch-action: none; background: #0b0f0d; }
.pt-video { transform: scaleX(-1); }
.pt-ring { position: absolute; inset: -6px; border-radius: 50%; pointer-events: none; box-shadow: 0 0 0 3px #e8d39b, 0 0 0 7px #6e5424, 0 0 0 9px #c9a45c, 0 10px 30px rgba(0,0,0,.6); }
.pt-zoom { width: 80%; accent-color: var(--gold); }
.pt-row { display: flex; gap: 10px; justify-content: center; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.pt-row .btn.big { width: auto; margin-top: 0; padding: 14px 22px; }
.pt-confirm { display: flex; flex-direction: column; align-items: center; gap: 16px; margin: 22px 0 10px; }
.pt-note { margin-top: 14px; }
.nameplate { display: inline-block; padding: 6px 18px; border: 1px solid var(--gold); border-radius: 4px; font-family: var(--display); letter-spacing: .14em; color: var(--gold2);
  background: linear-gradient(180deg, rgba(201,164,92,.16), rgba(201,164,92,.04)); text-transform: uppercase; font-size: 15px; }
.avbtn { background: none; border: 0; padding: 0; cursor: pointer; }
