/* 《拾光留声》视觉体系 · 温润宣纸书房
   全站单一浅色基底：宣纸 #F3EFE7 + 卡片白 #FCFBF7 + 墨炭字 #1C1B19 + 细线 #DFD8CA。
   双强调色：朱砂 #A93729（声音 / 印章 / 录音核心动作）、松木绿 #2A4D45（已留声 / 成书进度）。
   金色仅作实体书封面烫金点缀（见 book.html），界面不再出现金渐变。
   字体分工：书的内容（话题 / 标题 / 正文）宋体楷体；操作控件（按钮 / 筛选 / 时间 / 状态）无衬线黑体。
   桌面 >=1024px：左 390px 纸面手机框 + 右自适应同屏；移动 <1024px：一机一角色，子女端原生 App 结构（头卡 + 吸顶筛选 + 三 Tab）。 */

:root {
  /* 故宫古宣 · 印泥绛朱 · 黛青松烟（低饱和出版级色板） */
  --base: #F3EFE7;
  --card: #FCFBF7;
  --well: #ECE7DD;
  --ink: #1C1B19;
  --ink-soft: #4E4A43;
  --mute: #756F65;
  --faint: #8B8478;
  --line: #DFD8CA;
  --seal: #A93729;
  --seal-deep: #8D2B1F;
  --seal-wash: rgba(169, 55, 41, .09);
  --pine: #2A4D45;
  --pine-deep: #1F3B35;
  --pine-wash: #E9F0EE;
  --pine-line: #C7D7D2;
  --foil: #B8933A;
  --shadow: 0 1px 2px rgba(28, 27, 25, .04), 0 12px 30px -18px rgba(28, 27, 25, .18);
  --font-ui: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    "Source Han Sans SC", "Noto Sans CJK SC", system-ui, sans-serif;
  --font-book: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC",
    "STSong", "FangSong", "SimSun", serif;
  --font-kai: "Kaiti SC", "KaiTi", "STKaiti", "Songti SC", "SimSun", serif;
}

html { font-size: 16px; }

body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background-color: var(--base);
  background-image: radial-gradient(120% 80% at 50% 0%, rgba(252, 251, 247, .55) 0%, transparent 65%);
  -webkit-font-smoothing: antialiased;
}

:focus-visible {
  outline: 3px solid var(--pine);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] { display: none !important; }

button { font-family: var(--font-ui); }

/* ------------------------------------------------------------ 舞台布局 · 一机一角色 */

.stage { display: block; }

body[data-role="elder"] .family-pane { display: none; }
body[data-role="family"] .elder-pane { display: none; }

@media (min-width: 1024px) {
  body[data-role="both"][data-demo="1"] .stage {
    display: grid;
    grid-template-columns: 390px minmax(0, 1fr);
    gap: 1.5rem;
    align-items: stretch;
    padding: 1.5rem;
    min-height: 100vh;
    box-sizing: border-box;
    max-width: 1700px;
    margin: 0 auto;
  }
  body[data-role="both"][data-demo="1"] .elder-pane, body[data-role="both"][data-demo="1"] .family-pane { min-height: 0; }
  body[data-role="both"][data-demo="1"] .phone-frame { height: calc(100vh - 3rem); min-height: 620px; }
  body[data-role="both"][data-demo="1"] .family-pane { height: calc(100vh - 3rem); min-height: 620px; overflow-y: auto; }
  body[data-role="elder"] .stage, body[data-role="family"] .stage {
    display: flex;
    justify-content: center;
    padding: 1.5rem;
    min-height: 100vh;
    box-sizing: border-box;
  }
  body[data-role="elder"] .phone-frame { height: calc(100vh - 3rem); min-height: 620px; }
  body[data-role="family"] .family-pane { width: min(1100px, 100%); min-height: calc(100vh - 3rem); }
}

@media (max-width: 1023.98px) {
  .elder-pane { min-height: 100dvh; }
  .record-zone .live-caption { max-height: 34%; }
}

/* ------------------------------------------------------------ 长辈端 · 纸面手机框 */

.phone-frame {
  width: 390px;
  max-width: 100%;
  margin: 0 auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 2.6rem;
  padding: .8rem;
  box-sizing: border-box;
  position: relative;
  box-shadow: var(--shadow);
}
.phone-notch {
  position: absolute;
  top: 1.15rem;
  left: 50%;
  transform: translateX(-50%);
  width: 5rem;
  height: .35rem;
  background: var(--line);
  border-radius: 999px;
  z-index: 2;
}
.elder-screen {
  background: var(--base);
  color: var(--ink);
  border-radius: 2rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: .6rem .9rem .7rem;
  box-sizing: border-box;
  font-size: 24px;
  line-height: 1.6;
}

@media (max-width: 1023.98px) {
  .phone-frame {
    width: 100%;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }
  .phone-notch { display: none; }
  .elder-screen {
    border-radius: 0;
    height: 100dvh;
    padding: .4rem .9rem calc(.5rem + env(safe-area-inset-bottom));
  }
}

/* 顶栏 48px：书名 + 自动读题开关（长按 2 秒进家庭空间） */
.elder-top {
  flex: none;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
}
.elder-book-name {
  font-family: var(--font-book);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .06em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.autoread-toggle {
  flex: none;
  display: flex;
  align-items: center;
  gap: .4rem;
  min-height: 40px;
  padding: .2rem .7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--mute);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
}
.autoread-toggle[aria-checked="true"] { background: var(--pine-wash); border-color: var(--pine-line); color: var(--pine); }
.autoread-knob {
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--line);
  transition: background .15s ease;
}
.autoread-knob::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--card);
  transition: transform .15s ease;
}
.autoread-toggle[aria-checked="true"] .autoread-knob { background: var(--pine); }
.autoread-toggle[aria-checked="true"] .autoread-knob::after { transform: translateX(14px); }

/* 今日一问纸签卡：占屏约 35%，点卡朗读，右下换一题圆钮 */
.topic-card {
  flex: 35 1 0;
  min-height: 0;
  position: relative;
  margin-top: .5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  overflow: hidden;
}
.topic-inner {
  height: 100%;
  box-sizing: border-box;
  padding: .8rem 1rem 3.6rem;
  overflow: hidden;
}
.topic-kicker { font-size: 15px; font-weight: 600; color: var(--seal); letter-spacing: .18em; }
.topic-text {
  font-family: var(--font-book);
  font-size: 30px;
  font-weight: 600;
  line-height: 1.5;
  margin: .3rem 0 0;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.topic-swap {
  position: absolute;
  right: .8rem;
  bottom: .8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 76px;
  height: 44px;
  padding: 0 .95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--base);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.topic-swap:hover { border-color: var(--ink); }

/* 留声主控区：占屏约 50%，拇指自然落点 */
.record-zone {
  flex: 50 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  margin-top: .5rem;
}
.live-caption {
  flex: none;
  box-sizing: border-box;
  max-height: 38%;
  overflow-y: auto;
  background: var(--card);
  border: 2px dashed var(--seal);
  border-radius: .8rem;
  padding: .5rem .8rem;
  font-family: var(--font-book);
  font-size: 26px;
  line-height: 1.6;
  margin-bottom: .4rem;
}
.live-caption[hidden] { display: none; }
.record-stage {
  flex: 1;
  min-height: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  align-items: center;
  justify-content: center;
}
.record-wrap { position: relative; width: 160px; height: 160px; flex: none; }
@media (min-width: 1024px) { .record-wrap { width: 180px; height: 180px; } }
.record-btn {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: none;
  background: var(--seal);
  color: var(--card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  cursor: pointer;
  box-shadow: 0 0 0 10px var(--seal-wash), 0 16px 30px -18px rgba(28, 27, 25, .5);
  transition: transform .12s ease;
}
.record-btn .ico-mic { width: 46px; height: 46px; }
.record-label { font-size: 22px; font-weight: 600; padding: 0 .6rem; text-align: center; line-height: 1.3; }
.record-btn:active { transform: scale(.96); }
.redo-btn {
  flex: none;
  border: none;
  background: none;
  padding: .15rem .5rem;
  color: var(--mute);
  font-family: var(--font-ui);
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.redo-btn[hidden] { display: none; }
.redo-btn:hover { color: var(--seal); }

/* 整理态：三步动画进度，原地替换录音控件 */
.record-stage.is-busy .record-wrap,
.record-stage.is-busy .record-controls,
.record-stage.is-busy .record-timer,
.record-stage.is-busy .redo-btn { display: none; }
.process-steps { display: flex; flex-direction: column; gap: .9rem; align-items: flex-start; margin: 0 auto; }
.process-steps[hidden] { display: none; }
.p-step { display: flex; align-items: center; gap: .7rem; font-size: 22px; font-weight: 500; color: var(--mute); }
.p-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line); background: var(--card); flex: none; }
.p-step.is-active { color: var(--seal); }
.p-step.is-active .p-dot { border-color: var(--seal); background: var(--seal); animation: step-pulse 1.2s ease-in-out infinite; }
.p-step.is-done { color: var(--pine); }
.p-step.is-done .p-dot { border-color: var(--pine); background: var(--pine); }
@keyframes step-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--seal-wash); }
  50% { box-shadow: 0 0 0 10px rgba(169, 55, 41, .08); }
}
.record-hint { flex: none; margin: .4rem 0 0; font-size: 18px; color: var(--mute); text-align: center; line-height: 1.5; min-height: 1.5em; }

