/* =====================================================================
   Desktop layer — loaded only at >= 1024px (media attribute on the <link>).
   Phones and tablets never apply any rule in this file.
   ===================================================================== */

:root { --ap-max: 1240px; --ap-dh: 68px; }
html { background: var(--ap-bg); }
body.ap { background: var(--ap-bg); font-size: 16px; }

/* ---------- Frame ---------- */
.ap-shell { max-width: none; box-shadow: none !important; }
.ap-main { max-width: 1240px; margin: 0 auto; padding: 8px 16px 72px !important; min-height: 62vh; }
.ap-main.ap-narrow { max-width: 840px; }
.ap-main.ap-narrow-lg { max-width: 1040px; }
.ap-dwrap { max-width: 1240px; margin: 0 auto; padding: 0 32px; }

/* Phone-only chrome is hidden */
.ap-tabbar, .ap-legal, .ap-m-only, .ap-home-head, .ap-cta { display: none !important; }

/* ---------- Header ---------- */
.ap-dhead {
    display: block; position: sticky; top: 0; z-index: 60;
    background: var(--ap-bar-bg);
    -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
    border-bottom: 1px solid var(--ap-border);
    transition: box-shadow .2s;
}
.ap-dhead.is-scrolled { box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .35); }
.ap-dhead .ap-dwrap { height: var(--ap-dh); display: flex; align-items: center; gap: 20px; max-width: 1320px; }      /* a little wider than the page column so the header row always fits on one line */

.ap-dbrand { display: inline-flex; align-items: center; gap: 10px; flex: none; font-size: 20px; font-weight: 800; letter-spacing: -.03em; color: var(--ap-text); }
.ap-dbrand img { max-height: 34px; width: auto; display: block; }
.ap-dbrand__mark { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, var(--ap-primary), #B92F4E); box-shadow: 0 8px 18px -8px rgba(209, 56, 90, .6); }
.ap-dbrand__mark .ap-i { width: 20px; height: 20px; }

.ap-dnav { display: flex; align-items: center; gap: 2px; }
.ap-dnav__link {
    display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0 12px; border-radius: 999px;
    font: inherit; font-size: 15px; font-weight: 650; color: var(--ap-text-2); background: none; border: 0; cursor: pointer;
    transition: background-color .15s, color .15s;
}
.ap-dnav__link:hover { background: var(--ap-surface-2); color: var(--ap-text); }
.ap-dnav__link.is-active { background: var(--ap-primary-soft); color: var(--ap-accent-text); }
.ap-dnav__link .ap-i { width: 16px; height: 16px; transition: transform .2s; }
.ap-dmenu.is-open .ap-dmenu__btn .ap-i { transform: rotate(180deg); }

.ap-dmenu { position: relative; }
.ap-dmenu__panel {
    position: absolute; top: calc(100% + 12px); left: 0; min-width: 230px; padding: 8px;
    background: var(--ap-surface); border-radius: 18px;
    box-shadow: var(--ap-shadow-2), inset 0 0 0 1px var(--ap-border);
    opacity: 0; visibility: hidden; transform: translateY(-6px);
    transition: opacity .16s, transform .16s, visibility .16s;
}
.ap-dmenu.is-open .ap-dmenu__panel { opacity: 1; visibility: visible; transform: none; }
.ap-dmenu__panel--wide { width: 440px; }
.ap-dmenu__panel--right { left: auto; right: 0; }
.ap-dmenu__panel a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: 14.5px; font-weight: 600; color: var(--ap-text); }
.ap-dmenu__panel a:hover, .ap-dmenu__panel a:focus-visible { background: var(--ap-surface-2); }
.ap-dmenu__panel a .ap-i { width: 18px; height: 18px; color: var(--ap-text-2); }
.ap-dmenu__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.ap-dmenu__all { justify-content: space-between; margin-bottom: 6px; box-shadow: inset 0 -1px 0 var(--ap-border); border-radius: 10px 10px 0 0 !important; color: var(--ap-accent-text) !important; }
.ap-dmenu__who { padding: 10px 12px 12px; margin-bottom: 4px; box-shadow: inset 0 -1px 0 var(--ap-border); display: flex; flex-direction: column; }
.ap-dmenu__who strong { font-size: 15px; }
.ap-dmenu__who span { font-size: 13px; color: var(--ap-text-2); }
.ap-dmenu__out { margin-top: 4px; color: var(--ap-error) !important; }

