/* 调查手册（js/dossier.js、casebook.js、sfile.js）：手册本身、纸页上的旧案卷宗、证件档案、手机上的全屏报告。2026-11-19 从 desktop.css 拆出来。 */

:root {
  /* 手册自己的色板（手册摊在桌面外面，所以放在最外层）。只用一两回的颜色就地写着 */
  --hb-ink: #2b2924; /* 印刷的墨：纸页、纸条、标签上的正文 */
  --hb-paper: #f1ead6; /* 纸：纸页、纸条、手机上的报告 */
  --hb-card: #f6f2e8; /* 白一点的卡片：线索板的卡、方格纸 */
  --hb-mute: #8a8272; /* 淡墨：小字、注 */
  --hb-rule: #a9a6a0; /* 表格、格子的细线 */
  --hb-sf-ink: #1c2a2a; /* 基金会证件、档案的墨青 */
  --hb-red: #b8392f; /* 戳子红、CLASSIFIED */
  --hb-oxblood: #8e2a23; /* 暗红：签名、案号、缎带 */
  --hb-green: #46653a; /* 结案、证词的绿 */
  --hb-ochre: #9c7a2a; /* 存疑、证物的黄 */
  --hb-blue: #3b4f7a; /* 人物、时间线的蓝 */
}

/* ── 调查手册 ── */
.dossier-overlay {
  position: fixed;
  inset: 0;
  z-index: 9700;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgb(18 22 18 / 0);
  transition: background 0.3s;
  user-select: none;
}

.dossier-overlay,
.dossier-overlay button {
  font-family: 'Pixelated MS Sans Serif', var(--px);
  font-size: 12px;
}

.dossier-overlay.shown {
  background: rgb(18 22 18 / 0.38);
}

.dossier {
  --pw: calc(160px * var(--s));
  --ph: calc(220px * var(--s));
  position: relative;
  width: calc(var(--pw) * 2);
  height: var(--ph);
  perspective: calc(var(--pw) * 4);
  opacity: 0;
  /* 合着的时候封面在正中，翻开后整本往右挪半页 */
  transform: translateX(calc(var(--pw) * -0.5)) translateY(calc(var(--s) * 8px));
  transition: transform 0.45s steps(6), opacity 0.15s;
}

.shown .dossier {
  opacity: 1;
  transform: translateX(calc(var(--pw) * -0.5));
}

.open .dossier {
  transform: none;
}

.dossier canvas {
  display: block;
  image-rendering: pixelated;
}

.dossier .page {
  position: absolute;
  top: 0;
  width: var(--pw);
  height: var(--ph);
}

.dossier .page.left {
  left: 0;
  visibility: hidden;
}

.open .dossier .page.left {
  visibility: visible;
  transition: visibility 0s 0.45s;
}

.dossier .page.right {
  left: var(--pw);
}

.dossier .cover {
  position: absolute;
  z-index: 5;
  left: var(--pw);
  top: 0;
  width: var(--pw);
  height: var(--ph);
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.45s steps(8);
  filter: drop-shadow(calc(var(--s) * 2px) calc(var(--s) * 2px) 0 rgb(0 0 0 / 0.35));
}

.open .dossier .cover {
  transform: rotateY(-180deg);
  visibility: hidden;
  transition: transform 0.45s steps(8), visibility 0s 0.45s;
}

.dossier .face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
}

.dossier .face.back {
  transform: rotateY(180deg);
}

/* 物件 */
.ditem {
  position: absolute;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(calc(var(--s) * 1px) calc(var(--s) * 1px) 0 rgb(0 0 0 / 0.3));
}

.open .ditem {
  animation: ditem-drop 0.3s steps(3) both;
  animation-delay: calc(0.45s + var(--i) * 45ms);
}

/* 画布大半透明的物件（白玫瑰）：不接鼠标，点和悬停按像素算（dossier.js 的 seeThroughAt），算到了就是 .hot */
.ditem.see-through {
  pointer-events: none;
}

.dossier-overlay.hot-item {
  cursor: pointer;
}

.ditem:hover,
.ditem.hot {
  z-index: 3;
  translate: calc(var(--s) * -1px) calc(var(--s) * -1px);
  filter: drop-shadow(calc(var(--s) * 2px) calc(var(--s) * 2px) 0 rgb(0 0 0 / 0.35));
}

.ditem:hover::after,
.ditem.hot::after {
  content: attr(data-label);
  position: absolute;
  left: 50%;
  top: 100%;
  translate: -50% 4px;
  padding: 2px 6px;
  background: var(--hb-ink);
  color: var(--hb-card);
  white-space: nowrap;
  pointer-events: none;
}

.ditem.lifted {
  opacity: 0.35;
}

/* 夹层里正拖着挪的那件（dossier.js 的 moveInStash）：浮在最上面；压到别的东西上时变淡，松手会自己挪到最近的空地 */
.ditem.moving {
  z-index: 6;
  cursor: grabbing;
  translate: calc(var(--s) * -1px) calc(var(--s) * -1px);
  filter: drop-shadow(calc(var(--s) * 2px) calc(var(--s) * 2px) 0 rgb(0 0 0 / 0.35));
}

.ditem.moving::after {
  display: none;
}

.ditem.blocked {
  opacity: 0.55;
}

.dossier-ghost {
  position: fixed;
  z-index: 9800;
  pointer-events: none;
  image-rendering: pixelated;
  filter: drop-shadow(6px 6px 0 rgb(0 0 0 / 0.35));
}



.dossier-toast {
  position: fixed;
  left: 50%;
  bottom: 96px;
  translate: -50% 0;
  padding: 6px 12px;
  background: var(--slate);
  color: var(--text);
  box-shadow: inset 0 0 0 1px var(--line), 3px 3px 0 #0003;
  clip-path: var(--nick);
}

/* 手册的本体（book3d.js）：皮面硬板、两摞纸、物件的侧边，合着和翻开那一下的封面。
   夹在纸页底图和物件中间（底图往下压一层），这样物件挤出来的侧边落在纸上、物件正面盖在它上面；
   合着、封面在转的时候（.lid）整张提到最上面，盖住底下的纸页。CSS 转的那张封面不用了 */
.dossier .b3-body {
  position: absolute;
  z-index: -1;
  pointer-events: none;
  image-rendering: pixelated;
}

.dossier .b3-body.lid {
  z-index: 5;
}

.b3 .dossier .cover {
  display: none;
}

.b3 .dossier .page > canvas:first-child {
  position: relative;
  z-index: -2;
}

.b3 .dossier .hb-mark,
.b3.dossier-overlay .hb-ribbon {
  z-index: -3;
}

/* 翻页时绕书脊转过去的那张纸 */
.dossier .leaf {
  position: absolute;
  z-index: 6;
  top: 0;
  left: var(--pw);
  width: var(--pw);
  height: var(--ph);
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.45s steps(8);
}

.dossier .leaf.away {
  transform: rotateY(-180deg);
}


/* 手册左下、右下角的翻页热区：角上卷起一点纸边，指上去卷得更大 */
.dossier-overlay .dossier .corner {
  position: absolute;
  z-index: 7;
  bottom: 0;
  width: calc(18px * var(--s));
  height: calc(18px * var(--s));
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  cursor: pointer;
}

.dossier .corner.prev {
  left: 0;
}

.dossier .corner.next {
  right: 0;
}

.dossier .corner::before {
  content: '';
  position: absolute;
  bottom: 0;
  width: calc(8px * var(--s));
  height: calc(8px * var(--s));
  filter: drop-shadow(calc(var(--s) * -1px) calc(var(--s) * -1px) 0 rgb(0 0 0 / 0.25));
  transition: width 0.15s steps(3), height 0.15s steps(3);
}

