/* ===== 文心书院品牌色系 ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --teal:       #6ab7bd;
  --teal-dark:  #4a9da3;
  --teal-deep:  #2d7a80;
  --teal-light: #d1ecee;
  --teal-bg:    #f0f9fa;
  --gold:       #c8813a;
  --gold-light: #f0d9be;
  --text:       #1a3a3c;
  --text-mid:   #3d6b6e;
  --text-light: #7aabae;
  --border:     #c5e4e6;
  --shadow:     rgba(74,157,163,0.12);
  --paper:      #fafefe;
  --bg:         #f4fafb;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  line-height: 1.85;
  min-height: 100vh;
}

a { color: var(--teal-dark); text-decoration: none; }
a:hover { color: var(--teal-deep); text-decoration: underline; }

/* ===== 顶部导航 ===== */
.nav {
  background: var(--teal-deep);
  color: #fff;
  padding: 0 1.5rem;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.18);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
}

.nav-logo {
  height: 28px;
  width: auto;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}

.nav-divider {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.35);
  margin: 0 0.2rem;
}

.nav-book-title {
  font-size: 0.88rem;
  opacity: 0.85;
  font-weight: 400;
}

.nav-links { display: flex; gap: 1.2rem; }
.nav-links a { color: rgba(255,255,255,0.85); font-size: 0.88rem; }
.nav-links a:hover { color: #fff; text-decoration: none; }

/* ===== 封面区 ===== */
.cover {
  background: var(--teal-deep);
  overflow: hidden;
}

.cover-banner-img {
  width: 100%;
  display: block;
  max-height: 420px;
  object-fit: cover;
  object-position: center;
}

.cover-meta {
  display: flex;
  justify-content: center;
  gap: 1.2rem;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.72);
  padding: 0.7rem 1.5rem;
  background: var(--teal-deep);
  flex-wrap: wrap;
}

/* ===== 主内容区 ===== */
.latest-section, .toc-section {
  max-width: 760px;
  margin: 0 auto;
  padding: 2rem 1.5rem 1rem;
}

.toc-section { padding-bottom: 3rem; }

.section-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--teal-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.8rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ===== 章节卡片 ===== */
.chapter-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.8rem 2rem;
  box-shadow: 0 2px 12px var(--shadow);
}

.chapter-card-header {
  display: flex;
  align-items: baseline;
  gap: 0.8rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.chapter-num { font-size: 0.75rem; color: var(--text-light); font-weight: 600; }
.chapter-title-main { font-size: 1.35rem; font-weight: 700; color: var(--teal-deep); }
.chapter-date { font-size: 0.75rem; color: var(--text-light); margin-left: auto; }

.chapter-content { margin-top: 1.2rem; font-size: 1.05rem; line-height: 2; color: var(--text); }
.chapter-content p { margin-bottom: 1em; text-indent: 2em; }
.chapter-content p:first-child { margin-top: 0; }

.read-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1.2rem;
  background: var(--teal-dark);
  color: #fff;
  padding: 0.55rem 1.4rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s;
}

.read-more-btn:hover { background: var(--teal-deep); color: #fff; text-decoration: none; }

.content-preview { max-height: 420px; overflow: hidden; position: relative; }
.content-preview::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 120px;
  background: linear-gradient(transparent, var(--paper));
}

/* ===== 目录 ===== */
.toc-container {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.toc-part { border-bottom: 1px solid var(--border); }
.toc-part:last-child { border-bottom: none; }

.toc-part-header {
  padding: 0.7rem 1.5rem;
  background: var(--teal-bg);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--teal-dark);
  letter-spacing: 0.08em;
}

.toc-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  border-bottom: 1px solid #e8f4f5;
  text-decoration: none;
  transition: background 0.15s;
}

.toc-item:last-child { border-bottom: none; }
.toc-item:hover { background: var(--teal-bg); text-decoration: none; }

.toc-item-num { width: 2.2rem; font-size: 0.75rem; color: var(--text-light); flex-shrink: 0; }
.toc-item-title { flex: 1; font-size: 0.95rem; color: var(--text); }
.toc-item:hover .toc-item-title { color: var(--teal-deep); }
.toc-item-date { font-size: 0.72rem; color: var(--text-light); margin-left: 1rem; }

/* ===== 章节阅读页 ===== */
.chapter-page { max-width: 720px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.chapter-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--teal-dark);
  font-size: 0.85rem;
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--paper);
  transition: all 0.15s;
  text-decoration: none;
}

