:root {
  --paper: #f2ede3;
  --card: #fbf8f1;
  --ink: #161513;
  --muted: #6f685c;
  --line: #d8cfbf;
  --red: #c23a22;
  --brass: #a8864f;
  --blue: #2f5bff;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); font-family: var(--sans); }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
#app { max-width: 460px; margin: 0 auto; min-height: 100%; position: relative; }

.screen { display: none; min-height: 100vh; min-height: 100dvh; padding: max(16px, env(safe-area-inset-top)) 22px max(20px, env(safe-area-inset-bottom)); flex-direction: column; }
.screen.on { display: flex; animation: fade .35s ease; }
.screen.dark { background: #15140f; color: #efe9dc; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.masthead { display: flex; justify-content: space-between; align-items: center; font-size: 12px; letter-spacing: .12em; color: var(--muted); border-bottom: 1px solid var(--ink); padding-bottom: 8px; margin-bottom: 18px; }
.masthead .back { letter-spacing: 0; color: var(--ink); }
h1, h2 { font-family: var(--serif); font-weight: 900; margin: 0; }
h2 { font-size: 28px; line-height: 1.25; margin: 6px 0 10px; }
.sub { color: var(--muted); font-size: 14px; line-height: 1.65; margin: 0 0 16px; }
.kicker { font-size: 12px; letter-spacing: .14em; color: var(--muted); margin: 0; }
.dark .kicker, .dark .sub { color: #a69f8f; }

.btn { display: block; width: 100%; text-align: center; text-decoration: none; padding: 15px 18px; border: 1.5px solid var(--ink); border-radius: 999px; font-size: 16px; font-weight: 600; margin-top: 10px; }
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.big { font-size: 19px; padding: 17px; letter-spacing: .3em; }
.btn:disabled { opacity: .35; }
.dark .btn { border-color: #efe9dc; }
.dark .btn.primary { background: #efe9dc; color: #15140f; }
.link { font-size: 14px; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.link b { color: var(--ink); font-weight: 600; }

/* 首页 */
.title { font-size: 76px; line-height: .95; letter-spacing: -.02em; margin-top: 8px; }
.title em { font-style: normal; color: var(--red); font-size: 1.25em; }
.lede { font-family: var(--serif); font-size: 18px; line-height: 1.6; margin: 16px 0 6px; }
.table-wrap { margin: 8px -6px 6px; }
.table-wrap svg { width: 100%; height: auto; display: block; }
.home-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.made-by { margin-top: auto; padding-top: 22px; display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); text-decoration: none; justify-content: center; }
.made-by img { width: 16px; height: 16px; }
.challenge { border: 1.5px dashed var(--red); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; font-size: 14px; line-height: 1.6; }
.challenge b { color: var(--red); }
.challenge .row { display: flex; gap: 8px; margin-top: 8px; }
.challenge .row .btn { margin: 0; padding: 10px; font-size: 14px; }

/* 游戏 */
.meters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; padding: 4px 0 10px; border-bottom: 1px solid var(--line); }
.meter { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); position: relative; }
.meter .icon { width: 34px; height: 34px; position: relative; }
.meter .icon svg { width: 100%; height: 100%; display: block; }
.meter .icon .fill { position: absolute; inset: 0; clip-path: inset(var(--empty, 50%) 0 0 0); transition: clip-path .5s ease; }
.meter .icon .fill svg path, .meter .icon .fill svg rect, .meter .icon .fill svg circle { fill: var(--ink); stroke: var(--ink); }
.meter.danger .icon .fill svg * { fill: var(--red); stroke: var(--red); }
.meter .dot { position: absolute; top: -6px; left: 50%; transform: translateX(-50%) scale(0); width: 8px; height: 8px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.meter .dot.on { transform: translateX(-50%) scale(1); }
.meter .dot.big { width: 12px; height: 12px; top: -8px; }
.meter.up .icon { animation: up .6s; }
.meter.down .icon { animation: down .6s; }
@keyframes up { 30% { transform: scale(1.18); filter: drop-shadow(0 0 6px #6fae6a); } }
@keyframes down { 30% { transform: scale(.85); filter: drop-shadow(0 0 6px var(--red)); } }

.stage { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; min-height: 360px; touch-action: none; }
.card { width: min(80vw, 330px); min-height: 340px; max-height: 62vh; background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 1px 0 #fff inset, 0 18px 40px -18px rgba(40, 30, 10, .35); padding: 22px 22px 18px; display: flex; flex-direction: column; position: relative; user-select: none; -webkit-user-select: none; touch-action: none; will-change: transform; cursor: grab; }
.card.enter { animation: deal .35s cubic-bezier(.2, .8, .2, 1); }
@keyframes deal { from { transform: translateY(30px) rotate(-3deg) scale(.96); opacity: 0; } }
.card .who { display: flex; align-items: center; gap: 10px; }
.card .avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fbf8f1; font-family: var(--serif); font-weight: 900; font-size: 20px; flex: none; }
.card .avatar img { width: 26px; height: 26px; filter: invert(1); }
.card .name { font-weight: 700; font-size: 15px; }
.card .role { font-size: 12px; color: var(--muted); }
.card .text { font-family: var(--serif); font-size: 22px; line-height: 1.6; margin: 24px 0 18px; flex: 1; display: flex; align-items: center; }
.card .note { font-size: 12.5px; line-height: 1.55; color: var(--blue); border-top: 1px dashed rgba(47, 91, 255, .35); padding-top: 10px; display: flex; gap: 6px; align-items: flex-start; }
.card .note img { width: 14px; height: 14px; margin-top: 2px; flex: none; }
.card.agent { border: 2px solid var(--blue); box-shadow: 0 18px 40px -18px rgba(47, 91, 255, .45); }
.card.agent .badge { position: absolute; top: 14px; right: 14px; font-size: 11px; color: var(--blue); border: 1px solid var(--blue); border-radius: 999px; padding: 2px 8px; letter-spacing: .05em; }
.card.narrator .text { font-size: 20px; }
.card .tilt { position: absolute; top: 14px; left: 14px; right: 14px; padding: 8px 12px; font-weight: 700; font-size: 15px; background: var(--ink); color: var(--paper); border-radius: 10px; opacity: 0; transition: opacity .1s; text-align: center; }
.card.agent .tilt { background: var(--blue); }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 6px 0 12px; }
.choice { font-size: 13.5px; color: var(--muted); border: 1px solid var(--line); border-radius: 12px; padding: 10px 10px; line-height: 1.4; min-height: 44px; }
.choice:first-child::before { content: "← "; }
.choice:last-child::after { content: " →"; }
.tenure { border-top: 1px solid var(--line); padding-top: 10px; }
.tenure-text { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }
#itemBadge { color: var(--blue); font-weight: 600; font-size: 12px; border: 1px solid var(--blue); border-radius: 999px; padding: 1px 8px; }
.tenure-bar { position: relative; height: 4px; background: var(--line); border-radius: 2px; margin-top: 8px; }
.tenure-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); border-radius: 2px; transition: width .4s; }
.tenure-bar .mark { position: absolute; right: 0; top: 8px; font-size: 10.5px; color: var(--muted); }

/* 董事会 */
.board-head h2 { color: #efe9dc; }
.seats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 14px; }
.seat { border: 1px solid #3a372f; border-radius: 14px; padding: 10px 12px; min-height: 92px; position: relative; transition: border-color .3s, background .3s; }
.seat .top { display: flex; align-items: center; gap: 8px; }
.seat .avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-family: var(--serif); font-weight: 900; font-size: 14px; color: #fbf8f1; }
.seat .n { font-weight: 700; font-size: 13.5px; }
.seat .r { font-size: 10.5px; color: #a69f8f; }
.seat .say { font-family: var(--serif); font-size: 13.5px; line-height: 1.55; margin-top: 8px; color: #efe9dc; min-height: 2.6em; }
.seat .vote { position: absolute; right: 10px; top: 10px; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; opacity: 0; transition: opacity .3s; }
.seat.keep { border-color: #6fae6a; }
.seat.keep .vote { opacity: 1; background: #6fae6a; color: #10200f; }
.seat.fire { border-color: var(--red); }
.seat.fire .vote { opacity: 1; background: var(--red); color: #fff; }
.seat.moved { background: rgba(111, 174, 106, .1); }
.seat.unmoved { background: rgba(194, 58, 34, .1); }
.args { display: flex; flex-direction: column; gap: 8px; }
.arg { text-align: left; border: 1px solid #4a463c; border-radius: 12px; padding: 11px 14px; font-family: var(--serif); font-size: 15.5px; line-height: 1.45; color: #efe9dc; }
.arg.sel { border-color: #efe9dc; background: #efe9dc; color: #15140f; }
.arg.agent { border-color: var(--blue); }
.arg.agent.sel { background: var(--blue); color: #fff; }
.arg small { display: block; font-family: var(--sans); font-size: 11px; opacity: .7; margin-top: 2px; }
.said { display: block; font-family: var(--serif); font-size: 19px; line-height: 1.5; color: #efe9dc; border-left: 3px solid #efe9dc; padding: 2px 0 2px 12px; margin: 4px 0 0; }
.board-foot { margin-top: auto; padding-top: 14px; }

/* 下台 */
.dead-top { position: relative; padding-top: 8px; }
.stamp { position: absolute; right: -4px; top: 0; font-family: var(--serif); font-weight: 900; font-size: 30px; color: var(--red); border: 3.5px solid var(--red); border-radius: 8px; padding: 4px 12px; transform: rotate(-12deg); letter-spacing: .1em; opacity: .9; animation: stamp .5s cubic-bezier(.3, 1.6, .5, 1); background: rgba(242, 237, 227, .7); }
.stamp.win { color: #2f7a3a; border-color: #2f7a3a; }
@keyframes stamp { from { transform: rotate(-12deg) scale(2.4); opacity: 0; } }
#deadTitle { font-size: 30px; padding-right: 92px; }
.vs { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); margin: 6px 0 16px; }
.vs div { padding: 10px 0; text-align: center; }
.vs div + div { border-left: 1px solid var(--line); }
.vs b { display: block; font-family: var(--serif); font-size: 24px; }
.vs span { font-size: 12px; color: var(--muted); }
.file { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px 16px 14px; position: relative; }
.file .tab { font-size: 11px; letter-spacing: .12em; color: var(--muted); display: flex; justify-content: space-between; }
.file h3 { font-family: var(--serif); font-size: 21px; margin: 8px 0 2px; }
.file .co { font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.file p { font-size: 14px; line-height: 1.7; margin: 6px 0; }
.file p b { font-weight: 600; }
.file .q { font-family: var(--serif); border-left: 3px solid var(--brass); padding-left: 10px; color: #4a4336; }
.file .src { font-size: 11.5px; color: var(--muted); margin-top: 10px; line-height: 1.7; }
.file .src a { color: var(--muted); }
.file .open { font-size: 13px; margin-top: 8px; display: inline-block; }
.egg { font-size: 13px; color: var(--brass); text-align: center; margin: 10px 0 0; }
.dead-actions { margin-top: 14px; }
.dead-links { display: flex; justify-content: space-between; margin: 16px 2px 0; }

/* 朋友 */
.friend-list { display: flex; flex-direction: column; gap: 10px; }
.fcard { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.fcard .ctx { font-family: var(--serif); font-size: 16px; line-height: 1.55; }
.fcard .did { margin: 8px 0 10px; font-size: 14px; }
.fcard .did b { background: var(--ink); color: var(--paper); padding: 1px 8px; border-radius: 6px; font-weight: 600; }
.fcard .vote { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fcard .vote button { border: 1.5px solid var(--ink); border-radius: 999px; padding: 9px; font-weight: 600; font-size: 14px; }
.fcard .vote button.on { background: var(--ink); color: var(--paper); }
.fcard .dirs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; font-size: 12px; color: var(--muted); }
.fcard .dirs span { border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; }
.fcard .dirs span.y { border-color: #6fae6a; color: #2f6a2a; }
.fcard .dirs span.n { border-color: var(--red); color: var(--red); }
.friend-result { margin-top: 14px; border: 1.5px solid var(--ink); border-radius: 14px; padding: 14px; font-size: 15px; line-height: 1.7; }
.friend-result b { font-family: var(--serif); font-size: 22px; }

/* 图鉴 */
.album { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.chair { aspect-ratio: 3 / 4; border: 1px solid var(--line); border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10px; color: var(--muted); background: transparent; padding: 4px 2px; }
.chair svg { width: 26px; height: 26px; }
.chair.got { background: var(--card); color: var(--ink); border-color: var(--ink); }
.chair.got svg * { stroke: var(--ink); }
.chair.hot { border-color: var(--red); color: var(--red); }
.chair.hot svg * { stroke: var(--red); }
.chair .nm { font-size: 10px; line-height: 1.2; text-align: center; height: 2.4em; overflow: hidden; }
.album-type { grid-column: 1 / -1; font-size: 12px; letter-spacing: .1em; color: var(--muted); margin-top: 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.pack-cta { display: block; margin-top: 18px; border: 1.5px solid var(--ink); border-radius: 14px; padding: 14px 16px; text-decoration: none; }
.pack-cta b { display: block; font-size: 16px; }
.pack-cta span { font-size: 12.5px; color: var(--muted); }

/* 规则 / 关于 */
.rules { padding-left: 20px; line-height: 1.8; font-size: 15px; }
.rules li { margin-bottom: 8px; }
.credits { padding-left: 18px; line-height: 1.8; font-size: 15px; }
.credits li { margin-bottom: 8px; }
.as-box { border: 2px solid var(--blue); border-radius: 16px; padding: 16px; margin-top: 10px; }
.as-box img { width: 26px; height: 26px; }
.as-box p { font-size: 14.5px; line-height: 1.7; margin: 8px 0 4px; }
.as-box .btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.as-box .btn { border-color: var(--blue); color: var(--blue); }
.fine { font-size: 11.5px; color: var(--muted); line-height: 1.7; margin-top: 18px; }

/* 弹层 */
.sheet { position: fixed; inset: 0; background: rgba(20, 18, 12, .55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet[hidden] { display: none; }
.sheet-body { background: var(--paper); width: 100%; max-width: 460px; max-height: 92vh; overflow: auto; border-radius: 20px 20px 0 0; padding: 18px 20px max(20px, env(safe-area-inset-bottom)); }
.sheet-body img.shot { width: 100%; border-radius: 12px; display: block; box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .4); }
.sheet-body .tip { font-size: 13px; color: var(--muted); text-align: center; margin: 10px 0 0; }
.sheet-body .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sheet-body .row .btn { font-size: 14px; padding: 12px; }
.sheet-body input { width: 100%; font: inherit; font-size: 16px; padding: 12px 14px; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--card); margin: 6px 0 4px; }
.interlude { text-align: center; padding: 14px 4px 4px; }
.interlude h3 { font-family: var(--serif); font-size: 24px; margin: 6px 0 10px; }
.interlude p { font-size: 15px; line-height: 1.7; margin: 0 0 8px; }
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 30; animation: fade .2s; }

.hot-file { display: flex; align-items: center; gap: 12px; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 14px; padding: 10px 14px; margin: 4px 0 6px; }
.hot-file .ch { color: var(--red); width: 30px; height: 30px; flex: none; }
.hot-file .ch svg { width: 100%; height: 100%; }
.hot-file small { display: block; font-size: 11px; letter-spacing: .1em; color: var(--red); }
.hot-file b { font-family: var(--serif); font-size: 16px; }
.hot-file span { font-size: 12px; color: var(--muted); }
.anote { font-size: 12.5px; color: var(--blue); display: flex; gap: 6px; align-items: flex-start; margin: -2px 0 10px; line-height: 1.5; }
.anote img { width: 14px; height: 14px; margin-top: 2px; }
.free-row { margin-top: 14px; font-size: 13px; color: var(--muted); text-align: center; }
.free-row a { color: var(--ink); text-underline-offset: 3px; }