.dossier .corner.next::before {
  right: 0;
  background: linear-gradient(315deg, transparent 50%, #8a6a4a 50%);
}

.dossier .corner.prev::before {
  left: 0;
  background: linear-gradient(45deg, transparent 50%, #8a6a4a 50%);
}

.dossier .corner:hover::before,
.dossier .corner:focus-visible::before {
  width: calc(14px * var(--s));
  height: calc(14px * var(--s));
}

.dossier .corner[hidden] {
  display: none;
}

/* 中缝：点一下合上手册 */
.dossier-overlay .dossier .spine {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: calc(var(--pw) - 6px * var(--s));
  width: calc(12px * var(--s));
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  box-shadow: none;
  cursor: pointer;
}

.dossier-overlay .dossier .spine:hover,
.dossier-overlay .dossier .spine:focus-visible {
  background: linear-gradient(90deg, transparent, rgb(14 24 20 / 0.28) 50%, transparent);
}

.dossier-overlay:not(.open) .dossier .corner,
.dossier-overlay:not(.open) .dossier .spine {
  display: none;
}

/* 调查手册钉在桌面上：没有遮罩，躺在窗口底下，拖书页能挪 */
.dossier-overlay.pinned {
  position: absolute;
  inset: auto;
  z-index: 1;
  display: block;
  background: none;
}

.dossier-overlay.pinned .page {
  cursor: move;
}

/* ── 手册里的纸页（dossier.js 的 flow，内容是 js/casebook.js 的旧案卷宗）──
   字不是画上去的，是浏览器排的：不跟着手册放大，一直是这块屏幕上清楚的字号。
   内容只有一份，一页一栏往右排；.hb-view 是开在纸上的窗，看哪一摊就把内容横挪过去 */
.dossier-overlay {
  --pen: #b0142a;
  --quill: #23324a;
  --mute: var(--hb-mute);
}

.hb-view {
  position: absolute;
  left: calc(16px * var(--s));
  top: calc(18px * var(--s));
  width: calc(128px * var(--s));
  height: calc(184px * var(--s));
  /* clip 而不是 hidden：hidden 的盒子还能被焦点、页内查找悄悄滚走，一滚页就对不上了 */
  overflow: clip;
  pointer-events: none;
}

/* 摊开的那一份：电脑上横跨两页（中间隔着书脊）；合着的时候不露出来 */
.dossier > .hb-view {
  z-index: 4;
  visibility: hidden;
}

.dossier > .hb-view {
  width: calc(288px * var(--s));
}

.open .dossier > .hb-view {
  visibility: visible;
  transition: visibility 0s 0.45s;
}

.hb-flow {
  width: calc(128px * var(--s));
  height: 100%;
  column-width: calc(128px * var(--s));
  column-gap: calc(32px * var(--s));
  column-fill: auto;
  color: var(--hb-ink);
  user-select: text;
}

.hb-flow > * {
  pointer-events: auto;
}

/* 每一栏、占整页的块、补的空白页，都另起一页 */
.hb-flow > [data-tab],
.hb-flow > .cb-brk,
.hb-flow > .hb-slot,
.hb-pad {
  break-before: column;
}

.hb-slot {
  position: relative;
  height: 100%;
}

.hb-pad {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--mute);
  font-family: var(--small-font);
  font-size: var(--small);
}

.hb-end {
  display: block;
  height: 0;
}

.hb-art {
  display: block;
  image-rendering: pixelated;
}

.hb-btn[hidden],
.cb-owner[hidden] {
  display: none !important;
}

/* 夹在手册上边的那张纸条：状态、换字号、谁执笔、留在书房、归档、钉在桌面上 */
.hb-strip {
  position: absolute;
  z-index: 7;
  right: 0;
  bottom: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 2px 6px;
  max-width: 100%;
  margin-bottom: calc(2px * var(--s));
  padding: 2px 8px;
  background: var(--hb-paper);
  box-shadow: 2px 2px 0 rgb(0 0 0 / 0.35);
  color: var(--hb-ink);
  font-family: var(--px);
  font-size: 12px;
  opacity: 0;
  transition: opacity 0.2s;
}

.open .hb-strip {
  opacity: 1;
  transition-delay: 0.45s;
}

.dossier-overlay:not(.open) .hb-strip,
.dossier-overlay:not(.open) .hb-flags {
  pointer-events: none;
}

.cb-strip,
.cb-owner,
.cb-role {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 6px;
  font-family: var(--small-font, var(--px));
  font-size: var(--small, 12px);
}

.cb-role {
  gap: 0;
}

.cb-state {
  color: var(--mute);
}

/* 右边缘的索引标签：一栏一个，竖着写，贴在页边上；摊开的是哪一栏，哪个探出来 */
.hb-flags {
  position: absolute;
  z-index: 3;
  left: calc(100% - 6px * var(--s));
  top: calc(14px * var(--s));
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: calc(2px * var(--s));
  opacity: 0;
  transition: opacity 0.2s;
}

.open .hb-flags {
  opacity: 1;
  transition-delay: 0.45s;
}

.dossier-overlay .hb-flag {
  min-width: 0;
  min-height: 0;
  padding: 5px 2px 5px 3px;
  border: 0;
  border-radius: 0;
  background: #9fc2b9;
  box-shadow: 1px 1px 0 rgb(0 0 0 / 0.35);
  color: var(--hb-ink);
  /* 和纸上最小那档字一样（casebook.js 挂在手册上的 --small：这块屏幕上清楚、大屏上跟着放大） */
  font-family: var(--small-font, var(--px)) !important;
  font-size: var(--small, 12px) !important;
  line-height: 1;
  text-shadow: none;
  writing-mode: vertical-rl;
  cursor: pointer;
}

.dossier-overlay .hb-flag:nth-child(3n + 2) {
  background: #d9b98a;
}

.dossier-overlay .hb-flag:nth-child(3n) {
  background: #c3d6dc;
}

.dossier-overlay .hb-flag:hover,
.dossier-overlay .hb-flag.on {
  translate: calc(2px * var(--s)) 0;
}

.dossier-overlay .hb-flag.on {
  background: var(--hb-red);
  color: var(--hb-paper);
}

.dossier-overlay button.hb-flag:not(:disabled):active {
  padding: 5px 2px 5px 3px;
  box-shadow: 1px 1px 0 rgb(0 0 0 / 0.35);
}

.dossier-overlay .hb-flag:focus {
  outline: none;
}

/* 落在手册上的纸条：有话要说、要人回话 */
.hb-veil {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(18 22 18 / 0.3);
}

.hb-slip {
  position: relative;
  box-sizing: border-box;
  width: min(340px, 92%);
  padding: 14px 16px 8px;
  background: var(--hb-paper);
  box-shadow: 3px 3px 0 rgb(0 0 0 / 0.4);
  color: var(--hb-ink);
  font-family: var(--small-font, var(--px));
  font-size: var(--small, 12px);
  line-height: 1.8;
  user-select: text;
}

/* 顶上一截纸胶带 */
.hb-slip::before {
  content: '';
  position: absolute;
  top: -6px;
  left: calc(50% - 24px);
  width: 48px;
  height: 12px;
  background: rgb(159 194 185 / 0.85);
}

.hb-slip p {
  margin: 0 0 4px;
}

.hb-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}

/* ── 手机上的调查手册：一份全屏的调查报告（dossier.js 的 openReport）。
   同一份内容不分页了，一栏到底；状态栏和底下的导航键留在外面。
   从底下升上来挪的是 top/bottom，不用 translate：iOS 的 WebKit 里，带 transform 的 fixed 层里面套着
   能滚的 .rp-body，滚动层会脱开父层画——纸和顶栏不见了，字铺满整个桌面 ── */
