:root {
  --paper: #f4efe6; --paper2: #fbf8f2; --ink: #2b2622; --ink2: #5d544c; --line: #d8cdbd;
  --accent: #1f5f5b; --accent2: #2f7d77; --danger: #9b2c2c; --gold: #b08d57; --ok: #2e7a46; --bad: #a33a2a;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 16px/1.45 Georgia, 'Times New Roman', serif; }
button { font: inherit; }
.screen { display: none; min-height: 100vh; }
.screen.on { display: block; }

.btn { background: var(--paper2); color: var(--ink); border: 1.5px solid var(--ink2); border-radius: 6px; padding: 7px 14px; cursor: pointer; }
.btn:hover:not(:disabled) { background: #fff; border-color: var(--ink); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.big { padding: 11px 22px; font-size: 18px; background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.big:hover:not(:disabled) { background: var(--accent2); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger.big { background: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { border-color: var(--line); }
.btn.small { padding: 3px 9px; font-size: 14px; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff; font-size: 13px; text-align: center; }
.badge.pulse { animation: pulse 0.9s 2; }
@keyframes pulse { 50% { transform: scale(1.35); background: var(--gold); } }

/* title */
#s-title { display: none; align-items: center; justify-content: center; }
#s-title.on { display: flex; }
.title-card { display: flex; gap: 48px; align-items: center; padding: 40px; }
.title-face { width: 320px; height: 400px; border-radius: 10px; overflow: hidden; background: #cbbba3; box-shadow: 0 10px 40px rgba(60, 40, 20, 0.25); position: relative; }
.title-face svg { width: 100%; height: 100%; }
.title-text h1 { font-size: 64px; letter-spacing: 6px; margin: 0; font-weight: normal; }
.title-text .sub { font-style: italic; color: var(--ink2); margin: 4px 0 30px; font-size: 20px; }
.case-name { font-size: 15px; text-transform: uppercase; letter-spacing: 2px; color: var(--accent); }
.hint { color: var(--ink2); font-size: 14px; }

/* folder / paper */
.folder { max-width: 820px; margin: 40px auto; position: relative; }
.folder-tab { display: inline-block; background: #d9c39a; padding: 6px 22px; border-radius: 8px 8px 0 0; font: bold 14px 'Courier New', monospace; letter-spacing: 3px; }
.paper { background: var(--paper2); border: 1px solid var(--line); padding: 34px 44px; box-shadow: 0 6px 24px rgba(60, 40, 20, 0.12); position: relative; }
.paper.wide { max-width: 980px; margin: 30px auto; }
.paper h2 { margin: 0 0 4px; font-size: 30px; font-weight: normal; }
.paper h3 { margin: 24px 0 8px; font-size: 18px; color: var(--accent); }
.meta { color: var(--ink2); font-style: italic; margin: 0 0 18px; }
#briefText p { font-size: 18px; margin: 0 0 12px; }
#howTo li { margin-bottom: 6px; }
.stamp { position: absolute; right: 36px; top: 26px; border: 3px solid var(--danger); color: var(--danger); font: bold 20px 'Courier New', monospace; padding: 2px 12px; transform: rotate(8deg); opacity: 0.7; letter-spacing: 3px; }
.stamp.big { font-size: 30px; }
.row { display: flex; gap: 12px; justify-content: space-between; margin-top: 26px; }

/* room */
.topbar { display: flex; align-items: center; gap: 16px; padding: 8px 18px; border-bottom: 1px solid var(--line); background: var(--paper2); }
.brand { letter-spacing: 3px; font-size: 15px; }
.brand span { letter-spacing: 0; color: var(--ink2); font-style: italic; margin-left: 10px; }
.clockText { margin-left: auto; font: bold 16px 'Courier New', monospace; color: var(--ink2); }
.topbtns { display: flex; gap: 8px; }
.room-grid { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; padding: 14px 18px; max-width: 1400px; margin: 0 auto; }
.stage { position: relative; height: min(64vh, 600px); min-height: 440px; border-radius: 10px; overflow: hidden; background: #c9b9a2; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08), 0 8px 30px rgba(60, 40, 20, 0.18); }
.stage.small { height: 58vh; }
.room, .room-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.faces { position: absolute; left: 50%; bottom: 8%; height: 88%; aspect-ratio: 4 / 5; transform: translateX(-50%); }
.faces .face-svg { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 0.35s; }
.faces .face-svg.off { opacity: 0; pointer-events: none; }
.table { position: absolute; left: 0; right: 0; bottom: 0; height: 15%; }
.table-svg { width: 100%; height: 100%; display: block; }
.plate { position: absolute; left: 16px; top: 14px; background: rgba(251, 248, 242, 0.92); border: 1px solid var(--line); padding: 6px 12px; border-radius: 6px; font-size: 15px; }
.plate b { font-size: 17px; }
.stage.flash { animation: flash 0.5s; }
@keyframes flash { 10% { filter: brightness(1.35); } 20% { filter: brightness(1); } 30% { filter: brightness(1.2); } }
.rain { animation: rain 0.55s linear infinite; }
.rain2 { animation-duration: 0.8s; }
@keyframes rain { from { transform: translate(0, -40px); } to { transform: translate(-8px, 30px); } }
.flash.on { animation: wflash 0.6s; }
@keyframes wflash { 10% { opacity: 0.8; } 25% { opacity: 0.1; } 35% { opacity: 0.6; } 100% { opacity: 0; } }
.lamplight { animation: lamp 7s infinite; }
@keyframes lamp { 0%, 92%, 100% { opacity: 1; } 93% { opacity: 0.55; } 94% { opacity: 1; } 95.5% { opacity: 0.7; } 96% { opacity: 1; } }
.steam path { animation: steam 3.5s ease-in-out infinite; }
.steam path:nth-child(2) { animation-delay: 1.2s; }
@keyframes steam { 0% { opacity: 0; transform: translateY(6px); } 40% { opacity: 0.6; } 100% { opacity: 0; transform: translateY(-10px); } }
.rec { animation: rec 1.6s steps(1) infinite; }
@keyframes rec { 50% { opacity: 0.15; } }

.dialog { background: var(--paper2); border: 1px solid var(--line); border-radius: 8px; margin-top: 12px; padding: 12px 18px; min-height: 132px; }
.dialog.solo { max-width: 900px; margin: 14px auto; }
.you { color: var(--ink2); font-style: italic; min-height: 1.4em; }
.line { font-size: 19px; min-height: 2.9em; margin-top: 4px; cursor: pointer; }
.line b { color: var(--accent); font-weight: normal; letter-spacing: 1px; }
.readbar { display: none; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.readbar.on { display: flex; }
.rq { font-weight: bold; color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--accent); color: var(--accent); background: #fff; border-radius: 16px; padding: 4px 13px; cursor: pointer; font-size: 15px; }
.chip:hover { background: var(--accent); color: #fff; }

.side { display: flex; flex-direction: column; min-height: 0; }
.people { display: flex; gap: 8px; }
.pcard { flex: 1; border: 1.5px solid var(--line); background: var(--paper2); border-radius: 8px; padding: 6px; cursor: pointer; text-align: center; position: relative; }
.pcard.on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(31, 95, 91, 0.15); }
.pcard .mini { width: 100%; aspect-ratio: 4 / 5; background: #d4c5ae; border-radius: 6px; overflow: hidden; }
.pcard .mini svg { width: 100%; height: 100%; }
.pcard .nm { font-size: 14px; margin-top: 4px; }
.pcard .pat { font-size: 11px; letter-spacing: 1px; color: var(--accent); }
.pcard .pat.low { color: var(--danger); }
.pcard .dot { position: absolute; top: 4px; right: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); display: none; }
.pcard .dot.on { display: block; }
.qhead { margin: 14px 0 6px; font-size: 16px; color: var(--accent); }
.qlist { display: flex; flex-direction: column; gap: 6px; overflow-y: auto; max-height: calc(100vh - 420px); padding-right: 4px; }
.q { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 7px 11px; cursor: pointer; font-size: 15px; position: relative; }
.q:hover:not(:disabled) { border-color: var(--accent); }
.q:disabled { cursor: default; }
.q.asked { background: transparent; color: var(--ink2); font-size: 14px; }
.q.asked::before { content: '✓ '; color: var(--accent); }
.q.new::after { content: 'new'; position: absolute; right: 8px; top: 7px; font-size: 11px; background: var(--gold); color: #fff; border-radius: 8px; padding: 0 6px; }
.q.press { border-color: var(--gold); }
.q.show { border-style: dashed; }
.empty { color: var(--ink2); font-style: italic; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 30; }
.toast { background: var(--ink); color: #fff; padding: 9px 14px; border-radius: 6px; font-size: 15px; box-shadow: 0 4px 16px rgba(0,0,0,0.2); animation: tin 0.25s; max-width: 360px; }
.toast.ok { background: var(--ok); } .toast.bad { background: var(--bad); } .toast.clue { background: #6b5536; }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }

/* notebook */
.overlay { position: fixed; inset: 0; background: rgba(43, 38, 34, 0.45); display: flex; align-items: center; justify-content: center; z-index: 20; }
.overlay[hidden] { display: none; }
.nb { width: min(980px, 94vw); height: min(720px, 88vh); background: #fbf6e8; border-radius: 8px; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3); background-image: repeating-linear-gradient(transparent 0 31px, #dfe7ee 31px 32px); }
.nb-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 2px solid #e2b9b0; background: #fbf6e8; }
.tabs button { border: none; background: none; padding: 6px 12px; cursor: pointer; border-bottom: 2px solid transparent; color: var(--ink2); }
.tabs button.on { border-color: var(--accent); color: var(--ink); }
.nb-body { overflow-y: auto; padding: 14px 22px; flex: 1; }
.ev { display: flex; gap: 14px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.ev .t { font-weight: bold; min-width: 170px; }
.ev .x { flex: 1; }
.ev .btn { white-space: nowrap; align-self: flex-start; }
.st { display: grid; grid-template-columns: 90px 1fr 110px 80px; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); align-items: center; }
.st .who { font-weight: bold; color: var(--accent); }
.st .rd.ok { color: var(--ok); } .st .rd.bad { color: var(--bad); }
.liebtn { border: 1.5px solid var(--line); border-radius: 12px; padding: 2px 10px; background: #fff; cursor: pointer; font-size: 13px; }
.liebtn.on { border-color: var(--danger); background: var(--danger); color: #fff; }
.guide dt { font-weight: bold; margin-top: 10px; color: var(--accent); }
.guide dd { margin: 2px 0 0 0; }

/* accusation */
.pick-people { display: flex; gap: 14px; }
.pp { width: 150px; border: 2px solid var(--line); border-radius: 8px; padding: 6px; cursor: pointer; text-align: center; background: #fff; }
.pp.on { border-color: var(--danger); }
.pp .mini { aspect-ratio: 4 / 5; background: #d4c5ae; border-radius: 6px; overflow: hidden; }
.pp svg { width: 100%; height: 100%; }
.pick-list { display: flex; flex-direction: column; gap: 6px; }
.pick-list.scroll { max-height: 260px; overflow-y: auto; }
.opt { text-align: left; border: 1.5px solid var(--line); background: #fff; border-radius: 6px; padding: 7px 12px; cursor: pointer; }
.opt.on { border-color: var(--danger); background: #fbeeee; }
.opt .flag { color: var(--danger); font-size: 13px; }

/* result */
.ending { font-size: 18px; }
.score { display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; max-width: 560px; margin: 18px 0; font-size: 16px; }
.score .tot { font-weight: bold; border-top: 1px solid var(--ink2); padding-top: 4px; font-size: 18px; }
.review .rv { padding: 9px 0; border-bottom: 1px dashed var(--line); }
.review .rv .h { font-weight: bold; }
.review .ok { color: var(--ok); } .review .bad { color: var(--bad); } .review .skip { color: var(--ink2); }
.review .why { color: var(--ink2); font-size: 15px; }
.confront { padding: 18px; max-width: 1100px; margin: 0 auto; }
