:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-soft: #e9eeec;
  --ink: #17211f;
  --ink-soft: #44524f;
  --muted: #71807c;
  --line: #d4ddda;
  --line-strong: #aab8b4;
  --accent: #146c63;
  --accent-dark: #0d514b;
  --signal: #b6574f;
  --success: #2d7658;
  --focus: #1c78a5;
  --danger: #a53c3c;
  --shadow: 0 18px 45px rgba(26, 43, 39, .10);
  --radius: 8px;
  --page: 1180px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; background: var(--bg); color: var(--ink); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent); outline-offset: 3px; }
.skip-link { position: fixed; left: 16px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--ink); color: white; }
.skip-link:focus { top: 12px; }
.page-width { width: min(var(--page), calc(100% - 48px)); margin-inline: auto; }
.site-header { min-height: 72px; position: sticky; top: 0; z-index: 20; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; padding: 10px max(24px, calc((100vw - var(--page)) / 2)); border-bottom: 1px solid var(--line); background: rgba(244, 246, 245, .96); backdrop-filter: blur(12px); }
.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px; background: #17211f; }
.brand-mark img { width: 31px; height: 31px; object-fit: contain; }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 21px; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; }
.main-nav { height: 52px; display: flex; align-items: stretch; gap: 8px; }
.main-nav a { min-width: 88px; display: grid; place-items: center; padding: 0 12px; border-bottom: 2px solid transparent; color: var(--ink-soft); font-size: 13px; font-weight: 700; text-decoration: none; }
.main-nav a:hover, .main-nav a.active { color: var(--ink); border-color: var(--accent); }
.account-button, .icon-button { border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.account-button { justify-self: end; min-height: 40px; padding: 0 15px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px; font-weight: 700; background: var(--surface); }
.account-button:hover { border-color: var(--line-strong); }
.site-footer { min-height: 120px; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 30px max(24px, calc((100vw - var(--page)) / 2)); border-top: 1px solid var(--line); background: var(--surface); }
.site-footer strong, .site-footer span { display: block; }
.site-footer span { margin-top: 5px; color: var(--muted); font-size: 13px; }
.site-footer nav { display: flex; gap: 22px; }
.site-footer a { color: var(--ink-soft); font-size: 13px; text-decoration: none; }
.eyebrow { color: var(--accent); font-size: 11px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.primary-button, .secondary-button, .danger-button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0 17px; border-radius: 6px; font-size: 13px; font-weight: 800; text-decoration: none; cursor: pointer; }
.primary-button { border: 1px solid var(--accent); background: var(--accent); color: white; }
.primary-button:hover { border-color: var(--accent-dark); background: var(--accent-dark); }
.secondary-button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.secondary-button:hover { border-color: var(--line-strong); }
.danger-button { border: 1px solid #e4c4c4; background: #fff8f8; color: var(--danger); }
button:disabled { opacity: .55; cursor: wait; }
.library-heading { display: flex; justify-content: space-between; align-items: end; gap: 40px; padding: 70px 0 34px; border-bottom: 1px solid var(--line); }
.library-heading h1, .membership-intro h1 { margin: 8px 0 10px; font-family: Georgia, "Times New Roman", serif; font-size: 42px; line-height: 1.1; font-weight: 700; }
.library-heading p, .membership-intro p { max-width: 620px; margin: 0; color: var(--ink-soft); font-size: 17px; line-height: 1.65; }
.library-count { display: grid; min-width: 155px; padding-left: 24px; border-left: 1px solid var(--line); }
.library-count strong { font: 34px/1 Georgia, serif; }
.library-count span { margin-top: 7px; color: var(--muted); font-size: 12px; }
.story-shelf { display: grid; gap: 26px; padding: 34px 0 80px; }
.novel-card { display: grid; grid-template-columns: 178px minmax(0, 1fr); min-height: 244px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.novel-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow); }
.cover-link { height: 100%; overflow: hidden; background: #17211f; }
.cover-link img { width: 100%; height: 100%; object-fit: cover; }
.novel-card-copy { padding: 28px 32px; }
.meta-line { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 11px; text-transform: uppercase; }
.meta-line span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; margin: 0 10px 2px 0; border-radius: 50%; background: var(--line-strong); }
.novel-card h2 { margin: 12px 0 3px; font: 700 28px/1.15 Georgia, serif; }
.novel-card h2 a { text-decoration: none; }
.novel-card h2 a:hover { color: var(--accent); }
.byline, .story-author { margin: 0; color: var(--muted); font-size: 12px; }
.novel-card-copy > p:not(.byline) { max-width: 720px; margin: 18px 0; color: var(--ink-soft); line-height: 1.6; }
.genre-list { display: flex; flex-wrap: wrap; gap: 7px; }
.genre-list span { padding: 5px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--ink-soft); font-size: 11px; }
.story-overview { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 56px; padding: 52px 0 48px; }
.story-cover { aspect-ratio: 2 / 3; overflow: hidden; border-radius: var(--radius); background: #17211f; box-shadow: var(--shadow); }
.story-cover img { width: 100%; height: 100%; object-fit: cover; }
.back-link { display: inline-block; margin-bottom: 32px; color: var(--muted); font-size: 12px; font-weight: 750; text-decoration: none; }
.story-copy h1 { margin: 15px 0 7px; font: 700 44px/1.08 Georgia, serif; overflow-wrap: anywhere; }
.story-description { max-width: 730px; margin: 28px 0; color: var(--ink-soft); font: 17px/1.72 Georgia, serif; }
.story-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.volume-list { padding: 0 0 90px 326px; }
.volume-section { padding: 30px 0; border-top: 1px solid var(--line); }
.volume-section > header { display: flex; justify-content: space-between; align-items: end; gap: 20px; }
.volume-section h2 { margin: 5px 0 0; font: 700 25px/1.2 Georgia, serif; }
.volume-section > header > span, .volume-description { color: var(--muted); font-size: 12px; }
.volume-description { max-width: 700px; line-height: 1.6; }
.chapter-list { margin: 22px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.chapter-list li { border-bottom: 1px solid var(--line); }
.chapter-list a { min-height: 70px; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 10px 4px; text-decoration: none; }
.chapter-list a:hover strong { color: var(--accent); }
.chapter-number { color: var(--muted); font-variant-numeric: tabular-nums; }
.chapter-name strong, .chapter-name small { display: block; }
.chapter-name strong { font-family: Georgia, serif; }
.chapter-name small { margin-top: 5px; color: var(--muted); font-size: 11px; }
.access-badge { min-width: 88px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); font-size: 10px; font-weight: 800; text-align: center; text-transform: uppercase; }
.access-badge.open { border-color: #b9d6ca; color: var(--success); background: #f4faf7; }
.access-badge.locked { border-color: #dfc9c7; color: var(--signal); background: #fdf7f6; }
.text-link { display: inline-block; margin-top: 18px; color: var(--accent); font-size: 12px; font-weight: 750; }
.reader-page { --reader-size: 19px; min-height: calc(100vh - 72px); padding-bottom: 90px; transition: background .2s ease, color .2s ease; }
.reader-page.theme-light { background: #f3f5f4; color: #1d2523; }
.reader-page.theme-dark { background: #1b211f; color: #e6ebe9; }
.reader-toolbar { min-height: 58px; position: sticky; top: 72px; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 8px max(20px, calc((100vw - 960px) / 2)); border-bottom: 1px solid var(--line); background: rgba(244, 246, 245, .96); color: var(--ink); }
.reader-toolbar > a { max-width: 300px; overflow: hidden; font-size: 12px; font-weight: 750; text-decoration: none; text-overflow: ellipsis; white-space: nowrap; }
.reader-controls { display: flex; gap: 13px; }
.reader-controls label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.reader-controls select { height: 32px; border: 1px solid var(--line); border-radius: 4px; background: white; }
.reader-controls input { width: 86px; accent-color: var(--accent); }
.reader-sheet { width: min(760px, calc(100% - 40px)); margin: 54px auto 0; }
.reader-kicker { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.reader-sheet h1 { margin: 12px 0; font: 700 40px/1.15 Georgia, serif; }
.reader-meta { display: flex; gap: 16px; padding-bottom: 26px; border-bottom: 1px solid currentColor; color: var(--muted); font-size: 11px; opacity: .75; }
.chapter-prose { margin-top: 38px; font-size: var(--reader-size); line-height: 1.82; }
.font-serif .chapter-prose { font-family: Georgia, "Times New Roman", serif; }
.font-sans .chapter-prose { font-family: Roboto, "Segoe UI", sans-serif; }
.chapter-prose p { margin: 0 0 1.45em; }
.chapter-prose p:first-child::first-letter { float: left; margin: .08em .12em 0 0; color: var(--accent); font: 3.25em/.8 Georgia, serif; }
.reader-watermark { margin-top: 70px; padding-top: 20px; border-top: 1px solid currentColor; color: var(--muted); font: 10px/1.5 ui-monospace, monospace; opacity: .45; text-align: center; }
.paywall-page { min-height: 680px; display: grid; place-items: center; }
.paywall { max-width: 760px; padding: 60px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.paywall-mark { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 24px; border-radius: 50%; background: var(--surface-soft); color: var(--accent); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.paywall h1 { margin: 10px 0; font: 700 36px/1.15 Georgia, serif; }
.paywall > p { color: var(--ink-soft); font-size: 16px; }
.paywall-actions { display: flex; justify-content: center; gap: 10px; margin-top: 28px; }
.membership-intro { padding: 76px 0 38px; }
.membership-offer { display: grid; grid-template-columns: 1fr 300px; gap: 50px; margin-bottom: 90px; padding: 42px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.membership-copy h2 { margin: 0; font: 700 28px/1.2 Georgia, serif; }
.membership-copy ul { margin: 25px 0 0; padding: 0; list-style: none; }
.membership-copy li { padding: 12px 0; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.membership-action { display: flex; flex-direction: column; justify-content: center; gap: 14px; padding-left: 36px; border-left: 1px solid var(--line); }
.membership-action > span { color: var(--muted); font-size: 12px; }
.membership-action > strong { color: var(--success); font-size: 24px; }
.account-shell { margin-top: 58px; margin-bottom: 90px; padding: 42px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.account-shell > header { display: flex; align-items: center; gap: 20px; padding-bottom: 30px; border-bottom: 1px solid var(--line); }
.avatar { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: white; font: 24px Georgia, serif; }
.account-shell h1 { margin: 5px 0 2px; font: 700 30px Georgia, serif; }
.account-shell header p { margin: 0; color: var(--muted); }
.account-details { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0; }
.account-details div { padding: 28px 20px 28px 0; }
.account-details dt { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.account-details dd { margin: 8px 0 0; font-weight: 700; }
.account-actions { display: flex; gap: 10px; }
.auth-dialog { width: min(460px, calc(100% - 24px)); padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow); }
.auth-dialog::backdrop { background: rgba(23, 33, 31, .56); }
.dialog-close { width: 38px; height: 38px; position: absolute; right: 10px; top: 8px; font-size: 25px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 12px 54px 0 20px; border-bottom: 1px solid var(--line); }
.auth-tabs button { min-height: 44px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 750; cursor: pointer; }
.auth-tabs button[aria-selected="true"] { border-color: var(--accent); color: var(--ink); }
.auth-form { padding: 30px; }
.auth-form h2 { margin: 0 0 24px; font: 700 27px Georgia, serif; }
.auth-form label, .editor-form label { display: grid; gap: 7px; margin-bottom: 17px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
input, textarea, select { width: 100%; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); }
input, select { min-height: 42px; padding: 0 11px; }
textarea { padding: 11px; line-height: 1.55; resize: vertical; }
.auth-form .primary-button { width: 100%; margin-top: 8px; }
.form-error { padding: 10px; border-left: 3px solid var(--danger); background: #fff6f6; color: var(--danger); font-size: 12px; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 50; max-width: 360px; padding: 13px 16px; border: 1px solid #b9d6ca; border-radius: 6px; background: #f4faf7; color: var(--success); box-shadow: var(--shadow); font-size: 13px; }
.toast.error { border-color: #e2c0c0; background: #fff7f7; color: var(--danger); }
.studio-shell { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.studio-sidebar { padding: 34px 24px; border-right: 1px solid var(--line); background: var(--surface); }
.studio-sidebar h1 { margin: 5px 0 28px; font: 700 25px Georgia, serif; }
.studio-sidebar nav { display: grid; gap: 3px; }
.studio-sidebar nav button { min-height: 40px; padding: 0 11px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-soft); text-align: left; cursor: pointer; }
.studio-sidebar nav button.active { background: var(--surface-soft); color: var(--ink); font-weight: 800; }
.studio-sidebar dl { margin-top: 34px; border-top: 1px solid var(--line); }
.studio-sidebar dl div { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 11px; }
.studio-sidebar dt { color: var(--muted); }
.studio-sidebar dd { margin: 0; font-weight: 800; }
.studio-work { min-width: 0; padding: 34px 28px 80px; }
.work-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.work-header h2 { margin: 4px 0 0; font: 700 27px Georgia, serif; }
.editor-layout { min-width: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 24px; align-items: start; }
.item-list { max-height: 720px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.item-list button { width: 100%; min-height: 68px; display: grid; gap: 5px; padding: 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: var(--ink); text-align: left; cursor: pointer; }
.item-list button.selected { box-shadow: inset 3px 0 var(--accent); background: var(--surface-soft); }
.item-list strong { overflow-wrap: anywhere; font-size: 12px; }
.item-list span { color: var(--muted); font-size: 10px; }
.editor-form { min-width: 0; padding: 26px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.editor-form label { min-width: 0; }
.field-row { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.manuscript-input { min-height: 440px; font: 15px/1.65 Georgia, serif; }
.form-actions { display: flex; justify-content: space-between; gap: 12px; }
.data-table { overflow: hidden; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.table-row { min-height: 60px; display: grid; grid-template-columns: 2fr 1fr 1fr; align-items: center; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 12px; }
.table-row.header { min-height: 42px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.table-row strong, .table-row small { display: block; }
.table-row small { margin-top: 3px; color: var(--muted); }
.loading-page, .error-page { width: min(var(--page), calc(100% - 48px)); min-height: 620px; margin: auto; padding-top: 70px; }
.loading-line, .loading-block { border-radius: 5px; background: linear-gradient(90deg, #e5eae8, #f1f4f3, #e5eae8); background-size: 200% 100%; animation: load 1.4s infinite; }
.loading-line { width: 240px; height: 24px; }
.loading-block { height: 380px; margin-top: 28px; }
.empty-state { max-width: 680px; margin: 70px auto; padding: 46px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-align: center; }
.empty-state h1, .empty-state h2 { font-family: Georgia, serif; }
.empty-state p { color: var(--muted); }
@keyframes load { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }
@media (max-width: 820px) {
  .site-header { grid-template-columns: 1fr auto; padding-inline: 16px; }
  .main-nav { grid-column: 1 / -1; grid-row: 2; width: 100%; height: 44px; justify-content: center; border-top: 1px solid var(--line); }
  .site-header { padding-bottom: 0; }
  .reader-toolbar { top: 117px; }
  .story-overview { grid-template-columns: 190px minmax(0, 1fr); gap: 30px; }
  .volume-list { padding-left: 0; }
  .studio-shell { grid-template-columns: 1fr; }
  .studio-sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .studio-sidebar nav { grid-template-columns: repeat(4, 1fr); }
  .studio-sidebar dl { display: none; }
  .editor-layout { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .page-width { width: calc(100% - 24px); }
  .brand small { display: none; }
  .main-nav a { min-width: 0; flex: 1; padding-inline: 5px; }
  .library-heading { align-items: start; padding-top: 42px; }
  .library-heading h1, .membership-intro h1 { font-size: 34px; }
  .library-count { display: none; }
  .novel-card { grid-template-columns: 112px minmax(0, 1fr); min-height: 190px; }
  .novel-card-copy { padding: 18px; }
  .novel-card h2 { font-size: 22px; }
  .novel-card-copy > p:not(.byline) { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; font-size: 13px; }
  .genre-list { display: none; }
  .story-overview { grid-template-columns: 1fr; gap: 28px; padding-top: 24px; }
  .story-cover { width: 170px; }
  .story-copy h1 { font-size: 35px; }
  .chapter-list a { grid-template-columns: 34px minmax(0, 1fr); }
  .access-badge { grid-column: 2; justify-self: start; }
  .reader-toolbar { align-items: start; padding: 10px 12px; }
  .reader-toolbar > a { max-width: 120px; padding-top: 8px; }
  .reader-controls { gap: 6px; }
  .reader-controls label { display: grid; }
  .reader-controls input { width: 65px; }
  .reader-sheet { width: calc(100% - 30px); margin-top: 36px; }
  .reader-sheet h1 { font-size: 32px; }
  .paywall { width: calc(100% - 24px); padding: 34px 22px; }
  .paywall-actions, .account-actions { flex-direction: column; }
  .membership-offer { grid-template-columns: 1fr; padding: 26px; }
  .membership-action { padding: 25px 0 0; border-left: 0; border-top: 1px solid var(--line); }
  .account-shell { padding: 24px; }
  .account-details { grid-template-columns: 1fr; }
  .account-details div { padding: 18px 0; border-bottom: 1px solid var(--line); }
  .studio-sidebar nav { grid-template-columns: 1fr 1fr; }
  .studio-work { padding: 24px 12px 60px; }
  .editor-layout { grid-template-columns: 1fr; }
  .item-list { max-height: 250px; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .editor-form { padding: 18px; }
  .table-row { grid-template-columns: 1fr; gap: 4px; padding-block: 14px; }
  .table-row.header { display: none; }
  .site-footer { align-items: flex-start; }
}
