:root {
  --bg: #FAF6EF;
  --surface: #FFFFFF;
  --surface-warm: #FFFDF8;
  --border: #EAE0CE;
  --text: #2C241E;
  --text-muted: #786A5E;
  --primary: #C84B31;
  --primary-soft: #FCECE8;
  --secondary: #2E6F7E;
  --secondary-soft: #E8F3F5;
  --gold: #C68B2C;
  --shadow-sm: 0 2px 8px rgba(64, 44, 24, 0.06);
  --shadow-md: 0 8px 24px rgba(64, 44, 24, 0.09);
  --radius-lg: 18px;
  --radius-md: 12px;
  --font-ui: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif SC", "Kaiti SC", Georgia, serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.hidden {
  display: none !important;
}

.app-shell {
  max-width: 780px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 88px;
  position: relative;
}

.view {
  display: none;
  padding: 16px 16px 24px;
  animation: fadeIn 0.2s ease;
}

.view.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==================== 顶部品牌与搜索 ==================== */
.top-search-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(250, 246, 239, 0.94);
  backdrop-filter: blur(10px);
  padding: 6px 0 14px;
  margin-bottom: 10px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.brand-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.pill-btn-ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow-sm);
}

.pill-btn-ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-seal {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--primary);
  color: #FFFDF8;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 3px 10px rgba(200, 75, 49, 0.28);
}

.brand-title h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 10px 14px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(200, 75, 49, 0.12);
}

.search-icon {
  font-size: 16px;
  margin-right: 8px;
}

.search-box input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  color: var(--text);
}

.search-box input::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

.search-clear {
  border: none;
  background: #EFE7DA;
  color: var(--text-muted);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
}

/* ==================== 通用区块与按钮 ==================== */
.section {
  margin-bottom: 24px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}

.section-header h2 {
  font-size: 17px;
  font-weight: 700;
}

.muted-tag {
  font-size: 12px;
  color: var(--text-muted);
  background: #F1E9DC;
  padding: 3px 10px;
  border-radius: 999px;
}