.dossier-overlay.report {
  --s: 2;
  top: 100%;
  bottom: calc(64px - 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0;
  overflow: hidden;
  background: var(--hb-paper);
  color: var(--hb-ink);
  transition: top 0.25s steps(5), bottom 0.25s steps(5);
}

.dossier-overlay.report.shown {
  top: 24px;
  bottom: 40px;
  background: var(--hb-paper);
}

.rp-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 4px 12px;
  border-bottom: 3px double var(--hb-ink);
  font-family: var(--px);
}

.rp-head b {
  font-size: 24px;
  font-weight: normal;
}

.rp-head i {
  flex: 1;
  color: var(--hb-oxblood);
  font-size: 12px;
  font-style: normal;
}

.report .hb-strip {
  position: static;
  justify-content: flex-start;
  margin: 0;
  padding: 2px 8px;
  box-shadow: none;
  opacity: 1;
}

/* 栏目：一排文件夹的耳朵，横着滑 */
.rp-nav {
  display: flex;
  flex: none;
  gap: 3px;
  overflow-x: auto;
  padding: 4px 8px 0;
  border-bottom: 2px solid #4f5f58;
  scrollbar-width: none;
}

.report .hb-flag {
  flex: none;
  padding: 5px 9px;
  box-shadow: none;
  writing-mode: horizontal-tb;
}

.report .hb-flag:hover,
.report .hb-flag.on {
  translate: none;
}

.dossier-overlay.report button.hb-flag:not(:disabled):active {
  padding: 5px 9px;
  box-shadow: none;
}

.rp-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px 48px;
  user-select: text;
}

.report .hb-flow {
  width: auto;
  height: auto;
  columns: auto;
}

/* 一栏和一栏之间划一道双线 */
.report .hb-flow > [data-tab] ~ [data-tab],
.rp-shelf {
  margin-top: 28px;
  padding-top: 14px;
  border-top: 3px double var(--hb-ink);
}

.rp-shelf h3 {
  margin: 0 0 6px;
  font-family: var(--px);
  font-size: 24px;
  font-weight: normal;
}

/* 随身物件：手册第一页那块软木板，排在报告最前面。东西多了往下换行，不横着滑 */
.rp-shelf.rp-board {
  margin: -12px -14px 0;
  padding: 12px 14px 18px;
  border-top: 0;
  background: #4f5f58 radial-gradient(rgb(0 0 0 / 0.22) 1px, transparent 1.5px) 0 0 / 6px 6px;
  box-shadow: inset 0 -4px 0 rgb(0 0 0 / 0.18);
  color: var(--hb-paper);
}

.rp-board .rp-row {
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 18px 22px;
  overflow: visible;
}

.rp-board .rp-item {
  color: #e8dcc0;
}

.rp-board + .hb-flow {
  margin-top: 20px;
}

/* 线索板：一块能横着拖着看的软木板 */
.report .hb-slot {
  height: 70vh;
}

.report .cb-board {
  background: #b98a57 radial-gradient(rgb(0 0 0 / 0.12) 1px, transparent 1.5px) 0 0 / 7px 7px;
  box-shadow: inset 0 0 0 4px #7a5636;
}

/* 附件：物件排成一行，横着滑 */
.rp-row {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  overflow-x: auto;
  padding: 8px 2px 12px;
  user-select: none;
}

.rp-item {
  display: flex;
  flex: none;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--mute);
  font-family: var(--px);
  font-size: 12px;
  cursor: pointer;
}

.rp-item canvas {
  filter: drop-shadow(2px 2px 0 rgb(0 0 0 / 0.3));
}

/* ── 旧案卷宗排在纸页上的样子（js/casebook.js）── */
.hb-flow h3 {
  margin: 0 0 0.2em;
  font-size: max(24px, 1.5em);
  font-weight: normal;
  line-height: 1.4;
  break-after: avoid; /* 栏目标题别一个人落在页底，跟着下面第一项走 */
}

.hb-flow h4 {
  margin: 0.6em 0 0.2em;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--hb-ink);
  font-size: 1em;
  font-weight: normal;
  letter-spacing: 2px;
  break-after: avoid;
}

.hb-flow p {
  margin: 0 0 0.3em;
}

.hb-flow section > p {
  text-indent: 2em;
}

.hb-flow ol {
  margin: 0;
  padding-left: 1.8em;
}

.hb-flow a {
  color: var(--quill);
}

.hb-flow small,
.cb-tip,
.cb-pinned,
.cb-no,
.cb-read,
.cb-shelf,
.cb-day,
.cb-mark {
  font-family: var(--small-font);
  font-size: var(--small);
}

.hb-flow small,
.cb-setting,
.cb-empty,
.cb-pinned,
.cb-no {
  color: var(--mute);
}

/* 卷首：编号、戳子、案名、一句话案情、读到哪了、要回答的问题 */
.cb-no {
  color: var(--hb-oxblood);
  letter-spacing: 1px;
}

.cb-stamp {
  float: right;
  margin: calc(1px * var(--s)) 0 0 0.5em;
  padding: 0 calc(3px * var(--s));
  border: calc(1px * var(--s)) solid var(--hb-red);
  color: var(--hb-red);
  font-family: var(--px);
  font-size: 24px;
  line-height: 1.4;
}

.cb-stamp.closed {
  border-color: var(--hb-green);
  color: var(--hb-green);
}

.cb-log .cb-stamp {
  float: none;
  display: inline-block;
  margin-top: 1em;
}

.cb-brief {
  padding: 0.3em 0.5em;
  border-left: calc(1px * var(--s)) solid var(--hb-ink);
  background: rgb(0 0 0 / 0.05);
}

.cb-question {
  margin-top: 0.6em !important;
  padding: 0.3em 0.5em;
  border: 1px dashed var(--hb-ink);
  break-inside: avoid;
}

.cb-read {
  letter-spacing: 1px;
}

.cb-read i {
  display: inline-block;
  width: calc(4px * var(--s));
  height: calc(4px * var(--s));
  margin-left: calc(2px * var(--s));
  border: calc(1px * var(--s)) solid var(--hb-ink);
  vertical-align: middle;
}

.cb-read i.on {
  background: var(--hb-ink);
}

.cb-shelf .hb-opt {
  display: block;
  width: fit-content;
}

/* 书签：调查员读到哪了 */
.hb-flow section > .cb-bookmark {
  margin: 0.4em 0;
  border-top: 2px solid var(--pen);
  color: var(--pen);
  font-family: var(--small-font);
  font-size: var(--small);
  text-align: center;
  text-indent: 0;
}

/* 批注：塞梅尔维斯的蓝黑钢笔字，瓦伦缇娜的红笔。回别人的话挂在那句底下，再缩进一级 */
.cb-notes {
  margin: 0.1em 0 0.3em;
}

.hb-flow .cb-note {
  margin: 0.1em 0 0.1em 2em;
  color: var(--quill);
  text-indent: 0;
}

.cb-note::before {
  content: '↳ ';
}

.hb-flow .cb-note.by-v {
  color: var(--pen);
}

.hb-flow .cb-note.reply {
  margin-left: 4em;
}

.cb-note.reply::before {
  content: '└ ';
}

/* 塞梅尔维斯看过、不打算回的那句：铅笔勾一下 */
.cb-ok {
  margin-left: 0.3em;
  color: var(--quill);
}

/* 批注后面的「回」「擦」：平时只是淡淡的小字，指上去才圈起来 */
.cb-acts {
  white-space: nowrap;
}

.dossier-overlay .cb-acts .hb-opt {
  margin: 0;
  padding: 6px 8px;
  color: var(--mute);
}

/* 写字的地方：一道虚线，没有框 */
.cb-inline {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 0.1em 0;
}