/* 底栏：状态行 + 沉底打字文字链 */
.elder-foot { flex: none; margin-top: .3rem; display: flex; flex-direction: column; align-items: center; gap: .1rem; }
.elder-status { margin: 0; font-size: 20px; font-weight: 500; color: var(--pine); text-align: center; }
.elder-status:empty { display: none; }
.elder-status.is-error { color: var(--seal); }
.type-link {
  border: none;
  background: none;
  padding: .2rem .6rem;
  font-size: 18px;
  color: var(--mute);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.type-link:hover { color: var(--ink); }
/* 左上角返回小箭头：每个整屏步骤都可逆 */
.pane-back {
  flex: none; width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--card); color: var(--mute); cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .12s cubic-bezier(.22, 1, .36, 1);
}
.pane-back svg { width: 17px; height: 17px; }
.pane-back:hover { color: var(--seal); border-color: var(--seal); background: var(--seal-wash); }
.pane-back:active { transform: scale(.94); }
.elder-top .elder-book-name { flex: 1; }
.family-top .pane-back { margin-top: .3rem; }
/* 小屏省一行：拍留影与打字改为并排半宽，状态/提示更从容 */
.elder-links { display: flex; gap: .5rem; width: 100%; margin-top: .15rem; }
.elder-links .type-link {
  flex: 1; min-width: 0; min-height: 38px;
  display: flex; align-items: center; justify-content: center;
  padding: .2rem .3rem;
  border: 1px solid var(--line); border-radius: .5rem;
  font-size: 15px; line-height: 1.3; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-decoration: none;
}
.elder-links .type-link:hover { border-color: var(--pine); color: var(--pine); }
.elder-screen { min-height: 100dvh; }
@media (max-height: 700px) {
  .topic-inner { padding: .7rem .8rem 2.6rem; }
  .topic-text { font-size: 26px; }
  .elder-status { font-size: 18px; }
  .elder-links .type-link { min-height: 34px; font-size: 14px; }
  .record-hint { font-size: 15px; }
}

/* 打字面板：整屏替换话题与主控，仍是一屏一件事 */
.elder-screen.is-typing .topic-card, .elder-screen.is-typing .record-zone { display: none; }
.elder-edit { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .6rem; margin-top: .5rem; }
.elder-edit[hidden] { display: none; }
.elder-text {
  flex: 1;
  min-height: 0;
  width: 100%;
  box-sizing: border-box;
  resize: none;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--card);
  color: var(--ink);
  padding: .8rem;
  font-family: var(--font-book);
  font-size: 24px;
  line-height: 1.8;
}
.btn-typed {
  flex: none;
  width: 100%;
  min-height: 60px;
  border-radius: .8rem;
  border: none;
  background: var(--pine);
  color: var(--card);
  font-size: 24px;
  font-weight: 600;
  cursor: pointer;
}
.btn-typed:hover { background: var(--pine-deep); }
.type-back {
  flex: none;
  border: none;
  background: none;
  padding: .2rem;
  font-size: 18px;
  color: var(--mute);
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.type-back:hover { color: var(--ink); }

/* ------------------------------------------------------------ 子女端 */

.family-pane {
  background: var(--base);
  background-image: repeating-linear-gradient(0deg, rgba(28, 27, 25, .015) 0 1px, transparent 1px 4px);
  color: var(--ink);
  padding: 1.4rem 1.4rem 3rem;
  box-sizing: border-box;
}
@media (min-width: 1024px) {
  .family-pane { border-radius: 1rem; border: 1px solid var(--line); }
}

.family-top { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; }
.family-head-text { min-width: 0; }
.family-title { font-family: var(--font-book); font-size: 1.9rem; font-weight: 600; margin: 0; line-height: 1.3; }
.family-sub { font-size: .85rem; color: var(--mute); margin: .3rem 0 0; }
.btn-space {
  margin-left: auto;
  min-height: 2.8rem;
  padding: .4rem 1.1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: .95rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-space:hover { border-color: var(--ink); }

/* 关怀 + 成书进度聚合头卡 */
.care-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .8rem;
  padding: .8rem 1rem;
  box-shadow: var(--shadow);
}
.care-ring-wrap { flex: none; display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.care-ring { position: relative; width: 64px; height: 64px; }
.care-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.cr-bg { fill: none; stroke: var(--line); stroke-width: 7; }
.cr-fg {
  fill: none;
  stroke: var(--pine);
  stroke-width: 7;
  stroke-linecap: round;
  stroke-dasharray: 213.6;
  stroke-dashoffset: 213.6;
  transition: stroke-dashoffset .4s ease;
}
.care-ring-txt {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}
.care-ring-txt b { font-size: 1.05rem; font-weight: 600; color: var(--pine); }
.care-ring-txt i { font-style: normal; font-size: .68rem; color: var(--mute); }
.care-ring-label { font-size: .68rem; color: var(--mute); }
.care-stats { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; align-items: baseline; }
.care-stat { display: flex; align-items: baseline; gap: .4rem; }
.care-stat b { font-size: 1.35rem; font-weight: 600; color: var(--pine); font-variant-numeric: tabular-nums; }
.care-stat span { font-size: .72rem; color: var(--mute); }
.care-line { flex-basis: 100%; margin: 0; font-size: .85rem; font-weight: 500; color: var(--pine); }
.care-line.is-idle { color: var(--mute); }
.btn-greet {
  flex: none;
  max-width: 8.5em;
  border: none;
  border-radius: .6rem;
  background: var(--pine);
  color: var(--card);
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.5;
  padding: .5rem .7rem;
  cursor: pointer;
}
.btn-greet:hover { background: var(--pine-deep); }
.btn-greet[hidden] { display: none; }

.btn-book {
  display: block;
  text-align: center;
  width: 100%;
  margin-top: 1rem;
  min-height: 3.4rem;
  border-radius: .8rem;
  border: none;
  background: var(--pine);
  color: var(--card);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-wrap: balance;
  cursor: pointer;
  box-shadow: 0 10px 22px -16px rgba(42, 77, 69, .8);
}
.btn-book:hover { background: var(--pine-deep); }

/* 吸顶年代胶囊 + 搜索 */
.family-filter {
  position: sticky;
  top: 0;
  z-index: 6;
  background: var(--base);
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-top: 1rem;
  padding: .5rem 0;
}
.era-pills { display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none; }
.era-pills::-webkit-scrollbar { display: none; }
.era-pill {
  flex: none;
  min-height: 2.2rem;
  padding: .3rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--mute);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
}
.era-pill.is-active { background: var(--seal-wash); border-color: var(--seal); color: var(--seal); }
.family-filter input[type="search"] {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--card);
  color: var(--ink);
  padding: .4rem .8rem;
  font-size: .95rem;
  font-family: var(--font-ui);
}
.family-filter input:focus-visible {
  outline: 2px solid var(--pine);
  outline-offset: 1px;
}

.family-body { min-height: 0; }
.tab-panel[hidden] { display: none; }

.timeline { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 1.7rem; }
.era-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.era-name { font-family: var(--font-book); font-size: 1rem; font-weight: 600; color: var(--seal); letter-spacing: .06em; }
.era-count { margin-left: auto; font-size: .8rem; color: var(--mute); }
.era-cards {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  padding-left: 1.1rem;
  border-left: 2px dotted var(--line);
}

