/* 黄昏馆事件簿：半声钟下的密室 — 90s 推理 ADV */
:root {
  --ink: #0d1117;
  --ink-2: #1a1f2e;
  --paper: #f3ead8;
  --paper-2: #e8dcc4;
  --text: #1a1f2e;
  --accent: #c43c3c;
  --gold: #c9a227;
  --mute: #8b929e;
  --serif: "Noto Serif SC", "Songti SC", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  background: #05070a;
  color: var(--paper);
  font-family: var(--sans);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button, .btn, .hud-btn, .chip, .choice, .hotspot {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #121820 0%, #05070a 70%);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* 舞台：桌面 16:9；小屏铺满 */
#stage {
  position: relative;
  width: min(100vw, calc(100vh * 16 / 9));
  height: min(100vh, calc(100vw * 9 / 16));
  width: min(100%, calc(100dvh * 16 / 9));
  height: min(100dvh, calc((100vw) * 9 / 16));
  background: var(--ink);
  overflow: hidden;
  box-shadow: 0 0 80px rgba(0,0,0,.8);
  max-width: 100%;
  max-height: 100%;
}

@media (max-width: 820px), (max-height: 520px) {
  #stage {
    width: 100%;
    height: 100dvh;
    max-height: none;
    box-shadow: none;
  }
  #quest-panel {
    width: min(42%, 180px);
    top: 14%;
    padding: .55em .6em;
  }
  #quest-panel li { font-size: 11px; }
  .hud-btn {
    font-size: 12px;
    padding: .65em .7em;
    min-height: 44px;
    min-width: 44px;
  }
  #dialog {
    min-height: 28%;
    padding: 3% 3.5% 2%;
    left: 2%;
    right: 2%;
    bottom: calc(2% + env(safe-area-inset-bottom));
  }
  #dialog-text {
    font-size: 15px;
    min-height: 3.8em;
  }
  #nameplate {
    font-size: 13px;
    padding: .4em .9em;
  }
  .hotspot {
    /* 尺寸由 JS 按最近邻间距排布，这里不再用 min-* 顶破布局 */
    min-width: 0;
    min-height: 0;
  }
  .modal {
    padding: 2%;
    align-items: stretch;
  }
  .modal-panel {
    width: 100%;
    max-height: 100%;
    height: 100%;
  }
  .modal-body {
    padding: 1em;
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
  }
  .clue-grid {
    grid-template-columns: 1fr 1fr;
  }
  .closeup-card {
    width: min(92%, 360px);
  }
  #title-screen h1 {
    font-size: clamp(26px, 8vw, 40px);
    letter-spacing: .12em;
    padding: 0 12px;
    text-align: center;
  }
  #title-screen .sub {
    letter-spacing: .2em;
    margin-bottom: 1.6em;
  }
  .title-actions {
    display: flex;
    flex-direction: column;
    gap: .7em;
    width: min(80%, 280px);
  }
  .title-actions .btn {
    width: 100%;
    min-height: 48px;
    padding: .9em 1em;
  }
  .btn.ghost {
    border-color: rgba(139,146,158,.5);
    color: var(--mute);
  }
  #investigate-tip {
    top: 5.5%;
    font-size: 12px;
    width: 90%;
    text-align: center;
    letter-spacing: .12em;
  }
}

.title-actions {
  display: flex;
  flex-direction: column;
  gap: .8em;
  align-items: center;
}
.btn.ghost {
  border-color: rgba(139,146,158,.5);
  color: var(--mute);
  background: transparent;
}

.credit {
  margin-top: 1.4em;
  font-family: var(--serif);
  font-size: clamp(11px, 1.3vw, 14px);
  letter-spacing: .35em;
  color: var(--mute);
  opacity: .85;
}
#title-credit {
  cursor: default;
  user-select: none;
  transition: color .2s;
}
#title-credit:hover {
  color: var(--gold);
}
.easter-hint {
  margin-top: 1em;
  font-size: 11px;
  letter-spacing: .15em;
  color: var(--mute);
  opacity: .55;
}
#title-logo {
  cursor: default;
}

/* ---------- 背景 ---------- */
#bg-layer {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: opacity .6s ease;
}
#bg-layer.dim::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(5,7,10,.55) 0%, rgba(5,7,10,.15) 45%, rgba(5,7,10,.35) 100%);
}

/* ---------- 立绘 ---------- */
#char-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.char-sprite {
  position: absolute;
  bottom: 0;
  height: 88%;
  max-width: 42%;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.55));
  transition: opacity .35s ease, transform .35s ease;
}
.char-sprite.left { left: 6%; }
.char-sprite.center { left: 50%; transform: translateX(-50%); }
.char-sprite.right { right: 6%; }
.char-sprite.hidden { opacity: 0; transform: translateY(12px); }
.char-sprite.right.hidden { transform: translate(0, 12px); }
.char-sprite.center.hidden { transform: translate(-50%, 12px); }

