.books-shell {
    display: grid;
    gap: 18px;
}

.books-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
    gap: 18px;
    align-items: end;
    background:
        radial-gradient(circle at top left, rgba(223, 164, 93, 0.12), transparent 38%),
        linear-gradient(145deg, rgba(21, 29, 44, 0.96), rgba(9, 13, 21, 0.95));
}

.books-hero h1,
.books-highlight-copy h2 a,
.books-card-copy h3 a {
    background: linear-gradient(135deg, #f3d798, #d8b26e 55%, #9f7840);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.books-hero-actions {
    display: grid;
    gap: 12px;
}

.books-search-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.books-search-form input {
    width: 100%;
    min-width: 0;
    border-radius: 999px;
    border: 1px solid rgba(224, 180, 113, 0.2);
    background: rgba(7, 11, 19, 0.8);
    color: #f4efe5;
    padding: 12px 16px;
}

.books-layout,
.books-reader-layout,
.books-detail-grid,
.books-editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 300px;
    gap: 18px;
    align-items: start;
}

.books-main-column,
.books-reader-main {
    display: grid;
    gap: 18px;
}

.books-highlight {
    display: grid;
    gap: 14px;
    background:
        linear-gradient(180deg, rgba(32, 40, 58, 0.98), rgba(11, 14, 22, 0.98)),
        #111722;
    border: 1px solid rgba(229, 181, 116, 0.18);
}

.books-highlight-head,
.books-highlight-footer,
.books-reader-head,
.book-detail-actions,
.books-editor-badges {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.books-section-label {
    text-transform: uppercase;
    font-size: 0.78rem;
    letter-spacing: 0.18em;
    color: #d9ad66;
}

.books-highlight-body,
.book-detail-card {
    display: grid;
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.books-highlight-cover,
.book-detail-cover,
.books-card-cover {
    display: block;
    border-radius: 18px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(86, 104, 135, 0.35), rgba(18, 22, 31, 0.9));
    min-height: 240px;
}

.books-highlight-cover img,
.book-detail-cover img,
.books-card-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.books-cover-fallback {
    min-height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(249, 232, 202, 0.86);
    font-family: 'Cinzel', serif;
    letter-spacing: 0.12em;
}

.books-cover-fallback-small {
    min-height: 180px;
}

.books-highlight-copy,
.book-detail-copy,
.books-card-copy {
    display: grid;
    gap: 10px;
}

.books-highlight-copy h2,
.book-detail-copy h1,
.books-card-copy h3 {
    margin: 0;
}

.books-highlight-copy a,
.books-card-copy a,
.books-chapter-list a {
    color: inherit;
    text-decoration: none;
}

.books-highlight-copy h2 a:hover,
.books-card-copy h3 a:hover,
.books-highlight-copy h2 a:focus-visible,
.books-card-copy h3 a:focus-visible {
    filter: brightness(1.08);
}

.books-author-line,
.book-detail-subtitle {
    color: #d3d9e7;
    margin: 0;
}

.books-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    color: #aeb8cb;
    font-size: 0.92rem;
}

.books-genres-line {
    display: inline-flex;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(217, 173, 102, 0.12);
    color: #f1ddb5;
}

.books-synopsis-line,
.books-card-excerpt,
.books-reader-content {
    color: #dce1ee;
    line-height: 1.75;
}

.books-writing-meta-line {
    margin: 6px 0 0;
    color: #d9c9a5;
}