/* 降噪卡片：年份 + 标题 + 2 行摘要 + 缩略图 + 原声播放条；点卡进详情 */
.t-card {
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .5rem;
  padding: .9rem 1rem 1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.t-card.is-new { animation: stamp-in .55s ease; }
@keyframes stamp-in {
  0% { transform: scale(.97); box-shadow: 0 0 0 3px var(--seal-wash); }
  100% { transform: scale(1); box-shadow: var(--shadow); }
}
.t-main { flex: 1; min-width: 0; }
.t-head { display: flex; align-items: center; gap: .6rem; }
.t-head .era-name { margin-left: auto; }
.t-year { font-size: .95rem; font-weight: 600; color: var(--mute); font-variant-numeric: tabular-nums; }
.t-title { font-family: var(--font-book); font-size: 1.3rem; font-weight: 500; margin: .5rem 0 .3rem; line-height: 1.4; }
.t-excerpt {
  font-family: var(--font-book);
  font-size: .95rem;
  line-height: 1.9;
  color: var(--mute);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.t-thumb {
  flex: none;
  width: 4.6rem;
  height: 4.6rem;
  margin: 0;
  box-sizing: border-box;
  background: var(--card);
  padding: .2rem;
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px -6px rgba(28, 27, 25, .4);
}
.t-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.t-foot { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.engine-tag {
  font-size: .64rem;
  font-weight: 500;
  color: var(--mute);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .1rem .55rem;
  margin-left: auto;
}

/* 原声播放条：卡片与详情共用 */
.playbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-top: .6rem;
  background: var(--base);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .35rem .7rem;
}
.pb-btn {
  flex: none;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  background: var(--seal);
  color: var(--card);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.pb-btn svg { width: .75rem; height: .75rem; }
.pb-pause { display: none; }
.playbar.is-playing .pb-play { display: none; }
.playbar.is-playing .pb-pause { display: block; }
.pb-track { flex: 1; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.pb-fill { height: 100%; width: 0; background: var(--seal); }
.pb-time { flex: none; font-size: .7rem; color: var(--mute); font-variant-numeric: tabular-nums; }
.playbar audio { display: none; }

.compare {
  margin-top: .8rem;
  border-top: 1px dashed var(--line);
  padding-top: .8rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
}
.compare[hidden] { display: none; }
@media (max-width: 640px) { .compare { grid-template-columns: 1fr; } }
.compare h4 { font-size: .72rem; letter-spacing: .12em; color: var(--mute); margin: 0 0 .4rem; }
.compare .raw, .compare .polished {
  font-family: var(--font-book);
  font-size: .9rem;
  line-height: 1.9;
  border-radius: .4rem;
  padding: .6rem .7rem;
  white-space: pre-wrap;
  max-height: 16rem;
  overflow-y: auto;
}
.compare .raw { background: var(--base); color: var(--mute); }
.compare .polished { background: var(--base); color: var(--ink); }

.family-empty {
  margin-top: 1.5rem;
  border: 2px dashed var(--line);
  border-radius: .6rem;
  padding: 2rem 1.2rem;
  text-align: center;
}
.family-empty h3 { font-family: var(--font-book); font-size: 1.25rem; margin: 0 0 .5rem; }
.family-empty p { font-size: .9rem; line-height: 1.9; color: var(--mute); margin: 0; }

/* 底部三 Tab（仅移动）：时光轴 / 传家书 / 家庭空间 */
.family-tabs { display: none; border-top: 1px solid var(--line); background: var(--card); }
.ftab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  border: none;
  background: none;
  cursor: pointer;
  padding: .5rem 0 calc(.5rem + env(safe-area-inset-bottom));
  color: var(--mute);
  font-size: .72rem;
  font-weight: 500;
}
.ftab svg { width: 22px; height: 22px; }
.ftab.is-active { color: var(--seal); }

/* 传家书 Tab */
#panelBook:not([hidden]) { display: flex; flex-direction: column; height: 100%; }
.book-tab-head { flex: none; display: flex; align-items: center; gap: .8rem; padding: .6rem .2rem; font-size: .8rem; color: var(--mute); }
#bookTabStats { font-weight: 600; color: var(--pine); }
.book-tab-hint { margin-left: auto; }
#bookTabFrame { flex: 1; min-height: 0; width: 100%; border: 1px solid var(--line); border-radius: .5rem; background: var(--card); }

/* 家庭空间 Tab */
#panelSpace { padding-bottom: 1.2rem; }
.space-tab-note { font-size: .8rem; color: var(--mute); line-height: 1.8; margin: .6rem 0 .4rem; }
.tab-panel label { display: block; font-size: .8rem; font-weight: 600; margin: .9rem 0 .3rem; }
.tab-panel input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.9rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--card);
  padding: .5rem .8rem;
  font-size: .95rem;
  font-family: var(--font-ui);
  color: var(--ink);
}

/* 全屏详情页：对比 / 编辑 / 换图 / 重润色 / 删除 集中于此 */
.detail {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(243, 239, 231, .9);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
}
.detail[hidden] { display: none; }
.detail-sheet { width: 100%; height: 100%; background: var(--base); display: flex; flex-direction: column; }
.detail-top { flex: none; display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--card); }
.detail-back { border: none; background: none; padding: .3rem .4rem; font-size: .95rem; font-weight: 600; color: var(--ink); cursor: pointer; }
.detail-back:hover { color: var(--seal); }
.detail-top .t-year { margin-left: auto; }
.detail-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem 1.1rem 1.4rem; }
.detail-title { font-family: var(--font-book); font-size: 1.6rem; font-weight: 600; margin: .2rem 0 .8rem; line-height: 1.4; }
.detail-photo {
  position: relative;
  overflow: hidden;
  border: 2px dashed var(--line);
  border-radius: .6rem;
  background: var(--card);
  min-height: 9rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
  font-size: .85rem;
  cursor: pointer;
}
.detail-photo img { width: 100%; max-height: 16rem; object-fit: cover; display: block; }
.detail-photo.is-over { border-color: var(--pine); background: var(--pine-wash); }
.dp-hint {
  position: absolute;
  right: .5rem;
  bottom: .5rem;
  background: rgba(28, 27, 25, .55);
  color: var(--card);
  font-size: .68rem;
  padding: .15rem .55rem;
  border-radius: 999px;
}
.detail-audio:not(:empty) { margin-top: .8rem; }
.detail-actions-top { display: flex; align-items: center; gap: .6rem; margin-top: .9rem; }
.detail-actions-top .engine-tag { margin-left: auto; }
.detail-body p { font-family: var(--font-book); font-size: 1.02rem; line-height: 2; text-indent: 2em; margin: 0 0 .6rem; }
.detail-compare { margin-top: 1rem; }
.detail-foot {
  flex: none;
  display: flex;
  gap: .5rem;
  padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--card);
}
.detail-foot .btn { flex: 1; }
@media (min-width: 1024px) {
  .detail { padding: 2rem; }
  .detail-sheet { width: min(760px, 100%); border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow); overflow: hidden; }
}

/* 移动：原生 App 骨架，外层零滚动，列表内部滚动 */
@media (max-width: 1023.98px) {
  .family-pane {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    padding: .5rem .9rem 0;
    overflow: hidden;
  }
  .family-top { flex: none; }
  .family-title { font-size: 1.25rem; }
  .family-sub, .btn-space, .btn-book { display: none; }
  .care-card { flex: none; margin-top: .6rem; padding: .6rem .8rem; gap: .8rem; }
  .care-ring { width: 56px; height: 56px; }
  .care-stat b { font-size: 1.15rem; }
  .family-filter { flex: none; position: static; margin-top: .5rem; padding: .2rem 0 .5rem; }
  .family-body { flex: 1; min-height: 0; }
  .family-pane.book-mode .care-card, .family-pane.book-mode .family-filter { display: none; }
  .tab-panel { height: 100%; overflow-y: auto; }
  #panelBook:not([hidden]) { overflow: hidden; }
  .timeline { margin-top: .8rem; padding-bottom: 1.2rem; gap: 1.2rem; }
  .t-foot { display: none; }
  .family-tabs { display: flex; flex: none; }
  .family-empty { margin: .8rem 0 1.2rem; }
}

/* ------------------------------------------------------------ 桌面 · 出版级书房工作台 */

.workbench { display: none; }
.wb-demo { display: none; }
.wb-only { display: none; }

.wb-top {
  flex: none;
  height: 56px;
  display: flex;
  align-items: center;
  gap: .8rem;
  padding: 0 1.2rem;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-sizing: border-box;
}
.wb-brand { font-family: var(--font-book); font-size: 1.15rem; font-weight: 600; letter-spacing: .06em; }
.wb-brand i { font-style: normal; font-family: var(--font-ui); font-size: .78rem; color: var(--mute); margin-left: .45rem; letter-spacing: .12em; }
.wb-book-name { color: var(--ink-soft); font-size: .9rem; flex: 0 1 auto; max-width: min(42vw, 560px); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-demo {
  margin-left: auto;
  align-items: center;
  min-height: 2.2rem;
  padding: .3rem .95rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--base);
  color: var(--mute);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
}
.wb-demo:hover { border-color: var(--ink); color: var(--ink); }
.wb-demo[aria-pressed="true"] { background: var(--seal-wash); border-color: var(--seal); color: var(--seal); }
.wb-demo.is-fab { position: fixed; top: .9rem; right: 1.2rem; z-index: 45; box-shadow: var(--shadow); }

.wb-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr) 420px; }

.wb-left {
  display: flex;
  flex-direction: column;
  gap: .9rem;
  min-height: 0;
  padding: 1rem .9rem;
  box-sizing: border-box;
  background: var(--card);
  border-right: 1px solid var(--line);
}
.wb-space-row { display: flex; gap: .4rem; }
.wb-space-row select {
  flex: 1;
  min-width: 0;
  min-height: 2.4rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--base);
  color: var(--ink);
  padding: .3rem .5rem;
  font-size: .85rem;
  font-family: var(--font-ui);
}
.wb-progress {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--base);
}
.wb-progress-txt { margin: 0; font-size: .76rem; color: var(--mute); line-height: 1.8; }
.wb-progress-txt b { color: var(--pine); font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.wb-tree { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: .15rem; }
.wb-tree-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  border: none;
  border-radius: .5rem;
  background: none;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 500;
  font-family: var(--font-ui);
  cursor: pointer;
  text-align: left;
}
.wb-tree-item:hover { background: var(--base); }
.wb-tree-item.is-active { background: var(--seal-wash); color: var(--seal); }
.wb-tree-count { margin-left: auto; font-size: .72rem; color: var(--mute); font-variant-numeric: tabular-nums; }
.wb-tree-item.is-active .wb-tree-count { color: var(--seal); }
.wb-left-foot { flex: none; display: flex; flex-direction: column; gap: .5rem; }
.wb-left-foot .btn { width: 100%; }
.btn-record { background: var(--seal); color: var(--card); }
.btn-record:hover { background: var(--seal-deep); }

.wb-mid { min-height: 0; display: flex; flex-direction: column; padding: 0 1rem; box-sizing: border-box; }
.wb-mid-top {
  flex: none;
  display: flex;
  gap: .5rem;
  width: min(640px, 100%);
  margin: 0 auto;
  padding: .8rem 0 .6rem;
}
.wb-mid-top input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--card);
  color: var(--ink);
  padding: .4rem .8rem;
  font-size: .95rem;
  font-family: var(--font-ui);
}
.wb-mid-top select {
  flex: none;
  min-height: 2.6rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--card);
  color: var(--ink);
  padding: .4rem .6rem;
  font-size: .85rem;
  font-family: var(--font-ui);
}
.wb-flow {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  width: min(640px, 100%);
  margin: 0 auto;
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}
.wb-flow::-webkit-scrollbar { display: none; }
.wb-flow .era-cards { padding-left: 0; border-left: none; gap: 1rem; }
.wb-empty { width: min(640px, 100%); margin: .8rem auto; }