.ap-dsearch {
    position: relative; flex: 1 1 0; min-width: 0; max-width: 420px; margin-left: auto; height: 44px; padding: 0 16px;
    display: flex; align-items: center; gap: 10px;
    background: var(--ap-surface-2); border-radius: 999px; color: var(--ap-text-2);
    transition: box-shadow .15s, background-color .15s;
}
.ap-dsearch:focus-within { background: var(--ap-surface); box-shadow: inset 0 0 0 2px var(--ap-primary); }
.ap-dsearch > .ap-i { width: 20px; height: 20px; }
.ap .ap-dsearch input {
    flex: 1 1 0; width: 0; min-width: 0; height: 100%; min-height: 0 !important; padding: 0 !important;
    border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important;
    font: inherit; font-size: 15px; color: var(--ap-text); outline: none;
}
.ap-dsearch__pop {
    position: absolute; top: calc(100% + 12px); left: -24px; right: -24px; padding: 8px; z-index: 70;
    background: var(--ap-surface); border-radius: 20px; box-shadow: var(--ap-shadow-2), inset 0 0 0 1px var(--ap-border);
}
.ap-dsearch__pop[hidden] { display: none; }
.ap-dsearch__item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 12px; color: var(--ap-text); }
.ap-dsearch__item:hover { background: var(--ap-surface-2); }
.ap-dsearch__cover { flex: none; width: 40px; height: 60px; border-radius: 6px; overflow: hidden; background: var(--ap-surface-3); }
.ap-dsearch__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-dsearch__item strong { display: block; font-size: 14.5px; font-weight: 650; line-height: 1.25; }
.ap-dsearch__item small { display: block; font-size: 12.5px; color: var(--ap-text-2); }
.ap-dsearch__all { display: block; margin-top: 4px; padding: 12px; text-align: center; border-radius: 12px; font-size: 14px; font-weight: 700; color: var(--ap-accent-text); box-shadow: inset 0 1px 0 var(--ap-border); }
.ap-dsearch__all:hover { background: var(--ap-surface-2); }
.ap-dsearch__none { margin: 0; padding: 16px; text-align: center; font-size: 14px; color: var(--ap-text-2); }
body:has(#s-q) .ap-dsearch { visibility: hidden; }

.ap-dtools { display: flex; align-items: center; gap: 10px; flex: none; }
.ap-dbtn { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; background: none; border: 0; color: var(--ap-text); cursor: pointer; transition: background-color .15s; }
.ap-dbtn:hover { background: var(--ap-surface-2); }
.ap-dbtn--txt { width: auto; height: 40px; padding: 0 14px 0 10px; display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; font: inherit; font-size: 13px; font-weight: 600; color: var(--ap-text-2); }
.ap-dbtn--txt .ap-i { width: 18px; height: 18px; }
.ap-dt-moon, .ap-dt-sun { display: grid; place-items: center; }
.ap-dt-sun { display: none; }
:root[data-theme="dark"] .ap-dt-moon { display: none; }
:root[data-theme="dark"] .ap-dt-sun { display: grid; }
.ap-davatar { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; overflow: hidden; cursor: pointer; background: var(--ap-surface-2); box-shadow: 0 0 0 2px var(--ap-border); transition: box-shadow .15s; }
.ap-davatar:hover, .ap-dmenu.is-open .ap-davatar { box-shadow: 0 0 0 2px var(--ap-primary); }
.ap-davatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ap-dtools .ap-btn { min-height: 44px; }

/* ---------- Footer ---------- */
.ap-dfoot { display: block; margin-top: 24px; padding: 60px 0 30px; background: var(--ap-surface); border-top: 1px solid var(--ap-border); }
.ap-dfoot__grid { display: grid; grid-template-columns: 1.7fr 1fr 1fr 1fr; gap: 56px; }
.ap-dfoot__brand p { margin: 16px 0 0; max-width: 320px; font-size: 14.5px; line-height: 1.65; color: var(--ap-text-2); }
.ap-dfoot nav { display: flex; flex-direction: column; gap: 2px; }
.ap-dfoot nav h2 { margin-bottom: 12px; font-size: 14px; font-weight: 700; color: var(--ap-text); }
.ap-dfoot nav a { padding: 5px 0; font-size: 14.5px; font-weight: 520; color: var(--ap-text-2); transition: color .15s; }
.ap-dfoot nav a:hover { color: var(--ap-accent-text); }
.ap-dfoot__bar { display: flex; align-items: center; justify-content: space-between; margin-top: 48px; padding-top: 22px; border-top: 1px solid var(--ap-border); font-size: 13px; color: var(--ap-text-2); }
.ap-dfoot__bar p { margin: 0; }

/* ---------- Page headings (mobile top bar → page title) ---------- */
.ap-topbar { position: static; min-height: 0; padding: 36px 16px 8px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; border: 0; }
.ap-topbar > .ap-iconbtn, .ap-topbar__spacer { display: none; }
.ap-topbar__title { flex: none; text-align: left; padding: 0; font-size: 34px; font-weight: 800; letter-spacing: -.035em; }
.ap-topbar__actions { margin-left: auto; }
.ap-topbar.is-transparent { display: none; }
.ap-shell > .ap-topbar { max-width: 1240px; margin: 0 auto; }
.ap-shell:has(.ap-main.ap-narrow) > .ap-topbar { max-width: 840px; }
.ap-shell:has(.ap-main.ap-narrow-lg) > .ap-topbar { max-width: 1040px; }

/* ---------- Sections, chips ---------- */
.ap-section { margin-top: 52px; }
.ap-section__head { padding: 0 16px; min-height: 48px; }
.ap-h2 { font-size: 24px; letter-spacing: -.025em; }
.ap-more { font-size: 15px; }
.ap-chips { flex-wrap: nowrap; overflow-x: auto; padding: 20px 16px 6px; gap: 8px; -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.ap-chip { flex: none; }
.ap-chips--sticky { position: static; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.ap-chip { height: 40px; padding: 0 16px; font-size: 14.5px; transition: background-color .15s, box-shadow .15s; }
.ap-chip:not(.is-active):hover { background: var(--ap-surface-2); }
.ap-libhead { top: var(--ap-dh); padding-top: 8px; }
.ap-libhead .ap-tabs { padding: 0 16px; }
.ap-libhead .ap-tabs a { font-size: 18px; }
.ap-libhead .ap-chips { padding-top: 10px; padding-bottom: 10px; }
.ap-libhead h1 { font-size: 34px; letter-spacing: -.035em; }

/* ---------- Discover ---------- */
.ap-dhero { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 28px; align-items: start; margin-top: 12px; }
.ap-dhero__main .ap-feature { height: 100%; margin: 0; padding: 40px; gap: 36px; grid-template-columns: 220px minmax(0, 1fr); align-content: center; border-radius: 30px; }
.ap-feature__body { justify-content: center; gap: 8px; }
.ap-feature__genre { font-size: 14px; }
.ap-feature__title { font-size: 38px; }
.ap-feature__title a::after { border-radius: 30px; }
.ap-feature__author { font-size: 16px; }
.ap-feature__desc { margin-top: 6px; font-size: 16.5px; line-height: 1.6; -webkit-line-clamp: 4; }
.ap-feature .ap-btn { min-height: 54px; padding: 0 30px; margin-top: 14px; font-size: 16px; }
.ap-dside { display: block; padding: 24px 24px 12px; border-radius: 30px; background: var(--ap-surface); box-shadow: inset 0 0 0 1px var(--ap-border); }
.ap-dside .ap-h2 { font-size: 19px; margin-bottom: 4px; }
.ap-dside .ap-list, .ap-dside .ap-list.ap-pad { display: block; padding: 0; }
.ap-dside .ap-book--row { padding: 11px 0; }
.ap-dside .ap-book--row:last-child { border-bottom: 0; }
.ap-dside .ap-book__desc, .ap-dside .ap-book__tags { display: none; }
.ap-dside .ap-book--row.has-rank { grid-template-columns: 28px 52px minmax(0, 1fr); gap: 14px; align-items: center; }
.ap-dside .ap-book--row .ap-book__title { font-size: 15.5px; }

/* Rails become tidy grids */
.ap-rail { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 28px 22px; overflow: visible; padding: 12px 16px 4px; scroll-snap-type: none; }
.ap-rail > * { scroll-snap-align: none; }
.ap-rail > *:nth-child(n + 6) { display: none; }
.ap-book--rail { width: auto; }
.ap-book--rail .ap-book__title, .ap-book--grid .ap-book__title { font-size: 15.5px; }
.ap-book--rail .ap-cover, .ap-book--grid .ap-cover { transition: transform .25s var(--ap-ease), box-shadow .25s var(--ap-ease); }
.ap-book--rail:hover .ap-cover, .ap-book--grid:hover .ap-cover { transform: translateY(-6px); box-shadow: 0 3px 6px rgba(23, 23, 23, .14), 0 26px 34px -14px rgba(23, 23, 23, .5); }

/* Lists → two columns */
.ap-list, .ap-list.ap-pad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 56px; padding: 0 16px; }
.ap-list > .ap-book--row { padding: 20px 0; }
.ap-book--row { grid-template-columns: 104px minmax(0, 1fr); gap: 22px; }
.ap-book--row.has-rank { grid-template-columns: 40px 96px minmax(0, 1fr); gap: 18px; }
.ap-book--row .ap-book__title { font-size: 18px; transition: color .15s; }
.ap-book--row:hover .ap-book__title { color: var(--ap-accent-text); }
.ap-book--row .ap-cover { transition: transform .25s var(--ap-ease); }
.ap-book--row:hover .ap-cover { transform: translateY(-3px); }
.ap-book__desc { font-size: 14.5px; -webkit-line-clamp: 3; }
.ap-rank { font-size: 26px; }
.ap-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 34px 24px; padding: 16px 16px 0; }
.ap-shelves { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 56px; }
.ap-shelf { grid-template-columns: 100px minmax(0, 1fr); gap: 20px; padding: 20px 0; }
.ap-shelf__title { font-size: 18px; }

@media (min-width: 1280px) {
    .ap-rail { grid-template-columns: repeat(6, minmax(0, 1fr)); }
    .ap-rail > *:nth-child(n + 6) { display: block; }
    .ap-rail > *:nth-child(n + 7) { display: none; }
    .ap-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* ---------- Search page ---------- */
.ap-searchhead { position: static; max-width: 760px; margin: 36px auto 4px; padding: 0 16px; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.ap-searchhead > a.ap-iconbtn { display: none; }
.ap-searchhead .ap-search { min-height: 58px; border-radius: 999px; font-size: 17px; padding: 0 22px; }
#s-idle > .ap-pad, #s-results { max-width: none; }
.ap-suggest { padding-left: 0; padding-right: 0; }

/* ---------- Novel detail ---------- */
.ap-main--cta { padding-bottom: 72px !important; }
.ap-nv { display: grid; grid-template-columns: minmax(0, 1fr) 360px; column-gap: 56px; align-items: start; }
.ap-nv > * { grid-column: 1; min-width: 0; }
.ap-nv > .ap-hero { grid-column: 1 / -1; }
.ap-nv > .ap-nv-side { grid-column: 2; grid-row: 2 / span 30; position: sticky; top: calc(var(--ap-dh) + 20px); }
.ap-nv > .ap-hero {
    display: grid; grid-template-columns: 236px minmax(0, 1fr); column-gap: 48px; align-content: center; align-items: center;
    margin: 20px 16px 28px; padding: 48px 52px; min-height: 360px; border-radius: 32px; text-align: left;
    box-shadow: inset 0 0 0 1px var(--ap-border);
}
.ap-hero::after { background: linear-gradient(90deg, color-mix(in srgb, var(--ap-bg) 90%, transparent), color-mix(in srgb, var(--ap-bg) 58%, transparent)); }
.ap-hero .ap-cover { grid-column: 1; grid-row: 1 / span 6; width: 236px; margin: 0; }
.ap-hero > :not(.ap-cover):not(.ap-hero__bg) { grid-column: 2; }
.ap-hero__title { margin-top: 0; font-size: 44px; line-height: 1.07; text-align: left; text-wrap: balance; }
.ap-hero__author { min-height: 0; margin-top: 10px; font-size: 18px; }
.ap-hero__facts { justify-content: flex-start; margin-top: 8px; font-size: 14px; }
.ap-hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.ap-hero__cta .ap-btn { min-height: 54px; padding: 0 26px; font-size: 16px; }
.ap-hero__cta .ap-btn.is-on { background: var(--ap-primary-soft); color: var(--ap-accent-text); }
.ap-nv-side .ap-section { margin-top: 28px; }
.ap-nv-side > .ap-section:first-child { margin-top: 0; }
.ap-nv-side .ap-card, .ap-nv-side .ap-row.ap-card { margin-left: 0; margin-right: 0; }
.ap-nv-side .ap-section__head { padding: 0; }
.ap-nv-side .ap-pad { padding-left: 0; padding-right: 0; }
.ap-nv-side .ap-h2 { font-size: 19px; }
.ap-nv-side .ap-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 14px; padding: 8px 0 0; }
.ap-nv-side .ap-rail > *:nth-child(-n + 6) { display: block; }
.ap-nv-side .ap-rail > *:nth-child(n + 7) { display: none; }
.ap-nv-side .ap-book--rail .ap-book__title { font-size: 13.5px; }
.ap-nv-side .ap-meta { display: none; }
#comments-sec { margin-top: 44px; }

/* ---------- Reader ---------- */
body.ap-reading .ap-main { max-width: none; padding: 0 !important; }
body.ap-reading .ap-dhead { position: relative; }
.ap-reader-wrap { max-width: none; min-height: 0; background: var(--ap-bg); }
.ap-rtop { position: sticky; top: 0; left: auto; width: 100%; transform: none; min-height: 64px; padding: 0 max(24px, calc((100% - 1240px) / 2 + 24px)); z-index: 55; }
.ap-rtop.is-hidden { transform: translateY(-100%); }
.ap-rtop__t small { font-size: 13px; }
.ap-rtop__t strong { font-size: 16px; }
.ap-read { max-width: 47rem; padding: 52px 24px 240px; }
.ap-read__novel { font-size: 15px; }
.ap-read__title { font-size: 38px; }
.ap-read__end { margin-top: 56px; }
body.ap .ap-reader-wrap .ap-read { padding-bottom: 240px; }
.ap-rbar, body.ap .ap-rbar { bottom: 26px; left: 50%; width: min(540px, calc(100% - 48px)); padding: 6px 8px; border: 0; border-radius: 24px; box-shadow: var(--ap-shadow-2), inset 0 0 0 1px var(--ap-border); }
.ap-rbar.is-hidden, body.ap .ap-rbar.is-hidden { transform: translate(-50%, 180%); }
.ap-rbtn { border-radius: 16px; transition: background-color .15s; }
.ap-rbtn:hover { background: var(--ap-surface-2); }

/* ---------- Bottom sheets → centred dialogs ---------- */
.ap-sheet { align-items: center; padding: 24px; }
.ap-sheet__panel {
    width: min(560px, 100%); max-height: min(82vh, 780px); padding-bottom: 0; border-radius: 26px;
    box-shadow: 0 34px 90px -24px rgba(0, 0, 0, .55), inset 0 0 0 1px var(--ap-border);
    transform: translateY(18px) scale(.97); opacity: 0;
    transition: transform .3s var(--ap-ease), opacity .24s ease;
}
.ap-sheet.is-open .ap-sheet__panel { transform: none; opacity: 1; }
.ap-sheet__grab { display: none; }
.ap-sheet__head { padding: 14px 12px 8px 26px; }
.ap-sheet__body { padding: 6px 26px 26px; }
.ap-sheet--tall .ap-sheet__panel { height: min(80vh, 720px); }
.ap-sheet--tall .ap-sheet__body { padding-left: 0; padding-right: 0; padding-bottom: 0; }
.ap .modal-overlay { align-items: center; padding: 24px; }
.ap .modal-box { max-width: 520px !important; max-height: 82vh; border-radius: 26px; }
.ap .modal-box::before { display: none; }

/* ---------- Floating bits ---------- */
.ap-resume { left: auto; right: 32px; bottom: 32px; transform: none; width: 420px; z-index: 55; animation: ap-rise-d .45s var(--ap-ease) both; }
@keyframes ap-rise-d { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.ap-toasts { bottom: 32px !important; width: min(100%, 640px); }

/* ---------- Wallet ---------- */
.ap .price-list.ap-plans { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.ap .price-list-row.ap-plan { flex-direction: column; align-items: flex-start; gap: 12px; padding: 24px; }
.ap .price-list-row.ap-plan .ap-plan__price { font-size: 26px; }
.ap .pay-btn { position: static; display: block; width: min(420px, 100%); margin: 28px auto 0; box-shadow: 0 12px 28px -12px rgba(209, 56, 90, .6); }
.ap-wallet { margin-left: 0; margin-right: 0; }
.ap-padded .ap-wallet, .ap-padded .ap-notice { margin-left: 0; margin-right: 0; }

/* ---------- Account, auth, misc ---------- */
.ap-me { padding-top: 28px; }
.ap-me__name { font-size: 28px; }
.ap-main.ap-auth {
    max-width: 480px; min-height: 0; margin: 56px auto 24px; padding: 44px 44px 48px !important;
    background: var(--ap-surface); border-radius: 30px; box-shadow: inset 0 0 0 1px var(--ap-border), var(--ap-shadow-2);
}
.ap-btn { transition: background-color .15s, box-shadow .15s, transform .12s; }
.ap-btn--primary:hover { filter: brightness(1.06); }
.ap-state { padding-top: 64px; }
.ap .price-list, .ap .price-list.ap-plans { max-width: none; width: 100%; }

/* ---------- Narrower desktops (1024–1199px): keep the header on one line ---------- */
.ap-dnav__link, .ap-dbrand span { white-space: nowrap; }
@media (max-width: 1199px) {
    .ap-dwrap { padding: 0 20px; }
    .ap-dhead .ap-dwrap { gap: 14px; }
    .ap-dnav__link { padding: 0 10px; font-size: 14.5px; }
    .ap-dtools { gap: 6px; }
    .ap-dtools .ap-btn { padding: 0 14px; }
    .ap-dfoot__grid { gap: 32px; }
    .ap-dhero { grid-template-columns: minmax(0, 1fr) 340px; }
    .ap-dhero__main .ap-feature { grid-template-columns: 180px minmax(0, 1fr); gap: 28px; padding: 32px; }
    .ap-feature__title { font-size: 32px; }
    .ap-nv { grid-template-columns: minmax(0, 1fr) 320px; column-gap: 40px; }
}
.ap-chips::after, .ap-tabs::after { display: none; }

/* Footer: "Help & pages" gets its own column */
.ap-dfoot__grid.has-pages { grid-template-columns: 1.9fr .9fr .9fr .9fr 1.4fr; gap: 40px; }
.ap-dfoot__pages > div { display: flex; flex-direction: column; gap: 2px; }
.ap-dfoot__pages.is-split > div { display: block; column-count: 2; column-gap: 24px; }
.ap-dfoot__pages.is-split > div a { display: block; break-inside: avoid; }
@media (max-width: 1199px) { .ap-dfoot__grid.has-pages { grid-template-columns: 1.8fr 1fr 1fr 1fr 1.5fr; gap: 24px; } .ap-dfoot .ap-social { gap: 8px; } .ap-dfoot .ap-social__btn { width: 40px; height: 40px; } }

/* ---------- Install, follow, support (desktop) ---------- */
.ap-dbtn--install { width: auto; padding: 0 14px 0 10px; display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; font-size: 14px; font-weight: 650; box-shadow: inset 0 0 0 1px var(--ap-border-strong); }
.ap-dbtn--install .ap-i { width: 18px; height: 18px; }
/* The header's Install button is icon-only at every width so the header always fits on one line (the tooltip / label still says "Install app"). */
.ap-dbtn--install span { display: none; } .ap-dbtn--install { width: 44px; padding: 0; justify-content: center; }
.ap-dfoot__install { margin-top: 18px; }
.ap-dfoot .ap-social { margin-top: 18px; }
.ap-dfoot__contact { margin-top: 24px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.ap-dfoot__contact h2 { font-size: 14px; font-weight: 700; margin: 0; }
.ap-dfoot__mail { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; font-weight: 550; color: var(--ap-text-2); }
.ap-dfoot__mail .ap-i { width: 18px; height: 18px; }
.ap-dfoot__mail:hover { color: var(--ap-accent-text); }
.ap-wafab {
    display: inline-flex; align-items: center; gap: 0; position: fixed; left: 28px; bottom: 28px; z-index: 55;
    height: 58px; min-width: 58px; padding: 0 17px; border-radius: 999px; background: #25D366; color: #fff;
    box-shadow: 0 16px 32px -12px rgba(18, 140, 74, .7), 0 2px 6px rgba(0, 0, 0, .12); overflow: hidden;
    transition: gap .2s var(--ap-ease), padding .2s var(--ap-ease), transform .2s var(--ap-ease);
}
.ap-wafab .ap-i { width: 24px; height: 24px; flex: none; }
.ap-wafab span { max-width: 0; overflow: hidden; white-space: nowrap; font-size: 15px; font-weight: 700; opacity: 0; transition: max-width .25s var(--ap-ease), opacity .2s; }
.ap-wafab:hover, .ap-wafab:focus-visible { gap: 10px; padding-right: 22px; transform: translateY(-2px); }
.ap-wafab:hover span, .ap-wafab:focus-visible span { max-width: 230px; opacity: 1; }
body.ap-reading .ap-wafab { bottom: 96px; }

/* ---------- Newly added: full 2 × 10 grid ---------- */
.ap-newgrid { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: repeat(10, minmax(0, 1fr)); grid-auto-columns: auto; overflow: visible; gap: 24px 14px; padding: 12px 16px 4px; }
.ap-book--mini .ap-book__title { font-size: 13.5px; }
.ap-book--mini .ap-cover { transition: transform .25s var(--ap-ease), box-shadow .25s var(--ap-ease); }
.ap-book--mini:hover .ap-cover { transform: translateY(-5px); box-shadow: 0 3px 6px rgba(23, 23, 23, .14), 0 22px 30px -14px rgba(23, 23, 23, .5); }
@media (max-width: 1199px) { .ap-newgrid { gap: 20px 10px; } .ap-book--mini .ap-book__title { font-size: 12.5px; } }
.ap-list > .ap-sentinel { grid-column: 1 / -1; }

/* ---------- Library (desktop) ---------- */
.ap-libhead .ap-libbar { padding-right: 16px; }
.ap-libitems[data-view="list"] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 56px; margin-left: 0; margin-right: 0; }
.ap-libitems[data-view="list"] .ap-libitem__row { padding: 20px 0; grid-template-columns: 100px minmax(0, 1fr); gap: 20px; }
.ap-libitem__title { font-size: 18px; }
.ap-libitems[data-view="list"] .ap-libitem__x { top: 16px; right: 0; }
.ap-libitems[data-view="grid"] { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 30px 22px; }
.ap-libitems[data-view="grid"] .ap-libitem__title { font-size: 14px; }
.ap-libitems[data-view="grid"] .ap-libitem__cover .ap-cover { transition: transform .25s var(--ap-ease), box-shadow .25s var(--ap-ease); }
.ap-libitems[data-view="grid"] .ap-libitem:hover .ap-libitem__cover .ap-cover { transform: translateY(-5px); box-shadow: 0 3px 6px rgba(23, 23, 23, .14), 0 22px 30px -14px rgba(23, 23, 23, .5); }
.ap-libhint { display: none !important; }
.ap-snack { margin-left: 0; }
@media (min-width: 1280px) { .ap-libitems[data-view="grid"] { grid-template-columns: repeat(6, minmax(0, 1fr)); } }

/* Inbox bell in the header */
.ap-dbtn--bell { position: relative; }
.ap-dbell__badge { position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; display: grid; place-items: center; background: var(--ap-cta); color: var(--ap-on-cta, #fff); font-size: 11px; font-weight: 800; font-style: normal; line-height: 1; box-shadow: 0 0 0 2px var(--ap-bg); }
.ap-dmenu__count { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--ap-cta); color: var(--ap-on-cta, #fff); font-size: 11.5px; font-weight: 800; text-align: center; }

/* Videos (desktop) */
.ap-vgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 22px; }
.ap-vp__frame { border-radius: 18px; }
.ap-watch__info { padding-top: 22px; }
.ap-watch__info h1 { font-size: 28px; }

.ap-vrail { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 22px; overflow: visible; padding: 8px 0 0; }
.ap-vrail .ap-vcard { max-width: none; }

.ap-ract { margin-bottom: 16px; }

.ap-dmenu__panel a.ap-dmenu__dash { color: var(--ap-accent-text); font-weight: 700; }
.ap-dmenu__panel a.ap-dmenu__dash .ap-i { color: var(--ap-accent-text); }

.ap-libitem--reel .ap-libitem__row { grid-template-columns: 190px minmax(0, 1fr); }
.ap-libitems[data-view="grid"] .ap-libitem--reel .ap-libitem__row { display: block; }

@media (max-width: 1099px) { .ap-dhead .ap-dwrap { gap: 10px; } .ap-dnav__link { padding: 0 8px; } .ap-dbrand { font-size: 18px; } .ap-dtools .ap-btn { padding: 0 12px; } }

/* Below 1250px the header search box becomes a round icon (tap it to open the search page) so nothing spills out of the header */
@media (max-width: 1249px) {
    .ap-dsearch { flex: none; width: 44px; min-width: 0; padding: 0; justify-content: center; margin-left: auto; cursor: pointer; }
    .ap-dsearch input, .ap-dsearch__pop { display: none !important; }
}

/* ---------- Chapter reading page (desktop only): Back to top + WhatsApp "peek" while scrolling ---------- */
.ap-backtotop {
    position: fixed; right: 28px; bottom: 28px; z-index: 55;
    width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
    background: var(--ap-surface); color: var(--ap-text); border: 1px solid var(--ap-border-strong);
    box-shadow: var(--ap-shadow-2); cursor: pointer;
    opacity: 0; transform: translateY(10px) scale(.92); pointer-events: none;
    transition: opacity .2s var(--ap-ease), transform .25s var(--ap-ease), background .15s;
}
.ap-backtotop:not([hidden]) { opacity: 1; transform: none; pointer-events: auto; }
.ap-backtotop:hover { background: var(--ap-surface-2); }
.ap-backtotop .ap-i { width: 22px; height: 22px; }
body.ap-reading .ap-backtotop { bottom: 96px; }              /* clears the reader's own bottom bar */

/* WhatsApp button "peek": mostly off-screen to the left while the reader scrolls through the chapter, leaving a
   small sliver visible/clickable; hovering (or scrolling back near the top) brings it fully back into view. */
body.ap-reading .ap-wafab.is-peek { transform: translateX(calc(-100% + 18px)); }
body.ap-reading .ap-wafab.is-peek:hover,
body.ap-reading .ap-wafab.is-peek:focus-visible { transform: translateX(0); }

/* ---------- Novel page: "Read a sample" chapter-1 teaser — desktop only, guests only (see novel.php) ---------- */
.ap-sample1 { display: block; margin-top: 22px; }
.ap-sample1 .ap-h3 { margin-bottom: 12px; }
.ap-sample1__box { position: relative; max-height: 480px; overflow: hidden; border-radius: 16px; background: var(--ap-surface); border: 1px solid var(--ap-border); padding: 22px 26px; }
.ap-sample1__box.is-expanded { max-height: none; overflow: visible; }
.ap-sample1__text, .ap-sample1__rest { font-size: 16px; line-height: 1.8; }
.ap-sample1__text p, .ap-sample1__rest p { margin: 0 0 16px; }
.ap-sample1__rest { margin-top: 16px; }
.ap-sample1__fade { position: absolute; left: 0; right: 0; bottom: 0; height: 130px; background: linear-gradient(180deg, transparent, var(--ap-surface) 88%); pointer-events: none; border-radius: 0 0 16px 16px; }
.ap-sample1__box.is-expanded .ap-sample1__fade { display: none; }
#sample1-btn { max-width: 340px; margin: 16px auto 0; }
#sample1-btn.is-done { display: none; }

/* ---------- Breadcrumb trail (every reader-facing page except the chapter reader, desktop only) ---------- */
.ap-crumbs { display: block; margin: 2px 0 14px; }
.ap-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0; padding: 0; list-style: none; }
.ap-crumbs li { display: flex; align-items: center; min-width: 0; }
.ap-crumbs a, .ap-crumbs span { font-size: 13.5px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.ap-crumbs a { color: var(--ap-text-2); text-decoration: none; }
.ap-crumbs a:hover { color: var(--ap-text); text-decoration: underline; }
.ap-crumbs span[aria-current] { color: var(--ap-text); font-weight: 650; }
.ap-crumbs__sep { color: var(--ap-text-3, var(--ap-text-2)); opacity: .55; }
.ap-crumbs__sep .ap-i { width: 13px; height: 13px; }

/* ---------- Text-to-Speech player (desktop): a floating card in the bottom-right corner, clear of the text column ---------- */
.ap-tts, body.ap-notabs:not(.has-tabbar) .ap-tts, .ap-tts.is-low, body.ap-notabs:not(.has-tabbar) .ap-tts.is-low { left: auto; right: 20px; bottom: 28px; transform: none; width: 300px; }
.ap-tts.is-min { right: 20px; width: auto; }
.ap-tts__btn { width: 40px; height: 40px; }
.ap-tts__btn--play { width: 48px; height: 48px; }
.ap-tts__main { gap: 2px; }
.ap-tts__speed { min-width: 46px; padding: 0 6px; }
body.tts-open .ap-read { padding-bottom: 150px; }
body.ap-reading.tts-open .ap-backtotop { bottom: 236px; }
body.ap-reading.tts-open.tts-min .ap-backtotop { bottom: 96px; }