/* 表情差分微演出（图本身已换脸，这里只加情绪光效） */
.char-sprite.emo-shock {
  animation: emo-shock .5s ease;
}
.char-sprite.emo-nervous {
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.55)) saturate(.92) brightness(.96);
}
.char-sprite.emo-cry,
.char-sprite.emo-sad {
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.55)) saturate(.85) brightness(.95) hue-rotate(-6deg);
}
.char-sprite.emo-press {
  filter: drop-shadow(0 8px 18px rgba(0,0,0,.65)) contrast(1.08);
}
.char-sprite.emo-cool {
  filter: drop-shadow(0 12px 24px rgba(0,0,0,.55)) contrast(1.04);
}
@keyframes emo-shock {
  0%, 100% { transform: translateX(-50%) scale(1); }
  30% { transform: translateX(-50%) scale(1.03); }
  60% { transform: translateX(calc(-50% + 4px)) scale(1.01); }
}

/* 尸体发现特写 */
#fx-body {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 10, .55);
  pointer-events: none;
}
#fx-body.hidden { display: none; }
.body-card {
  width: min(70%, 520px);
  border: 1px solid rgba(201, 162, 39, .5);
  background: rgba(13, 17, 23, .88);
  padding: 1.2em;
  text-align: center;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
}
.body-art {
  height: 180px;
  margin-bottom: .8em;
  background:
    radial-gradient(ellipse at 50% 80%, rgba(196, 60, 60, .25), transparent 55%),
    linear-gradient(180deg, #1a2230 0%, #0d1117 100%);
  border: 1px solid rgba(201, 162, 39, .25);
  position: relative;
  overflow: hidden;
}
.body-art::before {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  bottom: 28%;
  height: 36%;
  background: #2a3142;
  border-radius: 40% 40% 8% 8%;
  box-shadow: 0 18px 0 -4px #222a38;
}
.body-art::after {
  content: "";
  position: absolute;
  left: 38%;
  right: 30%;
  bottom: 24%;
  height: 10%;
  background: #f3ead8;
  opacity: .7;
}
.body-cap {
  font-family: var(--serif);
  letter-spacing: .3em;
  color: var(--gold);
  font-size: 13px;
}

/* 物证特写 */
#fx-closeup {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5, 7, 10, .78);
  z-index: 55;
}
#fx-closeup.hidden { display: none; }
.closeup-card {
  width: min(88%, 420px);
  background: var(--paper);
  color: var(--text);
  border-left: 6px solid var(--gold);
  padding: 1.4em 1.5em 1.2em;
  box-shadow: 0 20px 50px rgba(0,0,0,.55);
}
.closeup-icon {
  display: flex;
  justify-content: center;
  margin-bottom: .6em;
}
.closeup-tag {
  font-size: 11px;
  letter-spacing: .25em;
  color: var(--accent);
  text-align: center;
}
.closeup-card h3 {
  font-family: var(--serif);
  font-size: 22px;
  text-align: center;
  margin: .35em 0 .55em;
  letter-spacing: .12em;
}
.closeup-card p {
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 1em;
}
.closeup-card .btn {
  width: 100%;
  background: var(--ink-2);
}

/* ---------- 对话框 ---------- */
#dialog {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 3.5%;
  min-height: 22%;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
  color: var(--text);
  border: 2px solid #2a3142;
  border-left: 6px solid var(--gold);
  box-shadow: 0 10px 40px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.45);
  padding: 2.2% 2.5% 1.5% 2.5%;
  cursor: pointer;
  z-index: 20;
}
#dialog.hidden { display: none; }

#nameplate {
  position: absolute;
  top: -1.1em;
  left: 1.5%;
  background: var(--ink-2);
  color: var(--paper);
  border: 1px solid var(--gold);
  padding: .35em 1.1em;
  font-family: var(--serif);
  font-size: clamp(12px, 1.5vw, 18px);
  letter-spacing: .12em;
  min-width: 5em;
  text-align: center;
}
#nameplate.empty { visibility: hidden; }

#dialog-text {
  font-size: clamp(13px, 1.55vw, 18px);
  line-height: 1.75;
  min-height: 4.2em;
  white-space: pre-wrap;
}

#dialog-next {
  position: absolute;
  right: 1.2%;
  bottom: 8%;
  color: var(--gold);
  font-size: clamp(11px, 1.2vw, 14px);
  letter-spacing: .15em;
  animation: bounce 1.2s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); opacity: .55; }
  50% { transform: translateY(4px); opacity: 1; }
}

