/* ---------- 11. Bottom sheets ---------- */
.ap-sheet { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.ap-sheet[hidden] { display: none; }
.ap-sheet__scrim { position: absolute; inset: 0; background: var(--ap-scrim); opacity: 0; transition: opacity .3s ease; }
.ap-sheet__panel {
    position: relative; width: min(100%, var(--ap-max)); max-height: 88vh; max-height: 88dvh;
    display: flex; flex-direction: column;
    background: var(--ap-surface); border-radius: 24px 24px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, .22);
    padding-bottom: var(--ap-safe-b);
    transform: translateY(100%); transition: transform .36s var(--ap-ease);
    will-change: transform;
}
.ap-sheet.is-open .ap-sheet__scrim { opacity: 1; }
.ap-sheet.is-open .ap-sheet__panel { transform: translateY(0); }
.ap-sheet.is-dragging .ap-sheet__panel, .ap-sheet.is-dragging .ap-sheet__scrim { transition: none; }
.ap-sheet__grab { position: relative; width: 40px; height: 5px; margin: 8px auto 0; border-radius: 3px; background: var(--ap-surface-3); touch-action: none; flex: none; }
.ap-sheet__grab::before { content: ""; position: absolute; inset: -14px -40px; }
.ap-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 8px 6px 20px; min-height: 52px; flex: none; touch-action: none; }
.ap-sheet__head h2 { font-size: 18px; font-weight: 750; }
.ap-sheet__body { overflow-y: auto; overscroll-behavior: contain; padding: 4px 20px 24px; -webkit-overflow-scrolling: touch; }
.ap-sheet__body.is-flush { padding-left: 0; padding-right: 0; }
body.ap-locked { overflow: hidden; }

.ap-sharegrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px 4px; padding-top: 4px; }
.ap-shareitem { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 84px; padding: 6px 2px; background: none; border: 0; color: var(--ap-text); font-size: 12.5px; font-weight: 550; cursor: pointer; }
.ap-shareitem span.dot { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 20px; }
.ap-shareitem .dot .ap-i { width: 24px; height: 24px; }

.ap-stars { display: flex; justify-content: center; gap: 4px; padding: 8px 0 4px; }
.ap-stars button { width: 52px; height: 52px; border: 0; background: none; color: var(--ap-surface-3); cursor: pointer; border-radius: 50%; }
.ap-stars button .ap-i { width: 38px; height: 38px; stroke: none; fill: currentColor; transition: transform .3s var(--ap-spring); }
.ap-stars button.is-on { color: var(--ap-star); }
.ap-stars button:active .ap-i { transform: scale(.85); }

