body.single-chapter {
    background: #faf3e9;
    color: #172830;
}

.single-chapter .chapter-page {
    --reader-ink: #172830;
    --reader-teal: #245464;
    --reader-rule: #e5cdb9;
    --reader-peach: #f6d7c8;
    max-width: none;
    padding: 0;
}

.chapter-banner {
    height: clamp(9rem, 23vw, 22rem);
    background: var(--reader-teal);
}

.chapter-banner img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chapter-layout {
    width: min(100%, 88rem);
    margin-inline: auto;
    display: grid;
}

.chapter-sidebar { display: none; }

.chapter-reading {
    width: min(100%, 76ch);
    min-width: 0;
    margin-inline: auto;
    padding: clamp(1.75rem, 4vw, 3.25rem) clamp(1.2rem, 4vw, 3rem) 3rem;
}

.chapter-heading {
    margin-bottom: clamp(1.75rem, 4vw, 3rem);
    text-align: center;
}

.chapter-book-name {
    display: block;
    width: min(100%, 24rem);
    margin: 0 auto 1rem;
    padding: 0 .25rem .85rem;
    border-bottom: 1px solid var(--reader-rule);
    color: var(--reader-ink);
    font-size: .85rem;
    letter-spacing: .18em;
    text-decoration: none;
}

.chapter-heading h1 {
    margin: 0;
    font-size: clamp(2.15rem, 5vw, 3.6rem);
    line-height: 1.1;
    font-weight: 500;
}

.chapter-subtitle {
    margin: .45rem 0 0;
    font-size: clamp(1.15rem, 3vw, 1.6rem);
    font-style: italic;
}

.chapter-prose {
    font-size: clamp(1.1rem, 1rem + .35vw, 1.3rem);
    line-height: 1.65;
    overflow-wrap: anywhere;
}

.chapter-prose > p { margin: 0 0 1em; }

.chapter-pagination {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: clamp(.35rem, 2vw, 1rem);
    align-items: center;
    margin-top: 2.75rem;
    font-size: clamp(.8rem, 1.8vw, 1rem);
    line-height: 1.25;
    text-align: center;
}

.chapter-pagination a {
    display: grid;
    gap: .2rem;
    align-content: center;
    min-height: 2.75rem;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.chapter-pagination .chapter-previous,
.chapter-pagination .chapter-next {
    padding: .65rem clamp(.4rem, 2vw, 1rem);
    border: 1px solid var(--reader-teal);
    border-radius: 1.75rem;
}

.chapter-previous { grid-column: 1; grid-row: 1; color: var(--reader-teal); }
.chapter-list-link { grid-column: 2; grid-row: 1; color: var(--reader-ink); }
.chapter-list-link span { font-size: 1.45rem; line-height: 1; }
.chapter-next { grid-column: 3; grid-row: 1; background: var(--reader-teal); color: #fff; }
.chapter-pagination a:hover { text-decoration: underline; }
.chapter-page a:focus-visible { outline: 2px solid var(--reader-teal); outline-offset: 3px; }

.chapter-comments {
    margin-top: 2rem;
    padding-top: 1.2rem;
    border-top: 1px solid var(--reader-rule);
    font-size: 1rem;
}

.chapter-comments :is(h2, h3) { margin: 0 0 .65rem; }
.chapter-comments input:not([type="checkbox"]):not([type="submit"]),
.chapter-comments textarea {
    display: block;
    width: 100%;
    max-width: 100%;
    padding: .6rem;
    border: 1px solid #a99382;
    border-radius: .4rem;
    background: #fffaf4;
    color: inherit;
    font: inherit;
}

.chapter-comments input[type="submit"] {
    min-height: 2.75rem;
    padding: .45rem 1rem;
    border: 0;
    border-radius: .4rem;
    background: #a64938;
    color: #fff;
    font: inherit;
    cursor: pointer;
}

.chapter-comment-list { padding: 0; list-style: none; }
.chapter-comment-list .children { padding-inline-start: 1.2rem; }
.chapter-comment-list .comment-body { padding: 1rem 0; border-top: 1px solid var(--reader-rule); }
.chapter-comment-list .avatar { border-radius: 50%; vertical-align: middle; margin-inline-end: .4rem; }

@media (min-width: 56rem) {
    .chapter-layout.has-chapter-sidebar { grid-template-columns: minmax(13rem, 26%) minmax(0, 1fr); }
    .chapter-sidebar {
        display: block;
        align-self: stretch;
        padding: 2rem clamp(1rem, 3vw, 2.5rem);
        border-inline-end: 1px solid var(--reader-rule);
        background: #f7eddf;
        font-size: 1rem;
        overflow-wrap: anywhere;
    }
    .chapter-book-cover { display: block; font-weight: bold; }
    .chapter-book-cover img { display: block; width: 100%; border-radius: .4rem; }
    .chapter-book-genre { margin-top: .75rem; }
    .chapter-index {
        margin: 1rem 0;
        padding: .5rem 0;
        border-block: 1px solid var(--reader-rule);
        list-style: none;
    }
    .chapter-index a, .chapter-back { display: block; padding: .4rem .7rem; color: var(--reader-ink); }
    .chapter-index a { text-decoration: none; }
    .chapter-index a:hover { text-decoration: underline; }
    .chapter-index [aria-current="page"] { border-radius: 1rem; background: var(--reader-peach); font-weight: bold; }
}
