/* ============================================
   严论小说站 - 阅读页样式 (番茄小说风格)
   对标番茄小说：极简、留白、沉浸式大屏阅读
   ============================================ */

/* ---- CSS 变量 ---- */
:root {
  --accent: #C45C4C;
  --accent-dark: #9E3A30;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #999;
  --border: #e8e8e8;
  --radius: 8px;
  --header-height: 48px;
  --footer-height: 56px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  transition: background 0.3s, color 0.3s;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; border: none; background: none; font: inherit; }

/* ========================================
   日间主题（默认）
   ======================================== */
body.theme-light {
  background: #f5f5f5;
  color: var(--text-primary);
}

/* ========================================
   夜间主题
   ======================================== */
body.theme-dark {
  background: #1a1a1a;
  color: #d0d0d0;
}
body.theme-dark .reader-toolbar { background: #2a2a2a; border-color: #333; }
body.theme-dark .toolbar-btn { color: #ccc; }
body.theme-dark .toolbar-btn:hover { background: #3a3a3a; }
body.theme-dark .toolbar-novel-title { color: #aaa; }
body.theme-dark .reader-container { background: #222; color: #ccc; }
body.theme-dark .chapter-title { color: #e0e0e0; }
body.theme-dark .chapter-meta { color: #777; }
body.theme-dark .chapter-content p { color: #ccc; }
body.theme-dark .reader-footer-nav { background: #2a2a2a; border-color: #333; }
body.theme-dark .nav-btn { color: #ccc; background: #2a2a2a; }
body.theme-dark .nav-btn:hover { background: #3a3a3a; }
body.theme-dark .nav-btn.disabled { color: #555; }
body.theme-dark .catalog-sidebar { background: #2a2a2a; }
body.theme-dark .catalog-header { border-color: #333; }
body.theme-dark .catalog-item { border-color: #333; color: #aaa; }
body.theme-dark .catalog-item:hover { background: #333; }
body.theme-dark .catalog-item.active { background: rgba(196,92,76,0.15); color: var(--accent); }

/* ========================================
   护眼主题
   ======================================== */
body.theme-sepia {
  background: #f4ecd8;
  color: #5c4b37;
}
body.theme-sepia .reader-toolbar { background: #ede0c8; border-color: #d4c5a9; }
body.theme-sepia .toolbar-btn { color: #7a6a54; }
body.theme-sepia .toolbar-btn:hover { background: #e4d5b8; }
body.theme-sepia .reader-container { background: #faf4e8; color: #5c4b37; }
body.theme-sepia .chapter-title { color: #3d2e1e; }
body.theme-sepia .chapter-meta { color: #9e8b6e; }
body.theme-sepia .chapter-content p { color: #5c4b37; }
body.theme-sepia .reader-footer-nav { background: #ede0c8; border-color: #d4c5a9; }
body.theme-sepia .nav-btn { color: #7a6a54; background: #ede0c8; }
body.theme-sepia .nav-btn:hover { background: #e4d5b8; }

/* ---- 顶部工具栏 ---- */
.reader-toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: var(--header-height);
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  transition: background 0.3s;
}
.toolbar-left, .toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 14px;
  transition: background 0.2s;
}
.toolbar-btn:hover { background: #f0f0f0; }
.toolbar-btn small { font-size: 11px; margin-left: 2px; }
.toolbar-novel-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-left: 4px;
}

/* ---- 目录侧边栏 ---- */
.catalog-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 199;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}
.catalog-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.catalog-sidebar {
  position: fixed;
  top: 0;
  right: -320px;
  width: 320px;
  height: 100vh;
  background: #fff;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: right 0.3s ease;
  box-shadow: -4px 0 20px rgba(0,0,0,0.1);
}
.catalog-sidebar.open { right: 0; }
.catalog-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.catalog-header h3 { font-size: 16px; font-weight: 600; }
.catalog-count { font-size: 12px; color: var(--text-muted); }
.catalog-close {
  margin-left: auto;
  font-size: 24px;
  color: var(--text-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}
.catalog-close:hover { background: #f0f0f0; }
.catalog-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.catalog-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--text-primary);
  border-bottom: 1px solid #f0f0f0;
  transition: background 0.15s;
}
.catalog-item:hover { background: #f8f8f8; }
.catalog-item.active {
  background: rgba(196,92,76,0.08);
  color: var(--accent);
  font-weight: 500;
}
.catalog-ch-num {
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.catalog-ch-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.catalog-ch-lock { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }

/* ---- 阅读内容区 ---- */
.reader-main {
  min-height: calc(100vh - var(--header-height) - var(--footer-height) - 2px);
  display: flex;
  justify-content: center;
  padding: 32px 20px 20px;
}
.reader-container {
  width: 100%;
  max-width: 700px;
  background: #fff;
  border-radius: 12px;
  padding: 40px 48px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  font-size: 18px;
  line-height: 1.9;
  transition: background 0.3s, color 0.3s, font-size 0.2s;
}

/* 章节标题 */
.chapter-title {
  font-size: 1.5em;
  font-weight: 700;
  text-align: center;
  margin-bottom: 12px;
  color: var(--text-primary);
  line-height: 1.4;
}

/* 章节元信息 */
.chapter-meta {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.meta-sep { margin: 0 6px; }

/* 正文内容 */
.chapter-content { }
.chapter-content p {
  text-indent: 2em;
  margin-bottom: 0.8em;
  word-break: break-all;
  line-height: 2.0;
}

/* ---- 底部导航 ---- */
.reader-footer-nav {
  position: sticky;
  bottom: 0;
  z-index: 100;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 8px 0;
  transition: background 0.3s;
}
.footer-nav-inner {
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
}
.nav-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-secondary);
  background: #fff;
  transition: background 0.2s;
}
.nav-btn:hover { background: #f0f0f0; }
.nav-btn.disabled {
  color: #ccc;
  pointer-events: none;
}
.nav-catalog {
  background: var(--accent);
  color: #fff;
  padding: 8px 24px;
}
.nav-catalog:hover {
  background: var(--accent-dark);
}
.nav-prev, .nav-next { min-width: 100px; }
.nav-prev { justify-content: flex-start; }
.nav-next { justify-content: flex-end; }

/* ---- 响应式 ---- */
@media (max-width: 768px) {
  .reader-container {
    padding: 24px 20px;
    border-radius: 0;
    box-shadow: none;
  }
  .reader-main {
    padding: 16px 0 20px;
  }
  .chapter-title { font-size: 1.25em; }
  .reader-container { font-size: 16px; }
  .catalog-sidebar { width: 280px; right: -280px; }
  .toolbar-novel-title { display: none; }
}

/* ---- 打印样式 ---- */
@media print {
  .reader-toolbar, .reader-footer-nav, .catalog-sidebar, .catalog-overlay { display: none; }
  .reader-container { box-shadow: none; border-radius: 0; }
  body { background: #fff; }
}