/* 杂志卡：左文右图，摘要单行 30–38 字 */
.wb-card {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .5rem;
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow);
  cursor: pointer;
}
.wb-card.is-new { animation: stamp-in .55s ease; }
.wb-card-body { display: flex; gap: 1rem; align-items: flex-start; width: 100%; }
.wb-card-text { flex: 1; min-width: 0; }
.wb-card-foot { display: flex; justify-content: flex-end; align-items: center; min-height: 1.4rem; }
.wb-card-del {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .45rem;
  border: none;
  border-radius: .4rem;
  background: none;
  color: var(--faint);
  font-family: var(--font-ui);
  font-size: .74rem;
  cursor: pointer;
}
.wb-card-del svg { width: 14px; height: 14px; flex: none; }
.wb-card-del:hover { color: var(--seal); background: var(--seal-wash); }
.wb-excerpt {
  font-family: var(--font-book);
  font-size: 14px;
  line-height: 1.9;
  color: var(--mute);
  margin: 0;
  max-width: 38em;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.wb-card-img {
  flex: none;
  width: 150px;
  margin: 0;
  box-sizing: border-box;
  background: var(--card);
  padding: .25rem;
  border: 1px solid var(--line);
  box-shadow: 0 4px 10px -6px rgba(28, 27, 25, .4);
}
.wb-card-img img { width: 100%; height: 110px; object-fit: cover; display: block; }

.wb-right {
  min-height: 0;
  overflow-y: auto;
  padding: 1.4rem 1.2rem;
  box-sizing: border-box;
  background: var(--card);
  border-left: 1px solid var(--line);
}
.wb-right-empty { display: flex; flex-direction: column; align-items: flex-start; gap: .7rem; color: var(--mute); }
.wb-right-empty .seal { font-size: .95rem; }
.wb-right-empty h3 { font-family: var(--font-book); font-size: 1.2rem; color: var(--ink); margin: 0; }
.wb-right-empty p { font-size: .85rem; line-height: 1.9; margin: 0; }

/* 右栏视图切换 + 内联编辑 + 实时 A5 书页 */
.wb-mode { gap: .25rem; margin-left: .4rem; }
.wb-mode button {
  border: 1px solid var(--line);
  background: var(--base);
  color: var(--mute);
  font-size: .72rem;
  font-weight: 600;
  padding: .25rem .7rem;
  border-radius: 999px;
  cursor: pointer;
}
.wb-mode button.is-active { background: var(--pine-wash); border-color: var(--pine-line); color: var(--pine); }
#wbEditBox label { display: block; font-size: .72rem; font-weight: 600; margin: .7rem 0 .25rem; color: var(--mute); }
#wbEditBox input, #wbEditBox select, #wbEditBox textarea {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--card);
  padding: .45rem .7rem;
  font-size: .9rem;
  font-family: var(--font-ui);
  color: var(--ink);
}
#wbEditBox textarea { font-family: var(--font-book); line-height: 1.9; min-height: 12rem; resize: vertical; }
#wbEditBox .grid-2 { gap: .6rem; }
#wbPage { margin-top: .4rem; }
.a5-sheet {
  aspect-ratio: 148 / 210;
  overflow-y: auto;
  box-sizing: border-box;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .3rem;
  box-shadow: var(--shadow);
  padding: 1.1rem 1rem 1.4rem;
  font-family: var(--font-book);
  color: var(--ink);
}
.a5-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .68rem;
  color: var(--mute);
  border-bottom: 2px solid var(--line);
  padding-bottom: .45rem;
  margin-bottom: .7rem;
}
.a5-head .era-name { font-size: .78rem; }
.a5-title { font-size: 1.25rem; font-weight: 600; margin: 0 0 .7rem; line-height: 1.45; }
.a5-figure {
  margin: 0 0 .7rem;
  background: var(--card);
  padding: .3rem;
  border: 1px solid var(--line);
  width: fit-content;
  max-width: 100%;
  cursor: pointer;
}
.a5-figure img { display: block; width: 100%; max-height: 9rem; object-fit: cover; }
.a5-figure.a5-empty {
  width: 100%;
  min-height: 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  color: var(--mute);
  font-size: .7rem;
  font-family: var(--font-ui);
}
.a5-body p { font-size: .86rem; line-height: 2; text-indent: 2em; margin: 0 0 .5rem; text-align: justify; }
.a5-folio { text-align: center; font-size: .68rem; color: var(--mute); margin: .8rem 0 0; }
.a5-note { font-size: .68rem; color: var(--mute); margin: .5rem 0 0; font-family: var(--font-ui); }

/* 录音 / 打字抽屉 */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 58;
  background: rgba(243, 239, 231, .6);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  justify-content: flex-end;
}
.drawer {
  width: min(430px, 100%);
  height: 100%;
  box-sizing: border-box;
  background: var(--card);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: .7rem;
  padding: 1rem 1.2rem calc(1rem + env(safe-area-inset-bottom));
  overflow-y: auto;
  animation: drawer-in .22s ease;
}
@keyframes drawer-in {
  from { transform: translateX(24px); opacity: .4; }
  to { transform: none; opacity: 1; }
}
.drawer-top { display: flex; align-items: center; justify-content: space-between; }
.drawer-top h2 { font-family: var(--font-book); font-size: 1.3rem; margin: 0; }
.drawer-close { border: none; background: none; font-size: 1.3rem; color: var(--mute); cursor: pointer; padding: .2rem .5rem; }
.drawer-close:hover { color: var(--ink); }
.drawer-topic { position: relative; background: var(--base); border: 1px solid var(--line); border-radius: .7rem; padding: .7rem .9rem 2.8rem; }
.drawer-topic-text { font-family: var(--font-book); font-size: 1.15rem; font-weight: 600; line-height: 1.6; margin: .2rem 0 0; }
.drawer-swap { position: absolute; right: .6rem; bottom: .6rem; width: auto; height: 2.2rem; border-radius: 999px; padding: 0 .8rem; font-size: .78rem; }
.drawer-tabs { display: flex; gap: .4rem; }
.drawer-tabs button {
  flex: 1;
  min-height: 2.5rem;
  border-radius: .6rem;
  border: 1px solid var(--line);
  background: var(--base);
  color: var(--mute);
  font-weight: 600;
  font-size: .9rem;
  cursor: pointer;
}
.drawer-tabs button.is-active { background: var(--seal-wash); border-color: var(--seal); color: var(--seal); }
.drawer-talk { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.drawer-caption { width: 100%; max-height: 8rem; font-size: 18px; margin-bottom: 0; }
.drawer-wrap { width: 150px; height: 150px; flex: none; margin-top: .4rem; }
.drawer-wrap .record-label { font-size: 17px; }
.drawer-talk .record-hint { font-size: .85rem; }
.drawer-type { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: .6rem; }
.drawer-type textarea {
  flex: 1;
  min-height: 10rem;
  resize: none;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--base);
  padding: .7rem;
  font-family: var(--font-book);
  font-size: 1.05rem;
  line-height: 1.9;
  color: var(--ink);
}
.drawer-status { margin: 0; font-size: .85rem; font-weight: 500; color: var(--pine); min-height: 1.4em; }
.drawer-status:empty { display: none; }
.drawer-status.is-error { color: var(--seal); }

@media (min-width: 1024px) {
  body[data-role="both"]:not([data-demo="1"]) .stage { display: none; }
  body[data-role="both"]:not([data-demo="1"]) .workbench { display: flex; flex-direction: column; height: 100vh; }
  body[data-role="both"] .wb-demo { display: inline-flex; }

  /* 详情层dock进右栏：同一 DOM，移动全屏 / 桌面右栏 */
  body[data-role="both"]:not([data-demo="1"]) .detail {
    top: 56px;
    right: 0;
    bottom: 0;
    left: auto;
    width: 420px;
    padding: 0;
    background: var(--base);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  body[data-role="both"]:not([data-demo="1"]) .detail-sheet {
    width: 100%;
    border: none;
    border-left: 1px solid var(--line);
    border-radius: 0;
    box-shadow: none;
  }
  body[data-role="both"]:not([data-demo="1"]) .wb-only { display: block; }
  body[data-role="both"]:not([data-demo="1"]) .wb-mode { display: flex; }
}

@media (min-width: 1024px) and (max-width: 1279.98px) {
  .wb-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .wb-right { display: none; }
  body[data-role="both"]:not([data-demo="1"]) .detail { width: min(420px, 92vw); box-shadow: var(--shadow); }
}

/* 中栏偏窄时收紧图区，保住摘要单行 30–38 字 */
@media (min-width: 1024px) and (max-width: 1359.98px) {
  .wb-card { gap: .45rem; padding: .9rem 1rem; }
  .wb-card-body { gap: .75rem; }
  .wb-card-img { width: 120px; }
  .wb-card-img img { height: 90px; }
}

/* ------------------------------------------------------------ 印章 */

.seal {
  display: grid;
  grid-template-columns: repeat(2, 1em);
  gap: .02em .12em;
  padding: .22em .26em;
  background: var(--seal);
  color: var(--card);
  font-family: var(--font-book);
  font-size: .68rem;
  font-weight: 500;
  line-height: 1.15;
  border-radius: .18em;
  transform: rotate(-3deg);
  box-shadow: inset 0 0 0 2px var(--seal), inset 0 0 0 3.5px rgba(252, 251, 247, .8);
  flex: none;
}

/* ------------------------------------------------------------ 通用按钮 */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 2.9rem;
  padding: .5rem 1.3rem;
  border-radius: .6rem;
  border: 1px solid transparent;
  font-size: .95rem;
  font-weight: 600;
  letter-spacing: .04em;
  cursor: pointer;
  text-decoration: none;
  transition: background .12s ease, border-color .12s ease;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--pine); color: var(--card); }