.dossier-overlay .cb-inline input,
.dossier-overlay .hb-lock input,
.dossier-overlay .nb-form input,
.dossier-overlay .nb-form textarea,
.dossier-overlay .cb-close textarea,
.dossier-overlay .hb-slip textarea {
  flex: 1;
  box-sizing: border-box;
  min-width: 0;
  height: auto;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px dashed var(--hb-ink);
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  color: var(--quill);
  font-family: var(--small-font, var(--px)) !important;
  font-size: var(--small, 12px) !important;
  line-height: 1.8;
}

.dossier-overlay .cb-inline input.by-v,
.dossier-overlay .hb-slip textarea.by-v {
  color: var(--pen);
}

/* 整段的字写在横线纸上 */
.dossier-overlay .nb-form textarea,
.dossier-overlay .cb-close textarea,
.dossier-overlay .hb-slip textarea {
  display: block;
  width: 100%;
  height: 9em;
  margin: 0.4em 0;
  border: 0;
  background: repeating-linear-gradient(transparent 0 calc(1.8em - 1px), rgb(0 0 0 / 0.2) 0 1.8em);
  resize: none;
}

.dossier-overlay .hb-slip textarea {
  height: 5.4em;
}

.dossier-overlay .nb-form input {
  flex: none;
  width: 100%;
}

/* 正文：至少八行，写多少长多高（js 管），最高到一页装得下为止；横线跟着字一起滚 */
.dossier-overlay .nb-form textarea {
  flex: none;
  height: auto;
  min-height: 14.4em;
  max-height: calc(184px * var(--s) - 200px);
  background-attachment: local;
  scrollbar-width: thin;
  scrollbar-color: #b9b1a0 transparent;
}

.dossier-overlay.report .nb-form textarea {
  max-height: 60vh;
}

/* 人物、证物、口供、时间：一条一条 */
.cb-item {
  position: relative;
  padding: 0.3em 0;
  border-bottom: 1px dashed rgb(0 0 0 / 0.25);
  break-inside: avoid;
}

.cb-item > b {
  border-bottom: 2px solid var(--hb-ink);
  font-weight: normal;
}

.cb-item > p {
  margin: 0.1em 0;
}

/* 照片、证物袋挂在左边 */
.cb-pic {
  min-height: calc(38px * var(--s));
  padding-left: calc(31px * var(--s));
}

.cb-pic > .hb-art {
  position: absolute;
  left: 0;
  top: 0.4em;
  filter: drop-shadow(calc(1px * var(--s)) calc(1px * var(--s)) 0 rgb(0 0 0 / 0.25));
}

.cb-mark {
  margin-left: 0.5em;
  padding: 0 4px;
  background: var(--hb-mute);
  color: #fff;
}

.cb-mark.doubt {
  background: var(--hb-ochre);
}

.cb-mark.focus {
  background: var(--pen);
}

.cb-mark.cleared {
  background: var(--hb-green);
}

.cb-time .cb-item {
  margin-left: calc(3px * var(--s));
  padding-left: calc(6px * var(--s));
  border-bottom: 0;
  border-left: calc(1px * var(--s)) solid var(--hb-blue);
}

.cb-time .cb-item::before {
  content: '';
  position: absolute;
  left: calc(-3px * var(--s));
  top: 0.7em;
  width: calc(5px * var(--s));
  height: calc(5px * var(--s));
  background: var(--hb-blue);
}

.cb-time .cb-item > b {
  border: 0;
  color: var(--hb-blue);
}

/* 线索板：左右两页拼成一块软木板（板子是手册画的底），卡片可以拖，卡片之间拉红线。
   板上的东西跟着手册的放大倍数走（--f），字固定用最小那档 */
.cb-boardwrap {
  display: flex;
  flex-direction: column;
  gap: calc(2px * var(--s));
}

.cb-boardbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 4px;
  box-sizing: border-box;
  width: fit-content;
  max-width: 100%;
  padding: 0 6px 0 0;
  background: var(--hb-paper);
  box-shadow: 1px 1px 0 rgb(0 0 0 / 0.3);
  font-family: var(--small-font);
  font-size: var(--small);
  line-height: 1.8;
}

.cb-tape {
  padding: 0 calc(4px * var(--s));
  background: #9fc2b9;
  color: #22524b;
}

.cb-tip {
  color: var(--mute);
}

.cb-boardbar .cb-inline {
  width: calc(110px * var(--s));
  margin: 0 0 0 6px;
}

.cb-board {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  font-family: var(--small-font);
  font-size: var(--small);
  line-height: 1.4;
  user-select: none;
}

/* 手册里板子从左页一直铺到右页 */
.hb-view .cb-board {
  width: calc(288px * var(--s));
}

.hb-view .cb-boardbar {
  max-width: calc(288px * var(--s));
}

.cb-board svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.cb-board line {
  stroke: #b0142a;
  stroke-width: 2;
}

.cb-board .cb-empty {
  padding: 1em;
  color: #3a2a1a;
}

.cb-far {
  position: absolute;
  width: 1px;
  height: 1px;
}

.cb-card {
  position: absolute;
  box-sizing: border-box;
  width: calc(124px * var(--f));
  max-height: calc(84px * var(--f));
  padding: 2px 5px 3px;
  overflow: hidden;
  border-top: calc(2px * var(--s)) solid var(--hb-mute);
  background: var(--hb-card);
  box-shadow: calc(1px * var(--s)) calc(1px * var(--s)) 0 rgb(0 0 0 / 0.3);
  touch-action: none;
}

.cb-card b {
  display: block;
  font-weight: normal;
}

.cb-card small {
  display: block;
  color: #6a6050;
}

.cb-card.person {
  border-top-color: var(--hb-blue);
}

.cb-card.evidence {
  border-top-color: var(--hb-ochre);
}

.cb-card.testimony {
  border-top-color: var(--hb-green);
}

.cb-card.moment {
  border-top-color: #5f666c;
}

.cb-card.slip {
  border-top: 0;
  background: #ecdc84;
}

.cb-card.slip small {
  color: var(--quill);
}

.cb-card.slip.by-v small {
  color: var(--pen);
}

.cb-card.focus {
  outline: 2px solid var(--pen);
}

.cb-card.doubt {
  outline: 2px dashed var(--hb-ochre);
}

.cb-card.cleared {
  opacity: 0.55;
}

.cb-card.cleared b {
  text-decoration: line-through;
}

.cb-card.picked {
  outline: 3px solid #fff;
}

/* 便条右上角那个「撕」 */
.dossier-overlay .cb-tear {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 0;
  min-height: 0;
  padding: 0 2px;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--pen);
  font: inherit !important;
  cursor: pointer;
}

.cb-linklabel {
  position: absolute;
  translate: -50% -50%;
  padding: 0 4px;
  background: var(--hb-card);
  box-shadow: 1px 1px 0 rgb(0 0 0 / 0.3);
  color: var(--quill);
  white-space: nowrap;
}

.cb-linklabel.by-v {
  color: var(--pen);
}

/* 记录：一天一个日期，底下一条一条 */
.hb-flow .cb-day {
  width: fit-content;
  margin: 0.6em 0 0.1em;
  padding-right: 2em;
  border-bottom: 1px solid var(--pen);
  color: var(--pen);
}

.cb-entry {
  position: relative;
  padding-left: 1em;
  color: var(--quill);
  break-inside: avoid;
}

.cb-entry::before {
  content: '·';
  position: absolute;
  left: 0.2em;
}

.cb-entry.by-v {
  color: var(--pen);
}

.cb-wine {
  position: absolute;
  right: 0;
  top: -0.4em;
  pointer-events: none;
}

/* 结案 */
.cb-report {
  padding: 0.3em 0.5em;
  border-left: calc(1px * var(--s)) solid var(--quill);
  color: var(--quill);
  white-space: pre-wrap;
}

.cb-rejected {
  color: var(--pen);
  text-decoration: line-through;
}

