:root {
  --ink: #101416;
  --paper: #f1f0eb;
  --paper-2: #e4e3dd;
  --signal: #00bdda;
  --muted: #737b7e;
  --line: rgba(16,20,22,.2);
  --reader-width: 760px;
  --header-height: 68px;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Arial, "Microsoft YaHei", sans-serif; }
a { color: inherit; }
button { color: inherit; font: inherit; }
.reader-skip { position: fixed; z-index: 1000; top: -80px; left: 1rem; padding: .8rem 1rem; color: #fff; background: #111; }
.reader-skip:focus { top: 1rem; }

.library-body { min-height: 100vh; background-image: linear-gradient(rgba(16,20,22,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(16,20,22,.08) 1px, transparent 1px); background-size: 72px 72px; }
.library-header { position: sticky; z-index: 20; top: 0; height: 72px; display: flex; justify-content: space-between; align-items: stretch; color: #f7f7f4; background: rgba(8,10,11,.97); border-bottom: 3px solid var(--signal); }
.library-brand { display: flex; min-width: 280px; padding: .85rem 2rem; flex-direction: column; justify-content: center; text-decoration: none; border-right: 1px solid rgba(255,255,255,.2); }
.library-brand b { letter-spacing: .18em; }
.library-brand span { margin-top: .25rem; color: #929a9c; font: .58rem Consolas, monospace; letter-spacing: .12em; }
.library-header nav { display: flex; }
.library-header nav a { display: grid; place-items: center; min-width: 170px; padding: 0 1rem; color: #bbc0c1; border-left: 1px solid rgba(255,255,255,.18); font: .65rem Consolas, monospace; text-decoration: none; }
.library-header nav a:hover { color: var(--signal); }
.library-hero { min-height: 330px; padding: 7rem max(5vw, 2rem) 3rem; color: #fff; background: #0b0e0f; clip-path: polygon(0 0,100% 0,100% 85%,72% 85%,68% 100%,0 100%); }
.library-hero > p:first-child { color: var(--signal); font: .7rem Consolas, monospace; letter-spacing: .15em; }
.library-hero h1 { margin: 1rem 0; font-size: clamp(3rem, 7vw, 7rem); line-height: .78; letter-spacing: -.07em; }
.library-hero h1 span { display: block; margin-top: 1rem; color: #888f91; font: .18em Consolas, monospace; letter-spacing: .16em; }
.library-hero > p:last-child { max-width: 620px; color: #aeb4b5; line-height: 1.8; }
.library-grid { max-width: 1240px; margin: 5rem auto 2rem; padding: 0 2rem; }
.novel-card { display: grid; grid-template-columns: minmax(260px, 34%) 1fr; min-height: 520px; background: rgba(248,248,244,.96); border: 1px solid var(--ink); box-shadow: 18px 18px 0 var(--ink); }
.novel-cover { position: relative; min-height: 520px; overflow: hidden; background: #15191a; }
.novel-cover img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.08); }
.novel-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, transparent 42%, rgba(0,189,218,.66) 42% 60%, transparent 60%); mix-blend-mode: multiply; }
.novel-cover span { position: absolute; z-index: 2; right: 1rem; bottom: 1rem; color: #fff; font: 700 .72rem/1.4 Consolas, monospace; text-align: right; }
.novel-card-copy { display: flex; padding: clamp(2rem,5vw,5rem); flex-direction: column; justify-content: center; }
.novel-status { color: var(--signal); font: .68rem Consolas, monospace; letter-spacing: .13em; }
.novel-card h2 { max-width: 760px; margin: .7rem 0 .3rem; font-size: clamp(2.1rem,4vw,4.4rem); line-height: 1; }
.novel-en { margin: 0 0 2rem; color: var(--muted); font: .72rem Consolas, monospace; letter-spacing: .08em; text-transform: uppercase; }
.novel-description { max-width: 680px; font-size: 1rem; line-height: 2; }
.novel-progress { margin: 1.2rem 0 0; }
.novel-progress span { color: var(--muted); font-size: .78rem; }
.novel-progress i { display: block; height: 4px; margin-top: .6rem; overflow: hidden; background: #cfd1cd; }
.novel-progress b { display: block; height: 100%; background: var(--signal); }
.novel-actions { display: flex; gap: .8rem; margin-top: 2rem; }
.novel-actions a { padding: 1rem 1.4rem; border: 1px solid var(--ink); font-size: .8rem; font-weight: 700; text-decoration: none; }
.novel-actions .primary-action { color: #fff; background: var(--ink); }
.novel-actions a:hover { color: #000; background: var(--signal); }
.future-card { max-width: 1240px; margin: 5rem auto; padding: 3rem; border: 1px dashed var(--muted); }
.future-card span { color: var(--signal); font: .65rem Consolas, monospace; }
.future-card h2 { margin-bottom: .4rem; font-size: 2rem; }
.future-card p { color: var(--muted); }
.library-body footer { display: flex; justify-content: space-between; padding: 2rem 5vw; color: #959b9c; background: #0b0e0f; font: .65rem Consolas, monospace; }

.reader-body { min-height: 100vh; transition: background .2s, color .2s; }
[data-reader-theme="dark"] .reader-body { --ink: #ecece8; --paper: #151718; --paper-2: #202324; --muted: #a0a7a8; --line: rgba(255,255,255,.17); }
.reading-line { position: fixed; z-index: 100; top: 0; left: 0; height: 3px; width: 0; background: var(--signal); }
.reader-header { position: fixed; z-index: 80; inset: 0 0 auto; height: var(--header-height); display: grid; grid-template-columns: 200px 1fr 230px; align-items: stretch; color: var(--ink); background: color-mix(in srgb, var(--paper) 94%, transparent); border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.reader-back { display: grid; place-items: center; border-right: 1px solid var(--line); font-size: .8rem; font-weight: 700; text-decoration: none; }
.reader-title { min-width: 0; display: flex; padding: 0 1.4rem; flex-direction: column; justify-content: center; }
.reader-title b,.reader-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-title b { font-size: .8rem; }.reader-title span { margin-top: .2rem; color: var(--muted); font-size: .67rem; }
.reader-tools { display: grid; grid-template-columns: repeat(3,1fr); }
.reader-tools button { border: 0; border-left: 1px solid var(--line); background: transparent; cursor: pointer; font-size: .72rem; }
.reader-tools button:hover { color: #001316; background: var(--signal); }
.reader-layout { min-height: 100vh; padding-top: var(--header-height); }
.reader-toc { position: fixed; z-index: 90; inset: var(--header-height) auto 0 0; width: min(370px, 88vw); padding: 2rem; overflow: auto; color: #f0f1ed; background: #0c0f10; transform: translateX(-102%); transition: transform .3s cubic-bezier(.76,0,.24,1); }
.reader-toc.is-open { transform: none; box-shadow: 18px 0 50px rgba(0,0,0,.3); }
.toc-head { position: sticky; z-index: 2; top: -2rem; display: grid; grid-template-columns: 1fr auto; padding: 2rem 0 1rem; background: #0c0f10; }
.toc-head p { grid-column: 1; margin: 0; color: var(--signal); font: .6rem Consolas, monospace; }
.toc-head h2 { grid-column: 1; margin: .3rem 0; font-size: 2rem; }
.toc-head button { grid-column: 2; grid-row: 1/3; width: 44px; border: 1px solid #555; color: #fff; background: transparent; cursor: pointer; }
#tocNav section { margin: 1.5rem 0; border-top: 1px solid #323637; }
#tocNav h3 { margin: 0; padding: 1rem 0 .6rem; color: #8c9394; font: .7rem Consolas, monospace; }
#tocNav a { display: block; padding: .62rem .7rem; color: #d3d5d1; border-left: 2px solid transparent; font-size: .82rem; line-height: 1.5; text-decoration: none; }
#tocNav a:hover,#tocNav a[aria-current="page"] { color: #fff; border-left-color: var(--signal); background: rgba(0,189,218,.12); }
.toc-scrim { position: fixed; z-index: 85; inset: var(--header-height) 0 0; visibility: hidden; background: rgba(0,0,0,.46); opacity: 0; transition: opacity .25s; }
.toc-scrim.is-open { visibility: visible; opacity: 1; }
.reader-main { min-height: calc(100vh - var(--header-height)); padding: 5rem max(1.5rem, 4vw) 8rem; }
.reader-loading { max-width: var(--reader-width); margin: 16vh auto; color: var(--muted); text-align: center; }
.reader-loading.is-error { color: #b32b2b; }
.chapter-article { max-width: var(--reader-width); margin: auto; }
.chapter-head { margin: 0 0 4rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); }
.chapter-head > p:first-child { margin: 0; color: var(--signal); font: .68rem Consolas, monospace; letter-spacing: .12em; }
.chapter-head h1 { margin: 1.2rem 0 .6rem; font-size: clamp(2.2rem,6vw,4rem); line-height: 1.12; letter-spacing: -.04em; }
.chapter-head > p:last-child { margin: 0; color: var(--muted); }
.chapter-illustration { position: relative; width: min(100%, 900px); aspect-ratio: 16/9; margin: 0 0 4.5rem; overflow: hidden; border: 1px solid var(--ink); background: var(--paper-2); }
.chapter-illustration img { width: 100%; height: 100%; object-fit: cover; }
#chapterImagePlaceholder { position: absolute; inset: 0; display: grid; place-content: center; padding: 1rem; text-align: center; background-image: linear-gradient(var(--line) 1px, transparent 1px),linear-gradient(90deg,var(--line) 1px,transparent 1px); background-size: 36px 36px; }
#chapterImagePlaceholder[hidden] { display: none; }
#chapterImagePlaceholder b { font: 1.1rem Consolas, monospace; letter-spacing: .12em; }
#chapterImagePlaceholder span,#chapterImagePlaceholder small { margin-top: .6rem; color: var(--muted); font-size: .7rem; }
.chapter-copy { font-family: "Noto Serif SC", "Songti SC", SimSun, serif; font-size: 1.1rem; line-height: 2.15; letter-spacing: .02em; }
[data-reader-size="small"] .chapter-copy { font-size: .98rem; }
[data-reader-size="large"] .chapter-copy { font-size: 1.25rem; }
.chapter-copy p { margin: 0 0 1.45em; text-align: justify; }
.chapter-copy blockquote { margin: 2rem 0; padding: 1.1rem 1.5rem; border-left: 4px solid var(--signal); color: var(--muted); background: var(--paper-2); }
.chapter-copy hr { width: 80px; margin: 4rem auto; border: 0; border-top: 1px solid var(--ink); }
.chapter-pagination { display: flex; justify-content: space-between; gap: 1rem; margin-top: 6rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.chapter-pagination a { min-width: 140px; padding: 1rem; border: 1px solid var(--ink); font-size: .78rem; font-weight: 700; text-align: center; text-decoration: none; }
.chapter-pagination a:hover { color: #001316; background: var(--signal); }

@media (max-width: 760px) {
  .library-header { height: 62px; }.library-brand { min-width: auto; padding: .7rem 1rem; }.library-brand b { font-size: .78rem; }.library-header nav a { min-width: auto; padding: 0 .75rem; }.library-header nav a:first-child { display: none; }
  .library-hero { min-height: 300px; padding: 5rem 1.2rem 3rem; clip-path: none; }.library-hero h1 { font-size: 3.2rem; }
  .library-grid { margin-top: 2.5rem; padding: 0 1rem; }.novel-card { display: block; box-shadow: 8px 8px 0 var(--ink); }.novel-cover { min-height: 300px; height: 46vh; }.novel-card-copy { padding: 2rem 1.2rem; }.novel-card h2 { font-size: 2.1rem; }.novel-actions { flex-direction: column; }.novel-actions a { text-align: center; }.future-card { margin: 3rem 1rem; padding: 2rem 1rem; }
  .reader-header { grid-template-columns: 68px 1fr 150px; }.reader-back { font-size: 0; }.reader-back::after { content: "←"; font-size: 1.1rem; }.reader-title { padding: 0 .7rem; }.reader-title b { font-size: .7rem; }.reader-title span { font-size: .58rem; }.reader-tools button { font-size: .64rem; }
  .reader-main { padding: 3rem 1.15rem 6rem; }.chapter-head { margin-bottom: 2.5rem; }.chapter-illustration { margin-bottom: 3rem; }.chapter-copy { line-height: 2; }.chapter-copy p { text-align: left; }.chapter-pagination { flex-direction: column; }.chapter-pagination a { width: 100%; }
}

html { scrollbar-gutter: stable; }
[hidden] { display: none !important; }
.reader-main, .chapter-article, .novel-card-copy { min-width: 0; }
.reader-toc { overscroll-behavior: contain; }
.reader-loading button { display: block; margin: 1.5rem auto; min-height: 44px; padding: .6rem 1.5rem; color: var(--ink); background: var(--paper-2); border: 1px solid var(--line); cursor: pointer; }
.chapter-copy { overflow-wrap: anywhere; }
.novel-actions { flex-wrap: wrap; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
.novel-card { border-radius: 8px; overflow: hidden; box-shadow: 10px 10px 0 rgba(16,20,22,.12); }
.library-grid { display: grid; gap: 3rem; }
.chapter-illustration img { object-fit: contain; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition-duration: .01ms !important; } }
