/* Book detail */
.ap-book-detail { padding-top: 0.25rem; }
.ap-book-detail-hero { align-items: center; display: grid; gap: clamp(1.5rem, 3vw, 3rem); grid-template-columns: minmax(280px, 360px) minmax(360px, 1fr) 250px; min-height: 390px; }
.ap-book-stage { align-items: end; align-self: stretch; background: radial-gradient(circle at 52% 55%, #f0e4d5, transparent 58%); display: flex; justify-content: center; padding: 1rem 1.4rem 0; position: relative; }
.ap-book-stage::before,
.ap-book-stage::after { border: 1px solid #dfc9aa; border-radius: 60% 0; bottom: 1rem; content: ""; height: 120px; opacity: 0.7; position: absolute; width: 48px; }
.ap-book-stage::before { left: 1rem; transform: rotate(-25deg); }
.ap-book-stage::after { right: 0.6rem; transform: rotate(25deg); }
.ap-detail-cover { aspect-ratio: 2 / 3; box-shadow: 11px 14px 22px rgba(47,33,22,0.25); max-width: 230px; overflow: hidden; position: relative; transform: perspective(900px) rotateY(-4deg); width: 75%; }
.ap-detail-cover::after { background: linear-gradient(0deg, rgba(15,13,12,0.75), transparent 60%); content: ""; inset: 0; position: absolute; }
.ap-detail-cover img { height: 100%; object-fit: cover; width: 100%; }
.ap-detail-cover > span { bottom: 1.2rem; color: #f2d8aa; display: grid; gap: 0.7rem; left: 1rem; position: absolute; right: 1rem; text-align: center; z-index: 1; }
.ap-detail-cover > span small { font-size: 0.46rem; letter-spacing: 0.12em; }
.ap-detail-cover > span strong { font-family: var(--ap-serif); font-size: clamp(1.25rem, 2.2vw, 2rem); font-weight: 500; line-height: 0.94; text-transform: uppercase; }
.ap-book-overview { min-width: 0; }
.ap-book-overview h1 { color: #8f622c; font-family: var(--ap-serif); font-size: clamp(2.8rem, 5vw, 4.7rem); font-weight: 400; line-height: 0.9; margin: 0; overflow-wrap: anywhere; text-shadow: 0 3px 4px rgba(76,48,18,0.22); text-transform: uppercase; }
.ap-book-overview h2 { font-family: var(--ap-serif); font-size: 1.25rem; font-weight: 500; margin: 0.75rem 0; }
.ap-book-overview .ap-rating { align-items: center; display: flex; gap: 0.7rem; margin: 0.8rem 0; }
.ap-book-overview .ap-rating b { color: var(--ap-gold); font-size: 1.4rem; }
.ap-book-overview .ap-rating strong { font-family: var(--ap-serif); font-size: 1.35rem; font-weight: 500; }
.ap-book-overview .ap-rating small { color: var(--ap-muted); font-size: 0.62rem; }
.ap-book-description { background: rgba(255,255,255,0.68); border: 1px solid var(--ap-line); border-radius: 8px; box-shadow: 0 14px 34px rgba(72,48,29,0.06); font-family: var(--ap-serif); font-size: 0.9rem; line-height: 1.55; max-width: 620px; padding: 1rem 1.1rem 1.05rem; position: relative; }
.ap-book-description-label { align-items: center; color: #a7743a; display: flex; font-family: var(--ap-sans); font-size: clamp(0.58rem, 2.65vw, 0.68rem); font-weight: 700; gap: 0.55rem; letter-spacing: 0.08em; margin-bottom: 0.65rem; max-width: 100%; min-width: 0; text-transform: uppercase; white-space: nowrap; }
.ap-book-description-label::after { background: var(--ap-line); content: ""; flex: 1 1 auto; height: 1px; min-width: 18px; width: auto; }
.ap-book-overview blockquote { background: rgba(255,255,255,0.54); border: 1px solid var(--ap-line); border-radius: 7px; color: #7b7168; font-family: var(--ap-serif); font-size: 0.78rem; font-style: italic; line-height: 1.45; margin: 1rem 0 0; padding: 0.85rem 1rem 0.85rem 2.7rem; position: relative; }
.ap-book-overview blockquote::before { color: var(--ap-gold); content: "“"; font-size: 2.6rem; left: 0.8rem; position: absolute; top: 0.1rem; }
.ap-book-actions-panel { background: rgba(255,255,255,0.7); border: 1px solid var(--ap-line); border-radius: 8px; box-shadow: 0 12px 32px rgba(79,55,34,0.06); display: grid; gap: 0.65rem; padding: 1rem; }
.ap-book-actions-panel > a,
.ap-book-actions-panel > button { font-size: 0.72rem; min-height: 44px; width: 100%; }
.ap-book-actions-panel dl { border-top: 1px solid var(--ap-line); display: grid; gap: 0.75rem; margin: 0.5rem 0 0; padding-top: 0.8rem; }
.ap-book-actions-panel dl div { display: grid; font-size: 0.62rem; gap: 0.35rem; grid-template-columns: 1fr auto; }
.ap-book-actions-panel dt { color: #6c5742; font-weight: 650; }
.ap-book-actions-panel dd { color: var(--ap-muted); margin: 0; }
.ap-book-detail-grid { display: grid; gap: 1rem; grid-template-columns: 1fr 1.2fr; margin-top: 1rem; }
.ap-chapters-panel,
.ap-reviews-panel { background: rgba(255,255,255,0.54); border: 1px solid var(--ap-line); border-radius: 8px; min-height: 220px; padding: 1rem 1.25rem; }
.ap-chapters-panel header,
.ap-reviews-panel header { align-items: center; display: flex; justify-content: space-between; }
.ap-chapters-panel header h2,
.ap-reviews-panel header h2 { font-family: var(--ap-serif); font-size: 1.32rem; font-weight: 500; margin: 0; }
.ap-chapters-panel header span,
.ap-reviews-panel header span { color: var(--ap-muted); font-size: 0.58rem; }
.ap-chapters-panel ol { counter-reset: chapter; list-style: none; margin: 0.65rem 0; padding: 0; }
.ap-chapters-panel li { border-bottom: 1px solid var(--ap-line); counter-increment: chapter; }
.ap-chapters-panel li a { align-items: center; display: grid; font-family: var(--ap-serif); font-size: 0.76rem; gap: 0.65rem; grid-template-columns: 1.2rem 1fr auto; padding: 0.42rem 0; text-decoration: none; }
.ap-chapters-panel li a::before { content: counter(chapter); }
.ap-chapters-panel li small { color: var(--ap-muted); font-family: var(--ap-sans); font-size: 0.55rem; }
.ap-wide-button { width: 100%; }
.ap-empty-state { color: var(--ap-muted); font-family: var(--ap-serif); padding: 2rem 0; }
.ap-review-layout { align-items: center; display: grid; gap: 1.2rem; grid-template-columns: 120px 1fr; margin-top: 0.85rem; }
.ap-review-score { display: grid; justify-items: center; }
.ap-review-score strong { font-family: var(--ap-serif); font-size: 3rem; font-weight: 400; line-height: 1; }
.ap-review-score span { color: var(--ap-gold); letter-spacing: 0.08em; }
.ap-review-score small { color: var(--ap-muted); font-size: 0.55rem; margin-top: 0.35rem; }
.ap-review-card { background: rgba(255,255,255,0.82); border: 1px solid var(--ap-line); border-radius: 7px; padding: 0.85rem 1rem; }
.ap-review-card > div { display: flex; justify-content: space-between; }
.ap-review-card b { font-family: var(--ap-serif); font-size: 0.8rem; }
.ap-review-card > div span { color: var(--ap-gold); font-size: 0.65rem; }
.ap-review-card small { color: var(--ap-muted); font-size: 0.52rem; }
.ap-review-card p { color: #655e59; font-size: 0.63rem; line-height: 1.45; margin-bottom: 0; }
.ap-review-dots { display: flex; gap: 0.4rem; justify-content: center; margin-top: 0.65rem; }
.ap-review-dots i { background: #d9d1c8; border-radius: 50%; height: 4px; width: 4px; }
.ap-review-dots i:first-child { background: var(--ap-gold); }
.ap-related-books { margin-top: 0.35rem; }
.ap-related-grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(4, 1fr); }
.ap-related-grid > article { background: rgba(255,255,255,0.55); border: 1px solid var(--ap-line); border-radius: 7px; display: grid; gap: 0.75rem; grid-template-columns: 40% 1fr; min-height: 150px; padding: 0.55rem; }
.ap-related-cover { align-items: end; background: linear-gradient(155deg, #ddcfbe, #77685d); border-radius: 4px; color: #f7e8cf; display: flex; font-family: var(--ap-serif); justify-content: center; overflow: hidden; padding: 0.7rem; position: relative; text-align: center; text-transform: uppercase; }
.ap-related-cover img { height: 100%; inset: 0; object-fit: cover; position: absolute; width: 100%; }
.ap-related-cover span { position: relative; z-index: 1; }
.ap-related-cover--1 { background: #211f1d; }
.ap-related-cover--2 { background: linear-gradient(155deg, #d9d0c6, #7f756d); }
.ap-related-cover--3 { background: linear-gradient(155deg, #efe7dc, #b39d83); }
.ap-related-grid h3 { font-family: var(--ap-serif); font-size: 0.82rem; font-weight: 600; line-height: 1.1; margin: 0.4rem 0; }
.ap-related-grid p { color: var(--ap-muted); font-size: 0.56rem; line-height: 1.45; }
.ap-related-grid .ap-outline-button { font-size: 0.55rem; min-height: 28px; padding: 0.35rem 0.55rem; }
.ap-book-signoff { align-items: center; background: linear-gradient(90deg, rgba(255,255,255,0.75), rgba(247,237,226,0.5)), url("../images/blog-writing-still-life.png") right/48% auto no-repeat; border: 1px solid var(--ap-line); border-radius: 7px; display: flex; font-family: "Segoe Script", cursive; justify-content: space-between; margin-top: 1.1rem; min-height: 78px; padding: 1rem 4rem; }
.ap-book-signoff b { color: var(--ap-gold); font-weight: 400; }

/* Reader */
.ap-reader-page { --ap-reader-bg: #fbf8f4; --ap-reader-paper: #fffdfb; }
.ap-reader-page,
.ap-reader-page * {
    max-width: 100%;
}
.ap-reader-workspace { background: rgba(255,255,255,0.48); border: 1px solid var(--ap-line); border-radius: 9px; display: grid; grid-template-columns: 300px minmax(460px, 1fr); min-height: calc(100vh - 120px); max-width: 100%; overflow: hidden; }
.ap-reader-toc,
.ap-reader-notes { padding: 1.1rem; }
.ap-reader-toc { border-right: 1px solid var(--ap-line); }
.ap-reader-back { color: var(--ap-gold-deep); display: inline-block; font-size: 0.68rem; margin: 0.3rem 0 1.5rem; text-decoration: none; }
.ap-reader-book-card { align-items: center; display: grid; gap: 0.75rem; grid-template-columns: 94px 1fr; }
.ap-reader-mini-cover { aspect-ratio: 2/3; box-shadow: 4px 7px 14px rgba(43,30,21,0.18); overflow: hidden; position: relative; }
.ap-reader-mini-cover img { height: 100%; object-fit: cover; width: 100%; }
.ap-reader-mini-cover span { bottom: 0.5rem; color: #f1d4a5; font-family: var(--ap-serif); font-size: 0.68rem; left: 0.3rem; line-height: 0.9; position: absolute; right: 0.3rem; text-align: center; text-transform: uppercase; }
.ap-reader-book-card h2 { font-family: var(--ap-serif); font-size: 1.02rem; font-weight: 500; line-height: 1; margin: 0; }
.ap-reader-book-card p { color: var(--ap-muted); font-family: var(--ap-serif); font-size: 0.72rem; margin: 0.3rem 0 0.8rem; }
.ap-reader-book-card small { color: var(--ap-muted); font-size: 0.58rem; }
.ap-small-progress { background: #e9e2db; border-radius: 999px; height: 4px; margin: 0.25rem 0 0.35rem; overflow: hidden; }
.ap-small-progress i { background: var(--ap-gold); display: block; height: 100%; transition: width 180ms ease; }
.ap-reader-toc > .ap-wide-button { font-size: 0.62rem; margin-top: 1rem; }
.ap-toc-list { border-top: 1px solid var(--ap-line); margin-top: 0.9rem; padding-top: 0.9rem; }
.ap-toc-list h2 { display: flex; font-family: var(--ap-serif); font-size: 1.08rem; font-weight: 500; justify-content: space-between; margin: 0; }
.ap-toc-list ol { list-style: none; margin: 0.7rem 0 0; padding: 0; }
.ap-toc-list li a { align-items: center; border-radius: 4px; display: flex; font-family: var(--ap-serif); font-size: 0.72rem; justify-content: space-between; padding: 0.43rem 0.55rem; text-decoration: none; }
.ap-toc-list li.is-current a { background: #f3e8da; color: #5f472d; }
.ap-toc-list li small { color: var(--ap-gold); }
.ap-reader-download { background: transparent; border: 1px solid var(--ap-line); border-radius: 5px; bottom: 1.1rem; display: flex; font-size: 0.62rem; justify-content: space-between; margin-top: 1rem; padding: 0.75rem 1rem; width: 100%; }
.ap-reader-main { background: var(--ap-reader-paper); max-width: 100%; min-width: 0; overflow: hidden; padding: 1rem clamp(1.5rem, 4vw, 3.2rem); }
.ap-reader-toolbar { display: flex; gap: 0.35rem; justify-content: flex-end; }
.ap-reader-toolbar > div { display: flex; }
.ap-reader-toolbar button { align-items: center; background: rgba(255,255,255,0.78); border: 1px solid var(--ap-line); color: #5b514a; cursor: pointer; display: inline-flex; font-size: 0.86rem; font-weight: 650; gap: 0.42rem; justify-content: center; line-height: 1; min-height: 42px; min-width: 46px; padding: 0.62rem 0.9rem; }
.ap-reader-toolbar [data-reader-theme] { color: #8b5f2e; font-size: 1.05rem; min-width: 112px; }
.ap-reader-toolbar [data-reader-theme] span { color: #5b514a; font-size: 0.86rem; }
.ap-reader-toolbar > *:first-child button:first-child { border-radius: 5px 0 0 5px; }
.ap-reader-toolbar > button:last-child { border-radius: 0 5px 5px 0; }
.ap-reader-heading { margin: 0.3rem 0 1.65rem; }
.ap-reader-heading .ap-script-line { font-size: 0.78rem; }
.ap-reader-heading h1 { color: #815b2d; font-family: var(--ap-serif); font-size: clamp(1.95rem, 3.2vw, 3.05rem); font-weight: 400; line-height: 0.92; margin: 0; max-width: 100%; overflow-wrap: anywhere; text-shadow: 0 2px 3px rgba(83,53,21,0.18); text-transform: uppercase; word-break: break-word; }
.ap-reader-heading > small { font-family: var(--ap-serif); font-size: 1rem; }
.ap-reader-chapter-title { align-items: center; display: flex; gap: 1rem; margin-bottom: 1rem; }
.ap-reader-chapter-title h2 { font-family: var(--ap-serif); font-size: 1.35rem; font-weight: 500; margin: 0; min-width: 0; overflow-wrap: anywhere; white-space: normal; word-break: break-word; }
.ap-reader-chapter-title::after,
.ap-reader-chapter-title::before { background: var(--ap-line); content: ""; height: 1px; width: 100%; }
.ap-reader-chapter-title::before { max-width: 42px; order: 1; }
.ap-reader-chapter-title h2 { order: 0; }
.ap-reader-chapter-title span { color: var(--ap-gold); order: 2; }
.ap-reader-chapter-title::after { order: 3; }
.ap-reader-content { color: #453f3b; font-family: Georgia, "Times New Roman", serif; font-size: calc(1rem * var(--ap-reader-font-scale, 1)); line-height: 1.75; max-width: 100%; min-height: 170px; overflow-wrap: break-word; word-break: normal; }
.ap-reader-content p { margin: 0 0 1rem; }
.ap-reader-content p:first-child::first-letter { color: var(--ap-gold); float: left; font-family: var(--ap-serif); font-size: calc(4rem * var(--ap-reader-font-scale, 1)); line-height: 0.78; margin: 0.15rem 0.3rem 0 0; }
.ap-reader-state { color: var(--ap-muted); font-family: var(--ap-sans); text-align: center; }
.ap-reader-error { background: #f8efe6; border: 1px solid var(--ap-line); border-radius: 6px; padding: 1rem; text-align: center; }
.ap-reader-footer { align-items: center; display: grid; gap: 1rem; grid-template-columns: 1fr 160px 1fr; margin-top: 2rem; }
.ap-reader-footer > a,
.ap-reader-footer > button { font-size: 0.62rem; }
.ap-reader-footer > a:last-child,
.ap-reader-footer > button:last-child { justify-self: end; }
.ap-partner-next-button { align-items: center; background: linear-gradient(135deg, #7c3aed, #a855f7); border: 0; border-radius: 7px; box-shadow: 0 12px 28px rgba(124,58,237,0.22); color: #fff !important; cursor: pointer; display: inline-flex; font-weight: 700; gap: 0.5rem; justify-content: center; min-height: 52px; padding: 0.9rem 1.35rem; text-decoration: none; transition: transform 180ms ease, box-shadow 180ms ease; width: 100%; }
.ap-partner-next-button:hover { box-shadow: 0 16px 34px rgba(124,58,237,0.28); transform: translateY(-1px); }
.ap-reader-footer > div small { display: block; font-size: 0.55rem; text-align: center; }
.ap-reader-footer .is-disabled { opacity: 0.4; pointer-events: none; }
.ap-reader-notes { border-left: 1px solid var(--ap-line); display: grid; gap: 0.8rem; grid-auto-rows: min-content; }
.ap-reader-notes > section { background: rgba(255,255,255,0.55); border: 1px solid var(--ap-line); border-radius: 7px; padding: 0.85rem; }
.ap-reader-notes header { align-items: center; display: flex; justify-content: space-between; }
.ap-reader-notes h2 { font-family: var(--ap-serif); font-size: 0.9rem; font-weight: 500; margin: 0 0 0.7rem; }
.ap-reader-notes header button { background: none; border: 0; color: var(--ap-gold); cursor: pointer; }
.ap-reader-notes blockquote { background: #f8f3ed; border: 0; border-radius: 5px; color: #665e57; font-family: var(--ap-serif); font-size: 0.68rem; font-style: italic; line-height: 1.45; margin: 0; padding: 0.7rem; }
.ap-reader-notes blockquote small { color: var(--ap-muted); display: block; font-family: var(--ap-sans); font-size: 0.48rem; margin-top: 0.65rem; }
.ap-reader-notes > section > p { color: #665e57; font-size: 0.58rem; line-height: 1.45; }
.ap-daily-quote { min-height: 140px; position: relative; }
.ap-daily-quote p { font-family: var(--ap-serif); font-size: 0.72rem !important; font-style: italic; padding: 0 0.5rem; }
.ap-daily-quote > span { bottom: 0.8rem; color: var(--ap-gold); font-size: 1.5rem; position: absolute; right: 0.8rem; }
.ap-reader-progress-card > div { align-items: center; display: grid; gap: 0.7rem; grid-template-columns: 72px 1fr; }
.ap-reader-progress-card strong { align-items: center; border: 4px solid #e8e0d7; border-right-color: var(--ap-gold); border-radius: 50%; display: flex; font-family: var(--ap-serif); font-size: 1rem; font-weight: 500; height: 64px; justify-content: center; width: 64px; }
.ap-reader-progress-card p { margin: 0; }
.ap-reader-progress-card p b,
.ap-reader-progress-card p small { display: block; margin-top: 0.25rem; }
.ap-reader-progress-card .ap-outline-button { font-size: 0.56rem; margin-top: 0.75rem; width: 100%; }

body.ap-reader-dark .ap-reader-page { --ap-cream: #1b1918; --ap-paper: #24211f; --ap-ink: #f2ebe4; --ap-muted: #b7aca3; --ap-line: #49413b; --ap-reader-bg: #1b1918; --ap-reader-paper: #24211f; background: #1b1918; }
body.ap-reader-dark .ap-reader-main,
body.ap-reader-dark .ap-reader-workspace,
body.ap-reader-dark .ap-reader-notes > section { background: #24211f; }
body.ap-reader-dark .ap-reader-content { color: #ded6cf; }
body.ap-reader-dark .ap-reader-toolbar button,
body.ap-reader-dark .ap-reader-notes blockquote { background: #2d2926; color: #ded6cf; }

.ap-book-page .ap-book-detail {
    padding-top: 0.55rem;
}

.ap-book-page .ap-book-detail-hero {
    align-items: start;
    grid-template-columns: minmax(280px, 390px) minmax(360px, 1fr) minmax(250px, 305px);
    min-height: 438px;
}

.ap-book-page .ap-book-stage {
    align-items: center;
    align-self: start;
    background:
        linear-gradient(90deg, transparent, rgba(255,255,255,0.38) 46%, transparent),
        radial-gradient(circle at 54% 58%, #efe0cd, transparent 56%);
    min-height: 438px;
    padding: 1.1rem 1.2rem;
}

.ap-book-page .ap-book-actions-panel { align-self: start; }

.ap-book-page .ap-book-stage::before,
.ap-book-page .ap-book-stage::after {
    bottom: 1.5rem;
    opacity: 0.46;
}

.ap-book-page .ap-detail-cover--flat {
    border-radius: 7px;
    box-shadow: 0 18px 34px rgba(46, 31, 20, 0.22);
    max-width: 318px;
    transform: none;
    width: min(82%, 318px);
}

.ap-book-page .ap-detail-cover--flat::after {
    background: linear-gradient(90deg, rgba(0,0,0,0.32), transparent 14%), linear-gradient(0deg, rgba(0,0,0,0.58), transparent 58%);
    pointer-events: none;
}

.ap-book-page .ap-detail-cover--flat:has(img[srcset])::after {
    background: linear-gradient(90deg, rgba(0,0,0,0.32), transparent 14%);
}

.ap-book-page .ap-detail-cover--flat img {
    display: block;
    image-rendering: auto;
}

.ap-book-page .ap-book-overview h1 {
    color: #3f3731;
    font-size: clamp(3.3rem, 5.8vw, 5.35rem);
    letter-spacing: 0;
    text-shadow: 0 3px 6px rgba(122, 86, 48, 0.22);
}

.ap-book-page .ap-book-overview h2 {
    color: #3d3631;
    font-size: 1.45rem;
    margin: 0.7rem 0 0.7rem;
}

.ap-book-page .ap-book-description {
    color: #3f3935;
    font-family: var(--ap-sans);
    font-size: 0.86rem;
    line-height: 1.62;
    margin-top: 1rem;
}

.ap-book-page .ap-book-description p {
    margin: 0 0 0.72rem;
}

.ap-book-page .ap-book-description p:last-child {
    margin-bottom: 0;
}

.ap-book-page .ap-book-overview blockquote {
    max-width: 620px;
}

.ap-book-page .ap-book-actions-panel {
    border-radius: 8px;
    gap: 0.8rem;
    padding: 1.25rem;
}

.ap-book-page .ap-book-actions-panel > a,
.ap-book-page .ap-book-actions-panel > button,
.ap-book-page .ap-book-actions-panel > span {
    font-size: 0.9rem;
    min-height: 52px;
}

.ap-book-page .ap-book-actions-panel .is-disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.ap-book-page .ap-book-actions-panel dl {
    gap: 1rem;
    margin-top: 0.65rem;
    padding-top: 1.1rem;
}

.ap-book-page .ap-book-actions-panel dl div {
    font-size: 0.78rem;
}

.ap-book-detail-grid--single {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
}

.ap-book-detail-grid--single .ap-chapters-panel {
    min-height: 240px;
}

.ap-book-quote-panel {
    align-items: center;
    background: rgba(255,255,255,0.54);
    border: 1px solid var(--ap-line);
    border-radius: 8px;
    display: flex;
    min-height: 240px;
    padding: 1.2rem 1.5rem;
}

.ap-book-quote-panel blockquote {
    border: 0;
    color: #756c65;
    font-family: var(--ap-serif);
    font-size: clamp(1rem, 1.5vw, 1.28rem);
    font-style: italic;
    line-height: 1.45;
    margin: 0;
    padding-left: 2.4rem;
    position: relative;
}

.ap-book-quote-panel blockquote::before {
    color: var(--ap-gold);
    content: "“";
    font-size: 3.2rem;
    left: 0;
    line-height: 1;
    position: absolute;
    top: -0.3rem;
}

@media (max-width: 1120px) {
    .ap-book-page .ap-book-detail-hero {
        grid-template-columns: 310px 1fr;
    }
}

@media (max-width: 820px) {
    .ap-book-page .ap-book-detail-hero,
    .ap-book-detail-grid--single {
        grid-template-columns: 1fr;
    }

    .ap-book-page .ap-book-stage {
        min-height: 420px;
    }
}

@media (max-width: 620px) {
    .ap-book-page .ap-book-stage {
        min-height: 380px;
    }

    .ap-book-page .ap-detail-cover--flat {
        width: min(74vw, 270px);
    }

    .ap-book-page .ap-book-overview h1 {
        font-size: 3rem;
    }
}

@media (max-width: 1120px) {
    .ap-book-detail-hero { grid-template-columns: 280px 1fr; }
    .ap-book-actions-panel { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
    .ap-book-actions-panel dl { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); }
    .ap-reader-workspace { grid-template-columns: 240px minmax(440px, 1fr); }
}

@media (max-width: 820px) {
    .ap-book-detail-hero { grid-template-columns: 220px 1fr; }
    .ap-book-detail-grid { grid-template-columns: 1fr; }
    .ap-related-grid { grid-template-columns: repeat(2, 1fr); }
    .ap-book-signoff { padding: 1rem 1.5rem; }
    .ap-reader-workspace { grid-template-columns: minmax(0, 1fr); width: 100%; }
    .ap-reader-toc { border-bottom: 1px solid var(--ap-line); border-right: 0; }
    .ap-toc-list { max-width: 100%; min-width: 0; overflow: hidden; }
    .ap-toc-list ol { display: grid; gap: 0.35rem; grid-template-columns: repeat(4, minmax(0, 1fr)); max-height: 7.4rem; max-width: 100%; overflow-x: hidden; overflow-y: auto; padding: 0.05rem 0.15rem 0.05rem 0; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
    .ap-toc-list li { min-width: 0; }
    .ap-toc-list li a { background: rgba(255,255,255,0.62); border: 1px solid var(--ap-line); display: grid; gap: 0.25rem; grid-template-columns: minmax(0, 1fr) auto; min-height: 38px; min-width: 0; padding: 0.46rem 0.55rem; }
    .ap-toc-list li.is-current a { border-color: #d7bd9d; }
    .ap-toc-list li a span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ap-toc-list li small { font-size: 0.58rem; min-width: 0.9rem; text-align: right; }
    .ap-reader-notes { grid-column: auto; }
}

@media (max-width: 620px) {
    .ap-book-detail-hero { grid-template-columns: 1fr; }
    .ap-book-stage { min-height: 360px; }
    .ap-book-overview h1 { font-size: 2.8rem; }
    .ap-book-actions-panel { grid-template-columns: 1fr; }
    .ap-book-actions-panel dl { grid-column: auto; grid-template-columns: 1fr 1fr; }
    .ap-related-grid { grid-template-columns: 1fr; }
    .ap-book-signoff { align-items: flex-start; flex-direction: column; gap: 0.6rem; }
    .ap-reader-page { overflow-x: hidden; padding-inline: 0; }
    .ap-reader-workspace { border-left: 0; border-radius: 0; border-right: 0; margin-inline: 0; width: 100%; }
    .ap-reader-toc,
    .ap-reader-main { min-width: 0; width: 100%; }
    .ap-reader-main { padding: 1rem clamp(.85rem, 4vw, 1rem); }
    .ap-toc-list ol { grid-template-columns: repeat(3, minmax(0, 1fr)); max-height: 6.6rem; }
    .ap-reader-toolbar { justify-content: flex-start; max-width: 100%; overflow-x: auto; padding-bottom: .15rem; }
    .ap-reader-toolbar > div { flex: 0 0 auto; }
    .ap-reader-toolbar button { font-size: 0.9rem; min-height: 44px; min-width: 48px; }
    .ap-reader-toolbar [data-reader-theme] span { display: inline; font-size: 0.88rem; }
    .ap-reader-heading .ap-script-line { overflow-wrap: break-word; }
    .ap-reader-heading h1 { font-size: clamp(1.95rem, 10vw, 2.65rem); }
    .ap-reader-chapter-title { align-items: center; display: grid; gap: .55rem; grid-template-columns: 42px auto 1fr; }
    .ap-reader-chapter-title h2 { font-size: clamp(1.35rem, 7vw, 1.75rem); grid-column: 1 / -1; line-height: 1.12; }
    .ap-reader-chapter-title::before { max-width: none; order: initial; width: 42px; }
    .ap-reader-chapter-title span { order: initial; }
    .ap-reader-chapter-title::after { min-width: 34px; order: initial; width: 100%; }
    .ap-reader-content { font-size: calc(clamp(.98rem, 5vw, 1.08rem) * var(--ap-reader-font-scale, 1)); line-height: 1.72; }
    .ap-reader-content p { max-width: 100%; overflow-wrap: break-word; }
    .ap-reader-footer { grid-template-columns: 1fr; }
    .ap-reader-footer > div { grid-column: 1 / -1; grid-row: 1; }
    .ap-reader-footer > a,
    .ap-reader-footer > button {
        justify-self: stretch !important;
        min-width: 0;
        overflow-wrap: break-word;
        text-align: center;
        width: 100%;
    }
    .ap-reader-notes { grid-template-columns: 1fr; }
    .ap-review-layout { grid-template-columns: 1fr; }
    .ap-book-page .ap-book-detail { min-width: 0; }
    .ap-book-page .ap-book-detail-hero { gap: 1.25rem; }
    .ap-book-page .ap-book-stage { min-height: 360px; padding: .75rem; }
    .ap-book-page .ap-book-overview h1 { font-size: clamp(2.5rem, 13vw, 3.4rem); }
    .ap-book-description { font-size: clamp(0.82rem, 4.25vw, 0.94rem); overflow-wrap: normal; word-break: normal; }
    .ap-chapters-panel { padding-inline: .8rem; }
    .ap-chapters-panel header { align-items: flex-start; gap: .5rem; }
    .ap-chapters-panel li a { grid-template-columns: 1rem minmax(0, 1fr); }
    .ap-chapters-panel li small { grid-column: 2; }
}

@media (max-width: 390px) {
    .ap-reader-toc,
    .ap-reader-notes {
        padding: .85rem;
    }

    .ap-reader-book-card {
        gap: .65rem;
        grid-template-columns: 76px minmax(0, 1fr);
    }

    .ap-reader-toolbar button {
        padding-inline: .72rem;
    }

    .ap-reader-toolbar [data-reader-theme] {
        min-width: 104px;
    }

    .ap-reader-content {
        font-size: calc(.98rem * var(--ap-reader-font-scale, 1));
    }
}
