/* 岁月留声 · AI 回忆录 —— 温暖 / 纸质 / 家庭相册风格 */
:root {
  --bg: #f6f1e7;
  --paper: #fffdf8;
  --ink: #3d3229;
  --ink-soft: #7a6a58;
  --brown: #7c4f2e;
  --brown-dark: #5f3b21;
  --gold: #c9a25e;
  --gold-soft: #efe3c8;
  --line: #e5dbc8;
  --green: #5d7a52;
  --red: #a6533f;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(95, 59, 33, 0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; }
body {
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
.boot { padding: 60px; text-align: center; color: var(--ink-soft); }

.container { max-width: 760px; margin: 0 auto; padding: 14px 14px 96px; }

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: linear-gradient(180deg, #fbf7ee, #f6f1e7);
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .brand { font-size: 1.15rem; font-weight: 700; color: var(--brown-dark); letter-spacing: 1px; }
.topbar .brand small { display: block; font-size: 0.7rem; color: var(--gold); font-weight: 400; }
.topbar .spacer { flex: 1; }
.topbar .user { font-size: 0.8rem; color: var(--ink-soft); }
.back-btn { background: none; border: none; font-size: 1.3rem; color: var(--brown); cursor: pointer; padding: 2px 6px; }

/* 卡片 */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.card-title { font-size: 1.05rem; font-weight: 700; color: var(--brown-dark); margin-bottom: 10px; }

/* 按钮 —— 大、清晰 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 12px; cursor: pointer;
  font-size: 1rem; font-weight: 600; padding: 12px 20px;
  transition: transform 0.05s;
  text-decoration: none;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--brown); color: #fff; }
.btn-gold { background: var(--gold); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--brown); color: var(--brown); }
.btn-ghost { background: #f1eadd; color: var(--brown-dark); }
.btn-danger { background: #f7e8e4; color: var(--red); }
.btn-big { width: 100%; padding: 18px; font-size: 1.2rem; border-radius: 16px; }
.btn-record { background: #b04a37; color: #fff; width: 100%; padding: 22px; font-size: 1.35rem; border-radius: 20px; box-shadow: 0 4px 14px rgba(176, 74, 55, 0.3); }
.btn-record.recording { background: #d9534f; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(217,83,79,.4);} 50% { box-shadow: 0 0 0 12px rgba(217,83,79,0);} }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; border-radius: 8px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 0.88rem; color: var(--ink-soft); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; font-size: 1rem;
  border: 1.5px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--ink); font-family: inherit;
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--gold); }

/* 统计 */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 8px; text-align: center;
}
.stat .num { font-size: 1.5rem; font-weight: 800; color: var(--brown); }
.stat .lbl { font-size: 0.75rem; color: var(--ink-soft); margin-top: 2px; }

/* 项目列表 */
.project-item { display: flex; gap: 12px; align-items: center; }
.avatar {
  width: 62px; height: 62px; border-radius: 50%; flex-shrink: 0;
  background: var(--gold-soft); color: var(--brown);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700; overflow: hidden;
  border: 2px solid var(--gold-soft);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.project-item .info { flex: 1; min-width: 0; }
.project-item .name { font-size: 1.08rem; font-weight: 700; }
.project-item .meta { font-size: 0.78rem; color: var(--ink-soft); margin-top: 3px; line-height: 1.5; }

/* 进度条 */
.progress { height: 8px; background: #ede4d3; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--brown)); border-radius: 99px; }

/* 徽章 */
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 0.72rem; font-weight: 600; }
.badge.not_started { background: #eee7da; color: var(--ink-soft); }
.badge.in_progress { background: #f5e6c8; color: #8a6d1f; }
.badge.pending_organize { background: #e8dfc5; color: #7a6210; }
.badge.pending_review { background: #f3d9c2; color: #9c5211; }
.badge.done { background: #dde8d5; color: var(--green); }
.badge.interviewing { background: #f5e6c8; color: #8a6d1f; }
.badge.ai_processing { background: #e8dfc5; color: #7a6210; }
.badge.reviewing { background: #f3d9c2; color: #9c5211; }
.badge.book_ready { background: #dde8d5; color: var(--green); }
.badge.printing { background: #e0d6ef; color: #5b4a86; }
.badge.pending { background: #f3d9c2; color: #9c5211; }
.badge.layout, .badge.to_print { background: #e8dfc5; color: #7a6210; }
.badge.shipped { background: #d5e3ee; color: #33597a; }

/* 主题卡片（两列） */
.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.topic-card {
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px;
  padding: 16px 12px; text-align: center; cursor: pointer;
}
.topic-card:active { transform: scale(0.97); }
.topic-card .tname { font-weight: 700; font-size: 0.95rem; margin-bottom: 8px; }
.topic-card.done { border-color: var(--green); background: #f4f8f0; }
.topic-card.current { border-color: var(--gold); }

/* AI 问题区 */
.ai-box {
  background: linear-gradient(160deg, #fbf5e6, #f7eeda);
  border: 1.5px solid var(--gold-soft); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px;
}
.ai-box .ai-label { font-size: 0.78rem; color: var(--gold); font-weight: 700; letter-spacing: 1px; margin-bottom: 8px; }
.ai-question { font-size: 1.18rem; font-weight: 700; color: var(--brown-dark); line-height: 1.6; min-height: 56px; }

/* 录音列表 */
.audio-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.audio-item:last-child { border-bottom: none; }
.audio-item audio { flex: 1; height: 36px; min-width: 0; }

/* 照片网格 */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-cell { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: #efe8da; }
.photo-cell img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.photo-cell .cap { font-size: 0.68rem; padding: 4px 6px; color: var(--ink-soft); background: var(--paper); }

/* 步骤进度 */
.steps { padding: 8px 0; }
.step { display: flex; align-items: center; gap: 10px; padding: 9px 0; font-size: 0.95rem; color: var(--ink-soft); }
.step.active { color: var(--brown); font-weight: 700; }
.step.finished { color: var(--green); }
.step .dot { width: 12px; height: 12px; border-radius: 50%; background: #ddd; flex-shrink: 0; }
.step.active .dot { background: var(--gold); animation: pulse 1.2s infinite; }
.step.finished .dot { background: var(--green); }

/* Tab */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; }
.tab { padding: 8px 14px; border-radius: 99px; font-size: 0.85rem; background: #eee6d6; color: var(--ink-soft); border: none; cursor: pointer; white-space: nowrap; }
.tab.on { background: var(--brown); color: #fff; }

/* 时间线 */
.timeline { position: relative; padding-left: 24px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--gold-soft); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item::before { content: ''; position: absolute; left: -22px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--gold); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--gold-soft); }
.tl-item .year { font-weight: 800; color: var(--brown); }
.tl-item .age { font-size: 0.78rem; color: var(--gold); margin-left: 8px; }
.tl-item .ttl { font-weight: 700; margin-top: 2px; }
.tl-item .desc { font-size: 0.85rem; color: var(--ink-soft); margin-top: 2px; line-height: 1.6; }
.tl-item .src { font-size: 0.72rem; color: var(--gold); margin-top: 3px; }

/* 编辑器 */
.editor-layout { display: flex; gap: 12px; }
.chapter-list { width: 200px; flex-shrink: 0; }
.chapter-list .ch { padding: 10px 12px; border-radius: 10px; font-size: 0.85rem; cursor: pointer; margin-bottom: 6px; background: #f1eadd; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chapter-list .ch.on { background: var(--brown); color: #fff; }
@media (max-width: 640px) {
  .editor-layout { flex-direction: column; }
  .chapter-list { width: 100%; display: flex; overflow-x: auto; gap: 6px; }
  .chapter-list .ch { white-space: nowrap; margin-bottom: 0; }
}

/* 书页预览（打印） */
.book-page { background: #fff; max-width: 680px; margin: 0 auto; padding: 48px 40px; box-shadow: var(--shadow); }
.book-page h1 { text-align: center; font-size: 2rem; color: var(--brown-dark); margin: 40px 0 8px; }
.book-page .subtitle { text-align: center; color: var(--gold); margin-bottom: 60px; }
.book-page h2 { font-size: 1.4rem; color: var(--brown-dark); margin: 36px 0 16px; border-bottom: 1px solid var(--gold-soft); padding-bottom: 8px; }
.book-page p { line-height: 2; margin-bottom: 14px; text-indent: 2em; }
.book-page figure { text-align: center; margin: 20px 0; }
.book-page figure img { max-width: 70%; border: 6px solid #fff; box-shadow: var(--shadow); }
.book-page figcaption { font-size: 0.8rem; color: var(--ink-soft); margin-top: 6px; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .book-page { box-shadow: none; max-width: 100%; padding: 0; }
  .book-page h2 { page-break-before: always; }
  .book-page h2:first-of-type { page-break-before: avoid; }
}

/* 表格 */
table.admin { width: 100%; border-collapse: collapse; font-size: 0.85rem; background: var(--paper); }
table.admin th, table.admin td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.admin th { color: var(--brown); font-size: 0.78rem; }
.table-wrap { overflow-x: auto; }

/* 底部导航 */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
  background: var(--paper); border-top: 1px solid var(--line);
  display: flex; max-width: 760px; margin: 0 auto;
}
.bottom-nav a {
  flex: 1; text-align: center; padding: 10px 0 12px; text-decoration: none;
  color: var(--ink-soft); font-size: 0.72rem;
}
.bottom-nav a .ico { font-size: 1.3rem; display: block; margin-bottom: 2px; }
.bottom-nav a.on { color: var(--brown); font-weight: 700; }

/* 提示 */
.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%); z-index: 99;
  background: var(--brown-dark); color: #fff; padding: 10px 22px; border-radius: 99px;
  font-size: 0.9rem; box-shadow: var(--shadow); animation: fadein 0.2s;
}
@keyframes fadein { from { opacity: 0; top: 8px; } to { opacity: 1; top: 20px; } }
.empty { text-align: center; color: var(--ink-soft); padding: 40px 0; font-size: 0.9rem; }
.hint { font-size: 0.8rem; color: var(--ink-soft); line-height: 1.6; }
.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.mt { margin-top: 12px; }
.mb { margin-bottom: 12px; }
pre.text-block { white-space: pre-wrap; font-family: inherit; font-size: 0.92rem; line-height: 1.9; background: #fbf8f0; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