.accent-tag {
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.pill-btn {
  border: none;
  background: var(--secondary);
  color: #fff;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.text-link-btn {
  border: none;
  background: none;
  color: var(--secondary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.primary-btn {
  border: none;
  background: var(--primary);
  color: #fff;
  padding: 10px 18px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(200, 75, 49, 0.24);
  transition: transform 0.12s, opacity 0.15s;
}

.primary-btn:hover { opacity: 0.94; }
.primary-btn:active { transform: scale(0.98); }

.secondary-btn {
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.full-width { width: 100%; }

/* ==================== 阅读历史横排书架 ==================== */
.history-shelf {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}

.history-empty-card {
  width: 100%;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.history-card {
  flex: 0 0 235px;
  display: flex;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.history-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.mini-cover {
  width: 52px;
  height: 72px;
  border-radius: 6px 8px 8px 6px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  color: #fff;
  font-family: var(--font-serif);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
  line-height: 1.25;
  box-shadow: inset 5px 0 0 rgba(0, 0, 0, 0.16);
}

.history-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.history-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-chapter {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-track {
  height: 6px;
  background: #EFE7DA;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
}

.history-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==================== 年龄段推荐横幅 & 今日精选 ==================== */
.age-banner {
  background: linear-gradient(135deg, #FFFDF8 0%, #F7EFE1 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

.age-banner-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.stage-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.stage-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.age-pill {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.stage-controls {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.stage-controls-label {
  font-size: 12px;
  color: var(--text-muted);
}

.stage-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.stage-chip {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.stage-chip.active {
  background: var(--secondary);
  border-color: var(--secondary);
  color: #fff;
  font-weight: 600;
}

.catalog-filter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-pills {
  display: flex;
  gap: 6px;
}

.filter-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
}

.filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

.icon-pill-btn.cached {
  background: #EAFAF1;
  border-color: #A9DFBF;
  color: #1E8449;
}

.toc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.toc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #D5C8B3;
  flex-shrink: 0;
}

.toc-dot.fetched {
  background: #27AE60;
}

.featured-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
  display: flex;
  gap: 16px;
  align-items: center;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

.featured-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.featured-cover {
  width: 86px;
  height: 118px;
  border-radius: 6px 10px 10px 6px;
  flex-shrink: 0;
  padding: 10px 8px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 8px 0 0 rgba(0, 0, 0, 0.18), 0 6px 14px rgba(0, 0, 0, 0.14);
}

.featured-cover-title {
  font-family: var(--font-serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}

.featured-cover-author {
  font-size: 11px;
  opacity: 0.9;
}

.featured-info {
  flex: 1;
  min-width: 0;
}

.featured-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  background: #FDF5E6;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.featured-info h3 {
  font-size: 18px;
  margin-bottom: 4px;
}

.featured-desc {
  font-size: 13px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 10px;
}

/* ==================== 实木书架 (WOODEN BOOKSHELF) ==================== */
.book-grid {
  display: block;
}

.bookshelf-case {
  background: linear-gradient(180deg, #E8D5B7 0%, #DFC6A1 100%);
  border: 8px solid #8E5B36;
  border-radius: 16px;
  box-shadow:
    inset 0 10px 22px rgba(62, 34, 12, 0.22),
    inset 0 0 0 2px rgba(255, 244, 224, 0.30),
    0 12px 28px rgba(68, 38, 16, 0.16);
  overflow: hidden;
  padding-top: 8px;
}

.shelf-tier {
  position: relative;
  background:
    linear-gradient(180deg, rgba(78, 44, 18, 0.14) 0%, rgba(78, 44, 18, 0.03) 24%, transparent 55%, rgba(78, 44, 18, 0.08) 100%),
    repeating-linear-gradient(
      90deg,
      rgba(120, 74, 34, 0.03) 0px,
      rgba(120, 74, 34, 0.03) 1px,
      transparent 1px,
      transparent 90px
    );
}

.shelf-books {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  justify-items: center;
  gap: 18px;
  padding: 24px 22px 0;
}

.shelf-plank {
  position: relative;
  height: 24px;
  background: linear-gradient(
    180deg,
    #E2BA8D 0%,
    #CFA06C 34%,
    #A97142 35%,
    #8A562F 100%
  );
  border-top: 1px solid rgba(255, 245, 228, 0.72);
  border-bottom: 2px solid #693E1E;
  box-shadow: 0 8px 16px rgba(52, 28, 10, 0.28);
  z-index: 2;
}

.shelf-plank::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    transparent 44px,
    rgba(88, 48, 18, 0.06) 45px,
    transparent 47px
  );
  pointer-events: none;
}

/* 真实比例立体中式精装/线装书（严格保持 1 : 1.44 修长书本比例，永不变形） */
.shelf-book {
  position: relative;
  width: 100%;
  max-width: 136px;
  aspect-ratio: 10 / 14.4;
  border-radius: 3px 6px 3px 2px;
  padding: 11px 11px 10px 21px;
  color: #FFFDF8;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transform-origin: bottom center;
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.22s ease;
  /* 书封织布肌理 + 柔和左上光源 + 左侧真实书脊压痕 */
  background-image:
    linear-gradient(
      90deg,
      rgba(0, 0, 0, 0.28) 0px,
      rgba(0, 0, 0, 0.14) 8px,
      rgba(255, 255, 255, 0.22) 11px,
      rgba(0, 0, 0, 0.16) 13px,
      rgba(255, 255, 255, 0.06) 16px,
      transparent 28px
    ),
    linear-gradient(
      145deg,
      rgba(255, 255, 255, 0.14) 0%,
      transparent 48%,
      rgba(0, 0, 0, 0.18) 100%
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.025) 0px,
      rgba(255, 255, 255, 0.025) 1px,
      transparent 1px,
      transparent 3px
    );
  /* 右侧真实多层米白书页厚度 + 封底硬壳边 + 落桌阴影 */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.28),
    inset -1px 0 0 rgba(255, 255, 255, 0.18),
    2px 0 0 #FAF5E8,
    3px 0 0 #E5DBC6,
    5px 0 0 #F6F0E0,
    6px 0 0 #D8CCB4,
    7px 1px 0 rgba(38, 22, 10, 0.32),
    10px 6px 14px rgba(42, 24, 10, 0.34);
  margin-bottom: -1px;
  z-index: 1;
}

/* 细微自然高低错落，同时严格保持真实书本修长感 */
.shelf-book.tall {
  aspect-ratio: 10 / 14.9;
}

.shelf-book.short {
  aspect-ratio: 10 / 13.9;
}

/* 中式线装书四眼装订白线细节 */
.shelf-book::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 15px;
  bottom: 15px;
  width: 2px;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 250, 238, 0.72) 0px,
    rgba(255, 250, 238, 0.72) 5px,
    transparent 5px,
    transparent 26px
  );
  pointer-events: none;
}

/* 书本立在实木板上的真实接触投影 */
.shelf-book::after {
  content: "";
  position: absolute;
  left: 0;
  right: -7px;
  bottom: -4px;
  height: 6px;
  background: radial-gradient(ellipse at center, rgba(42, 22, 8, 0.45) 0%, rgba(42, 22, 8, 0) 78%);
  pointer-events: none;
}

.shelf-book:hover {
  transform: translateY(-10px) rotate(-0.8deg);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    inset -1px 0 0 rgba(255, 255, 255, 0.22),
    2px 0 0 #FAF5E8,
    3px 0 0 #E5DBC6,
    5px 0 0 #F6F0E0,
    6px 0 0 #D8CCB4,
    7px 1px 0 rgba(38, 22, 10, 0.30),
    14px 16px 24px rgba(42, 24, 10, 0.38);
  z-index: 5;
}

.shelf-book:active {
  transform: translateY(-4px) scale(0.985);
}

.shelf-book-top {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.shelf-badge {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(20, 14, 10, 0.26);
  color: #FFFBF0;
  border: 1px solid rgba(255, 250, 235, 0.24);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.shelf-badge.is-cached {
  background: rgba(30, 132, 73, 0.92);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
}

.shelf-badge.is-preview {
  background: rgba(255, 250, 240, 0.22);
}

.shelf-badge.is-bilingual {
  background: rgba(79, 70, 229, 0.92);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.shelf-badge.is-english {
  background: rgba(3, 105, 161, 0.94);
  border-color: rgba(255, 255, 255, 0.35);
  color: #fff;
}

.shelf-book.is-lang-en .shelf-book-title {
  font-family: Georgia, "Palatino Linotype", "Times New Roman", serif;
  font-size: 12.5px;
  letter-spacing: 0;
  line-height: 1.24;
}

.shelf-book.is-lang-bilingual .shelf-book-title {
  font-size: 13px;
  line-height: 1.28;
}

/* 传统中式宣纸双线题签框 */
.shelf-cartouche {
  position: relative;
  background: linear-gradient(180deg, #FFFDF7 0%, #F7EFE0 100%);
  color: #261C14;
  border: 1px solid rgba(92, 52, 28, 0.38);
  outline: 1.5px solid rgba(255, 250, 238, 0.72);
  outline-offset: 2px;
  border-radius: 2px;
  padding: 9px 7px 10px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18), inset 0 0 0 2px #FFFDF7, inset 0 0 0 3px rgba(168, 62, 42, 0.22);
}

.shelf-book-title {
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: 0.04em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 烫金风格底部作者与卷数 */
.shelf-book-foot {
  border-top: 1px solid rgba(255, 245, 220, 0.28);
  padding-top: 5px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.shelf-book-author {
  font-family: var(--font-serif);
  font-size: 11px;
  color: rgba(255, 248, 230, 0.96);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shelf-book-cat {
  font-size: 9.5px;
  color: rgba(255, 244, 220, 0.76);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 600px) {
  .shelf-books {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    padding: 16px 12px 0;
  }
  .shelf-book {
    max-width: 112px;
    padding: 8px 8px 7px 15px;
  }
  .shelf-book::before {
    left: 9px;
  }
  .shelf-cartouche {
    padding: 6px 5px 7px;
  }
  .shelf-book-title {
    font-size: 12.5px;
  }
}

.book-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s, box-shadow 0.15s;
}

.book-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.book-cover-art {
  height: 138px;
  border-radius: 6px 10px 10px 6px;
  padding: 12px 10px 10px 16px;
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  margin-bottom: 10px;
  box-shadow: inset 9px 0 0 rgba(0, 0, 0, 0.18);
}

.book-cover-badge {
  align-self: flex-start;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.22);
  padding: 2px 7px;
  border-radius: 999px;
}

.book-cover-title {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
}

.book-cover-author {
  font-size: 11px;
  opacity: 0.9;
}

.book-card-title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-card-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.mini-book-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.mini-book-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

/* ==================== 纸张 (PAPER READER) ==================== */
.paper-empty {
  min-height: calc(100vh - 120px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.paper-empty-card {
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 34px 24px;
  text-align: center;
  max-width: 420px;
  box-shadow: var(--shadow-md);
}

.paper-empty-icon {
  font-size: 46px;
  margin-bottom: 10px;
}

.paper-empty-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 10px 0 20px;
}

.paper-empty-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.paper-reader {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.reader-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.reader-book-meta {
  min-width: 0;
}

.reader-title {
  font-size: 17px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-tools {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.icon-pill-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.reader-settings {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.setting-group {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.theme-dots, .font-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.theme-chip, .mini-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.theme-chip.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

/* 纸张主体 */
.paper-sheet {
  background: #FFFBF0;
  border: 1px solid #E8DEC8;
  border-radius: 16px;
  padding: 20px 24px 16px;
  min-height: 48vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 30px rgba(72, 52, 26, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  transition: background 0.2s, color 0.2s;
}

.paper-reader[data-theme="green"] .paper-sheet {
  background: #EDF5EA;
  border-color: #D2E3CC;
  color: #213022;
}

.paper-reader[data-theme="night"] .paper-sheet {
  background: #1F2633;
  border-color: #323D50;
  color: #DCE3EE;
}

.paper-header-line, .paper-footer-line {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  opacity: 0.65;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(130, 110, 80, 0.16);
}

.paper-footer-line {
  padding-bottom: 0;
  padding-top: 12px;
  border-bottom: none;
  border-top: 1px solid rgba(130, 110, 80, 0.16);
}

.paper-content {
  flex: 1;
  padding: 20px 2px;
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.95;
  letter-spacing: 0.03em;
}

.paper-content h3 {
  font-size: 1.15em;
  margin-bottom: 16px;
  color: var(--primary);
  font-weight: 700;
}

.paper-reader[data-theme="night"] .paper-content h3 {
  color: #F2A679;
}

.paper-content p {
  text-indent: 2em;
  margin-bottom: 14px;
}

/* 纯英文原版阅读排版 */
.paper-sheet.is-lang-en .paper-content {
  font-family: Georgia, "Palatino Linotype", "Book Antiqua", "Times New Roman", serif;
  letter-spacing: 0.01em;
  line-height: 1.82;
}

.paper-sheet.is-lang-en .paper-content p {
  text-indent: 0;
  margin-bottom: 16px;
}

/* 中英双语对照排版 */
.bi-pair {
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px dashed rgba(130, 110, 80, 0.2);
}

.bi-pair:last-child {
  border-bottom: none;
  margin-bottom: 6px;
}

.paper-content p.bi-en,
.paper-content p.bi-en-only {
  font-family: Georgia, "Palatino Linotype", "Times New Roman", serif;
  text-indent: 0;
  letter-spacing: 0.01em;
  line-height: 1.72;
  margin-bottom: 8px;
}

.paper-content p.bi-zh {
  text-indent: 0;
  padding-left: 12px;
  border-left: 3px solid rgba(200, 75, 49, 0.45);
  font-size: 0.92em;
  line-height: 1.82;
  opacity: 0.88;
  margin-bottom: 0;
}

.paper-reader[data-theme="night"] .paper-content p.bi-zh {
  border-left-color: rgba(242, 166, 121, 0.55);
}

.icon-pill-btn.is-bilingual-btn {
  background: #EEF2FF;
  border-color: #C7D2FE;
  color: #4338CA;
}

/* ==================== 语音朗读面板与高亮跟随 ==================== */
.icon-pill-btn.is-speaking {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 3px rgba(200, 75, 49, 0.22);
}

.tts-panel {
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.tts-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.tts-btn-group,
.tts-meta-group,
.tts-rate-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tts-main-btn {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: 10px;
}

.tts-status-badge {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.tts-status-badge.is-active {
  background: var(--primary-soft);
  border-color: rgba(200, 75, 49, 0.35);
  color: var(--primary);
}

.tts-checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
}

.tts-checkbox-label input {
  accent-color: var(--primary);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

.tts-config-row {
  padding-top: 8px;
  border-top: 1px dashed var(--border);
}

.tts-control-block {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tts-label {
  font-size: 12.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.tts-label strong {
  color: var(--primary);
  font-variant-numeric: tabular-nums;
  margin-left: 2px;
}

.tts-slider {
  width: 130px;
  accent-color: var(--primary);
  cursor: pointer;
}

.tts-select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tts-select {
  max-width: 215px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

.tts-select:focus {
  outline: none;
  border-color: var(--primary);
}

/* 正在朗读的段落高亮 */
.paper-content .tts-speaking {
  background: rgba(200, 75, 49, 0.11);
  border-radius: 8px;
  box-shadow: -4px 0 0 rgba(200, 75, 49, 0.72);
  padding: 4px 8px;
  margin-left: -8px;
  margin-right: -8px;
  transition: background 0.2s ease;
}

.paper-reader[data-theme="green"] .paper-content .tts-speaking {
  background: rgba(39, 174, 96, 0.16);
  box-shadow: -4px 0 0 rgba(30, 132, 73, 0.75);
}

.paper-reader[data-theme="night"] .paper-content .tts-speaking {
  background: rgba(242, 166, 121, 0.16);
  box-shadow: -4px 0 0 rgba(242, 166, 121, 0.85);
}

@media (max-width: 680px) {
  .tts-slider {
    width: 100px;
  }
  .tts-select {
    max-width: 135px;
  }
}

.paper-pdf-frame {
  width: 100%;
  height: 62vh;
  border: none;
  border-radius: 8px;
  margin: 12px 0;
  background: #fff;
}

.paper-pager {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pager-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.pager-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pager-bar-wrap {
  flex: 1;
  height: 8px;
  background: #E9DFCE;
  border-radius: 999px;
  overflow: hidden;
}

.pager-bar-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 999px;
  transition: width 0.2s;
}

/* 目录抽屉 */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(28, 22, 18, 0.45);
  z-index: 60;
  display: flex;
  justify-content: flex-end;
}

.drawer-panel {
  width: min(340px, 86vw);
  height: 100%;
  background: var(--surface-warm);
  padding: 18px;
  display: flex;
  flex-direction: column;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.icon-close-btn {
  border: none;
  background: #EFE7DA;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
}

.toc-list {
  flex: 1;
  overflow-y: auto;
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.toc-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  color: var(--text);
}

.toc-item.active {
  background: var(--primary-soft);
  border-color: rgba(200, 75, 49, 0.25);
  color: var(--primary);
  font-weight: 700;
}

/* ==================== 用户中心 (USER) ==================== */
.profile-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.profile-main {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}

.avatar-preview-wrap {
  position: relative;
  flex-shrink: 0;
}

.avatar-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  background: #FFF6E6;
  font-size: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-cam-badge {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--primary);
  color: #fff;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.brand-seal.has-photo {
  padding: 0;
  overflow: hidden;
  background: #FFF6E6;
  border: 1.5px solid var(--border);
}

.brand-seal.has-emoji {
  background: #FFF6E6;
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 22px;
}

.brand-seal img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-settings-box {
  border-top: 1px dashed var(--border);
  padding-top: 14px;
}

.profile-settings-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}

.avatar-picker-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 14px;
}

.avatar-picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
}

.avatar-upload-actions {
  display: flex;
  gap: 6px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
}

.avatar-choice {
  aspect-ratio: 1;
  border-radius: 12px;
  border: 1.5px solid transparent;
  background: #fff;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, border-color 0.15s, background 0.15s;
}

.avatar-choice:hover {
  transform: scale(1.08);
  border-color: var(--border);
}

.avatar-choice.active {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 0 0 2px rgba(200, 75, 49, 0.16);
}

.nickname-field {
  margin-bottom: 10px;
}

.field-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.muted-hint {
  font-size: 11px;
  color: var(--text-muted);
}

.nickname-presets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.preset-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.preset-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
}

.form-row-birth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

@media (max-width: 540px) {
  .avatar-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.profile-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.stat-box {
  background: var(--bg);
  border-radius: 12px;
  padding: 10px;
  text-align: center;
}

.stat-num {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
}

.profile-form .form-row {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.profile-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.profile-form input, .profile-form select {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  background: var(--surface-warm);
  color: var(--text);
}

/* 导入电子书 */
.upload-dropzone {
  background: var(--surface-warm);
  border: 2px dashed #D8C7AE;
  border-radius: var(--radius-lg);
  padding: 22px 16px;
  text-align: center;
  margin-bottom: 12px;
  transition: border-color 0.2s, background 0.2s;
}

.upload-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.hidden-file-input {
  display: none;
}

.upload-icon {
  font-size: 32px;
  margin-bottom: 6px;
}

.upload-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 4px;
}

.upload-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* 小作家作文纸 */
.article-editor-card {
  background: var(--surface-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.article-title-input {
  border: none;
  border-bottom: 1.5px solid var(--border);
  background: transparent;
  font-size: 17px;
  font-weight: 700;
  padding: 8px 4px;
  outline: none;
  color: var(--text);
}

.article-meta-row {
  display: flex;
  gap: 10px;
}

.article-meta-row select {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  background: #fff;
  font-size: 13px;
}

.article-textarea {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.9;
  resize: vertical;
  background-color: #FFFDF7;
  background-image: linear-gradient(to bottom, transparent 95%, rgba(210, 195, 170, 0.35) 96%);
  background-size: 100% 30px;
  outline: none;
  color: var(--text);
}

.article-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.manage-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manage-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.manage-item-info {
  min-width: 0;
  flex: 1;
}

.manage-item-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.manage-item-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.manage-item-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.tiny-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  cursor: pointer;
}

.tiny-btn.danger {
  color: #B03A2E;
  border-color: #F2D7D5;
  background: #FDEDEC;
}

/* ==================== 底部 3 个导航按钮 ==================== */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 780px;
  height: 70px;
  background: rgba(255, 253, 248, 0.96);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  z-index: 40;
  box-shadow: 0 -4px 16px rgba(64, 44, 24, 0.06);
}

.nav-btn {
  border: none;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.15s;
}

.nav-btn.active {
  color: var(--primary);
}

.nav-icon-wrap {
  position: relative;
  display: inline-flex;
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.nav-dot {
  position: absolute;
  top: -2px;
  right: -5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
}

.nav-label {
  font-size: 12px;
  font-weight: 700;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  background: rgba(44, 36, 30, 0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 90;
  box-shadow: var(--shadow-md);
}

@media (max-width: 540px) {
  .featured-card {
    flex-direction: column;
    align-items: flex-start;
  }
  .profile-form .form-row {
    grid-template-columns: 1fr;
  }
  .paper-sheet {
    padding: 18px 16px 14px;
  }
}


/* ==================== 平板与触控全面适配 (iPad / Android Tablet) ==================== */
button,
.shelf-book,
.history-card,
.featured-card,
.mini-book-pill,
.nav-btn,
.toc-item {
  touch-action: manipulation;
}

.bottom-nav {
  height: calc(70px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.app-shell {
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}

.spread-only-btn {
  display: none;
}

.paper-pages-wrap {
  flex: 1;
  display: block;
}

.paper-gesture-hint {
  font-size: 11px;
  opacity: 0.75;
}

/* 平板竖屏 (>= 768px) */
@media (min-width: 768px) {
  .app-shell,
  .bottom-nav {
    max-width: 1120px;
  }

  .view {
    padding: 22px 28px 32px;
  }

  .top-search-header {
    padding: 8px 0 16px;
  }

  .search-box {
    padding: 12px 18px;
  }

  .search-box input {
    font-size: 16px;
  }

  .section-header h2 {
    font-size: 19px;
  }

  .history-card {
    flex: 0 0 268px;
    padding: 14px;
  }

  .featured-card {
    padding: 20px 22px;
    gap: 20px;
  }

  .featured-cover {
    width: 98px;
    height: 134px;
  }

  .paper-sheet {
    padding: 28px 36px 22px;
    min-height: 58vh;
  }

  .pager-btn,
  .icon-pill-btn,
  .primary-btn,
  .secondary-btn {
    min-height: 44px;
  }

  .nav-btn {
    gap: 4px;
  }

  .nav-icon {
    font-size: 24px;
  }

  .nav-label {
    font-size: 13px;
  }

  .drawer-panel {
    width: 390px;
  }

  .toc-item {
    min-height: 44px;
    font-size: 15px;
  }
}

/* 平板横屏 & 宽屏 (>= 920px)：5列书架 + 摊开双页阅读 + 用户中心双栏 */
@media (min-width: 920px) {
  .shelf-books {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
    padding: 26px 28px 0;
  }

  .shelf-book {
    max-width: 142px;
  }

  .spread-only-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
  }

  .paper-sheet.is-spread {
    padding: 28px 34px 20px;
    min-height: 62vh;
    background-image: linear-gradient(
      90deg,
      transparent 0%,
      transparent 47.5%,
      rgba(92, 66, 36, 0.08) 49.6%,
      rgba(72, 48, 22, 0.14) 50%,
      rgba(92, 66, 36, 0.06) 50.4%,
      transparent 52.5%,
      transparent 100%
    );
  }

  .paper-reader[data-theme="night"] .paper-sheet.is-spread {
    background-image: linear-gradient(
      90deg,
      transparent 0%,
      transparent 47.5%,
      rgba(0, 0, 0, 0.28) 50%,
      transparent 52.5%,
      transparent 100%
    );
  }

  .paper-sheet.is-spread .paper-pages-wrap {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 48px;
    align-items: start;
  }

  .paper-sheet.is-spread .paper-content {
    padding: 18px 4px;
  }

  .paper-content-right {
    display: block;
  }

  /* 用户中心平板双栏布局 */
  .user-layout {
    display: grid;
    grid-template-columns: 420px 1fr;
    gap: 22px;
    align-items: start;
  }

  .user-col-profile {
    position: sticky;
    top: 18px;
  }
}

@media (max-width: 540px) {
  .paper-gesture-hint {
    display: none;
  }
}


/* ==================== 真实 3D 纸张翻页动画 (Page-Turn Animation) ==================== */
.paper-sheet {
  position: relative;
  overflow: hidden;
  perspective: 1800px;
}

.paper-flip-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  background: #FFFBF0;
  padding: 58px 30px 48px;
  font-family: var(--font-serif);
  line-height: 1.95;
  letter-spacing: 0.03em;
  overflow: hidden;
  backface-visibility: hidden;
  transform-style: preserve-3d;
  will-change: transform, opacity;
  box-shadow: 0 0 24px rgba(56, 38, 18, 0.18);
}

.paper-reader[data-theme="green"] .paper-flip-overlay {
  background: #EDF5EA;
  color: #213022;
}

.paper-reader[data-theme="night"] .paper-flip-overlay {
  background: #1F2633;
  color: #DCE3EE;
}

.paper-flip-overlay h3 {
  font-size: 1.15em;
  margin-bottom: 16px;
  color: var(--primary);
  font-weight: 700;
}

.paper-reader[data-theme="night"] .paper-flip-overlay h3 {
  color: #F2A679;
}

.paper-flip-overlay p {
  text-indent: 2em;
  margin-bottom: 14px;
}

/* 纸页翻起时的动态折光阴影 */
.paper-flip-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(64, 44, 20, 0.16) 0%,
    rgba(255, 255, 255, 0.22) 18%,
    rgba(64, 44, 20, 0.04) 65%,
    rgba(64, 44, 20, 0.20) 100%
  );
  opacity: 0;
  transition: opacity 0.2s;
}

/* 单页：向下一页翻（右侧掀起向左翻过） */
.paper-flip-overlay.flip-next {
  transform-origin: left center;
  border-right: 1px solid rgba(130, 100, 60, 0.24);
  animation: pageTurnNext 0.44s cubic-bezier(0.32, 0.08, 0.24, 1) forwards;
}

.paper-flip-overlay.flip-next::after {
  animation: pageShadowSweep 0.44s ease-out forwards;
}

/* 单页：向上一页翻（从左侧翻回展开） */
.paper-flip-overlay.flip-prev {
  transform-origin: left center;
  border-right: 1px solid rgba(130, 100, 60, 0.24);
  animation: pageTurnPrev 0.44s cubic-bezier(0.22, 0.68, 0.24, 1) forwards;
}

.paper-flip-overlay.flip-prev::after {
  animation: pageShadowSweep 0.44s ease-out forwards;
}

/* 平板双页摊开：右页绕中缝向左翻过 */
.paper-flip-overlay.flip-next-spread {
  left: 50%;
  width: 50%;
  padding: 58px 34px 48px 26px;
  transform-origin: left center;
  border-left: 1px solid rgba(90, 64, 34, 0.20);
  animation: spreadTurnNext 0.48s cubic-bezier(0.35, 0.06, 0.25, 1) forwards;
}

/* 平板双页摊开：左页绕中缝向右翻过 */
.paper-flip-overlay.flip-prev-spread {
  left: 0;
  width: 50%;
  padding: 58px 26px 48px 34px;
  transform-origin: right center;
  border-right: 1px solid rgba(90, 64, 34, 0.20);
  animation: spreadTurnPrev 0.48s cubic-bezier(0.35, 0.06, 0.25, 1) forwards;
}

/* 底层新页面轻柔浮现 */
.paper-pages-wrap.page-enter {
  animation: pageReveal 0.34s ease-out;
}

@keyframes pageTurnNext {
  0% {
    transform: rotateY(0deg) translateZ(0);
    opacity: 1;
    box-shadow: 0 0 0 rgba(48, 30, 12, 0);
  }
  45% {
    transform: rotateY(-52deg) translateZ(18px);
    opacity: 0.98;
    box-shadow: 24px 8px 34px rgba(48, 30, 12, 0.26);
  }
  100% {
    transform: rotateY(-102deg) translateZ(0);
    opacity: 0;
    box-shadow: 6px 2px 12px rgba(48, 30, 12, 0.06);
  }
}

@keyframes pageTurnPrev {
  0% {
    transform: rotateY(-95deg) translateZ(0);
    opacity: 0.25;
    box-shadow: 20px 8px 30px rgba(48, 30, 12, 0.24);
  }
  65% {
    transform: rotateY(-16deg) translateZ(10px);
    opacity: 0.96;
    box-shadow: 12px 6px 20px rgba(48, 30, 12, 0.16);
  }
  100% {
    transform: rotateY(0deg) translateZ(0);
    opacity: 0;
    box-shadow: 0 0 0 rgba(48, 30, 12, 0);
  }
}

@keyframes spreadTurnNext {
  0% {
    transform: rotateY(0deg);
    opacity: 1;
    box-shadow: -6px 0 18px rgba(48, 30, 12, 0.12);
  }
  50% {
    transform: rotateY(-90deg);
    opacity: 0.96;
    box-shadow: -22px 10px 36px rgba(48, 30, 12, 0.28);
  }
  100% {
    transform: rotateY(-176deg);
    opacity: 0;
    box-shadow: 0 0 8px rgba(48, 30, 12, 0.06);
  }
}

@keyframes spreadTurnPrev {
  0% {
    transform: rotateY(0deg);
    opacity: 1;
    box-shadow: 6px 0 18px rgba(48, 30, 12, 0.12);
  }
  50% {
    transform: rotateY(90deg);
    opacity: 0.96;
    box-shadow: 22px 10px 36px rgba(48, 30, 12, 0.28);
  }
  100% {
    transform: rotateY(176deg);
    opacity: 0;
    box-shadow: 0 0 8px rgba(48, 30, 12, 0.06);
  }
}

@keyframes pageShadowSweep {
  0% { opacity: 0.05; }
  45% { opacity: 0.85; }
  100% { opacity: 0; }
}

@keyframes pageReveal {
  0% { opacity: 0.65; }
  100% { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .paper-flip-overlay,
  .paper-pages-wrap.page-enter {
    animation: none !important;
  }
}


/* ==================== 独立页面：昵称与头像设置 ==================== */
.profile-entry-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-warm);
  border-color: var(--border);
  transition: border-color 0.15s, background 0.15s;
}

.profile-entry-btn:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.settings-page-shell {
  max-width: 680px;
  margin: 0 auto;
}

.subpage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.subpage-header h2 {
  font-size: 18px;
  font-weight: 700;
}

.subpage-spacer {
  width: 82px;
}

.settings-preview-card {
  background: linear-gradient(135deg, #FFFDF8 0%, #F7EFE1 100%);
}

.avatar-circle-lg {
  width: 82px;
  height: 82px;
  font-size: 44px;
}

.settings-form-actions {
  display: grid;
  grid-template-columns: 1fr 1.6fr;
  gap: 10px;
  margin-top: 6px;
}


/* ==================== 导出电子书面板 ==================== */
.export-format-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.export-chip {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s, border-color 0.15s;
}

.export-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.export-chip.primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.export-chip.primary:hover {
  color: #fff;
  opacity: 0.94;
}
