:root {
  color-scheme: light;
  --page: #faf8f2;
  --paper: #fffdf8;
  --ink: #232521;
  --quiet: #565b51;
  --line: #d9d7cb;
  --deep: #1d2f26;
  --deep-text: #faf8ef;
  --light-action: #dce8b8;
  --brand: #a24535;
  --serif: "Noto Serif KR", "Nanum Myeongjo", Batang, 바탕, serif;
  font-family: system-ui, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  line-height: 1.55;
  background: var(--page);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { display: flex; min-height: 100vh; flex-direction: column; margin: 0; }
main { flex: 1; }
body, h1, h2, h3, h4, p, figure { margin: 0; }
a { color: inherit; text-underline-offset: .22em; }
a:hover { text-decoration-thickness: 2px; }
a:focus-visible { outline: 3px solid #8d4231; outline-offset: 4px; }
img { display: block; max-width: 100%; height: auto; }
.shell { width: min(100% - 3rem, 71rem); margin-inline: auto; }
.skip { position: absolute; z-index: 2; inset: .75rem auto auto .75rem; padding: .625rem 1rem; background: var(--paper); }
.skip:not(:focus) { clip-path: inset(50%); }

.site-header { border-bottom: 1px solid var(--line); }
.site-header-inner { display: flex; min-height: 4.55rem; align-items: center; justify-content: space-between; gap: 1rem; }
.site-header nav a, .brand { display: inline-flex; align-items: center; min-height: 2.75rem; text-decoration: none; }
.site-header nav a { color: var(--quiet); font-size: .9375rem; font-weight: 700; }
.site-header nav a:hover { color: var(--deep); text-decoration: underline; }
.brand { gap: .55rem; font-size: 1.275rem; font-weight: 850; letter-spacing: -.04em; }
.brand-mark { display: grid; width: 1.875rem; height: 1.875rem; place-items: center; border-radius: .375rem; background: var(--brand); color: #fff8f1; font-family: var(--serif); font-size: 1rem; }
.site-footer { margin-top: 5rem; border-top: 1px solid var(--line); color: var(--quiet); font-size: .875rem; }
.site-footer .shell { display: flex; min-height: 4.75rem; align-items: center; gap: 1rem; }
.site-footer a { color: var(--ink); font-weight: 760; text-decoration: none; }

.home-shell { padding-top: 2rem; }
.feature { display: grid; grid-template-columns: 1.12fr .88fr; position: relative; overflow: hidden; isolation: isolate; min-height: 24rem; border-radius: 1.25rem; background: var(--deep); color: var(--deep-text); }
.feature-copy { z-index: 1; align-self: center; padding: clamp(2.3rem, 5.35vw, 4.5rem); padding-right: clamp(1.25rem, 3vw, 2.5rem); }
.feature-label { color: #d8e29b; font-weight: 700; font-size: .9rem; }
.feature h1, .work-intro h1 { max-width: 13em; font-family: var(--serif); font-size: clamp(2.35rem, 5.2vw, 4.7rem); line-height: 1.17; letter-spacing: -.07em; word-break: keep-all; overflow-wrap: anywhere; }
.feature h1, .work-intro h1 { margin-top: .875rem; }
.feature-excerpt, .work-excerpt { max-width: 28rem; margin-top: 1.18rem; line-height: 1.8; word-break: keep-all; overflow-wrap: anywhere; }
.feature-excerpt { color: #e0e8dc; }
.feature-art { position: relative; min-height: 100%; }
.feature-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 62%; }
.feature-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--deep), transparent 38%); pointer-events: none; }
.feature a:focus-visible { outline-color: #e2eeae; }
.action-row { display: flex; flex-wrap: wrap; align-items: center; gap: .65rem; margin-top: 1.45rem; }
.button { display: inline-flex; min-height: 2.75rem; align-items: center; justify-content: center; padding: .58rem 1.05rem; border: 1px solid transparent; border-radius: .55rem; font-size: .9375rem; font-weight: 740; line-height: 1.4; text-align: center; text-decoration: none; }
.primary { color: var(--paper); background: var(--deep); }
.primary:hover { background: #324d3e; }
.feature .primary { color: #243120; background: var(--light-action); }
.feature .primary:hover { background: #e9f1ce; }
.ghost { color: var(--deep-text); border-color: #839588; }
.ghost:hover { background: #304439; }
.outline { border-color: var(--line); color: var(--deep); background: var(--paper); }
.outline:hover { border-color: #7d897a; background: #f4f2ea; }

.library { margin-top: 3.35rem; scroll-margin-top: 1rem; }
.section-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1.1rem; padding-bottom: 1.2rem; border-bottom: 1px solid var(--line); }
.section-head h2, .chapter-index h2 { font-size: clamp(1.55rem, 3.5vw, 2.06rem); letter-spacing: -.045em; line-height: 1.25; }
.section-head p { margin-top: .38rem; color: var(--quiet); font-size: .9375rem; }
.genre-tabs { display: flex; flex-wrap: wrap; gap: .36rem; }
.genre-tab { display: inline-flex; min-height: 2.75rem; align-items: center; gap: .4rem; padding: .48rem .83rem; border: 1px solid var(--line); border-radius: 99px; background: var(--paper); color: var(--quiet); font-size: .875rem; font-weight: 700; text-decoration: none; }
.genre-tab span { font-variant-numeric: tabular-nums; }
.genre-tab:hover { border-color: #7d897a; color: var(--ink); }
.genre-tab[aria-current="true"] { border-color: var(--deep); background: var(--deep); color: var(--paper); }
.genre-section { scroll-margin-top: 1rem; margin-top: 1.7rem; }
.genre-section + .genre-section { margin-top: 2.25rem; }
.genre-section h3 { margin-bottom: .9rem; font-size: 1.15rem; font-weight: 760; letter-spacing: -.035em; }
.book-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(.65rem, 2vw, 1.25rem); margin: 0; padding: 0; list-style: none; }
.book-card { min-width: 0; }
.book-card-link { display: block; height: 100%; overflow: hidden; border: 1px solid var(--line); border-radius: .8rem; background: var(--paper); text-decoration: none; }
.book-card-link:hover { border-color: #787c6e; }
.book-card-link:hover h4 { text-decoration: underline; }
.card-cover { overflow: hidden; aspect-ratio: 2 / 3; background: #deded5; }
.card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.card-info { display: grid; align-content: start; gap: .5rem; padding: .88rem .95rem 1rem; }
.card-info h4 { font-size: 1rem; font-weight: 770; line-height: 1.45; word-break: keep-all; overflow-wrap: anywhere; }
.card-info p { font-size: .875rem; color: var(--quiet); }

.work-shell { padding-top: 1.1rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .55rem; margin: 0; padding: 0; list-style: none; color: var(--quiet); font-size: .875rem; }
.breadcrumbs li { display: flex; align-items: center; gap: .55rem; }
.breadcrumbs li + li::before { content: "/"; color: #73776c; }
.breadcrumbs a, .breadcrumbs span { display: inline-flex; min-height: 2.75rem; align-items: center; overflow-wrap: anywhere; }
.breadcrumbs [aria-current] { color: var(--ink); }
.work-intro { display: grid; grid-template-columns: minmax(10rem, 16.5rem) minmax(0, 1fr); align-items: center; gap: clamp(1.25rem, 5.5vw, 4.2rem); margin-top: .55rem; padding: clamp(1.25rem, 4vw, 3.1rem); border: 1px solid var(--line); border-radius: 1rem; background: var(--paper); }
.work-cover img { display: block; width: 100%; height: auto; border-radius: .55rem; }
.work-intro h1 { font-size: clamp(1.9rem, 5vw, 3.72rem); }
.meta-label { color: #4e6243; font-size: .9rem; font-weight: 740; }
.work-excerpt { color: var(--quiet); }
.chapter-index { max-width: 54rem; margin: 2.7rem auto 0; scroll-margin-top: 1.25rem; }
.chapter-index h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: .6rem; margin-bottom: 1rem; }
.chapter-index h2 span { color: var(--quiet); font-size: .9375rem; font-weight: 600; letter-spacing: 0; }
.chapter-index ol { margin: 0; padding: 0; border-top: 1px solid var(--line); list-style: none; }
.chapter-row { display: grid; min-height: 3.35rem; grid-template-columns: minmax(2.5rem, 3.25rem) 1fr auto; align-items: center; gap: .65rem; padding: .52rem .65rem; border-bottom: 1px solid var(--line); text-decoration: none; }
.chapter-row:hover { background: var(--paper); }
.chapter-row:hover .chapter-title { text-decoration: underline; }
.chapter-num { color: var(--quiet); font-size: .9375rem; font-weight: 700; }
.chapter-title { font-weight: 650; word-break: keep-all; overflow-wrap: anywhere; }
.complete-label { border-radius: .25rem; padding: .14rem .38rem; background: #e4ead7; color: #395436; font-size: .875rem; font-weight: 740; }

.reader-page { background: var(--paper); }
.reader-shell { width: min(100% - 3rem, 42rem); margin-inline: auto; padding-top: 1rem; }
.reader-heading { margin: 2.25rem 0 1.75rem; text-align: center; }
.reader-heading h1 { margin-top: .56rem; font: 750 clamp(1.8rem, 4vw, 2.95rem) / 1.24 var(--serif); letter-spacing: -.055em; word-break: keep-all; overflow-wrap: anywhere; }
.reader-nav { display: grid; grid-template-columns: 1fr auto 1fr; gap: .35rem; align-items: center; padding: .85rem 0; border-block: 1px solid var(--line); }
.reader-nav > div:last-child { text-align: right; }
.reader-nav .button { padding-inline: .85rem; }
.manuscript { margin: 2.45rem 0; color: #252521; font-family: var(--serif); font-size: clamp(1.12rem, 2vw, 1.25rem); line-height: 1.95; }
.manuscript p { word-break: keep-all; overflow-wrap: anywhere; white-space: pre-line; }
.manuscript p + p { margin-top: 1.21em; }
.manuscript figure { margin: 2.15rem 0; }
.manuscript img { display: block; width: 100%; height: auto; border-radius: .55rem; }
.story-break { width: 4rem; margin: 2.3rem auto; border: 0; border-top: 1px solid #9c9b90; }
.work-end { margin: 1rem 0 1.5rem; color: var(--quiet); font-weight: 720; text-align: center; }
.error-content { padding-top: 3rem; }
.error-content .button { margin-top: 1rem; }

@media (max-width: 47rem) {
  .shell, .reader-shell { width: min(100% - 2.5rem, 71rem); }
  .feature { min-height: 22rem; }
  .book-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-info { padding-inline: .72rem; }
}

@media (max-width: 36rem) {
  .shell, .reader-shell { width: calc(100% - 2rem); }
  .site-header-inner { min-height: 3.75rem; }
  .home-shell { padding-top: .9rem; }
  .feature { grid-template-columns: minmax(0, 1fr); min-height: 0; border-radius: .9rem; }
  .feature-copy { padding: 1.6rem 1.25rem 1rem; }
  .feature h1 { max-width: 10em; font-size: clamp(2.1rem, 9vw, 2.7rem); }
  .feature-art { min-height: 12rem; }
  .feature-art::after { background: linear-gradient(180deg, var(--deep), transparent 41%); }
  .feature-art img { object-position: center 63%; }
  .library { margin-top: 2.35rem; }
  .section-head { align-items: flex-start; flex-direction: column; gap: .8rem; }
  .book-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .work-intro { grid-template-columns: minmax(0, 1fr); gap: 1rem; padding: 1rem; }
  .work-cover { max-width: 10rem; }
  .work-intro h1 { margin-top: .55rem; }
  .work-excerpt { margin-top: .75rem; }
  .chapter-index { margin-top: 1.95rem; }
  .chapter-row { gap: .45rem; padding-inline: .27rem; }
  .reader-shell { padding-top: .55rem; }
  .reader-heading { margin: 1.6rem 0 1.4rem; }
  .manuscript { margin-block: 2rem; }
  .site-footer { margin-top: 3.15rem; }
}

@media (prefers-contrast: more) {
  :root { --line: #726f65; }
}

.library:has(.genre-section[hidden]) .book-grid { max-width: 19rem; }

.site-header nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0 clamp(.65rem, 2.5vw, 1.4rem); }
.site-header nav a { white-space: nowrap; }
.reader-shelf { margin-top: 3.35rem; scroll-margin-top: 1rem; }
.reader-shelf h2 { margin-bottom: 1rem; font-size: clamp(1.55rem, 3.5vw, 2.06rem); letter-spacing: -.045em; line-height: 1.25; }
.shelf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(.7rem, 2vw, 1.25rem); }
.shelf-panel { min-width: 0; padding: clamp(.95rem, 2.5vw, 1.45rem); border: 1px solid var(--line); border-radius: .8rem; background: var(--paper); }
.shelf-panel h3 { font-size: 1.12rem; margin-bottom: .6rem; }
.shelf-empty { margin: .25rem 0; color: var(--quiet); }
.shelf-list { list-style: none; padding: 0; margin: 0; }
.shelf-list li { display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-height: 2.75rem; }
.shelf-list li + li { border-top: 1px solid var(--line); }
.shelf-list a { display: block; min-width: 0; padding-block: .45rem; color: var(--deep); font-weight: 720; text-underline-offset: .16em; overflow-wrap: anywhere; }
.shelf-list small { display: block; color: var(--quiet); font-size: .87rem; font-weight: 600; }
.shelf-remove { flex: 0 0 auto; min-height: 2.75rem; padding: .35rem .55rem; border: 0; color: var(--quiet); background: transparent; font: inherit; cursor: pointer; }
.shelf-remove:hover { color: var(--deep); text-decoration: underline; }
.shelf-toggle { font-family: inherit; cursor: pointer; }
.shelf-toggle[hidden], .shelf-list[hidden], .shelf-empty[hidden] { display: none; }
.shelf-toggle[aria-pressed="true"] { border-color: #6f8064; background: #e7eddf; }
.shelf-toggle:focus-visible, .shelf-remove:focus-visible { outline: 3px solid #8d4231; outline-offset: 3px; }
.shelf-chapter-actions:not(:has(.shelf-toggle[hidden])) { margin-top: .85rem; }

@media (max-width: 36rem) {
  .reader-shelf { margin-top: 2.35rem; }
  .shelf-grid { grid-template-columns: 1fr; }
}


/* The public catalog, work pages and reader keep their original routes. */
.home-shell { padding-top: clamp(1rem, 3vw, 2.6rem); }
.feature { min-height: clamp(26rem, 46vw, 36rem); background: #1b3028; }
.feature-copy { padding-inline-end: 1.2rem; }
.feature-label { color: #d9e5a6; letter-spacing: .025em; }
.split-title { display: block; }
.feature h1 { max-width: none; font-size: clamp(2.85rem, 6.55vw, 5.3rem); line-height: 1.13; }
.feature-excerpt { max-width: 27rem; color: #e6eadb; }
.feature-art img { object-position: 49% 35%; }
.feature-art::after { background: linear-gradient(90deg, #1b3028, transparent 46%); }
.genre-section { margin-top: 2rem; }
.book-grid { grid-template-columns: minmax(0, 1fr); }
.book-card-link { display: grid; grid-template-columns: minmax(6.5rem, 9.2rem) minmax(0, 1fr); border-radius: .92rem; }
.card-info { padding: clamp(1rem, 3vw, 2rem); align-content: center; gap: .65rem; }
.card-info h4 { font-size: clamp(1.1rem, 2.6vw, 1.65rem); }
.card-info p { max-width: 38rem; line-height: 1.65; }
.card-info .catalog-meta { color: #465c43; font-weight: 700; }
.latest-updates { margin-top: 3.1rem; }
.latest-updates h2, .cast h2 { font-size: clamp(1.38rem, 3.4vw, 1.8rem); margin-bottom: .75rem; }
.latest-updates ul { list-style: none; border-top: 1px solid var(--line); padding: 0; margin: 0; }
.latest-updates a { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.latest-updates a:hover strong { text-decoration: underline; }
.latest-updates small { display: block; color: var(--quiet); margin-bottom: .1rem; }
.latest-updates time { white-space: nowrap; color: var(--quiet); font-size: .86rem; }
.release-note { margin-top: 1rem; color: #425844; font-size: .9rem; font-weight: 700; }
.cast { max-width: 54rem; margin: 2.8rem auto 0; }
.cast dl { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .6rem; margin: 0; }
.cast dl div { min-width: 0; padding: 1rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--paper); }
.cast dt { font-weight: 800; }
.cast dd { margin: .22rem 0 0; color: var(--quiet); font-size: .9rem; }
.chapter-aside { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: .35rem; }
.chapter-aside time { color: var(--quiet); white-space: nowrap; font-size: .86rem; }
.read-state { border-radius: .28rem; padding: .1rem .42rem; background: #e5ebd8; color: #375539; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.chapter-group { margin-bottom: .6rem; }
.chapter-group summary { cursor: pointer; min-height: 2.75rem; display: list-item; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: .4rem; }
.reader-page { --reader-size: 1.18rem; --reader-leading: 1.92; --reader-font: var(--serif); --reader-control: #e5eadc; --reader-muted: #48614c; }
.reader-page .manuscript { color: var(--ink); font: normal var(--reader-size) / var(--reader-leading) var(--reader-font); }
.reader-page[data-reading-size="small"] { --reader-size: 1.03rem; }
.reader-page[data-reading-size="large"] { --reader-size: 1.38rem; }
.reader-page[data-reading-spacing="wide"] { --reader-leading: 2.2; }
.reader-page[data-reading-font="sans"] { --reader-font: system-ui, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif; }
.reader-page[data-reading-theme="dark"] { color-scheme: dark; --page: #151b18; --paper: #191f1b; --ink: #f1efe0; --quiet: #b8b9a8; --line: #353d33; --deep: #dde7b2; --deep-text: #162017; --reader-muted: #c1d4a1; --reader-control: #303d2e; }
.reader-page[data-reading-theme="dark"] .primary { color: #172319; }
.reader-page[data-reading-theme="dark"] .primary:hover { background: #ecf3d3; }
.reader-page[data-reading-theme="dark"] .outline:hover { background: #252f27; }
.reader-page[data-reading-theme="dark"] .meta-label { color: var(--reader-muted); }
.reader-page[data-reading-theme="dark"] .brand-mark { color: #192419; background: var(--deep); }
.reader-page :is(a,button,select,summary):focus-visible { outline: 3px solid var(--reader-muted); outline-offset: 3px; }
.reading-tools { display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: .7rem; margin-block: .65rem .42rem; }
.reading-settings { flex: 1 1 12rem; }
.reading-settings summary { cursor: pointer; min-height: 2.75rem; padding: .55rem .75rem; border: 1px solid var(--line); border-radius: .55rem; font-weight: 700; width: fit-content; }
.settings-fields { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .5rem; padding: .6rem 0 0; max-width: 28rem; }
.settings-fields label { display: grid; gap: .2rem; color: var(--quiet); font-size: .875rem; }
.settings-fields select { min-width: 0; width: 100%; min-height: 2.7rem; background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: .4rem; padding: .3rem .45rem; font: inherit; }
.reading-progress { position: sticky; top: 0; z-index: 4; background: var(--paper); padding: .25rem 0; }
.reading-progress progress { display: block; width: 100%; height: .32rem; border: 0; border-radius: 1rem; overflow: hidden; background: var(--reader-control); accent-color: var(--reader-muted); }
.reading-progress progress::-webkit-progress-bar { background: var(--reader-control); }
.reading-progress progress::-webkit-progress-value { background: var(--reader-muted); }
.reading-progress progress::-moz-progress-bar { background: var(--reader-muted); }
.reader-dock { position: sticky; z-index: 3; bottom: 0; background: var(--paper); padding-bottom: max(.75rem,env(safe-area-inset-bottom)); }
@media(max-width: 36rem) {
  .feature { min-height: 0; }
  .feature-copy { padding-inline: 1.4rem; }
  .feature h1 { font-size: clamp(2rem, 9vw, 3.3rem); }
  .feature-art { min-height: 13.5rem; }
  .feature-art img { object-position: 49% 32%; }
  .feature-art::after { background: linear-gradient(180deg,#1b3028,transparent 28%); }
  .book-grid { grid-template-columns: minmax(0,1fr); }
  .book-card-link { grid-template-columns: minmax(4.85rem, 6.2rem) minmax(0,1fr); }
  .card-info { padding: .8rem .7rem; gap: .4rem; }
  .card-info p { font-size: .8rem; }
  .cast dl { grid-template-columns: 1fr; }
  .chapter-aside { display: grid; justify-items: end; gap: .12rem; }
  .chapter-aside time, .read-state { font-size: .74rem; }
  .reader-nav .button { padding-inline: .5rem; font-size: .87rem; }
}