#dialog.meta-hint {
  border-left-color: var(--mute);
}
#dialog.meta-clue {
  border-left-color: var(--gold);
  background: linear-gradient(180deg, #f7f0df 0%, #efe2c4 100%);
}
#dialog.meta-fail {
  border-left-color: var(--accent);
}
#dialog.meta-unlocked {
  border-left-color: var(--gold);
}

/* ---------- 标题屏 ---------- */
#title-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(to top, rgba(5,7,10,.85) 0%, rgba(5,7,10,.25) 45%, rgba(5,7,10,.55) 100%),
    url("../assets/bg-mansion.png") center/cover no-repeat;
}
#title-screen.hidden { display: none; }

#title-screen h1 {
  font-family: var(--serif);
  font-size: clamp(28px, 5.5vw, 64px);
  font-weight: 700;
  letter-spacing: .18em;
  text-shadow: 0 4px 24px rgba(0,0,0,.8), 0 0 40px rgba(196,60,60,.25);
  margin-bottom: .35em;
}
#title-screen .sub {
  font-family: var(--serif);
  font-size: clamp(12px, 1.8vw, 20px);
  letter-spacing: .35em;
  color: var(--gold);
  margin-bottom: 2.5em;
}
#title-screen .tag {
  color: var(--mute);
  font-size: clamp(11px, 1.2vw, 14px);
  letter-spacing: .2em;
  margin-top: 1.2em;
}

.btn {
  appearance: none;
  border: 1px solid var(--gold);
  background: rgba(13,17,23,.75);
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(13px, 1.5vw, 18px);
  letter-spacing: .25em;
  padding: .85em 2.5em;
  cursor: pointer;
  transition: background .2s, color .2s, box-shadow .2s;
}
.btn:hover {
  background: var(--gold);
  color: var(--ink);
  box-shadow: 0 0 24px rgba(201,162,39,.35);
}
.btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}
.btn:disabled:hover {
  background: rgba(13,17,23,.75);
  color: var(--paper);
  box-shadow: none;
}
.btn.danger {
  border-color: var(--accent);
}
.btn.danger:hover {
  background: var(--accent);
  color: var(--paper);
}

/* ---------- 调查 HUD ---------- */
#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 15;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 1.2% 1.5%;
  pointer-events: none;
}
#hud.hidden { display: none; }

#hud-left, #hud-right {
  display: flex;
  gap: .5em;
  pointer-events: auto;
}

.hud-btn {
  appearance: none;
  border: 1px solid rgba(201,162,39,.55);
  background: rgba(13,17,23,.72);
  color: var(--paper);
  font-family: var(--sans);
  font-size: clamp(11px, 1.2vw, 14px);
  letter-spacing: .12em;
  padding: .55em 1em;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.hud-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.hud-btn .badge {
  display: inline-block;
  min-width: 1.4em;
  margin-left: .35em;
  padding: 0 .3em;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  font-size: .85em;
}
.hud-btn.alert {
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(196,60,60,.45);
  animation: pulse 1.4s ease-in-out infinite;
}
/* 次要功能收进 ⋯ 菜单，主界面只留调查动作 */
#hud-more {
  position: relative;
  display: flex;
}
.hud-more-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  display: none;
  flex-direction: column;
  gap: 4px;
  min-width: 108px;
  padding: 6px;
  background: rgba(10, 14, 20, .94);
  border: 1px solid rgba(201,162,39,.45);
  box-shadow: 0 10px 30px rgba(0,0,0,.6);
  z-index: 30;
}
#hud-more.open .hud-more-list {
  display: flex;
}
.hud-more-list .hud-btn {
  text-align: left;
  white-space: nowrap;
  letter-spacing: .08em;
  font-size: clamp(11px, 1.1vw, 13px);
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(196,60,60,.3); }
  50% { box-shadow: 0 0 18px rgba(196,60,60,.7); }
}

/* ---------- 热点 ---------- */
#hotspot-layer {
  position: absolute;
  inset: 0;
  z-index: 10;
}
#hotspot-layer.hidden { display: none; }

.hotspot {
  position: absolute;
  border: 1px solid rgba(255, 218, 112, .72);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  background: radial-gradient(circle, rgba(255, 210, 100, .18) 0%, rgba(255, 200, 60, .035) 58%, transparent 74%);
  box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 0 12px rgba(255, 195, 65, .28);
  animation: hs-pulse 2.4s ease-in-out infinite;
  z-index: 2;
}
.hotspot::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 1em;
  letter-spacing: .12em;
  color: #ffe6a0;
  background: rgba(8, 10, 14, .72);
  border: 1px solid rgba(255, 210, 80, .45);
  padding: .25em .55em;
  text-shadow: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.hotspot:hover,
