:root {
  --bg: #17191f;
  --panel: #222631;
  --panel-soft: #1d2028;
  --panel-2: #2b303c;
  --text: #eceef5;
  --muted: #a7adbb;
  --line: #363d4c;
  --accent: #ff9518;
  --accent-2: #7c5cff;
  --kofi: #29abe0;
  --kofi-hover: #1f9bcc;
  --patreon: #ff424d;
  --patreon-hover: #e83b45;
  --radius: 22px;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);

  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: dark;
}

/* Base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  background-image: none;
  color: var(--text);
}

main {
  background: var(--bg);
  background-image: none;
}

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

code {
  background: #111319;
  border: 1px solid var(--line);
  padding: 0.15em 0.35em;
  border-radius: 6px;
  color: #fff;
}

.container {
  width: min(1120px, 92vw);
  margin: 0 auto;
}

.muted {
  color: var(--muted);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(17, 19, 24, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: #050609;
  color: #fff;
  font-weight: 900;
  border: 1px solid #333;
}

.brand small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
}

.top-nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.top-nav a {
  color: #d7dbe5;
}

.support-link,
.button-like {
  background: linear-gradient(135deg, var(--accent), #ff7b00);
  color: #fff !important;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 800;
  box-shadow: 0 10px 25px rgba(255, 149, 24, 0.2);
}

/* Homepage */
.home-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 24px;
  align-items: stretch;
  padding: 54px 0 30px;
}

.welcome-card {
  padding: 42px;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(43, 48, 60, 0.92), rgba(26, 29, 38, 0.92));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
}

.welcome-card h1 {
  font-size: clamp(1.85rem, 3.3vw, 3.45rem);
  line-height: 1.04;
  margin: 0.35em 0 0.28em;
}

.welcome-card p,
.page-heading p,
.featured-card p,
.synopsis {
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.7;
}

.featured-card {
  display: grid;
  grid-template-columns: 1.05fr 0.75fr;
  gap: 24px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 34px;
  background: linear-gradient(135deg, #202631, #171a22);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.featured-card h2 {
  font-size: clamp(1.7rem, 3vw, 3rem);
  line-height: 1.04;
  margin: 0.25em 0;
}

.featured-card img {
  width: 100%;
  max-height: 310px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.45);
}

.compact-feature {
  height: 100%;
}

/* Sections */
.section-block {
  padding: 42px 0;
}

.section-title-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-end;
  margin-bottom: 22px;
}

.section-title-row h2 {
  font-size: 2rem;
  margin: 0;
}

.section-title-row a,
.section-title-row span {
  color: var(--muted);
}

.page-heading {
  padding: 64px 0 22px;
}

.page-heading h1 {
  font-size: clamp(2rem, 4vw, 3.5rem);
  line-height: 1.04;
  margin: 0.2em 0;
}

/* Book cards */
.book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}

.book-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  transition: 0.18s transform, 0.18s border-color;
}

.book-card:hover,
.library-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 149, 24, 0.55);
}

.book-card img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
}

.book-card h3 {
  margin: 14px 14px 4px;
  font-size: 1.02rem;
}

.book-card p {
  margin: 0 14px 16px;
  color: var(--accent);
  font-weight: 800;
}

/* Library page */
.library-list {
  display: grid;
  gap: 18px;
  padding-bottom: 60px;
}

.library-card {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  transition: 0.18s;
}

.library-card img {
  width: 130px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 12px;
}

.library-card h2 {
  margin: 4px 0;
}

.library-card p {
  color: var(--muted);
  line-height: 1.6;
}

/* Novel page */
.novel-hero {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 36px;
  padding: 70px 0 28px;
  align-items: start;
}

.novel-cover-large {
  width: 100%;
  border-radius: 20px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}

.novel-hero h1 {
  font-size: clamp(2.1rem, 5vw, 4.3rem);
  line-height: 1.05;
  margin: 0.1em 0;
}

.subtitle {
  color: #d5d9e4;
  font-size: 1.2rem;
}

.meta-pills,
.genre-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.meta-pills span,
.genre-row span {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  padding: 8px 12px;
  color: #d8dce7;
}

.meta-pills.small span {
  font-size: 0.9rem;
  padding: 6px 10px;
}

/* Chapter list / TOC */
.compact-note {
  margin: 0.35rem 0 0;
  max-width: 680px;
  line-height: 1.55;
}

.chapter-tools {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 12px;
  margin-bottom: 16px;
}

.chapter-tools input,
.chapter-tools select {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  border-radius: 12px;
  padding: 14px 15px;
  font: inherit;
}

.chapter-list {
  display: grid;
  gap: 10px;
}

.chapter-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}

.chapter-row small {
  color: var(--muted);
}

.load-more {
  display: block;
  margin: 18px auto 0;
  border: 1px solid rgba(255, 149, 24, 0.45);
  background: rgba(255, 149, 24, 0.12);
  color: var(--text);
  border-radius: 12px;
  padding: 13px 18px;
  font-weight: 900;
  cursor: pointer;
}

.load-more:hover {
  background: rgba(255, 149, 24, 0.2);
}

/* Chapter reading page */
.chapter-page {
  max-width: 1120px;
  padding: 44px 0 70px;
  background: var(--bg);
  background-image: none;
}

.chapter-header {
  text-align: center;
  background-image: none;
}

.chapter-header h1 {
  font-size: clamp(1.35rem, 2.4vw, 2.05rem);
  line-height: 1.2;
  margin: 0.45em 0 0.2em;
}

.back-link {
  color: var(--muted);
}

.chapter-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin: 18px 0 20px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: #8f96a5;
  font-size: 0.94rem;
}

