:root {
  --ink-top: #3d3d3d;
  --ink-bar: #2c2c2c;
  --accent: #ed4259;
  --accent-hover: #d63a4f;
  --bg: #f5f5f5;
  --surface: #ffffff;
  --line: #e8e8e8;
  --text: #1a1a1a;
  --muted: #4d4d4d;
  --muted-strong: #333333;
  --tag-bg: #f0f0f0;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

/* —— Top bar (catalog) —— */
.site-top {
  background: var(--ink-bar);
  color: #f0f0f0;
  font-size: 13px;
}

.site-top-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 12px;
  min-height: 40px;
}

.site-top a {
  padding: 8px 10px;
  border-radius: 4px;
  color: #e0e0e0;
}

.site-top a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.site-top .is-active {
  background: var(--accent);
  color: #fff;
}

.site-top .is-active:hover {
  color: #fff;
  background: var(--accent-hover);
}

.site-top-spacer {
  flex: 1;
}

/* —— Secondary tabs —— */
.sub-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.sub-tabs-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 0 8px;
}

.sub-tabs a {
  display: inline-block;
  padding: 14px 18px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
}

.sub-tabs a.is-active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--accent);
}

/* —— Layout: sidebar + main —— */
.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }
}

.filter-block {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.filter-block h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--tag-bg);
  color: var(--muted);
  font-size: 12px;
  border: 1px solid transparent;
}

.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tag.is-on {
  background: rgba(237, 66, 89, 0.1);
  color: var(--accent);
  border-color: rgba(237, 66, 89, 0.35);
  font-weight: 600;
}

/* —— Toolbar —— */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 14px;
}

.sort-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  align-items: center;
}

.sort-group a {
  color: var(--muted);
  font-size: 13px;
}

.sort-group a.is-active {
  color: var(--accent);
  font-weight: 700;
}

.toolbar-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}

/* —— Book cards —— */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

@media (max-width: 720px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
}

.book-card {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: box-shadow 0.15s ease;
}

.book-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.book-cover {
  width: 118px;
  height: 158px;
  border-radius: 6px;
  object-fit: cover;
  background: #ddd;
  display: block;
}

.book-card h2 {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.25;
}

.book-card h2 a {
  color: var(--text);
}

.book-card h2 a:hover {
  color: var(--accent);
}

.book-meta {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.book-meta span {
  color: var(--accent);
}

.book-blurb {
  margin: 0;
  font-size: 13px;
  color: #444;
  line-height: 1.65;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-foot {
  margin-top: 10px;
  font-size: 11px;
  color: #999;
}

/* —— Book detail page —— */
.detail-body {
  background: var(--bg);
}

.breadcrumb {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  font-size: 13px;
  color: var(--muted-strong);
}

.breadcrumb a {
  color: var(--muted-strong);
}

.breadcrumb a:hover {
  color: var(--accent);
}

.hero-book {
  max-width: 1180px;
  margin: 0 auto 20px;
  padding: 24px;
  background: var(--surface);
  border-radius: 12px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) minmax(200px, 280px);
  gap: 24px;
}

@media (max-width: 900px) {
  .hero-book {
    grid-template-columns: 140px 1fr;
  }

  .hero-author {
    grid-column: 1 / -1;
    border-left: none !important;
    border-top: 1px dashed var(--line);
    padding-top: 20px !important;
    padding-left: 0 !important;
  }
}

.hero-book .cover-lg {
  width: 200px;
  height: 268px;
  border-radius: 8px;
  object-fit: cover;
  background: #ddd;
}

@media (max-width: 900px) {
  .hero-book .cover-lg {
    width: 140px;
    height: 188px;
  }
}

.hero-main h1 {
  margin: 0 0 8px;
  font-size: 22px;
  line-height: 1.22;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin: 16px 0;
}

.hero-stats strong {
  display: block;
  font-size: 22px;
  color: var(--accent);
}

.hero-stats span {
  font-size: 12px;
  color: var(--muted);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: #fff;
}

.hero-author {
  border-left: 1px dashed var(--line);
  padding-left: 20px;
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
}

/* —— Detail 3-column —— */
.detail-layout {
  max-width: 1180px;
  margin: 0 auto 48px;
  padding: 0 20px;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 260px;
  gap: 20px;
}

@media (max-width: 960px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }
}

