/* reader.css - 阅读应用专属多端自适应布局样式表 */

/* 1. 窗口及选项卡基础 */
#win-reader {
  background-color: #f8fafc;
}

.reader-tab-panel {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
}

.reader-tab-panel.active {
  display: block;
}

/* 2. 书架页 - 拟真网格书架 */
.bookshelf-container {
  padding: 16px;
  box-sizing: border-box;
}

.bookshelf-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px 16px;
  width: 100%;
}

.bookshelf-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  position: relative;
  min-width: 0; /* 极其关键：防止因书名过长撑爆一维 CSS Grid 槽位宽度导致卡片变大 */
}

.book-cover-wrapper {
  width: 100%;
  max-width: 110px; /* 锁死最大宽度，防止大屏下异常拉伸 */
  height: 146px;    /* 锁死固定高度 (对齐 3:4 比例)，避免自适应形变 */
  border-radius: 6px;
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  box-shadow: 0 4px 10px rgba(0,0,0,0.12), 2px 0 0 rgba(0,0,0,0.08) inset;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  transition: transform 0.2s ease;
}

.book-cover-wrapper:active {
  transform: scale(0.96);
}

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

.book-cover-title-fallback {
  padding: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  word-break: break-all;
  line-height: 1.4;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.book-meta-title {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
  width: 100%;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 虚线导入格 */
.bookshelf-item.import-placeholder .book-cover-wrapper {
  background: transparent;
  border: 2px dashed #94a3b8;
  box-shadow: none;
  cursor: pointer;
}

.bookshelf-item.import-placeholder .book-cover-wrapper svg {
  color: #94a3b8;
}

/* 3. 书城页 - 榜单分类与搜索 */
.bookstore-container {
  padding: 16px;
  box-sizing: border-box;
}

.bookstore-search-bar {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  padding: 10px 14px;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02);
}

.bookstore-search-bar span {
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

.bookstore-search-bar svg {
  color: #64748b;
}

.bookstore-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  margin: 16px 0 10px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.refresh-trigger-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #576b95;
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 700;
}

.book-list-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.book-card-horizontal {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.01);
}

.book-card-cover {
  width: 60px;
  height: 80px;
  border-radius: 4px;
  background: #94a3b8;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  color: white;
  font-size: 10px;
  font-weight: bold;
  text-align: center;
  padding: 4px;
  box-sizing: border-box;
}

.book-card-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.book-card-title {
  font-size: 14px;
  font-weight: 700;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-card-author {
  font-size: 11px;
  color: #64748b;
  margin-top: 4px;
}

.book-card-summary {
  font-size: 11px;
  color: #94a3b8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  margin-top: 6px;
}

/* 分类标签网格 */
.category-tags-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 20px;
}

.category-tag-item {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #475569;
  cursor: pointer;
  position: relative;
}

.category-tag-item .tag-edit-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 14px;
  height: 14px;
  background: #64748b;
  color: white;
  border-radius: 50%;
  font-size: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 4. 我的页 - 阅读统计与预设 */
.reader-mine-header {
  background: #ffffff;
  padding: 16px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 16px;
}

.reader-persona-sync-box {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reader-mine-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.reader-stat-card {
  background: #f1f5f9;
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}

.reader-stat-num {
  font-size: 18px;
  font-weight: 700;
  color: #0f766e;
  margin-top: 4px;
}

.reader-stat-label {
  font-size: 11px;
  color: #64748b;
}

/* 5. 搜索模态抽屉 */
.reader-search-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #f8fafc;
  z-index: 100;
  transform: translateY(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.reader-search-overlay.active {
  transform: translateY(0);
}

.search-options-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  box-sizing: border-box;
}

/* 角色与主角选择器平铺 */
.reader-character-select-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 150px;
  overflow-y: auto;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px;
  background: #ffffff;
}

.reader-char-option-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  cursor: pointer;
  background: #ffffff;
}

.reader-char-option-card.selected {
  border-color: #0f766e;
  background: #f0fdf4;
}