.hotspot:focus-visible {
  background: radial-gradient(circle, rgba(255, 220, 90, .55) 0%, rgba(255, 200, 60, .15) 55%, transparent 72%);
  border-color: var(--paper);
  outline: none;
}
/* 标签避让：挤压时改到圆上方 */
.hotspot[data-lbl="above"]::after {
  top: auto;
  bottom: calc(100% + 6px);
}
.hotspot:hover::after,
.hotspot:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(2px);
}
.hotspot[data-lbl="above"]:hover::after,
.hotspot[data-lbl="above"]:focus-visible::after {
  transform: translateX(-50%) translateY(-2px);
}
/* 已调查：用角标而不是常驻文字（常驻标签会互相压字） */
.hotspot.found::before {
  content: "✓";
  position: absolute;
  right: -4px;
  top: -4px;
  width: 1.5em;
  height: 1.5em;
  line-height: 1.5em;
  font-size: 1em;
  text-align: center;
  border-radius: 50%;
  color: #0d1117;
  background: #ffd85a;
  box-shadow: 0 0 8px rgba(255, 200, 60, .5);
}
.hotspot.found {
  animation: none;
  opacity: .38;
  border-style: dashed;
}
@keyframes hs-pulse {
  0%, 100% { box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 0 7px rgba(255, 190, 50, .2); }
  50% { box-shadow: 0 0 0 1px rgba(0,0,0,.28), 0 0 17px rgba(255, 210, 80, .48); }
}
@media (hover: none), (pointer: coarse) {
  .hotspot:not(.found)::after { opacity: .82; }
}

/* 目标面板：可点开的药丸，点一条直接跳到对应面板 */
#quest-panel {
  position: absolute;
  right: 1.2%;
  top: 12%;
  z-index: 16;
  width: min(30%, 260px);
  background: rgba(10, 14, 20, .82);
  border: 1px solid rgba(201, 162, 39, .4);
  padding: .8em .9em;
  pointer-events: auto;
}
#quest-panel.hidden { display: none; }
#quest-panel .quest-title {
  appearance: none;
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  font-family: var(--serif);
  letter-spacing: .25em;
  color: var(--gold);
  font-size: clamp(11px, 1.2vw, 14px);
  margin-bottom: .55em;
}
#quest-panel ul {
  list-style: none;
}
#quest-panel li {
  font-size: clamp(11px, 1.15vw, 13px);
  line-height: 1.55;
  color: var(--paper);
  margin-bottom: .35em;
  opacity: .92;
  cursor: pointer;
  border-left: 2px solid transparent;
  padding-left: .45em;
}
#quest-panel li:hover,
#quest-panel li:focus-visible {
  outline: none;
  color: var(--gold);
  border-left-color: var(--gold);
  background: rgba(201, 162, 39, .1);
}
#quest-panel li.done {
  color: var(--mute);
  text-decoration: line-through;
  opacity: .55;
}

#investigate-tip {
  position: absolute;
  top: 4.5%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 12;
  font-family: var(--serif);
  letter-spacing: .25em;
  font-size: clamp(11px, 1.3vw, 15px);
  color: var(--gold);
  text-shadow: 0 2px 8px #000;
  pointer-events: none;
}
#investigate-tip.hidden { display: none; }

/* ---------- 模态：线索板 / 证词 / 指认 / 询问 ---------- */
#modal {
  position: absolute;
  inset: 0;
  z-index: 40;
  background: rgba(5,7,10,.82);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3%;
}
#modal.hidden { display: none; }

.modal-panel {
  width: min(92%, 920px);
  max-height: 90%;
  background: linear-gradient(180deg, #1a1f2e 0%, #121820 100%);
  border: 1px solid rgba(201,162,39,.45);
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1em 1.4em;
  border-bottom: 1px solid rgba(201,162,39,.25);
}
.modal-head h2 {
  font-family: var(--serif);
  font-size: clamp(16px, 2vw, 22px);
  letter-spacing: .3em;
  color: var(--gold);
}
.modal-close {
  appearance: none;
  border: 1px solid rgba(139,146,158,.5);
  background: transparent;
  color: var(--mute);
  width: 2em;
  height: 2em;
  cursor: pointer;
  font-size: 1em;
}
.modal-close:hover { color: var(--paper); border-color: var(--paper); }

.modal-body {
  padding: 1.2em 1.4em 1.5em;
  overflow: auto;
}
/* 内容超出可视区时，底部提示下面还有东西 */
#modal.scrollable .modal-panel {
  position: relative;
}
#modal.scrollable .modal-panel::after {
  content: "▾ 下滚";
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  padding: .3em .9em;
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--gold);
  background: rgba(10, 14, 20, .88);
  border: 1px solid rgba(201,162,39,.4);
  border-radius: 999px;
  pointer-events: none;
  animation: fade-nudge 1.8s ease-in-out infinite;
}
@keyframes fade-nudge {
  0%, 100% { opacity: .55; transform: translateX(-50%) translateY(0); }
  50% { opacity: 1; transform: translateX(-50%) translateY(3px); }
}

