@font-face { font-family: "MinchoB"; src: url("../fonts/minchoB.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Mincho"; src: url("../fonts/mincho.woff2") format("woff2"); font-display: swap; }

:root {
  --paper: #efe3c8;
  --paper2: #e4d8bd;
  --ink: #241f1a;
  --ink2: #3a3a44;
  --red: #b7282e;
  --gold: #d4a64a;
  --text: #f3ead8;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: #14110e; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
body { font-family: "Mincho", "Noto Serif SC", "Songti SC", serif; color: var(--ink); }
button { font-family: inherit; }

#viewport { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#stage { position: absolute; left: 50%; top: 50%; width: 1280px; height: 720px; margin: -360px 0 0 -640px; overflow: hidden; background: var(--paper); transform-origin: 50% 50%; }
#scene, #actors, #spots, #fx { position: absolute; inset: 0; }
#scene svg { width: 100%; height: 100%; display: block; }
#scene .scene-layer { position: absolute; inset: 0; transition: opacity .6s; }
#fx { pointer-events: none; z-index: 60; }
.hidden { display: none !important; }

/* ---------- actors ---------- */
#actors { pointer-events: none; z-index: 10; }
.actor { position: absolute; bottom: 20px; width: 240px; height: 480px; margin-left: -120px; transition: left .6s ease, opacity .5s, filter .3s; transform-origin: 50% 100%; }
.actor .pup { width: 100%; height: 100%; transform-origin: 50% 100%; animation: breathe 5s ease-in-out infinite; }
.actor.flip .pup-wrap { transform: scaleX(-1); }
.actor .pup-wrap { width: 100%; height: 100%; }
.actor.talking .pup { animation: breathe 5s ease-in-out infinite; }
.actor.talking { filter: drop-shadow(0 0 10px rgba(239,227,200,.25)); }
.actor.dim { filter: brightness(.55) saturate(.6); }
.actor.enter { opacity: 0; }
@keyframes sway { 0%,100% { transform: rotate(-.8deg); } 50% { transform: rotate(.8deg); } }
@keyframes hop { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }

/* ---------- hotspots ---------- */
#spots { z-index: 20; }
.spot { position: absolute; cursor: pointer; border-radius: 12px; }
.spot .dot { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; border: 2px solid rgba(255,248,230,.95); background: radial-gradient(circle, rgba(168,50,42,.85) 0 30%, rgba(168,50,42,.25) 31% 100%); box-shadow: 0 0 10px rgba(0,0,0,.5); animation: pulse 1.8s ease-in-out infinite; }
.spot.seen .dot { background: radial-gradient(circle, rgba(60,55,50,.7) 0 30%, rgba(60,55,50,.2) 31%); animation: none; opacity: .65; }
.spot .lbl { position: absolute; left: 50%; top: 50%; transform: translate(-50%, 20px); white-space: nowrap; padding: 3px 10px; font-size: 19px; color: var(--text); background: rgba(20,16,12,.78); border-radius: 3px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.spot:hover .lbl, .spot.show-lbl .lbl { opacity: 1; }
.spot:hover { background: rgba(255,240,200,.08); }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.18); } }