/* 选项：在方框里涂一格；驳回过的划掉 */
.dossier-overlay .cb-option {
  position: relative;
  display: block;
  width: 100%;
  min-height: 0;
  margin: 0.3em 0;
  padding: 0 0 0 1.6em;
  border: 0;
  background: none;
  box-shadow: none;
  color: inherit;
  font: inherit !important;
  text-align: left;
  text-shadow: none;
  white-space: normal;
  cursor: pointer;
}

.cb-option::before {
  content: '';
  position: absolute;
  left: 0.1em;
  top: 0.45em;
  width: calc(4px * var(--s));
  height: calc(4px * var(--s));
  border: calc(1px * var(--s)) solid var(--hb-ink);
}

.cb-option.on::before {
  background: var(--pen);
  box-shadow: inset 0 0 0 calc(1px * var(--s)) var(--hb-paper);
}

.dossier-overlay .cb-option:disabled {
  opacity: 0.5;
  text-decoration: line-through;
  cursor: default;
}

.dossier-overlay button.cb-option:not(:disabled):active {
  padding: 0 0 0 1.6em;
  box-shadow: none;
}

.dossier-overlay .cb-option:focus {
  outline: none;
}

.cb-verdict {
  padding: 0.2em 0.5em;
  background: var(--hb-green);
  color: #fff;
}

/* ── 塞梅尔维斯的那套档案（js/sfile.js）：从手册里拿起来凑近了看的证件和成员档案。
   落在手册上（.hb-veil 里），尺寸按一倍写，放大靠 .sf-zoom 上的 zoom ── */
.sf-view {
  max-width: 100%;
  max-height: 100%;
  overflow: hidden auto;
  scrollbar-width: thin;
  color: var(--hb-sf-ink);
  font-family: var(--px);
  font-size: 12px;
  line-height: 1;
}

.sf-zoom {
  padding: 6px;
  perspective: 1200px;
}

.sf-view img {
  display: block;
  image-rendering: pixelated;
}

/* 证件：两面背靠背，点一下绕竖轴翻过去 */
.sf-id {
  position: relative;
  width: 400px;
  height: 252px;
  outline: none;
  transform-style: preserve-3d;
  transition: transform 0.6s;
  cursor: pointer;
}

.sf-id.flip {
  transform: rotateY(180deg);
}

.sf-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 2px 2px 0 rgb(0 0 0 / 0.4);
  backface-visibility: hidden;
}

.sf-id:focus-visible .sf-face {
  outline: 1px dotted #efe6d2;
  outline-offset: 2px;
}