/* 线索卡 */
.clue-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .9em;
}
.clue-card {
  background: var(--paper);
  color: var(--text);
  border-left: 4px solid var(--gold);
  padding: .9em 1em;
  min-height: 7.5em;
  box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.clue-card.locked {
  background: #2a3142;
  color: var(--mute);
  border-left-color: var(--mute);
  border: 1px dashed var(--mute);
}
.clue-card .tag {
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--accent);
  margin-bottom: .35em;
}
.clue-card.locked .tag { color: var(--mute); }
.clue-card h3 {
  font-family: var(--serif);
  font-size: 15px;
  margin-bottom: .4em;
  letter-spacing: .08em;
}
.clue-card p {
  font-size: 12px;
  line-height: 1.65;
  opacity: .9;
}

.section-label {
  font-family: var(--serif);
  letter-spacing: .25em;
  color: var(--gold);
  font-size: 13px;
  margin: 1.2em 0 .7em;
}
.section-label:first-child { margin-top: 0; }

/* 证词列表 */
.testi-item {
  border: 1px solid rgba(201,162,39,.25);
  background: rgba(243,234,216,.06);
  padding: 1em 1.1em;
  margin-bottom: .7em;
}
.testi-item h3 {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 15px;
  letter-spacing: .15em;
  margin-bottom: .45em;
}
.testi-item p {
  font-size: 13px;
  line-height: 1.7;
  color: var(--paper);
  opacity: .9;
}
.testi-item .row {
  margin-top: .7em;
  display: flex;
  gap: .5em;
  flex-wrap: wrap;
}

/* 指认 */
.accuse-block { margin-bottom: 1.4em; }
.accuse-block h3 {
  font-family: var(--serif);
  letter-spacing: .25em;
  color: var(--gold);
  font-size: 14px;
  margin-bottom: .7em;
}
.choice-list { display: flex; flex-direction: column; gap: .55em; }
.deduce-topics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .55em;
  margin-bottom: 1.2em;
}
.choice {
  appearance: none;
  text-align: left;
  border: 1px solid rgba(139,146,158,.4);
  background: rgba(243,234,216,.05);
  color: var(--paper);
  padding: .85em 1em;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: .04em;
}
.choice:hover { border-color: var(--gold); }
.choice.selected {
  border-color: var(--accent);
  background: rgba(196,60,60,.18);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.accuse-actions {
  display: flex;
  justify-content: flex-end;
  gap: .8em;
  margin-top: 1em;
}

/* 推理卡（已解锁） */
.deduce-card {
  border: 1px solid rgba(196,60,60,.45);
  background: linear-gradient(135deg, rgba(196,60,60,.12), rgba(201,162,39,.08));
  padding: .9em 1em;
  margin-bottom: .7em;
}
.deduce-card h3 {
  font-family: var(--serif);
  color: var(--accent);
  font-size: 15px;
  letter-spacing: .12em;
  margin-bottom: .4em;
}
.deduce-card p { font-size: 12.5px; line-height: 1.65; }
.deduce-chain {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .35em;
  margin: .55em 0;
}
.deduce-chain .dn {
  border: 1px solid rgba(201, 162, 39, .55);
  color: var(--gold);
  font-size: 11px;
  padding: .25em .5em;
}
.deduce-chain .dn.out {
  border-color: var(--accent);
  color: var(--accent);
}
.deduce-chain .dl {
  display: inline-block;
  width: 1.4em;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(196, 60, 60, .6);
}

.deduce-card.locked {
  border: 1px dashed var(--mute);
  background: transparent;
}
.deduce-card.locked h3 { color: var(--mute); }
.deduce-card.locked p { color: var(--mute); }

/* 询问选择 */
.interview-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .8em;
}