.books-highlight-stats,
.books-card-foot {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    color: #aeb8cb;
    font-size: 0.92rem;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.books-card {
    display: grid;
    grid-template-columns: 98px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
}

.books-card-cover {
    min-height: 180px;
}

.books-sidebar {
    position: sticky;
    top: 88px;
    display: grid;
    gap: 14px;
    min-width: 0;
}

.books-detail-section {
    display: grid;
    gap: 12px;
}

.books-detail-section h2 {
    margin: 0;
}

.books-detail-section p {
    margin: 0;
}

.books-sidebar-list,
.books-editor-side-list {
    display: grid;
    gap: 10px;
}

.books-genre-pill,
.books-editor-chapter-link,
.books-genre-pill-static {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 999px;
    background: rgba(36, 43, 58, 0.92);
    border: 1px solid rgba(219, 175, 108, 0.15);
    color: #f5f0e6;
    text-decoration: none;
}

.books-genre-pill.is-active,
.books-editor-chapter-link.is-active,
.books-chapter-list a.is-current {
    background: rgba(213, 164, 95, 0.18);
    border-color: rgba(230, 192, 133, 0.42);
}

.books-chapter-list {
    display: grid;
    gap: 10px;
    list-style: none;
    padding: 0;
    margin: 0;
}

.books-chapter-list li a {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(20, 26, 40, 0.88);
    border: 1px solid rgba(123, 142, 176, 0.14);
}

.books-chapter-list li small {
    color: #b7c3db;
}

.books-chapter-locked {
    display: grid;
    gap: 8px;
    padding: 12px 14px;
    border-radius: 14px;
    background: rgba(31, 26, 21, 0.68);
    border: 1px solid rgba(206, 156, 92, 0.25);
}

.books-reader-main {
    padding: 24px;
}

.books-reader-content {
    font-size: 1.02rem;
    white-space: pre-wrap;
}

.books-reader-next {
    margin-top: 18px;
    display: flex;
    justify-content: flex-end;
}

.books-editor-form {
    display: grid;
    gap: 14px;
}

.books-editor-form input,
.books-editor-form textarea,
.books-editor-form select {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(124, 145, 183, 0.2);
    background: rgba(8, 12, 19, 0.92);
    color: #eff4ff;
    padding: 11px 13px;
    font-family: inherit;
}

.books-chapter-editor {
    min-height: 380px;
    resize: vertical;
    font-family: 'Georgia', serif;
    line-height: 1.7;
}

.books-chapter-image-wrap {
    margin: 8px 0 18px;
}

.books-chapter-image {
    width: 100%;
    max-height: 420px;
    object-fit: cover;
    border-radius: 18px;
    display: block;
}

.books-editor-chapter-toolbar {
    margin-bottom: 14px;
}

.books-writing-shell {
    width: min(1700px, calc(100vw - 24px));
    max-width: none;
    margin: 0 auto;
}

.books-writing-card,
.books-writing-form {
    display: grid;
    gap: 18px;
}

.books-writing-head,
.books-writing-footer,
.books-writing-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.books-writing-meta {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
}

.books-pricing-choice {
    display: grid;
    gap: 8px;
}

.books-writing-body-group {
    gap: 10px;
}

.books-writing-body {
    width: 100%;
    min-height: 76vh;
    height: auto;
    resize: none;
    overflow-y: hidden;
    font-family: Georgia, serif;
    line-height: 1.8;
    font-size: 1.06rem;
}

.books-reaction-bar-inline {
    margin: 0;
}

.books-reaction-bar-inline .reaction-btn,
.reaction-bar .reaction-btn {
    border: none;
    background: transparent;
    color: #b8caeb;
    border-radius: 999px;
    padding: 4px 8px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.books-reaction-bar-inline .reaction-btn:hover,
.reaction-bar .reaction-btn:hover {
    color: #dce8ff;
}

.books-reaction-bar-inline .reaction-btn.active,
.reaction-bar .reaction-btn.active {
    color: #f7e3b4;
}

.books-inline-action {
    color: #b7c9ea;
    text-decoration: none;
    padding: 4px 8px;
}

.books-inline-action:hover {
    color: #dce8ff;
}

.books-card-reaction-summary {
    margin-top: 2px;
}

.books-chapter-setup-form {
    margin-bottom: 16px;
}

.books-empty-state {
    text-align: center;
}

.books-modal {
    position: fixed;
    inset: 0;
    background: rgba(4, 8, 14, 0.76);
    display: grid;
    place-items: center;
    z-index: 40;
    padding: 16px;
}

.books-modal[hidden] {
    display: none;
}

.books-modal-card {
    width: min(520px, 96vw);
    border-radius: 16px;
    border: 1px solid rgba(214, 167, 101, 0.28);
    background: linear-gradient(180deg, rgba(14, 22, 34, 0.98), rgba(8, 12, 20, 0.98));
    padding: 16px;
    display: grid;
    gap: 10px;
}

.books-modal-card h3,
.books-modal-card p {
    margin: 0;
}

.books-modal-actions {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 1024px) {
    .books-hero,
    .books-layout,
    .books-reader-layout,
    .books-editor-layout,
    .books-highlight-body,
    .book-detail-card {
        grid-template-columns: 1fr;
    }

    .books-sidebar {
        position: static;
    }

    .books-hero-actions,
    .book-detail-actions,
    .books-writing-actions {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .books-search-form,
    .books-card {
        grid-template-columns: 1fr;
    }

    .books-shell {
        gap: 14px;
    }

    .books-hero,
    .books-highlight,
    .book-detail-card,
    .books-reader-main,
    .books-writing-card,
    .books-card {
        padding: 14px;
    }

    .books-writing-shell {
        width: calc(100% - 16px);
    }

    .books-hero-actions,
    .books-search-form,
    .book-detail-actions,
    .books-writing-actions,
    .books-writing-footer,
    .books-highlight-footer,
    .books-reader-head {
        align-items: stretch;
    }

    .books-search-form,
    .book-detail-actions,
    .books-writing-actions,
    .books-writing-footer,
    .books-highlight-footer {
        grid-template-columns: 1fr;
        display: grid;
    }

    .books-search-form .button-outline,
    .book-detail-actions .button,
    .book-detail-actions .button-outline,
    .book-detail-actions form,
    .book-detail-actions form button,
    .books-writing-actions .button-outline,
    .books-writing-footer .button,
    .books-highlight-footer .button-outline {
        width: 100%;
    }

    .book-detail-actions form {
        margin: 0;
    }

    .books-writing-meta {
        grid-template-columns: 1fr;
    }

    .books-highlight-cover,
    .book-detail-cover,
    .books-card-cover {
        max-width: none;
        width: 100%;
        min-height: 220px;
    }

    .books-card-copy,
    .books-highlight-copy,
    .book-detail-copy {
        min-width: 0;
    }

    .books-meta-grid {
        grid-template-columns: 1fr 1fr;
    }

    .books-genre-pill,
    .books-editor-chapter-link,
    .books-chapter-list li a {
        padding: 10px 12px;
    }

    .books-reaction-bar-inline,
    .reaction-bar,
    .reaction-summary {
        gap: 6px;
    }

    .books-inline-action {
        padding-left: 0;
    }
}

@media (max-width: 520px) {
    .books-meta-grid {
        grid-template-columns: 1fr;
    }

    .books-reader-main,
    .books-writing-body {
        font-size: 0.96rem;
    }

    .books-writing-body {
        min-height: 66vh;
    }

    .books-reader-main,
    .books-writing-card,
    .books-card,
    .books-highlight,
    .book-detail-card {
        border-radius: 12px;
    }
}