/* 全局变量与重置 */
:root {
  --primary: #e6b325;
  --primary-light: #f5d061;
  --bg-main: #0d1120;
  --bg-card: #161c30;
  --bg-dark: #090c17;
  --text-main: #e6e8f0;
  --text-sub: #8a90a8;
  --border: #232a45;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  line-height: 1.6;
}

a {
  text-decoration: none;
  color: inherit;
  transition: 0.3s;
}

ul {
  list-style: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 92%;
  max-width: 1280px;
  margin: 0 auto;
}

.section {
  padding: 70px 0;
}

.bg-dark {
  background: var(--bg-dark);
}

/* 通用标题栏 */
.section-header {
  display: flex;
  align-items: center;
  margin-bottom: 35px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 15px;
  position: relative;
}

.section-title {
  font-size: 26px;
  color: #fff;
  position: relative;
  padding-left: 15px;
}

.section-title::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  background: var(--primary);
  border-radius: 2px;
}

.tab-nav {
  margin-left: 40px;
  display: flex;
  gap: 25px;
}

.tab-nav span {
  cursor: pointer;
  color: var(--text-sub);
  font-size: 15px;
  transition: 0.3s;
  position: relative;
}

.tab-nav span.active {
  color: var(--primary);
}

.tab-nav span.active::after {
  content: "";
  position: absolute;
  bottom: -20px;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary);
}

.more-link {
  margin-left: auto;
  color: var(--text-sub);
  font-size: 14px;
}

.more-link:hover {
  color: var(--primary);
}

/* 顶部导航 */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 999;
  background: rgba(13, 17, 32, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: 0.3s;
}

.header.scrolled {
  background: rgba(13, 17, 32, 0.98);
  border-bottom-color: var(--border);
}

.nav-wrap {
  display: flex;
  align-items: center;
  height: 70px;
}

.logo {
  font-size: 24px;
  font-weight: bold;
  color: #fff;
  margin-right: 50px;
}

.logo span {
  color: var(--primary);
}

.nav-menu {
  display: flex;
  gap: 35px;
  flex: 1;
}

.nav-menu a {
  color: var(--text-sub);
  font-size: 15px;
  position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
  color: var(--primary);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border-radius: 30px;
  padding: 6px 15px;
  border: 1px solid var(--border);
}

.search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  width: 160px;
  font-size: 14px;
}

.search-box button {
  background: transparent;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 16px;
}

.login-btn {
  padding: 7px 20px;
  border: 1px solid var(--primary);
  color: var(--primary);
  border-radius: 20px;
  font-size: 14px;
}

.login-btn:hover {
  background: var(--primary);
  color: var(--bg-main);
}

.mobile-toggle {
  display: none;
  font-size: 24px;
  cursor: pointer;
  color: #fff;
}

/* Banner轮播 */
.banner {
  margin-top: 70px;
  position: relative;
  overflow: hidden;
  height: 480px;
}

.banner-slide {
  display: flex;
  height: 100%;
  transition: transform 0.6s ease;
}

.banner-item {
  min-width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  position: relative;
}

.banner-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(13, 17, 32, 0.7);
}

.banner-content {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 60px;
}

.banner-text {
  flex: 1;
}

.banner-text .tag {
  display: inline-block;
  padding: 5px 15px;
  background: rgba(230, 179, 37, 0.15);
  color: var(--primary);
  border-radius: 20px;
  font-size: 13px;
  margin-bottom: 20px;
  border: 1px solid rgba(230, 179, 37, 0.3);
}

.banner-text h1 {
  font-size: 52px;
  color: #fff;
  margin-bottom: 15px;
  line-height: 1.2;
}

.banner-text .author {
  color: var(--text-sub);
  margin-bottom: 20px;
  font-size: 15px;
}

.banner-text .desc {
  color: var(--text-sub);
  font-size: 16px;
  margin-bottom: 35px;
  max-width: 500px;
}

.banner-btns {
  display: flex;
  gap: 20px;
}

.btn {
  padding: 12px 35px;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 500;
  transition: 0.3s;
  display: inline-block;
}

.btn.primary {
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  color: var(--bg-main);
  box-shadow: 0 4px 15px rgba(230, 179, 37, 0.3);
}

.btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(230, 179, 37, 0.4);
}

.btn.ghost {
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
}

.btn.ghost:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.banner-cover {
  flex-shrink: 0;
}

.cover-img {
  width: 240px;
  height: 340px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
}

.banner-dots {
  position: absolute;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 2;
}

.banner-dots span {
  width: 30px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  cursor: pointer;
  transition: 0.3s;
}

.banner-dots span.active {
  background: var(--primary);
}

/* 分类入口 */
.category-section {
  padding: 40px 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 15px;
}

.cate-item {
  text-align: center;
  padding: 20px 10px;
  border-radius: 10px;
  transition: 0.3s;
  cursor: pointer;
}

.cate-item:hover {
  background: var(--bg-main);
  transform: translateY(-3px);
}

.cate-icon {
  font-size: 30px;
  margin-bottom: 10px;
}

.cate-item p {
  font-size: 14px;
  color: var(--text-sub);
}

.cate-item:hover p {
  color: var(--primary);
}

/* 热门榜单 */
.rank-content {
  position: relative;
}

.rank-list {
  display: none;
}

.rank-list.active {
  display: block;
}

