/* ═══════════════════════════════════════════
   第八看 (d8kan.com) — Chinese Novel Site
   Palette: Crimson #8B0000 | Cream #FDF6EC | Gold #C9A040
   ═══════════════════════════════════════════ */

:root {
  --primary:       #8B0000;
  --primary-dark:  #5C0000;
  --primary-light: #B22222;
  --bg:            #FDF6EC;
  --card-bg:       #FFFFFF;
  --accent:        #C9A040;
  --accent-dark:   #A07020;
  --text:          #1A1A1A;
  --text-sec:      #5A4A3A;
  --text-muted:    #8A7A6A;
  --border:        #E8D5C0;
  --reader-bg:     #F5EDE0;
  --tag-bg:        #F0E8D5;
  --header-h:      58px;
  --strip-h:       40px;
  --font-serif:    'Noto Serif SC', serif;
  --font-sans:     'Noto Sans SC', sans-serif;
  --radius:        8px;
  --shadow:        0 2px 8px rgba(0,0,0,.08);
  --shadow-hover:  0 4px 16px rgba(0,0,0,.14);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  padding-top: calc(var(--header-h) + var(--strip-h));
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent-dark); text-decoration: underline; }
img { max-width: 100%; display: block; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ── Site Header ── */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  background: var(--primary);
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 24px;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}
.logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}
.logo-name {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: .05em;
}
.logo:hover { text-decoration: none; }

/* Main Nav */
.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.main-nav a {
  color: rgba(255,255,255,.88);
  font-size: 15px;
  padding: 6px 14px;
  border-radius: 20px;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.main-nav a:hover {
  background: rgba(255,255,255,.15);
  color: #fff;
  text-decoration: none;
}

/* Hamburger */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  margin-left: auto;
}
.menu-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: .2s;
}

/* Genre Strip */
.genre-strip {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  height: var(--strip-h);
  background: var(--primary-dark);
  z-index: 99;
  border-bottom: 1px solid rgba(255,255,255,.1);
  overflow: hidden;
}
.genre-strip-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.genre-strip-inner::-webkit-scrollbar { display: none; }
.genre-tab {
  white-space: nowrap;
  color: rgba(255,255,255,.78);
  font-size: 13px;
  padding: 4px 14px;
  border-radius: 20px;
  text-decoration: none;
  transition: background .15s, color .15s;
  flex-shrink: 0;
}
.genre-tab:hover, .genre-tab.active {
  background: rgba(255,255,255,.2);
  color: #fff;
  text-decoration: none;
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 56px 0 48px;
  text-align: center;
  color: #fff;
}
.hero-title {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: 10px;
}
.hero-slogan {
  font-size: 1rem;
  opacity: .82;
  letter-spacing: .04em;
}

/* ── Sections ── */
.home-section { padding: 40px 0; }
.home-section + .home-section { border-top: 1px solid var(--border); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  position: relative;
  padding-left: 12px;
}
.section-title::before {
  content: '';
  position: absolute;
  left: 0; top: 10%; bottom: 10%;
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
}
.see-all {
  font-size: 13px;
  color: var(--text-sec);
}
.see-all:hover { color: var(--primary); }

/* ── Novel Grid ── */
.novel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.novel-grid-wide {
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
}

/* ── Novel Card ── */
.novel-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
}
.novel-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}
.novel-card-link {
  display: flex;
  gap: 12px;
  padding: 14px;
  text-decoration: none;
  color: inherit;
}
.novel-card-link:hover { text-decoration: none; color: inherit; }

.novel-cover-wrap {
  position: relative;
  flex-shrink: 0;
  width: 70px; height: 95px;
}
.novel-cover {
  width: 70px; height: 95px;
  object-fit: cover;
  border-radius: 4px;
}
.novel-cover-placeholder {
  width: 70px; height: 95px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}
.novel-status {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  text-align: center;
  font-size: 10px;
  padding: 2px 0;
  border-radius: 0 0 4px 4px;
  color: #fff;
  background: rgba(0,0,0,.5);
}
.novel-status.completed { background: rgba(39,120,30,.8); }
.novel-status.ongoing   { background: rgba(139,0,0,.7); }

.novel-info { flex: 1; min-width: 0; }
.novel-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.novel-meta {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.meta-author { font-size: 12px; color: var(--text-sec); }
.meta-genre {
  font-size: 11px;
  background: var(--tag-bg);
  color: var(--primary);
  padding: 1px 7px;
  border-radius: 10px;
}
.novel-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.novel-stats { margin-top: 6px; }
.stat-chapters { font-size: 12px; color: var(--accent-dark); }

/* ── Page Layout ── */
.page-content { padding: 32px 0 60px; }
.page-header { margin-bottom: 28px; }
.page-header h1 {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--primary);
  margin-bottom: 4px;
}
.page-subtitle { color: var(--text-muted); font-size: 14px; }

/* ── Breadcrumb ── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb span { color: var(--border); }

/* ── Novel Detail ── */
.novel-detail-header {
  display: flex;
  gap: 28px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 28px;
}
.detail-cover-img {
  width: 140px; height: 190px;
  object-fit: cover;
  border-radius: 6px;
  flex-shrink: 0;
}
.detail-cover-placeholder {
  width: 140px; height: 190px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-serif);
  font-size: 52px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.novel-detail-info { flex: 1; }