/* 材料 chip / 观察卡 */
.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: .45em;
  margin-bottom: .4em;
}
.chip {
  appearance: none;
  border: 1px solid rgba(201, 162, 39, .45);
  background: rgba(243, 234, 216, .06);
  color: var(--paper);
  font-size: 12px;
  padding: .45em .75em;
  cursor: pointer;
  letter-spacing: .04em;
}
.chip:hover { border-color: var(--gold); color: var(--gold); }
.chip.selected {
  border-color: var(--accent);
  background: rgba(196, 60, 60, .2);
  color: #fff;
}
.obs-card {
  background: var(--paper);
  color: var(--text);
  border-left: 4px solid var(--gold);
  padding: .75em .9em;
  min-height: 5.5em;
}
.obs-card.locked {
  background: #2a3142;
  color: var(--mute);
  border: 1px dashed var(--mute);
  min-height: 3.5em;
}
.obs-card .tag {
  font-size: 10px;
  letter-spacing: .15em;
  color: var(--accent);
  margin-bottom: .3em;
}
.obs-card.locked .tag { color: var(--mute); }
.obs-card h3 {
  font-family: var(--serif);
  font-size: 14px;
  margin-bottom: .35em;
}
.obs-card p {
  font-size: 12px;
  line-height: 1.6;
}
.fail-box {
  background: rgba(196, 60, 60, .12);
  border: 1px solid rgba(196, 60, 60, .45);
  color: var(--paper);
  padding: 1em 1.1em;
  line-height: 1.7;
  font-size: 13px;
  margin-bottom: 1em;
}
.rebuttal {
  border-left: 3px solid var(--gold);
  background: rgba(243, 234, 216, .06);
  padding: .8em 1em;
  margin-bottom: 1em;
  font-size: 13px;
  line-height: 1.65;
}
.foot-note {
  color: var(--mute);
  font-size: 12px;
  line-height: 1.7;
  margin-top: .6em;
}
.step-mark {
  color: var(--mute);
  font-size: 12px;
  letter-spacing: .15em;
  margin-right: auto;
  align-self: center;
}
.choice.selected {
  border-color: var(--accent) !important;
  background: rgba(196, 60, 60, .18) !important;
}

/* ---------- 演出特效 ---------- */
#fx-layer {
  position: absolute;
  inset: 0;
  z-index: 60;
  pointer-events: none;
}
#fx-layer.hidden { display: none; }

#fx-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
}
#fx-flash.on {
  animation: flash .45s ease-out;
}
@keyframes flash {
  0% { opacity: 0; }
  15% { opacity: 1; }
  100% { opacity: 0; }
}

#fx-shake {
  position: absolute;
  inset: 0;
}
#fx-shake.on #stage-inner {
  animation: shake .4s linear;
}
/* shake applied on stage via JS class */
#stage.shake {
  animation: shake .45s linear;
}
@keyframes shake {
  0%, 100% { transform: translate(0,0); }
  20% { transform: translate(-8px, 3px); }
  40% { transform: translate(7px, -3px); }
  60% { transform: translate(-5px, 2px); }
  80% { transform: translate(4px, -1px); }
}

#fx-speedlines {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent 0 10px,
      rgba(255,255,255,.045) 10px 11px
    );
}
#fx-speedlines.on {
  opacity: 1;
  animation: speed-in .5s ease-out;
  background:
    repeating-linear-gradient(
      -18deg,
      transparent 0 8px,
      rgba(255,255,255,.14) 8px 9px
    ),
    radial-gradient(ellipse at 30% 45%, transparent 30%, rgba(0,0,0,.35) 100%);
}
@keyframes speed-in {
  from { opacity: 0; transform: scale(1.08); }
  to { opacity: 1; transform: scale(1); }
}

#fx-title {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,7,10,.72);
  opacity: 0;
}
#fx-title.on {
  animation: title-in 2.2s ease forwards;
}
#fx-title span {
  font-family: var(--serif);
  font-size: clamp(36px, 7vw, 84px);
  font-weight: 700;
  letter-spacing: .35em;
  writing-mode: vertical-rl;
  color: var(--paper);
  text-shadow: 0 0 30px rgba(196,60,60,.6), 0 4px 0 var(--accent);
}
@keyframes title-in {
  0% { opacity: 0; }
  15% { opacity: 1; }
  80% { opacity: 1; }
  100% { opacity: 0; }
}

#fx-fade {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  transition: opacity .6s ease;
}
#fx-fade.on { opacity: 1; }

/* 矛盾字卡 */
#fx-batsu {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
#fx-batsu.on {
  animation: batsu 1.6s ease forwards;
}
#fx-batsu span {
  font-family: var(--serif);
  font-size: clamp(48px, 10vw, 120px);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: .15em;
  text-shadow: 4px 4px 0 #000, -2px -2px 0 var(--paper);
  border: 6px solid var(--accent);
  padding: .1em .3em;
  transform: rotate(-6deg);
  background: rgba(243,234,216,.92);
}
@keyframes batsu {
  0% { opacity: 0; transform: scale(1.6); }
  20% { opacity: 1; transform: scale(1); }
  80% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(.95); }
}

