/* Reading and account tools share persistent desktop docks; mobile tools stay unchanged. */
.reader-mobile-nav,.reader-settings-sheet{display:none}
.reader-chapters-sheet[open]{display:flex;flex-direction:column;position:fixed;inset:auto 0 0;margin:0;width:100%;max-width:none;height:min(78dvh,650px);max-height:90dvh;box-sizing:border-box;padding:14px 20px max(20px,env(safe-area-inset-bottom));border:1px solid var(--line);border-radius:22px 22px 0 0;background:var(--surface);color:var(--ink);box-shadow:0 -12px 45px #17112124;overflow:hidden;animation:reader-sheet-up .22s ease-out both}
.reader-chapters-sheet::backdrop{background:#17112188}
.reader-chapters-sheet.is-closing{animation:reader-sheet-down .18s ease-in both}
.reader-chapters-sheet .reader-sheet-header{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin:0 0 8px;flex:none}
.reader-chapters-sheet .reader-sheet-grip{width:36px;height:4px;border-radius:4px;background:var(--line);margin:0 auto 17px;flex:none}
.reader-chapters-sheet .reader-sheet-eyebrow{font-size:9px;letter-spacing:1.7px;font-weight:700;color:var(--accent);margin:0 0 6px}
.reader-chapters-sheet h2{font-size:1.3rem;line-height:1.35;margin:0}
.reader-chapters-sheet .reader-sheet-close{display:grid;place-items:center;width:44px;height:44px;flex:none;border:1px solid var(--line);background:transparent;border-radius:50%;color:var(--muted)}
.reader-chapters-sheet .reader-sheet-close svg{width:19px;height:19px}
.reader-chapters-book{margin:0 0 14px;color:var(--muted);font-size:13px;line-height:1.5;overflow-wrap:anywhere;flex:none}
.reader-chapters-sheet input[type=search]{width:100%;min-height:44px;margin:0 0 12px;flex:none}
.reader-chapters-list{list-style:none;margin:0;padding:0 2px;min-height:0;overflow:auto;overscroll-behavior:contain;flex:1;scrollbar-gutter:stable}
.reader-chapters-list li{margin:0;border-bottom:1px solid var(--line)}
.reader-chapter-row{box-sizing:border-box;display:flex;align-items:center;justify-content:space-between;gap:14px;width:100%;min-height:64px;padding:12px 10px;border:0;border-radius:8px;background:transparent;color:var(--ink);font:inherit;text-align:left;text-decoration:none}
.reader-chapter-row:is(a,button){cursor:pointer}.reader-chapter-row:is(a,button):hover{background:var(--surface-accent);text-decoration:none}
.reader-chapter-row[aria-current=page]{background:var(--surface-accent);box-shadow:inset 3px 0 var(--accent)}
.reader-chapter-row[aria-disabled=true]{color:var(--muted)}
.reader-chapter-row:focus-visible,.reader-chapters-sheet .reader-sheet-close:focus-visible{outline:2px solid var(--focus,var(--accent));outline-offset:-2px}
.reader-chapter-copy{display:grid;gap:4px;min-width:0}.reader-chapter-copy strong{font-size:14px;line-height:1.5;overflow-wrap:anywhere}.reader-chapter-number,.reader-chapter-copy small{font-size:11px;line-height:1.5;color:var(--muted)}
.reader-chapter-row>svg{width:18px;height:18px;flex:none;color:var(--accent)}
.reader-chapter-empty{padding:24px 12px;color:var(--muted);font-size:13px;line-height:1.7}
html.reader-settings-open{overflow:hidden}
@media(min-width:761px){.reader-chapters-sheet[open]{inset:0;margin:auto;width:min(560px,calc(100% - 40px));height:min(78dvh,650px);border-radius:18px}.reader-chapters-sheet .reader-sheet-grip{display:none}}

/* Keep existing chapter controls within reach throughout desktop reading. */
@media(min-width:761px){
 .story-page .reader>header{margin-top:24px}
 .story-page .readercontrols{box-sizing:border-box;position:fixed;z-index:70;left:50%;right:auto;bottom:max(16px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(760px,calc(100% - 32px));min-height:72px;display:flex;align-items:center;justify-content:space-between;flex-wrap:nowrap;gap:20px;margin:0;padding:12px 16px;border:1px solid var(--line);border-radius:16px;background:var(--surface);color:var(--ink);box-shadow:0 4px 24px #20152d26}
 .story-page .readercontrols>.button{flex:none;min-height:44px;white-space:nowrap}
 .story-page .readercontrols label{flex:1 1 auto;justify-content:center;min-width:0;white-space:nowrap}
 .story-page .readercontrols input[type=range]{width:clamp(90px,11vw,140px);min-width:0;min-height:44px;margin:0;padding:0;border:0;background:transparent;cursor:pointer}
 .story-page:has(.readercontrols)+.story-page-footer{padding-bottom:calc(116px + env(safe-area-inset-bottom))}
 html:has(.story-page .readercontrols){scroll-padding-bottom:112px}
 body:has(.story-page .readercontrols) #toast{bottom:calc(104px + env(safe-area-inset-bottom))}
}

@media(max-width:760px){
 .story-page-header .story-header-products{display:none}
 .account-page-header .account-header-products{display:none}
 .account-page-header .account-header-logout,.story-page-header .account-header-logout{display:inline-flex;align-items:center;justify-content:center;min-width:44px;min-height:44px;padding:10px;border-radius:9px}
 .account-header-logout svg{width:20px;height:20px;display:block}
 .story-page .readercontrols{display:none}
 .story-page .readertext{font-size:var(--reader-size);line-height:var(--reader-line)}
 .story-page-footer,.account-page-footer{padding-bottom:calc(90px + env(safe-area-inset-bottom))}
 .reader-mobile-nav{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:4px;position:fixed;inset:auto 0 0;z-index:70;min-height:64px;padding:7px max(12px,env(safe-area-inset-right)) calc(7px + env(safe-area-inset-bottom)) max(12px,env(safe-area-inset-left));border-top:1px solid var(--line);background:var(--surface);box-shadow:0 -5px 24px #20152d0a}
 .reader-mobile-nav.reader-has-chapters{grid-template-columns:repeat(5,minmax(0,1fr))}
 .reader-settings-sheet.reader-chapters-sheet[open]{display:flex;overflow:hidden;padding:14px max(16px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(16px,env(safe-area-inset-left))}
 .reader-mobile-nav>a,.reader-mobile-nav>button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-height:49px;min-width:0;padding:5px 2px;border:0;border-radius:9px;background:transparent;color:var(--muted);font-family:inherit;font-size:11px;font-weight:500;line-height:1.25;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
 .reader-mobile-nav:not(.account-mobile-nav)>a>span:last-child,.reader-mobile-nav:not(.account-mobile-nav)>button>span:last-child{display:flex;align-items:center;justify-content:center;min-height:2.5em;text-align:center}
 .reader-mobile-nav svg{width:22px;height:22px;display:block;flex-shrink:0}
 .reader-mobile-nav>button[aria-expanded=true],.reader-mobile-nav>a:hover,.reader-mobile-nav>button:hover{background:color-mix(in srgb,var(--accent) 9%,transparent);color:var(--accent)}
 .reader-mobile-nav>a[aria-current=page]{background:color-mix(in srgb,var(--accent) 9%,transparent);color:var(--accent);font-weight:650}
 html[data-theme=dark] .account-mobile-nav>a[aria-current=page]{background:color-mix(in srgb,var(--accent) 22%,transparent);color:#d4befa}
 .reader-mobile-nav>a:focus-visible,.reader-mobile-nav>button:focus-visible{outline:2px solid var(--accent);outline-offset:1px}
 body:has(.reader-mobile-nav) #toast{bottom:calc(78px + env(safe-area-inset-bottom))}
 html.reader-settings-open{overflow:hidden}
 .reader-settings-sheet[open]{display:block;position:fixed;inset:auto 0 0;margin:0;width:100%;max-width:none;max-height:min(90dvh,650px);padding:11px max(20px,env(safe-area-inset-right)) max(20px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left));border:1px solid var(--line);border-bottom:0;border-radius:22px 22px 0 0;background:var(--surface);color:var(--ink);overflow-x:hidden;overflow-y:auto;overscroll-behavior:contain;box-shadow:0 -12px 45px #17112124;animation:reader-sheet-up .22s ease-out both}
 .reader-settings-sheet::backdrop{background:#17112188;backdrop-filter:blur(3px)}
 .reader-settings-sheet.is-closing{animation:reader-sheet-down .18s ease-in both}
 .reader-sheet-grip{width:36px;height:4px;border-radius:4px;background:var(--line);margin:0 auto 17px}
 .reader-sheet-header{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:9px}
 .reader-sheet-eyebrow{font-size:9px;letter-spacing:1.7px;font-weight:700;color:var(--accent);margin:0 0 6px}
 .reader-sheet-header h2{font-size:1.3rem;letter-spacing:-.6px;margin:0;line-height:1.35}
 .reader-sheet-close{display:grid;place-items:center;width:44px;height:44px;flex-shrink:0;border:1px solid var(--line);background:transparent;border-radius:50%;color:var(--muted);margin-top:-2px}
 .reader-sheet-close svg{width:19px;height:19px}
 .reader-settings-description{font-size:12px;color:var(--muted);line-height:1.7;margin:0 0 23px}
 .reader-setting{margin-bottom:22px}
 .reader-setting-label{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
 .reader-setting-label label{font-size:13px;margin:0}
 .reader-setting-label output{font-size:12px;font-weight:650;color:var(--accent);font-variant-numeric:tabular-nums}
 .reader-setting-inputs{display:grid;grid-template-columns:44px minmax(0,1fr) 44px;align-items:center;gap:13px}
 .reader-setting-inputs button{height:44px;min-width:44px;border:1px solid var(--line);border-radius:9px;background:transparent;color:var(--ink);font-size:16px;font-weight:600}
 .reader-setting-inputs input[type=range]{width:100%;min-width:0;min-height:44px;margin:0;padding:0;border:0;background:transparent;accent-color:var(--accent)}
 .reader-settings-preview{padding:15px 17px;border:1px solid var(--line);border-radius:12px;margin:2px 0 13px;background:color-mix(in srgb,var(--accent) 4%,var(--surface))}
 .reader-settings-preview>span{font-size:9px;font-weight:650;letter-spacing:1.7px;color:var(--muted)}
 .reader-settings-preview p{font:var(--reader-size)/var(--reader-line) Georgia,serif;overflow-wrap:anywhere;margin:10px 0 0}
 .reader-preference-status{font-size:11px;color:var(--muted);text-align:center;margin:0 0 14px;line-height:1.5}
 .reader-settings-done{min-height:46px;font-size:13px}
}
@keyframes reader-sheet-up{from{transform:translateY(100%);opacity:.7}to{transform:translateY(0);opacity:1}}
@keyframes reader-sheet-down{from{transform:translateY(0);opacity:1}to{transform:translateY(100%);opacity:.7}}
@media(prefers-reduced-motion:reduce){.reader-settings-sheet[open],.reader-settings-sheet.is-closing{animation:none}}

/* Shared desktop account shell: /member and all account subpages, /products. */
.account-page-header .account-header-products{display:none}
.topbar .account-header-logout{display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;min-width:44px;min-height:44px;padding:10px;border-radius:9px}
.topbar .account-header-logout svg{width:20px;height:20px;display:block}
@media(min-width:761px){
 .account-page-footer{padding-bottom:calc(114px + env(safe-area-inset-bottom))}
 .account-bottom-nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:4px;position:fixed;z-index:70;left:50%;right:auto;bottom:max(16px,env(safe-area-inset-bottom));transform:translateX(-50%);width:min(560px,calc(100% - 24px));min-height:66px;padding:7px 10px;border:1px solid var(--line);border-radius:14px;background:var(--surface);box-shadow:0 4px 24px #20152d1a}
 .account-bottom-nav>a,.account-bottom-nav>button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;min-width:0;min-height:49px;padding:5px 2px;border:0;border-radius:9px;background:transparent;color:var(--muted);font-family:inherit;font-size:12px;font-weight:500;line-height:1.25;text-decoration:none;cursor:pointer;-webkit-tap-highlight-color:transparent}
 .account-bottom-nav svg{width:22px;height:22px;display:block;flex-shrink:0}
 .account-bottom-nav>a[aria-current=page],.account-bottom-nav>a:hover,.account-bottom-nav>button:hover{background:var(--surface-accent);color:var(--accent)}
 .account-bottom-nav>a[aria-current=page]{font-weight:650}
 .account-bottom-nav>a:focus-visible,.account-bottom-nav>button:focus-visible{outline:2px solid var(--focus);outline-offset:1px}
 body:has(.account-bottom-nav) #toast{bottom:calc(100px + env(safe-area-inset-bottom))}
}

/* A proportional back icon beside reader/writer headings, with a 44px touch target. */
.eyebrow.has-page-back{display:flex;align-items:center;gap:6px;margin-bottom:4px}
.page-back{display:inline-flex;align-items:center;justify-content:center;flex:0 0 44px;width:44px;height:44px;min-height:44px;padding:11px;border:1px solid var(--line);border-radius:50%;background:transparent;color:var(--accent);cursor:pointer;letter-spacing:normal;touch-action:manipulation;-webkit-tap-highlight-color:transparent}
.page-back svg{display:block;width:20px;height:20px;flex-shrink:0}
.page-back:hover{background:var(--surface-accent)}
.page-back:focus-visible{outline:2px solid var(--focus,var(--accent));outline-offset:3px}

/* Member identity and the shared catalogue banner on every /member route. */
.header-account{min-width:0;max-width:190px;min-height:44px;display:inline-flex;align-items:center;justify-content:center}
.header-account-name{display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.member-catalog-banner{position:relative;isolation:isolate;overflow:hidden;display:flex;align-items:center;aspect-ratio:15/4;min-height:270px;margin:0 0 24px;border-radius:20px;border:1px solid #ffffff20;background:#2e1b45;color:#fff;box-shadow:0 12px 34px #24133512}
.member-catalog-art{position:absolute;z-index:-2;inset:0;display:block;width:100%;height:100%;object-fit:cover;object-position:center 58%}
.member-catalog-banner::after{content:"";position:absolute;z-index:-1;inset:0;background:linear-gradient(90deg,#211331dd 0%,#241337a6 32%,#29163a22 66%,transparent 100%);pointer-events:none}
.member-catalog-copy{position:relative;max-width:55%;padding:26px 34px}
.member-catalog-eyebrow{margin:0 0 9px;color:#eadcff;font-size:.7rem;line-height:1.4;font-weight:700;letter-spacing:1.7px;text-transform:uppercase}
.member-catalog-copy h2{margin:0 0 10px;color:#fff;font-family:Georgia,serif;font-size:clamp(1.8rem,2.8vw,2.45rem);font-weight:400;line-height:1.13;letter-spacing:-.5px}
.member-catalog-description{max-width:350px;margin:0 0 17px;color:#f0e9f9;font-size:.88rem;line-height:1.65}
.member-catalog-banner .member-catalog-cta{display:inline-flex;align-items:center;justify-content:center;gap:13px;min-height:44px;padding:11px 17px;border:1px solid #fff;background:#fff;color:#4b2d70;font-size:.82rem;font-weight:700;line-height:1.4;white-space:normal}
.member-catalog-banner .member-catalog-cta:hover{background:#eee6fb;border-color:#eee6fb;color:#3b205e;text-decoration:none}
.member-catalog-cta svg{width:18px;height:18px;flex:none}
.member-catalog-banner .member-catalog-cta:focus-visible{outline:3px solid #ffdda2;outline-offset:4px}
@media(max-width:760px){
 .has-profile-name{column-gap:8px}.topbar.has-profile-name .brand{flex:1 1 auto;min-width:0}.has-profile-name .brand>span{min-width:0}.has-profile-name .brand strong,.has-profile-name .brand small{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.has-profile-name .brand img{flex:none}
 .has-profile-name nav{gap:6px}.topbar .header-account{max-width:clamp(64px,22vw,130px);min-height:44px;padding:8px 10px}
 .member-catalog-banner{aspect-ratio:auto;min-height:330px;margin-bottom:19px;border-radius:17px;align-items:flex-end}
 .member-catalog-art{height:195px;object-position:78% 48%}
 .member-catalog-banner::after{background:linear-gradient(0deg,#2e1b45 0%,#2e1b45 38%,#2e1b45e6 53%,#2e1b4533 79%,transparent 100%)}
 .member-catalog-copy{max-width:none;width:100%;padding:19px 21px}.member-catalog-eyebrow{font-size:.64rem;letter-spacing:1.4px;margin-bottom:7px}
 .member-catalog-copy h2{font-size:1.75rem;line-height:1.12;margin-bottom:9px}.member-catalog-description{max-width:330px;font-size:.81rem;line-height:1.6;margin-bottom:14px}
 .member-catalog-banner .member-catalog-cta{font-size:.8rem;min-height:44px;padding:10px 15px}
}
.book-detail-access{margin-top:23px}
@media(max-width:760px){.book-detail-summary>.book-detail-access{grid-column:1/-1;margin:0;justify-self:start}}

/* Reader account navigation: five clear destinations on every screen. */
.account-bottom-nav{grid-template-columns:repeat(5,minmax(0,1fr))}
.member-catalog-hint{margin:12px 0 0;color:#eadcff;font-size:.74rem;line-height:1.5;max-width:350px}
@media(max-width:760px){
 .account-bottom-nav{grid-template-columns:repeat(5,minmax(0,1fr))}
 .account-bottom-nav>a,.account-bottom-nav>button{font-size:10px;line-height:1.25;min-height:49px}
 .account-bottom-nav>a>span{max-width:100%;overflow-wrap:normal}
 .member-catalog-banner{min-height:370px}
 .member-catalog-copy{padding:22px 18px}
 .member-catalog-description{font-size:.84rem;line-height:1.65}
 .member-catalog-hint{font-size:.72rem;max-width:290px}
}

.profile-photo-card{margin-bottom:20px}.profile-photo-intro h2{margin-top:0}.profile-photo-editor{display:flex;align-items:flex-start;gap:20px}.profile-photo-preview{width:96px;height:96px;flex:0 0 96px;border-radius:50%;overflow:hidden;background:var(--surface-soft);border:1px solid var(--line);display:grid;place-items:center}.profile-photo-preview img{width:96px;height:96px;object-fit:cover}.profile-photo-preview span{font-size:32px;font-weight:700;color:var(--accent)}.profile-photo-preview [hidden]{display:none}.profile-photo-controls{min-width:0;flex:1}.profile-photo-picker{position:relative;cursor:pointer;overflow:hidden}.profile-photo-picker input{position:absolute;inset:0;opacity:0;width:100%;height:100%;cursor:pointer}.profile-photo-picker:focus-within{outline:3px solid var(--focus);outline-offset:3px}.profile-photo-actions{display:flex;flex-wrap:wrap;gap:8px}.profile-photo-actions [hidden]{display:none}.profile-photo-card[aria-busy=true] .profile-photo-picker{opacity:.6}.profile-photo-card .formerror:empty{display:none}@media(max-width:420px){.profile-photo-editor{gap:12px}.profile-photo-preview,.profile-photo-preview img{width:76px;height:76px}.profile-photo-preview{flex-basis:76px}.profile-photo-actions{gap:6px}.profile-photo-controls .help{font-size:12px}}

/* Keep the introduction separate from the photo and its controls. */
.profile-photo-card .profile-photo-intro{margin-bottom:24px}
.profile-photo-card .profile-photo-intro p{margin:0;line-height:1.65}
.profile-photo-card .profile-photo-editor{align-items:flex-start;column-gap:22px}
@media(max-width:420px){.profile-photo-card .profile-photo-intro{margin-bottom:22px}.profile-photo-card .profile-photo-editor{column-gap:14px}}
