* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    color: #17201b;
    background: #f7f8f5;
}

a {
    color: inherit;
    text-decoration: none;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 14px 6vw;
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(23, 32, 27, 0.08);
}

.brand {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    font-size: 22px;
    font-weight: 800;
    color: #143d2d;
}

.brand-logo {
    display: block;
    max-width: 180px;
    max-height: 42px;
    object-fit: contain;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 14px;
    white-space: nowrap;
}

.nav-button,
.primary-link,
.primary-btn,
.ghost-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 18px;
    border-radius: 6px;
    border: 0;
    cursor: pointer;
    font-weight: 700;
    text-decoration: none;
}

.nav-button,
.primary-link,
.primary-btn {
    background: #1f6f4a;
    color: #fff;
}

.ghost-link {
    background: #fff;
    color: #1f6f4a;
    border: 1px solid rgba(31, 111, 74, 0.24);
}

.hero {
    min-height: 430px;
    display: grid;
    align-items: center;
    padding: 74px 6vw 56px;
    color: #fff;
    background: #143d2d;
}

.hero-copy {
    max-width: 760px;
}

.eyebrow {
    color: #f3c46b;
    text-transform: uppercase;
    letter-spacing: 0;
    font-size: 13px;
    font-weight: 800;
}

.hero h1 {
    max-width: 680px;
    margin: 12px 0 18px;
    font-size: 52px;
    line-height: 1.03;
    letter-spacing: 0;
}

.hero p {
    max-width: 620px;
    margin: 0 0 28px;
    font-size: 18px;
    line-height: 1.65;
}

.search-bar {
    display: flex;
    width: min(620px, 100%);
    background: #fff;
    padding: 7px;
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

.search-bar input {
    flex: 1;
    min-width: 0;
    border: 0;
    padding: 0 14px;
    font-size: 16px;
    outline: 0;
}

.search-bar button {
    border: 0;
    border-radius: 6px;
    padding: 0 24px;
    min-height: 44px;
    background: #d8563f;
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.book-grid-section,
.chapter-list-section,
.comments-section,
.pricing,
.account-layout,
.book-detail,
.reader,
.auth-panel {
    width: min(1180px, 88vw);
    margin: 0 auto;
}

.book-grid-section,
.chapter-list-section,
.comments-section,
.pricing,
.account-layout {
    padding: 48px 0;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 24px;
}

.section-heading h1,
.section-heading h2 {
    margin: 0;
    font-size: 34px;
}

.section-heading p,
.muted {
    color: #687069;
}

.book-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.directory-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.directory-menu a {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid rgba(31, 111, 74, 0.22);
    border-radius: 6px;
    background: #fff;
    color: #1f6f4a;
    font-weight: 700;
}

.directory-menu a.active,
.directory-menu a:hover {
    background: #1f6f4a;
    color: #fff;
}

.book-card,
.price-card,
.auth-card,
.account-summary,
.account-main,
.locked-box {
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(23, 32, 27, 0.08);
    box-shadow: 0 16px 40px rgba(43, 33, 21, 0.08);
}

.book-card {
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.book-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 20px 48px rgba(43, 33, 21, 0.12);
}

.cover,
.detail-cover {
    display: grid;
    place-items: center;
    background: #1f6f4a;
    color: #fff;
    overflow: hidden;
}

.cover {
    aspect-ratio: 4 / 5;
}

.cover img,
.detail-cover img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 24px;
    background: #fff;
}

.cover span,
.detail-cover span {
    font-size: 62px;
    font-weight: 900;
}

.book-card-body {
    padding: 16px;
}

.book-card h3 {
    margin: 0 0 8px;
    font-size: 19px;
    line-height: 1.25;
}

.book-card p {
    line-height: 1.55;
    margin: 8px 0 0;
}

.book-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
    color: #d8563f;
    font-size: 13px;
    font-weight: 800;
}

.book-detail {
    display: grid;
    grid-template-columns: minmax(230px, 300px) 1fr;
    gap: 38px;
    padding: 50px 0 28px;
    align-items: start;
}

.detail-cover {
    aspect-ratio: 3 / 4;
    border-radius: 8px;
    box-shadow: 0 24px 70px rgba(23, 32, 27, 0.16);
}

.detail-copy h1 {
    margin: 0 0 8px;
    font-size: 42px;
    line-height: 1.1;
}

.detail-copy p {
    font-size: 17px;
    line-height: 1.75;
}

.detail-copy > div a,
.reader-content a {
    color: #1769d4;
    font-weight: 800;
    text-decoration: none;
}

.detail-copy > div a:hover,
.reader-content a:hover {
    color: #d8563f;
    text-decoration: none;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 26px;
}

.inline-unlock-form,
.full-unlock-form {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
}

.unlock-note {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    color: #687069;
    font-size: 14px;
    font-weight: 700;
}

.chapter-list {
    display: grid;
    gap: 10px;
}

.chapter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px 18px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(23, 32, 27, 0.08);
    transition: background 0.16s ease, border-color 0.16s ease;
}

.chapter-row:hover {
    background: #fbfcfa;
    border-color: rgba(31, 111, 74, 0.24);
}