/* 结案屏 */
#clear-screen {
  position: absolute;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(to top, rgba(5,7,10,.92) 0%, rgba(5,7,10,.55) 50%, rgba(5,7,10,.85) 100%),
    url("../assets/bg-mansion.png") center/cover no-repeat;
  text-align: center;
}
#clear-screen.hidden { display: none; }
#clear-screen h2 {
  font-family: var(--serif);
  font-size: clamp(24px, 4vw, 42px);
  letter-spacing: .35em;
  color: var(--gold);
  margin-bottom: .5em;
}
#clear-screen p {
  color: var(--mute);
  letter-spacing: .2em;
  margin-bottom: 1.2em;
  font-size: clamp(12px, 1.4vw, 15px);
}
#clear-report {
  width: min(86%, 720px);
  margin: .4em auto 1.4em;
  text-align: left;
}
#clear-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: 1px solid rgba(201, 162, 39, .42);
  border-bottom: 1px solid rgba(201, 162, 39, .42);
}
#clear-stats > div {
  padding: .7em .8em;
  text-align: center;
  border-right: 1px solid rgba(201, 162, 39, .22);
}
#clear-stats > div:last-child { border-right: 0; }
#clear-stats strong {
  display: block;
  color: var(--paper);
  font-family: var(--serif);
  font-size: clamp(18px, 2.3vw, 28px);
  letter-spacing: .05em;
}
#clear-stats span {
  display: block;
  margin-top: .25em;
  color: var(--mute);
  font-size: 11px;
  letter-spacing: .12em;
}
#clear-recap {
  margin-top: 1em;
}
#clear-recap h3 {
  color: var(--gold);
  font-family: var(--serif);
  font-size: 13px;
  letter-spacing: .2em;
  margin-bottom: .55em;
}
#clear-recap ol {
  list-style-position: inside;
  color: var(--paper);
}
#clear-recap li {
  padding: .35em 0;
  font-size: 12px;
  line-height: 1.55;
  border-bottom: 1px solid rgba(243, 234, 216, .09);
}
#clear-recap li span {
  display: inline-block;
  min-width: 7em;
  margin: 0 .65em 0 .3em;
  color: var(--gold);
}

/* 时间轴 / 物证对照 */
.tl-pool {
  display: flex;
  flex-wrap: wrap;
  gap: .45em;
  margin-bottom: 1em;
}
.tl-axis {
  display: flex;
  flex-direction: column;
  gap: .4em;
}
.tl-slot {
  appearance: none;
  text-align: left;
  border: 1px dashed rgba(201, 162, 39, .45);
  background: rgba(243, 234, 216, .04);
  color: var(--mute);
  padding: .7em .9em;
  cursor: pointer;
  font-size: 13px;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(64px, .34fr) 1fr;
  align-items: center;
  gap: .7em;
}
.tl-time {
  color: var(--gold);
  font-family: var(--mono);
  font-size: 11px;
}
.tl-event { color: inherit; }
.tl-slot.filled {
  border-style: solid;
  border-color: var(--gold);
  color: var(--paper);
}
.cmp-list {
  display: flex;
  flex-direction: column;
  gap: .7em;
}
.cmp-item {
  border: 1px solid rgba(201, 162, 39, .3);
  padding: .8em .9em;
}
.cmp-item h3 {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 14px;
  margin-bottom: .35em;
}
.cmp-item p {
  font-size: 12px;
  line-height: 1.55;
  margin-bottom: .55em;
  opacity: .9;
}
.cmp-item .row {
  display: flex;
  gap: .4em;
}