.side-nav {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 0;
}

.side-nav a {
  display: block;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
  border-left: 3px solid transparent;
}

.side-nav a.is-active {
  color: var(--accent);
  font-weight: 700;
  border-left-color: var(--accent);
  background: rgba(237, 66, 89, 0.04);
}

.content-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.content-card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line);
}

.content-card p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.85;
  color: #333;
}

.pill-rank {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(237, 66, 89, 0.12);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
}

/* —— Reader —— */
.reader-body {
  background: #f5f3ef;
  color: #2c2c2c;
}

.reader-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

.reader-hot {
  font-size: 13px;
  color: #555;
  margin-bottom: 8px;
}

.reader-hot strong {
  color: var(--accent);
}

.reader-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 3.4vw, 1.85rem);
  margin: 0 0 12px;
  line-height: 1.25;
}

.badge-num {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  vertical-align: middle;
  font-family: var(--font);
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  font-size: 13px;
  color: var(--muted-strong);
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.reader-prose {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.95;
  color: #2a2a2a;
}

.reader-prose p {
  margin: 0 0 1.2em;
  position: relative;
}

.para-note {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font);
  color: #888;
  background: rgba(0, 0, 0, 0.05);
  vertical-align: middle;
}

.floating-dock {
  position: fixed;
  right: 16px;
  bottom: 80px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 20;
}

.floating-dock a {
  display: block;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  color: var(--muted);
  box-shadow: var(--shadow);
}

.floating-dock a:hover {
  color: var(--accent);
}

.site-brand {
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #fff;
  padding: 8px 12px 8px 0;
}

.site-brand span {
  color: var(--accent);
}

/* —— Catalog extras & static pages —— */
.catalog-intro {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #444;
  line-height: 1.65;
}

.catalog-intro strong {
  color: var(--text);
}

.novel-footer {
  max-width: 1280px;
  margin: 48px auto 0;
  padding: 32px 16px 48px;
  border-top: 1px solid var(--line);
  background: #ececec;
  font-size: 12px;
  color: var(--muted);
}

.novel-footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto 24px;
}

.novel-footer h3 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.novel-footer ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.novel-footer li {
  margin-bottom: 6px;
}

.novel-footer a {
  color: var(--muted);
}

.novel-footer a:hover {
  color: var(--accent);
}

.newsletter-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.newsletter-inline input {
  flex: 1;
  min-width: 180px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: inherit;
}

.static-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  background: var(--bg);
  min-height: 60vh;
}

.static-page h1 {
  margin: 0 0 16px;
  font-size: 22px;
}

.static-page h2 {
  margin: 28px 0 10px;
  font-size: 18px;
}

.static-page p,
.static-page li {
  font-size: 14px;
  line-height: 1.75;
  color: #333;
}

.static-page ul {
  padding-left: 20px;
}

.toc-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

.toc-wrap h1 {
  font-size: 21px;
  margin: 0 0 8px;
}

.toc-list {
  list-style: none;
  margin: 20px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.toc-list li {
  border-bottom: 1px solid var(--line);
}

.toc-list li:last-child {
  border-bottom: 0;
}

.toc-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 14px;
}

.toc-list a:hover {
  background: #fafafa;
  color: var(--accent);
}

.toc-list span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

/* —— Catalog section headers —— */
.catalog-section-title {
  margin: 32px 0 8px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.catalog-sub {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  max-width: 70ch;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.site-top {
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.site-top a:focus-visible,
.sub-tabs a:focus-visible,
.btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.btn:focus-visible {
  outline-color: var(--accent);
}

.book-cover,
.hero-book .cover-lg {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.newsletter-inline button {
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.newsletter-inline button:active {
  transform: translateY(1px);
}

::selection {
  background: rgba(237, 66, 89, 0.18);
  color: var(--text);
}