/* ---------- 12. Toasts ---------- */
.ap-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--ap-tab-h) + var(--ap-safe-b) + 14px); z-index: 300; width: min(100%, var(--ap-max)); padding: 0 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
body.ap-notabs .ap-toasts { bottom: calc(var(--ap-safe-b) + 92px); }
.ap-toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 100%; padding: 12px 16px; border-radius: 14px; background: #202023; color: #fff; font-size: 14px; font-weight: 550; line-height: 1.3; box-shadow: var(--ap-shadow-2); opacity: 0; transform: translateY(14px) scale(.98); transition: opacity .25s, transform .32s var(--ap-spring); }
:root[data-theme="dark"] .ap-toast { background: #2E2E33; }
.ap-toast.is-show { opacity: 1; transform: none; }
.ap-toast .ap-i { width: 20px; height: 20px; }
.ap-toast--success .ap-i { color: #6BD69C; }
.ap-toast--error .ap-i { color: #FF8F86; }
.ap-toast a { color: #FFB3C1; font-weight: 700; margin-left: 4px; }

/* ---------- 13. Continue reading pill ---------- */
.ap-resume {
    position: fixed; left: 50%; transform: translateX(-50%);
    bottom: calc(var(--ap-tab-h) + var(--ap-safe-b) + 10px);
    width: min(calc(100% - 24px), calc(var(--ap-max) - 24px)); z-index: 45;
    display: grid; grid-template-columns: 40px minmax(0, 1fr) auto auto; gap: 12px; align-items: center;
    padding: 10px 6px 12px 10px; border-radius: 18px; overflow: hidden;
    background: var(--ap-surface); box-shadow: var(--ap-shadow-2), inset 0 0 0 1px var(--ap-border);
    animation: ap-rise .5s var(--ap-ease) both;
}
.ap-resume[hidden] { display: none; }
.ap-resume .ap-cover { width: 40px; border-radius: 6px; }
.ap-resume__text { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ap-resume__text small { font-size: 11.5px; color: var(--ap-text-2); font-weight: 550; }
.ap-resume__text strong { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-resume__text span { font-size: 12px; color: var(--ap-text-2); }
.ap-resume .ap-btn { min-height: 44px; padding: 0 16px; font-size: 14px; border-radius: 12px; }
.ap-resume .ap-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 0; background: transparent; }
body.has-resume .ap-main { padding-bottom: calc(var(--ap-tab-h) + var(--ap-safe-b) + 96px); }
@keyframes ap-rise { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ---------- 14. Groups & rows (settings-style lists) ---------- */
.ap-group { margin: 0 16px; background: var(--ap-surface); border-radius: 18px; box-shadow: inset 0 0 0 1px var(--ap-border); overflow: hidden; }
.ap-group + .ap-group, .ap-group + .ap-card, .ap-card + .ap-group { margin-top: 14px; }
.ap-group__title { margin: 22px 20px 8px; font-size: 13px; font-weight: 650; color: var(--ap-text-2); }
.ap-row { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 6px 14px 6px 14px; background: transparent; border: 0; color: var(--ap-text); text-align: left; font-size: 16px; font-weight: 520; cursor: pointer; position: relative; }
.ap-row + .ap-row { box-shadow: inset 0 1px 0 var(--ap-border); }
.ap-row:active { background: var(--ap-surface-2); }
.ap-row__icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 11px; background: var(--ap-surface-2); color: var(--ap-text); }
.ap-row__icon .ap-i { width: 20px; height: 20px; }
.ap-row__icon.is-pink { background: var(--ap-primary-soft); color: var(--ap-primary); }
.ap-row__icon.is-blue { background: var(--ap-blue-soft); color: var(--ap-blue-text); }
.ap-row__label { flex: 1; min-width: 0; }
.ap-row__label small { display: block; font-size: 13px; font-weight: 450; color: var(--ap-text-2); margin-top: 1px; }
.ap-row__value { color: var(--ap-text-2); font-size: 14px; font-weight: 500; }
.ap-row > .ap-i:last-child { width: 18px; height: 18px; color: var(--ap-text-2); opacity: .7; }
.ap-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; background: var(--ap-primary); color: #fff; font-size: 12px; font-weight: 700; }
.ap-card { margin: 0 16px; padding: 16px; background: var(--ap-surface); border-radius: 18px; box-shadow: inset 0 0 0 1px var(--ap-border); }

/* ---------- 15. Novel detail ---------- */
.ap-hero { position: relative; isolation: isolate; overflow: hidden; padding: calc(var(--ap-safe-t) + 76px) 20px 22px; text-align: center; }
.ap-hero__bg { position: absolute; inset: -30px; z-index: -2; background-size: cover; background-position: center; filter: blur(34px) saturate(1.35); transform: scale(1.2); opacity: .5; }
.ap-hero::after { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(to bottom, transparent 10%, var(--ap-bg) 96%); }
.ap-hero .ap-cover { width: min(46vw, 176px); margin: 0 auto; border-radius: 14px; box-shadow: 0 3px 6px rgba(23, 23, 23, .16), 0 22px 40px -12px rgba(23, 23, 23, .5); }
.ap-hero__title { margin-top: 20px; font-size: 24px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; text-wrap: balance; }
.ap-hero__author { display: inline-flex; align-items: center; min-height: 44px; font-size: 15px; color: var(--ap-accent-text); font-weight: 600; }
.ap-hero__facts { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 14px; font-size: 13px; color: var(--ap-text-2); }
.ap-stats { display: grid; grid-template-columns: repeat(3, 1fr); margin: 0 16px; padding: 14px 0; background: var(--ap-surface); border-radius: 18px; box-shadow: inset 0 0 0 1px var(--ap-border); }
.ap-stat { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 4px; background: none; border: 0; color: var(--ap-text); font: inherit; min-height: 48px; justify-content: center; }
.ap-stat + .ap-stat::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 1px; background: var(--ap-border-strong); }
.ap-stat strong { font-size: 19px; font-weight: 760; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 4px; }
.ap-stat strong .ap-i { width: 16px; height: 16px; color: var(--ap-star); }
.ap-stat span { font-size: 12px; color: var(--ap-text-2); font-weight: 550; }
button.ap-stat { cursor: pointer; }
.ap-actions { display: flex; gap: 10px; padding: 14px 16px 0; }
.ap-action { flex: 1; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--ap-surface); border: 0; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--ap-border-strong); color: var(--ap-text); font-size: 14px; font-weight: 620; cursor: pointer; }
.ap-action .ap-i { width: 20px; height: 20px; }
.ap-action.is-on { color: var(--ap-accent-text); background: var(--ap-primary-soft); box-shadow: inset 0 0 0 1px transparent; }
.ap-action.is-on .ap-i { animation: ap-pop .45s var(--ap-spring); }
.ap-syn { margin: 22px 16px 0; }
.ap-syn__text { margin: 0; font-size: 15px; line-height: 1.62; color: var(--ap-text); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ap-syn.is-open .ap-syn__text { display: block; -webkit-line-clamp: unset; }
.ap-syn__more { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; padding: 0; background: none; border: 0; color: var(--ap-accent-text); font-size: 14px; font-weight: 650; cursor: pointer; }
.ap-syn.is-open .ap-syn__more .ap-i { transform: rotate(180deg); }
.ap-tagrow { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 0; scrollbar-width: none; }
.ap-tagrow::-webkit-scrollbar { display: none; }
.ap-tagrow > * { flex: none; }
.ap-notice { display: flex; gap: 10px; align-items: flex-start; margin: 16px 16px 0; padding: 12px 14px; border-radius: 14px; background: var(--ap-blue-soft); color: var(--ap-blue-text); font-size: 14px; font-weight: 550; }
.ap-notice .ap-i { width: 20px; height: 20px; margin-top: 1px; }
.ap-author { display: flex; align-items: center; gap: 14px; }
.ap-avatar { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--ap-primary-soft); color: var(--ap-accent-text); font-weight: 800; font-size: 19px; overflow: hidden; }
.ap-avatar img { width: 100%; height: 100%; object-fit: cover; }
.ap-avatar--lg { width: 68px; height: 68px; font-size: 26px; }
.ap-cta {
    position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; z-index: 45; width: min(100%, var(--ap-max));
    display: flex; gap: 10px; align-items: center; padding: 10px 16px calc(10px + var(--ap-safe-b));
    background: var(--ap-bar-bg); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
    border-top: 1px solid var(--ap-border);
}
.ap-cta .ap-btn { flex: 1; min-height: 52px; }
.ap-cta__save { flex: none; width: 52px; height: 52px; border-radius: 14px; background: var(--ap-surface); box-shadow: inset 0 0 0 1px var(--ap-border-strong); border: 0; display: grid; place-items: center; color: var(--ap-text); cursor: pointer; }
.ap-cta__save.is-on { color: var(--ap-primary); background: var(--ap-primary-soft); box-shadow: none; }
.ap-cta__save.is-on .ap-i { animation: ap-pop .45s var(--ap-spring); }
.ap-btn__stack { display: flex; flex-direction: column; align-items: center; gap: 3px; line-height: 1.1; }
.ap-btn__stack small { font-size: 12px; font-weight: 550; opacity: .88; }

/* Chapter rows (sheet + detail) */
.ap-chtools { display: flex; gap: 10px; padding: 4px 20px 10px; position: sticky; top: 0; background: var(--ap-surface); z-index: 2; }
.ap-chtools .ap-search { min-height: 44px; border-radius: 12px; flex: 1; }
.ap-chrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 60px; padding: 8px 20px; color: var(--ap-text); }
.ap-chrow + .ap-chrow { box-shadow: inset 0 1px 0 var(--ap-border); }
.ap-chrow:active { background: var(--ap-surface-2); }
.ap-chrow__t { font-size: 15px; font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.ap-chrow__d { font-size: 12px; color: var(--ap-text-2); display: block; }
.ap-chrow.is-current { background: var(--ap-primary-soft); }
.ap-chrow.is-current .ap-chrow__t { color: var(--ap-accent-text); font-weight: 700; }
.ap-chrow .ap-i { width: 18px; height: 18px; color: var(--ap-text-2); }
.ap-chrow__here { font-size: 12px; font-weight: 700; color: var(--ap-accent-text); }
.ap-loadmore { display: flex; justify-content: center; padding: 14px 20px 6px; }

/* ---------- 16. Library ---------- */
.ap-libhead { padding-top: var(--ap-safe-t); background: var(--ap-bar-bg); position: sticky; top: 0; z-index: 25; -webkit-backdrop-filter: saturate(1.6) blur(16px); backdrop-filter: saturate(1.6) blur(16px); }
.ap-libhead .ap-tabs { border-bottom: 0; padding-top: 6px; }
.ap-libhead .ap-tabs a { font-size: 20px; font-weight: 750; letter-spacing: -.02em; }
.ap-shelf { position: relative; display: grid; grid-template-columns: 80px minmax(0, 1fr); gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--ap-border); }
.ap-shelf:last-child { border-bottom: 0; }
.ap-shelf__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.ap-shelf__title { font-size: 16px; font-weight: 680; letter-spacing: -.01em; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.25; }
.ap-shelf__title a::after { content: ""; position: absolute; inset: 0; }
.ap-shelf__sub { font-size: 13px; color: var(--ap-text-2); }
.ap-shelf__row { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.ap-shelf__row .ap-progress { flex: 1; }
.ap-shelf__pct { font-size: 12.5px; font-weight: 700; color: var(--ap-text); font-variant-numeric: tabular-nums; min-width: 34px; text-align: right; }
.ap-shelf__foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; }
.ap-shelf__foot .ap-btn { position: relative; z-index: 1; min-height: 44px; padding: 0 16px; font-size: 14px; }
.ap-pill { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--ap-blue-soft); color: var(--ap-blue-text); font-size: 11.5px; font-weight: 700; }
.ap-pill--pink { background: var(--ap-primary-soft); color: var(--ap-accent-text); }
.ap-sentinel { display: flex; justify-content: center; padding: 18px 0 6px; }