.btn-primary:hover { background: var(--pine-deep); }
.btn-quiet { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-quiet:hover { border-color: var(--ink); }
.btn-danger { background: transparent; border-color: var(--seal); color: var(--seal); }
.btn-danger:hover { background: var(--seal-wash); }
.btn-danger-solid { background: var(--seal); color: var(--card); }
.btn-danger-solid:hover { background: var(--seal-deep); }
.btn-sm { min-height: 2.3rem; padding: .25rem .85rem; font-size: .8rem; }
.flex-none { flex: none; }
.ml-auto { margin-left: auto; }
.row-gap { display: flex; gap: .5rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------ 弹层 */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(243, 239, 231, .82);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: .7rem;
  width: min(34rem, 100%);
  max-height: calc(100vh - 2rem);
  max-height: calc(100dvh - 2rem);
  overflow-y: auto;
  padding: 1.3rem 1.2rem 1.4rem;
  box-shadow: var(--shadow);
}
.modal h2 { font-family: var(--font-book); font-size: 1.45rem; margin: 0 0 .5rem; line-height: 1.4; }
.modal .modal-sub { font-size: .84rem; line-height: 1.9; color: var(--mute); margin: 0 0 1rem; }
.modal label { display: block; font-size: .8rem; font-weight: 600; margin: .9rem 0 .3rem; }
.modal input[type="text"], .modal textarea, .modal select {
  width: 100%;
  box-sizing: border-box;
  min-height: 2.9rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--base);
  padding: .5rem .8rem;
  font-size: .95rem;
  font-family: var(--font-ui);
  color: var(--ink);
}
.modal textarea { min-height: 12rem; line-height: 1.95; resize: vertical; font-family: var(--font-book); }
.modal-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.2rem; }

.choice-list { display: flex; flex-direction: column; gap: .6rem; margin-top: .4rem; }
.choice {
  display: flex;
  align-items: center;
  gap: .8rem;
  width: 100%;
  text-align: left;
  min-height: 3.25rem;
  padding: .7rem .9rem;
  border: 1px solid var(--line);
  border-radius: .6rem;
  background: var(--base);
  cursor: pointer;
  color: var(--ink);
}
.choice:hover { border-color: var(--pine); }
.choice[aria-pressed="true"] { border-color: var(--pine); box-shadow: inset 0 0 0 2px var(--pine); }
.choice .choice-title { font-family: var(--font-book); font-size: 1.02rem; font-weight: 600; display: block; }
.choice .choice-sub { font-size: .74rem; color: var(--mute); display: block; margin-top: .15rem; }
.choice .choice-count { margin-left: auto; flex: none; font-size: .78rem; font-weight: 600; color: var(--pine); font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------ 提示条 */

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%);
  z-index: 80;
  max-width: min(30rem, calc(100vw - 2rem));
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 4px solid var(--pine);
  border-radius: .5rem;
  padding: .7rem 1rem;
  font-size: .9rem;
  line-height: 1.7;
  box-shadow: var(--shadow);
}
.toast[hidden] { display: none; }
.toast.is-error { border-left-color: var(--seal); }

/* ------------------------------------------------------------ 成就卡与角色锁定 */

.achieve-card { text-align: center; }
.achieve-seal { width: fit-content; margin: 0 auto .9rem; font-size: .95rem; }
.achieve-card h2 {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  letter-spacing: .18em;
  color: var(--mute);
  margin: 0 0 .3rem;
}
.achieve-kicker { font-size: .8rem; color: var(--mute); margin: 0 0 .7rem; }
.achieve-title { font-family: var(--font-book); font-size: 1.7rem; font-weight: 600; line-height: 1.5; margin: 0 0 .4rem; }
.achieve-meta { font-size: .9rem; color: var(--pine); font-weight: 500; margin: 0 0 1.1rem; }
.achieve-actions { justify-content: center; }
#achieveRead { background: var(--seal); color: var(--card); min-height: 3.4rem; font-size: 1.05rem; }
#achieveRead:hover { background: var(--seal-deep); }
.role-lock .choice { min-height: 4.4rem; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}


@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* -------------------------------- 录音态：计时胶囊 + 双大钮 */
.record-timer {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  padding: .35rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  font-family: Georgia, "Times New Roman", serif;
  font-variant-numeric: tabular-nums;
  font-size: 26px;
  line-height: 1.1;
  color: var(--ink);
  box-shadow: var(--shadow);
}
.rt-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--seal);
  animation: rt-pulse 1.4s ease-in-out infinite;
}
@keyframes rt-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--seal-wash); }
  50% { opacity: .55; box-shadow: 0 0 0 7px rgba(169, 55, 41, .06); }
}
.record-timer.is-paused { color: var(--mute); }
.record-timer.is-paused .rt-dot { animation: none; background: var(--faint); opacity: .7; }

.record-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
}
.record-controls:not([hidden]) { animation: controls-in .22s cubic-bezier(.22, 1, .36, 1) both; }
@keyframes controls-in {
  from { opacity: 0; transform: scale(.9); }
  to { opacity: 1; transform: scale(1); }
}
.ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 76px;
  padding: .4rem .6rem;
  border: 2px solid transparent;
  border-radius: 16px;
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform .16s cubic-bezier(.22, 1, .36, 1), background .18s ease,
    color .18s ease, border-color .18s ease;
}
.ctrl-btn:active { transform: scale(.98); }
.ctrl-btn:disabled { opacity: .5; cursor: not-allowed; }
.ctrl-ico { width: 20px; height: 20px; flex: none; }
.ctrl-pause { background: var(--card); border-color: var(--pine); color: var(--pine); }
.ctrl-pause:hover { background: var(--pine-wash); }
.ctrl-pause.is-paused { background: var(--pine); border-color: var(--pine); color: var(--card); }
.ctrl-pause .ctrl-ico-play { display: none; }
.ctrl-pause.is-paused .ctrl-ico-pause { display: none; }
.ctrl-pause.is-paused .ctrl-ico-play { display: block; }
.ctrl-stop { background: var(--seal); border-color: var(--seal); color: var(--card); }
.ctrl-stop:hover { background: var(--seal-deep); border-color: var(--seal-deep); }
@media (prefers-reduced-motion: reduce) {
  .record-controls:not([hidden]) { animation: none; }
  .ctrl-btn:active { transform: none; }
}

/* 桌面录音抽屉：双大钮略收窄 */
.drawer-timer { margin-top: .2rem; }
.drawer-controls { width: 100%; max-width: 340px; margin: .4rem auto 0; }

/* -------------------------------- 家人点题（长辈话题卡） */
.topic-card.is-family { border-color: var(--pine-line); background: var(--pine-wash); }
.topic-card.is-family .topic-kicker { color: var(--pine); }

/* -------------------------------- 子女远程出题行 */
.care-card { flex-wrap: wrap; }
.ask-row { flex-basis: 100%; display: flex; flex-direction: column; gap: .35rem; border-top: 1px dashed var(--line); padding-top: .6rem; }
.ask-label { font-size: .8rem; font-weight: 600; letter-spacing: .08em; color: var(--pine-deep); }
.ask-line { display: flex; gap: .45rem; }
.ask-line input {
  flex: 1; min-width: 0;
  border: 1px solid var(--line); border-radius: .5rem;
  background: var(--base); color: var(--ink);
  font-family: var(--font-book); font-size: .95rem;
  padding: .45rem .6rem;
}
.ask-line input:focus { outline: 2px solid var(--pine); outline-offset: 1px; border-color: var(--pine); }
.ask-note { margin: 0; font-size: .72rem; color: var(--mute); }

/* -------------------------------- 工作台左栏留题 + 右栏自动保存状态 */
.wb-ask { flex: none; display: flex; flex-direction: column; gap: .4rem; padding: .6rem 0; border-top: 1px dashed var(--line); }
.wb-ask label { font-size: .74rem; font-weight: 600; letter-spacing: .08em; color: var(--pine-deep); }
.wb-ask input {
  width: 100%; border: 1px solid var(--line); border-radius: .5rem;
  background: var(--base); color: var(--ink);
  font-family: var(--font-book); font-size: .85rem; padding: .4rem .5rem;
}
.wb-ask input:focus { outline: 2px solid var(--pine); outline-offset: 1px; }
.wb-ask-line { display: flex; gap: .4rem; }
.wb-ask-line .btn { flex: 1; }
.wb-savestate { margin-left: auto; font-family: var(--font-ui); font-size: .72rem; letter-spacing: .06em; color: var(--mute); white-space: nowrap; }
.wb-savestate.is-saving { color: var(--pine); }
.wb-savestate.is-saved { color: var(--pine); font-weight: 500; }
.wb-savestate.is-warn { color: var(--seal); font-weight: 500; }