/* 对话回看 */
.backlog-list {
  max-height: 55vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.backlog-item {
  border-left: 3px solid rgba(201, 162, 39, .35);
  padding: .55em .75em;
  margin-bottom: .55em;
  background: rgba(243, 234, 216, .05);
}
.backlog-who {
  display: block;
  font-family: var(--serif);
  color: var(--gold);
  font-size: 12px;
  letter-spacing: .12em;
  margin-bottom: .25em;
}
.backlog-item p {
  font-size: 13px;
  line-height: 1.65;
  color: var(--paper);
}

/* 场景切换：与 HUD 同层但更轻，放在左下，避免和顶部提示条重叠 */
.scene-nav {
  position: absolute;
  left: 2%;
  bottom: 2.5%;
  display: flex;
  gap: .45em;
  z-index: 12;
  pointer-events: auto;
}
.scene-nav .scene-btn {
  padding: .4em .9em;
  border-radius: 999px;
  background: rgba(13,17,23,.55);
  border-color: rgba(201,162,39,.35);
  color: var(--mute);
  font-size: clamp(11px, 1.05vw, 13px);
  animation: none;
  box-shadow: none;
}
.scene-nav .scene-btn:hover {
  color: var(--paper);
  border-color: rgba(201,162,39,.6);
}
.scene-nav .hud-btn.alert {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(13,17,23,.8);
}

#hint-box {
  position: absolute;
  left: 3%;
  top: 22%;
  width: min(42%, 280px);
  z-index: 17;
  background: rgba(10, 14, 20, .9);
  border: 1px solid rgba(201, 162, 39, .45);
  padding: .7em .8em;
  pointer-events: none;
}
#hint-box.hidden { display: none; }
#hint-box .hint-head {
  font-family: var(--serif);
  color: var(--gold);
  font-size: 12px;
  letter-spacing: .12em;
  margin-bottom: .45em;
}
#hint-box .hint-line {
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: .35em;
}
#hint-box .hint-tag {
  color: var(--accent);
  margin-right: .35em;
}
#hint-box .hint-foot {
  margin-top: .5em;
  color: var(--mute);
  font-size: 11px;
}
#btn-hint.idle {
  animation: pulse 1.4s ease-in-out infinite;
  border-color: var(--gold);
}
@media (max-width: 820px), (max-height: 520px) {
  #hud {
    flex-wrap: wrap;
    gap: .35em;
    padding: 2% 2%;
  }
  #hud-left, #hud-right {
    flex-wrap: wrap;
    gap: .3em;
    max-width: 48%;
  }
  .hud-btn {
    font-size: 11px;
    padding: .5em .55em;
    min-height: 38px;
    min-width: 38px;
  }
  #hint-box {
    width: min(48%, 200px);
    top: 20%;
    font-size: 11px;
  }
  #quest-panel {
    top: 18%;
  }
}
#hint-box .hint-cost {
  color: #d9b46d;
  font-size: 10px;
  margin: .25em 0 .5em;
}
@media (max-width: 820px) {
  #hud {
    flex-direction: column;
    flex-wrap: nowrap;
    gap: 4px;
    padding: calc(6px + env(safe-area-inset-top)) 6px 0;
  }
  #hud-left, #hud-right {
    width: 100%;
    max-width: none;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 4px;
  }
  #hud-left { width: min(62%, 250px); }
  #hud-right { justify-content: stretch; }
  #hud-right > .hud-btn {
    flex: 1 1 0;
  }
  #hud-more {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
  }
  #btn-more {
    width: 44px;
    min-width: 44px;
  }
  .hud-btn {
    min-width: 0;
    min-height: 44px;
    padding: .45em .25em;
    font-size: 10px;
    letter-spacing: .04em;
    white-space: nowrap;
  }
  .hud-btn .badge {
    min-width: 1.3em;
    margin-left: .15em;
    padding: 0 .2em;
  }
  .scene-nav {
    left: 8px;
    top: auto;
    bottom: calc(2% + env(safe-area-inset-bottom));
    transform: none;
    gap: 4px;
  }
  .scene-nav .hud-btn {
    min-width: 46px;
  }
  #investigate-tip {
    top: calc(96px + env(safe-area-inset-top));
    left: auto;
    right: 8px;
    width: 58%;
    transform: none;
    text-align: right;
    font-size: 10px;
    letter-spacing: .08em;
  }
  #quest-panel {
    top: calc(136px + env(safe-area-inset-top));
    right: 8px;
    width: min(43%, 180px);
    max-height: 34%;
    padding: .55em .6em;
    overflow: hidden;
  }
  /* 窄屏默认只留头两条，点标题展开——不再用 display:none 把目标藏死 */
  #quest-panel:not(.expanded) li:nth-child(n+3) { display: none; }
  #quest-panel.expanded { overflow-y: auto; }
  #quest-panel li { padding: .3em .45em; margin-bottom: 2px; }
  #hint-box {
    left: 8px;
    top: calc(136px + env(safe-area-inset-top));
    width: min(53%, 220px);
    padding: .55em .6em;
  }
  #clear-screen {
    justify-content: flex-start;
    padding: calc(8vh + env(safe-area-inset-top)) 0 calc(3vh + env(safe-area-inset-bottom));
    overflow-y: auto;
  }
  #clear-stats {
    grid-template-columns: 1fr 1fr;
  }
  #clear-stats > div:nth-child(2) { border-right: 0; }
  #clear-stats > div:nth-child(-n+2) { border-bottom: 1px solid rgba(201, 162, 39, .22); }
  #clear-recap li span {
    display: block;
    margin: 0 0 .15em;
  }
}
/* Toast */
#toast {
  position: absolute;
  left: 50%;
  bottom: 28%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(13, 17, 23, .9);
  border: 1px solid var(--gold);
  color: var(--paper);
  padding: .6em 1.2em;
  font-size: 13px;
  letter-spacing: .12em;
  z-index: 80;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
}
#toast.on {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 章节字卡 */
#chapter-card {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(5,7,10,.88);
}
#chapter-card.hidden { display: none; }
#chapter-card .inner {
  text-align: center;
}
#chapter-card .en {
  letter-spacing: .5em;
  color: var(--mute);
  font-size: 11px;
  margin-bottom: 1em;
}
#chapter-card h2 {
  font-family: var(--serif);
  font-size: clamp(28px, 5vw, 52px);
  letter-spacing: .3em;
  color: var(--paper);
}
#chapter-card .line {
  width: 8em;
  height: 1px;
  background: var(--gold);
  margin: 1.2em auto;
}
