/* ==================== 课外书阅读 ==================== */
* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f4f6fb;
  color: #333;
}

.header {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #fff;
  padding: 18px 0;
  position: relative;
}
.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 132px;
  text-align: center;
}
.header h1 { margin: 0; font-size: 22px; }
.header p { margin: 4px 0 0; font-size: 13px; opacity: 0.9; }

.btn-back-home {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  padding: 6px 14px;
  border-radius: 12px;
  transition: background 0.2s;
}
.btn-back-home:hover { background: rgba(255,255,255,0.35); }

/* 阅读记录入口（左上角，与「返回练习」对称） */
.btn-records {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  background: rgba(255,255,255,0.2);
  border: none;
  padding: 6px 14px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-records:hover { background: rgba(255,255,255,0.35); }

.btn-back {
  display: inline-block;
  margin: 16px auto 0;
  background: #eef0f6;
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  color: #555;
  cursor: pointer;
}
.btn-back:hover { background: #e2e6f2; }

/* 书单 */
.books-page { max-width: 860px; margin: 20px auto; padding: 0 16px; }
.books-intro {
  text-align: center;
  color: #888;
  font-size: 14px;
  margin-bottom: 18px;
}
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.books-section__title {
  margin: 24px 0 12px;
  font-size: 16px;
  font-weight: 700;
  color: #6d28d9;
  padding-left: 10px;
  border-left: 4px solid #8b5cf6;
}
.books-section__title:first-child { margin-top: 0; }
.book-card {
  border-radius: 6px 14px 14px 6px;
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,0.22);
  transition: transform 0.18s, box-shadow 0.18s;
  position: relative;
  min-height: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  overflow: hidden;
}
.book-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 28px rgba(0,0,0,0.32);
}
.book-card__spine {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  background: rgba(0,0,0,0.22);
  border-radius: 6px 0 0 6px;
}
.book-card__icon {
  font-size: 40px;
  margin-bottom: 6px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}
.book-card__title {
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,0.35);
  letter-spacing: 0.03em;
}
.book-card__author {
  font-size: 13px;
  color: rgba(255,255,255,0.9);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  margin-top: 2px;
}
.book-card__grade {
  display: inline-block;
  margin-top: 8px;
  background: rgba(255,255,255,0.25);
  color: #fff;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.book-card__full {
  display: inline-block;
  margin-top: 6px;
  margin-left: 6px;
  background: #fef3c7;
  color: #b45309;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
}
/* 青少精读是首推入口（紫=主路径），原著全文是进阶入口（琥珀=附录） */
.book-card__jingdu {
  display: inline-block;
  margin-top: 6px;
  background: #ede9fe;
  color: #6d28d9;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 700;
}