/* ---------- nav exits ---------- */
#nav { position: absolute; left: 16px; bottom: 16px; z-index: 25; display: flex; gap: 10px; flex-wrap: wrap; max-width: 900px; }
.nav-btn { padding: 8px 18px 8px 14px; font-size: 21px; color: var(--text); background: rgba(28,22,17,.85); border: 1px solid rgba(212,166,74,.6); border-radius: 3px; cursor: pointer; }
.nav-btn::before { content: "◂ "; color: var(--gold); }
.nav-btn.cur { background: var(--red); border-color: var(--red); }
.nav-btn.cur::before { content: "● "; color: #fff; }
.nav-btn .badge { display: inline-block; width: 9px; height: 9px; margin-left: 6px; border-radius: 50%; background: #e0563f; vertical-align: 3px; }
.nav-btn:hover { background: rgba(60,44,30,.95); }
.nav-btn.cur:hover { background: #b8433a; }

/* ---------- HUD ---------- */
#hud { position: absolute; top: 0; left: 0; right: 0; height: 80px; z-index: 40; pointer-events: none; display: flex; justify-content: space-between; align-items: flex-start; padding: 14px 18px; }
#hud > div { pointer-events: auto; display: flex; align-items: center; gap: 12px; }
.hud-btn { width: 62px; height: 62px; border-radius: 50%; border: 2px solid rgba(212,166,74,.7); background: rgba(28,22,17,.82); color: var(--text); font-family: "MinchoB", "Mincho", serif; font-size: 24px; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.hud-btn:hover { background: var(--red); }
.hud-btn.flash { animation: flash 1s ease-in-out 3; }
@keyframes flash { 50% { background: var(--red); transform: scale(1.1); } }
#ink { display: flex; gap: 3px; height: 22px; padding: 3px 8px; background: linear-gradient(90deg, rgba(20,16,12,.85), rgba(20,16,12,.2)); border-radius: 2px 12px 12px 2px; }
#ink i { display: block; width: 46px; height: 16px; background: #e6919b; clip-path: polygon(4% 20%, 100% 0, 96% 80%, 0 100%); transition: background .4s, opacity .4s; }
#ink i.gone { background: #3a332c; opacity: .5; }
#ink.hit { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
#hud-time { margin-top: 6px; padding: 6px 22px; color: var(--text); font-size: 20px; background: rgba(20,16,12,.7); border-radius: 2px; letter-spacing: 2px; }
#hud-time:empty { display: none; }
#hud.off { display: none; }

/* ---------- continue ---------- */
.ink-btn { position: absolute; right: 24px; bottom: 22px; z-index: 30; padding: 12px 30px; font-size: 24px; color: var(--text); font-family: "MinchoB", "Mincho", serif; background: var(--red); border-radius: 2px; cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.4); clip-path: polygon(3% 0, 100% 6%, 97% 100%, 0 92%); }
.ink-btn:hover { background: #bd4237; }

/* ---------- dialog ---------- */
#dialog { position: absolute; left: 0; right: 0; bottom: 0; height: 190px; z-index: 50; padding: 34px 170px 20px; cursor: pointer; background: linear-gradient(180deg, rgba(20,28,43,0) 0, rgba(20,28,43,.86) 30px, rgba(20,28,43,.95) 100%); color: var(--text); }
#dlg-name { position: absolute; left: 170px; top: 0; padding: 4px 18px; font-family: "MinchoB", "Mincho", serif; font-size: 27px; color: #fff; background: var(--red); clip-path: polygon(0 8%, 100% 0, 96% 100%, 3% 94%); }
#dlg-name:empty { display: none; }
#dlg-text { font-size: 27px; line-height: 1.6; letter-spacing: 1px; min-height: 90px; padding-top: 14px; }
#dialog.narr #dlg-text { color: #d9cfbb; font-style: normal; }
#dialog.think #dlg-text { color: #bcd2cf; }
#dlg-more { position: absolute; right: 150px; bottom: 18px; font-size: 22px; color: var(--gold); animation: bob 1s infinite; }
@keyframes bob { 50% { transform: translateY(5px); } }
#dlg-text .em { color: #f0b85a; }
#dlg-text .clue { color: #ef7d6a; }

/* ---------- choices ---------- */
#choices { position: absolute; inset: 0; z-index: 55; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: rgba(10,8,6,.35); padding-bottom: 120px; }
.choice { min-width: 460px; max-width: 820px; padding: 14px 36px; font-size: 25px; text-align: center; color: var(--ink); background: var(--paper); border: 2px solid var(--ink2); cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.35); clip-path: polygon(1% 4%, 99% 0, 100% 94%, 0 100%); transition: transform .15s; }
.choice:hover { background: #fff6e0; transform: scale(1.03); }
.choice.used { color: #8a7f70; }
.choices-title { color: var(--text); font-size: 28px; font-family: "MinchoB", "Mincho", serif; text-shadow: 0 2px 6px #000; margin-bottom: 6px; }

/* ---------- toast ---------- */
#toast { position: absolute; top: 96px; left: 50%; transform: translateX(-50%); z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { padding: 9px 26px; font-size: 21px; color: var(--text); background: rgba(20,16,12,.9); border-left: 5px solid var(--red); animation: toastIn .35s ease-out, toastOut .5s ease-in 2.6s forwards; white-space: nowrap; }
.toast.ach { border-left-color: var(--gold); }
.toast b { color: #f0b85a; font-weight: normal; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- overlay / panels ---------- */
#overlay { position: absolute; inset: 0; z-index: 58; background: rgba(10,8,6,.55); }
.panel { position: absolute; inset: 36px 60px; background: var(--paper); box-shadow: 0 10px 40px rgba(0,0,0,.6); display: flex; flex-direction: column; }
.panel::before, .panel::after { content: ""; position: absolute; top: -10px; bottom: -10px; width: 22px; background: linear-gradient(90deg, #1a2638, #3c5a7a 50%, #141c2b); border-radius: 6px; }
.panel::before { left: -16px; } .panel::after { right: -16px; }
.panel-head { display: flex; align-items: center; padding: 16px 28px 10px; border-bottom: 2px solid rgba(36,31,26,.25); }
.panel-title { font-family: "MinchoB", "Mincho", serif; font-size: 36px; flex: 1; }
.panel-close { width: 46px; height: 46px; font-size: 28px; border: none; border-radius: 50%; background: var(--ink); color: var(--text); cursor: pointer; }
.panel-body { flex: 1; display: flex; min-height: 0; }

.tabs { width: 130px; padding: 14px 0; border-right: 2px solid rgba(36,31,26,.2); display: flex; flex-direction: column; gap: 6px; }
.tab { padding: 10px 0; font-size: 23px; text-align: center; cursor: pointer; color: var(--ink2); position: relative; }
.tab.on { color: #fff; background: var(--red); }
.tab .n { font-size: 15px; opacity: .7; }
.grid { flex: 1; padding: 16px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; align-content: start; }
.card { height: 150px; padding: 10px; background: #f8f1e1; border: 2px solid rgba(36,31,26,.3); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; position: relative; }
.card svg { width: 84px; height: 84px; }
.card .nm { font-size: 19px; margin-top: 6px; line-height: 1.2; }
.card.sel { border-color: var(--red); box-shadow: 0 0 0 3px rgba(168,50,42,.35); background: #fff8ea; }
.card.new::after { content: "新"; position: absolute; top: 4px; right: 6px; font-size: 14px; color: #fff; background: var(--red); padding: 0 4px; }
.detail { width: 360px; padding: 20px 24px; border-left: 2px solid rgba(36,31,26,.2); overflow-y: auto; }
.detail h3 { margin: 0 0 4px; font-family: "MinchoB", "Mincho", serif; font-size: 32px; font-weight: normal; }
.detail .cat { color: var(--red); font-size: 18px; margin-bottom: 10px; }
.detail p { font-size: 21px; line-height: 1.65; margin: 0 0 10px; }
.detail .big { display: flex; justify-content: center; margin: 4px 0 10px; }
.detail .big svg { width: 140px; height: 140px; }
.empty { color: #8a7f70; font-size: 21px; padding: 30px; grid-column: 1 / -1; }
.present-bar { padding: 12px 28px; display: flex; justify-content: space-between; align-items: center; border-top: 2px solid rgba(36,31,26,.25); }
.present-bar .q { font-size: 23px; color: var(--ink2); flex: 1; padding-right: 20px; }
.btn { padding: 10px 28px; font-size: 23px; color: var(--text); background: var(--ink); border: none; cursor: pointer; font-family: "MinchoB", "Mincho", serif; }
.btn.red { background: var(--red); }
.btn:disabled { opacity: .35; cursor: default; }
.btn + .btn { margin-left: 10px; }

.timeline { flex: 1; padding: 20px 30px; overflow-y: auto; }
.tl-row { display: flex; gap: 18px; padding: 8px 0; border-bottom: 1px dashed rgba(36,31,26,.25); font-size: 21px; }
.tl-row .t { width: 90px; color: var(--red); flex-shrink: 0; }
.people { flex: 1; padding: 16px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; align-content: start; }
.person { display: flex; gap: 12px; padding: 10px; background: #f8f1e1; border: 2px solid rgba(36,31,26,.25); }
.person .ph { width: 80px; height: 120px; flex-shrink: 0; overflow: hidden; }
.person .ph svg { width: 120px; height: 240px; margin-left: -20px; margin-top: -12px; }
.person h4 { margin: 0; font-family: "MinchoB", "Mincho", serif; font-size: 26px; font-weight: normal; }
.person p { margin: 4px 0 0; font-size: 18px; line-height: 1.5; }

/* testimony */
.testi { position: absolute; left: 50%; top: 40px; transform: translateX(-50%); width: 900px; padding: 20px 34px 24px; background: var(--paper); box-shadow: 0 10px 40px rgba(0,0,0,.6); }
.testi h2 { margin: 0 0 4px; font-family: "MinchoB", "Mincho", serif; font-weight: normal; font-size: 34px; text-align: center; }
.testi .sub { text-align: center; color: var(--ink2); font-size: 19px; margin-bottom: 12px; }
.tline { padding: 10px 18px; margin: 7px 0; font-size: 23px; background: #f8f1e1; border-left: 5px solid #8a7f70; cursor: pointer; }
.tline.sel { border-left-color: var(--red); background: #fff3dc; box-shadow: 0 0 0 2px rgba(168,50,42,.35); }
.tline.broken { text-decoration: line-through; color: #8a7f70; border-left-color: #3a332c; cursor: default; }
.tline .press { float: right; font-size: 17px; color: var(--red); }
.testi .ops { display: flex; justify-content: center; gap: 14px; margin-top: 14px; }

/* deduce */
.deduce { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 940px; padding: 28px 40px 30px; background: var(--paper); box-shadow: 0 10px 40px rgba(0,0,0,.6); text-align: center; }
.deduce .tag { font-family: "MinchoB", "Mincho", serif; color: var(--red); font-size: 24px; letter-spacing: 6px; }
.deduce h2 { margin: 8px 0 20px; font-weight: normal; font-size: 29px; line-height: 1.5; }
.deduce .opts { display: flex; flex-direction: column; gap: 12px; }
.deduce .opt { padding: 13px 20px; font-size: 23px; background: #f8f1e1; border: 2px solid rgba(36,31,26,.3); cursor: pointer; text-align: left; }
.deduce .opt:hover { border-color: var(--red); background: #fff6e0; }
.deduce .opt.wrong { opacity: .4; text-decoration: line-through; pointer-events: none; }

/* accuse scroll */
.accuse { position: absolute; left: 40px; right: 40px; top: 50%; height: 560px; margin-top: -270px; }
.accuse h2 { margin: 0 0 14px; text-align: center; color: #fff; font-family: "MinchoB", "Mincho", serif; font-size: 50px; font-weight: normal; letter-spacing: 6px; text-shadow: 0 3px 10px #000; }
.scroll { position: relative; height: 420px; background: var(--paper); box-shadow: 0 10px 40px rgba(0,0,0,.6); overflow-x: auto; overflow-y: hidden; display: flex; align-items: flex-end; padding: 0 40px; animation: unroll .8s ease-out; }
@keyframes unroll { from { clip-path: inset(0 50% 0 50%); } to { clip-path: inset(0 0 0 0); } }
.suspect { position: relative; width: 180px; height: 400px; flex-shrink: 0; cursor: pointer; }
.suspect svg { position: absolute; left: -10px; bottom: -6px; width: 200px; height: 400px; pointer-events: none; }
.suspect .tagname { position: absolute; top: 18px; right: 6px; width: 40px; padding: 8px 0; writing-mode: vertical-rl; font-family: "MinchoB", "Mincho", serif; font-size: 26px; text-align: center; border: 2px solid var(--ink2); background: #f8f1e1; letter-spacing: 4px; }
.suspect.sel .tagname { background: var(--red); color: #fff; border-color: var(--red); }
.suspect.sel::after { content: ""; position: absolute; right: 10px; bottom: 30px; width: 100px; height: 60px; border-left: 12px solid var(--red); border-bottom: 12px solid var(--red); transform: rotate(-45deg); opacity: .85; }
.accuse .ops { text-align: center; margin-top: 18px; }

/* chapter card */
.chapter { position: absolute; inset: 0; z-index: 80; background: var(--paper); display: flex; align-items: center; justify-content: center; animation: fadeIn .8s; }
.chapter svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.chapter .cv { position: relative; display: flex; flex-direction: row-reverse; gap: 30px; align-items: flex-start; }
.chapter .c1 { writing-mode: vertical-rl; font-family: "MinchoB", "Mincho", serif; font-size: 40px; color: var(--red); letter-spacing: 8px; }
.chapter .c2 { writing-mode: vertical-rl; font-family: "MinchoB", "Mincho", serif; font-size: 96px; letter-spacing: 16px; color: var(--ink); animation: brushIn 1.4s ease-out; }
.chapter .c3 { writing-mode: vertical-rl; font-size: 26px; color: var(--ink2); letter-spacing: 6px; margin-top: 120px; }
@keyframes brushIn { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes fadeIn { from { opacity: 0; } }
.fadeout { animation: fadeOut .7s forwards; }
@keyframes fadeOut { to { opacity: 0; } }

/* ink transition */
.ink-wipe { position: absolute; inset: 0; background: #16120e; animation: wipe 1.1s ease-in-out forwards; }
@keyframes wipe { 0% { clip-path: circle(0% at 50% 50%); } 45%,55% { clip-path: circle(80% at 50% 50%); } 100% { clip-path: circle(0% at 50% 50%); opacity: .0; } }
.flash-red { position: absolute; inset: 0; background: radial-gradient(circle, rgba(168,50,42,0), rgba(168,50,42,.55)); animation: fadeOut .6s forwards; }
.objection { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-6deg); font-family: "MinchoB", "Mincho", serif; font-size: 150px; color: var(--red); text-shadow: 4px 4px 0 #fff, 0 0 30px rgba(0,0,0,.4); animation: stamp .9s ease-out forwards; }
@keyframes stamp { 0% { transform: translate(-50%,-50%) rotate(-6deg) scale(2.4); opacity: 0; } 20% { transform: translate(-50%,-50%) rotate(-6deg) scale(1); opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }

/* title */
#title-screen { position: absolute; inset: 0; z-index: 90; background: var(--paper); }
#title-screen svg.bg { position: absolute; inset: 0; width: 100%; height: 100%; }
.logo { position: absolute; left: 120px; top: 70px; display: flex; flex-direction: row-reverse; gap: 10px; }
.logo .big { writing-mode: vertical-rl; font-family: "MinchoB", "Mincho", serif; font-size: 132px; line-height: 1; color: var(--ink); letter-spacing: 4px; animation: brushIn 2s ease-out; }
.logo .seal { writing-mode: vertical-rl; align-self: flex-end; margin-bottom: 20px; padding: 6px 4px; font-family: "MinchoB", "Mincho", serif; font-size: 22px; color: #fff; background: var(--red); border-radius: 3px; }
.logo .small { writing-mode: vertical-rl; font-size: 26px; color: var(--ink2); letter-spacing: 8px; margin-top: 40px; }
.menu { position: absolute; right: 120px; bottom: 90px; display: flex; flex-direction: column; gap: 14px; }
.menu button { width: 240px; padding: 12px 0; font-size: 28px; font-family: "MinchoB", "Mincho", serif; color: var(--text); background: rgba(28,22,17,.88); border: 1px solid rgba(212,166,74,.6); cursor: pointer; letter-spacing: 6px; }
.menu button:hover { background: var(--red); }
.menu button:disabled { opacity: .35; cursor: default; background: rgba(28,22,17,.88); }
.credit { position: absolute; left: 0; right: 0; bottom: 14px; text-align: center; color: var(--ink2); font-size: 16px; opacity: .7; }

.ach-list { flex: 1; padding: 16px 28px; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-content: start; }
.ach { display: flex; gap: 14px; align-items: center; padding: 10px; background: #f8f1e1; border: 2px solid rgba(36,31,26,.25); }
.ach .stamp { width: 70px; height: 70px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-family: "MinchoB", "Mincho", serif; font-size: 34px; color: #fff; background: var(--red); border: 4px double #f3ead8; outline: 2px solid var(--red); }
.ach.lock .stamp { background: #9a9083; outline-color: #9a9083; }
.ach.lock { color: #8a7f70; }
.ach h4 { margin: 0; font-size: 24px; font-weight: normal; font-family: "MinchoB", "Mincho", serif; }
.ach p { margin: 2px 0 0; font-size: 18px; }

.menu-panel { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 420px; padding: 30px; background: var(--paper); box-shadow: 0 10px 40px rgba(0,0,0,.6); display: flex; flex-direction: column; gap: 12px; }
.menu-panel h2 { margin: 0 0 6px; text-align: center; font-family: "MinchoB", "Mincho", serif; font-weight: normal; font-size: 36px; }
.menu-panel .btn { width: 100%; margin: 0; }

/* puzzle */
.puzzle { position: absolute; inset: 0; z-index: 58; background: #1b1713; }
.puzzle svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pz-tip { position: absolute; left: 50%; top: 22px; transform: translateX(-50%); padding: 10px 30px; font-size: 24px; color: var(--text); background: rgba(20,16,12,.85); border-bottom: 3px solid var(--red); white-space: nowrap; }
.pz-tools { position: absolute; left: 24px; top: 100px; display: flex; flex-direction: column; gap: 10px; }
.pz-tool { width: 150px; padding: 10px; font-size: 21px; color: var(--ink); background: var(--paper); border: 2px solid var(--ink2); cursor: pointer; text-align: center; }
.pz-tool.on { background: var(--red); color: #fff; border-color: var(--red); }
.pz-tool.done { opacity: .4; pointer-events: none; }
.pz-slot { cursor: pointer; }
.pz-slot:hover .ring { stroke: #f0b85a; }

/* svg 动效（注意：带 transform 属性的 g 不要挂这些类） */
.spin { animation: rot 1.4s linear infinite; transform-origin: 0 0; }
.spin-slow { animation: rot 7s linear infinite; transform-origin: 0 0; }
@keyframes rot { to { transform: rotate(360deg); } }
.drift { animation: drift 14s ease-in-out infinite alternate; }
@keyframes drift { from { transform: translateX(-30px); } to { transform: translateX(30px); } }
.birds { animation: birds 30s linear infinite; }
@keyframes birds { from { transform: translate(-40px, 10px); } to { transform: translate(140px, -20px); } }
.flick { animation: flick 3s ease-in-out infinite; }
@keyframes flick { 0%,100% { opacity: .85; } 40% { opacity: 1; } 60% { opacity: .7; } }
.flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flame .5s ease-in-out infinite alternate; }
@keyframes flame { to { transform: scale(.85, 1.12); } }
.shake { animation: wshake .3s linear infinite; }
@keyframes wshake { 50% { transform: translate(1.5px, -1px); } }
.leaf { animation: leaf 7s ease-in infinite; }
@keyframes leaf { from { transform: translate(0, 0) rotate(0); opacity: 1; } to { transform: translate(-160px, 300px) rotate(240deg); opacity: 0; } }

.sway-tree { animation: swayT 6s ease-in-out infinite alternate; transform-origin: 0 -300px; }
@keyframes swayT { from { transform: rotate(-1.2deg); } to { transform: rotate(1.6deg); } }
.flutter { animation: flutter 3s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 0 0; }
@keyframes flutter { to { transform: skewY(3deg) scaleX(.96); } }
.dust circle { animation: dust 12s linear infinite; }
@keyframes dust { 0% { transform: translate(0, 0); opacity: 0; } 20% { opacity: .6; } 100% { transform: translate(40px, -80px); opacity: 0; } }

/* rotate tip */
#rotate-tip { display: none; position: fixed; inset: 0; z-index: 999; background: #14110e; color: var(--text); font-size: 26px; text-align: center; align-items: center; justify-content: center; flex-direction: column; line-height: 2; }
@media (orientation: portrait) and (max-width: 900px) {
  #rotate-tip { display: flex; }
  body.ignore-rotate #rotate-tip { display: none; }
}

/* 国风淡彩视觉层：仅覆盖绘制属性，不改变几何、显隐、缩放或点击行为。 */
:root { --paper: #eee4cc; --paper2: #e0d2b0; --ink: #292e2c; --ink2: #59594b; --red: #963e32; --gold: #bca371; --text: #f4ecd9; }
html, body { background: #172522; }
#stage { background: #eee4cc; }
.hud-btn { background: linear-gradient(145deg, #34463e, #1b2c28); border-color: #b9a77d; box-shadow: inset 0 0 0 4px #22362f, inset 0 0 0 5px #8d805e, 0 3px 12px #101e1b66; color: #f2e6c9; }
.hud-btn:hover { background: linear-gradient(145deg,#b05c43,#793c32); }
#ink { background: linear-gradient(90deg,#21362dd9,#21362d20); }
#ink i { background: #73988b; }
#hud-time { background: #21362dd9; color: #f1e4c3; box-shadow: inset 0 -1px #c5ae7866; }
.nav-btn { background: linear-gradient(180deg,#35463ff5,#1e302bf5); border-color: #ac996e; box-shadow: inset 0 0 0 3px #d6bf8620, 0 2px 6px #18272155; border-radius: 2px; }
.nav-btn:hover { background: #45564b; }
.nav-btn.cur { background: #8d4536; border-color: #c6aa73; }
.nav-btn.cur:hover { background: #a75a44; }
.spot .dot { border-color: #f4e7bd; background: radial-gradient(circle,#b45e45 0 25%,#ddc79655 29% 50%,#263c3288 52%); box-shadow: 0 0 0 4px #cfb57720, 0 2px 10px #14272099; }
.spot.seen .dot { background: radial-gradient(circle,#688277 0 25%,#ddc79644 29% 50%,#263c3266 52%); }
.spot .lbl { background: #26382ef2; color: #f4e5c3; box-shadow: 0 1px 0 #ccb17899; }
#dialog { background: linear-gradient(180deg,#1c302a00 0%,#1c302aee 20%,#152923fa 100%); box-shadow: inset 0 -5px #b6a47755; color: #f5ecd5; }
#dlg-name { background: linear-gradient(110deg,#aa5740,#78372f); color: #ffefd0; text-shadow: 0 1px #5a2c26; }
#dlg-text { text-shadow: 0 1px 2px #0b1c16; }
#dialog.narr #dlg-text { color: #e3dbc5; }
#dialog.think #dlg-text { color: #c2d8cd; }
#dlg-text .em { color: #e4bf79; }
#dlg-text .clue { color: #f0ab8c; }
.ink-btn { background: #963e32; box-shadow: inset 0 0 0 4px #efcf8c25,0 3px 10px #17272077; }
.choice, .card, .person, .ach, .deduce .opt, .tline { background: linear-gradient(120deg,#f7efda,#e8dcc0); }
.choice { border-color: #7b8069; box-shadow: inset 0 0 0 4px #fbf4e3, inset 0 0 0 5px #bdad85,0 6px 16px #17282066; }
.choice:hover { background: #fff3d5; }
.panel, .testi, .deduce, .scroll, .menu-panel { background-color: #eee4cc; background-image: repeating-linear-gradient(3deg,#806a3e05 0 1px,transparent 1px 6px),radial-gradient(ellipse at 30% 20%,#fff9e4,#dfcfaa); box-shadow: inset 0 0 0 4px #eddfbd,inset 0 0 0 5px #aa936566,0 12px 44px #101f19aa; }
.panel::before, .panel::after { background: linear-gradient(90deg,#2e3c31,#7b7960 42%,#a89c73 49%,#5a6250 63%,#283a2d); }
.panel-head, .present-bar, .tabs, .detail { border-color: #9c8b6444; }
.panel-title, .detail h3, .person h4, .menu-panel h2, .testi h2 { color: #344c3f; }
.panel-close, .btn { background: #30483b; color: #f5e9cc; box-shadow: inset 0 0 0 3px #d6be8729; }
.btn.red { background: #963e32; }
.card, .person, .ach, .deduce .opt { border-color: #b2a27c88; }
.card.sel, .tline.sel { background: #fff1d2; border-color: #963e32; box-shadow: inset 0 0 0 2px #c49f6177; }
.tab.on { background: linear-gradient(90deg,#963e32,#ad6148); color: #fff2d8; }
.tline { border-left-color: #89917a; }
.tline.sel { border-left-color: #963e32; }
.tline.broken { border-left-color: #555e50; }
.deduce .opt:hover { background: #fff1d2; border-color: #963e32; }
.toast { background: #233c31f5; box-shadow: inset 0 -1px #d2bd7b55,0 3px 14px #101f19aa; }
.pz-tip { background: #20392ff5; border-bottom-color: #b99763; }
.pz-tool { background: linear-gradient(120deg,#f4ead0,#dcccaa); border-color: #8d8c70; box-shadow: inset 0 0 0 3px #fbf1d9; }
.pz-tool.on { background: #963e32; color: #fff2d8; border-color: #c6a46a; box-shadow: inset 0 0 0 3px #efcf8c44; }
.logo .big { color: #293c32; text-shadow: 1px 2px #f5ebcf66; }
.logo .small { color: #68715c; }
.logo .seal { background: #963e32; box-shadow: inset 0 0 0 2px #f4ddbd66; }
.menu button { background: linear-gradient(110deg,#20372ff2,#304a3ff2); border-color: #b49c6b; box-shadow: inset 0 0 0 4px #1b302a,inset 0 0 0 5px #b49c6b66,0 5px 14px #1b302a33; color: #f0e4c7; }
.menu button:hover { background: linear-gradient(110deg,#874133,#ae6147); }
.menu button:disabled { background: #23372f; }
.credit { color: #4f5e4e; }
.chapter .c1 { color: #963e32; text-shadow: 1px 1px #fff2d5; }
.chapter .c2 { color: #2c4438; }
.chapter .c3 { color: #68725f; }
.suspect .tagname { border-color: #7a8068; background: #f4e8cc; }
.suspect.sel .tagname { background: #963e32; color: #fff0cc; border-color: #963e32; }

/* ===== 本作追加 ===== */
#dlg-name { background: var(--red); }
#dialog::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 26px; background: repeating-radial-gradient(circle at 20px 26px, transparent 0 8px, rgba(239,227,200,.12) 8px 9.5px, transparent 9.5px 13px, rgba(239,227,200,.12) 13px 14.5px, transparent 14.5px 20px); background-size: 40px 26px; pointer-events: none; }
.hud-btn { border-color: rgba(212,166,74,.7); background: rgba(20,28,43,.85); }
.ink-btn { background: var(--red); }
.choice { border-color: #22344f; }

.flow { animation: flow 6s linear infinite; }
@keyframes flow { from { transform: translateX(0); } to { transform: translateX(-40px); } }
.petal { animation: petal 9s linear infinite; }
@keyframes petal { from { transform: translate(0, 0) rotate(0); opacity: 0; } 10% { opacity: 1; } to { transform: translate(var(--dx, -200px), 420px) rotate(400deg); opacity: 0; } }
.dits { animation: flick 1.2s steps(2) infinite; }

/* 谜题 */
.pz { position: absolute; inset: 0; z-index: 58; background: rgba(10,12,18,.72); display: flex; align-items: center; justify-content: center; animation: fadeIn .3s; }
.pz-card { position: relative; width: 560px; padding: 26px 34px 24px; background: var(--paper); box-shadow: 0 10px 40px rgba(0,0,0,.6); border-top: 8px solid var(--red); text-align: center; }
.pz-card.wide { width: 860px; }
.pz-card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, rgba(0,0,0,.02) 0 2px, transparent 2px 5px); }
.pz-title { font-family: "MinchoB", serif; font-size: 32px; letter-spacing: 4px; }
.pz-sub { font-size: 20px; color: var(--ink2); margin: 6px 0 16px; line-height: 1.5; }
.pz-ops { display: flex; justify-content: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.pz-ops .btn + .btn { margin-left: 0; }
.shake-x { animation: shake .4s; }
.kp-screen { margin: 0 auto 16px; width: 360px; height: 62px; line-height: 62px; font-family: "MinchoB", monospace; font-size: 34px; letter-spacing: 6px; color: #9fd28a; background: #141a14; border: 4px solid #3a3e41; }
.kp-screen.broken { color: #c9c2b0; background: repeating-linear-gradient(115deg, #141a14 0 12px, #20251f 12px 14px); }
.kp-screen.ok { color: #fff2c0; }
.kp-keys { display: grid; grid-template-columns: repeat(3, 90px); gap: 10px; justify-content: center; }
.kp-k { height: 58px; font-size: 26px; font-family: "MinchoB", serif; background: #d6cfbd; border: 2px solid #3a3a44; cursor: pointer; }
.kp-k:hover { background: #fff6e0; }
.kp-k:active { transform: translateY(2px); }
.tx-row { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 30px; }
.tx-in { width: 220px; padding: 8px 12px; font-size: 32px; font-family: "MinchoB", serif; text-align: center; background: #fbf6ea; border: 3px solid #22344f; outline: none; }
.tx-in.ok { border-color: #4f8a4b; background: #eef6e6; }
.sg-pick { display: flex; gap: 12px; justify-content: center; margin-bottom: 12px; }
.sg-pick .btn + .btn { margin-left: 0; }
.sg-board canvas { width: 480px; height: 160px; background: #efe6d0; border: 3px solid #3a3a44; touch-action: none; cursor: crosshair; }
.sg-meter { width: 480px; height: 8px; margin: 6px auto 0; background: #d6cfbd; }
.sg-meter i { display: block; height: 100%; width: 0; background: #4f8a4b; transition: width .2s; }
.pt-wrap { display: flex; justify-content: center; }
.pt { width: 440px; height: 360px; transition: filter .8s; }
.ky-holes { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0 auto 16px; width: 120px; padding: 12px; background: url() , linear-gradient(90deg, #4a5257, #7d868b 45%, #3e4549); border: 3px solid #1d1a17; }
.ky-hole { width: 56px; height: 34px; border-radius: 6px; background: #1a1c1e; color: #fff; font-family: "MinchoB", serif; font-size: 20px; line-height: 34px; box-shadow: inset 0 2px 4px #000; }
.ky-deck { display: flex; gap: 12px; justify-content: center; }
.ky { width: 70px; height: 70px; border-radius: 50%; font-size: 26px; font-family: "MinchoB", serif; color: #fff; background: var(--c); border: 3px solid #1d1a17; cursor: pointer; }
.ky:disabled { opacity: .25; cursor: default; }
.rm-map { position: relative; width: 438px; height: 356px; margin: 0 auto 14px; background: #5a4636; border: 3px solid #1d1a17; }
.rm { position: absolute; padding: 6px 2px; background: #d6cfbd; border: 3px solid #3a3a44; cursor: pointer; box-sizing: border-box; }
.rm:hover { background: #fff6e0; }
.rm-door { position: absolute; background: #d4a64a; border: 2px solid #1d1a17; pointer-events: none; }
.rm-hall { position: absolute; left: 0; width: 330px; top: 150px; text-align: center; color: #efe3c8; font-size: 20px; letter-spacing: 14px; opacity: .55; pointer-events: none; }
.rm-north { position: absolute; left: 8px; top: 6px; color: #efe3c8; font-size: 18px; pointer-events: none; }
.rm.fixed { background: #e9dcc0; cursor: default; }
.rm-n { font-family: "MinchoB", serif; font-size: 18px; }
.rm-who { margin-top: 4px; font-size: 16px; color: var(--red); line-height: 1.2; }
.rm-names { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.rm-names .btn + .btn { margin-left: 0; }
