:root {
  --bg: #0e1116;
  --panel: #171b22;
  --ink: #e8e4dc;
  --muted: #8b929e;
  --accent: #d4a017;
  --line: #2a313c;
  --user: #243044;
  --suspect: #2a241c;
  --sys: #1a1f28;
  --ok: #6a9b6a;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-classic: "Songti SC", "STSong", "SimSun", "FangSong", "STFangsong",
    "Noto Serif CJK SC", "Source Han Serif SC", "Times New Roman", serif;
  --font-title: "Kaiti SC", "STKaiti", "KaiTi", "Songti SC", "STSong", serif;
}
* { box-sizing: border-box; }
html, body {
  height: 100%;
}
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: radial-gradient(900px 500px at 10% -10%, #1a2230, var(--bg));
  overflow: hidden;
}
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0.75rem 1.1rem 0.9rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex: 0 0 auto;
}
h1 { margin: 0 0 0.15rem; font-size: 1.4rem; letter-spacing: 0.05em; }
h3 { margin: 0.9rem 0 0.4rem; font-size: 0.85rem; color: var(--accent); font-weight: 600; }
.muted { color: var(--muted); font-size: 0.88rem; }
.small { font-size: 0.78rem; line-height: 1.35; }
.stat { color: var(--accent); font-weight: 700; }

button, select, textarea {
  font: inherit; color: var(--ink);
  background: #222833; border: 1px solid var(--line);
  border-radius: 6px; padding: 0.45rem 0.65rem;
}
button { cursor: pointer; }
button.primary { background: #3a3218; border-color: #6a5520; color: #f5e6b8; }
button.ghost { background: transparent; border-color: #5a4a28; color: #c4b48a; }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.9rem;
  margin-top: 0.75rem;
}
.row { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: center; }
.chip {
  display: inline-block; border: 1px solid var(--line);
  border-radius: 999px; padding: 0.15rem 0.5rem;
  font-size: 0.78rem; color: var(--muted);
}
.chip.on { border-color: var(--accent); color: var(--accent); }

#lobby { flex: 0 0 auto; }
#game {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  max-height: 100%;
  margin-top: 0.55rem;
  overflow: hidden;
}
.layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0.75rem;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  max-height: 100%;
  overflow: hidden;
  align-items: stretch;
}
@media (max-width: 860px) {
  body { overflow: auto; }
  .wrap { height: auto; min-height: 100%; overflow: visible; }
  #game { overflow: visible; max-height: none; }
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(420px, 70vh);
    height: auto;
    max-height: none;
    overflow: visible;
  }
}