/* 正面的镭射膜：一条斜着的彩虹慢慢横着流。底图的宽正好是彩虹横着重复一次的距离（600px ÷ sin 110°），所以流一圈接得上 */
.sf-front {
  background: repeating-linear-gradient(110deg, #c4e4ee 0, #eccadf 100px, #f3e8bd 200px, #c6ebd0 300px, #cbd3f4 400px, #eccadf 500px, #c4e4ee 600px) 0 0 / 638.5px 100%;
  animation: sf-holo 26s linear infinite;
}

.sf-edge {
  position: absolute;
  box-sizing: border-box;
  background: var(--hb-sf-ink);
  color: #e4f0ee;
  font-family: var(--px10);
  font-size: 10px;
  line-height: 12px;
  text-align: center;
  white-space: nowrap;
}

.sf-edge.l {
  left: 10px;
  top: 10px;
  bottom: 10px;
  width: 12px;
  border-radius: 6px 0 0 6px;
  writing-mode: vertical-rl;
}

/* 上边那条：左边一截是黑白格，右边是字 */
.sf-edge.t {
  left: 22px;
  right: 10px;
  top: 10px;
  height: 12px;
  padding-left: 96px;
  border-radius: 0 6px 0 0;
  background: linear-gradient(var(--hb-sf-ink), var(--hb-sf-ink)) 96px 0 no-repeat, repeating-conic-gradient(var(--hb-sf-ink) 0 25%, #0000 0 50%) 0 0 / 12px 12px;
}

.sf-edge.r {
  right: 10px;
  top: 22px;
  bottom: 22px;
  width: 12px;
  background: repeating-conic-gradient(var(--hb-sf-ink) 0 25%, #0000 0 50%) 0 0 / 12px 12px;
}

.sf-edge.b {
  left: 22px;
  right: 10px;
  bottom: 10px;
  height: 12px;
  border-radius: 0 0 6px;
}

.sf-who {
  position: absolute;
  left: 30px;
  top: 24px;
  width: 107px;
}

.sf-who img {
  width: 105px;
  height: 132px;
  border: 1px solid var(--hb-sf-ink);
  border-radius: 6px 6px 0 0;
  background: rgb(255 255 255 / 0.4);
  filter: grayscale(1) contrast(1.15);
}

.sf-who b {
  display: block;
  padding: 3px 6px;
  background: var(--hb-sf-ink);
  color: #e4f0ee;
  line-height: 13px;
}

.sf-who p,
.sf-what dt,
.sf-crest,
.sf-org span {
  font-family: var(--px10);
  font-size: 10px;
  line-height: 11px;
}

.sf-who p {
  margin-top: 3px;
}

.sf-what {
  position: absolute;
  left: 144px;
  right: 28px;
  top: 22px;
  bottom: 22px;
  padding: 0 0 0 8px;
  border-left: 1px solid var(--hb-sf-ink);
}

.sf-view h4 {
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 1px;
  text-align: center;
}

.sf-crest {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: center;
}

.sf-what dd {
  margin-bottom: 1px;
  border-bottom: 1px solid var(--hb-sf-ink);
  line-height: 13px;
}

/* 签名压在最下面几行字上：存的像素版（100×32），放大一倍，只取它的形状，换成黑墨水 */
.sf-sign {
  position: absolute;
  right: -8px;
  bottom: -4px;
  width: 200px;
  height: 64px;
  background: #141414;
  image-rendering: pixelated;
  -webkit-mask: url('../img/semmelweis-pixel.png') center / 100% 100% no-repeat;
  mask: url('../img/semmelweis-pixel.png') center / 100% 100% no-repeat;
}

/* 背面：拉丝的银色，左边一张编号贴纸，右下两排黑菱形 */
.sf-back {
  background: repeating-linear-gradient(0deg, rgb(255 255 255 / 0.25) 0 1px, #0000 1px 3px), linear-gradient(100deg, #b4b8c0, #eceef1 38%, #bfc3ca 62%, #dfe2e6);
  transform: rotateY(180deg);
}

.sf-bars {
  position: absolute;
  left: 8px;
  top: 44px;
  bottom: 30px;
  width: 9px;
  background: repeating-linear-gradient(180deg, #16181c 0 2px, #0000 2px 5px, #16181c 5px 6px, #0000 6px 11px, #16181c 11px 14px, #0000 14px 17px);
}

.sf-label {
  position: absolute;
  left: 24px;
  top: 26px;
  bottom: 34px;
  width: 44px;
  background: #e6e9c6;
  line-height: 44px;
  letter-spacing: 2px;
  text-align: center;
  writing-mode: vertical-rl;
}

.sf-label b {
  margin-bottom: 10px;
  font-size: 24px;
  letter-spacing: 0;
}

.sf-org {
  position: absolute;
  right: 22px;
  top: 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  justify-items: end;
  column-gap: 6px;
  text-align: right;
}

.sf-org h4 {
  grid-column: 1 / -1;
  margin-bottom: 4px;
}

.sf-diamonds {
  position: absolute;
  left: 118px;
  right: 0;
  bottom: 0;
  height: 138px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 2 4' preserveAspectRatio='none' shape-rendering='crispEdges'%3E%3Cpath d='M1 0 2 2 1 4 0 2z' fill='%2316181c'/%3E%3C/svg%3E") 0 0 / 47px 92px;
}

.sf-tip {
  margin-top: 10px;
  color: #efe6d2;
  text-align: center;
  text-shadow: 1px 1px 0 #000;
}

/* 提示那行里的圈（白玫瑰的「插到兜里」）落在深色的皮面上：字跟提示一样用浅色，不然和底色糊在一起 */
.dossier-overlay .sf-tip .hb-btn {
  color: inherit;
  text-shadow: inherit;
}

/* 成员档案：一张白纸 */
.sf-profile {
  position: relative;
  box-sizing: border-box;
  width: 380px;
  padding: 18px 20px 10px;
  background: #fbfaf6;
  box-shadow: 3px 3px 0 rgb(0 0 0 / 0.4);
  color: var(--hb-ink);
  line-height: 1.5;
  user-select: text;
}

.sf-profile header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.sf-profile header div {
  flex: 1;
  padding: 10px 8px;
  background: #dcdcd9;
  text-align: right;
}

.sf-profile header span {
  margin-top: 8px;
  letter-spacing: 1px;
}

.sf-profile dl {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 10px 6px;
  align-items: end;
}

.sf-profile dt {
  line-height: 1.1;
  text-align: right;
}

.sf-profile dd {
  min-height: 15px;
  border-bottom: 1px solid var(--hb-ink);
  line-height: 15px;
  white-space: nowrap;
}

.sf-name {
  margin-bottom: 12px;
}

.sf-rows {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.sf-rows dl {
  flex: 1;
  min-width: 0;
}

.sf-rows img {
  width: 105px;
  height: 132px;
  padding: 2px;
  border: 1px solid var(--hb-ink);
  background: #fff;
}

.sf-profile dd.sf-two {
  display: flex;
  gap: 6px;
  border: 0;
}

.sf-two span {
  flex: 1;
  border-bottom: 1px solid var(--hb-ink);
}

.sf-profile .gap,
.sf-profile .gap + dd {
  margin-top: 12px;
}

/* 手写的那一行：像素字写大一号、歪一点 */
.sf-to {
  margin: 16px 0 8px 56px;
  color: #3a332c;
  font-size: 24px;
  line-height: 1.2;
  white-space: nowrap;
  transform: skewX(-14deg) rotate(-2deg);
}

/* 烫金的章，压着照片的角和手写的那行 */
.sf-stamp {
  position: absolute;
  right: 24px;
  top: 230px;
  width: 150px;
  height: 150px;
  overflow: visible;
  fill: none;
  stroke: #c8a233;
  stroke-width: 1.5;
  pointer-events: none;
}

.sf-stamp text {
  fill: #c8a233;
  stroke: none;
  font-family: var(--px10);
  font-size: 10px;
  letter-spacing: 1px;
}

.sf-stamp .big {
  font-family: var(--px);
  font-size: 24px;
  letter-spacing: 0;
}

.sf-profile h5 {
  margin-bottom: 4px;
  font-size: 12px;
}

.sf-eval {
  padding: 8px 10px;
  border: 1px solid var(--hb-ink);
}

.sf-profile footer {
  margin-top: 6px;
  letter-spacing: 1px;
  text-align: right;
}

.sf-profile .hb-btn {
  display: block;
  margin: 6px 0 0 auto;
}

/* 每桩旧案开头的那只档案袋（casebook.js 的卷首之前，画在 sfile.js）：和手册上那张活页纸一样大（148×202），
   排版上只占一栏（128×184，纸在栏外四边各宽出一截），画布用负的边距探出去正好盖住那张纸（字栏为它放宽了裁切，见 dossier.js 的 clipMargin）。
   --ox、--oy 是纸的左上角相对这一栏的位置：牌子、按钮按纸上的位置摆。手机上的报告没有纸，袋子就是它自己那么大 */
.cb-bag {
  --ox: -10px;
  --oy: -8px;
  position: relative;
  display: flow-root;
  width: calc(128px * var(--s));
  height: calc(184px * var(--s));
  line-height: 1.5;
}

.report .cb-bag {
  --ox: 0px;
  --oy: 0px;
  width: calc(148px * var(--s));
  height: auto;
  margin: 0 auto 16px;
}

.cb-sack {
  display: block;
  margin: calc(var(--oy) * var(--s)) 0 0 calc(var(--ox) * var(--s));
  cursor: pointer;
}

.report .cb-sack {
  filter: drop-shadow(calc(1px * var(--s)) calc(1px * var(--s)) 0 rgb(0 0 0 / 0.3));
}

/* 牌子挂在表格右边那片空白上 */
.cb-tag {
  position: absolute;
  left: calc((102px + var(--ox)) * var(--s));
  top: calc((73px + var(--oy)) * var(--s));
  outline: none;
  cursor: pointer;
  filter: drop-shadow(calc(1px * var(--s)) calc(1px * var(--s)) 0 rgb(0 0 0 / 0.3));
  transform-origin: 50% 20%;
  transition: rotate 0.15s steps(2);
}

.cb-tag:hover,
.cb-tag:focus-visible {
  rotate: -5deg;
}

.dossier-overlay .cb-bag .hb-btn {
  position: absolute;
  left: calc((106px + var(--ox)) * var(--s));
  top: calc((148px + var(--oy)) * var(--s));
}

/* 警告牌上的守则：纸条换成吊牌的银白和烫金字，底下一条黑白格 */
.hb-slip.sf-warn {
  background: linear-gradient(#eef0f2, #d9dcdf);
  color: #6b5320;
}

.sf-warn h4 {
  margin: 2px 0 10px;
  padding: 4px 0;
  border-block: 1px dashed #8c6d2a;
  font-family: var(--px);
  font-size: 24px;
  font-weight: normal;
  line-height: 1.2;
  letter-spacing: 6px;
  text-align: center;
}

.sf-warn .in {
  padding-left: 1em;
}

.sf-warn i {
  display: block;
  height: 12px;
  margin-top: 10px;
  background: repeating-conic-gradient(#3a3d42 0 25%, #0000 0 50%) 0 0 / 12px 12px;
}

/* 手册第一页的兜（dossier.js 的 pocket()）：正面盖在插着的物件上面；指到插着的东西，它就探出来 */
.hb-pocket {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  pointer-events: none;
}

.ditem.front {
  z-index: 3;
}

.ditem.tucked:hover,
.ditem.tucked.hot {
  translate: 0 calc(var(--s) * -8px);
}

/* 插在兜里的白玫瑰：兜口以下的茎已经从画上裁掉了，所以放在最外面——压过拉链（4）和夹层的照片；
   指上去只微微动一下，不往外抽（抽了会露出裁掉的那截） */
.ditem.tucked.see-through {
  z-index: 5;
}

.ditem.tucked.see-through.hot {
  translate: calc(var(--s) * -1px) calc(var(--s) * -1px);
}

/* 摊开的字条：和证件一样两面背靠背（借 .sf-id / .sf-face 翻面）。正面是瓦伦缇娜的字，红墨水，写得很顺；
   背面是塞梅尔维斯写了又删的回信 */
.hb-note {
  width: 280px;
  height: 160px;
}

.hb-note .sf-face {
  box-sizing: border-box;
  padding: 20px 18px;
  border-radius: 0;
  background: linear-gradient(#0000 calc(33% - 1px), rgb(0 0 0 / 0.1) 0, #0000 calc(33% + 1px), #0000 calc(66% - 1px), rgb(0 0 0 / 0.1) 0, #0000 calc(66% + 1px)), #efe8d6;
}

.hb-addr p {
  margin-left: 14px;
  color: var(--pen);
  font-size: 24px;
  line-height: 1.5;
  white-space: nowrap;
  transform: skewX(-14deg) rotate(-2deg);
}

.hb-reply {
  color: var(--quill);
  line-height: 1.9;
  transform: rotateY(180deg);
}

.hb-reply del {
  color: var(--hb-mute);
  text-decoration-color: #c0392b;
  text-decoration-thickness: 2px;
}

/* ── 手册第一页的物件点开，落在手册上的那几张纸（desktop.js 的 BOOK_VIEWS、dossier.js 的 doodle） ── */
.hb-slip:not(.sf-warn) > h4 {
  margin: 0 0 8px;
  font-family: var(--px);
  font-size: 12px;
  font-weight: normal;
  letter-spacing: 2px;
}

.hb-file::before,
.hb-memo::before,
.hb-grid::before {
  display: none;
}

/* 人事档案：红抬头，下面是 readme 的字 */
.hb-slip.hb-file {
  width: min(420px, 94%);
}

.hb-file h4 {
  margin: -14px -16px 10px;
  padding: 5px 16px;
  background: var(--hb-red);
  color: #efe6d2;
}

.hb-file pre,
.hb-eggs ul {
  max-height: min(56vh, 420px);
  margin: 0;
  overflow-y: auto;
  scrollbar-width: thin;
}

.hb-file pre {
  font: inherit;
  white-space: pre-wrap;
}

/* 彩蛋图鉴：一格一个小方框，找到的涂实 */
.hb-eggs ul {
  padding: 0;
  list-style: none;
}

.hb-eggs li::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 8px;
  border: 1px solid currentColor;
}

.hb-eggs li.got {
  color: var(--hb-green);
}

.hb-eggs li.got::before {
  background: currentColor;
}

.hb-eggs small {
  margin-left: 0.6em;
  color: var(--mute);
}

/* 便签：一页横线纸，左边一道红色的页边线 */
.hb-slip.hb-memo {
  width: min(360px, 94%);
  padding-left: 36px;
  background: linear-gradient(90deg, #0000 26px, #d9938c 26px 27px, #0000 27px), var(--hb-paper);
}

.dossier-overlay .hb-slip.hb-memo textarea {
  height: 16.2em;
}

.hb-letter .sig {
  margin-top: 8px;
  color: var(--hb-oxblood);
  text-align: right;
}

/* 网格纸：画布放大三倍，网格垫在底下 */
.hb-slip.hb-grid {
  width: auto;
  padding: 12px 12px 8px;
  background: var(--hb-card);
}

.hb-grid canvas {
  display: block;
  width: 300px;
  height: 372px;
  background: linear-gradient(#c3d6dc 1px, #0000 1px) 0 0 / 12px 12px, linear-gradient(90deg, #c3d6dc 1px, #0000 1px) 0 0 / 12px 12px;
  image-rendering: pixelated;
  touch-action: none;
  cursor: crosshair;
}

.hb-grid .hb-row {
  max-width: 300px;
}

/* ── 手册第一页的暗拉锁（dossier.js 的 zipArt）：合着时只是左边一道缝线，拉头是唯一的破绽；拉开了牙从上往下分开 ── */
.hb-zip {
  position: absolute;
  z-index: 4;
  left: calc(1px * var(--s));
  top: calc(9px * var(--s));
  width: calc(5px * var(--s));
  height: calc(156px * var(--s));
  background: var(--zs) 0 0 / 100% 100%;
  image-rendering: pixelated;
  pointer-events: none;
}

.hb-zip i {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 0;
  background: var(--zo) 0 0 / 100% calc(156px * var(--s));
  transition: height 0.5s steps(13);
}

.hb-zip b {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: calc(7px * var(--s));
  outline: none;
  background: var(--zp) 0 0 / 100% 100%;
  cursor: pointer;
  pointer-events: auto;
  transition: top 0.5s steps(13);
}

.hb-zip b:hover,
.hb-zip b:focus-visible {
  filter: brightness(1.5);
}

.hb-zip.open i {
  height: 100%;
}

.hb-zip.open b {
  top: calc(149px * var(--s));
}

/* ── 瓦伦缇娜的调查档案（sfile.js 的 subjectFile）：活页纸 ── */
.sf-subject {
  position: relative;
  box-sizing: border-box;
  width: 380px;
  padding: 16px 16px 10px 34px;
  /* 左边一排活页孔 */
  background: radial-gradient(circle 4px at 14px 50%, #3a3d42 99%, #0000) 0 0 / 100% 96px, #e3e1dc;
  box-shadow: 3px 3px 0 rgb(0 0 0 / 0.4);
  color: var(--hb-ink);
  line-height: 1.5;
  user-select: text;
}

.sf-subject header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.sf-subject header div {
  flex: 1;
}

.sf-subject header span,
.sf-subject header li,
.sf-subject small {
  font-family: var(--px10);
  font-size: 10px;
}

.sf-subject header ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sf-subject header li {
  width: 92px;
  margin-bottom: 2px;
  padding: 0 3px;
  border: 1px solid var(--hb-rule);
  color: var(--hb-mute);
  line-height: 12px;
}

/* 紫色的栏头，左边留一块白底写栏名 */
.sf-subject h5 {
  margin: 0 0 4px;
  padding: 2px 0 2px 60px;
  background: #5b5a8c;
  font-family: var(--px10);
  font-size: 10px;
  line-height: 12px;
}

.sf-subject h5 b {
  padding: 0 14px 0 4px;
  background: #e3e1dc;
  color: var(--hb-mute);
  letter-spacing: 1px;
}

.sf-desc {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 78px;
  margin-bottom: 10px;
}

.sf-desc > div {
  min-height: 40px;
  padding: 2px 4px;
  border-right: 1px solid var(--hb-rule);
  border-bottom: 1px solid var(--hb-rule);
}

.sf-desc dt {
  color: var(--hb-mute);
}

.sf-desc small {
  margin-left: 4px;
}

.sf-desc dd {
  text-align: center;
}

/* 档案上的头像（72×92） */
.sf-shot {
  grid-column: 4;
  grid-row: 1 / span 3;
  align-self: start;
  margin: 2px 0 0 5px;
  border: 1px solid var(--hb-mute);
}

/* 手册最后那个锁着的档案袋（desktop.js 的 BOOK_VIEWS.sealed）：口令一行，错了印一行字，连错三次多一张红笔纸条 */
.hb-lock form {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin: 6px 0 2px;
}

.hb-lock .hb-says {
  min-height: 1.8em;
  color: var(--hb-mute);
}

/* 照着源码里的假口令输：塞梅尔维斯的回话，蓝黑墨水 */
.hb-lock .hb-s {
  margin: 6px 0 0;
  padding-top: 6px;
  border-top: 1px dashed var(--hb-rule);
  color: var(--quill, #23324a);
}

.hb-lock .hb-v {
  margin: 6px 0 0;
  padding-top: 6px;
  border-top: 1px dashed var(--hb-rule);
  color: var(--pen, #b0142a);
  transform: rotate(-0.8deg);
}

/* 撬锁人那份档案（desktop.js 的 intruderFile）：没有照片，一格斜线 */
.sf-shot.sf-noshot {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 92px;
  background: repeating-linear-gradient(45deg, #0000 0 6px, rgb(138 130 114 / 0.25) 6px 7px);
  color: var(--hb-mute);
  font-family: var(--px10);
  font-size: 10px;
  font-style: normal;
  line-height: 12px;
  text-align: center;
}

.sf-subject section {
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--hb-rule);
}

.sf-subject h6 {
  margin: 0 0 2px;
  font-size: 12px;
  font-weight: normal;
}

/* 她的红笔：斜着写的 */
.sf-subject em {
  display: block;
  color: #b0142a;
  transform: skewX(-12deg) rotate(-1.5deg);
  transform-origin: left;
}

.sf-desc em {
  font-family: var(--px10);
  font-size: 10px;
  line-height: 11px;
}

.sf-subject section em {
  margin-left: 42%;
}

/* 没填字的地方：一行行看不清的字。印的是灰的，红笔写的是红的 */
.sf-lines,
.sf-scrawl {
  display: block;
  -webkit-mask: repeating-linear-gradient(90deg, #000 0 22px, #0000 22px 26px, #000 26px 61px, #0000 61px 66px, #000 66px 80px, #0000 80px 85px);
  mask: repeating-linear-gradient(90deg, #000 0 22px, #0000 22px 26px, #000 26px 61px, #0000 61px 66px, #000 66px 80px, #0000 80px 85px);
}

.sf-lines {
  width: 78%;
  height: calc(var(--n) * 12px);
  background: repeating-linear-gradient(#0000 0 5px, var(--hb-mute) 5px 7px, #0000 7px 12px);
}

.sf-scrawl {
  width: 52%;
  height: 8px;
  background: linear-gradient(#0000 3px, #b0142a 3px 5px, #0000 5px);
}

.sf-desc .sf-scrawl {
  width: 90%;
}

/* 贴在底下的便条，旁边几点酒渍 */
.sf-subject aside {
  position: relative;
  width: 62%;
  margin: 14px 0 6px auto;
  padding: 16px 12px 10px;
  background: #efe8d6;
  box-shadow: 2px 2px 0 rgb(0 0 0 / 0.25);
  transform: rotate(2deg);
}

.sf-subject aside::before {
  content: '';
  position: absolute;
  left: calc(50% - 22px);
  top: -5px;
  width: 44px;
  height: 11px;
  background: rgb(190 140 120 / 0.85);
}

.sf-subject aside::after {
  content: '';
  position: absolute;
  right: 108%;
  top: 6px;
  width: 78px;
  height: 60px;
  background: radial-gradient(circle 13px at 46px 34px, rgb(150 20 40 / 0.5) 99%, #0000), radial-gradient(circle 4px at 20px 14px, rgb(150 20 40 / 0.5) 99%, #0000), radial-gradient(circle 3px at 66px 10px, rgb(150 20 40 / 0.45) 99%, #0000);
}

.sf-subject aside em {
  margin: 0 0 6px;
}

.sf-subject aside .sf-scrawl {
  width: 92%;
}

.sf-subject .hb-btn {
  display: block;
  margin: 6px 0 0 auto;
}

/* 夹层里的照片点开：一张带白边的相纸 */
.sf-photo {
  margin: 0;
  padding: 10px;
  background: #f3efe6;
  box-shadow: 3px 3px 0 rgb(0 0 0 / 0.4);
}

/* 手机报告里的暗拉锁：标题后面一个小铜拉头 */
.rp-zip {
  display: inline-block;
  width: 8px;
  height: 14px;
  margin-left: 10px;
  outline: none;
  background: linear-gradient(var(--hb-ochre) 0 6px, #0000 6px 8px, var(--hb-ochre) 8px);
  vertical-align: middle;
  cursor: pointer;
}

/* ── 两枚书签（dossier.js 的 MARKS）：从左页顶上探出头，下半截压在书页后面。夹着的那页摊开时多探出来一截 ── */
.hb-mark {
  position: absolute;
  z-index: -1;
  top: calc(-9px * var(--s));
  width: calc(20px * var(--s));
  height: calc(55px * var(--s));
  outline: none;
  background: 0 0 / 100% 100% no-repeat;
  box-shadow: calc(1px * var(--s)) 0 0 rgb(0 0 0 / 0.3);
  image-rendering: pixelated;
  cursor: pointer;
  visibility: hidden;
}

.hb-mark[hidden] {
  display: none;
}

.hb-mark[data-who='s'] {
  left: calc(10px * var(--s));
}

.hb-mark[data-who='v'] {
  left: calc(34px * var(--s));
}

/* 和左页一样，等封面翻开了才露出来 */
.open .dossier .hb-mark {
  visibility: visible;
  transition: visibility 0s 0.45s, translate 0.15s steps(3);
}

.hb-mark:hover,
.hb-mark:focus-visible {
  translate: 0 calc(-3px * var(--s));
}

.hb-mark.here {
  translate: 0 calc(-8px * var(--s));
}

.hb-mark.here:hover,
.hb-mark.here:focus-visible {
  translate: 0 calc(-11px * var(--s));
}

/* 书签头上铅笔画的正字（dossier.js 的 tallyOn）：她还有几句话等着回 */
.hb-tally {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: calc(9px * var(--s));
  image-rendering: pixelated;
  pointer-events: none;
}

/* 点书签翻过去：落点那一句像被荧光笔扫了两下 */
.hb-flow .hb-flash {
  animation: hb-flash 0.5s steps(1) 3;
}

/* 拿起来看的书签：就是那张泛黄的纸，不带相纸的白边 */
.sf-photo.sf-mark {
  padding: 0;
}

/* 书签是线稿，不是像素画：缩小了看要平滑着缩，不然线会断 */
.sf-mark img {
  image-rendering: auto;
}

/* 成员档案在电脑上摊成宽的（sfile.js 的 profile）：栏目不拉满，照片靠右，评语几行排完 */
.sf-profile.wide {
  width: 700px;
}

.sf-profile.wide .sf-rows {
  justify-content: space-between;
}

.sf-profile.wide .sf-rows dl {
  flex: 0 1 380px;
}

.sf-profile.wide .sf-name {
  max-width: 380px;
}

.sf-profile.wide .sf-to {
  width: max-content;
  margin: 10px 130px 8px auto;
}

/* 读书笔记的书签带：不占侧边的索引标签，从手册下沿、靠书脊的右页垂出来一截（贴在书后面，和书签一样）；正翻到笔记就多垂一截 */
.dossier-overlay .hb-ribbon {
  position: absolute;
  z-index: -1;
  left: calc(50% + 14px * var(--s));
  bottom: calc(-15px * var(--s));
  width: calc(7px * var(--s));
  min-width: 0;
  height: calc(26px * var(--s));
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, var(--hb-oxblood) 0 72%, #6b1d18 72%);
  box-shadow: none;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 80%, 0 100%);
  cursor: pointer;
  visibility: hidden;
}

.dossier-overlay .hb-ribbon[hidden] {
  display: none;
}

.open .dossier .hb-ribbon {
  visibility: visible;
  transition: visibility 0s 0.45s, translate 0.15s steps(3);
}

.dossier-overlay .hb-ribbon:hover,
.dossier-overlay .hb-ribbon:focus-visible {
  outline: none;
  translate: 0 calc(3px * var(--s));
}

.dossier-overlay .hb-ribbon.here {
  translate: 0 calc(8px * var(--s));
}

.dossier-overlay .hb-ribbon.here:hover,
.dossier-overlay .hb-ribbon.here:focus-visible {
  translate: 0 calc(11px * var(--s));
}

/* 手机报告：书签带排在页签行最后，红布条剪个燕尾 */
.report .hb-flag.rp-ribbon,
.dossier-overlay.report button.hb-flag.rp-ribbon:not(:disabled):active {
  padding: 5px 9px 10px;
  background: var(--hb-oxblood);
  color: var(--hb-paper);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 5px), 0 100%);
}

/* 时间线自己排（第 2 号起）：电脑上拖卡片，拖到哪张上面就插到它前面；结了案对不上的画红圈 */
.cb-time .cb-item[draggable='true'] {
  cursor: grab;
}

.cb-time .cb-item.drop {
  box-shadow: 0 calc(-2px * var(--s)) 0 #b0142a;
}

.cb-time .cb-item.wrong > b {
  outline: 2px solid #b0142a;
  outline-offset: 2px;
  border-radius: 50%;
}

.cb-time .cb-item.right::before {
  background: var(--hb-green);
}

.cb-truth {
  margin: 0 0 0.6em;
  padding-left: 1.6em;
  color: var(--hb-blue);
}
