* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "PingFang SC","Microsoft YaHei",sans-serif;
}
html,body {
  width: 100%;
  background: #f6f6f6;
  transition: all 0.3s;
}
body.dark {
  background: #1a1a1a;
  color: #e0e0e0;
}
.container {
  max-width: 750px;
  margin: 0 auto;
  padding: 0 14px;
}
.header {
  position: fixed;
  top:0; left:0; right:0;
  height:48px;
  background:#fff;
  display: flex;
  align-items:center;
  justify-content:center;
  box-shadow:0 0 4px rgba(0,0,0,0.1);
  z-index:10;
  transition: all 0.3s;
  /* 给标题区域留出左右按钮空间 */
  padding: 0 80px;
}
body.dark .header {
  background:#2d2d2d;
  color:#e0e0e0;
}
.header h1 {
  font-size:17px;
  font-weight:500;
  /* 标题文字超出时省略 */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* 左上角回到详情按钮样式 */
.back-detail-btn {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  font-size:16px;
  color:#333;
  background:none;
  border:none;
  text-decoration:none;
  cursor:pointer;
  padding: 4px 8px;
  border-radius: 4px;
  z-index: 1;
}
body.dark .back-detail-btn {
  color:#e0e0e0;
}
.back-detail-btn:hover {
  background: #f0f0f0;
}
body.dark .back-detail-btn:hover {
  background: #3d3d3d;
}
.header-actions {
  position:absolute;
  right:15px;
  display:flex;
  align-items:center;
  gap:15px;
  z-index: 1;
}
.home-btn,.setting-btn {
  font-size:18px;
  color:#333;
  background:none;
  border:none;
  text-decoration:none;
  cursor:pointer;
}
body.dark .home-btn,body.dark .setting-btn {
  color:#e0e0e0;
}
.content {
  padding-top:60px;
  padding-bottom:100px;
}

/* 首页小说列表 */
.novel-item {
  background:#fff;
  border-radius:10px;
  padding:14px 16px;
  margin-bottom:10px;
  transition: all 0.3s;
}
body.dark .novel-item {
  background:#2d2d2d;
}
.novel-item h3 {
  font-size:17px;
  margin-bottom:6px;
}
.novel-item p {
  font-size:13px;
  color:#666;
  line-height:1.5;
  transition: all 0.3s;
}
body.dark .novel-item p {
  color:#ccc;
}
.read-mark {
  font-size:12px;
  color:#409eff;
  margin-top:4px;
}

/* 章节列表（详情页） */
.chapter-list {
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:8px;
}
.chapter-item {
  background:#fff;
  border-radius:8px;
  padding:12px 10px;
  font-size:14px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  text-decoration:none;
  color:#333;
  transition: all 0.3s;
}
body.dark .chapter-item {
  background:#2d2d2d;
  color:#e0e0e0;
}
.chapter-item.current {
  background:#409eff;
  color:#fff;
}

/* 阅读内容 */
.read-content {
  background:#fff;
  padding:16px;
  border-radius:10px;
  font-size:16px;
  line-height:1.8;
  color:#333;
  white-space:pre-line;
  transition: all 0.3s;
}
body.dark .read-content {
  background:#2d2d2d;
  color:#e0e0e0;
}
.read-content.font-sm { font-size:14px; }
.read-content.font-md { font-size:16px; }
.read-content.font-lg { font-size:18px; }
.read-content.font-xl { font-size:20px; }

/* 底部翻页栏 */
.read-nav {
  position:fixed;
  bottom:20px;
  left:50%;
  transform:translateX(-50%);
  width:calc(100% - 28px);
  max-width:750px;
  display:flex;
  gap:8px;
  z-index:8;
}
.read-nav a {
  flex:1;
  background:#fff;
  padding:12px 0;
  border-radius:8px;
  text-align:center;
  font-size:15px;
  color:#333;
  text-decoration:none;
  transition: all 0.3s;
}
body.dark .read-nav a {
  background:#2d2d2d;
  color:#e0e0e0;
}
/* 目录按钮样式：与上下章完全一致，仅保留加粗区分 */
.center-chapter-btn {
  font-weight:bold;
  background: #fff !important;
  color: #333 !important;
}
/* 夜间模式下目录按钮与上下章完全一致 */
body.dark .center-chapter-btn {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
}

/* 设置面板 */
.setting-panel {
  position:fixed;
  top:60px;
  right:10px;
  width:280px;
  background:#fff;
  border-radius:8px;
  box-shadow:0 2px 15px rgba(0,0,0,0.2);
  padding:15px;
  z-index:20;
  display:none;
  transition: all 0.3s;
}
.setting-panel.show {
  display:block;
}
body.dark .setting-panel {
  background:#2d2d2d;
}
.panel-header {
  display:flex;
  justify-content:space-between;
  padding-bottom:10px;
  border-bottom:1px solid #eee;
  margin-bottom:12px;
}
body.dark .panel-header {
  border-color:#444;
}
.close-panel {
  background:none;
  border:none;
  font-size:18px;
  cursor:pointer;
}
.setting-item {
  margin-bottom:14px;
}
.setting-item-title {
  font-size:14px;
  color:#666;
  margin-bottom:6px;
}
body.dark .setting-item-title {
  color:#ccc;
}
.font-size-controls {
  display:flex;
  align-items:center;
  gap:8px;
}
.font-btn {
  width:36px;
  height:36px;
  border-radius:50%;
  border:none;
  background:#f0f0f0;
  font-size:16px;
}
body.dark .font-btn {
  background:#3d3d3d;
  color:#fff;
}
.font-preview {
  flex:1;
  font-size:14px;
}

/* 夜间开关 */
.switch {
  display:inline-block;
  width:40px;
  height:20px;
  position:relative;
}
.switch input {
  opacity:0;
}
.slider {
  position:absolute;
  top:0;left:0;right:0;bottom:0;
  background:#ccc;
  border-radius:20px;
  transition:0.4s;
}
.slider:before {
  content:"";
  position:absolute;
  width:16px; height:16px;
  left:2px; bottom:2px;
  background:white;
  border-radius:50%;
  transition:0.4s;
}
input:checked + .slider {
  background:#409eff;
}
input:checked + .slider:before {
  transform:translateX(20px);
}

/* 全屏遮罩目录（带动画效果） */
.chapter-mask {
  position:fixed;
  top:0; left:0; right:0; bottom:0;
  background:rgba(0,0,0,0.5);
  z-index:99;
  display:none;
  align-items:center;
  justify-content:center;
  padding:20px;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.chapter-mask.show {
  display:flex;
  opacity: 1;
}
.chapter-panel {
  width:90%;
  max-width:400px;
  max-height:80vh;
  background:#fff;
  border-radius:10px;
  box-shadow:0 4px 20px rgba(0,0,0,0.3);
  padding:15px;
  overflow-y:auto;
  transition: all 0.3s ease;
  position: relative;
  transform: scale(0.9) translateY(20px);
  opacity: 0;
}
.chapter-mask.show .chapter-panel {
  transform: scale(1) translateY(0);
  opacity: 1;
}
body.dark .chapter-panel {
  background:#2d2d2d;
}
/* 目录关闭按钮 */
.chapter-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius:50%;
  background: #f5f5f5;
  border: none;
  font-size:16px;
  color:#666;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
body.dark .chapter-close-btn {
  background: #3d3d3d;
  color:#ccc;
}
.chapter-close-btn:hover {
  background: #409eff;
  color:#fff;
}
.panel-header {
  display:flex;
  justify-content:center;
  padding-bottom:10px;
  border-bottom:1px solid #eee;
  margin-bottom:12px;
  padding-right: 40px;
}
.panel-chapters {
  display:flex;
  flex-direction:column;
  gap:8px;
  margin-top:10px;
}
.panel-chapter {
  padding:10px 12px;
  border-radius:6px;
  font-size:15px;
  cursor:pointer;
  transition:background 0.2s;
}
.panel-chapter.current {
  background:#409eff;
  color:#fff;
}
body.dark .panel-chapter:hover {
  background:#3d3d3d;
}
.panel-chapter:hover {
  background:#f5f5f5;
}