.side {
  margin-top: 0 !important;
  overflow-x: hidden;
  overflow-y: auto;
  min-height: 0;
  max-height: 100%;
  height: auto;
  align-self: stretch;
}
.suspects { display: flex; flex-direction: column; gap: 0.35rem; }
.suspects button {
  position: relative;
  text-align: left;
  background: #1c222c;
}
.suspects button.active {
  border-color: var(--accent);
  background: #2a2418;
  color: #f5e6b8;
}
.suspects button.ally {
  border-color: #3a4a3a;
  background: #1a221c;
}
.suspects button.ally.active {
  border-color: #6a9b6a;
  background: #243028;
  color: #d8e8d0;
}
.suspects button.ally.mentor {
  border-color: #5a4a28;
  background: #221c12;
}
.suspects button.ally.mentor.active {
  border-color: #c4a060;
  background: #2a2418;
  color: #f0e0b8;
}
.bubble.assistant {
  align-self: flex-start;
  background: #1c2820;
  border: 1px solid #3a5540;
}
.actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.actions button { font-size: 0.8rem; }
.loc-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.55rem 0.28rem 0.28rem;
  font-size: 0.8rem;
}
.loc-btn.searched { opacity: 0.88; }
.has-dot::after {
  content: "";
  position: absolute;
  top: 5px;
  right: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e24a4a;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.loc-btn.has-dot::after {
  top: 4px;
  right: 4px;
}
.ev-list button.has-dot::after {
  top: 6px;
  right: 6px;
}
.list-ico {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  object-fit: cover;
  background: #0a0e14;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.list-ico.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  color: #8a8070;
  font-family: var(--font-title);
  letter-spacing: 0.04em;
}
.ev-list { display: flex; flex-direction: column; gap: 0.3rem; }
.ev-list button,
.ev-list .ev-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-align: left;
  font-size: 0.82rem;
  background: #1c222c;
  padding: 0.35rem 0.55rem 0.35rem 0.35rem;
}
.ev-list .list-ico {
  width: 40px;
  height: 40px;
}
.ev-btn-text { flex: 1; min-width: 0; line-height: 1.3; }
.ev-list button.unread {
  border-color: rgba(212, 168, 72, 0.55);
  color: #e8d5a0;
}
.ev-list button.active {
  border-color: var(--accent);
  color: #f5e6b8;
  background: #2a2418;
}
.ev-card {
  width: min(440px, 100%);
}
.ev-thumb-wrap {
  margin: 0.65rem 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #0a0e14;
  max-width: 220px;
}
.ev-thumb {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  background: #0a0e14;
}
.ev-desc {
  margin: 0.55rem 0 0;
  line-height: 1.55;
  font-size: 0.95rem;
  color: var(--ink);
  white-space: pre-wrap;
}
#evGetModal {
  z-index: 70;
}
.ev-get-card {
  width: min(360px, 100%);
  text-align: center;
  padding: 1.15rem 1.2rem 1rem;
  animation: evGetIn 0.38s ease-out;
}
@keyframes evGetIn {
  from {
    opacity: 0;
    transform: scale(0.88) translateY(14px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}
.ev-get-label {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  color: #c4a35a;
  text-transform: none;
}
.ev-get-thumb-wrap {
  margin: 0.85rem auto 0;
  width: min(200px, 70%);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #0a0e14;
  animation: evGetThumb 0.48s ease-out 0.06s both;
}
@keyframes evGetThumb {
  from {
    opacity: 0;
    transform: scale(0.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}
.ev-get-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: #0a0e14;
}
.ev-get-thumb-wrap.empty {
  display: none;
}
.ev-get-title {
  margin: 0.75rem 0 0;
  font-size: 1.2rem;
  color: #f5e6b8;
  font-family: var(--font-title);
}
.ev-get-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}
.ev-get-actions button {
  flex: 1;
}
.ev-get-hint {
  margin: 0.55rem 0 0;
}
.lead-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 160px;
  overflow: auto;
}
.lead-list li {
  padding: 0.4rem 0.5rem;
  background: #1c222c;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.35;
  cursor: pointer;
}
.lead-list li:hover { border-color: #5a4a28; }
.lead-list .lead-title { color: #c4b48a; font-weight: 600; }
.small-btn {
  margin-top: 0.35rem;
  width: 100%;
  font-size: 0.8rem;
  padding: 0.35rem 0.5rem;
}
.clues-modal-list {
  max-height: min(60vh, 420px);
  overflow: auto;
}
.lead-list li.done { border-color: #3d5a45; }
.lead-list li.done .lead-title { color: #8fbc8f; }
.progress-bar {
  height: 6px;
  background: #1c222c;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin: 0.25rem 0 0.4rem;
  overflow: hidden;
}
.progress-bar .progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #8a6a32, #c4a35a);
  transition: width 0.25s ease;
}
.progress-bar.side .progress-fill {
  background: linear-gradient(90deg, #3d5a6a, #6a9aaa);
}
.progress-details { margin: 0.25rem 0 0.5rem; }
.progress-details summary { cursor: pointer; }
.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}
.score-row strong { color: var(--accent); }
#endingLabel.perfect { color: #8fbc8f; }
#endingLabel.bad { color: #c47a7a; }
#btnCourt:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.lead-toast {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(6, 8, 12, 0.55);
}
.lead-toast.hidden { display: none; }
.lead-toast-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.lead-toast-title {
  margin: 0.35rem 0 0.45rem;
  font-size: 1.05rem;
  color: #f5e6b8;
}
.lead-toast-card button { margin-top: 0.75rem; width: 100%; }
.notes { margin: 0; padding: 0; list-style: none; font-size: 0.85rem; }
.notes li { margin: 0.45rem 0; line-height: 1.45; }
.rec-list { min-height: 280px; }
.rec-item {
  padding: 0.55rem 0.65rem;
  background: #1c222c;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.rec-tag {
  display: inline-block;
  min-width: 2.4em;
  margin-right: 0.35rem;
  font-size: 0.72rem;
  color: var(--accent);
  opacity: 0.9;
}
.rec-flaw .rec-tag { color: #c9785a; }
.rec-search .rec-tag { color: #8aab7a; }
.rec-evidence .rec-tag { color: #c4a35a; }
.rec-confront .rec-tag { color: #7aa0c4; }
.rec-court .rec-tag { color: #c4a35a; }
.rec-lead .rec-tag { color: #6db3c4; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(6, 8, 12, 0.72);
}
.modal-card {
  position: relative;
  z-index: 1;
  width: min(560px, 100%);
  max-height: min(78vh, 640px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem 1rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}
.modal-head h2 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}

.scene-card {
  width: min(720px, 100%);
  max-height: min(90vh, 780px);
}
.scene-tip {
  margin: 0.35rem 0 0.55rem;
  min-height: 1.2em;
  color: #c4b48a;
  font-size: 0.85rem;
}
.scene-stage {
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #0a0e14;
  user-select: none;
}
.scene-art {
  display: block;
  width: 100%;
  line-height: 0;
  pointer-events: none;
}
.scene-art svg,
.scene-art img {
  display: block;
  width: 100%;
  height: auto;
}
.scene-art .ev-taken {
  display: none !important;
}
.scene-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.hotspot {
  position: absolute;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  padding: 0;
  outline: none;
  pointer-events: auto;
}
.hotspot:hover,
.hotspot:focus-visible,
.hotspot.owned,
.hotspot.locked {
  border: none;
  background: transparent;
  box-shadow: none;
  outline: none;
  opacity: 1;
}
.hotspot.owned { cursor: default; }
.hotspot .hot-label { display: none; }
.hotspot .hot-overlay {
  position: absolute;
  left: 12%;
  top: 8%;
  width: 76%;
  height: 84%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0.92;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.45));
}

/* 勘查热区调试：青=氛围物，琥珀=证物；已取/未解锁另标 */
.scene-hotspots.debug-hotspots .hotspot-debug {
  border: 1.5px solid rgba(120, 220, 255, 0.95);
  background: rgba(80, 180, 220, 0.22);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.35);
  z-index: 2;
}
.scene-hotspots.debug-hotspots .hotspot-debug.hotspot-evidence {
  border-color: rgba(240, 180, 70, 0.98);
  background: rgba(220, 150, 40, 0.28);
  z-index: 3;
}
.scene-hotspots.debug-hotspots .hotspot-debug.photo {
  border-style: dashed;
}
.scene-hotspots.debug-hotspots .hotspot-debug.owned {
  border-style: dashed;
  opacity: 0.55;
}
.scene-hotspots.debug-hotspots .hotspot-debug.locked {
  border-style: dotted;
  background: rgba(120, 120, 120, 0.28);
}
.hotspot-edit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.55rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(20, 28, 38, 0.92);
}
.hotspot-edit-bar.hidden { display: none; }
.hotspot-edit-info {
  flex: 1;
  min-width: 0;
  font-size: 0.8rem;
  color: #c4b48a;
  font-variant-numeric: tabular-nums;
  word-break: break-all;
}
.hotspot-edit-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}
.scene-hotspots.debug-hotspots.calibrating .hotspot-debug {
  pointer-events: auto;
  cursor: move;
}
.scene-hotspots.debug-hotspots .hotspot-debug.selected {
  border-color: #fff;
  box-shadow: 0 0 0 1px #fff, inset 0 0 0 1px rgba(0, 0, 0, 0.45);
  z-index: 30;
}
.hot-handle {
  position: absolute;
  width: 11px;
  height: 11px;
  margin: 0;
  padding: 0;
  border: 1px solid #1a1a1a;
  border-radius: 1px;
  background: #f5f0e6;
  z-index: 31;
  box-sizing: border-box;
}
.hot-handle.nw { left: -6px; top: -6px; cursor: nwse-resize; }
.hot-handle.ne { right: -6px; top: -6px; cursor: nesw-resize; }
.hot-handle.sw { left: -6px; bottom: -6px; cursor: nesw-resize; }
.hot-handle.se { right: -6px; bottom: -6px; cursor: nwse-resize; }

.scene-hotspots.debug-hotspots .hotspot-debug .hot-label {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  max-width: 120%;
  padding: 1px 3px;
  font-size: 10px;
  line-height: 1.2;
  color: #fff;
  background: rgba(0, 0, 0, 0.72);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  transform: translateY(-100%);
}
.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--line);
}
.pager .pages { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.pager button.active {
  border-color: var(--accent);
  color: #f5e6b8;
  background: #2a2418;
}
.court-box { margin-top: 0.8rem; color: var(--muted); font-size: 0.85rem; }
.court-box summary { cursor: pointer; color: var(--accent); }
.court-box textarea {
  width: 100%;
  margin-top: 0.25rem;
  resize: vertical;
  min-height: 3.2rem;
  font: inherit;
  color: var(--text);
  background: #141820;
  border: 1px solid #3a4555;
  border-radius: 4px;
  padding: 0.4rem 0.5rem;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  margin-top: 0 !important;
  min-height: 0;
  max-height: 100%;
  height: 100%;
  padding: 0 !important;
  overflow: hidden;
  align-self: stretch;
}
.chat-stage {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 70% 40%, #1a222c 0%, #0e1218 55%, #0a0e14 100%);
}
.chat-scroll {
  position: relative;
  z-index: 1;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: transparent;
}
.chat-portrait {
  pointer-events: none;
  position: absolute;
  right: 0;
  bottom: 0;
  top: 0;
  width: min(48%, 340px);
  background-position: 90% 12%;
  background-repeat: no-repeat;
  background-size: auto 92%;
  opacity: 0.92;
  z-index: 0;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 22%, #000 82%, transparent 100%),
    linear-gradient(180deg, transparent 0%, #000 6%, #000 90%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 22%, #000 82%, transparent 100%),
    linear-gradient(180deg, transparent 0%, #000 6%, #000 90%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  filter: saturate(0.95) contrast(1.04);
  transition: opacity 0.28s ease, background-image 0.28s ease;
}
.chat-portrait.hidden {
  display: none;
}
.chat {
  position: relative;
  z-index: 1;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  min-height: 100%;
}
.bubble {
  max-width: 72%;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  line-height: 1.55;
  font-size: 0.98rem;
  letter-spacing: 0.03em;
  font-family: var(--font-classic);
  white-space: pre-wrap;
  backdrop-filter: blur(2px);
}
.bubble .who {
  display: block;
  font-family: var(--font-title);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}
.bubble.user {
  align-self: flex-end;
  background: rgba(28, 40, 58, 0.92);
  border: 1px solid #33415a;
}
.bubble.suspect,
.bubble.assistant {
  align-self: flex-start;
  background: rgba(42, 34, 24, 0.9);
  border: 1px solid #4a3d28;
}
.bubble.system {
  align-self: center;
  max-width: 92%;
  background: rgba(20, 24, 32, 0.88);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}
.composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  padding: 0.55rem 0.85rem 0.7rem;
  background: #12161d;
  box-shadow: 0 -8px 18px rgba(0, 0, 0, 0.25);
}
.composer-row { display: flex; gap: 0.5rem; align-items: flex-end; margin-top: 0.35rem; }
.voice-btn {
  min-width: 44px !important;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 0.4rem;
}
.voice-btn.muted { opacity: 0.55; }
.bubble.streaming .bubble-text::after {
  content: "▍";
  margin-left: 1px;
  animation: caret-blink 0.85s steps(1) infinite;
  color: var(--muted);
}
@keyframes caret-blink {
  50% { opacity: 0; }
}
.composer-row textarea {
  flex: 1;
  resize: none;
  min-height: 52px;
  background: #1c222c;
}
.composer-row button { min-width: 72px; height: 52px; }

#endbox {
  display: none;
  border-color: var(--ok);
  flex: 0 0 auto;
  margin-top: 0.6rem;
  max-height: 30vh;
  overflow: auto;
}
#endbox.show { display: block; }
.hidden { display: none !important; }
.star { color: var(--accent); font-size: 1.2rem; }

/* —— 开篇序章（立绘 + 背景 + 文字） —— */
.prologue {
  position: fixed;
  inset: 0;
  z-index: 60;
  overflow: hidden;
  background: #07090d;
  cursor: pointer;
  user-select: none;
}
.prologue-bg {
  position: absolute;
  inset: 0;
  background-color: #0a0e14;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  opacity: 1;
  transition: opacity 0.35s ease;
  filter: brightness(0.72) saturate(0.9);
}
.prologue-bg.is-fading {
  opacity: 0;
}
.prologue-portrait {
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  width: min(42vw, 320px);
  height: min(58vh, 520px);
  background-position: center top;
  background-repeat: no-repeat;
  background-size: contain;
  opacity: 0.95;
  transition: opacity 0.28s ease;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 70%, transparent 100%);
}
.prologue-portrait.hidden {
  display: none;
}
.prologue-ui {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
  z-index: 2;
}
.prologue-skip {
  pointer-events: auto;
  align-self: flex-end;
  margin: 0.85rem 1rem 0;
  z-index: 3;
}
.prologue-box {
  pointer-events: none;
  margin: 0.75rem 1rem 1.25rem;
  padding: 0.85rem 1rem 0.7rem;
  background: rgba(10, 12, 18, 0.82);
  border: 1px solid #5a4a28;
  border-radius: 4px;
  min-height: 5.5rem;
  font-family: var(--font-classic);
}
.prologue-speaker {
  font-family: var(--font-title);
  font-size: 0.95rem;
  color: var(--accent);
  letter-spacing: 0.12em;
  margin-bottom: 0.4rem;
  font-weight: 600;
}
.prologue-speaker.hidden {
  display: none;
}
.prologue-text {
  margin: 0;
  font-family: var(--font-classic);
  font-size: 1.08rem;
  line-height: 1.65;
  letter-spacing: 0.04em;
  color: #f0e6d0;
  min-height: 2.8em;
}
.prologue-hint {
  margin: 0.55rem 0 0;
  text-align: right;
  opacity: 0.7;
  font-family: var(--font-classic);
  letter-spacing: 0.08em;
}
.prologue-chapter {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(4, 6, 10, 0.88);
  cursor: pointer;
  text-align: center;
  padding: 1.5rem;
  font-family: var(--font-title);
}
.prologue-chapter.hidden {
  display: none;
}
.prologue-chapter-label {
  font-family: var(--font-title);
  font-size: 0.95rem;
  letter-spacing: 0.35em;
  color: #c4b8a0;
  margin-bottom: 0.75rem;
}
.prologue-chapter-title {
  font-family: var(--font-title);
  font-size: clamp(1.8rem, 5vw, 2.6rem);
  letter-spacing: 0.22em;
  color: #f0e6d0;
  font-weight: 600;
}
.prologue-chapter-hint {
  margin-top: 1.75rem;
  opacity: 0.65;
  font-family: var(--font-classic);
  letter-spacing: 0.12em;
}
@media (max-width: 640px) {
  .prologue-portrait {
    width: min(70vw, 260px);
    height: min(48vh, 400px);
    bottom: 28%;
  }
  .prologue-box {
    margin: 0.5rem 0.65rem 0.85rem;
    min-height: 6rem;
  }
}

/* —— 回忆录 —— */
.memories-sheet,
.memory-detail-sheet {
  position: relative;
  z-index: 2;
  width: min(420px, calc(100vw - 1.5rem));
  max-height: min(88vh, 720px);
  margin: auto;
  overflow: auto;
  background:
    linear-gradient(165deg, rgba(28, 24, 32, 0.98), rgba(10, 10, 14, 0.98));
  border: 1px solid rgba(196, 163, 90, 0.45);
  border-radius: 16px;
  padding: 1.15rem 1.1rem 1rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  animation: memories-in 0.35s ease-out;
}
@keyframes memories-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.memories-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.memories-eyebrow {
  margin: 0;
  font-size: 0.7rem;
  letter-spacing: 0.28em;
  color: #c4a35a;
  font-family: var(--font-title);
}
.memories-head h2,
.memory-detail-sheet h2 {
  margin: 0.2rem 0 0.25rem;
  font-family: var(--font-title);
  font-size: 1.35rem;
  letter-spacing: 0.12em;
  color: #f2e6cc;
  font-weight: 600;
}
.memories-ring {
  position: relative;
  width: 56px;
  height: 56px;
  flex: 0 0 auto;
}
.memories-ring svg { display: block; transform: rotate(-90deg); }
.memories-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 4;
}
.memories-ring-fg {
  fill: none;
  stroke: #c4a35a;
  stroke-width: 4.5;
  stroke-linecap: round;
  stroke-dasharray: 138.2;
  stroke-dashoffset: 138.2;
  transition: stroke-dashoffset 0.5s ease;
}
.memories-ring span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: #e8dcc8;
}
.memories-tabs {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.35rem;
  margin: 0.95rem 0 0.7rem;
}
.memories-tabs button {
  padding: 0.4rem 0.15rem;
  font-size: 0.72rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-color: transparent;
  color: #a8a090;
}
.memories-tabs button.on {
  background: rgba(196, 163, 90, 0.22);
  border-color: rgba(196, 163, 90, 0.55);
  color: #f2e6cc;
}
.memories-tabs button:disabled {
  opacity: 0.55;
  color: #555a62;
}
.memories-chapter-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-title);
  color: #e8dcc8;
  font-size: 0.92rem;
}
.memories-bar {
  height: 6px;
  margin: 0.45rem 0 0.85rem;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.memories-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #8a7040, #c4a35a);
  transition: width 0.45s ease;
}
.memories-quests {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 42vh;
  overflow: auto;
}
.memories-quests li {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 0.7rem;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
}
.memories-quests li.done {
  border-color: rgba(196, 163, 90, 0.4);
  background: rgba(196, 163, 90, 0.1);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.memories-quests li.done:hover {
  transform: translateY(-1px);
  border-color: rgba(196, 163, 90, 0.7);
}
.memories-quests .thumb {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  object-fit: cover;
  background: #1a1c22;
  border: 1px solid rgba(196, 163, 90, 0.25);
}
.memories-quests .thumb.gray {
  filter: grayscale(1) brightness(0.72);
  border-color: rgba(255, 255, 255, 0.1);
}
.memories-quests .thumb.seal {
  display: grid;
  place-items: center;
  color: #3a4048;
  font-family: var(--font-title);
  font-size: 1.1rem;
  border-color: rgba(255, 255, 255, 0.06);
}
.memories-quests .q-title {
  margin: 0;
  font-family: var(--font-title);
  color: #f2e6cc;
  font-size: 0.95rem;
}
.memories-quests li.pending .q-title { color: #8a8478; }
.memories-quests .q-teaser {
  margin: 0.2rem 0 0;
  font-size: 0.75rem;
  color: #a89878;
  font-family: var(--font-title);
}
.memories-quests li.pending .q-teaser { color: #6a6660; }
.memories-quests .q-go {
  color: #c4a35a;
  font-size: 0.75rem;
  white-space: nowrap;
}
.memories-close {
  width: 100%;
  margin-top: 0.85rem;
}
.memory-detail-art {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  margin-bottom: 0.85rem;
  background:
    center / cover no-repeat #1a1620,
    linear-gradient(160deg, #2a2430, #121018);
  border: 1px solid rgba(196, 163, 90, 0.3);
  box-shadow: inset 0 -40px 50px rgba(8, 6, 10, 0.55);
}
.memory-detail-story {
  margin: 0.55rem 0 0;
  font-family: var(--font-classic);
  font-size: 0.95rem;
  line-height: 1.75;
  color: #c8c0b4;
  white-space: pre-wrap;
}
#memoriesModal.modal,
#memoryDetailModal.modal {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
#memoriesModal.modal.hidden,
#memoryDetailModal.modal.hidden {
  display: none !important;
}