/* 章节页 */
.chapters-page { max-width: 760px; margin: 0 auto; padding: 0 16px 30px; }
.book-detail {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.book-detail__icon { font-size: 48px; }
.book-detail__title { font-size: 20px; font-weight: 700; }
.book-detail__author { font-size: 13px; color: #888; margin-top: 4px; }
.book-detail__count { font-size: 12px; color: #aaa; margin-top: 4px; }
.chapters-list { display: flex; flex-direction: column; gap: 10px; }
.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  border: none;
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 15px;
  color: #333;
  cursor: pointer;
  text-align: left;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
  transition: background 0.15s;
}
.chapter-item:hover { background: #f5f3ff; }
.chapter-item__arrow { font-size: 13px; color: #8b5cf6; }
.chapters-divider {
  margin: 18px 0 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  color: #b45309;
  background: #fef3c7;
  border-radius: 12px;
  padding: 10px;
}
.chapter-item--full .chapter-item__arrow { color: #b45309; }

/* 青少精读：紫色分隔条 + 条目左侧一道细边，跟原著全文一眼分得开 */
.chapters-divider--jingdu {
  color: #6d28d9;
  background: #ede9fe;
}
.chapter-item--jingdu { border-left: 4px solid #c4b5fd; }
.chapter-item--jingdu:hover { background: #f5f3ff; }

/* 读到哪儿打勾：章节列表里的勾与「打勾」小按钮 */
.chapter-item--marked { background: #f0fdf4; box-shadow: 0 2px 8px rgba(16,185,129,0.16); }
.chapter-item--marked:hover { background: #dcfce7; }
.chapter-item__title { flex: 1; min-width: 0; }
.chapter-item__mark {
  font-size: 12px;
  color: #059669;
  font-weight: 700;
  margin-right: 6px;
  white-space: nowrap;
}
.chapter-btn--mark { color: #059669; border-color: #a7f3d0; background: #f0fdf4; }
.chapter-btn--mark:hover { background: #dcfce7; }

/* 原著全文：分组标题（国风/小雅、内篇/外篇…） */
.chapters-group {
  margin: 16px 0 2px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: #7c3aed;
  background: #f3f0ff;
  border-left: 4px solid #8b5cf6;
  border-radius: 6px;
}
/* 长篇目快速查找（诗经311篇、红楼梦120回等） */
.chapters-filter { margin: 12px 0 4px; }
.chapters-filter__input {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 14px;
  font-size: 15px;
  border: 1.5px solid #ddd6fe;
  border-radius: 12px;
  outline: none;
  background: #fff;
}
.chapters-filter__input:focus { border-color: #8b5cf6; }
.chapters-filter__hint { font-size: 12px; color: #8b5cf6; margin-top: 6px; padding-left: 4px; }
/* 原文按章加载时的提示 */
.reader-loading { text-align: center; color: #999; font-size: 15px; padding: 40px 0; }

/* 章节双按钮：听读 / 阅读 */
.chapter-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chapter-item__title { flex: 1; font-size: 15px; }
.chapter-item__actions { display: flex; gap: 6px; flex-shrink: 0; }
.chapter-btn {
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  background: #ede9fe;
  color: #6d28d9;
  transition: background 0.15s;
}
.chapter-btn:hover { background: #ddd6fe; }
.chapter-btn--read {
  background: #ecfdf5;
  color: #047857;
}
.chapter-btn--read:hover { background: #d1fae5; }

/* 继续阅读按钮 */
.book-detail__resume { margin-top: 8px; }
.btn-resume {
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  background: #fef3c7;
  color: #b45309;
  font-weight: 600;
  transition: background 0.15s;
}
.btn-resume:hover { background: #fde68a; }

/* 纯文字阅读模式 */
.reader-text--reading {
  font-size: 19px;
  line-height: 2.2;
}
.reader-font-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.btn-font {
  width: 34px;
  height: 34px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #555;
  font-size: 14px;
  cursor: pointer;
}
.btn-font:hover { background: #f5f3ff; border-color: #8b5cf6; }

/* 阅读器 */
.reader-page { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }
.reader-card {
  background: #fff;
  border-radius: 16px;
  padding: 24px 22px;
  margin-top: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.reader-title {
  font-size: 18px;
  font-weight: 700;
  color: #333;
  margin-bottom: 6px;
}
.reader-author {
  font-size: 13px;
  color: #999;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f5;
}
.reader-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.btn-read {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  color: #fff;
  border: none;
  border-radius: 22px;
  padding: 10px 22px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.3);
  transition: transform 0.15s;
}
.btn-read:hover { transform: translateY(-2px); }
.btn-read--stop {
  background: #f2f3f7;
  color: #e74c3c;
  box-shadow: none;
}
.reader-hint { font-size: 12px; color: #aaa; }
.reader-text {
  font-size: 16.5px;
  line-height: 2.1;
  color: #444;
  letter-spacing: 0.02em;
}
.reader-text p {
  margin: 0 0 16px;
  text-indent: 2em;
}

/* 文言原文：白话当正文，原文缩成小字跟在后面作对照，默认显示，可一键隐藏 */
.reader-text .reader-classic {
  margin: -8px 0 20px;
  padding-left: 0.9em;
  border-left: 3px solid #ffe0b2;
  color: #9a8f7d;
  font-size: 0.82em;
  line-height: 1.85;
  text-indent: 0;
  letter-spacing: 0.01em;
}
.reader-text.hide-classic .reader-classic { display: none; }
.btn-trans {
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid #e0d5c2;
  border-radius: 999px;
  background: #fffdf7;
  color: #7a6a55;
  cursor: pointer;
}
.btn-trans--off { background: #f3f0ea; color: #b3a894; }

/* 篇末原文金句：比对照原文更轻，只作收束 */
.reader-text .reader-quote {
  margin: 26px 0 8px;
  padding: 14px 16px;
  background: #fffbeb;
  border-left: 4px solid #fcd34d;
  border-radius: 0 10px 10px 0;
  color: #8a6d3b;
  font-size: 0.88em;
  line-height: 1.9;
  text-indent: 0;
}
.reader-text .reader-quote::before {
  content: '原 著 摘 句';
  display: block;
  font-size: 11px;
  letter-spacing: 0.18em;
  color: #b45309;
  margin-bottom: 8px;
}

/* 超龄内容提示：只提醒，不删改正文 */
.reader-text .reader-warn {
  margin: 0 0 20px;
  padding: 12px 14px;
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  border-radius: 0 10px 10px 0;
  color: #92400e;
  font-size: 0.9em;
  line-height: 1.7;
  text-indent: 0;
}

/* 精读篇 → 对应回原著 */
.btn-source {
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid #ddd6fe;
  border-radius: 999px;
  background: #f5f3ff;
  color: #6d28d9;
  cursor: pointer;
}
.btn-source:hover { background: #ede9fe; border-color: #8b5cf6; }

/* 边读边记录：直接在这里开/关「语文课外阅读」那套计时+录像+录音 */
.btn-rec {
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid #f0c9b8;
  border-radius: 999px;
  background: #fff6f2;
  color: #b45309;
  cursor: pointer;
}
.btn-rec--on {
  background: #dc2626;
  border-color: #dc2626;
  color: #fff;
  font-weight: 700;
}
/* 正在记录时，录像状态那一格（分段数、占用大小） */
.reader-recbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: -8px 0 16px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #fff6f2;
  border: 1px solid #f6ddcf;
  font-size: 13px;
  color: #9a5b2a;
}
.reader-recbar__dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: #dc2626; flex: 0 0 auto;
  animation: recPulse 1.4s ease-in-out infinite;
}
@keyframes recPulse { 0%,100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) {
  .reader-recbar__dot { animation: none; }
}

/* 正文底部的翻页条 */
.reader-nav {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px dashed #eee;
}
.btn-nav {
  flex: 1;
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
  border: 1px solid #e0d5c2;
  border-radius: 12px;
  background: #fffdf7;
  color: #7a6a55;
  cursor: pointer;
}
.btn-nav--next {
  background: linear-gradient(135deg, #8b5cf6 0%, #6d28d9 100%);
  border-color: transparent;
  color: #fff;
  font-weight: 700;
}
.btn-nav:disabled { opacity: .35; cursor: default; }
.btn-nav:not(:disabled):hover { filter: brightness(0.97); }

/* 读到哪儿打勾：阅读器里的「✓ 读到这里」 */
.btn-mark {
  font-size: 13px;
  padding: 5px 12px;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  background: #f0fdf4;
  color: #059669;
  font-weight: 700;
  cursor: pointer;
}
.btn-mark:hover { background: #dcfce7; }
.btn-mark--on { background: #059669; border-color: #059669; color: #fff; }
/* 上次读到这儿的分隔标记 */
.reader-text .reader-mark {
  text-indent: 0;
  margin: 4px 0 18px;
  font-size: 12px;
  font-weight: 700;
  color: #059669;
  border-top: 2px dashed #6ee7b7;
  padding-top: 8px;
  letter-spacing: 0.05em;
}

/* ===== 阅读记录（与「语文课外阅读」共用同一份记录和本机录像/录音） ===== */
.records-page { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }
.records-card {
  background: #fff;
  border-radius: 18px;
  padding: 16px 18px;
  margin-top: 12px;
  box-shadow: 0 3px 14px rgba(0,0,0,0.05);
}
.records-card__title { font-size: 15px; font-weight: 700; color: #555; margin-bottom: 12px; }
.records-card__sub { font-size: 12px; font-weight: 400; color: #a6adbb; }
.records-card__today { margin-bottom: 12px; }
.records-today__bar { height: 8px; background: #eef3f0; border-radius: 999px; overflow: hidden; }
.records-today__fill {
  height: 100%;
  background: linear-gradient(90deg, #34d399, #0d9488);
  border-radius: 999px;
  transition: width 0.4s;
}
.records-today__text { font-size: 13px; color: #666; margin-top: 6px; }
.records-today__live { font-size: 13px; color: #0d9488; font-weight: 700; margin-top: 4px; }
.records-card__storage {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
  color: #98a2b3;
  margin: 0 0 10px;
}
.records-card__list { display: flex; flex-direction: column; gap: 8px; }
.record-item {
  border: 2px solid #eef3f0;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
}
.record-item__head { display: flex; justify-content: space-between; margin-bottom: 4px; }
.record-item__date { font-weight: 700; color: #444; }
.record-item__dur { color: #0d9488; font-weight: 800; }
.record-item__dur--done { color: #d97706; }
.record-item__books { color: #888; font-size: 12px; line-height: 1.6; }
.record-item__del {
  background: none;
  border: none;
  color: #ccc;
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  float: right;
}
.record-item__del:hover { color: #e74c3c; }
.records-empty { text-align: center; color: #bbb; font-size: 13px; padding: 12px 0; line-height: 1.9; }
.linkbtn {
  background: none;
  border: none;
  color: #ef4444;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 2px 6px;
}
.linkbtn:hover { text-decoration: underline; }
.record-item__video {
  margin-top: 8px;
  background: #fff5f5;
  border: 1px solid #ffd9d9;
  color: #b91c1c;
  border-radius: 10px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.record-item__video:hover { background: #ffecec; }
.record-item__video.open { background: #ef4444; border-color: #ef4444; color: #fff; }
.record-item__videos { margin-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.video-loading { font-size: 12px; color: #98a2b3; padding: 6px 2px; }
.video-seg {
  background: #fbfbfd;
  border: 1px solid #eef0f6;
  border-radius: 12px;
  padding: 8px 10px;
}
.video-seg__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
}
.video-seg__dl {
  background: #eef1ff;
  border: 1px solid #c9d2f5;
  color: #4a5cd4;
  border-radius: 10px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.video-seg__dl:hover { background: #dfe6ff; }
.video-seg__player { width: 100%; max-width: 420px; border-radius: 10px; background: #000; display: block; }
.video-seg__hint { font-size: 11px; color: #a6adbb; margin-top: 4px; }

/* 轻提示（打勾反馈等） */
.lx-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(16px);
  max-width: 90vw;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  padding: 12px 20px;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.28);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 99998;
  text-align: center;
}
.lx-toast--show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 600px) {
  .books-grid { grid-template-columns: repeat(2, 1fr); }
  .reader-text { font-size: 15.5px; }
  /* 顶部两个按钮改为排到标题上方，避免和标题挤在一起 */
  .header-inner { padding: 0 14px; }
  .header h1 { font-size: 19px; }
  .btn-back-home, .btn-records {
    position: static;
    transform: none;
    display: inline-block;
    font-size: 12px;
    padding: 5px 10px;
    margin: 0 4px 8px;
  }
}