.chapter-nav a,
.chapter-nav span,
.chapter-nav a:visited {
  display: inline;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: #aeb4c2;
  font-weight: 650;
  text-decoration: none;
}

.chapter-nav a:hover {
  color: #e1e4ec;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.chapter-nav .disabled,
.chapter-nav span.disabled,
.chapter-nav a.disabled {
  color: #555b66;
  opacity: 0.75;
  pointer-events: none;
  cursor: not-allowed;
  text-decoration: none;
}

.chapter-nav .nav-divider {
  color: #555b66;
  user-select: none;
}

.chapter-content {
  max-width: 960px;
  margin: 24px auto 18px;
  background: var(--panel-soft);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 14px;
  box-shadow: none;
  padding: 42px 54px 34px;
  color: #eef0f6;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.16rem;
  line-height: 1.85;
  background-image: none;
}

.chapter-content p {
  margin: 0 0 1.25em;
}

/* Chapter support block */
.chapter-support {
  margin: 30px 0 18px;
  padding: 16px 0;
  border-width: 1px 0;
  border-style: solid;
  border-color: var(--line);
  border-radius: 0;
  background: transparent;
  background-image: none;
  box-shadow: none;
}

.chapter-support-kicker {
  display: none;
}

.chapter-support h2 {
  margin: 0 0 5px;
  font-size: 1rem;
  line-height: 1.25;
}

.chapter-support p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0 0 10px;
  font-size: 0.92rem;
}

.chapter-support-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* Support page */
.support-page {
  padding: 80px 0;
}

.support-card-large {
  max-width: 760px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 48px;
  text-align: center;
  box-shadow: var(--shadow);
}

.support-card-large h1 {
  font-size: 3rem;
}

.support-card-large p {
  color: var(--muted);
  line-height: 1.7;
}

.support-main-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 26px;
}

/* Shared support buttons */
.chapter-support-actions a,
.support-main-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 9px 15px;
  border: 1px solid #333947;
  background: #1b1e26;
  color: #eef0f6 !important;
  font-weight: 800;
  font-size: 0.92rem;
  line-height: 1;
  box-shadow: none;
  transition: 0.18s background, 0.18s border-color, 0.18s transform;
}

.chapter-support-actions a:hover,
.support-main-actions a:hover {
  transform: translateY(-1px);
}

/* Ko-fi button */
.chapter-support-actions a[href*="ko-fi.com"],
.support-main-actions a[href*="ko-fi.com"] {
  background: var(--kofi);
  border-color: var(--kofi);
  color: #ffffff !important;
}

.chapter-support-actions a[href*="ko-fi.com"]:hover,
.support-main-actions a[href*="ko-fi.com"]:hover {
  background: var(--kofi-hover);
  border-color: var(--kofi-hover);
}

/* Patreon button */
.chapter-support-actions a[href*="patreon.com"],
.support-main-actions a[href*="patreon.com"] {
  background: var(--patreon);
  border-color: var(--patreon);
  color: #ffffff !important;
}

.chapter-support-actions a[href*="patreon.com"]:hover,
.support-main-actions a[href*="patreon.com"]:hover {
  background: var(--patreon-hover);
  border-color: var(--patreon-hover);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 26px 0;
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

/* 404 page */
.error-page {
  padding: 90px 0;
}

.error-card {
  max-width: 720px;
  margin: 0 auto;
  padding: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  text-align: center;
  box-shadow: var(--shadow);
}

.error-card h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  margin: 0.2em 0;
}

.error-card p {
  color: var(--muted);
  line-height: 1.7;
}

.error-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 24px;
}

.error-actions a:not(.button-like) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: #d7dbe5;
  font-weight: 800;
}

.error-actions a:not(.button-like):hover {
  border-color: rgba(255, 149, 24, 0.55);
  color: var(--accent);
}

/* Responsive */
@media (max-width: 900px) {
  .home-hero-grid {
    grid-template-columns: 1fr;
    padding-top: 38px;
  }

  .featured-card {
    grid-template-columns: 1fr;
  }

  .featured-card img {
    max-height: 360px;
  }
}

@media (max-width: 760px) {
  @media (max-width: 760px) {
  .site-header {
    position: static;
  }

  .nav-wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
  }

  .brand {
    gap: 10px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 0.9rem;
  }

  .brand strong {
    font-size: 1rem;
  }

  .brand small {
    font-size: 0.82rem;
  }

  .top-nav {
    width: 100%;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
  }

  .top-nav a {
    font-size: 0.95rem;
  }

  .support-link {
    padding: 9px 13px;
    border-radius: 10px;
    font-size: 0.92rem;
  }

  .footer-grid {
    flex-direction: column;
    align-items: flex-start;
  }

  .novel-hero,
  .library-card {
    grid-template-columns: 1fr;
  }

  .library-card img {
    width: 100%;
    max-width: 180px;
  }

  .book-grid {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .chapter-page {
    max-width: 94vw;
  }

  .chapter-content {
    max-width: 100%;
    margin: 18px auto 12px;
    padding: 28px 20px 20px;
    font-size: 1.07rem;
    line-height: 1.82;
    border-radius: 12px;
  }

  .chapter-nav {
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
  }

  .chapter-support {
    padding: 16px 0;
  }

  .chapter-support-actions {
    gap: 8px;
  }

  .chapter-support-actions a {
    flex: 1;
    min-width: 120px;
  }
}

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

  .welcome-card,
  .featured-card,
  .support-card-large {
    padding: 24px;
  }

  .support-main-actions,
  .error-actions {
    flex-direction: column;
  }

  .support-main-actions a {
    width: 100%;
  }

  .error-card {
    padding: 28px 22px;
  }
}
