/* Compact controls within the existing PM Bible Notes theme. */
#library-view .page-head{padding:18px 0 10px;max-width:none}
#library-view .page-head .eyebrow{display:none}
#library-view .page-head h1{font-size:clamp(22px,2.2vw,30px);margin:4px 0 8px;letter-spacing:-.035em}
#library-view .page-head p:not(.eyebrow){font-size:14px;max-width:none}
#library-view .back-link{padding-bottom:8px;min-height:32px}
.library-tools{display:grid;grid-template-columns:minmax(0,2fr) minmax(80px,1fr) auto;gap:10px;margin:12px 0 8px;max-width:800px}
.library-tools .select-box{min-width:0}.library-tools label span,.library-filter label span{font-size:14px}
.library-tools select{min-height:44px;padding:8px 10px}.library-tools button{min-height:44px;padding:8px 18px}
.library-filter{margin:12px 0;max-width:220px}.library-filter .select-box{flex-direction:row;align-items:center;gap:10px}
.library-filter select{min-height:44px;padding:8px;font-size:14px}
#book-grid{gap:0 22px}#book-grid .book-card{min-height:76px;padding:14px 6px}#book-grid .book-card strong{font-size:18px}#book-grid .book-card span{font-size:13px;margin-top:6px}
.testament-heading{grid-column:1/-1;font-size:16px;letter-spacing:0;margin:18px 0 12px}
#home-search{margin:12px 0 0;max-width:800px;position:relative}
#home-search>label,#bible-wide-search>label{font:600 14px/1.4 var(--font);margin-bottom:6px}
#home-search .home-search-fields input,#home-search .home-search-fields button{min-height:44px;padding-block:8px}
.quick-search-links{display:flex;flex-wrap:wrap;gap:0 16px;font-size:13px;margin-top:4px!important}
.quick-search-links a{display:inline-flex;align-items:center;min-height:32px;padding:0!important;border:0!important;text-decoration:underline;font-size:13px}
#home-search .home-search-results{z-index:40}
#home-search .home-search-filters{margin-top:6px}#home-search .home-search-filters:has(select[hidden]){justify-content:flex-end}
.chapter-sections a{flex-direction:column;gap:4px}.chapter-sections .section-availability{font-size:12px;font-weight:400;color:inherit}
#site-menu-button{display:none}
@media(max-width:700px){
 .library-tools{grid-template-columns:minmax(0,1fr) 76px auto;gap:8px}.library-tools button{padding-inline:10px;gap:0;font-size:14px}
 #library-view .page-head{padding-top:18px}#library-view .page-head h1{font-size:24px}
 #home-search{margin-top:12px}.quick-search-links{gap:0 12px}
 body{padding-bottom:0!important}#mobile-navigation,#mobile-more{display:none!important}
 .site-header .topnav{flex-wrap:wrap}.site-header .nav-actions{display:contents}
 .site-header .nav-actions>.nav-link,.site-header .nav-actions>.display-settings{display:none}
 .site-header .language-control{margin-left:auto;display:flex!important;gap:4px}
 #site-menu-button{display:inline-flex;align-items:center;justify-content:center;min-height:44px;min-width:60px;border:1px solid var(--line);background:var(--surface);border-radius:4px;padding:8px;font-size:14px}
 .site-header.menu-open .nav-actions{display:flex;width:100%;order:5;flex-wrap:wrap;align-items:stretch;gap:4px;padding-top:8px}
 .site-header.menu-open .nav-actions>.nav-link{display:flex;min-height:44px;align-items:center;flex:1 1 45%;font-size:14px;padding:10px}
 .site-header.menu-open .nav-actions>.display-settings{display:block}
 .site-header.menu-open .nav-actions>.language-control{display:none!important}
 .site-header .language-control>span{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
 .site-header .language-control select{width:125px;font-size:14px;min-height:44px}
 .site-header .brand-logo{width:44px}.site-header .brand-mark{gap:8px}.site-header .brand-mark strong{font-size:14px}.site-header .brand-mark small{font-size:7px}
 .chapter-sections{gap:6px}.chapter-sections a{flex:1 1 30%;padding:7px 5px}
}
@media(max-width:360px){.site-header .brand-mark>span{display:none}.library-tools{grid-template-columns:minmax(0,1fr) 70px}.library-tools button{grid-column:1/-1}.quick-search-links{font-size:12px}}
/* Route focus lands here for screen readers; it must not frame the whole page. */
#main-content:focus,#main-content:focus-visible,#seo-main:focus,#seo-main:focus-visible{outline:none;box-shadow:none}
#reader-view .reader-head h1{font-size:clamp(26px,3.2vw,38px);margin:10px 0 14px}
#reader-view .reader-head{margin-bottom:18px;padding-bottom:18px}
#reader-view .reader-top{margin:18px 0 16px}
#reader-view .reader-head .description{font-size:15px}
@media(max-width:700px){
 #seo-content .site-header .nav-actions{display:contents}
 #seo-content .site-header .nav-actions>.nav-link{display:none}
 #seo-content .site-header.menu-open .nav-actions{display:flex;width:100%}
 #seo-content .site-header.menu-open .nav-actions>.nav-link{display:flex}
 .site-header.menu-open .nav-actions>.language-control{display:flex!important}
 .site-header .display-settings>summary{display:flex;min-height:44px}
 .site-header .settings-panel{bottom:12px}
}

.initial-search{display:block}.initial-search>label{font-size:14px;margin-bottom:6px}
#chapter-verses .verse[data-highlight]{background:transparent!important;color:inherit!important}
#chapter-verses .verse[data-highlight] .verse-text{background:var(--custom-highlight);color:var(--custom-highlight-ink);box-shadow:none}
#chapter-verses .verse[data-highlight] .verse-number{color:inherit}
/* Keep save and type controls alongside the existing heading. */
.reader-title-row{display:flex;align-items:center;justify-content:space-between;gap:12px}
.reader-title-row h1{min-width:0;flex:1}
.reader-title-row #reading-toolbar{flex:none;margin:0;background:transparent;max-width:none}
.reader-title-row #reading-toolbar .reading-actions{display:flex;gap:4px}
.reader-title-row #reading-toolbar .reading-bookmark,.reader-title-row #reading-toolbar summary{width:44px;height:44px;min-height:44px;padding:8px;border:none;background:transparent}
.reader-title-row #reading-status:empty{display:none}
.reader-title-row #reading-status:not(:empty){position:absolute;right:0;top:100%;width:230px;background:var(--paper);padding:8px;z-index:4;font-size:13px}
.reading-hint{font-size:13px;margin:0 auto 14px;max-width:740px;padding-block:4px}
@media(max-width:700px){.site-header:not([data-menu-ready]) .nav-actions>.nav-link{display:flex;min-height:44px;align-items:center;font-size:14px;padding:8px}.site-header:not([data-menu-ready]) .nav-actions{display:flex;flex-wrap:wrap}}

/* Explicit content height prevents Safari's popover/grid stretching. */
#verse-action-menu{position:fixed;inset:auto;bottom:auto;right:auto;margin:0;display:block;width:min(390px,calc(100vw - 24px));height:auto;min-height:0;max-height:calc(100dvh - 24px);overflow:auto;padding:8px 10px;border-radius:12px;contain:layout;z-index:100;}
#verse-action-menu .verse-action-heading{display:flex;position:static;align-items:center;gap:8px;margin:0 0 4px;padding:0;min-height:28px}
#verse-action-menu .verse-action-heading>span{font-size:13px;font-weight:600;color:var(--ink);flex:1}
#verse-action-menu .verse-action-close{position:static;width:32px;min-width:32px;height:32px;min-height:32px;padding:0;font-size:20px}
.verse-highlight-row{display:flex;align-items:center;gap:4px;margin-bottom:4px}
.verse-recent-colours{display:flex;gap:2px;overflow-x:auto;flex:1;min-width:0}
#verse-action-menu [data-highlight-color]{background:transparent;display:grid;place-items:center;min-width:32px;min-height:36px;padding:4px;border-radius:50%;color:#152525;flex:none}
#verse-action-menu [data-highlight-color]>span{width:24px;height:24px;border-radius:50%;box-shadow:inset 0 0 0 1px #0002}
#verse-action-menu [data-highlight-color][aria-pressed=true]>span{outline:2px solid var(--accent);outline-offset:2px}
#verse-action-menu [data-highlight-color][aria-pressed=true]>span::after{content:'✓';display:block;text-align:center;font-weight:700}
#verse-action-menu .verse-palette-toggle{background:conic-gradient(#ff91bf,#ffc078,#65f57a,#44d6ff,#c5a0ff,#ff91bf);color:#152525;width:30px;min-width:30px;min-height:30px;padding:0;border-radius:50%}
#verse-action-menu .verse-action-buttons{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:2px}
#verse-action-menu .verse-action-buttons>button{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;min-width:0;min-height:44px;padding:4px 2px;font-size:12px;font-weight:500;line-height:1.3;background:transparent;border-radius:6px;color:var(--ink)}
#verse-action-menu .verse-action-buttons>button:hover,#verse-action-menu .verse-action-buttons>button[aria-pressed=true]{background:var(--paper);color:var(--accent)}
#verse-action-menu .verse-action-buttons svg{width:16px;height:16px}
#verse-action-menu .verse-range{margin:4px 0 0;padding:0;font-size:12px}
#verse-action-menu .verse-range summary{min-height:28px;cursor:pointer;color:var(--muted);font-size:12px}
#verse-action-menu .verse-range>div{display:flex;align-items:end;gap:6px;padding:6px 0}
#verse-action-menu .verse-range label{flex:1;min-width:0}#verse-action-menu .verse-range select{min-height:40px;padding:6px;font-size:16px}
#verse-action-menu .verse-range p{font-size:12px;color:var(--muted);margin:4px 0}
#verse-action-menu .verse-range button{min-height:40px;padding:6px 10px;background:var(--accent);color:var(--paper);border-radius:6px}
#verse-action-menu .verse-colours{border-top:1px solid var(--line);margin-top:6px;padding-top:6px}
#verse-action-menu .verse-swatches{display:flex;gap:2px;flex-wrap:wrap;justify-content:flex-start}
#verse-action-menu .recent-colours-label{font-size:12px;color:var(--muted);margin:0 0 3px}
#verse-action-menu .custom-colour{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:12px;margin-top:4px}
#verse-action-menu .custom-colour label{display:flex;gap:6px;align-items:center}#verse-action-menu input[type=color]{width:40px;height:32px;min-height:32px;padding:2px}
#verse-action-menu .custom-colour button{font-size:12px;min-height:36px;padding:4px 8px;background:var(--paper);border:1px solid var(--line);border-radius:6px}
#verse-action-menu .verse-action-status{font-size:12px;margin:4px 0 0;padding:0;line-height:1.4}
#verse-action-menu .verse-action-status.is-confirmation{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
.verse-comparison{border-top:1px solid var(--line);margin-top:6px;padding-top:8px}.verse-comparison-heading{display:flex;align-items:center;gap:8px;font-size:13px}.verse-comparison select{width:140px;min-height:40px;padding:6px;font-size:16px;margin-left:auto}
.verse-comparison [data-comparison-text]{display:grid;grid-template-columns:1fr 1fr;gap:12px;margin-top:8px}.verse-comparison section{min-width:0}.verse-comparison p{font:16px/1.6 var(--reader-font,Georgia,serif);margin:6px 0}.verse-comparison sup{font:11px var(--font);color:var(--muted)}.verse-comparison small{display:block;font-size:11px;color:var(--muted);margin-top:6px}
/* Keep the passage close to its heading and chapter selector. */
#reader-view .reader-top{margin:10px 0 8px}#reader-view .reader-head{max-width:740px;margin:0 auto 4px;padding-bottom:6px}
#reader-view .reader-head h1{margin:4px 0 6px;font-size:clamp(24px,3vw,34px)}#reader-view .reader-meta{margin-top:6px;gap:14px;font-size:11px}#reader-view .reader-head .description{font-size:13px}
#chapter-selector-slot{max-width:740px;margin:0 auto 4px;min-height:40px!important}#chapter-bar{max-width:320px;padding:2px 6px;border-radius:9px;grid-template-columns:minmax(0,1fr) 64px;gap:4px}#chapter-bar select{min-height:34px;padding-block:4px;font-size:14px}
.chapter-sections{margin:4px auto 6px;gap:4px}.chapter-sections a{padding:4px 8px;font-size:12px}.chapter-sections .section-availability{font-size:10px}.reading-hint{margin:0 auto 4px;padding-block:0;font-size:12px}
.verse-directory.quick-group{max-width:740px;margin:12px auto 6px;padding:0;border:0;background:transparent}.verse-directory.quick-group>summary{padding:4px 0;min-height:28px;font-size:12px;font-weight:400;color:var(--muted)}.verse-directory .quick-grid{gap:4px;padding:6px 0}.verse-directory .quick-grid a{min-height:32px;padding:4px;font-size:12px}
@media print{#verse-action-menu,.verse-directory{display:none}#chapter-verses .verse[data-highlight] .verse-text{background:transparent!important;color:inherit!important}}

#reader-view .chapter-sections{flex-wrap:nowrap;overflow-x:auto;margin:4px auto 6px;gap:4px}#reader-view .chapter-sections a{flex:1 0 auto;padding:6px 8px;min-height:30px;font-size:11px;white-space:nowrap}#reader-view .chapter-sections .section-availability{position:absolute;width:1px;height:1px;overflow:hidden;clip-path:inset(50%)}
#verse-action-menu{animation:none}
/* Minimal gaps on reading pages; Aa retains its existing size and controls. */
body:has(#reader-view.is-active) #home-search{margin-top:4px}
body:has(#reader-view.is-active) #home-search>label{margin-bottom:3px}
body:has(#reader-view.is-active) .quick-search-links{margin-top:0!important;line-height:1.25}
body:has(#reader-view.is-active) .quick-search-links a{min-height:26px}
#reader-view .reader-top{margin:3px 0 2px;gap:8px}
#reader-view .reader-head{margin-bottom:2px;padding-bottom:3px}
#reader-view .reader-head .eyebrow{line-height:1.2}
#reader-view .reader-head h1{margin:0;font-size:clamp(24px,3vw,34px)}
#reader-view .reader-head .description{line-height:1.3}
#reader-view .reader-meta{margin-top:3px;line-height:1.3}
#chapter-selector-slot{margin-bottom:2px}
#reader-view .chapter-sections{margin:2px auto 4px}

body:has(#reader-view.is-active) #home-search{display:none}

/* Chapter reading starts with one compact control row rather than a title stack. */
#reader-view:has(.chapter-reader-head) .reader-top{display:none}
#reader-view .chapter-reader-head{position:relative;z-index:20;max-width:940px;margin:4px 0 8px max(0px,calc((100% - 740px)/2));padding:0;border:0;background:var(--paper)}
#reader-view .chapter-reader-head>.eyebrow,#reader-view .chapter-reader-head>.description{display:none}
#reader-view .chapter-reader-head h1{position:absolute;width:1px;height:1px;margin:0;padding:0;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
.chapter-reader-head .reader-title-row{gap:8px;min-height:44px}
.chapter-reader-head #chapter-selector-slot{position:static;flex:1;min-width:0;min-height:38px!important;margin:0;pointer-events:auto}
.chapter-reader-head #chapter-bar,.chapter-reader-head #chapter-bar.is-compact{max-width:none;width:100%;margin:0;padding:0 2px;gap:3px;border:0;border-radius:6px;box-shadow:none;grid-template-columns:minmax(0,1fr) 64px;transition:none}
.chapter-reader-head #chapter-bar select{height:38px;min-height:38px;padding:5px 7px;font-size:14px;border:1px solid var(--line);border-radius:6px}
#reader-view .chapter-reader-head .chapter-sections{flex:0 1 auto;min-width:0;max-width:42%;margin:0 0 0 auto;gap:2px;overflow-x:auto}
#reader-view .chapter-reader-head .chapter-sections a{flex:0 0 auto;min-height:28px;padding:4px 5px;font-size:11px;border:0;border-radius:4px}
.chapter-reader-head #reading-toolbar .reading-preferences{left:auto;right:0}
#reader-view .chapter-reading-info{max-width:740px;margin:6px auto;font-size:11px;gap:14px;color:var(--muted)}
@media(max-width:700px){
 .chapter-reader-head .reader-title-row{flex-wrap:wrap;gap:2px 6px}
 .chapter-reader-head #chapter-selector-slot{flex:1;min-width:0}
 .chapter-reader-head #chapter-bar select{font-size:16px}
 .chapter-reader-head #reading-toolbar{order:2}
 #reader-view .chapter-reader-head .chapter-sections{order:3;flex:1 0 100%;max-width:none;justify-content:flex-start}
 #reader-view .chapter-reader-head .chapter-sections a{padding:3px 6px;min-height:26px}
 #chapter-verses{overflow-wrap:anywhere}
}
@media(max-width:360px){#reader-view .chapter-reader-head .chapter-sections a{font-size:10px;padding-inline:4px}}
@media print{#reader-view .chapter-reader-head{position:static}#reader-view .chapter-reader-head h1{position:static;width:auto;height:auto;clip-path:none;overflow:visible}#reader-view .chapter-reader-head .chapter-sections{display:none}}

/* On scroll, keep only the selector floating above the passage. */
.chapter-reader-head #chapter-bar.is-compact{position:fixed;top:8px;left:50%;transform:translateX(-50%);width:min(480px,calc(100vw - 24px));padding:3px;background:var(--paper);border:1px solid var(--line);box-shadow:0 3px 12px #00000012;z-index:20}

/* Match the app: hide on downward scrolling, reveal the clean selector upward. */
.chapter-reader-head #chapter-bar.is-compact{transform:translate(-50%,-70px);opacity:0;visibility:hidden;pointer-events:none;transition:transform .16s ease,opacity .16s ease}
.chapter-reader-head #chapter-bar.is-compact.is-revealed{transform:translateX(-50%);opacity:1;visibility:visible;pointer-events:auto}
@media(prefers-reduced-motion:reduce){.chapter-reader-head #chapter-bar.is-compact{transition:none}}
/* Soft glass for the selector revealed while scrolling upward. */
.chapter-reader-head #chapter-bar.is-compact{background:color-mix(in srgb,var(--paper) 72%,transparent);backdrop-filter:blur(16px) saturate(135%);-webkit-backdrop-filter:blur(16px) saturate(135%);border-color:color-mix(in srgb,var(--line) 65%,transparent);box-shadow:0 4px 18px #0000000d;border-radius:12px}
.chapter-reader-head #chapter-bar.is-compact select{background:transparent;border-color:transparent}
@supports not (backdrop-filter:blur(1px)){.chapter-reader-head #chapter-bar.is-compact{background:var(--paper)}}
/* Related reading explains each connection beside its destination. */
[data-related-content],.related-reading{max-width:740px;margin:14px auto 20px;font-size:14px}
.related-reading>summary{font-size:14px;cursor:pointer;padding:10px 0;border-block:1px solid var(--line)}
.related-filter{display:flex;align-items:center;gap:12px;font-size:13px;color:var(--muted);margin:12px 0}
.related-filter select{width:180px;min-height:40px;padding:6px 10px;font-size:16px}
.related-intro{font-size:13px;color:var(--muted);margin:8px 0 20px}
[data-related-content] h3{font:600 18px/1.4 var(--font);letter-spacing:0;margin:22px 0 10px}
.related-cards{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.related-card{min-width:0;padding:14px;border:1px solid var(--line);border-radius:9px;background:var(--surface)}
.related-card .related-connection{font-size:11px;color:var(--muted);margin:0 0 6px}
.related-title{font-size:15px;font-weight:600;color:var(--accent);text-decoration:none;line-height:1.5;display:inline-block}
.related-title:hover{text-decoration:underline}.related-kind{display:block;font-size:11px;color:var(--muted);margin-top:4px}
.related-card>p:not(.related-connection){font-size:13px;line-height:1.75;margin-top:9px;overflow-wrap:anywhere}
.related-reference{display:inline-block;font-size:12px;color:var(--accent);margin-top:8px}
.related-attribution{font-size:11px;color:var(--muted);margin-top:18px}.related-status{font-size:13px;margin:12px 0;color:var(--muted)}
@media(max-width:700px){.related-cards{grid-template-columns:1fr}.related-card{padding:12px}}

.chapter-material[data-chapter-section="related"]{max-width:740px;margin-inline:auto}

/* Use the app's compact glass toolbar, three recent colours and inline marks. */
#chapter-verses .verse-text.is-selected{text-decoration-style:solid;text-decoration-thickness:1px;text-underline-offset:5px}
#chapter-verses .verse[data-highlight] .verse-text{display:inline;padding:1px 0;border-radius:2px;-webkit-box-decoration-break:clone;box-decoration-break:clone}
#verse-action-menu{width:min(440px,calc(100vw - 24px));border-radius:24px;padding:5px 10px 9px;box-shadow:0 12px 40px #0002,inset 0 1px 0 #ffffff50}
#verse-action-menu .verse-action-heading>span{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#verse-action-menu .verse-action-strip{display:flex;align-items:center;gap:4px}
#verse-action-menu .verse-highlight-row{flex:none;gap:0;margin:0}
#verse-action-menu .verse-recent-colours{flex:none;gap:0;overflow:visible}
#verse-action-menu [data-highlight-color]{min-width:36px;width:36px;min-height:44px;height:44px;padding:0}
#verse-action-menu [data-highlight-color]>span{width:22px;height:22px}
#verse-action-menu .verse-palette-toggle{display:grid;place-items:center;background:transparent;width:36px;min-width:36px;min-height:44px;height:44px;border-radius:14px}
#verse-action-menu .verse-palette-toggle>span{display:none}
#verse-action-menu .verse-palette-toggle::before{content:'';width:24px;height:24px;border-radius:50%;background:conic-gradient(#ef4444,#facc15,#4ade80,#22d3ee,#6366f1,#e879f9,#ef4444);box-shadow:inset 0 0 0 1px #0002}
#verse-action-menu .verse-action-buttons{flex:1;grid-template-columns:repeat(4,minmax(0,1fr));gap:0;min-width:176px}
#verse-action-menu .verse-action-buttons>button{min-width:44px;font-size:10px;min-height:44px;padding:3px 2px;border-radius:14px}
#verse-action-menu .verse-action-buttons svg{width:19px;height:19px}
#verse-action-menu .verse-swatches [data-highlight-color]{width:44px;min-width:44px}
#verse-action-menu .custom-colour [data-verse-copy]{display:flex;align-items:center;gap:6px}
#verse-action-menu .custom-colour [data-verse-copy] svg{width:16px;height:16px}
@supports(backdrop-filter:blur(20px)){#verse-action-menu{background:color-mix(in srgb,var(--surface) 85%,transparent);backdrop-filter:blur(24px) saturate(135%);-webkit-backdrop-filter:blur(24px) saturate(135%)}}
@media(max-width:370px){#verse-action-menu .verse-action-strip{flex-wrap:wrap}#verse-action-menu .verse-highlight-row{flex-basis:100%;justify-content:center}#verse-action-menu .verse-action-buttons{flex-basis:100%}}
@media(prefers-reduced-transparency:reduce){#verse-action-menu{background:var(--surface);backdrop-filter:none;-webkit-backdrop-filter:none}}