/* -------------------------------- 家庭空间页脚 · 重置本机角色 */
.space-tab-foot { margin-top: 1.2rem; padding-top: .8rem; border-top: 1px dashed var(--line); text-align: center; }
.role-reset {
  appearance: none; border: none; background: none; cursor: pointer;
  color: var(--mute); font-family: var(--font-ui); font-size: .78rem;
  text-decoration: underline; text-underline-offset: 3px;
}
.role-reset:hover { color: var(--seal); }

/* -------------------------------- 家庭口令与邀请链接 */
.invite-box {
  background: var(--well); border: 1px solid var(--line); border-radius: .6rem;
  padding: .6rem .7rem; margin: .5rem 0 .8rem; font-size: .85rem;
}
.invite-box[hidden] { display: none !important; }
.invite-code { margin: 0 0 .45rem; color: var(--mute); }
.invite-code b {
  font-family: Georgia, var(--font-book); letter-spacing: .14em;
  color: var(--ink); font-size: 1.05rem;
}
.invite-links { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ============================================================
   出版级视觉收敛：轻字重 / 纸肌理 / 规整影像 / 克制动效
   ============================================================ */

/* 标题只到 600，并拉宽字距；层次靠字号与三层墨色 */
.t-title, .detail-title, .family-title, .wb-brand, .achieve-title, .a5-title,
.drawer-topic-text, .era-name, .choice .choice-title, .modal h2, .topic-kicker {
  font-weight: 600;
  letter-spacing: .06em;
}
body { color: var(--ink); }
.hint-text, .book-tab-hint, .ask-note, .wb-savestate, .care-line, .t-sub, .choice-sub { color: var(--faint); }

/* 年代数字：Georgia + 等宽数字，老期刊的精致感 */
.t-year, .book-toc .toc-year, .volume-year, .care-stat b, .wb-progress-txt b,
.care-line, .cover-span, .pb-time, .toc-entry .p {
  font-variant-numeric: tabular-nums;
}
.t-year, .book-toc .toc-year, .volume-year, .cover-span {
  font-family: Georgia, "Times New Roman", var(--font-book), serif;
  letter-spacing: .02em;
}

/* 宣纸微肌理：内联 SVG 噪点，2.8% 覆盖，不挡点击 */
body::after {
  content: ""; position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: .025;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/></filter><rect width='180' height='180' filter='url(%23n)'/></svg>");
}
@media print { body::after { display: none !important; } }

/* 照片：规整直角 + 细白相纸留边 + 柔和色温；悬停微放大还原 */
.wb-card-img, .t-thumb {
  transform: none;
  border-radius: 2px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 5px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(28, 27, 25, .05), 0 8px 18px -12px rgba(28, 27, 25, .18);
}
.wb-card-img img, .t-thumb img, .detail-photo img, .topic-photo {
  filter: saturate(.92) contrast(1.02);
  transition: transform .28s ease, filter .28s ease;
}
.wb-card:hover .wb-card-img img, .t-card:hover .t-thumb img { transform: scale(1.03); filter: none; }
.detail-photo:hover img { transform: scale(1.01); filter: none; }
.wb-card-img img { height: 110px; }
.wb-card { transition: transform .28s cubic-bezier(.22, .8, .28, 1), box-shadow .28s ease; }
.wb-card:hover { transform: translateY(-2px); border-color: #CFC6B4; }
.wb-card { box-shadow: 0 1px 2px rgba(28, 27, 25, .04), 0 14px 30px -18px rgba(28, 27, 25, .14); }

/* 中栏当前选中卡：左手边一道朱砂竖线 + 轻微抬升 */
.wb-card.is-current {
  box-shadow: inset 3px 0 0 var(--seal), 0 1px 2px rgba(28, 27, 25, .05), 0 16px 34px -20px rgba(28, 27, 25, .2);
  transform: translateY(-1px);
}

/* 系统控件重绘：细箭头下拉、柔和描边输入框 */
.wb-space-row select, .wb-mid-top select, #repolishStyle {
  appearance: none; -webkit-appearance: none;
  background-color: var(--card);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%235E584E' stroke-width='1.2' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right .55rem center;
  background-size: .6rem;
  padding-right: 1.6rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
}
.wb-mid-top input[type="search"], .ask-line input, .wb-ask input,
.detail-caption-row input, .note-line input {
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--card);
  color: var(--ink);
}
.wb-mid-top input[type="search"]:focus, .ask-line input:focus, .wb-ask input:focus,
.detail-caption-row input:focus, .note-line input:focus, .wb-space-row select:focus {
  outline: 2px solid var(--pine);
  outline-offset: 1px;
}

/* 右栏批注式编辑：标题与年份改底线输入 */
#wbTitle, #wbYear {
  border: none;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  padding: .35rem .1rem;
  font-family: var(--font-book);
}
#wbTitle:focus, #wbYear:focus {
  outline: none;
  border-bottom-color: var(--seal);
  background: rgba(169, 55, 41, .03);
  box-shadow: 0 0 0 3px rgba(42, 77, 69, .10);
}
#wbContent:focus { border-color: var(--pine); box-shadow: 0 0 0 3px rgba(42, 77, 69, .12); outline: none; }
#wbContent { border-color: var(--line); background: rgba(252, 251, 247, .7); }

/* 实时 A5：书脊内折 + 两页纸叠的厚度 */
.a5-sheet {
  position: relative;
  border-color: rgba(28, 27, 25, .08);
  box-shadow: 1px 1px 0 #F0EBE1, 2px 2px 0 #EAE3D7, 0 18px 36px -22px rgba(28, 27, 25, .28);
}
.a5-sheet::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 12px;
  background: linear-gradient(90deg, rgba(28, 27, 25, .055), rgba(28, 27, 25, 0));
  pointer-events: none;
}

/* 朱砂录音钮：漆器印钮的微光、内描边与物理回弹 */
.record-btn {
  background:
    radial-gradient(120% 100% at 30% 22%, rgba(255, 255, 255, .24), rgba(255, 255, 255, 0) 44%),
    radial-gradient(circle at 35% 28%, #BD4435 0%, var(--seal) 68%, var(--seal-deep) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .35),
    inset 0 0 0 1px rgba(255, 255, 255, .14),
    inset 0 -3px 8px rgba(0, 0, 0, .18),
    0 0 0 10px var(--seal-wash),
    0 18px 34px -20px rgba(28, 27, 25, .5);
  transition: transform .22s cubic-bezier(.22, 1, .36, 1);
}
.record-btn:active { transform: scale(.965); }

/* 克制的画册级微动效 */
.detail-sheet { animation: detail-in .18s ease both; }
@keyframes detail-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.wb-flow .era-group, .timeline .t-card { animation: rise-in .18s ease both; }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.pb-track { cursor: pointer; touch-action: none; }

/* 新版块：图注、批注、看图题、事实核对、撤销按钮、润色口味 */
.detail-caption-row { display: flex; gap: .45rem; align-items: center; margin: .55rem 0 0; }
.detail-caption-row input { flex: 1; min-width: 0; padding: .45rem .6rem; font-family: var(--font-book); font-size: .92rem; }
.detail-photo-actions { display: flex; gap: .45rem; flex-wrap: wrap; margin: .5rem 0 0; }
.detail-note-row { margin: .9rem 0 0; }
.detail-note-row label { display: block; font-size: .74rem; color: var(--faint); margin: 0 0 .3rem; letter-spacing: .04em; }
.note-line { display: flex; gap: .45rem; }
.note-line input { flex: 1; min-width: 0; padding: .45rem .6rem; font-family: var(--font-book); font-size: .92rem; }
.note-list { display: flex; flex-direction: column; gap: .35rem; margin: 0 0 .5rem; }
.note-item {
  display: flex; gap: .5rem; align-items: baseline;
  background: var(--pine-wash); border: 1px solid var(--pine-line);
  border-radius: .45rem; padding: .35rem .55rem; font-size: .82rem;
}
.note-by { flex: none; color: var(--pine-deep); font-weight: 600; font-size: .74rem; letter-spacing: .04em; }
.note-text { flex: 1; color: var(--ink); font-family: var(--font-book); }
.note-del {
  border: none; background: none; cursor: pointer; color: var(--faint);
  font-size: 1rem; line-height: 1; padding: 0 .1rem;
}
.note-del:hover { color: var(--seal); }
.a5-notes { margin-top: .5rem; padding-top: .35rem; border-top: 1px dashed rgba(28, 27, 25, .15); }
.a5-note-line { margin: .15rem 0; font-family: var(--font-kai); font-size: .6rem; color: var(--mute); }
.a5-note-line b { color: var(--seal); margin-right: .2em; font-weight: 600; }
.topic-photo {
  display: block; width: 100%; max-height: 28vh; object-fit: cover;
  border-radius: .5rem; border: 1px solid var(--pine-line);
  margin: 0 0 .5rem; background: var(--card);
}
mark.fact-warn {
  background: rgba(184, 147, 58, .24);
  color: inherit;
  border-bottom: 1px dashed rgba(184, 147, 58, .85);
  padding: 0 .1em;
  border-radius: 2px;
}
#repolishStyle { font-family: var(--font-ui); font-size: .72rem; padding: .3rem 1.6rem .3rem .5rem; color: var(--ink); }
.toast-act {
  margin-left: .7rem; border: none; background: none; cursor: pointer;
  color: var(--pine); font-family: var(--font-ui); font-size: inherit; font-weight: 600;
  text-decoration: underline; text-underline-offset: 2px;
}
.ask-clear-topic {
  align-self: flex-start; border: none; background: none; cursor: pointer; padding: 0;
  color: var(--seal); font-family: var(--font-ui); font-size: .72rem;
  text-decoration: underline; text-underline-offset: 2px;
}

/* ============================================================
   字体与按钮模组优化（按《字体与按钮模组优化指南》）
   ============================================================ */

/* 标题字距 0.05em；目录树降温；正文排版优化 */
.t-title, .a5-title, .elder-book-name { font-weight: 600; letter-spacing: .05em; }
.wb-tree-item { font-weight: 500; }
.t-excerpt, .wb-excerpt, .detail-body, .a5-body { text-rendering: optimizeLegibility; }

/* 期刊衬线数字：年份与统计 */
.t-year, .care-stat b, .wb-progress-txt b {
  font-family: Georgia, var(--font-book);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* 极小辅助字号底线 12px */
.care-ring-txt i, .care-ring-label, .a5-head, .a5-folio, .a5-note { font-size: .75rem; }

/* ---- 按钮四级权重 ---- */
.btn {
  border-radius: 8px;
  font-weight: 500;
  transition: background-color .18s ease, border-color .18s ease,
    color .18s ease, transform .12s cubic-bezier(.22, 1, .36, 1);
}
.btn-primary {
  background: var(--pine); color: var(--card); font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 6px 16px -10px rgba(42, 77, 69, .5);
}
.btn-primary:hover { background: var(--pine-deep); }
.btn-quiet { background: var(--well); border-color: transparent; color: var(--ink); }
.btn-quiet:hover { background: var(--well); border-color: var(--line); }
/* 三级幽灵：关闭/管理/取消 */
.btn-quiet[data-close], #wbSpaceManage {
  background: transparent; border-color: transparent;
}
.btn-quiet[data-close]:hover, #wbSpaceManage:hover {
  background: rgba(28, 27, 25, .05); border-color: transparent;
}
/* 四级危险：平时淡墨，悬停才变印泥红 */
.btn-danger { background: transparent; border-color: var(--line); color: var(--mute); }
.btn-danger:hover {
  color: var(--seal); background: var(--seal-wash); border-color: rgba(169, 55, 41, .3);
}
.btn-danger-solid { font-weight: 600; }
.btn-record { font-weight: 600; }
.btn:active:not(:disabled) { transform: scale(.98); }

