:root {
  --bg: #0a0d19; --panel: #131729; --panel2: #1a1f36; --line: #2a3152; --text: #e9ebf7; --muted: #9399bb;
  --gold: #ffd98a; --red: #ff6b6b; --green: #7fe0a2; --purple: #c6b3ff; --blue: #8fc3ff;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: inherit; }
button, .btn { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
button:hover, .btn:hover { border-color: #4a5590; }
button:disabled { opacity: .4; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.ghost { background: transparent; }
.primary { background: var(--gold); color: #241a00; border-color: var(--gold); font-weight: 600; }
.muted { color: var(--muted); }

.top { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #0d1122; position: sticky; top: 0; z-index: 20; }
.brand { font-weight: 700; font-size: 18px; text-decoration: none; letter-spacing: .04em; }
.brand small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 6px; letter-spacing: 0; }

/* ---------- 主页 ---------- */
#home { max-width: 1120px; margin: 0 auto; padding: 24px 16px 40px; }
.hero h1 { font-size: clamp(22px, 4vw, 34px); margin: 8px 0; }
.hero p { color: var(--muted); max-width: 640px; margin: 0 0 22px; }
.games { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.gcard { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; height: 100%; transition: border-color .15s, transform .15s; }
.gcard:hover { border-color: var(--gold); transform: translateY(-2px); }
.gtop { display: flex; justify-content: space-between; align-items: baseline; }
.gno { font-weight: 700; font-size: 18px; }
.gmeta { color: var(--muted); font-size: 13px; }
.heads { display: flex; }
.heads img { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--c); background: #0d1122; margin-right: -6px; object-fit: cover; }
.heads.many img { width: 28px; height: 28px; margin-right: -9px; }
.hook { margin: 0; font-size: 14px; color: #d8dcf2; flex: 1; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag.old { background: #2a2f45; color: var(--muted); }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 99px; background: #2a2140; color: var(--purple); }
.herobtns { display: flex; gap: 10px; flex-wrap: wrap; margin: -8px 0 26px; }
.setting { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 14px; margin-bottom: 30px; scroll-margin-top: 70px; }
.setting h2 { margin: 0 0 6px; font-size: 22px; }
.setting h3 { margin: 20px 0 10px; font-size: 16px; color: var(--gold); }
.setting .lede { margin: 0; color: #d8dcf2; max-width: 820px; }
.setting .lede b { color: var(--text); }
.factions { display: grid; grid-template-columns: 1.35fr 1fr .8fr; gap: 12px; align-items: start; }
.fac { background: var(--panel2); border: 1px solid var(--line); border-top: 3px solid var(--blue); border-radius: 12px; padding: 12px 14px; }
.fac.evil { border-top-color: var(--red); } .fac.bug { border-top-color: #f1dc6a; }
.fac header { display: flex; gap: 10px; align-items: center; }
.fac .fic { font-size: 26px; }
.fac header b { display: block; font-size: 16px; } .fac header small { color: var(--muted); }
.fac .win { margin: 8px 0; font-size: 13px; color: var(--muted); }
.fac ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.fac li { display: grid; grid-template-columns: 24px 1fr; column-gap: 6px; font-size: 14px; line-height: 1.5; }
.fac li i { font-style: normal; grid-row: span 2; }
.fac li span { color: #c3c8e4; font-size: 13px; }
.fac.good li b { color: var(--blue); } .fac.evil li b { color: #ff8a8a; } .fac.bug li b { color: #f1dc6a; }
.dayflow { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; counter-reset: d; }
.dayflow li { background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; position: relative; }
.dayflow li b { display: block; margin-bottom: 4px; }
.dayflow li span { font-size: 13px; color: #c3c8e4; }
.twocol { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.note ul { margin: 0; padding-left: 18px; font-size: 14px; color: #d0d4ec; display: grid; gap: 4px; }
.evilc { color: #ff8a8a; } .fanc { color: #ffb36b; } .bugc { color: #f1dc6a; }
.small { font-size: 13px; margin: 14px 0 0; }
.gh { font-size: 20px; margin: 0 0 12px; scroll-margin-top: 70px; }
@media (max-width: 900px) {
  .factions { grid-template-columns: 1fr; }
  .dayflow { grid-template-columns: 1fr 1fr; }
  .twocol { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .setting { padding: 14px 14px 12px; }
  .dayflow { grid-template-columns: 1fr; }
}
.foot { color: var(--muted); font-size: 12px; margin-top: 28px; text-align: center; }

/* ---------- 回放页 ---------- */
#player { max-width: 1500px; margin: 0 auto; padding: 14px 16px 24px; }
.playgrid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.left { min-width: 0; }

.stage { position: relative; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: #000; user-select: none; container-type: inline-size; }
.bg { position: absolute; inset: 0; background-size: cover; background-position: center 30%; opacity: 0; transition: opacity .5s; }
.bg.on { opacity: 1; }
.bg[data-k=hall] { background-image: url(assets/scene/hall.webp); }
.bg[data-k=night] { background-image: url(assets/scene/night.webp); }
.bg[data-k=cryo] { background-image: url(assets/scene/cryo.webp); }
.bg[data-k=bridge] { background-image: url(assets/scene/bridge.webp); }
.stage[data-type=night_act] .bg.on, .stage[data-type=wolf] .bg.on { filter: brightness(.8); }

.lineup { position: absolute; inset: 0; transition: filter .35s; }
.stage.focus .lineup { filter: brightness(.3) saturate(.6); }
.actor { position: absolute; left: var(--x); bottom: 9%; height: 64%; width: 9%; transform: translateX(-50%); padding: 0; border: 0; background: none; border-radius: 0; z-index: var(--z); cursor: pointer; display: block; }
.actor:hover { border: 0; }
.actor .bob { position: absolute; left: 50%; bottom: 0; height: 100%; transform: translateX(-50%); transform-origin: 50% 100%; transition: transform .25s, filter .25s, opacity .25s; display: block; }
.actor img { height: 100%; width: auto; display: block; pointer-events: none; }
.actor.dim .bob { filter: brightness(.62); }
.actor.dead .bob { filter: grayscale(1) brightness(.55); opacity: .5; }
.actor.dead.erased .bob { opacity: .12; }
.actor.dead.sleep .bob { filter: grayscale(.4) brightness(.75) sepia(.2) hue-rotate(170deg); }
.actor.speaking { z-index: 30; }
.actor.speaking .bob { transform: translateX(-50%) scale(1.07); filter: drop-shadow(0 0 3px #fff3c0) drop-shadow(0 0 12px var(--gold)); animation: talk .32s ease-in-out infinite alternate; }
.actor.speaking[data-tone=angry] .bob { animation: shake .09s linear infinite alternate; }
.actor.speaking[data-tone=sad] .bob { animation: none; transform: translateX(-50%) translateY(2%) scale(1.05); }
.actor.target { z-index: 29; }
.actor.target .bob { filter: drop-shadow(0 0 3px #ffb0b0) drop-shadow(0 0 12px #ff4050); animation: nudge .5s ease-out 1; }
.actor.picked .plate { outline: 2px solid var(--gold); }
.actor.win .bob { animation: hop .6s ease-in-out infinite alternate; }
.actor.lose:not(.dead) .bob { filter: brightness(.6); }
@keyframes talk { from { transform: translateX(-50%) scale(1.07) translateY(0); } to { transform: translateX(-50%) scale(1.07) translateY(-1.2%); } }
@keyframes shake { from { transform: translateX(-52%) scale(1.07) rotate(-1deg); } to { transform: translateX(-48%) scale(1.07) rotate(1deg); } }
@keyframes nudge { 0%, 100% { transform: translateX(-50%); } 20% { transform: translateX(-55%); } 50% { transform: translateX(-46%); } 75% { transform: translateX(-52%); } }
@keyframes hop { from { transform: translateX(-50%) translateY(0); } to { transform: translateX(-50%) translateY(-3%); } }
.actor .mark { position: absolute; left: 50%; top: -9%; transform: translateX(-50%); font-size: clamp(14px, 2.4cqw, 34px); }
.actor .point { position: absolute; left: 50%; top: -13%; transform: translateX(-50%); font-size: clamp(16px, 2.8cqw, 40px); display: none; animation: bobp .5s ease-in-out infinite alternate; }
.actor.target .point { display: block; }
@keyframes bobp { from { translate: 0 0; } to { translate: 0 25%; } }
.actor .votes { position: absolute; left: 50%; top: 22%; transform: translate(-50%, -100%); min-width: 2.1em; height: 2.1em; line-height: 1.9em; border-radius: 50%; background: #d8283a; border: 2px solid #fff; color: #fff; font-weight: 700; font-size: clamp(11px, 1.8cqw, 24px); text-align: center; animation: popin .25s ease-out; z-index: 2; }
.actor .plate { position: absolute; left: 50%; top: 100%; transform: translate(-50%, 4px); background: rgba(14, 16, 30, .85); border: 2px solid var(--c); border-radius: 8px; padding: 1px 6px 2px; white-space: nowrap; line-height: 1.2; text-align: center; font-size: clamp(9px, 1.35cqw, 18px); }
.actor .plate b { display: block; font-weight: 600; }
.actor .plate i { display: block; font-style: normal; font-size: .8em; color: var(--blue); }
.actor .plate i.evil { color: #ff8a8a; } .actor .plate i.fan { color: #ffb36b; } .actor .plate i.bug { color: #f1dc6a; } .actor .plate i.claim { color: var(--gold); } .actor .plate i.unk { color: var(--muted); }
.actor.dead .plate { opacity: .6; }
.actor .plate .short { display: none; }
/* 14 人：人物缩小、名牌更紧凑 */
.stage.crowd .actor { height: 56%; width: 6.4%; bottom: 10%; }
.stage.crowd .actor .plate { font-size: clamp(8px, 1.15cqw, 15px); padding: 1px 4px 2px; border-width: 1.5px; }
.stage.crowd .actor .mark { font-size: clamp(11px, 1.9cqw, 26px); }
.stage.crowd .actor .votes { font-size: clamp(9px, 1.4cqw, 19px); }
@container (max-width: 700px) {
  .stage.crowd .actor .plate .full { display: none; }
  .stage.crowd .actor .plate .short { display: inline; }
}

.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }
.arrows .arc { fill: none; stroke-width: 3.5; stroke-linecap: round; opacity: .9; filter: drop-shadow(0 1px 2px #000); }
.arrows .arc.new { stroke-dasharray: 1000; stroke-dashoffset: 1000; animation: draw .45s ease-out forwards; stroke-width: 5; }
@keyframes draw { to { stroke-dashoffset: 0; } }

.bubble { position: absolute; top: 3.5%; z-index: 50; max-width: min(58%, 680px); background: rgba(255, 255, 255, .97); color: #1d1f2c; border: 3px solid var(--c); border-radius: 18px; padding: .45em .9em; font-size: clamp(13px, 2cqw, 26px); line-height: 1.4; display: flex; gap: .4em; align-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.45); }
.bubble::after { content: ""; position: absolute; left: var(--tail); bottom: -12px; width: 18px; height: 18px; background: #fff; border-right: 3px solid var(--c); border-bottom: 3px solid var(--c); transform: translateX(-50%) rotate(45deg); }
.bubble.pop { animation: popin .25s cubic-bezier(.3, 1.6, .5, 1); }
.bemo:empty { display: none; }
@keyframes popin { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.daychip { position: absolute; right: 1.5%; top: 2.5%; z-index: 45; background: rgba(10, 12, 24, .78); padding: .15em .7em; border-radius: 10px; font-size: clamp(11px, 1.6cqw, 22px); }
.stage.focus .plate, .stage.focus .mark, .stage.focus .votes { opacity: 0; }

.overlay { position: absolute; inset: 0; z-index: 60; display: none; align-items: center; justify-content: center; pointer-events: none; overflow: hidden; }
.overlay.show { display: flex; }
.overlay .band { width: 100%; background: rgba(0, 0, 0, .66); padding: 2.2% 4%; text-align: center; animation: bandin .35s ease-out; }
@keyframes bandin { from { clip-path: inset(50% 0 50% 0); } to { clip-path: inset(0 0 0 0); } }
.btitle { font-size: clamp(24px, 6.5cqw, 92px); font-weight: 800; letter-spacing: .04em; text-shadow: 0 3px 0 #000, 0 0 24px rgba(0,0,0,.6); }
.btitle .ic { margin-right: .25em; }
.bsub { font-size: clamp(12px, 2.1cqw, 30px); color: #d8dcff; margin-top: .3em; }
.narr { width: min(84%, 900px); background: rgba(8, 10, 24, .86); border: 2px solid rgba(255, 215, 130, .8); border-radius: 18px; padding: 2% 3%; animation: popin .3s ease-out; }
.narr small { color: var(--gold); font-size: clamp(10px, 1.3cqw, 16px); }
.narr p { margin: .2em 0 0; font-size: clamp(14px, 2.6cqw, 34px); color: #ffefcf; text-align: center; }
.card { background: rgba(10, 12, 26, .9); border: 2px solid var(--line); border-radius: 18px; padding: 2% 3%; text-align: center; animation: popin .3s ease-out; font-size: clamp(12px, 2cqw, 26px); min-width: 50%; }
.card p { margin: .3em 0; }
.card .act { font-size: 2.4em; }
.duo { display: flex; align-items: center; justify-content: center; gap: 4%; }
.duo figure { margin: 0; }
.duo figcaption { font-size: .85em; }
.hd { width: 2.6em; height: 2.6em; border-radius: 50%; border: 3px solid var(--c); object-fit: cover; background: #0d1122; vertical-align: middle; }
.duo .hd { width: 4.4em; height: 4.4em; }
.hd.bad { border-color: var(--red); box-shadow: 0 0 18px var(--red); }
.result { display: inline-block; margin-top: .3em; padding: .15em 1em; border-radius: 10px; font-weight: 700; font-size: 1.3em; border: 2px solid; animation: stamp .35s .5s both cubic-bezier(.3, 1.6, .5, 1); }
.result.bad { color: var(--red); border-color: var(--red); } .result.good { color: var(--green); border-color: var(--green); }
@keyframes stamp { from { transform: scale(2.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.card ul { list-style: none; padding: 0; margin: .4em 0 0; display: grid; gap: .35em; }
.card li { display: flex; align-items: center; justify-content: center; gap: .6em; }
.card.wolf { border-color: #a03040; }
.card.tally li { justify-content: flex-start; } .card.tally li b { margin-left: auto; color: var(--red); }
.solo { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; padding-bottom: 3%; }
.solo .pt { height: 66%; animation: popin .35s ease-out; }
.solo .pt.gray { filter: grayscale(1) brightness(.7); animation: fadeout 2.2s .4s forwards; }
@keyframes fadeout { to { opacity: .35; transform: translateY(4%); } }
.solo .pt.glitch { filter: hue-rotate(90deg) saturate(1.6) contrast(1.2); animation: glitch .18s steps(2) 8, fadeout 1.6s 1.4s forwards; }
@keyframes glitch { 0% { transform: translateX(-2%) skewX(4deg); clip-path: inset(10% 0 40% 0); } 50% { transform: translateX(2%) skewX(-4deg); clip-path: inset(50% 0 5% 0); } 100% { transform: none; clip-path: none; } }
.solo .pt.ice { filter: sepia(.3) hue-rotate(170deg) saturate(1.3) brightness(1.05); opacity: .85; }
.pod { height: 70%; display: flex; justify-content: center; align-items: flex-end; padding: 0 2.5%; border: 4px solid rgba(225, 242, 255, .9); border-radius: 40px; background: rgba(190, 225, 255, .18); box-shadow: 0 0 40px rgba(150, 210, 255, .45) inset; }
.pod .pt { height: 94%; }
.stitle { margin-top: 1.4%; font-size: clamp(18px, 4.2cqw, 58px); font-weight: 800; text-shadow: 0 3px 0 #000; background: rgba(0,0,0,.55); padding: 0 .6em; border-radius: 12px; }
.ssub { font-size: clamp(12px, 2.3cqw, 32px); font-weight: 700; text-shadow: 0 2px 0 #000; }
.ssub.bad { color: var(--red); } .ssub.good { color: var(--green); }
.endband { position: absolute; top: 0; left: 0; right: 0; background: linear-gradient(rgba(0, 0, 0, .75), rgba(0, 0, 0, .45)); text-align: center; padding: 1.2% 0 1.4%; }
.endband .btitle { font-size: clamp(22px, 5.4cqw, 76px); }
.endband.bad .btitle { color: #ff8080; } .endband.good .btitle { color: #8fe9ad; } .endband.bugw .btitle { color: #f1dc6a; }
.endbtns { display: flex; gap: 10px; margin-top: 8px; }
.overlay.end { display: block; }
.stage[data-type=end] .lineup { filter: none; }
.conf { position: absolute; top: -4%; left: var(--l); width: 10px; height: 6px; background: hsl(var(--h) 85% 65%); animation: fall 3.2s var(--d) linear infinite; }
@keyframes fall { to { transform: translateY(1100%) rotate(540deg); top: 104%; } }

.start { position: absolute; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; background: rgba(5, 7, 16, .72); backdrop-filter: blur(2px); }
.startcard { text-align: center; padding: 16px; }
.startcard h2 { font-size: clamp(22px, 5cqw, 52px); margin: 0; }
.startcard p { color: #cfd3ee; margin: .3em 0 1em; font-size: clamp(12px, 1.8cqw, 18px); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { border: 0; border-radius: 0; background: transparent; padding: 6px 10px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed=true] { background: #2c3458; color: var(--gold); }
.seg.big button { flex-direction: column; padding: 8px 18px; }
.seg.big small { color: var(--muted); font-size: 12px; }
.go { margin-top: 16px; font-size: 18px; padding: 8px 26px; }

.caption { background: var(--panel); border: 1px solid var(--line); border-top: 4px solid var(--line); border-radius: 0 0 14px 14px; padding: 10px 16px 12px; min-height: 104px; margin-top: -6px; }
.cwrap { display: flex; gap: 12px; align-items: flex-start; }
.cface { width: 84px; height: 84px; border-radius: 14px; border: 3px solid var(--c); object-fit: cover; background: #0d1122; flex: none; animation: popin .2s ease-out; }
.cbody { min-width: 0; flex: 1; }
@media (max-width: 640px) { .cface { width: 60px; height: 60px; border-radius: 10px; } }
.cline { display: flex; align-items: center; gap: 8px; min-height: 26px; flex-wrap: wrap; }
.who { background: var(--c); color: #fff; padding: 1px 10px; border-radius: 8px; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
.kind { color: #ffd27a; font-size: 14px; }
.lie { font-size: 12px; color: #fff; background: #b8323f; padding: 0 6px; border-radius: 6px; }
.ctext { margin: 4px 0 0; font-size: clamp(16px, 1.6vw, 21px); }
.thought { margin: 4px 0 0; color: var(--purple); font-size: 14px; }
.thought b { font-weight: 400; opacity: .8; }

.controls { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.transport { display: flex; gap: 6px; align-items: center; flex: 1 1 340px; }
.transport input { flex: 1; accent-color: var(--gold); min-width: 80px; }
/* 船员视角：没播到的部分画成暗条，表示拖不过去 */
.transport input.limited { -webkit-appearance: none; appearance: none; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #6b6f8f 0 var(--reach), #23283f var(--reach) 100%); }
.transport input.limited::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--gold); border: 0; }
.transport input.limited::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--gold); border: 0; }
.pos { color: var(--muted); font-size: 13px; min-width: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.toggles { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.logwrap { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; display: flex; flex-direction: column; position: sticky; top: 64px; max-height: calc(100vh - 80px); }
.logbar { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 6px; font-size: 14px; min-height: 48px; }
.logbar .hd { width: 26px; height: 26px; border-width: 2px; }
.logbar .x { margin-left: auto; padding: 2px 8px; }
.log { list-style: none; margin: 0; padding: 6px; overflow-y: auto; flex: 1; position: relative; }
.log li { padding: 6px 8px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.log li:hover { background: #1c2240; }
.log li.cur { background: #262e55; box-shadow: inset 3px 0 0 var(--gold); }
.lhead { font-weight: 700; color: var(--gold); margin-top: 6px; }
.log li.lturn { font-size: 12px; color: var(--muted); padding: 2px 8px; cursor: default; border-top: 1px dashed var(--line); margin-top: 4px; border-radius: 0; }
.log li.lturn:hover { background: none; }
.lsay.lreply { margin-left: 22px; padding-left: 8px; border-left: 2px solid var(--line); border-radius: 0 10px 10px 0; }
.lsay { display: flex; gap: 8px; align-items: flex-start; }
.lsay .hd { width: 30px; height: 30px; border-width: 2px; flex: none; }
.lsay p { margin: 0; }
.lmeta { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.lmeta b { font-size: 13px; color: color-mix(in srgb, var(--c) 55%, #fff); }
.lclaim p:first-of-type { color: var(--gold); }
.lev { color: #c9cde6; }
.lev.secret { color: #b9a9e8; }
.l-death, .l-sleep { color: #ffb4b4; }
.log .thought { font-size: 12.5px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px; max-width: 560px; width: calc(100% - 32px); padding: 18px 22px; }
dialog::backdrop { background: rgba(0, 0, 0, .6); }
dialog h2 { margin-top: 0; } dialog h3 { margin-bottom: 6px; }
dialog .close { position: absolute; right: 12px; top: 12px; }
.flow { padding-left: 18px; } .flow b { margin-right: 8px; }
.roles { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.roles li { display: grid; grid-template-columns: 28px 56px 1fr; gap: 6px; align-items: center; }
.roles li.evil b { color: #ff8a8a; } .roles li.fan b { color: #ffb36b; } .roles li.bug b { color: #f1dc6a; }

@media (max-width: 1000px) {
  .playgrid { grid-template-columns: 1fr; }
  .logwrap { position: static; max-height: 60vh; }
}
@media (max-width: 640px) {
  #player { padding: 8px 0 20px; }
  .left { padding: 0; }
  .stage { aspect-ratio: 4 / 3; border-radius: 0; }
  .bg { background-position: center; }
  .actor { height: 60%; bottom: 13%; }
  .stage.crowd .actor { height: 50%; bottom: 14%; }
  .bubble { display: none !important; }
  .caption { border-radius: 0; border-left: 0; border-right: 0; margin-top: 0; }
  .controls, .logwrap { margin-left: 16px; margin-right: 16px; }
  .logwrap { margin-top: 12px; }
  .toggles { width: 100%; justify-content: space-between; }
  .seg button { padding: 6px 8px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
#realBtn { font-size: 13px; white-space: nowrap; }
#realBtn[aria-pressed=true] { background: #2c3458; color: var(--gold); }
/* 我是群友：名牌平时只写化名，轮到这个角色（说话/被点名/被选中）时才加上群名，避免挤在一起 */
.actor .plate .rn { display: none; font-size: .78em; color: var(--muted); }
.actor.speaking .plate .rn, .actor.target .plate .rn, .actor.picked .plate .rn { display: block; }
.actor.speaking .plate, .actor.target .plate, .actor.picked .plate { z-index: 5; }
/* 投票板公布动画 */
.arrows .arc.rv { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw .45s ease-out forwards; }
.arrows .dot.rv { opacity: 0; transform-box: fill-box; transform-origin: center; animation: dotin .25s ease-out forwards; }
@keyframes dotin { from { opacity: 0; transform: scale(3); } to { opacity: 1; transform: scale(1); } }
.actor .votes.bump { animation: bump .3s cubic-bezier(.3, 1.8, .5, 1); }
@keyframes bump { from { transform: translate(-50%, -100%) scale(1.7); } to { transform: translate(-50%, -100%) scale(1); } }
.overlay.tally .card.tally { animation: popin .35s ease-out var(--d, 0s) backwards; min-width: min(50%, 520px); }
.card.tally li { position: relative; padding: .15em .5em; border-radius: 8px; overflow: hidden; }
.card.tally li > :not(.bar) { position: relative; }
.card.tally li .bar { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w); background: color-mix(in srgb, var(--c) 30%, transparent); transform-origin: left; animation: grow .6s ease-out calc(var(--d, 0s) + .25s + var(--k) * .08s) backwards; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.card.tally li.top { outline: 2px solid var(--red); animation: leader 1s ease-in-out calc(var(--d, 0s) + .9s) 2; }
@keyframes leader { 50% { box-shadow: 0 0 18px var(--red); } }
@media (prefers-reduced-motion: reduce) { .arrows .arc.rv, .arrows .dot.rv, .card.tally li .bar { animation: none; stroke-dashoffset: 0; opacity: 1; } }
/* 群友小测 */
.qopts { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.qopt { padding: 6px 12px; border-radius: 999px; }
.qopt[aria-pressed=true] { background: #2c3458; color: var(--gold); border-color: var(--gold); }
.qmsg { min-height: 1.4em; color: var(--red); margin: 4px 0 10px; }
/* 角色视角 */
.povq { margin: .6em 0 .3em; font-size: .9em; }
.povgrid { display: grid; grid-template-columns: repeat(5, auto); justify-content: center; gap: 6px; margin: 0 auto .4em; }
.povgrid.many { grid-template-columns: repeat(7, auto); }
.povpick { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 6px; border-radius: 10px; font-size: 12px; background: rgba(255,255,255,.04); }
.povpick img { width: 40px; height: 40px; border-radius: 50%; border: 2px solid var(--c); }
.povpick[aria-pressed=true] { background: #2c3458; color: var(--gold); outline: 2px solid var(--gold); }
.povinfo { min-height: 1.4em; color: var(--gold); font-size: .9em; margin: .2em 0 .6em; }
.actor.me .plate { box-shadow: 0 0 0 2px var(--gold), 0 0 12px var(--gold); }
.actor.me .plate::before { content: "你"; position: absolute; left: 50%; top: -1.3em; transform: translateX(-50%); background: var(--gold); color: #241a00; border-radius: 6px; padding: 0 .35em; font-size: .8em; font-weight: 700; }
.thought.mine { border-left-color: var(--gold); }
@media (max-width: 640px) { .povgrid, .povgrid.many { grid-template-columns: repeat(5, auto); } .povpick img { width: 34px; height: 34px; } }
/* 带入角色在“想” */
.ctext.later { animation: fadein .3s ease-out var(--t, 0s) backwards; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } }
.thought .dots { display: inline-block; animation: blink .6s ease-in-out infinite alternate; }
@keyframes blink { from { opacity: .3; } to { opacity: 1; } }
.actor.thinking::after { content: "💭"; position: absolute; left: 62%; top: -6%; font-size: clamp(18px, 3cqw, 42px); z-index: 3; animation: thinkcloud var(--think, 1s) linear forwards; pointer-events: none; }
@keyframes thinkcloud { 0% { opacity: 0; transform: translateY(20%) scale(.6); } 10%, 85% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* 开场卡片内容多了：桌面版压紧一点，放不下时可以滚动 */
.start { overflow-y: auto; align-items: safe center; }
.startcard { padding: 10px 16px; }
.startcard h2 { font-size: clamp(22px, 4cqw, 42px); }
.startcard > p { margin: .15em 0 .5em; }
.startcard .povq { margin: .3em 0 .3em; }
.startcard .povinfo { margin: .1em 0 .4em; }
.startcard .go { margin-top: 10px; }
.startcard .seg.big button { padding-top: 6px; padding-bottom: 6px; }

/* ---------- 手机版 ---------- */
@media (max-width: 640px) {
  /* 舞台加高：14 个人站得下，人物也大一点（背景两边裁掉一些） */
  .stage { aspect-ratio: 5 / 4; border-radius: 0; }
  .stage.crowd .actor { height: 58%; bottom: 11%; }
  /* 名牌只写化名；群友名放在下方字幕里，不然挤成一团 */
  .actor .plate .rn { display: none !important; }
  .actor.me .plate::before { font-size: 9px; top: -1.5em; }
  .actor.thinking::after { font-size: 20px; top: -9%; }
  .bubble { max-width: 86%; font-size: 14px; top: 2.5%; }
  /* 开场卡片太高，放不进舞台：改成整屏浮层，可以滚动 */
  .start { position: fixed; inset: 0; z-index: 200; overflow-y: auto; align-items: flex-start; padding: 24px 0 32px; }
  .startcard { padding: 8px 16px; }
  .startcard h2 { font-size: 28px; }
  .startcard p, .povq, .povinfo { font-size: 14px; }
  .startcard .seg.big { width: 100%; display: flex; }
  .startcard .seg.big button { flex: 1; }
  .startcard .go { display: block; width: 100%; text-align: center; margin-top: 12px; padding: 12px; font-size: 17px; }
  .start { background: rgba(5, 7, 16, .93); }
  /* 工具栏：视角一整行，速度/群友/声音一行 */
  #viewSeg { order: -1; flex: 1 1 100%; display: flex; }
  #viewSeg button { flex: 1; padding-left: 4px; padding-right: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #speedSeg { margin-right: auto; }
  /* 投票板 / 卡片在小舞台上收紧 */
  .card { padding: 3% 4%; font-size: 13px; min-width: 70%; }
  .overlay.tally .card.tally { min-width: 80%; max-height: 92%; overflow: hidden; }
  .card.tally li { padding: 0 .4em; }
  .card .hd { width: 22px; height: 22px; }
}
/* 选角色时的“我是群友” */
.povpick .prn { font-size: 10px; color: var(--muted); max-width: 5.5em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.startcard .qunyou { display: block; margin: 0 auto .5em; font-size: 13px; padding: 4px 12px; border-radius: 999px; }
.startcard .qunyou[aria-pressed=true] { background: #2c3458; color: var(--gold); border-color: var(--gold); }
/* 开场：速度 + 背景音乐 */
.startopts { display: flex; gap: 10px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 4px 0 2px; font-size: 14px; }
.startopts .seg button { padding: 4px 12px; }
.musicpick { border-radius: 999px; padding: 4px 12px; font-size: 13px; }
.musicpick[aria-pressed=true], #musicBtn[aria-pressed=true], #musicTop[aria-pressed=true] { color: var(--gold); }
#musicBtn[aria-pressed=false], #musicTop[aria-pressed=false] { opacity: .45; }
.seg button[aria-pressed=true] { background: #2c3458; color: var(--gold); }
/* 随机带入 */
.randpick { display: flex; gap: 6px; align-items: center; justify-content: center; flex-wrap: wrap; margin: 2px 0 6px; font-size: 13px; }
.randpick button { border-radius: 999px; padding: 3px 12px; font-size: 13px; }
.randpick button:disabled { opacity: .35; cursor: not-allowed; }
.randpick .qunyou { display: inline-block; margin: 0 0 0 10px; }
/* 手机/省流量：背景图用 assets-m 小图 */
.lite .bg[data-k=hall] { background-image: url(assets-m/scene/hall.webp); }
.lite .bg[data-k=night] { background-image: url(assets-m/scene/night.webp); }
.lite .bg[data-k=cryo] { background-image: url(assets-m/scene/cryo.webp); }
.lite .bg[data-k=bridge] { background-image: url(assets-m/scene/bridge.webp); }
/* 隐私说明（只在公网版里由 deploy-ahk.sh 加上） */
footer.privacy { max-width: 1100px; margin: 24px auto 32px; padding: 0 16px; text-align: center; }
/* 我是群友在“开始回放”正上方 */
.startcard > .qunyou { display: block; margin: 10px auto 0; font-size: 14px; padding: 6px 16px; }
