:root {
  --ink: #1e2421;
  --muted: #66706a;
  --paper: #f7f8f5;
  --surface: #ffffff;
  --line: #dce1dc;
  --forest: #174c3c;
  --forest-2: #0f352a;
  --coral: #e66b4f;
  --gold: #e6bb58;
  --reader-size: 19px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: 'Segoe UI', Tahoma, sans-serif; line-height: 1.6; letter-spacing: 0; }
a { color: inherit; text-decoration-color: rgba(23, 76, 60, .4); text-underline-offset: 3px; }
a:hover { color: var(--forest); }
button, input, select { font: inherit; letter-spacing: 0; }
button, select { cursor: pointer; }
img { display: block; max-width: 100%; }
h1, h2, h3, p { overflow-wrap: anywhere; }
h1, h2, h3 { margin: 0; line-height: 1.08; letter-spacing: 0; }
h1, h2 { font-family: 'Libre Caslon Display', Georgia, serif; font-weight: 400; }
h1 { font-size: 52px; }
h2 { font-size: 34px; }
h3 { font-size: 19px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; padding: 10px 14px; background: var(--surface); }
.skip-link:focus { top: 12px; }

.site-header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--line); background: rgba(247, 248, 245, .96); backdrop-filter: blur(14px); }
.header-inner { width: min(1400px, calc(100% - 40px)); min-height: 72px; margin: 0 auto; display: grid; grid-template-columns: auto auto minmax(220px, 1fr) auto; align-items: center; gap: 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; text-decoration: none; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 4px; background: var(--forest); color: white; font-family: 'Libre Caslon Display', Georgia, serif; font-size: 22px; }
.main-nav { display: flex; gap: 22px; }
.main-nav a, .site-footer nav a { color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.header-search { display: flex; justify-self: end; width: min(380px, 100%); border: 1px solid var(--line); background: var(--surface); }
.header-search input { min-width: 0; flex: 1; border: 0; outline: 0; padding: 10px 12px; background: transparent; }
.header-search button { border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--forest); padding: 0 14px; font-weight: 700; }
.text-button { border: 0; background: transparent; color: var(--forest); font-weight: 700; white-space: nowrap; }

.primary-button, .secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--forest); border-radius: 4px; padding: 10px 18px; text-decoration: none; font-weight: 700; }
.primary-button { background: var(--forest); color: white; }
.primary-button:hover { background: var(--forest-2); color: white; }
.secondary-button { background: transparent; color: var(--forest); }
.lead-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.eyebrow { margin: 0 0 10px; color: var(--coral); font-size: 12px; font-weight: 700; text-transform: uppercase; }