.nav-btn:hover { background: var(--teal-dark); color: #fff; text-decoration: none; border-color: var(--teal-dark); }
.nav-btn.disabled { opacity: 0.35; pointer-events: none; }
.chapter-toc-link { font-size: 0.8rem; color: var(--text-light); }

.chapter-header {
  text-align: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.chapter-header-part { font-size: 0.75rem; color: var(--teal); font-weight: 600; letter-spacing: 0.1em; margin-bottom: 0.5rem; }
.chapter-header-num { font-size: 0.9rem; color: var(--text-light); margin-bottom: 0.4rem; }
.chapter-header-title { font-size: clamp(1.4rem, 4vw, 1.9rem); font-weight: 800; color: var(--teal-deep); line-height: 1.3; }
.chapter-header-date { margin-top: 0.8rem; font-size: 0.78rem; color: var(--text-light); }

/* 正文 */
.chapter-body { font-size: 1.1rem; line-height: 2.05; color: var(--text); }
.chapter-body p { margin-bottom: 1.1em; text-indent: 2em; }
.chapter-body p:first-child { margin-top: 0; }

/* ===== 插图 ===== */
.chapter-illustration {
  margin: 1.8rem 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px var(--shadow);
  border: 1px solid var(--border);
}

.chapter-illustration img {
  width: 100%;
  height: auto;
  display: block;
  max-height: 380px;
  object-fit: cover;
}

.illustration-caption {
  background: var(--teal-bg);
  padding: 0.5rem 1rem;
  font-size: 0.78rem;
  color: var(--text-light);
  text-align: center;
  font-style: italic;
}

/* ===== 留言区 ===== */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}

.comments-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--teal-deep);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.comment-form {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.2rem 1.4rem;
  margin-bottom: 1.5rem;
}

.form-row { display: flex; gap: 0.8rem; margin-bottom: 0.8rem; }

.form-row input, .comment-form textarea {
  width: 100%;
  padding: 0.55rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
}

.form-row input:focus, .comment-form textarea:focus {
  outline: none;
  border-color: var(--teal);
}

.form-row input { flex: 1; }
.comment-form textarea { resize: vertical; min-height: 80px; margin-bottom: 0.8rem; }

.submit-btn {
  background: var(--teal-dark);
  color: #fff;
  border: none;
  padding: 0.55rem 1.4rem;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}

.submit-btn:hover { background: var(--teal-deep); }

.comment-list { display: flex; flex-direction: column; gap: 0.8rem; }

.comment-item {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
}

.comment-meta { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.4rem; }
.comment-name { font-weight: 700; font-size: 0.85rem; color: var(--teal-deep); }
.comment-date { font-size: 0.75rem; color: var(--text-light); }
.comment-text { font-size: 0.92rem; color: var(--text-mid); line-height: 1.7; }

/* ===== 关于页 ===== */
.about-page { max-width: 760px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.about-page h2 {
  font-size: 1.1rem;
  color: var(--teal-deep);
  margin: 2rem 0 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

/* 人物卡片 */
.char-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

@media (max-width: 680px) { .char-cards { grid-template-columns: 1fr; } }

.char-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px var(--shadow);
}

.char-portrait {
  width: 100%;
  height: 480px;
  object-fit: cover;
  object-position: top center;
  display: block;
}

.char-portrait-placeholder {
  width: 100%;
  height: 480px;
  background: linear-gradient(135deg, var(--teal-light), var(--teal-bg));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
}

.char-info { padding: 0.9rem 1rem; }
.char-name { font-weight: 700; font-size: 1.05rem; color: var(--teal-deep); margin-bottom: 0.2rem; }
.char-role { font-size: 0.75rem; color: var(--teal); font-weight: 600; margin-bottom: 0.5rem; letter-spacing: 0.04em; }
.char-desc { font-size: 0.88rem; color: var(--text-mid); line-height: 1.7; }

/* ===== 提示/加载 ===== */
.loading { text-align: center; padding: 3rem; color: var(--text-light); }
.empty { text-align: center; padding: 3rem; color: var(--text-light); }
.msg-ok { color: #2d6a4f; font-size: 0.85rem; margin-top: 0.5rem; }
.msg-err { color: #c0392b; font-size: 0.85rem; margin-top: 0.5rem; }

/* ===== 页脚 ===== */
.footer {
  background: var(--teal-deep);
  color: rgba(255,255,255,0.7);
  padding: 1.5rem;
  margin-top: 3rem;
}

.footer-inner {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.footer-logo {
  height: 20px;
  filter: brightness(0) invert(1);
  opacity: 0.85;
}

.footer-brand-name { font-size: 0.82rem; color: rgba(255,255,255,0.85); }
.footer-links { display: flex; gap: 1rem; font-size: 0.78rem; }
.footer-links a { color: rgba(255,255,255,0.65); }
.footer-links a:hover { color: rgba(255,255,255,0.9); text-decoration: none; }
.footer-copy { font-size: 0.72rem; opacity: 0.5; width: 100%; text-align: center; margin-top: 0.5rem; }

/* ===== 响应式 ===== */
@media (max-width: 600px) {
  .chapter-card { padding: 1.2rem 1rem; }
  .chapter-content { font-size: 1rem; }
  .chapter-body { font-size: 1.05rem; }
  .chapter-nav { flex-wrap: wrap; }
  .form-row { flex-direction: column; }
  .cover { padding: 2rem 1rem 1.5rem; }
  .latest-section, .toc-section, .chapter-page, .about-page { padding-left: 1rem; padding-right: 1rem; }
  .footer-inner { flex-direction: column; align-items: flex-start; }
}