.chapter-row em {
    flex: 0 0 auto;
    color: #d8563f;
    font-style: normal;
    font-weight: 800;
}

.chapter-row em.access-free,
.chapter-row em.access-unlocked {
    color: #1f6f4a;
}

.chapter-row em.access-locked {
    color: #d8563f;
}

.reader {
    max-width: 900px;
    padding: 42px 0 70px;
}

.reader-head a {
    color: #1f6f4a;
    font-weight: 800;
}

.reader-head h1 {
    margin: 10px 0 26px;
    font-size: 36px;
}

.reader-access {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin: -12px 0 24px;
    padding: 0 12px;
    border-radius: 6px;
    background: rgba(31, 111, 74, 0.1);
    color: #1f6f4a;
    font-size: 14px;
    font-weight: 800;
}

.reader-access.access-locked {
    background: rgba(216, 86, 63, 0.1);
    color: #d8563f;
}

.reader-content {
    padding: 44px 48px;
    border-radius: 8px;
    background: #fff;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 18px;
    line-height: 1.92;
    box-shadow: 0 16px 40px rgba(43, 33, 21, 0.08);
}

.locked-box {
    padding: 34px;
}

.locked-box form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.locked-box .full-unlock-form {
    margin-top: 14px;
}

.reader-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
    padding: 16px 0;
}

.reader-nav a {
    color: #1f6f4a;
    font-weight: 800;
}

.reader-comments {
    width: 100%;
    padding: 44px 0 0;
}

.comment-form {
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(23, 32, 27, 0.08);
}

.comment-form textarea {
    min-height: 110px;
}

.comment-login {
    padding: 16px 18px;
    margin-bottom: 20px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(23, 32, 27, 0.08);
}

.comment-login a {
    color: #1f6f4a;
    font-weight: 800;
}

.comment-list {
    display: grid;
    gap: 12px;
}

.comment-item {
    padding: 18px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid rgba(23, 32, 27, 0.08);
}

.comment-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: #687069;
    font-size: 14px;
    flex-wrap: wrap;
}

.comment-meta strong {
    color: #17201b;
}

.comment-item p {
    margin: 10px 0 0;
    line-height: 1.65;
}

.auth-panel {
    min-height: 70vh;
    display: grid;
    place-items: center;
    padding: 60px 0;
}

.auth-card {
    width: min(430px, 100%);
    padding: 30px;
}

.auth-card h1,
.account-summary h1 {
    margin-top: 0;
}

label {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
    color: #3d463f;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid rgba(23, 32, 27, 0.16);
    border-radius: 6px;
    padding: 12px 13px;
    font: inherit;
    background: #fff;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 18px;
}

.price-card {
    padding: 24px;
}

.price-card h2 {
    margin: 0 0 12px;
}

.vip-card {
    border-top: 5px solid #d8563f;
}

.account-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 24px;
}

.account-summary,
.account-main {
    padding: 24px;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(23, 32, 27, 0.08);
}

.account-note {
    margin: 16px 0;
    color: #687069;
    font-size: 14px;
    line-height: 1.55;
}

.plain-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
    background: #fff;
}

.plain-table th,
.plain-table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid rgba(23, 32, 27, 0.08);
    vertical-align: top;
}

.order-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mini-link {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid rgba(31, 111, 74, 0.22);
    border-radius: 6px;
    background: #fff;
    color: #1f6f4a;
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
}

.danger-mini {
    border-color: rgba(192, 61, 53, 0.28);
    color: #c03d35;
}

.flash {
    width: min(1180px, 88vw);
    margin: 18px auto 0;
    padding: 14px 16px;
    border-radius: 8px;
    background: #fff;
    border-left: 5px solid #1f6f4a;
}

.flash-success {
    border-left-color: #1f6f4a;
}

.flash-error {
    border-left-color: #c03d35;
}

.flash-warning {
    border-left-color: #d7a22a;
}

.empty {
    color: #687069;
}

.site-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 34px 6vw;
    color: #f6f3ec;
    background: #17201b;
}

@media (max-width: 780px) {
    .site-header {
        align-items: stretch;
        gap: 12px;
    }

    .main-nav {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
        gap: 14px;
    }

    .hero {
        min-height: 480px;
        padding-top: 56px;
    }

    .hero h1 {
        font-size: 38px;
    }

    .search-bar {
        flex-direction: column;
    }

    .search-bar input {
        min-height: 44px;
    }

    .book-detail,
    .account-layout {
        grid-template-columns: 1fr;
    }

    .book-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .detail-cover {
        width: min(260px, 100%);
    }

    .reader-content {
        padding: 24px 20px;
        font-size: 17px;
    }

    .reader-head h1,
    .detail-copy h1,
    .section-heading h1,
    .section-heading h2 {
        font-size: 30px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .chapter-row,
    .reader-nav,
    .site-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .book-grid-section,
    .chapter-list-section,
    .comments-section,
    .pricing,
    .account-layout {
        padding: 36px 0;
    }
}

@media (max-width: 480px) {
    .book-grid {
        grid-template-columns: 1fr;
    }
}