.btn-book {
  display: flex; align-items: center; justify-content: center; gap: .45rem;
  border-radius: 8px; font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 6px 16px -10px rgba(42, 77, 69, .5);
  transition: background-color .18s ease, border-color .18s ease,
    color .18s ease, transform .12s cubic-bezier(.22, 1, .36, 1);
}
.btn-book:active { transform: scale(.98); }
.btn-greet {
  max-width: none; border: none; border-radius: 8px;
  background: var(--pine-wash); color: var(--pine);
  font-weight: 600; white-space: nowrap; padding: .5rem .9rem; font-size: .85rem;
  transition: background-color .18s ease, color .18s ease, transform .12s cubic-bezier(.22, 1, .36, 1);
}
.btn-greet:hover { background: var(--pine-line); }
.btn-greet:active { transform: scale(.98); }

/* 胶囊控件统一全圆角与轻按压 */
.era-pill, .autoread-toggle { border-radius: 999px; }
.era-pill {
  font-weight: 500;
  transition: background-color .18s ease, border-color .18s ease,
    color .18s ease, transform .12s cubic-bezier(.22, 1, .36, 1);
}
.era-pill.is-active { font-weight: 600; }
.era-pill:active { transform: scale(.98); }

/* 分段控件：浅槽容器 + 白色浮块选中态 */
.wb-mode, .drawer-tabs { background: var(--well); padding: 3px; border-radius: 10px; gap: 2px; }
.wb-mode button, .drawer-tabs button {
  border: none; background: transparent; border-radius: 7px;
  color: var(--mute); font-weight: 500;
}
.wb-mode button.is-active, .drawer-tabs button.is-active {
  background: var(--card); color: var(--ink); font-weight: 600;
  box-shadow: 0 1px 3px rgba(28, 27, 25, .10);
}
.drawer-tabs button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; }

/* 单色线性图标（替换彩色 Emoji） */
.autoread-ico, .tab-ico, .btn-ico { width: 17px; height: 17px; flex: none; display: block; }
.a5-figure figcaption { margin-top: .4rem; font-size: .68rem; text-align: center; color: var(--faint); letter-spacing: .04em; }

/* -------------------------------- 讲完追问 · 接着补充 */
.elder-screen { position: relative; }
.follow-card {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: min(520px, calc(100% - 24px)); box-sizing: border-box; z-index: 40;
  background: var(--card); border: 1px solid var(--pine-line); border-radius: .9rem;
  padding: 1rem 1.1rem;
  box-shadow: 0 1px 2px rgba(28, 27, 25, .05), 0 18px 40px -20px rgba(28, 27, 25, .3);
  animation: detail-in .18s ease both;
}
.follow-kicker { margin: 0 0 .3rem; font-size: .8rem; color: var(--pine); letter-spacing: .12em; font-weight: 600; }
.follow-text { margin: 0 0 .8rem; font-family: var(--font-book); font-size: 24px; line-height: 1.5; font-weight: 600; color: var(--ink); }
.follow-actions { display: flex; gap: .6rem; }
.follow-more {
  flex: 1; min-height: 56px; border: none; border-radius: .6rem; cursor: pointer;
  background: var(--seal); color: var(--card); font-size: 20px; font-weight: 600;
}
.follow-more:hover { background: var(--seal-deep); }
.follow-done {
  flex: none; padding: 0 1.1rem; min-height: 56px; cursor: pointer;
  border: 1px solid var(--line); border-radius: .6rem;
  background: var(--card); color: var(--mute); font-size: 18px;
}
.ask-photo-line { display: flex; gap: .8rem; align-items: center; }
.ask-photo-btn {
  border: none; background: none; cursor: pointer; padding: 0;
  color: var(--pine-deep); font-family: var(--font-ui); font-size: .72rem;
  text-decoration: underline; text-underline-offset: 2px;
}