/* ---------- 17. Profile & wallet ---------- */
.ap-me { display: flex; align-items: center; gap: 14px; padding: calc(var(--ap-safe-t) + 20px) 16px 8px; }
.ap-me__name { font-size: 22px; font-weight: 780; letter-spacing: -.025em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-me__id { font-size: 13px; color: var(--ap-text-2); }
.ap-me__text { flex: 1; min-width: 0; }
.ap-wallet { margin: 16px 16px 0; padding: 18px 16px 16px; border-radius: 22px; background: var(--ap-surface); box-shadow: inset 0 0 0 1px var(--ap-border), var(--ap-shadow-1); }
.ap-wallet__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.ap-wallet__top h2 { font-size: 16px; font-weight: 700; }
.ap-wallet__top a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; color: var(--ap-text-2); font-weight: 600; }
.ap-wallet__body { display: flex; align-items: center; gap: 16px; }
.ap-wallet__balance { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.ap-wallet__num { font-size: 28px; font-weight: 800; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.ap-wallet__lbl { font-size: 13px; color: var(--ap-text-2); font-weight: 550; margin-top: 4px; display: block; }
.ap-subbanner { display: flex; align-items: center; gap: 14px; margin: 14px 16px 0; padding: 16px; border-radius: 20px; color: #F6EEF1; background: radial-gradient(120% 140% at 100% 0%, rgba(233, 79, 112, .42), transparent 55%), linear-gradient(135deg, #2A2129, #171216); box-shadow: 0 10px 24px -12px rgba(23, 18, 22, .6); position: relative; }
.ap-subbanner__icon { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); color: #FFC2CF; }
.ap-subbanner strong { display: block; font-size: 16px; font-weight: 720; }
.ap-subbanner span { font-size: 13px; color: #C9BBC1; }
.ap-subbanner .ap-btn { position: relative; z-index: 1; margin-left: auto; min-height: 44px; background: #FFE3E9; color: #7A1830; }
.ap-subbanner a.stretch::after { content: ""; position: absolute; inset: 0; border-radius: 20px; }

/* Packages */
.ap-plans { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.ap-plan { position: relative; display: flex; align-items: center; gap: 14px; padding: 16px; background: var(--ap-surface); border-radius: 18px; box-shadow: inset 0 0 0 1.5px var(--ap-border-strong); cursor: pointer; transition: box-shadow .2s, background-color .2s; }
.ap-plan input { position: absolute; opacity: 0; pointer-events: none; }
.ap-plan:has(input:checked) { box-shadow: inset 0 0 0 2px var(--ap-primary); background: var(--ap-primary-soft); }
.ap-plan:has(input:focus-visible) { outline: 2px solid var(--ap-primary); outline-offset: 2px; }
.ap-plan__radio { flex: none; width: 22px; height: 22px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--ap-border-strong); display: grid; place-items: center; }
.ap-plan:has(input:checked) .ap-plan__radio { box-shadow: inset 0 0 0 7px var(--ap-primary); }
.ap-plan__body { flex: 1; min-width: 0; }
.ap-plan__name { font-size: 16px; font-weight: 700; }
.ap-plan__sub { font-size: 13px; color: var(--ap-text-2); }
.ap-plan__price { font-size: 18px; font-weight: 780; letter-spacing: -.02em; white-space: nowrap; }
.ap-paybar { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.ap-txn { display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px; }
.ap-txn + .ap-txn { box-shadow: inset 0 1px 0 var(--ap-border); }
.ap-txn__main { flex: 1; min-width: 0; }
.ap-txn__title { font-size: 15px; font-weight: 620; }
.ap-txn__sub { font-size: 12.5px; color: var(--ap-text-2); }
.ap-txn__amt { text-align: right; font-size: 15px; font-weight: 700; }
.ap-txn__amt small { display: block; font-size: 12px; font-weight: 600; }
.ap-txn__amt .ok { color: var(--ap-success); } .ap-txn__amt .bad { color: var(--ap-error); } .ap-txn__amt .wait { color: var(--ap-warn); }

/* ---------- 18. Reader ---------- */
html.ap-reading, html.ap-reading body { background: var(--ap-bg); }
.ap-rprogress { position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 70; background: transparent; pointer-events: none; }
.ap-rprogress span { display: block; height: 100%; width: var(--p, 0%); background: var(--ap-primary); transition: width .12s linear; border-radius: 0 3px 3px 0; }
.ap-rtop, .ap-rbar { position: fixed; left: 50%; width: min(100%, var(--ap-max)); z-index: 60; background: var(--ap-bar-bg); -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px); transition: transform .3s var(--ap-ease), opacity .3s; }
.ap-rtop { top: 0; transform: translateX(-50%); display: flex; align-items: center; gap: 2px; padding: var(--ap-safe-t) 8px 0; min-height: calc(56px + var(--ap-safe-t)); border-bottom: 1px solid var(--ap-border); }
.ap-rtop__t { flex: 1; min-width: 0; line-height: 1.2; }
.ap-rtop__t small { display: block; font-size: 12px; color: var(--ap-text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-rtop__t strong { display: block; font-size: 15px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ap-rbar { bottom: 0; transform: translateX(-50%); display: grid; grid-template-columns: repeat(4, 1fr); padding: 4px 6px calc(4px + var(--ap-safe-b)); border-top: 1px solid var(--ap-border); }
.ap-rbtn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; background: none; border: 0; color: var(--ap-text); font-size: 11.5px; font-weight: 600; cursor: pointer; border-radius: 12px; }
.ap-rbtn .ap-i { width: 22px; height: 22px; }
.ap-rbtn.is-disabled { opacity: .35; pointer-events: none; }
.ap-rtop.is-hidden { transform: translate(-50%, -100%); }
.ap-rbar.is-hidden { transform: translate(-50%, 100%); }
.ap-reader-wrap { max-width: var(--ap-max); margin: 0 auto; min-height: 100vh; background: var(--ap-bg); }
.ap-read {
    --rd-font: var(--ap-font); --rd-size: 18px; --rd-lh: 1.8;
    max-width: 38rem; margin: 0 auto;
    padding: calc(var(--ap-safe-t) + 84px) 22px calc(150px + var(--ap-safe-b));
    color: var(--ap-text);
}
.ap-read[data-font="serif"] { --rd-font: var(--ap-serif); }
.ap-read[data-font="georgia"] { --rd-font: Georgia, "Times New Roman", serif; }
.ap-read__head { margin-bottom: 26px; }
.ap-read__novel { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; font-weight: 600; color: var(--ap-accent-text); }
.ap-read__title { font-size: 27px; font-weight: 800; letter-spacing: -.03em; line-height: 1.15; text-wrap: balance; }
.ap-read__meta { margin-top: 8px; font-size: 13px; color: var(--ap-text-2); }
.ap-read__body { font-family: var(--rd-font); font-size: var(--rd-size); line-height: var(--rd-lh); word-break: break-word; hyphens: auto; -webkit-hyphens: auto; }
.ap-read__body p { margin: 0 0 1.15em; }
.ap-read__body h1, .ap-read__body h2, .ap-read__body h3 { font-family: var(--rd-font); margin: 1.6em 0 .7em; line-height: 1.3; }
.ap-read__body h2 { font-size: 1.25em; } .ap-read__body h3 { font-size: 1.1em; }
.ap-read__body img { max-width: 100%; height: auto; border-radius: 10px; display: block; margin: 1.2em auto; }
.ap-read__body blockquote { margin: 1.2em 0; padding-left: 1em; border-left: 3px solid var(--ap-primary); color: var(--ap-text-2); }
.ap-read__body hr { border: 0; text-align: center; margin: 2em 0; }
.ap-read__body hr::before { content: "· · ·"; color: var(--ap-text-2); letter-spacing: .5em; }
.ap-read__body a { color: var(--ap-accent-text); text-decoration: underline; }
.ap-read__end { margin-top: 44px; padding-top: 26px; border-top: 1px solid var(--ap-border); display: flex; flex-direction: column; gap: 14px; font-family: var(--ap-font); }
.ap-read__acts { display: flex; gap: 10px; }
.ap-read__acts .ap-action { min-height: 48px; }
.ap-read__nav { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ap-read__nav .ap-btn { min-height: 54px; }
.ap-read__done { text-align: center; color: var(--ap-text-2); font-size: 14px; padding: 8px 0; }
.ap-adslot { margin: 1.6em 0; text-align: center; overflow: hidden; }

.ap-swatches { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ap-swatch { display: flex; flex-direction: column; align-items: center; gap: 8px; min-height: 80px; padding: 8px 0 4px; background: none; border: 0; color: var(--ap-text); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.ap-swatch i { width: 48px; height: 48px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(128, 128, 128, .4); display: grid; place-items: center; font-style: normal; font-weight: 800; font-size: 17px; transition: transform .3s var(--ap-spring); }
.ap-swatch.is-active i { box-shadow: 0 0 0 2px var(--ap-surface), 0 0 0 4px var(--ap-primary); transform: scale(1.05); }
.ap-swatch.is-active i::after { content: "\2713"; font-weight: 900; font-size: 22px; line-height: 1; }     /* tick in the theme's own text colour */
.ap-setrow { padding: 12px 0; }
.ap-setrow + .ap-setrow { border-top: 1px solid var(--ap-border); }
.ap-setrow > label, .ap-setrow > .lbl { display: flex; justify-content: space-between; font-size: 14px; font-weight: 650; margin-bottom: 10px; }
.ap-stepper { display: flex; align-items: center; gap: 14px; }
.ap-stepper button { flex: none; width: 48px; height: 48px; border-radius: 14px; border: 0; background: var(--ap-surface-2); color: var(--ap-text); font-weight: 700; cursor: pointer; }
.ap-stepper .sm { font-size: 14px; } .ap-stepper .lg { font-size: 22px; }
.ap-range { flex: 1; -webkit-appearance: none; appearance: none; height: 30px; background: transparent; }
.ap-range::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--ap-surface-3); }
.ap-range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%; background: var(--ap-surface); box-shadow: 0 1px 4px rgba(0, 0, 0, .35), 0 0 0 1px var(--ap-border-strong); border: 0; }
.ap-range::-moz-range-track { height: 6px; border-radius: 3px; background: var(--ap-surface-3); }
.ap-range::-moz-range-thumb { width: 28px; height: 28px; border-radius: 50%; background: var(--ap-surface); border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .35); }
.ap-preview-sample { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--ap-surface-2); font-size: var(--rd-size, 18px); line-height: var(--rd-lh, 1.8); font-family: var(--rd-font, var(--ap-font)); }

/* Locked chapter */
.ap-preview { -webkit-mask-image: linear-gradient(#000 45%, transparent 100%); mask-image: linear-gradient(#000 45%, transparent 100%); padding-bottom: 20px; }
.ap-lock { position: relative; margin-top: -8px; padding: 26px 20px 20px; border-radius: 24px; background: var(--ap-surface); box-shadow: var(--ap-shadow-2), inset 0 0 0 1px var(--ap-border); text-align: center; font-family: var(--ap-font); }
.ap-lock__icon { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%; display: grid; place-items: center; background: var(--ap-primary-soft); color: var(--ap-primary); }
.ap-lock__icon .ap-i { width: 28px; height: 28px; }
.ap-lock h2 { font-size: 21px; font-weight: 780; letter-spacing: -.02em; }
.ap-lock p { margin: 6px 0 0; font-size: 15px; color: var(--ap-text-2); }
.ap-lock form { margin: 18px 0 0; }

/* ---------- 19. Auth ---------- */
.ap-auth { padding: calc(var(--ap-safe-t) + 16px) 22px 40px; }
.ap-auth__brand { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 20px 0 22px; gap: 6px; }
.ap-auth__logo { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: linear-gradient(145deg, var(--ap-primary), #B92F4E); color: #fff; box-shadow: 0 12px 24px -10px rgba(209, 56, 90, .6); margin-bottom: 8px; }
.ap-auth__logo img { max-width: 40px; max-height: 40px; }
.ap-auth__logo .ap-i { width: 32px; height: 32px; }
.ap-auth__brand h1 { font-size: 28px; font-weight: 800; letter-spacing: -.03em; }
.ap-auth__brand p { margin: 0; color: var(--ap-text-2); font-size: 15px; }
.ap-auth__foot { text-align: center; margin-top: 22px; font-size: 14px; color: var(--ap-text-2); }
.ap-auth__foot a { color: var(--ap-accent-text); font-weight: 650; display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; }
.ap-auth .form-card { background: transparent !important; border: 0 !important; box-shadow: none !important; padding: 0 !important; max-width: none !important; margin: 0 !important; }
.ap-auth .form-card > h1 { display: none; }
.ap-auth .form-group { margin: 0 0 14px; }
.ap-auth .form-group label { display: block; margin: 0 0 6px 2px; font-size: 13px; font-weight: 650; color: var(--ap-text-2); text-transform: none; letter-spacing: 0; }
.ap-auth .btn, .ap-auth button[type=submit].btn { display: flex; width: 100%; min-height: 52px; justify-content: center; align-items: center; }

.ap-reset-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 16px; padding: 13px; border: 1.5px solid var(--ap-border-strong); border-radius: 14px; background: none; color: var(--ap-text-2); font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer; }
.ap-reset-btn:hover { background: var(--ap-surface-2); color: var(--ap-text); }
.ap-reset-btn .ap-i { width: 17px; height: 17px; }

/* Admin's "Reader Message" (Admin -> Reader Message) — shown at the end of a novel's latest chapter only, right
   after "Back to novel". Off by default; see chapter.php. */
.ap-read__msg { background: var(--ap-surface-2); border-radius: 16px; padding: 18px 20px; }
.ap-read__msg img { max-width: 100%; height: auto; border-radius: 8px; }
.ap-read__msg table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 10px 0; }
.ap-read__msg table, .ap-read__msg th, .ap-read__msg td { border: 1px solid var(--ap-border); }
.ap-read__msg th, .ap-read__msg td { padding: 6px 10px; text-align: left; }
.ap-read__msg table { display: block; overflow-x: auto; }