.novel-detail-title {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.novel-detail-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.detail-meta-item { font-size: 14px; color: var(--text-sec); }
.detail-meta-item a { color: var(--primary); }
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 12px;
  background: var(--tag-bg);
  color: var(--text-sec);
}
.status-badge.completed { background: #E8F5E9; color: #2E7D32; }
.status-badge.ongoing   { background: #FFEBEE; color: var(--primary); }

.novel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.tag {
  font-size: 12px;
  background: var(--tag-bg);
  color: var(--primary-dark);
  padding: 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
}
.novel-detail-desc {
  font-size: 14px;
  color: var(--text-sec);
  line-height: 1.8;
  margin-bottom: 18px;
  padding: 12px;
  background: var(--bg);
  border-radius: 6px;
  border-left: 3px solid var(--accent);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .2s, transform .1s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-light); color: #fff; }

/* ── Chapter List ── */
.chapter-list-section { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.chapter-list-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 2px;
}
.chapter-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 10px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background .15s;
}
.chapter-link:hover { background: var(--bg); color: var(--primary); text-decoration: none; }
.ch-num { color: var(--text-muted); flex-shrink: 0; font-size: 11px; }
.ch-name { overflow: hidden; text-overflow: ellipsis; }

/* ── Chapter Reader ── */
.reader-wrap { background: var(--reader-bg); min-height: 100vh; }

.reader-topbar {
  background: var(--primary-dark);
  padding: 10px 0;
  position: sticky;
  top: calc(var(--header-h) + var(--strip-h));
  z-index: 50;
}
.reader-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar-back {
  color: rgba(255,255,255,.85);
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 40%;
}
.topbar-back:hover { color: #fff; text-decoration: none; }
.topbar-chapter {
  color: rgba(255,255,255,.7);
  font-size: 13px;
  text-align: right;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reader-article { padding: 40px 0 60px; }
.reader-container { max-width: 720px; }

.chapter-nav {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 0;
}
.nav-btn {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 6px;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--text);
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); text-decoration: none; }
.nav-btn.nav-toc { background: var(--primary); color: #fff; border-color: var(--primary); }
.nav-btn.nav-toc:hover { background: var(--primary-dark); }
.nav-btn.nav-disabled { color: var(--text-muted); cursor: default; }
.nav-btn.nav-disabled:hover { background: var(--card-bg); color: var(--text-muted); border-color: var(--border); }

.reader-header { margin: 24px 0 32px; }
.reader-chapter-title {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.reader-meta { font-size: 13px; color: var(--text-muted); }

.reader-content {
  font-size: 18px;
  line-height: 2;
  color: var(--text);
  font-family: var(--font-sans);
}
.reader-content p {
  margin-bottom: 1.6em;
  text-indent: 2em;
}

/* ── Genre Index ── */
.genre-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.genre-index-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px 16px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .2s, border-color .2s;
}
.genre-index-card:hover { border-color: var(--primary); box-shadow: var(--shadow); text-decoration: none; color: var(--primary); }
.genre-icon { font-size: 28px; }
.genre-label { font-size: 14px; font-weight: 500; }

/* ── Footer ── */
.site-footer {
  background: var(--primary-dark);
  color: rgba(255,255,255,.75);
  padding-top: 40px;
}
.footer-inner {
  display: flex;
  gap: 40px;
  padding-bottom: 36px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer-brand { flex: 1; }
.logo-icon.small { width: 28px; height: 28px; font-size: 14px; display: inline-flex; }
.footer-name {
  font-family: var(--font-serif);
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  margin-left: 8px;
  vertical-align: middle;
}
.footer-slogan { font-size: 13px; margin-top: 8px; opacity: .7; }
.footer-links { display: flex; gap: 40px; }
.footer-col { display: flex; flex-direction: column; gap: 8px; }
.footer-col h4 { color: #fff; font-size: 13px; margin-bottom: 4px; }
.footer-col a { color: rgba(255,255,255,.65); font-size: 13px; text-decoration: none; }
.footer-col a:hover { color: #fff; }
.footer-bottom {
  background: rgba(0,0,0,.2);
  padding: 14px 0;
  text-align: center;
}
.footer-bottom p { font-size: 12px; opacity: .6; }

/* ── Misc ── */
.empty-tip { color: var(--text-muted); text-align: center; padding: 40px 0; }
.generic-list { list-style: none; }
.generic-list li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.prose { line-height: 1.9; }
.prose p { margin-bottom: 1em; }

/* ── Mobile ── */
@media (max-width: 768px) {
  body { font-size: 15px; }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--primary-dark);
    flex-direction: column;
    padding: 16px 20px;
    gap: 4px;
    margin-left: 0;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 10px 16px; }
  .menu-toggle { display: flex; }

  .hero-title { font-size: 1.7rem; }
  .novel-grid { grid-template-columns: 1fr; }
  .novel-grid-wide { grid-template-columns: 1fr; }

  .novel-detail-header { flex-direction: column; align-items: center; text-align: center; }
  .detail-cover-img, .detail-cover-placeholder { margin: 0 auto; }
  .novel-detail-meta { align-items: center; }
  .novel-tags { justify-content: center; }

  .chapter-grid { grid-template-columns: 1fr 1fr; }

  .reader-content { font-size: 16px; }
  .chapter-nav { gap: 8px; }
  .nav-btn { padding: 7px 14px; font-size: 13px; }

  .footer-inner { flex-direction: column; gap: 20px; }
  .footer-links { flex-direction: column; gap: 16px; }
}

@media (max-width: 480px) {
  .chapter-grid { grid-template-columns: 1fr; }
  .novel-card-link { padding: 12px; }
  .novel-cover-wrap { width: 60px; height: 82px; }
  .novel-cover, .novel-cover-placeholder { width: 60px; height: 82px; font-size: 22px; }
}