/* -------------------------------- 单章多图 / 留影 */
.extra-photos { display: flex; flex-direction: column; gap: .5rem; margin: .6rem 0 0; }
.extra-photo {
  display: flex; gap: .5rem; align-items: center;
  background: var(--card); border: 1px solid var(--line); border-radius: .5rem; padding: .35rem .45rem;
}
.extra-photo img {
  width: 64px; height: 48px; object-fit: cover; border-radius: .3rem; flex: none;
  filter: saturate(.92) contrast(1.02);
}
.extra-photo input {
  flex: 1; min-width: 0; border: none; border-bottom: 1px solid var(--line);
  background: transparent; font-family: var(--font-book); font-size: .85rem; padding: .3rem .2rem;
}
.extra-photo input:focus { outline: none; border-bottom-color: var(--seal); }
.detail-video { margin: .7rem 0 0; }
.detail-video video { width: 100%; max-height: 320px; border-radius: .5rem; background: #111; display: block; }
.video-row { display: flex; align-items: center; gap: .6rem; margin-top: .35rem; font-size: .75rem; color: var(--faint); }
.video-modal video { width: 100%; max-height: 52vh; border-radius: .5rem; background: #111; margin: .4rem 0 .8rem; display: block; }
#videoRecBtn.is-recording { background: var(--seal); }
.a5-extra { margin-top: .35rem; }
.a5-extra img { max-height: 3.4rem; object-fit: cover; }
/* -------------------------------- 空库首访 · 宣纸欢迎建书页 */
body[data-role].is-welcome .stage,
body[data-role].is-welcome .workbench { display: none; }

.welcome {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.4rem 1rem;
  box-sizing: border-box;
}
.welcome-inner { width: min(920px, 100%); }
.welcome-minimal { width: min(560px, 100%); }
.welcome-head { text-align: center; }
.welcome-seal { font-size: .8rem; margin: 0 auto .9rem; transform: rotate(-4deg); }
.welcome-kicker { margin: 0 0 .45rem; font-size: .78rem; letter-spacing: .22em; color: var(--mute); }
.welcome-head h1 {
  margin: 0;
  font-family: var(--font-book);
  font-size: clamp(1.7rem, 4.2vw, 2.55rem);
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 1.35;
}
.welcome-quote {
  margin: .7rem auto 0;
  font-family: var(--font-kai);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--mute);
  letter-spacing: .02em;
}
.welcome-actions {
  margin-top: 1.8rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .8rem;
  padding: 1.2rem 1.3rem 1.35rem;
  box-shadow: var(--shadow);
}
.welcome-actions label { display: block; font-size: .8rem; font-weight: 600; margin: 0 0 .35rem; }
.welcome-actions input {
  flex: 1;
  min-width: 0;
  min-height: 2.9rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  background: var(--base);
  padding: .5rem .8rem;
  font-size: .95rem;
  font-family: var(--font-ui);
  color: var(--ink);
  box-sizing: border-box;
}
.welcome-actions input:focus { outline: 2px solid var(--pine-line); outline-offset: 1px; }
.welcome-hint { margin: .5rem 0 0; font-size: .74rem; color: var(--faint); line-height: 1.7; }
.welcome-sep {
  display: flex;
  align-items: center;
  gap: .7rem;
  margin: 1rem 0;
  color: var(--faint);
  font-size: .74rem;
}
.welcome-sep::before, .welcome-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.welcome-guide-link {
  display: inline-block;
  margin-top: .9rem;
  color: var(--pine-deep);
  font-size: .8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.welcome-foot {
  margin-top: 1.8rem;
  text-align: center;
  color: var(--faint);
  font-size: .72rem;
  letter-spacing: .18em;
}
@media (max-width: 760px) {
  .welcome { padding: 1.6rem .9rem 2rem; align-items: flex-start; }
  .welcome-head h1 { font-size: 1.6rem; }
  .welcome-quote { font-size: .92rem; }
  .welcome-actions { padding: 1rem; }
  .welcome-actions .row-gap { flex-wrap: wrap; }
  .welcome-actions .row-gap input { flex: 1 1 100%; }
  .welcome-actions .row-gap .btn { width: 100%; }
}

/* -------------------------------- 空时光轴 · 三步开书清单 */
.empty-checklist {
  list-style: none;
  margin: 1.2rem 0 0;
  padding: 0;
  display: grid;
  gap: .65rem;
  text-align: left;
}
.empty-checklist li {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  background: var(--base);
  border: 1px solid var(--line);
  border-radius: .55rem;
  padding: .7rem .8rem;
}
.ec-num {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--seal-wash);
  color: var(--seal);
  font-family: Georgia, "Times New Roman", serif;
  font-size: .82rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.empty-checklist b { font-family: var(--font-book); font-size: .95rem; font-weight: 600; display: block; }
.empty-checklist p { margin: .15rem 0 .45rem; font-size: .76rem; line-height: 1.7; color: var(--mute); }
.empty-checklist .btn { min-height: 2rem; padding: .15rem .75rem; font-size: .74rem; }

/* -------------------------------- 长辈首访 8 秒气泡导览 */
.elder-guide {
  position: absolute;
  left: 50%;
  bottom: max(78px, calc(env(safe-area-inset-bottom) + 70px));
  transform: translateX(-50%);
  width: min(420px, calc(100% - 26px));
  box-sizing: border-box;
  z-index: 36;
  background: var(--card);
  border: 1px solid var(--pine-line);
  border-radius: .8rem;
  padding: .8rem .9rem .7rem;
  box-shadow: 0 1px 2px rgba(28, 27, 25, .05), 0 18px 40px -20px rgba(28, 27, 25, .3);
  text-align: center;
  animation: pop-centered .18s ease both;
}
@keyframes pop-centered {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
.follow-card { animation: pop-centered .18s ease both; }
.elder-guide p {
  margin: 0 0 .55rem;
  font-family: var(--font-book);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
}
.elder-guide button {
  appearance: none;
  border: 1px solid var(--pine-line);
  background: var(--pine-wash);
  color: var(--pine-deep);
  border-radius: 999px;
  min-height: 2.2rem;
  padding: .2rem 1.1rem;
  font-size: 15px;
  cursor: pointer;
}

/* -------------------------------- 指南入口 */
.wb-guide {
  margin-left: auto;
  color: var(--mute);
  font-size: .78rem;
  letter-spacing: .08em;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
}
.wb-guide:hover { color: var(--ink); border-bottom-color: var(--ink); }
.wb-demo { margin-left: 0; }
.space-guide-link { display: inline-flex; margin-bottom: .55rem; }

/* -------------------------------- 桌面长辈端 · 去手机框原生化（/elder） */
.elder-side { display: none; }

@media (min-width: 1024px) {
  body[data-role="elder"] .phone-frame {
    width: min(1240px, calc(100vw - 3rem));
    max-width: 100%;
    height: calc(100dvh - 3rem);
    min-height: 620px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-rows: minmax(0, 1fr);
    gap: 1.2rem;
    align-items: stretch;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  body[data-role="elder"] .phone-notch { display: none; }
  body[data-role="elder"] .elder-screen {
    height: 100%;
    min-height: 0;
    border: 1px solid var(--line);
    border-radius: 1.2rem;
    padding: 1.1rem 1.5rem 1rem;
    box-shadow: var(--shadow);
  }
  body[data-role="elder"] .elder-top { height: auto; min-height: 56px; }
  body[data-role="elder"] .elder-book-name {
    font-size: 1.5rem;
    line-height: 1.35;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
  }
  body[data-role="elder"] .topic-inner {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem 1.6rem 4.2rem;
  }
  body[data-role="elder"] .topic-text { font-size: 32px; -webkit-line-clamp: 3; }
  body[data-role="elder"] .topic-swap { height: 46px; font-size: 15px; }
  body[data-role="elder"] .record-wrap { width: 200px; height: 200px; }
  body[data-role="elder"] .record-label { font-size: 24px; }
  body[data-role="elder"] .record-controls { max-width: 440px; gap: 16px; }
  body[data-role="elder"] .ctrl-btn { min-height: 84px; font-size: 24px; }
  body[data-role="elder"] .record-timer { font-size: 28px; }
  body[data-role="elder"] .record-hint { font-size: 17px; }

  body[data-role="elder"] .elder-side {
    display: flex;
    flex-direction: column;
    gap: .9rem;
    height: auto;
    min-height: 0;
    max-height: 100%;
    overflow-y: auto;
    padding-right: 2px;
    scrollbar-width: thin;
  }
}

.es-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow);
}
.es-kicker {
  margin: 0;
  font-size: .72rem;
  letter-spacing: .18em;
  color: var(--faint);
  font-weight: 600;
}
.es-book h2 {
  margin: .25rem 0 .9rem;
  font-family: var(--font-book);
  font-size: 1.55rem;
  font-weight: 600;
  letter-spacing: .04em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.es-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--well);
  overflow: hidden;
}
.es-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--pine);
  transition: width .3s ease;
}
.es-progress-txt {
  margin: .55rem 0 0;
  font-size: .8rem;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
}
.es-progress-txt b {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  color: var(--ink);
}
.es-streak { margin: .4rem 0 0; font-size: .76rem; color: var(--pine-deep); }
.es-card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; }
.es-card-head h3 { margin: 0; font-family: var(--font-book); font-size: 1rem; font-weight: 600; }
.es-card-head a {
  flex: none;
  font-size: .74rem;
  color: var(--pine-deep);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.es-recent ol { list-style: none; margin: .7rem 0 0; padding: 0; display: grid; gap: .5rem; }
.es-recent li {
  display: flex;
  flex-direction: column;
  gap: .1rem;
  padding: .5rem .65rem;
  border-radius: .55rem;
  background: var(--base);
  border: 1px solid transparent;
}
.es-recent-title {
  font-family: var(--font-book);
  font-size: .9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.es-recent-meta { font-size: .68rem; color: var(--faint); }
.es-empty { margin: .8rem 0 0; font-size: .78rem; line-height: 1.75; color: var(--mute); }
.es-tip p { margin: 0; font-size: .76rem; line-height: 1.85; color: var(--mute); }
.es-back {
  flex: none;
  display: block;
  margin-top: auto;
  padding: .4rem 0;
  text-align: center;
  font-size: .76rem;
  color: var(--mute);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.es-back:hover { color: var(--ink); }

/* -------------------------------- 长辈端 · 语音准备提示 / 成书进度 / 更多菜单 */
.tts-pending {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin-left: .55rem;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--mute);
  white-space: nowrap;
  vertical-align: middle;
}
.vs-horn {
  display: inline-flex;
  width: 16px;
  height: 16px;
  color: var(--seal);
  animation: horn-pulse 1s ease-in-out infinite;
}
.vs-horn svg { width: 100%; height: 100%; }
@keyframes horn-pulse {
  0%, 100% { opacity: .45; transform: scale(.94); }
  50% { opacity: 1; transform: scale(1.06); }
}
@media (prefers-reduced-motion: reduce) { .vs-horn { animation: none; } }

.topic-progress {
  position: absolute;
  left: 1rem;
  bottom: 1.05rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
  width: max-content;
  max-width: calc(100% - 130px);
  pointer-events: none;
}
.topic-progress-text {
  font-family: var(--font-ui);
  font-size: 11px;
  line-height: 1.2;
  color: var(--mute);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tp-bar {
  display: block;
  width: 100%;
  height: 3px;
  border-radius: 999px;
  background: var(--well);
  overflow: hidden;
}
.tp-bar span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--pine);
  transition: width .3s ease;
}
@media (min-width: 1024px) {
  body[data-role="elder"] .topic-progress-text { font-size: 12px; }
}

.elder-foot { position: relative; }
.elder-links .more-link {
  flex: 0 0 auto;
  min-width: 0;
  min-height: 38px;
  padding: 0 .55rem;
  border: none;
  background: none;
  color: var(--mute);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.elder-links .more-link:hover { color: var(--ink); border-color: transparent; }
.elder-more {
  position: absolute;
  right: 0;
  bottom: calc(100% + .5rem);
  z-index: 46;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .35rem;
  width: 210px;
  padding: .45rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: .75rem;
  box-shadow: var(--shadow);
}
.elder-more .type-link {
  flex: none;
  width: 100%;
  min-height: 38px;
  padding: 0 .85rem;
  border: 1px solid var(--line);
  border-radius: .5rem;
  font-size: 15px;
  justify-content: center;
}
.more-close {
  border: none;
  background: none;
  color: var(--mute);
  font-family: var(--font-ui);
  font-size: 14px;
  padding: .3rem .45rem;
  cursor: pointer;
}
.role-hint {
  margin: .8rem 0 0;
  font-size: .74rem;
  line-height: 1.7;
  color: var(--faint);
}
