:root {
  --red: #8c2f24; --red2: #b2412f; --paper: #f3e9d8; --paper2: #faf4e8; --ink: #2b2420; --ink2: #6b5d52;
  --gold: #c9a25a; --teal: #4a6b6a; --line: #e2d3bb; --good: #4a7a4f; --bad: #b2412f;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --r: 12px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--serif); color: var(--ink); background: var(--paper);
  background-image: radial-gradient(rgba(140, 47, 36, .05) 1px, transparent 1px); background-size: 18px 18px;
  font-size: 15px; line-height: 1.65;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:disabled { cursor: default; }
#app { min-height: 100%; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 22px; border-radius: 999px; font-size: 16px; letter-spacing: 2px; transition: transform .12s, box-shadow .12s, opacity .12s; }
.btn:active { transform: scale(.97); }
.btn-main { background: linear-gradient(180deg, var(--red2), var(--red)); color: #fff6e6; box-shadow: 0 4px 0 #5e1d16, 0 8px 18px rgba(140, 47, 36, .25); }
.btn-main:disabled { opacity: .45; box-shadow: none; }
.btn-ghost { background: rgba(255, 250, 240, .75); border: 1.5px solid var(--red); color: var(--red); }
.link { color: var(--ink2); padding: 8px; font-size: 14px; }
.muted { color: var(--ink2); font-size: 14px; }

/* ---------- 标题 ---------- */
.title-screen { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; align-items: flex-end; justify-content: center; overflow: hidden; background: #3b1410; }
.title-bg { position: absolute; inset: 0; background: url(assets/ui/title.jpg) center top / cover no-repeat, radial-gradient(ellipse at 50% 20%, #c0452f, #5a1a13 70%); }
.title-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(40, 10, 8, 0) 30%, rgba(60, 14, 10, .82) 62%, #3b1410 92%); }
.title-box { position: relative; z-index: 1; text-align: center; color: #fbeedd; padding: 0 24px 40px; max-width: 520px; width: 100%; }
.title-seal { display: inline-block; width: 54px; height: 54px; line-height: 54px; border: 2px solid var(--gold); color: var(--gold); border-radius: 8px; font-size: 32px; transform: rotate(-6deg); margin-bottom: 4px; }
.title-main { font-size: 84px; line-height: 1; margin: 6px 0 4px; letter-spacing: 18px; text-indent: 18px; color: #fff3df; text-shadow: 0 4px 0 #6d1c14, 0 0 30px rgba(255, 170, 90, .35); }
.title-sub { display: inline-block; font-size: 22px; letter-spacing: 6px; padding: 4px 16px; background: var(--paper); color: var(--red); border-radius: 4px; transform: rotate(-2deg); box-shadow: 0 3px 0 #6d1c14; }
.title-tag { font-size: 16px; margin: 22px 0 22px; color: #f1dcc4; }
.title-tag b { color: #ffd27a; font-size: 18px; }
.title-btns { display: flex; flex-direction: column; gap: 12px; align-items: center; }
.title-btns .btn { width: 240px; }
.title-btns .btn-ghost { background: rgba(255, 245, 230, .12); color: #fbeedd; border-color: rgba(251, 238, 221, .6); }
.title-foot { margin-top: 18px; font-size: 12px; color: #c9a990; letter-spacing: 1px; }

/* ---------- 出身 ---------- */
.origin-screen, .book { max-width: 760px; margin: 0 auto; padding: 16px 16px 40px; }
.scr-head { display: flex; align-items: center; gap: 8px; }
.scr-head h2 { margin: 0; font-size: 22px; color: var(--red); flex: 1; }
.name-in { width: 100%; margin: 12px 0; padding: 12px 16px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--paper2); font: inherit; font-size: 16px; }
.origins { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.origin-card { text-align: left; padding: 14px 16px; border-radius: var(--r); background: var(--paper2); border: 1.5px solid var(--line); transition: border-color .15s, box-shadow .15s; }
.origin-card.on { border-color: var(--red); box-shadow: 0 0 0 3px rgba(140, 47, 36, .15); }
.origin-n { font-size: 18px; color: var(--red); font-weight: 700; }
.origin-d { font-size: 14px; margin: 4px 0; }
.origin-dw { font-size: 12px; color: var(--ink2); }
.origin-go { display: flex; gap: 12px; justify-content: center; margin-top: 18px; }

/* ---------- 主界面 ---------- */
.game { max-width: 1240px; margin: 0 auto; padding: 0 12px 24px; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; padding: 10px 2px; background: linear-gradient(var(--paper) 80%, rgba(243, 233, 216, 0)); }
.date { flex: 1; font-weight: 700; color: var(--red); font-size: 15px; }
.ap { font-size: 13px; color: var(--ink2); display: flex; align-items: center; gap: 3px; }
.ap i { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid var(--red); display: inline-block; }
.ap i.on { background: var(--red); }
.icon-btn.off { opacity: .45; text-decoration: line-through; }
.icon-btn { font-size: 13px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--paper2); }
.cols { display: grid; gap: 12px; }
@media (min-width: 960px) { .cols { grid-template-columns: 1fr 1fr; align-items: start; } .col-r { position: sticky; top: 56px; } }

.pt { position: relative; overflow: hidden; background: #eadbc3; border-radius: 10px; flex: none; }
.pt img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 12%; display: block; }
.pt-none { display: flex; align-items: center; justify-content: center; color: #fff; background: var(--teal); font-size: 20px; }
.pt-c0 { background: #a0614a; } .pt-c1 { background: #4a6b6a; } .pt-c2 { background: #7a6a3a; } .pt-c3 { background: #6b4a6b; }
.pt-boss { width: 112px; height: 140px; border: 2px solid var(--gold); box-shadow: 0 4px 12px rgba(0, 0, 0, .12); }
.pt-sm { width: 54px; height: 66px; }
.pt-xs { width: 38px; height: 38px; border-radius: 50%; font-size: 15px; }
.pt-ev { width: 100%; height: 220px; border-radius: 14px 14px 0 0; }
.pt-ev img { object-position: 50% 18%; }

.boss { display: flex; gap: 12px; padding: 12px; border-radius: 16px; background: linear-gradient(135deg, #fffaf1, #f6ead6); border: 1.5px solid var(--line); box-shadow: 0 2px 0 var(--line); }
.boss.is-widow .pt-boss { filter: grayscale(1) contrast(.9); }
.boss-info { flex: 1; min-width: 0; }
.boss-name { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.boss-tag { font-size: 11px; font-weight: 400; padding: 1px 7px; border-radius: 4px; background: var(--red); color: #fff; }
.is-widow .boss-tag { background: #555; }
.hpbar-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink2); margin-top: 6px; }
.hpbar-label b { color: var(--red); font-size: 14px; }
.hpbar { position: relative; height: 18px; border-radius: 4px; background: #2b2420; border: 2px solid #2b2420; overflow: hidden; box-shadow: inset 0 2px 0 rgba(0, 0, 0, .4); }
.hpbar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; transition: width .6s cubic-bezier(.3, 1.4, .5, 1); background: linear-gradient(180deg, #ff7a5c, #c0321f 60%, #8c1f12); }
.hpbar.mid i { background: linear-gradient(180deg, #ffc36b, #e0892a 60%, #a85a12); }
.hpbar.high i { background: linear-gradient(180deg, #8fe08a, #3fa24a 60%, #23702e); }
.hpbar.low i { animation: pulse 1s infinite; }
.hpbar i::after { content: ""; position: absolute; left: 0; right: 0; top: 2px; height: 4px; background: rgba(255, 255, 255, .35); border-radius: 2px; }
.hpbar em { display: none; }
@keyframes pulse { 50% { filter: brightness(1.4); } }
.lovebar { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink2); margin-top: 6px; }
.lovebar b { min-width: 22px; text-align: right; color: var(--ink); }
.mini { flex: 1; height: 6px; border-radius: 3px; background: #e6d8c2; overflow: hidden; }
.mini i { display: block; height: 100%; background: #d9637a; border-radius: 3px; transition: width .4s; }
.mini.tol i { background: var(--teal); } .mini.rep i { background: var(--gold); } .mini.wit i { background: #6b4a6b; }
.mini.body i { background: var(--good); } .mini.sus i { background: var(--bad); }
.boss-say { margin: 8px 0 0; font-size: 13.5px; color: var(--ink); background: rgba(255, 255, 255, .55); border-left: 3px solid var(--red); padding: 5px 8px; border-radius: 0 6px 6px 0; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.stat { text-align: left; padding: 8px 10px; border-radius: 10px; background: var(--paper2); border: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; align-items: baseline; row-gap: 4px; }
.stat span { font-size: 12px; color: var(--ink2); }
.stat b { font-size: 16px; }
.stat .mini { grid-column: 1 / -1; }
.stat.warn { border-color: var(--bad); background: #fbe9e3; animation: shake .5s 1; }
@keyframes shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
.alerts { margin-top: 8px; display: grid; gap: 4px; }
.alerts div { font-size: 13px; color: #fff; background: var(--bad); padding: 4px 10px; border-radius: 6px; }

.dock { margin-top: 10px; display: grid; gap: 8px; }
.med-btn { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 14px; font-size: 17px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #6d3a1c, #3e2212); box-shadow: 0 4px 0 #23140b; }
.med-btn.todo { animation: glow 1.6s infinite; }
@keyframes glow { 50% { box-shadow: 0 4px 0 #23140b, 0 0 0 5px rgba(201, 162, 90, .45); } }
.med-btn.done { background: #d9ccb6; color: var(--ink2); box-shadow: none; font-weight: 400; }
.med-btn small { margin-left: auto; font-size: 12px; background: var(--gold); color: #3e2212; padding: 1px 8px; border-radius: 999px; }
.med-ico { width: 34px; height: 34px; border-radius: 50%; background: var(--paper); color: #6d3a1c; display: flex; align-items: center; justify-content: center; font-size: 16px; }
.done .med-ico { background: #eee3d0; color: #a99; }
.acts { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px; }
.act { text-align: left; padding: 8px 10px; border-radius: 10px; background: var(--paper2); border: 1px solid var(--line); display: flex; flex-direction: column; transition: transform .1s, border-color .1s; }
.act:hover { border-color: var(--red); }
.act:active { transform: scale(.97); }
.act b { font-size: 15px; }
.act small { font-size: 11.5px; color: var(--ink2); line-height: 1.35; }
.act.off { opacity: .5; }
.act-risk b { color: var(--red); }
.acts-done { text-align: center; font-size: 13px; color: var(--ink2); padding: 6px; border: 1px dashed var(--line); border-radius: 10px; }
.end-month { width: 100%; padding: 13px; font-size: 17px; }

.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--red); }
.tabs button { position: relative; flex: 1; padding: 8px 4px; font-size: 14px; color: var(--ink2); border-radius: 10px 10px 0 0; }
.tabs button.on { background: var(--red); color: #fff; }
.tabs .dot { position: absolute; top: 6px; right: 10%; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); }
.tabs .on .dot { background: var(--gold); }
.panel { background: var(--paper2); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 14px 14px; padding: 10px 12px; max-height: 62vh; overflow: auto; }
@media (max-width: 959px) { .panel { max-height: none; } }
.log p { margin: 0 0 8px; font-size: 14px; }
.lg.sep { color: var(--ink2); text-align: center; font-size: 12px; margin: 10px 0; }
.lg.big { font-size: 15px; background: #fff; padding: 8px 10px; border-radius: 8px; border: 1px dashed var(--line); }
.lg.med { color: #5b3a1c; }
.lg.end { color: var(--red); font-weight: 700; }
.log-full { max-height: 60vh; overflow: auto; text-align: left; }

.gossip-head { font-size: 12px; color: var(--ink2); text-align: center; margin-bottom: 8px; }
.gsp { display: flex; gap: 8px; margin-bottom: 10px; }
.gsp-b { flex: 1; min-width: 0; }
.gsp-w { font-size: 12px; color: var(--ink2); }
.gsp-w span { margin-left: 6px; opacity: .7; }
.gsp-t { display: inline-block; background: #fff; border-radius: 4px 12px 12px 12px; padding: 6px 10px; font-size: 14px; box-shadow: 0 1px 0 var(--line); }

.dowry-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 12px; color: var(--ink2); text-align: center; }
.dowry-sum b { display: block; font-size: 17px; color: var(--red); }
.dowry { list-style: none; padding: 0; margin: 10px 0; }
.dowry li { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px dashed var(--line); font-size: 14px; }
.dowry li span { flex: 1; }
.dowry em { font-style: normal; color: var(--ink2); font-size: 13px; }
.tag { font-style: normal; font-size: 11px; padding: 1px 7px; border-radius: 4px; background: #e9dcc6; }
.tag.ok { background: #dcebd7; color: var(--good); }
.tag.bad { background: #f6d8cf; color: var(--bad); }
.tip { font-size: 12px; color: var(--ink2); }

.people { display: grid; gap: 10px; }
.person { display: flex; gap: 10px; align-items: center; }
.person-b { flex: 1; min-width: 0; }
.person-n { font-weight: 700; }
.person-n span { font-weight: 400; font-size: 12px; color: var(--ink2); margin-left: 6px; }
.person small { color: var(--ink2); font-size: 12px; }

/* ---------- 弹窗 ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(30, 14, 10, .55); opacity: 0; transition: opacity .18s; }
.modal.in { opacity: 1; }
.modal-card { width: 100%; max-width: 460px; max-height: 92vh; overflow: auto; background: var(--paper); border-radius: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .35); transform: translateY(12px) scale(.98); transition: transform .2s; }
.modal.in .modal-card { transform: none; }
.ev-b { padding: 14px 18px 18px; }
.ev-k { font-size: 12px; color: var(--red); letter-spacing: 2px; }
.ev h3, .res h3, .menu h3, .help h3, .med-modal h3 { margin: 2px 0 8px; font-size: 21px; color: var(--ink); }
.ev-t { margin: 0 0 14px; font-size: 15.5px; }
.choices { display: grid; gap: 8px; }
.choice { text-align: left; padding: 11px 14px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); font-size: 15px; transition: border-color .12s, transform .1s; }
.choice:hover { border-color: var(--red); }
.choice:active { transform: scale(.98); }
.choice small { display: block; font-size: 12px; color: var(--bad); }
.choice.off { opacity: .55; background: #f1e8da; }
.res, .menu, .help, .med-modal { padding: 20px; text-align: center; }
.res p { font-size: 15.5px; text-align: left; margin: 6px 0 12px; }
.res .btn { margin-top: 10px; min-width: 160px; }
.fx { display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 999px; background: #e9dcc6; }
.chip-good { background: #dcebd7; color: #2f5d34; }
.chip-bad { background: #f6d8cf; color: #9a2e1e; }
.chip-hpup { background: #3fa24a; color: #fff; }
.chip-hpdown { background: #2b2420; color: #ff8a6b; }
.menu { display: grid; gap: 10px; }
.help { text-align: left; }
.help ol { padding-left: 20px; }
.help .btn { display: flex; margin: 12px auto 0; }
.meds { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.med { text-align: left; padding: 10px; border-radius: 12px; background: #fff; border: 1.5px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.med:hover { border-color: var(--red); }
.med b { font-size: 16px; }
.med small { font-size: 12px; color: var(--ink2); }
.med .fx { justify-content: flex-start; margin-top: 4px; }
.med.tiger { border-color: #2b2420; background: #2b2420; color: #fbeedd; }
.med.tiger small { color: #c9b8a6; }
.med.pour b, .med.ginseng b { color: var(--red); }
.flash { position: fixed; left: 50%; top: 40%; z-index: 60; transform: translate(-50%, -50%); background: rgba(43, 36, 32, .88); color: #fbeedd; padding: 14px 28px; border-radius: 12px; font-size: 18px; letter-spacing: 2px; pointer-events: none; animation: fl 1.5s forwards; }
@keyframes fl { 0% { opacity: 0; transform: translate(-50%, -40%); } 15%, 75% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; } }

/* ---------- 结局 ---------- */
.ending { min-height: 100vh; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; background: radial-gradient(ellipse at 50% 0, #fffaf1, var(--paper) 60%); }
.end-card { position: relative; width: 100%; max-width: 460px; background: #fffaf1; border-radius: 18px; overflow: hidden; border: 2px solid var(--gold); box-shadow: 0 12px 30px rgba(90, 40, 20, .2); }
.end-art { aspect-ratio: 3 / 4; max-height: 62vh; width: 100%; overflow: hidden; background: #3b1410; }
.end-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.end-art.no-art { display: flex; align-items: center; justify-content: center; font-size: 120px; color: var(--paper); background: radial-gradient(circle, var(--red2), #4a150f); }
.stamp { position: absolute; top: 16px; right: 16px; padding: 6px 12px; border: 3px solid #d23a26; color: #d23a26; font-size: 20px; font-weight: 700; letter-spacing: 4px; transform: rotate(12deg); background: rgba(255, 250, 241, .85); border-radius: 6px; animation: stampin .5s .3s both; }
@keyframes stampin { from { transform: rotate(12deg) scale(2.4); opacity: 0; } }
.end-no { margin: 14px 18px 0; font-size: 12px; letter-spacing: 3px; color: var(--red); }
.end-card h1 { margin: 2px 18px 6px; font-size: 30px; line-height: 1.25; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 18px 10px; }
.badges span { font-size: 12px; padding: 2px 10px; border-radius: 4px; background: var(--red); color: #fff3df; letter-spacing: 1px; }
.badges span:nth-child(2) { background: var(--gold); color: #3e2212; }
.badges span:nth-child(3) { background: var(--teal); }
.end-text { margin: 0 18px 12px; font-size: 15px; }
.end-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border-top: 1px solid var(--line); }
.end-stats div { background: #fffaf1; padding: 8px 4px; text-align: center; }
.end-stats small { display: block; font-size: 11px; color: var(--ink2); }
.end-stats b { font-size: 16px; color: var(--red); }
.end-who { padding: 8px 18px 12px; font-size: 12px; color: var(--ink2); text-align: center; }
.end-share { font-size: 12px; color: var(--ink2); letter-spacing: 1px; }
.end-btns { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.cat-惨烈 .end-card { border-color: #2b2420; }
.cat-惨烈 .end-no { color: #2b2420; }
.cat-隐藏 .end-card { border-color: #6b4a6b; }

@media (min-width: 960px) {
  .ending { justify-content: center; }
  .end-card { max-width: 900px; display: grid; grid-template-columns: 400px 1fr; grid-template-rows: auto auto auto auto 1fr auto auto; }
  .end-art { grid-row: 1 / -1; max-height: none; height: 100%; aspect-ratio: auto; min-height: 560px; }
  .end-no { margin-top: 28px; }
  .end-card h1 { font-size: 36px; }
  .end-text { font-size: 16px; }
  .end-stats { align-self: end; }
}

/* ---------- 图鉴 ---------- */
.book-n { font-size: 16px; color: var(--red); font-weight: 700; }
.book-bar { height: 8px; border-radius: 4px; background: #e6d8c2; margin: 10px 0 14px; overflow: hidden; }
.book-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--red2), var(--gold)); }
.book-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
@media (max-width: 520px) { .book-grid { grid-template-columns: repeat(3, 1fr); } .bk-t { font-size: 13.5px; } .bk-h { font-size: 11px; } }
.bk { text-align: left; border-radius: 12px; overflow: hidden; background: var(--paper2); border: 1.5px solid var(--line); display: flex; flex-direction: column; }
.bk-art { aspect-ratio: 3 / 4; background: #d9ccb6; overflow: hidden; }
.bk-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.bk.off .bk-art { background: repeating-linear-gradient(45deg, #d9ccb6 0 8px, #d2c3aa 8px 16px); }
.bk.off .bk-art::after { content: "囍"; display: flex; height: 100%; align-items: center; justify-content: center; font-size: 46px; color: rgba(140, 47, 36, .18); }
.bk.on { border-color: var(--gold); }
.bk-no { font-size: 11px; color: var(--red); padding: 6px 8px 0; letter-spacing: 1px; }
.bk-t { font-weight: 700; padding: 0 8px; font-size: 15px; }
.bk-h { font-size: 11.5px; color: var(--ink2); padding: 2px 8px 8px; line-height: 1.4; }
.bk.on .bk-t { padding-bottom: 8px; }

@media (max-width: 420px) {
  .title-main { font-size: 70px; }
  .pt-boss { width: 96px; height: 124px; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .acts { grid-template-columns: repeat(3, 1fr); }
  .act { padding: 8px 6px; text-align: center; }
  .act small { display: none; }
  .act b { font-size: 14px; }
  .meds { grid-template-columns: 1fr; }
}
@media (max-height: 640px) and (max-width: 520px) {
  .title-box { padding-bottom: 18px; }
  .title-main { font-size: 54px; letter-spacing: 12px; text-indent: 12px; }
  .title-sub { font-size: 17px; }
  .title-tag { font-size: 13.5px; margin: 10px 0 12px; line-height: 1.5; }
  .title-tag b { font-size: 15px; }
  .title-btns { gap: 8px; }
  .title-btns .btn { padding: 8px 18px; font-size: 15px; width: 210px; }
  .title-foot { margin-top: 10px; }
}
