/* 留声亭 · 适老化视觉系统
 * 原则:大字(正文≥28px / 问题≥40px)、高对比、宣纸暖色、单一主行动、无时间压迫。
 */
:root {
  --paper: #f7f1e3;
  --paper-deep: #efe4cb;
  --card: #fffdf6;
  --ink: #2f2a24;
  --ink-soft: #6b5d48;
  --cinnabar: #b5442d;   /* 朱砂 */
  --gold: #a8863d;
  --green: #3f7d54;
  --serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --sans: "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--serif); color: var(--ink);
  background:
    radial-gradient(1200px 600px at 20% -10%, #fffaf0 0%, transparent 60%),
    radial-gradient(1000px 500px at 110% 110%, #f0e2c4 0%, transparent 55%),
    var(--paper);
  overflow: hidden;
}
button { font-family: inherit; cursor: pointer; }
.hidden { display: none !important; }

/* ---------- 屏幕切换 ---------- */
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 28px 40px; }

/* ---------- 通用按钮:≥64px 高,一屏一个主按钮 ---------- */
.btn {
  min-height: 68px; padding: 0 34px; font-size: 28px; border-radius: 18px;
  border: 3px solid transparent; transition: transform .08s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--cinnabar); color: #fff8ee; border-color: #93341f; box-shadow: 0 6px 0 #93341f; }
.btn-primary:active { box-shadow: 0 2px 0 #93341f; }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 3px solid #cdbb93; }
.btn-outline-gold { background: #fff8e8; color: #7a5a1e; border: 3px solid var(--gold); }
.btn-hero { font-size: 36px; min-height: 92px; padding: 0 64px; border-radius: 26px; box-shadow: 0 8px 0 #93341f, 0 16px 40px rgba(150,60,30,.25); }
.btn-row { display: flex; gap: 22px; justify-content: center; align-items: center; margin-top: 28px; flex-wrap: wrap; }
.btn-row.end { justify-content: flex-end; }
.btn-icon { background: none; border: none; font-size: 34px; color: var(--ink-soft); padding: 12px; }
.gear { position: absolute; right: 26px; top: 18px; }

/* ---------- 史官小七 ---------- */
.avatar { width: 200px; height: 200px; }
.avatar .eye, .avatar .pupil, .avatar .mouth rect { transform-origin: center; transform-box: fill-box; }
.avatar .eye, .avatar .pupil { animation: blink 5.2s infinite; }
@keyframes blink { 0%,94%,100% { transform: scaleY(1); } 96%,98% { transform: scaleY(.08); } }
.avatar.speaking .mouth rect { animation: talk .45s infinite alternate; }
@keyframes talk { from { transform: scaleY(.45); } to { transform: scaleY(1.15); } }
.avatar.listening .antenna-tip { animation: glow 1.1s infinite; }
@keyframes glow { 0%,100% { opacity: .5; r: 10; } 50% { opacity: 1; r: 13; } }

/* ---------- 待机橱窗 ---------- */
#s-attract { align-items: center; justify-content: center; text-align: center; }
.brand { font-size: 88px; letter-spacing: 18px; margin: 18px 0 6px; text-indent: 18px; }
.slogan { font-size: 32px; color: var(--ink-soft); letter-spacing: 10px; margin: 0 0 10px; }
.attract-line { font-size: 22px; color: #a08a5f; min-height: 34px; margin: 4px 0 30px; font-style: italic; }
.hint { font-size: 22px; color: var(--ink-soft); margin-top: 26px; }
.sess-list { position: absolute; left: 40px; bottom: 30px; display: flex; gap: 14px; max-width: 60%; flex-wrap: wrap; }
.sess-chip { background: var(--card); border: 2px solid #d8c9a8; border-radius: 14px; padding: 10px 20px; font-size: 20px; color: var(--ink); }
.sess-chip b { color: var(--cinnabar); }

/* ---------- 同意卡 / 引导 ---------- */
.card { background: var(--card); border: 2px solid #dccc9f; border-radius: 30px; box-shadow: 0 14px 50px rgba(90,60,20,.14); }
.consent-card { max-width: 860px; margin: auto; padding: 46px 60px; text-align: center; }
.consent-card h2 { font-size: 40px; margin: 18px 0 22px; }
.consent-list { text-align: left; font-size: 28px; line-height: 2.1; padding-left: 30px; margin: 0; }
.consent-list b { color: var(--cinnabar); }
#s-consent { justify-content: center; display: flex; }

#s-onboard { align-items: center; justify-content: center; text-align: center; }
.onboard-wrap { max-width: 900px; width: 100%; }
.ob-q { font-size: 44px; line-height: 1.5; min-height: 140px; margin: 10px 0 26px; }
.ob-input { font-size: 40px; width: 100%; max-width: 640px; padding: 18px 28px; border-radius: 20px; border: 3px solid #cdbb93; background: var(--card); font-family: var(--serif); }
.year-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 760px; margin: 14px auto; }
.year-cell { width: 108px; height: 72px; font-size: 28px; border-radius: 14px; border: 2px solid #cdbb93; background: var(--card); }
.year-cell.on { background: var(--cinnabar); color: #fff8ee; border-color: #93341f; }
.decade-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 8px; }

/* ---------- 访谈主界面 ---------- */
#s-talk { padding: 20px 36px 16px; }
.talk-head { display: flex; align-items: center; justify-content: space-between; }
.stage-dots { display: flex; gap: 10px; }
.dot { font-size: 20px; color: #a5936f; background: #efe6cf; border-radius: 999px; padding: 8px 18px; letter-spacing: 2px; }
.dot.on { background: var(--cinnabar); color: #fff6e8; }
.dot.done { background: #e2d5b0; color: #7a6a45; text-decoration: line-through; }
.talk-avatar-row { display: flex; justify-content: center; height: 118px; overflow: hidden; margin-top: -4px; }
.talk-avatar-row .avatar { width: 150px; height: 150px; }

.chat { flex: 1; overflow-y: auto; padding: 6px 8px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.bub { max-width: 78%; font-size: 30px; line-height: 1.75; padding: 18px 26px; border-radius: 22px; white-space: pre-wrap; }
.bub.bot { align-self: flex-start; background: var(--card); border: 2px solid #e3d5b2; box-shadow: 0 4px 14px rgba(120,90,40,.08); }
.bub.bot .replay { font-size: 18px; color: #a08a5f; background: none; border: 1px solid #d8c9a8; border-radius: 8px; padding: 2px 10px; margin-top: 8px; }
.bub.user { align-self: flex-end; background: #f3e7cf; border: 2px solid #dcc795; }
.bub.bot.big { font-size: 36px; border-color: #d9a26a; }

.family-btn { margin-top: 18px; font-size: 24px; min-height: 56px; }
.gentle-hint { text-align: center; font-size: 22px; color: #a08a5f; letter-spacing: 2px; margin-bottom: 8px; }

.hear-wrap { display: flex; align-items: center; gap: 14px; justify-content: center; min-height: 46px; font-size: 26px; color: var(--cinnabar); }
.hear-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--cinnabar); animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { transform: scale(.7); opacity: .5; } 50% { transform: scale(1.2); opacity: 1; } }

.talk-foot { padding-top: 6px; }
.mic-row { display: flex; justify-content: center; }
.mic-btn {
  width: 132px; height: 132px; border-radius: 50%; border: 4px solid #93341f;
  background: radial-gradient(circle at 30% 25%, #d96a48, var(--cinnabar));
  color: #fff8ee; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  box-shadow: 0 8px 0 #7e2a18, 0 18px 40px rgba(150,60,30,.35); position: relative;
}
.mic-icon { font-size: 44px; }
.mic-label { font-size: 18px; letter-spacing: 2px; }
.mic-btn.listening { animation: ring 1.4s infinite; }
@keyframes ring { 0% { box-shadow: 0 8px 0 #7e2a18, 0 0 0 0 rgba(181,68,45,.45); } 100% { box-shadow: 0 8px 0 #7e2a18, 0 0 0 46px rgba(181,68,45,0); } }
.mic-btn.disabled { filter: grayscale(.6); opacity: .55; }

.textrow { display: flex; gap: 14px; align-items: center; justify-content: center; margin-top: 14px; }
.textrow input { flex: 0 1 560px; font-size: 30px; padding: 14px 22px; border-radius: 16px; border: 3px solid #cdbb93; background: var(--card); font-family: var(--serif); }
.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip { font-size: 22px; padding: 10px 18px; border-radius: 999px; border: 2px solid #cdbb93; background: var(--card); color: var(--ink-soft); }
.ctrl-row { display: flex; gap: 18px; justify-content: center; margin-top: 14px; }
.ctrl-row .btn { min-height: 58px; font-size: 24px; }

/* ---------- 休息 ---------- */
#s-rest { align-items: center; justify-content: center; text-align: center; }
.breath { width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f7d9a8, #d9a26a); animation: breathe 6s infinite ease-in-out; margin-bottom: 30px; }
@keyframes breathe { 0%,100% { transform: scale(.85); opacity: .8; } 50% { transform: scale(1.12); opacity: 1; } }
.rest-line { font-size: 44px; letter-spacing: 6px; }

/* ---------- 素材墙 ---------- */
.wall-head { display: flex; align-items: center; justify-content: space-between; }
.wall-head h2 { font-size: 40px; margin: 0; letter-spacing: 3px; }
.wall-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; padding: 22px 4px; align-content: start; }
.wall-card { background: var(--card); border: 2px solid #dccc9f; border-left: 10px solid var(--gold); border-radius: 16px; padding: 18px 22px; box-shadow: 0 4px 16px rgba(120,90,40,.08); }
.wall-card .era { font-size: 20px; color: var(--cinnabar); letter-spacing: 2px; }
.wall-card .txt { font-size: 24px; line-height: 1.7; margin: 8px 0; }
.wall-card .meta { font-size: 17px; color: var(--ink-soft); display: flex; gap: 12px; align-items: center; }
.wall-card .stars { color: var(--gold); letter-spacing: 2px; }
.wall-card blockquote { margin: 6px 0 0; padding: 4px 14px; border-left: 4px solid #d9b98a; color: #7a4a2a; font-size: 22px; background: #faf3e3; }
.wall-empty { grid-column: 1/-1; text-align: center; font-size: 30px; color: var(--ink-soft); padding: 80px 0; }
.wall-foot { display: flex; justify-content: center; gap: 20px; padding-top: 12px; }

/* ---------- 成书 ---------- */
.book-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.book-head h2 { font-size: 32px; margin: 0; letter-spacing: 4px; flex: 1; text-align: center; }
.book-view { flex: 1; display: flex; align-items: center; justify-content: center; perspective: 2200px; overflow: hidden; }
.book-page {
  width: min(860px, 92%); max-height: 100%; overflow-y: auto; background: #fffdf6;
  border: 1px solid #d8c9a8; border-radius: 8px 22px 22px 8px; padding: 54px 70px;
  box-shadow: 24px 0 40px rgba(80,50,20,.12), inset 8px 0 12px -8px rgba(80,50,20,.25);
  font-size: 25px; line-height: 2.05; transform-style: preserve-3d; animation: turn .5s ease;
}
@keyframes turn { from { transform: rotateY(-10deg); opacity: .4; } to { transform: none; opacity: 1; } }
.book-page h1 { font-size: 46px; text-align: center; letter-spacing: 10px; margin: 60px 0 10px; }
.book-page .sub { text-align: center; color: #8a6a3a; letter-spacing: 6px; font-size: 24px; }
.book-page .epi { text-align: center; color: #a05a3a; margin-top: 90px; font-size: 28px; }
.book-page h2 { font-size: 34px; letter-spacing: 6px; border-bottom: 3px solid var(--cinnabar); padding-bottom: 10px; }
.book-page .ch-period { color: #8a6a3a; font-size: 20px; }
.book-page blockquote { border-left: 6px solid #d9b98a; background: #faf3e3; color: #7a4a2a; margin: 18px 0; padding: 10px 22px; font-size: 26px; }
.book-page table { width: 100%; border-collapse: collapse; font-size: 24px; }
.book-page td { padding: 10px 8px; border-bottom: 1px dashed #d8c9a8; }
.book-page td.y { width: 120px; color: var(--cinnabar); font-weight: 700; white-space: nowrap; }
.book-page .colo { color: #8a6a3a; text-align: center; line-height: 2.6; margin-top: 60px; }
.toc-item { font-size: 28px; padding: 12px 6px; border-bottom: 1px dashed #d8c9a8; display: flex; justify-content: space-between; }
.pageno { font-size: 24px; color: var(--ink-soft); }
.book-foot { display: flex; gap: 18px; align-items: center; justify-content: center; padding-top: 10px; }

/* ---------- 设置 ---------- */
.modal { position: fixed; inset: 0; background: rgba(40,30,15,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal-card { background: var(--card); border-radius: 24px; padding: 34px 44px; width: min(640px, 92%); max-height: 90vh; overflow-y: auto; }
.modal-card h3 { font-size: 32px; margin: 0 0 16px; }
.modal-card label { display: block; font-size: 22px; color: var(--ink-soft); margin: 16px 0 6px; }
.modal-card input, .modal-card select { width: 100%; font-size: 24px; padding: 12px 16px; border-radius: 12px; border: 2px solid #cdbb93; font-family: var(--sans); }
.cfg-hint { font-size: 19px; color: #a08a5f; margin: 6px 0 0; line-height: 1.6; }
.cfg-result { font-size: 20px; }
.dim { font-weight: normal; color: #a08a5f; font-size: 18px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%); background: #3a3125; color: #fff6e0; font-size: 24px; padding: 14px 30px; border-radius: 999px; z-index: 60; box-shadow: 0 8px 30px rgba(0,0,0,.3); }

/* ---------- 打印:只出书稿 ---------- */
@media print {
  body * { visibility: hidden; }
  #print-root, #print-root * { visibility: visible; }
  #print-root { position: absolute; inset: 0; background: #fff; }
}

@media (prefers-reduced-motion: reduce) {
  .avatar .eye, .avatar .mouth rect, .mic-btn.listening, .breath { animation: none; }
}

.diag-out { font-family: var(--sans); font-size: 17px; line-height: 1.9; background: #f6efe0; border-radius: 12px; padding: 14px 18px; white-space: pre-wrap; margin-top: 12px; }

/* 实时字幕气泡(老人说话时) */
.bub.user.live { opacity: .82; border-style: dashed; color: #7a6a52; }