.reader-char-option-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}

.reader-char-option-names {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.reader-char-option-real {
  font-size: 12px;
  font-weight: 700;
  color: #1e293b;
}

.reader-char-option-remark {
  font-size: 10px;
  color: #64748b;
}

/* 6. 书籍详情展示浮层 */
.book-details-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  z-index: 110;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.book-details-overlay.active {
  transform: translateX(0);
}

/* 7. 主流阅读排版视图 */
.reading-room-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 120;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.reading-room-overlay.active {
  transform: translateX(0);
}

/* 各种预设颜色主题 */
.read-theme-light_green { background-color: #f0fdf4; color: #166534; }
.read-theme-light_blue  { background-color: #f0f9ff; color: #1e3a8a; }
.read-theme-light_yellow { background-color: #fefcf0; color: #713f12; }
.read-theme-beige        { background-color: #faf0e6; color: #4338ca; }
.read-theme-white        { background-color: #ffffff; color: #1e293b; }

.reading-flow-body {
  flex: 1;
  padding: 64px 18px 40px 18px; /* 顶部留出 64px 的安全空白区，彻底隔离绝对定位的透明页头与正文重叠，保障点击穿透精确度 [1] */
  overflow-y: auto;
  box-sizing: border-box;
  line-height: 1.8;
  font-size: 16px;
  transition: background-color 0.2s, color 0.2s;
  user-select: none;
  -webkit-user-select: none;
}

.reading-flow-body p {
  margin-bottom: 1.2em;
  text-indent: 2em; /* 补回标准中文首行2字符排版缩进 [1] */
  position: relative;
  text-align: justify;
}

/* 伴读微气泡和评价段落 */
.para-comment-anchor {
  position: relative;
  display: inline;
}

.para-comment-bubble-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(87,107,149,0.15);
  color: #576b95;
  margin-left: 4px;
  cursor: pointer;
  vertical-align: middle;
}

.para-comment-bubble-trigger svg {
  width: 10px;
  height: 10px;
}

/* 段落书评卡片气泡弹层 */
.para-comment-balloon {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  margin: 6px 0 12px 2em;
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
  font-size: 12px;
  line-height: 1.5;
  color: #334155;
  animation: slideInDown 0.15s ease-out;
}

.para-comment-balloon-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #475569;
  margin-bottom: 6px;
}

/* 阅读设置面板 */
.reading-menu-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255,255,255,0.96);
  border-top: 1px solid #e2e8f0;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateY(100%);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 130;
  padding: 14px;
  box-sizing: border-box;
}

.reading-menu-bar.active {
  transform: translateY(0);
}

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

.reading-menu-row:last-child {
  margin-bottom: 0;
}

.theme-color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1.5px solid #cbd5e1;
  cursor: pointer;
  box-sizing: border-box;
}

.theme-color-dot.active {
  border-color: #0f766e;
  box-shadow: 0 0 0 2px rgba(15,118,110,0.2);
}

/* 目录抽屉 */
.reading-directory-drawer {
  position: absolute;
  top: 0;
  left: 0;
  width: 260px;
  height: 100%;
  background: #ffffff;
  border-right: 1px solid #e2e8f0;
  z-index: 140;
  transform: translateX(-100%);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.reading-directory-drawer.active {
  transform: translateX(0);
}

.reading-directory-drawer-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 135;
  display: none;
}

.reading-directory-drawer-mask.active {
  display: block;
}

/* 章节结束摘要与控制 */
.chapter-summary-card-box {
  background: rgba(15,118,110,0.04);
  border: 1px dashed #0f766e;
  border-radius: 10px;
  padding: 12px;
  margin-top: 30px;
  margin-bottom: 20px;
}

.chapter-summary-card-title {
  font-size: 12px;
  font-weight: 700;
  color: #0f766e;
  margin-bottom: 6px;
}

.chapter-summary-card-content {
  font-size: 12.5px;
  line-height: 1.6;
  color: #334155;
}