.home-lead { min-height: min(660px, calc(100vh - 72px)); padding: 64px max(24px, calc((100% - 1240px) / 2)); display: grid; grid-template-columns: 1fr minmax(260px, 390px); align-items: center; gap: 72px; background: var(--forest-2); color: white; }
.home-lead h1 { max-width: 760px; font-size: 76px; }
.home-lead p:not(.eyebrow) { max-width: 720px; color: #cfddd6; font-size: 18px; }
.home-lead .secondary-button { border-color: #9eb7ac; color: white; }
.lead-cover { justify-self: center; transform: rotate(2deg); box-shadow: 26px 30px 0 rgba(230, 187, 88, .9); transition: transform .25s ease; }
.lead-cover:hover { transform: rotate(0); }
.lead-cover img { width: 330px; aspect-ratio: 3/4; object-fit: cover; }
.genre-strip, .content-section { padding: 70px max(24px, calc((100% - 1240px) / 2)); }
.genre-strip { background: var(--gold); }
.genre-links { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1px solid rgba(30,36,33,.25); }
.genre-links a { min-height: 98px; display: flex; flex-direction: column; justify-content: center; border-bottom: 1px solid rgba(30,36,33,.25); padding: 16px 12px; text-decoration: none; }
.genre-links span { color: rgba(30,36,33,.65); font-size: 13px; }
.section-heading { margin-bottom: 34px; display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.section-heading > a { color: var(--forest); font-weight: 700; }
.alt-band { background: #edf0eb; }
.compact-section { padding-top: 24px; }

.novel-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 36px 24px; }
.novel-card { min-width: 0; display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 17px; align-items: start; }
.cover-link { display: block; }
.book-cover, .cover-placeholder { width: 100%; aspect-ratio: 3/4; object-fit: cover; background: #dce1dc; }
.cover-placeholder { display: grid; place-items: center; color: var(--forest); font-family: 'Libre Caslon Display', Georgia, serif; font-size: 42px; }
.novel-card h3 a, .ranking-list h2 a { text-decoration: none; }
.novel-card p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.5; }
.card-stats { display: flex; gap: 16px; margin: 12px 0 0; }
.card-stats div { display: grid; }
.card-stats dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.card-stats dd { margin: 0; font-size: 12px; font-weight: 700; }
.empty-state { width: 100%; padding: 44px; border: 1px dashed #b8c1ba; text-align: center; color: var(--muted); }

.page-intro { padding: 68px max(24px, calc((100% - 1100px) / 2)) 44px; border-bottom: 1px solid var(--line); background: var(--surface); }
.page-intro > p:not(.eyebrow) { max-width: 720px; color: var(--muted); }
.breadcrumbs { margin-bottom: 28px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; color: var(--muted); font-size: 13px; }
.breadcrumbs li + li::before { content: '/'; margin-right: 8px; color: #a2aaa5; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 32px; }
.tabs a { padding: 9px 14px; border: 1px solid var(--line); border-radius: 4px; text-decoration: none; }
.tabs a[aria-current='page'] { border-color: var(--forest); background: var(--forest); color: white; }
.sort-control { margin: 0 0 28px auto; display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.sort-control select { border: 1px solid var(--line); background: var(--surface); padding: 8px 34px 8px 10px; }
.pagination { display: flex; justify-content: center; gap: 6px; padding-top: 44px; }
.pagination a, .pagination span { min-width: 42px; min-height: 42px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.pagination span { border-color: var(--forest); background: var(--forest); color: white; }

.ranking-list { width: min(1100px, calc(100% - 48px)); margin: 0 auto; padding: 30px 0 80px; }
.ranking-list article { display: grid; grid-template-columns: 62px 76px minmax(0, 1fr) auto; gap: 22px; align-items: center; border-bottom: 1px solid var(--line); padding: 22px 0; }
.rank-number { font-family: 'Libre Caslon Display', Georgia, serif; font-size: 40px; color: var(--coral); }
.rank-cover img { width: 76px; }
.ranking-list h2 { font-size: 27px; }
.ranking-list article p:not(.eyebrow) { margin: 8px 0 0; color: var(--muted); }

.novel-hero { padding: 30px max(24px, calc((100% - 1120px) / 2)) 70px; background: var(--surface); }
.novel-hero-grid { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 54px; align-items: start; }
.detail-cover img { width: 260px; box-shadow: 18px 20px 0 var(--gold); }
.novel-summary h1 { font-size: 58px; }
.byline { color: var(--muted); }
.byline span { font-size: 12px; }
.novel-description { max-width: 760px; font-size: 17px; }
.novel-facts { display: flex; flex-wrap: wrap; gap: 34px; margin: 26px 0; padding: 20px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.novel-facts div { display: grid; }
.novel-facts dt { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.novel-facts dd { margin: 2px 0 0; font-weight: 700; }
.novel-meta-band { padding: 48px max(24px, calc((100% - 1120px) / 2)); background: var(--forest); color: white; }
.novel-meta-band h2 { font-size: 28px; }
.publication-details { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.publication-details dt { color: #aac1b7; font-size: 12px; text-transform: uppercase; }
.publication-details dd { margin: 5px 0 0; }
.status-label { color: var(--gold); font-weight: 700; }
.chapter-links, .chapter-directory { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.chapter-links li, .chapter-directory li { border-bottom: 1px solid var(--line); }
.chapter-links a, .chapter-directory a { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 22px; padding: 11px 4px; text-decoration: none; }
.chapter-links small, .chapter-directory small { color: var(--muted); white-space: nowrap; }
.chapter-directory { display: grid; grid-template-columns: 1fr 1fr; column-gap: 40px; counter-reset: chapter; }

.reader-page { --paper: #f2f0e8; }
.reader-shell { width: min(900px, calc(100% - 40px)); margin: 0 auto; padding: 32px 0 70px; }
.chapter-header { padding: 30px 0 34px; border-bottom: 1px solid var(--line); text-align: center; }
.chapter-header h1 { font-size: 48px; }
.chapter-header > p:last-child { color: var(--muted); font-size: 13px; }
.reading-tools { position: sticky; top: 86px; z-index: 10; width: fit-content; margin: 20px 0 14px auto; display: flex; border: 1px solid var(--line); background: var(--surface); }
.reading-tools button { width: 58px; height: 40px; border: 0; border-right: 1px solid var(--line); background: transparent; }
.reading-tools button:last-child { width: 72px; border: 0; }
.chapter-content { padding: 30px 52px 50px; font-family: Georgia, serif; font-size: var(--reader-size); line-height: 1.9; background: var(--surface); }
.chapter-content p { margin: 0 0 1.35em; }
.chapter-nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: stretch; gap: 8px; margin-top: 22px; }
.chapter-nav a { min-height: 76px; display: flex; flex-direction: column; justify-content: center; padding: 12px 16px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; }
.chapter-nav > div:last-child a { text-align: right; }
.chapter-nav small { color: var(--muted); }
.directory-link { align-items: center; }
.chapter-rights { margin-top: 35px; padding-top: 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.reader-page.reader-dark { --paper: #202521; --surface: #2b312d; --ink: #e9ece9; --muted: #b1b8b2; --line: #4b554e; }

.large-search { max-width: 720px; display: flex; margin-top: 26px; }
.large-search input { min-width: 0; flex: 1; border: 1px solid var(--line); padding: 12px 14px; background: var(--paper); }
.large-search button { border-radius: 0 4px 4px 0; }
.tool-shell, .status-page { width: min(660px, calc(100% - 40px)); min-height: 62vh; margin: 0 auto; padding: 90px 0; }
.tool-shell > p, .status-page > p { color: var(--muted); }
.account-form, .login-dialog form { display: grid; gap: 16px; margin-top: 30px; }
.account-form label, .login-dialog label { display: grid; gap: 6px; font-weight: 600; }
.account-form input, .login-dialog input { width: 100%; border: 1px solid var(--line); padding: 11px 12px; background: var(--surface); }
.form-status { min-height: 24px; color: var(--coral); }
.comments, .account-list { display: grid; gap: 10px; }
.comment, .account-list a { padding: 16px 18px; border: 1px solid var(--line); background: var(--surface); }
.comment p { margin: 6px 0; color: var(--muted); }
.comment small, .account-list span { color: var(--muted); font-size: 12px; }
.account-list a { display: flex; justify-content: space-between; gap: 20px; text-decoration: none; }
.login-dialog { width: min(440px, calc(100% - 32px)); border: 0; border-radius: 6px; padding: 34px; box-shadow: 0 20px 70px rgba(0,0,0,.25); }
.login-dialog::backdrop { background: rgba(15,28,23,.64); }
.dialog-close { position: absolute; right: 15px; top: 10px; border: 0; background: transparent; font-size: 28px; }
.site-footer { padding: 55px max(24px, calc((100% - 1240px) / 2)); display: flex; justify-content: space-between; gap: 40px; border-top: 1px solid var(--line); background: var(--ink); color: white; }
.site-footer p { color: #aeb6b0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; }
.site-footer nav a { color: #d6dbd7; }
.footer-brand { color: white; }

@media (max-width: 1050px) {
  .header-inner { grid-template-columns: auto 1fr auto; }
  .main-nav { display: none; }
  .novel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .genre-links { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  h1 { font-size: 39px; }
  h2 { font-size: 29px; }
  .header-inner { width: calc(100% - 24px); min-height: 64px; grid-template-columns: 1fr auto; gap: 10px; }
  .header-search { grid-column: 1 / -1; width: 100%; margin-bottom: 10px; }
  .home-lead { min-height: calc(100vh - 116px); grid-template-columns: 1fr 130px; gap: 18px; padding-top: 36px; padding-bottom: 42px; align-content: center; }
  .home-lead h1 { font-size: 46px; }
  .home-lead p:not(.eyebrow) { font-size: 15px; }
  .lead-cover { box-shadow: 10px 12px 0 var(--gold); }
  .lead-cover img { width: 130px; }
  .genre-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .genre-strip, .content-section { padding-top: 46px; padding-bottom: 46px; }
  .novel-grid { grid-template-columns: 1fr; }
  .novel-card { grid-template-columns: 96px minmax(0, 1fr); }
  .section-heading { align-items: start; flex-direction: column; }
  .novel-hero-grid { grid-template-columns: 120px minmax(0, 1fr); gap: 24px; }
  .detail-cover img { width: 120px; box-shadow: 8px 10px 0 var(--gold); }
  .novel-summary h1 { font-size: 36px; }
  .novel-description { grid-column: 1 / -1; }
  .publication-details, .chapter-directory { grid-template-columns: 1fr; }
  .ranking-list article { grid-template-columns: 42px 64px minmax(0, 1fr); gap: 12px; }
  .ranking-list article > strong { grid-column: 3; }
  .ranking-list article p:not(.eyebrow) { display: none; }
  .chapter-header h1 { font-size: 35px; }
  .chapter-content { padding: 24px 20px 38px; }
  .chapter-nav { grid-template-columns: 1fr 1fr; }
  .directory-link { grid-column: 1 / -1; grid-row: 2; }
  .site-footer { flex-direction: column; }
}

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

@media (max-width: 520px) {
  .novel-hero { padding-top: 24px; }
  .novel-hero-grid { grid-template-columns: 1fr; gap: 30px; }
  .detail-cover { width: min(46vw, 160px); }
  .detail-cover img { width: 100%; box-shadow: 10px 12px 0 var(--gold); }
  .novel-summary h1 { font-size: 40px; overflow-wrap: normal; }
}