.rank-item {
  display: flex;
  align-items: center;
  padding: 18px 20px;
  background: var(--bg-card);
  border-radius: 8px;
  margin-bottom: 12px;
  transition: 0.3s;
  border: 1px solid transparent;
}

.rank-item:hover {
  border-color: var(--primary);
  transform: translateX(5px);
}

.rank-num {
  width: 30px;
  font-size: 20px;
  font-weight: bold;
  color: var(--text-sub);
  margin-right: 20px;
  text-align: center;
}

.rank-num.top1 { color: #ff4757; }
.rank-num.top2 { color: #ffa502; }
.rank-num.top3 { color: #eccc68; }

.rank-info {
  flex: 1;
}

.rank-info h4 {
  font-size: 16px;
  color: #fff;
  margin-bottom: 5px;
}

.rank-info p {
  font-size: 13px;
  color: var(--text-sub);
}

.rank-tag {
  padding: 3px 10px;
  background: rgba(230, 179, 37, 0.1);
  color: var(--primary);
  border-radius: 12px;
  font-size: 12px;
}

/* 精选小说卡片 */
.book-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 25px;
}

.book-card {
  transition: 0.3s;
  cursor: pointer;
}

.book-card:hover {
  transform: translateY(-5px);
}

.book-cover {
  position: relative;
  margin-bottom: 12px;
  border-radius: 6px;
  overflow: hidden;
}

.book-cover img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 6px;
}

.book-tag {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 8px;
  background: var(--primary);
  color: var(--bg-main);
  font-size: 12px;
  border-radius: 3px;
  font-weight: bold;
}

.book-info h4 {
  font-size: 15px;
  color: #fff;
  margin-bottom: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.book-author {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
}

.book-desc {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 新闻资讯模块 */
.news-content {
  position: relative;
}

.news-panel {
  display: none;
}

.news-panel.active {
  display: block;
}

.news-main {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 30px;
  background: var(--bg-card);
  padding: 25px;
  border-radius: 10px;
  margin-bottom: 25px;
  border: 1px solid var(--border);
}

.news-main-img {
  border-radius: 8px;
  overflow: hidden;
}

.news-main-img img {
  width: 100%;
  height: 260px;
  object-fit: cover;
}

.news-main-info h3 {
  font-size: 22px;
  color: #fff;
  margin: 10px 0 15px;
  line-height: 1.4;
}

.news-main-info p {
  color: var(--text-sub);
  line-height: 1.8;
  margin-bottom: 20px;
}

.news-date {
  color: var(--text-sub);
  font-size: 13px;
}

.news-more {
  color: var(--primary);
  font-size: 14px;
}

.news-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.news-item {
  display: flex;
  gap: 15px;
  padding: 18px;
  background: var(--bg-card);
  border-radius: 8px;
  border: 1px solid var(--border);
  transition: 0.3s;
  cursor: pointer;
}

.news-item:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
}

.news-thumb {
  flex-shrink: 0;
  width: 100px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
}

.news-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-item-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.news-item-info h4 {
  font-size: 15px;
  color: #fff;
  margin-bottom: 6px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.news-item-info p {
  font-size: 13px;
  color: var(--text-sub);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 页脚 */
.footer {
  background: var(--bg-dark);
  border-top: 1px solid var(--border);
  padding-top: 50px;
}

.footer-wrap {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 40px;
  padding-bottom: 40px;
}

.footer-logo {
  font-size: 22px;
  color: #fff;
  margin-bottom: 15px;
}

.footer-col h4 {
  color: #fff;
  margin-bottom: 20px;
  font-size: 16px;
}

.footer-col ul li {
  margin-bottom: 10px;
}

.footer-col ul li a {
  color: var(--text-sub);
  font-size: 14px;
}

.footer-col ul li a:hover {
  color: var(--primary);
}

.footer-col p {
  color: var(--text-sub);
  font-size: 14px;
  margin-bottom: 10px;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 20px 0;
  text-align: center;
  color: var(--text-sub);
  font-size: 13px;
}

/* 响应式适配 */
@media (max-width: 1024px) {
  .book-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .category-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .news-main {
    grid-template-columns: 1fr;
  }

  .banner-text h1 {
    font-size: 40px;
  }

  .cover-img {
    width: 200px;
    height: 280px;
  }
}

@media (max-width: 768px) {
  .nav-menu, .nav-right {
    display: none;
  }

  .mobile-toggle {
    display: block;
    margin-left: auto;
  }

  .nav-menu.show {
    display: flex;
    position: absolute;
    top: 70px;
    left: 0;
    width: 100%;
    background: var(--bg-card);
    flex-direction: column;
    padding: 20px;
    gap: 15px;
    border-bottom: 1px solid var(--border);
  }

  .banner {
    height: auto;
    padding: 40px 0;
  }

  .banner-content {
    flex-direction: column-reverse;
    text-align: center;
    gap: 30px;
  }

  .banner-text h1 {
    font-size: 32px;
  }

  .banner-btns {
    justify-content: center;
  }

  .book-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
  }

  .news-list {
    grid-template-columns: 1fr;
  }

  .footer-wrap {
    grid-template-columns: 1fr 1fr;
    gap: 30px;
  }

  .section-header {
    flex-wrap: wrap;
    gap: 15px;
  }

  .tab-nav {
    margin-left: 0;
    order: 3;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .book-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .category-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .banner-text h1 {
    font-size: 26px;
  }

  .cover-img {
    width: 160px;
    height: 220px;
  }
}