:root { --paper: #efe4c9; --paper2: #e2d2ae; --ink: #2a2018; --ink2: #5e4d3b; --red: #a8321f; --gold: #b98a2c; --kai: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "SimSun", serif; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfc3a4; font-family: var(--kai); color: var(--ink); -webkit-font-smoothing: antialiased; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; user-select: none; font-size: 17px; }
.hide { display: none !important; }
.dim { color: var(--ink2); opacity: 0.85; }
kbd { display: inline-block; min-width: 1.5em; padding: 0 0.35em; margin: 0 0.25em 0 0.1em; border: 1px solid var(--ink2); border-bottom-width: 2px; border-radius: 4px; background: #f7efd9; color: var(--ink); font: 600 0.78em/1.5 ui-monospace, Menlo, monospace; text-align: center; vertical-align: 0.08em; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- HUD ---------- */
#hud .tl { position: absolute; left: 18px; top: 16px; display: flex; gap: 12px; align-items: flex-start; }
.seal { width: 62px; height: 62px; background: var(--red); color: #f7ead0; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; box-shadow: 0 2px 8px rgba(40, 20, 10, 0.35), inset 0 0 0 2px rgba(247, 234, 208, 0.55); }
.seal b { font-size: 21px; line-height: 1.1; letter-spacing: 1px; } .seal i { font-style: normal; font-size: 12px; opacity: 0.9; }
#hud .info { background: rgba(239, 228, 201, 0.86); border: 1px solid rgba(42, 32, 24, 0.45); border-radius: 4px; padding: 6px 12px 7px; box-shadow: 0 2px 8px rgba(40, 20, 10, 0.18); }
#h-zone { font-size: 18px; font-weight: 600; } #h-stat { font-size: 14.5px; margin-top: 2px; } #h-stat b { color: var(--red); font-size: 16px; }
#h-title { font-size: 13px; color: var(--ink2); margin-top: 1px; } #h-title::before { content: "人称："; }
#hud .tr { position: absolute; right: 18px; top: 16px; width: min(330px, 30vw); display: flex; flex-direction: column; gap: 6px; }
#hud .q { background: rgba(239, 228, 201, 0.84); border-left: 3px solid var(--ink2); padding: 5px 10px 6px; font-size: 14.5px; line-height: 1.4; box-shadow: 0 2px 6px rgba(40, 20, 10, 0.15); }
#hud .q.main { border-left-color: var(--red); } #hud .q b { display: block; font-size: 15.5px; } #hud .q.main b { color: var(--red); }
#hud .keys { position: absolute; left: 18px; bottom: 12px; font-size: 13px; color: #f4ead2; text-shadow: 0 1px 3px rgba(20, 10, 0, 0.85); opacity: 0.9; }
#hud .keys kbd { font-size: 11px; opacity: 0.95; }
#cross { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; border-radius: 50%; background: rgba(250, 244, 226, 0.9); box-shadow: 0 0 0 1.5px rgba(42, 32, 24, 0.7); }
#prompt { position: absolute; left: 50%; bottom: 17%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.pl { background: rgba(239, 228, 201, 0.93); border: 1px solid rgba(42, 32, 24, 0.55); border-radius: 4px; padding: 6px 16px 7px; font-size: 18px; white-space: nowrap; box-shadow: 0 3px 10px rgba(40, 20, 10, 0.25); }
.pl.fresh b::after { content: " ✦"; color: var(--gold); } .pl.sk { border-color: var(--red); } .pl.sk b { color: var(--red); }
.pl.dim { font-size: 15px; background: rgba(239, 228, 201, 0.75); }
.pl .bar { height: 4px; background: rgba(42, 32, 24, 0.18); margin-top: 5px; border-radius: 2px; overflow: hidden; } .pl .bar i { display: block; height: 100%; width: 0; background: var(--red); }
#toasts { position: absolute; left: 50%; top: 13%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.toast { background: rgba(42, 32, 24, 0.84); color: #f4ead2; padding: 5px 16px 6px; border-radius: 3px; font-size: 16px; animation: tin 0.25s ease-out; transition: opacity 0.6s, transform 0.6s; white-space: nowrap; }
.toast.quest { background: rgba(168, 50, 31, 0.93); font-size: 18px; } .toast.tip { background: rgba(239, 228, 201, 0.94); color: var(--ink); border: 1px solid rgba(42, 32, 24, 0.5); }
.toast.coin { color: #f1d27a; } .toast.favor { color: #f3b6a6; } .toast.out { opacity: 0; transform: translateY(-8px); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
#marks { position: absolute; inset: 0; overflow: hidden; }
.mk { position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 14px; will-change: transform; }
.mk::before { content: ""; position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; transform: rotate(45deg); }
.mk.main, .mk.quest { padding: 9px 0 0; margin-left: -4em; width: 8em; text-align: center; color: #fff6dc; font-weight: 600; text-shadow: 0 1px 3px #000, 0 0 6px rgba(0, 0, 0, 0.7); }
.mk.main::before, .mk.quest::before { left: calc(4em - 5px); background: var(--gold); box-shadow: 0 0 0 2px #fff6dc, 0 1px 5px #000; animation: pulse 1.6s infinite; }
.mk.quest::before { background: #3b5a6a; } .mk.off { opacity: 0.92; }
.mk.name { margin: -1.3em 0 0 -4em; width: 8em; text-align: center; color: #fff6dc; font-size: 15px; text-shadow: 0 1px 3px #000, 0 0 5px rgba(0, 0, 0, 0.8); }
.mk.glint::after { content: "✦"; position: absolute; left: -0.5em; top: -0.65em; color: #ffe9a6; font-size: 17px; text-shadow: 0 0 6px #b98a2c, 0 0 2px #000; animation: tw 1.4s infinite; }
.mk.sketch { margin: 0 0 0 -3em; width: 6em; text-align: center; font-size: 13px; color: #fff6dc; text-shadow: 0 1px 3px #000; padding-top: 12px; }
.mk.sketch::before { left: calc(3em - 5px); border: 2px solid #fff6dc; border-radius: 50%; transform: none; box-shadow: 0 0 4px #000; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(255, 246, 220, 0.35), 0 1px 5px #000; } }
@keyframes tw { 50% { opacity: 0.35; transform: scale(0.8); } }

/* ---------- 对话 ---------- */
#dialog { position: absolute; left: 50%; bottom: 5%; transform: translateX(-50%); width: min(820px, 92vw); pointer-events: auto; background: linear-gradient(#f3e9d0, var(--paper)); border: 1px solid var(--ink); outline: 4px solid rgba(239, 228, 201, 0.6); padding: 16px 22px 14px; box-shadow: 0 10px 34px rgba(30, 15, 5, 0.45); animation: up 0.2s ease-out; }
@keyframes up { from { opacity: 0; transform: translate(-50%, 12px); } }
.dname { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid rgba(42, 32, 24, 0.3); padding-bottom: 6px; margin-bottom: 8px; }
.dname b { font-size: 22px; color: var(--red); } .dname i { font-style: normal; font-size: 14px; color: var(--ink2); } .dname em { margin-left: auto; font-style: normal; font-size: 13px; color: var(--ink2); }
.hearts { display: inline-flex; gap: 3px; } .hearts i { width: 9px; height: 9px; border: 1px solid var(--red); transform: rotate(45deg); } .hearts i.on { background: var(--red); } .hearts i.half { background: linear-gradient(135deg, var(--red) 50%, transparent 50%); }
.dtext { font-size: 19.5px; line-height: 1.65; min-height: 3.2em; }
.dopts { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 38vh; overflow: auto; }
.dopts button { text-align: left; background: rgba(255, 250, 235, 0.55); border: 1px solid rgba(42, 32, 24, 0.28); border-radius: 3px; padding: 5px 10px; font-size: 17.5px; }
.dopts button:hover { background: #fff7e0; border-color: var(--red); color: var(--red); }

/* ---------- 画稿卡 ---------- */
#card { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; padding-right: 5vw; pointer-events: auto; background: radial-gradient(ellipse at 80% 50%, rgba(30, 20, 10, 0.3), transparent 70%); }
#card.card-sketch { justify-content: center; padding: 0; background: rgba(30, 20, 10, 0.42); }
.cbox { width: min(440px, 90vw); max-height: 88vh; overflow: auto; background: linear-gradient(#f5ecd4, var(--paper)); border: 1px solid var(--ink); outline: 4px solid rgba(239, 228, 201, 0.6); padding: 18px 22px 12px; box-shadow: 0 12px 40px rgba(30, 15, 5, 0.5); animation: pop 0.28s cubic-bezier(0.2, 1.3, 0.4, 1); }
.card-sketch .cbox { width: min(560px, 92vw); }
@keyframes pop { from { opacity: 0; transform: scale(0.94) rotate(-1deg); } }
.cimg { position: relative; margin: -4px -6px 12px; border: 1px solid var(--ink2); background: #d8c8a0; } .cimg img { display: block; width: 100%; }
.stamp { position: absolute; right: 10px; bottom: 10px; background: var(--red); color: #f7ead0; padding: 3px 5px; font-size: 14px; writing-mode: vertical-rl; letter-spacing: 2px; border-radius: 3px; opacity: 0.92; }
.ctag { font-size: 13.5px; color: var(--red); letter-spacing: 2px; } .cbox h2 { margin: 2px 0 8px; font-size: 27px; } .cbox p { margin: 0; font-size: 17.5px; line-height: 1.72; text-align: justify; }
.cfoot { text-align: right; font-size: 13px; color: var(--ink2); margin-top: 10px; }

/* ---------- 抛缆 ---------- */
#qte { position: absolute; left: 50%; top: 62%; transform: translateX(-50%); width: min(520px, 86vw); background: rgba(239, 228, 201, 0.95); border: 1px solid var(--ink); padding: 12px 18px; text-align: center; box-shadow: 0 8px 26px rgba(30, 15, 5, 0.45); }
.qt { font-size: 19px; margin-bottom: 8px; } .qs { font-size: 14px; color: var(--ink2); margin-top: 7px; }
.qbar { position: relative; height: 22px; background: #cdbd97; border: 1px solid var(--ink); } .qz { position: absolute; top: 0; bottom: 0; background: var(--red); } .qp { position: absolute; top: -5px; bottom: -5px; width: 4px; margin-left: -2px; background: var(--ink); }
.qbar.ok { animation: fok 0.3s; } .qbar.bad { animation: fbad 0.3s; }
@keyframes fok { 0% { box-shadow: 0 0 0 6px rgba(120, 170, 90, 0.8); } } @keyframes fbad { 0% { transform: translateX(-6px); } 50% { transform: translateX(6px); } }

/* ---------- 手札 / 画卷 ---------- */
#panel { position: absolute; inset: 0; pointer-events: auto; background: rgba(30, 20, 10, 0.5); display: flex; align-items: center; justify-content: center; }
.pbox { width: min(940px, 94vw); height: min(680px, 90vh); display: flex; flex-direction: column; background: linear-gradient(#f5ecd4, var(--paper)); border: 1px solid var(--ink); outline: 5px solid rgba(239, 228, 201, 0.55); box-shadow: 0 16px 50px rgba(20, 10, 0, 0.55); animation: pop 0.22s ease-out; }
.ptabs { display: flex; align-items: center; gap: 2px; padding: 10px 14px 0; border-bottom: 1px solid var(--ink); } .ptabs > b { font-size: 22px; padding: 0 10px 8px; } .ptabs > span { font-size: 13.5px; padding-bottom: 6px; }
.ptabs button { background: none; border: 1px solid transparent; border-bottom: none; padding: 5px 16px 7px; font-size: 18px; border-radius: 4px 4px 0 0; }
.ptabs button.on { background: var(--red); color: #f7ead0; } .ptabs button:hover:not(.on) { background: rgba(168, 50, 31, 0.12); }
.ptabs .x { margin-left: auto; font-size: 15px; color: var(--ink2); }
.pbody { flex: 1; overflow: auto; padding: 14px 22px 20px; font-size: 16.5px; line-height: 1.65; }
.pbody h3 { margin: 12px 0 6px; font-size: 19px; color: var(--red); display: flex; align-items: baseline; gap: 10px; } .pbody h3:first-child { margin-top: 0; }
.pbody h3 i { font-style: normal; font-size: 13px; color: var(--ink2); font-weight: 400; } .pbody h3 button { margin-left: auto; font-size: 14px; background: var(--red); color: #f7ead0; border: none; padding: 3px 12px; border-radius: 3px; }
.pbody p { margin: 4px 0 8px; }
.row { border-bottom: 1px dashed rgba(42, 32, 24, 0.25); padding: 7px 0; } .row b { font-size: 17.5px; } .row b i { font-style: normal; font-size: 13px; color: var(--ink2); margin-left: 8px; font-weight: 400; } .row p { margin: 2px 0 0; color: #3d3024; }
.chip { display: inline-block; border: 1px solid var(--red); color: var(--red); padding: 1px 10px; margin: 3px 6px 3px 0; border-radius: 3px; }
.skgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; margin-top: 10px; }
.sk { border: 1px solid rgba(42, 32, 24, 0.45); background: #f8f0da; padding: 4px 4px 2px; text-align: center; font-size: 14.5px; cursor: pointer; } .sk img, .sk .ph { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.sk .ph { display: flex; align-items: center; justify-content: center; background: #dccba3; color: rgba(42, 32, 24, 0.35); font-size: 30px; } .sk .ph.ink { color: var(--red); }
.sk.lock { cursor: default; opacity: 0.6; border-style: dashed; } .sk.on { outline: 2px solid var(--red); } .sk:not(.lock):hover { border-color: var(--red); }
.skinfo { border: 1px solid rgba(42, 32, 24, 0.3); background: rgba(255, 250, 235, 0.5); padding: 10px 14px; }
.person .fav { display: inline-block; width: 110px; height: 6px; background: rgba(42, 32, 24, 0.15); margin: 0 8px 2px 12px; vertical-align: middle; } .person .fav i { display: block; height: 100%; background: var(--red); } .person em { font-style: normal; font-size: 13px; color: var(--ink2); }
.boxes { display: flex; gap: 8px; margin: 10px 0; } .boxes div { flex: 1; border: 1px solid rgba(42, 32, 24, 0.4); text-align: center; padding: 6px 0; background: #f8f0da; } .boxes b { display: block; font-size: 24px; color: var(--red); } .boxes span { font-size: 13px; }
.qrow { display: flex; gap: 12px; padding: 4px 0; border-bottom: 1px dashed rgba(42, 32, 24, 0.2); font-size: 15.5px; } .qrow span { flex: 1; } .qrow em { font-style: normal; color: var(--ink2); font-size: 13.5px; white-space: nowrap; } .qrow.b3 em, .qrow.b4 em { color: #4d7a3a; } .qrow.b0 em { color: var(--red); }
.lrow { padding: 3px 0; } .lrow i { font-style: normal; color: var(--ink2); font-size: 13.5px; margin-right: 12px; }
.pbox.map { width: min(1500px, 97vw); height: auto; } .mapwrap { overflow: auto; padding: 10px 12px 4px; } #mapcv { display: block; width: 100%; min-width: 1100px; cursor: pointer; border: 1px solid rgba(42, 32, 24, 0.5); }
.mapfoot { text-align: center; font-size: 13.5px; padding: 2px 0 10px; }
.pbox.help { width: min(720px, 94vw); height: auto; max-height: 90vh; }
.pbox.ending { width: min(640px, 92vw); height: auto; padding: 30px 40px 26px; text-align: center; align-items: center; } .ending h1 { font-size: 46px; margin: 10px 0 8px; letter-spacing: 8px; } .ending p { margin: 6px 0; font-size: 17.5px; line-height: 1.7; } .ending .big { font-size: 20px; color: var(--red); } .ending .st-btns { margin-top: 18px; }

/* ---------- 开卷 / 终章 ---------- */
#start { position: absolute; inset: 0; pointer-events: auto; display: flex; align-items: center; justify-content: center; background: radial-gradient(ellipse at center, rgba(239, 228, 201, 0.78), rgba(210, 190, 150, 0.55) 60%, rgba(60, 40, 20, 0.55)); transition: opacity 0.9s; }
#start.gone { opacity: 0; pointer-events: none; }
.st-box { width: min(760px, 92vw); text-align: center; position: relative; padding: 20px; }
.st-seal { display: inline-block; background: var(--red); color: #f7ead0; padding: 7px 9px; font-size: 16px; line-height: 1.25; border-radius: 5px; box-shadow: inset 0 0 0 2px rgba(247, 234, 208, 0.5); }
.st-box h1 { font-size: clamp(54px, 9vw, 104px); margin: 8px 0 0; letter-spacing: 0.12em; font-weight: 700; text-shadow: 0 2px 0 rgba(255, 250, 235, 0.6); }
.st-sub { font-size: 20px; letter-spacing: 0.3em; color: var(--ink2); margin: 4px 0 18px; } .st-txt { font-size: 19px; line-height: 1.85; margin: 0 0 22px; }
.st-btns { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; } .st-btns button { background: var(--red); color: #f7ead0; border: none; padding: 10px 34px 12px; font-size: 22px; letter-spacing: 3px; border-radius: 4px; box-shadow: 0 4px 14px rgba(60, 20, 10, 0.4); }
.st-btns button:hover { filter: brightness(1.12); } .st-btns button.minor { background: none; color: var(--ink); border: 1px solid var(--ink); box-shadow: none; font-size: 18px; }
.st-warn { margin-top: 10px; font-size: 16px; color: var(--red); }
.st-keys { margin-top: 24px; font-size: 14.5px; line-height: 2; color: var(--ink2); }
#fade { position: absolute; inset: 0; background: #1c140c; opacity: 0; }
#bars div { position: absolute; left: 0; right: 0; height: 0; background: #17110b; transition: height 1.2s; } #bars div:last-child { bottom: 0; } #bars div:first-child { top: 0; }
body.cine #bars div { height: 10vh; }
#caption { position: absolute; left: 0; right: 0; bottom: 14vh; text-align: center; font-size: clamp(26px, 3.4vw, 44px); letter-spacing: 0.3em; color: #fff6dc; text-shadow: 0 2px 8px #000, 0 0 20px rgba(0, 0, 0, 0.7); opacity: 0; }
#caption.show { animation: cap 9s ease-in-out forwards; } @keyframes cap { 8% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
