/* A continuous reading surface, with controls outside the text column. */
.reader { --reader-border: #8883; --reader-hover: #8881; --reader-accent: #7853b8; min-height: 100dvh; }
.reader.dark { --reader-accent: #c3a0fa; }
.reader [hidden] { display: none !important; }
.reader .reader-header { position: fixed; inset: 0 0 auto; height: 68px; padding: 8px max(20px,calc((100vw - 1160px) / 2)); display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 20px; z-index: 50; border-color: var(--reader-border); transition: transform .18s, opacity .18s; }
.reader .reader-back { width: 44px; height: 44px; justify-content: center; border-radius: 8px; }
.reader-bar-title { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.reader-bar-title a, .reader-bar-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-bar-title a { width: fit-content; max-width: 100%; font-size: 14px; font-weight: 600; }
.reader-bar-title span { font-size: 11px; opacity: .6; }
.reader .reader-tools { gap: 6px; }
.reader .reader-tools .icon-button { width: 44px; height: 44px; }
.reader .reader-tools .icon-button:hover, .reader .reader-back:hover { background: var(--reader-hover); color: inherit; }
.reader .reading-progress { background: var(--reader-accent); height: 2px; }
.reader .reader-main { max-width: var(--reader-width,720px); width: calc(100% - 64px); padding: 132px 0 136px; min-height: 100dvh; }
.reader .reader-heading { margin-bottom: 58px; }
.reader .reader-heading h1 { font-size: 28px; }
.reader .reader-chapter { font-family: var(--sans); opacity: .6; }
.reader .prose { font-size: var(--reader-size,18px); line-height: var(--reader-line,1.95); overflow-wrap: anywhere; letter-spacing: -.015em; }
.reader .reader-end { margin-top: 70px; }
.reader .author-note { background: transparent; }
.reader-bottom { position: fixed; inset: auto 0 0; background: var(--reader-bg); border-top: 1px solid var(--reader-border); padding: 8px 24px calc(8px + env(safe-area-inset-bottom)); z-index: 50; transition: transform .18s, opacity .18s; }
.reader-bottom-inner { max-width: 1120px; margin: auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: 44px; }
.reader-reactions, .reader-pagination { display: flex; align-items: center; gap: 8px; }
.reader-pagination { margin-left: auto; }
.reader .reader-bottom button, .reader .reader-bottom a { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 76px; min-height: 44px; padding: 8px 12px; font-size: 13px; line-height: 1.35; white-space: nowrap; border: 0; border-radius: 6px; background: transparent; color: inherit; }
.reader .reader-bottom button:not(:disabled):hover, .reader .reader-bottom a:hover { background: var(--reader-hover); }
.reader .reader-bottom .episode-like.liked { color: var(--reader-accent); }
.reader .reader-bottom strong { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.reader .reader-bottom [aria-expanded="true"] { background: var(--reader-hover); color: var(--reader-accent); }
.reader-controls-hidden .reader-header { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.reader-controls-hidden .reader-bottom { transform: translateY(100%); opacity: 0; pointer-events: none; }
.reader-reveal { position: fixed; top: 14px; right: 20px; z-index: 49; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--reader-border); border-radius: 24px; color: inherit; background: var(--reader-bg); font-size: 12px; }
.reader-panel { position: fixed; top: 80px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); width: 340px; max-width: calc(100vw - 24px); z-index: 60; display: flex; flex-direction: column; background: var(--reader-bg); color: var(--reader-color); border: 1px solid var(--reader-border); border-radius: 12px; box-shadow: 0 12px 40px #00000012; overflow: hidden; }
.reader-panel-header { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 8px 14px 8px 22px; border-bottom: 1px solid var(--reader-border); }
.reader-panel-header h2 { font-size: 16px; font-weight: 700; }
.reader-panel-header .icon-button { min-height: 44px; min-width: 44px; color: inherit; }
.reader-panel-header .icon-button:hover { background: var(--reader-hover); }
.reader-toc { min-height: 0; display: flex; flex-direction: column; flex: 1; }
.reader-toc-intro { display: flex; flex-direction: column; gap: 5px; padding: 18px 22px; border-bottom: 1px solid var(--reader-border); }
.reader-toc-intro strong { font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.reader-toc-intro span { opacity: .6; font-size: 11px; }
.reader-toc-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.reader-toc-row { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--reader-border); min-height: 74px; }
.reader-toc-row:hover { background: var(--reader-hover); }
.reader-toc-row.is-read { background: #88808a0a; }
.reader-toc-row[aria-current="page"] { color: var(--reader-accent); background: #9878be14; box-shadow: inset 3px 0 var(--reader-accent); }
.reader-toc-number { flex: 0 0 22px; font-size: 12px; opacity: .65; font-variant-numeric: tabular-nums; text-align: center; }
.reader-toc-copy { min-width: 0; flex: 1; }
.reader-toc-copy strong { display: block; font-size: 13px; font-weight: 500; line-height: 1.65; overflow-wrap: anywhere; }
.reader-toc-copy small { display: block; font-size: 10px; margin-top: 5px; opacity: .65; }
.reader-toc-price { font-size: 10px; white-space: nowrap; opacity: .7; }
.reader-panel-work { display: flex; align-items: center; justify-content: center; flex: none; gap: 8px; min-height: 52px; border-top: 1px solid var(--reader-border); font-size: 12px; }
.reader-panel .reader-comments { overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; margin: 0; padding: 20px; border: 0; min-height: 0; }
.reader-panel .comments { margin-top: 0; }
.reader-panel .comments-header { font-size: 13px; margin-bottom: 16px; }
.reader-panel .comment-form { padding: 14px; }
.reader-panel .comment-form-bottom { flex-wrap: wrap; gap: 10px; }
.reader-panel .comment-form-bottom > span { font-size: 10px; line-height: 1.7; }
.reader-panel .comment-form-bottom .btn { margin-left: auto; min-height: 44px; }
.reader-panel .comment-row { padding: 20px 0; gap: 9px; }
.reader-panel .comment-name { gap: 8px; flex-wrap: wrap; }
.reader-panel .comment-name time { display: block; margin: 3px 0 0; }
.reader-panel .comment-content { min-width: 0; }
.reader-panel .comment-content p { font-size: 13px; overflow-wrap: anywhere; }
.reader-panel .comment-delete { min-height: 44px; }
.reader-panel-shade { position: fixed; inset: 0; background: #0005; z-index: 55; width: 100%; height: 100%; }
.reader :focus-visible { outline: 2px solid var(--reader-accent); outline-offset: 3px; }
.reader-toc-row:focus-visible { outline-offset: -4px; }

@media (max-width: 760px), (max-height: 440px) {
 body.reader-panel-open { overflow: hidden; }
 .reader-panel { inset: 0 0 0 auto; width: min(380px,calc(100vw - 24px)); max-width: none; border-radius: 0; border-block: 0; border-right: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); box-shadow: -8px 0 40px #0002; }
}
@media (max-width: 760px) {
 .reader .reader-header { height: calc(60px + env(safe-area-inset-top)); padding: calc(8px + env(safe-area-inset-top)) 10px 8px; grid-template-columns: 40px minmax(0,1fr) auto; gap: 6px; }
 .reader .reader-back { width: 40px; }
 .reader .reader-tools { gap: 0; }
 .reader-bar-title a { font-size: 12px; }
 .reader-bar-title span { font-size: 10px; }
 .reader .reader-main { width: calc(100% - 40px); padding: calc(100px + env(safe-area-inset-top)) 0 calc(108px + env(safe-area-inset-bottom)); }
 .reader .reader-heading { margin-bottom: 42px; }
 .reader .reader-heading h1 { font-size: 23px; }
 .reader .reader-end { margin-top: 48px; }
 .reader-bottom { padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); }
 .reader-bottom-inner { gap: 4px; }
 .reader-reactions { gap: 0; }
 .reader-pagination { flex: 1; justify-content: flex-end; gap: 2px; }
 .reader .reader-bottom button, .reader .reader-bottom a { min-width: 44px; min-height: 48px; padding: 6px; gap: 4px; font-size: 11px; }
 .reader .reader-bottom strong { font-size: 11px; }
 .reader-reactions > button > span { display: none; }
 .reader .reader-bottom .episode-like { min-width: 54px; }
 .reader .reader-pagination > [data-reader-action="toc"] { flex-direction: column; gap: 2px; }
 .reader-reveal { top: calc(10px + env(safe-area-inset-top)); right: 10px; }
}
@media (prefers-reduced-motion: reduce) {
 .reader .reader-header, .reader .reader-bottom { transition: none; }
}
