:root {
    --story-bg: #fbfaf7;
    --story-surface: #fffefa;
    --story-text: #24221f;
    --story-muted: #77716a;
    --story-line: #ded9d1;
    --story-soft: #f2eee8;
    --story-accent: #8f241c;
    --story-accent-hover: #741c17;
    --story-serif: "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", Georgia, serif;
    --story-sans: Inter, "Segoe UI", "Microsoft YaHei", sans-serif;
}
html[data-theme="dark"] {
    --story-bg: #1d1a18;
    --story-surface: #24211e;
    --story-text: #f3ede5;
    --story-muted: #b9afa5;
    --story-line: #4d4640;
    --story-soft: #302b27;
    --story-accent: #d78174;
    --story-accent-hover: #e49a8f;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: var(--story-bg); }
body.creative-library { min-height: 100vh; margin: 0; background: var(--story-bg); color: var(--story-text); font-family: var(--story-sans); }
a { color: inherit; }
.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; }
.stories-topbar { position: relative; z-index: 4; display: flex; min-height: 76px; align-items: center; justify-content: space-between; gap: 24px; padding: 0 48px; border-bottom: 1px solid var(--story-line); background: color-mix(in srgb, var(--story-bg) 94%, transparent); }
.stories-wordmark { font: 700 24px/1.2 var(--story-serif); letter-spacing: .04em; text-decoration: none; }
.stories-topbar nav { display: flex; align-items: center; gap: 10px; }
.stories-topbar nav > a, .stories-logout button { min-height: 38px; padding: 9px 14px; border: 1px solid var(--story-line); border-radius: 5px; background: var(--story-surface); color: var(--story-text); font: 600 13px/1 var(--story-sans); text-decoration: none; cursor: pointer; }
.stories-logout { margin: 0; }
.stories-logout button:hover, .stories-topbar nav > a:hover { border-color: var(--story-accent); color: var(--story-accent); }
.stories-preferences .preference-switcher { flex-wrap: nowrap; }
.stories-preferences .preference-button { min-height: 32px; background: var(--story-surface); }
.stories-shell { display: grid; min-height: calc(100vh - 77px); grid-template-columns: 340px minmax(500px, 1fr) 340px; }
.stories-sidebar { padding: 28px 30px 40px 46px; border-right: 1px solid var(--story-line); }
.stories-search { margin: 0 0 24px; }
.stories-search > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.stories-search input { min-width: 0; height: 40px; padding: 0 12px; border: 1px solid var(--story-line); border-radius: 5px 0 0 5px; background: var(--story-surface); color: var(--story-text); font: 13px/1 var(--story-sans); }
.stories-search button { min-width: 54px; border: 1px solid var(--story-line); border-left: 0; border-radius: 0 5px 5px 0; background: var(--story-soft); color: var(--story-text); font: 600 12px/1 var(--story-sans); cursor: pointer; }
.filter-group { padding: 15px 0; border-bottom: 1px solid var(--story-line); }
.filter-group summary { cursor: pointer; font: 700 15px/1.4 var(--story-serif); list-style-position: outside; }
.filter-links { display: grid; gap: 3px; padding-top: 10px; }
.filter-link { display: block; padding: 7px 9px; border-left: 2px solid transparent; color: var(--story-muted); font-size: 13px; line-height: 1.35; text-decoration: none; }
.filter-link:hover { background: var(--story-soft); color: var(--story-text); }
.filter-link--active { border-left-color: var(--story-accent); color: var(--story-accent); font-weight: 700; }
.filter-empty { padding: 8px; color: var(--story-muted); font-size: 12px; }
.stories-main { min-width: 0; padding: 46px 48px 54px; }
.reading-feature { min-height: 445px; }
.section-title { margin: 0 0 36px; padding-bottom: 15px; border-bottom: 1px solid var(--story-line); font: 700 32px/1.2 var(--story-serif); letter-spacing: .06em; }
.featured-work h1, .stories-empty h1 { margin: 0; font: 700 clamp(38px, 4vw, 54px)/1.15 var(--story-serif); letter-spacing: .04em; }
.work-meta { margin: 12px 0 0; color: var(--story-muted); font-size: 13px; letter-spacing: .03em; }
.private-badge { margin-left: 8px; color: var(--story-accent); font-weight: 700; }
.chapter-progress { margin: 28px 0 10px; color: var(--story-muted); font-size: 14px; }
.progress-track { width: min(100%, 530px); height: 4px; overflow: hidden; background: var(--story-line); }
.progress-track span { display: block; width: 60%; height: 100%; background: var(--story-accent); }
.featured-summary { max-width: 560px; margin: 27px 0 0; color: var(--story-muted); font: 17px/1.85 var(--story-serif); }
.primary-read { display: inline-flex; min-height: 52px; align-items: center; justify-content: center; margin-top: 34px; padding: 0 28px; border: 1px solid var(--story-accent); border-radius: 5px; background: var(--story-accent); color: #fff8f2; font: 700 16px/1 var(--story-serif); text-decoration: none; }
.primary-read:hover { background: var(--story-accent-hover); border-color: var(--story-accent-hover); }
.shelf { margin-top: 72px; }
.shelf h2, .chapter-list h2 { margin: 0; padding-bottom: 12px; border-bottom: 1px solid var(--story-line); font: 700 22px/1.3 var(--story-serif); }
.shelf-list { display: grid; }
.shelf-row { display: grid; min-height: 56px; grid-template-columns: minmax(130px, .8fr) minmax(190px, 1.4fr) auto; align-items: center; gap: 18px; border-bottom: 1px solid var(--story-line); text-decoration: none; }
.shelf-row:hover { color: var(--story-accent); }
.shelf-row strong { font: 700 17px/1.35 var(--story-serif); }
.shelf-row span, .shelf-row small { color: var(--story-muted); font-size: 12px; }
.browse-all, .rail-browse { display: block; width: fit-content; margin: 22px auto 0; color: var(--story-accent); font: 700 13px/1.4 var(--story-serif); text-decoration: none; }
.stories-rail { padding: 36px 44px 44px 30px; border-left: 1px solid var(--story-line); }
.rail-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--story-line); }
.rail-tabs a { position: relative; padding: 3px 8px 13px; color: var(--story-muted); font: 700 17px/1.3 var(--story-serif); text-decoration: none; }
.rail-tabs a[aria-selected="true"] { color: var(--story-accent); }
.rail-tabs a[aria-selected="true"]::after { position: absolute; right: 0; bottom: -1px; left: 0; height: 2px; background: var(--story-accent); content: ""; }
.rail-work { padding: 25px 0 23px; border-bottom: 1px solid var(--story-line); }
.rail-work h2 { margin: 0; font: 700 21px/1.3 var(--story-serif); }
.rail-work h2 a { text-decoration: none; }
.rail-work h2 a:hover { color: var(--story-accent); }
.rail-work > p:last-child { margin: 13px 0 0; color: var(--story-muted); font: 14px/1.75 var(--story-serif); }
.stories-empty { max-width: 720px; }
.stories-empty > p:not(.section-title) { max-width: 600px; color: var(--story-muted); font: 17px/1.8 var(--story-serif); }
.work-page { width: min(1120px, calc(100vw - 48px)); margin: 0 auto; padding: 38px 0 70px; }
.reader-back { color: var(--story-muted); font-size: 13px; text-decoration: none; }
.reader-back:hover { color: var(--story-accent); }
.work-overview { margin-top: 50px; }
.work-overview h1 { max-width: 820px; margin: 12px 0 0; font: 700 clamp(42px, 6vw, 72px)/1.12 var(--story-serif); }
.work-byline { margin: 17px 0 0; color: var(--story-muted); }
.work-summary { max-width: 760px; margin: 36px 0 0; font: 18px/1.9 var(--story-serif); }
.work-overview dl { display: grid; max-width: 760px; grid-template-columns: repeat(3, 1fr); margin: 54px 0 0; border-top: 1px solid var(--story-line); border-bottom: 1px solid var(--story-line); }
.work-overview dl div { padding: 18px 16px; border-right: 1px solid var(--story-line); }
.work-overview dl div:last-child { border-right: 0; }
.work-overview dt { color: var(--story-muted); font-size: 12px; }
.work-overview dd { margin: 8px 0 0; font: 700 16px/1.3 var(--story-serif); }
.chapter-list { max-width: 760px; margin-top: 70px; }
.chapter-list ol { margin: 0; padding: 0; list-style: none; }
.chapter-list li a { display: grid; min-height: 62px; grid-template-columns: 44px 1fr auto; align-items: center; gap: 14px; border-bottom: 1px solid var(--story-line); text-decoration: none; }
.chapter-list li a:hover { color: var(--story-accent); }
.chapter-list li span, .chapter-list li small { color: var(--story-muted); font-size: 12px; }
.chapter-list li strong { font: 700 16px/1.4 var(--story-serif); }
.reader-page { min-height: 100vh; padding: 0 28px 56px; }
.reader-toolbar { position: sticky; top: 0; z-index: 3; display: grid; min-height: 64px; grid-template-columns: 1fr auto 1fr; align-items: center; border-bottom: 1px solid var(--story-line); background: color-mix(in srgb, var(--story-bg) 94%, transparent); }
.reader-toolbar > span { color: var(--story-muted); font-size: 12px; }
.reader-toolbar .preference-switcher { justify-self: end; }
.literary-reader { width: min(740px, calc(100vw - 48px)); margin: 74px auto 0; }
.literary-reader > h1 { margin: 16px 0 52px; font: 700 clamp(38px, 6vw, 60px)/1.2 var(--story-serif); letter-spacing: .05em; }
.literary-body { color: var(--story-text); font: 18px/1.95 var(--story-serif); overflow-wrap: anywhere; }
.literary-body p { margin: 0 0 1.25em; }
.literary-body h1, .literary-body h2, .literary-body h3 { margin: 1.8em 0 .75em; font-family: var(--story-serif); line-height: 1.35; }
.literary-body blockquote { margin: 1.6em 0; padding: 4px 0 4px 20px; border-left: 2px solid var(--story-accent); color: var(--story-muted); }
.literary-body img { max-width: 100%; height: auto; }
.literary-body pre { overflow: auto; padding: 18px; background: var(--story-soft); font: 13px/1.6 Consolas, monospace; }
.literary-body table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.literary-body th, .literary-body td { padding: 8px 10px; border: 1px solid var(--story-line); }
.chapter-nav { display: grid; width: min(740px, calc(100vw - 48px)); grid-template-columns: 1fr auto 1fr; margin: 70px auto 0; padding-top: 20px; border-top: 1px solid var(--story-line); }
.chapter-nav a { color: var(--story-accent); font: 700 14px/1.4 var(--story-serif); text-decoration: none; }
.chapter-nav a:nth-child(2) { justify-self: center; }
.chapter-nav a:last-child { justify-self: end; }
a:focus-visible, button:focus-visible, input:focus-visible, summary:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
@media (max-width: 1120px) {
    .stories-shell { grid-template-columns: 240px minmax(0, 1fr); }
    .stories-rail { grid-column: 2; border-top: 1px solid var(--story-line); border-left: 0; }
    .stories-sidebar { grid-row: 1 / span 2; padding-left: 28px; }
}
@media (max-width: 760px) {
    .stories-topbar { align-items: flex-start; padding: 18px 20px; }
    .stories-topbar nav { justify-content: flex-end; flex-wrap: wrap; }
    .stories-shell { display: block; }
    .stories-sidebar { padding: 20px; border-right: 0; border-bottom: 1px solid var(--story-line); }
    .stories-sidebar .filter-group { padding: 11px 0; }
    .stories-main, .stories-rail { padding: 34px 20px; }
    .section-title { font-size: 26px; }
    .shelf-row { grid-template-columns: 1fr auto; padding: 13px 0; }
    .shelf-row span { grid-column: 1 / -1; grid-row: 2; }
    .stories-rail { border-left: 0; }
    .reader-toolbar { grid-template-columns: 1fr auto; gap: 12px; }
    .reader-toolbar > span { display: none; }
    .work-overview dl { grid-template-columns: 1fr; }
    .work-overview dl div { border-right: 0; border-bottom: 1px solid var(--story-line); }
}
@media (max-width: 520px) {
    .stories-topbar { display: grid; gap: 14px; }
    .stories-topbar nav { justify-content: flex-start; }
    .stories-topbar nav > a, .stories-logout button { min-height: 34px; padding: 8px 10px; }
    .stories-main, .stories-rail { padding: 30px 20px; }
    .reading-feature { min-height: 410px; }
}
