/* Foundation. */
:root { --navigation-width: 235px; --paper: #f8f7f2; --surface: #fffefa; --ink: #283c33; --green: #284d40; --green-soft: #e9eee4; --muted: #69745e; --line: #e2e4d9; --gold: #a48a55; --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif; --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color-scheme: light; font-family: var(--sans); background: var(--paper); color: var(--ink); font-synthesis: none; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 15px; line-height: 1.6; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button:disabled { cursor: wait; opacity: .6; }
button, input, a { touch-action: manipulation; }
button { border: 0; }
a { color: var(--green); text-underline-offset: 3px; }
svg { display: block; flex-shrink: 0; }
button svg { pointer-events: none; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--green); outline-offset: 4px; }
input:focus-visible { outline-offset: 0; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 30; left: 14px; top: -70px; padding: 12px 18px; border-radius: 7px; background: var(--green); color: white; }
.skip-link:focus { top: 12px; }
.app-shell { display: grid; grid-template-columns: 235px minmax(0,1fr); min-height: 100dvh; }

/* Library navigation. */
.sidebar { display: flex; flex-direction: column; position: sticky; top: 0; height: 100dvh; min-height: 0; overflow-y: auto; padding: 38px 22px 24px; background: #efF0e8; border-right: 1px solid #e0e3d7; }
.brand { display: flex; align-items: center; gap: 12px; margin: 0 8px 62px; color: var(--green); text-decoration: none; }
.brand-mark { flex-shrink: 0; }
.brand-name { display: block; font-family: var(--serif); font-size: 32px; line-height: 1.05; letter-spacing: -1px; }
.brand-line { display: block; }
.brand-dot { color: var(--gold); }
.brand-tagline { display: block; margin-top: 8px; font-size: 6px; font-weight: 600; letter-spacing: .8px; white-space: nowrap; }
.sidebar-caption { margin: 0 15px 13px; font-size: 9px; font-weight: 600; letter-spacing: 1.5px; color: #8a9083; }
.library-nav { display: grid; gap: 7px; }
.nav-button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 12px 15px; border-radius: 7px; background: transparent; text-align: left; font-size: 13px; font-weight: 500; color: #6f7b6d; transition: background .16s, color .16s; }
.nav-button:hover { color: var(--green); background: #e5e9df; }
.nav-button.is-active, .nav-button[aria-pressed="true"] { background: #dfe7d9; color: var(--green); }
.sidebar-bottom { margin-top: auto; }
.sidebar-note { margin: 44px 16px 29px; }
.tiny-rule { display: block; width: 25px; height: 1px; margin-bottom: 17px; background: #a6b399; }
.sidebar-note p { font-family: var(--serif); font-size: 16px; line-height: 1.6; color: #7c8974; font-style: italic; }
.nav-button.subtle { font-size: 11px; font-weight: 400; gap: 10px; padding-left: 13px; }
.personal-label { display: flex; align-items: center; gap: 7px; margin: 16px 14px 0; padding-top: 19px; border-top: 1px solid #dce1d2; font-size: 10px; letter-spacing: .25px; color: #87907f; }
.status-dot { width: 5px; height: 5px; background: #8fa580; border-radius: 50%; }

/* Search and collection. */
#app-content { min-width: 0; padding: 40px clamp(32px, 5.1vw, 84px) 0; }
#library-view, #reader-view { max-width: 1070px; margin: 0 auto; }
.library-topline { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.eyebrow { font-size: 9px; letter-spacing: 2px; font-weight: 600; color: #788674; }
.topline-note { font-family: var(--serif); font-size: 12px; color: #8c9385; font-style: italic; }
.library-hero { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 46px 0 35px; }
.hero-kicker { display: flex; align-items: center; gap: 9px; margin-bottom: 20px; font-size: 8px; letter-spacing: 1.65px; color: #88927e; font-weight: 600; }
.hero-kicker span { width: 18px; height: 1px; background: var(--gold); }
h1 { font-family: var(--serif); font-size: clamp(36px, 3.9vw, 56px); font-weight: 400; line-height: 1.12; letter-spacing: -1.9px; }
h1 em { font-weight: 400; color: #688064; }
.hero-description { margin-top: 22px; color: var(--muted); font-size: 13px; line-height: 1.85; }
.hero-art { width: clamp(160px, 20vw, 225px); flex-shrink: 0; color: #809575; }
.hero-art svg { width: 100%; height: auto; }
.search-area { margin: 5px 0 26px; }
.search-box { display: flex; align-items: center; gap: 14px; min-height: 63px; padding: 0 20px; background: var(--surface); border: 1px solid #d9dfd0; border-radius: 10px; box-shadow: 0 3px 9px #3d513207; color: #7b8b70; transition: border-color .18s, box-shadow .18s; }
.search-box:focus-within { border-color: #8eaa81; box-shadow: 0 0 0 3px #8eaa8114; }
.search-box input { min-width: 0; width: 100%; height: 61px; padding: 0; border: 0; background: transparent; outline: none; color: var(--ink); font-size: 14px; }
.search-box input:focus-visible { outline: none; }
.search-box input::placeholder { color: #939a8c; opacity: 1; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-box .icon-button { margin-right: -11px; }
.search-shortcut { flex-shrink: 0; padding: 2px 6px; border: 1px solid #e5e8df; border-radius: 4px; color: #abb0a3; font-size: 11px; }
.search-hint { margin: 9px 2px 0; color: #959b8e; font-size: 10px; }
.library-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 25px; color: #7b8872; font-size: 11px; }
.library-summary:empty { display: none; }
.library-summary strong { color: var(--green); font-weight: 600; }
.library-summary > .eyebrow { width: 100%; margin-top: 6px; font-size: 8px; letter-spacing: 1.25px; }
.suggested-list { display: flex; flex-wrap: wrap; gap: 8px; }
.suggested-button { display: inline-flex; align-items: center; min-height: 44px; max-width: 100%; padding: 9px 13px; border: 1px solid #dde4d2; border-radius: 6px; background: #eef2e7; color: #718064; font-family: var(--serif); font-size: 13px; text-align: left; }
.suggested-button:hover { background: #e4ecda; border-color: #bcccae; }
.continue-card { position: relative; display: flex; flex-direction: column; gap: 6px; width: 100%; min-height: 83px; padding: 17px 45px 17px 20px; border: 1px solid #dce3d1; border-radius: 8px; background: #edf2e6; text-align: left; }
.continue-card:hover { background: #e6eddd; }
.continue-card .eyebrow { font-size: 8px; letter-spacing: 1.3px; }
.continue-title { font-family: var(--serif); font-size: 18px; line-height: 1.4; color: #647958; }
.continue-arrow { position: absolute; right: 21px; top: 27px; font-size: 19px; color: #8d9c7b; }
.collection-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 30px 0 16px; }
.collection-heading h2 { flex: 1; font-family: var(--serif); font-size: 23px; font-weight: 400; letter-spacing: -.5px; }
#result-count { color: #92998b; font-size: 10px; }
.coverage-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 9px 12px; border: 1px solid #dce3d1; border-radius: 6px; background: transparent; color: #7e8e6e; font-size: 10px; white-space: nowrap; }
.coverage-toggle::before { display: inline-block; width: 11px; height: 11px; border: 1px solid #a8b99a; border-radius: 3px; content: ""; }
.coverage-toggle[aria-pressed="true"] { background: #e7efdd; border-color: #c3d2b5; color: #516e3f; }
.coverage-toggle[aria-pressed="true"]::before { border-color: #6b8657; background: #6b8657; box-shadow: inset 0 0 0 2px #e7efdd; }
.coverage-toggle:hover { border-color: #aabd97; background: #eef2e7; }
.results-list { display: grid; gap: 11px; }
.ginan-card { position: relative; display: flex; align-items: center; width: 100%; min-width: 0; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); text-align: left; text-decoration: none; transition: border-color .16s, box-shadow .16s, transform .16s; }
button.ginan-card { cursor: pointer; }
.ginan-card:hover { border-color: #b8c6ae; box-shadow: 0 4px 14px #30482908; transform: translateY(-1px); }
.ginan-open { display: flex; align-items: center; flex: 1; gap: 20px; min-width: 0; min-height: 100px; padding: 22px 12px 22px 23px; border-radius: 8px; background: transparent; text-align: left; }
.card-number { align-self: flex-start; flex-shrink: 0; margin-top: 4px; font-family: var(--sans); font-size: 11px; font-weight: 600; color: var(--green); white-space: nowrap; }
.card-body { flex: 1; min-width: 0; }
.ginan-card .title { display: block; margin-bottom: 7px; padding-right: 0; font-family: var(--serif); font-size: 21px; font-weight: 400; line-height: 1.3; letter-spacing: -.25px; overflow-wrap: anywhere; }
.ginan-card .subtitle { color: #8b9383; font-size: 10px; line-height: 1.5; }
.alternate-title { display: block; margin-top: 7px; color: #9aa18e; font-family: var(--serif); font-size: 12px; font-style: italic; }
.ginan-card .availability { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.ginan-card .card-arrow, .ginan-card > .chevron { display: block; flex-shrink: 0; color: #b0bba5; }
.card-arrow svg { width: 16px; height: 16px; }
.ginan-card .save-button { margin-right: 12px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border: 1px solid #e4e9db; border-radius: 4px; background: #f5f7f0; color: #798c69; font-size: 9px; font-weight: 400; letter-spacing: .1px; line-height: 1.4; }
.badge.muted, .badge.unavailable { color: #979b90; background: #f7f7f3; border-color: #eceee5; }
.ginan-card mark { color: inherit; background: #e9e5bf; border-radius: 2px; }
.card-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.card-save { position: relative; z-index: 1; }
.empty-state { padding: 46px 24px; border: 1px dashed #d5dccb; border-radius: 10px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-state h2, .empty-state h3 { margin-bottom: 8px; font-family: var(--serif); font-weight: 400; color: var(--green); font-size: 25px; }
.empty-state .button { margin-top: 18px; }
.library-footer { padding: 42px 0 29px; text-align: center; color: #939b89; }
.footer-flourish { display: block; margin-bottom: 10px; color: #a6b18f; font-size: 19px; }
.library-footer > p { font-family: var(--serif); font-size: 12px; font-style: italic; }
.library-footer .source-credit { margin-top: 9px; font-family: var(--sans); font-size: 9px; font-style: normal; color: #9da494; }
.source-credit a { text-decoration: none; color: inherit; }
.source-credit a:hover { text-decoration: underline; }

/* Reader and parallel verse columns. */
.reader-topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 0 0 22px; border-bottom: 1px solid var(--line); }
.back-button { gap: 9px; padding-left: 0 !important; border: none !important; background: transparent !important; }
.reader-topbar-label { color: #96a08c; font-size: 8px; letter-spacing: 1.5px; }
.reader-heading { padding: 36px 0 27px; }
.reader-heading > .eyebrow { margin-bottom: 18px; }
.reader-heading > .reader-ginan-id { font-size: 13px; letter-spacing: .6px; color: var(--green); }
.reader-heading h1, h1.reader-heading { font-size: clamp(32px, 3.8vw, 48px); line-height: 1.2; overflow-wrap: anywhere; }
.reader-meta { margin-top: 14px; color: #849077; font-size: 12px; }
.resource-statuses { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; max-width: 510px; margin: 22px 0 0; padding: 0; list-style: none; }
.resource-status { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; padding: 12px 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-align: center; }
.resource-name { font-size: 12px; font-weight: 600; line-height: 1.5; }
.resource-symbol { font-size: 25px; line-height: 1.2; color: var(--green); }
.resource-state, .resource-detail { font-size: 12px; line-height: 1.45; overflow-wrap: anywhere; }
.resource-detail { color: var(--muted); }
.resource-status[data-status="missing"] .resource-symbol { color: var(--muted); }
.resource-status:is([data-status="partial"], [data-status="error"]) { background: var(--reading-warning, #f5efdf); color: var(--reading-warning-ink, #655027); }
.resource-status:is([data-status="partial"], [data-status="error"]) .resource-symbol { color: inherit; }
.content-availability-notes { margin-top: 14px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.content-availability-notes p + p { margin-top: 5px; }
.content-availability-notes .button-secondary { margin-top: 8px; }
.reader-source { margin: 17px 0; color: #8a927f; font-size: 11px; }
.reader-source p + p { margin-top: 8px; }
.reader-source { margin: 15px 0 35px; padding: 22px 0 0; border-top: 1px solid var(--line); }
.reader-source h2 { margin-bottom: 14px; font-family: var(--serif); font-size: 24px; font-weight: 400; color: #596d4d; }
.source-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 16px; }
.source-links a { display: inline-flex; align-items: center; min-height: 44px; }
.source-note { color: #8b957f; font-size: 11px; line-height: 1.8; }
.source-link { color: #7a8c6c; font-size: 11px; text-decoration-thickness: 1px; }
.reader-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 26px; }
.button, .button-secondary { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 17px; border-radius: 6px; text-decoration: none; font-size: 12px; line-height: 1.5; }
.button { border: 1px solid var(--green); background: var(--green); color: #fffefa; }
.button:hover { background: #355e4b; }
.button-secondary { border: 1px solid #dbe1d2; background: transparent; color: #6d7f60; }
.button-secondary:hover { border-color: #9fb191; background: #edf1e7; }
.icon-button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; width: 44px; min-height: 44px; height: 44px; padding: 10px; border: none; border-radius: 7px; background: transparent; color: #809172; flex-shrink: 0; }
.icon-button:hover { background: #e9eee2; }
.icon-button svg { width: 19px; height: 19px; }
.icon-button[aria-pressed="true"] { color: var(--green); background: #e2ebda; }
.icon-button.is-saved svg { fill: #cddcbd; }
.reader-intro { margin: 20px 0; padding: 19px 22px; border-radius: 7px; background: #eef1e7; color: #6e7d61; font-size: 12px; }
.verse-headings, .verse-header, .verse-labels { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); margin-top: 30px; padding: 16px 0 16px 30px; border-top: 1px solid #cbd4c1; border-bottom: 1px solid #cbd4c1; color: #819070; font-size: 9px; font-weight: 600; letter-spacing: 1.3px; text-transform: uppercase; }
.verse-headings > :last-child, .verse-header > :last-child, .verse-labels > :last-child { padding-left: 27px; }
.verse-row { position: relative; display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 0; padding: 26px 0 26px 30px; border-bottom: 1px solid var(--line); }
.verse-number { position: absolute; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; left: -14px; top: 18px; padding: 0; border-radius: 6px; background: transparent; color: #a4ad99; font-family: var(--sans); font-size: 10px; line-height: 1.5; }
.verse-number:hover { background: #e5eddc; }
.verse-text, .verse-meaning { min-width: 0; margin: 0; font-size: var(--reading-size, 17px); line-height: 1.85; overflow-wrap: anywhere; white-space: pre-line; }
.verse-text { padding-right: 27px; font-family: var(--serif); color: #334936; }
.verse-meaning { padding-left: 27px; border-left: 1px solid var(--line); font-family: var(--serif); color: #65735c; }
.verse-text p + p, .verse-meaning p + p { margin-top: 12px; }
.verse-row.is-active, .verse-row.active-verse { background: #edf2e6; border-radius: 5px; }
.verse-row.active-verse .verse-number { color: #4f6f3d; font-weight: 600; }
.verse-source-label { display: block; margin-bottom: 8px; color: var(--muted); font: 11px/1.5 var(--sans); }
.verse-source-label-transliteration { grid-column: 1; }
.verse-source-label-meaning { grid-column: 2; padding-left: 27px; }
.verse-alignment-note, .verse-row > .printed-source-notes { grid-column: 1 / -1; margin-top: 12px; }
.printed-source-notes { margin: 12px 0; }
.printed-source-notes summary { cursor: pointer; min-height: 44px; padding: 10px 0; color: var(--muted); font: 12px/1.7 var(--sans); }
.printed-source-notes p { white-space: pre-line; }
.printed-source-notes p + p { margin-top: 10px; }
.unaligned-source-passages { margin-top: 28px; }
.unaligned-source-passages h2 { margin-bottom: 10px; font: 24px/1.4 var(--serif); }
.unaligned-source-columns { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 27px; margin-top: 20px; }
.unaligned-source-column { min-width: 0; }
.unaligned-source-block { padding: 18px 0; border-bottom: 1px solid var(--line); }
.source-passage-text { margin-top: 8px; font: var(--reading-size, 17px)/1.85 var(--serif); white-space: pre-line; overflow-wrap: anywhere; }
.stacked-reading .unaligned-source-columns { grid-template-columns: minmax(0,1fr); }
.stacked-reading .has-source-labels .verse-source-label-transliteration { grid-column: 1; grid-row: 1; }
.stacked-reading .has-source-labels .verse-text { grid-column: 1; grid-row: 2; }
.stacked-reading .has-source-labels .verse-source-label-meaning { grid-column: 1; grid-row: 3; margin-top: 12px; padding-left: 0; }
.stacked-reading .has-source-labels .verse-meaning { grid-column: 1; grid-row: 4; margin-top: 0; }
.verse-translation-note { grid-column: 2; margin: 8px 0 0; padding-left: 27px; }
.stacked-reading .verse-translation-note { grid-column: 1; padding-left: 0; }
.stacked-reading .verse-row { grid-template-columns: minmax(0,1fr); }
.stacked-reading .verse-text { padding-right: 0; }
.stacked-reading .verse-meaning { margin-top: 13px; padding: 13px 0 0; border-left: 0; border-top: 1px solid #e2e6d9; }
.resume-verse { display: block; min-height: 44px; margin: 12px 0 0; padding: 7px 13px; border-radius: 6px; background: #e7eddf; color: #778965; font-size: 11px; }
.reading-end { margin: 30px 0; color: #9dad8b; font-size: 12px; text-align: center; letter-spacing: 8px; }
.loading-message { margin-top: 35px; color: #8c987e; font-family: var(--serif); font-size: 21px; }
.listening-note { padding: 16px 19px; margin: 0 0 23px; border: 1px solid #dee5d5; border-radius: 7px; background: #eef2e8; color: #819171; font-size: 12px; }
.listening-note a { display: inline; font-size: inherit; color: #5e7a4c; }
.audio-section { margin: 17px 0 24px; padding: 19px 21px; border: 1px solid #dce5d2; border-radius: 8px; background: #edf2e6; }
.audio-section .source-note { margin-top: 5px; }
.recording-details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--muted); font-size: 11px; }
.recording-details summary::before { content: '+'; margin-right: 8px; font-size: 17px; }
.recording-details[open] summary::before { content: '−'; }
.reader-notes { margin: 30px 0; padding: 20px 0; color: #85917a; font-size: 12px; }
.reader-notes h2 { margin-bottom: 10px; font-family: var(--serif); font-size: 23px; font-weight: 400; }
.audio-player { padding: 19px 22px; border: 1px solid #d8e1ce; border-radius: 9px; background: #edf2e6; margin: 18px 0 25px; }
.audio-player audio, audio { width: 100%; max-width: 100%; margin-top: 12px; height: 42px; }
.audio-label { font-size: 10px; font-weight: 600; letter-spacing: 1px; color: #6c7f60; }
.audio-player select, .reader-toolbar select { max-width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid #cfd9c3; border-radius: 5px; background: var(--surface); color: var(--green); font-size: 12px; }

/* Dialogs and notices. */
dialog { width: min(500px, calc(100% - 32px)); max-height: calc(100dvh - 48px); overflow: auto; padding: 40px 32px 30px; border: 1px solid #dce2d4; border-radius: 13px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 100px #1a302833; }
dialog::backdrop { background: #172a2370; backdrop-filter: blur(3px); }
.dialog-close { position: absolute; top: 10px; right: 10px; }
#dialog-content h2, #dialog-content h1 { margin: 0 25px 19px 0; font-family: var(--serif); font-weight: 400; font-size: 29px; line-height: 1.25; }
#dialog-content h3 { margin: 22px 0 8px; font-size: 14px; }
#dialog-content p, #dialog-content li { color: #77836d; font-size: 13px; line-height: 1.8; }
#dialog-content p + p { margin-top: 13px; }
#dialog-content ol, #dialog-content ul { padding-left: 21px; }
#dialog-content li + li { margin-top: 10px; }
#dialog-content .button { margin-top: 22px; }
.status-message { position: fixed; bottom: 23px; left: 50%; z-index: 20; width: max-content; max-width: calc(100vw - 32px); margin: 0; padding: 11px 18px; border-radius: 7px; background: #284d40; color: #fffefa; box-shadow: 0 6px 24px #1e30282a; font-size: 12px; text-align: center; transform: translateX(-50%); }
.status-message:empty { display: none; }
.noscript-message { position: fixed; left: 12px; right: 12px; bottom: 12px; padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: center; }

/* Keep small text clear against the warm paper. */
.eyebrow, .hero-kicker, .search-hint, #result-count, .ginan-card .subtitle, .alternate-title, .reader-meta, .reader-source, .source-note, .source-link, .verse-labels, .coverage-toggle, .suggested-button, .listening-note, .library-footer .source-credit, .library-footer > p, #dialog-content p, #dialog-content li { color: var(--muted); }
.search-box input::placeholder { color: #717c66; }
.search-hint { color: #747e69; }

/* Tablet layout. */
@media (min-width: 1500px) {
:root { --navigation-width: 255px; }
.app-shell { grid-template-columns: 255px minmax(0,1fr); }
#app-content { padding-top: 48px; }
.library-hero { padding-top: 57px; padding-bottom: 45px; }
.ginan-open { padding: 25px 14px 25px 29px; }
}
@media (max-width: 1000px) {
:root { --navigation-width: 202px; }
.app-shell { grid-template-columns: 202px minmax(0,1fr); }
.sidebar { padding-left: 16px; padding-right: 16px; }
.brand { gap: 9px; margin-left: 6px; }
.brand-mark { width: 33px; height: 33px; }
.brand-name { font-size: 29px; }
.brand-tagline { font-size: 5.5px; letter-spacing: .8px; }
#app-content { padding-left: 33px; padding-right: 33px; }
.hero-art { width: 150px; }
.hero-kicker { font-size: 7px; letter-spacing: 1.2px; }
.topline-note { display: none; }
.hero-description { font-size: 12px; }
.ginan-card .title { font-size: 20px; }
}

/* iPhone layout. */
@media (max-width: 700px), (max-height: 540px) and (pointer: coarse) {
:root { --navigation-width: 0px; }
.app-shell { display: block; }
.sidebar { position: relative; height: auto; min-height: 0; padding: calc(22px + env(safe-area-inset-top)) 23px 20px; border-right: 0; border-bottom: 1px solid #e1e5d8; background: var(--paper); }
.brand { width: fit-content; max-width: calc(100% - 90px); margin: 0; gap: 10px; }
.brand-mark { width: 31px; height: 31px; }
.brand-name { font-size: 29px; }
.brand-tagline { margin-top: 6px; font-size: 5.5px; letter-spacing: .8px; }
.sidebar-caption, .sidebar-note, .personal-label { display: none; }
.library-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center; gap: 8px; padding: 10px 24px calc(10px + env(safe-area-inset-bottom)); background: #f8f7f2f5; border-top: 1px solid #dfe4d5; backdrop-filter: blur(12px); }
.library-nav .nav-button { width: min(180px, 50%); justify-content: center; min-height: 44px; gap: 9px; font-size: 12px; padding: 10px 15px; }
.library-nav .nav-button svg { width: 18px; height: 18px; }
.sidebar-bottom { position: absolute; right: 17px; top: calc(25px + env(safe-area-inset-top)); display: flex; gap: 0; }
.sidebar-bottom .nav-button { width: 44px; min-width: 44px; height: 44px; padding: 12px; justify-content: center; }
.sidebar-bottom .nav-button span { display: none; }
#app-content { padding: 26px 23px calc(82px + env(safe-area-inset-bottom)); }
.library-topline { padding: 0; border: 0; }
.eyebrow { font-size: 8px; letter-spacing: 1.65px; }
.library-hero { position: relative; gap: 0; padding: 31px 0 28px; }
.hero-kicker { display: none; }
h1 { font-size: clamp(33px, 9.3vw, 48px); line-height: 1.15; letter-spacing: -1.3px; }
.hero-art { position: absolute; width: 110px; right: -5px; top: 25px; opacity: .45; pointer-events: none; display: none; }
.hero-description { margin-top: 16px; font-size: 12px; line-height: 1.75; }
.desktop-break { display: none; }
.search-area { margin: 0 0 22px; }
.search-box { min-height: 58px; gap: 11px; padding: 0 15px; border-radius: 8px; }
.search-box > svg { width: 20px; height: 20px; }
.search-box input { height: 56px; font-size: 16px; letter-spacing: -.3px; }
.search-box input::placeholder { font-size: 12px; letter-spacing: 0; }
.search-shortcut { display: none; }
.search-hint { font-size: 9px; margin-top: 8px; }
.library-summary { font-size: 10px; gap: 6px 12px; margin-bottom: 21px; }
.collection-heading { display: grid; grid-template-columns: minmax(0,1fr) auto; margin: 24px 0 14px; gap: 2px 8px; }
.collection-heading h2 { font-size: 22px; }
#result-count { grid-column: 1; grid-row: 2; font-size: 9px; text-align: left; }
.coverage-toggle { grid-column: 2; grid-row: 1 / 3; padding: 8px 10px; font-size: 9px; }
.results-list { gap: 10px; }
.ginan-card { padding: 0; border-radius: 8px; }
.ginan-open { min-height: 99px; padding: 18px 4px 18px 17px; gap: 12px; }
.card-number { margin-top: 3px; font-size: 10px; }
.ginan-card .title { font-size: 19px; padding-right: 0; }
.ginan-card .subtitle { font-size: 9px; }
.ginan-card .save-button { width: 44px; margin-right: 5px; }
.ginan-card .card-arrow { display: none; }
.suggested-list { gap: 6px; }
.suggested-button { font-size: 12px; padding: 8px 10px; }
.alternate-title { font-size: 11px; }
.ginan-card .availability { margin-top: 12px; gap: 5px; }
.badge { font-size: 8px; padding: 3px 6px; }
.ginan-card .card-arrow, .ginan-card > .chevron { top: 26px; right: 18px; }
.library-footer { padding: 33px 0 18px; }
.library-footer .source-credit { font-size: 8px; max-width: 280px; margin: 8px auto 0; }
.reader-topbar { padding-bottom: 10px; }
.reader-topbar-label { display: none; }
.reader-heading { padding: 24px 0 12px; }
.reader-heading > .eyebrow { margin-bottom: 12px; }
.reader-heading h1, h1.reader-heading { font-size: 33px; }
.reader-meta { margin-top: 11px; font-size: 10px; }
.reader-toolbar { gap: 7px; margin-bottom: 20px; }
.button, .button-secondary { font-size: 11px; padding: 10px 12px; }
.verse-headings, .verse-header, .verse-labels { margin-top: 23px; padding: 14px 0 14px 30px; font-size: 8px; letter-spacing: .65px; }
.verse-headings > :last-child, .verse-header > :last-child, .verse-labels > :last-child { padding-left: 15px; }
.verse-row { padding: 20px 0 20px 30px; }
.verse-number { top: 14px; font-size: 9px; }
.verse-text, .verse-meaning { font-size: var(--reading-size, 16px); line-height: 1.8; }
.verse-text { padding-right: 15px; }
.verse-meaning { padding-left: 15px; }
.verse-translation-note { padding-left: 15px; }
.verse-source-label-meaning { padding-left: 15px; }
.unaligned-source-columns { gap: 15px; }
.reader-intro { padding: 15px 16px; font-size: 11px; }
.reader-source { font-size: 10px; }
.source-link { font-size: 10px; }
.audio-player { padding: 16px 14px; }
.status-message { bottom: calc(78px + env(safe-area-inset-bottom)); font-size: 11px; }
dialog { padding: 42px 24px 28px; }
}
@media (max-width: 360px) {
.sidebar { padding-left: 17px; padding-right: 17px; }
#app-content { padding-left: 17px; padding-right: 17px; }
h1 { font-size: 33px; }
.ginan-open { padding-left: 13px; gap: 10px; }
.verse-text, .verse-meaning { font-size: var(--reading-size, 15px); line-height: 1.8; }
.verse-row { padding-left: 30px; }
.verse-headings, .verse-header, .verse-labels { padding-left: 30px; font-size: 7px; }
.verse-text { padding-right: 11px; }
.verse-meaning, .verse-headings > :last-child, .verse-header > :last-child, .verse-labels > :last-child { padding-left: 11px; }
.verse-translation-note { padding-left: 11px; }
.verse-source-label-meaning { padding-left: 11px; }
.unaligned-source-columns { gap: 11px; }
}
@media (prefers-reduced-motion: reduce) {
html { scroll-behavior: auto; }
*, *::before, *::after { transition: none !important; animation: none !important; }
.ginan-card:hover { transform: none; }
}
@media print {
.sidebar, .reader-topbar, .reader-toolbar, .audio-player, .status-message, .library-footer { display: none !important; }
:root { --navigation-width: 0px; }
.app-shell { display: block; }
#app-content { padding: 0; }
body { background: white; }
.verse-row { break-inside: avoid; }
.verse-text, .verse-meaning { color: #222; }
}
/* Keep the source refrain above the numbered verses. */
.refrain-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 22px; padding: 24px 16px; background: var(--sage-light, #edf1e5); border-radius: 8px; margin: 12px 0; }
.refrain-row h2 { grid-column: 1 / -1; margin: 0 0 12px; }
.excerpt-notice { padding: 12px 16px; background: #edf1e5; border: 1px solid #d6decd; border-radius: 8px; font: 13px/1.6 -apple-system, BlinkMacSystemFont, sans-serif; color: #435a42; }
.section-heading { margin: 32px 0 12px; font: 24px/1.4 Georgia, serif; color: #284d40; }
.source-warning { padding: 12px 16px; background: #f5efdf; border: 1px solid #dfd1ae; border-radius: 8px; font: 13px/1.6 -apple-system, BlinkMacSystemFont, sans-serif; color: #655027; }
.refrain-row p { margin: 0; overflow-wrap: anywhere; }
.stacked-reading .refrain-row { grid-template-columns: minmax(0, 1fr); row-gap: 14px; }
@media (max-width: 480px) { .refrain-row { column-gap: 16px; padding: 18px 10px; } }

/* Put search and the complete alphabetical catalogue first. */
.library-intro { padding: 4px 0 25px; }
.library-intro .eyebrow { margin-bottom: 13px; }
.library-intro h1 { font-size: 44px; line-height: 1.15; letter-spacing: -1.3px; }
.search-area { margin-top: 0; margin-bottom: 14px; }
.search-box { min-height: 68px; border-color: #acbd9e; box-shadow: 0 4px 15px #284d4008; }
.search-box input { height: 66px; font-size: 18px; }
.search-box input::placeholder { font-size: inherit; }
.search-hint { margin-top: 9px; font-size: 11px; }
.browse-action-row { display: flex; align-items: center; gap: 18px; margin: 2px 0 24px; }
.browse-button { display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 7px 1px; background: transparent; color: var(--green); font-size: 13px; font-weight: 500; text-align: left; }
.browse-button:hover { color: #64844d; }
.browse-button > :last-child { margin-left: 5px; color: #879b75; font-size: 18px; }
.browse-icon { display: inline-flex; align-items: center; justify-content: center; width: 35px; height: 30px; border: 1px solid #d8e2cf; border-radius: 5px; background: #ecf1e5; font-size: 10px; letter-spacing: .3px; }
.browse-action-note { color: var(--muted); font-family: var(--serif); font-size: 13px; font-style: italic; }
.collection-heading { align-items: baseline; margin-top: 20px; }
#browse-section, .alphabet-group { scroll-margin-top: 20px; }
.alphabet-nav { display: flex; flex-wrap: wrap; gap: 4px; padding-bottom: 22px; margin-bottom: 0; border-bottom: 1px solid var(--line); }
.alphabet-letter { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; border: 1px solid #dce3d2; border-radius: 6px; background: #f1f4eb; color: #537048; font-size: 13px; text-decoration: none; }
.alphabet-letter:hover, .alphabet-letter:focus-visible { background: #dce8d2; border-color: #b0c49d; }
.alphabet-group { min-width: 0; }
.letter-heading { display: flex; align-items: baseline; gap: 14px; margin: 22px 0 12px; color: #496242; font-family: var(--serif); font-size: 28px; font-weight: 400; }
.letter-count { font-family: var(--sans); font-size: 10px; color: var(--muted); letter-spacing: .1px; }
.letter-results { display: grid; gap: 9px; }
.continue-card { min-height: 67px; padding-top: 11px; padding-bottom: 11px; }
.continue-card .continue-title { font-size: 16px; }
.continue-arrow { top: 20px; }
.library-summary { margin-bottom: 14px; }
.ginan-open { min-height: 88px; padding-top: 18px; padding-bottom: 18px; }
.ginan-card .subtitle { font-size: 11px; }
.source-warning, .excerpt-notice, .translation-notice { margin-top: 12px; }
.translation-notice { padding: 12px 16px; background: #edf1e5; border: 1px solid #d6decd; border-radius: 8px; font-size: 13px; line-height: 1.6; color: #435a42; }

/* Keep the recitation controls visible while the verses scroll. */
.sticky-audio { position: sticky; top: max(10px, env(safe-area-inset-top)); z-index: 8; margin: 13px 0 0; padding: 10px 14px; border: 1px solid #cddcbe; border-radius: 9px; background: #edf2e6fa; box-shadow: 0 5px 18px #233e2210; backdrop-filter: blur(12px); }
.audio-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; min-width: 0; }
.audio-heading .eyebrow { flex-shrink: 0; font-size: 8px; letter-spacing: 1.25px; }
.recording-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.sticky-audio audio { display: block; height: 44px; margin: 6px 0 0; }
.recording-details { margin: 0 2px 20px; }
.recording-details[open] { padding-bottom: 15px; }
.recording-details .source-link { display: inline-flex; min-height: 44px; align-items: center; }
.verse-row, .section-heading, .refrain-row, .unaligned-source-block { scroll-margin-top: calc(112px + env(safe-area-inset-top)); }
.verse-labels { scroll-margin-top: calc(100px + env(safe-area-inset-top)); }
@media (max-width: 700px), (max-height: 540px) and (pointer: coarse) {
.sidebar { padding-top: calc(16px + env(safe-area-inset-top)); padding-bottom: 15px; }
.sidebar-bottom { top: calc(17px + env(safe-area-inset-top)); }
#app-content { padding-top: 24px; }
.library-intro { padding: 0 0 19px; }
.library-intro .eyebrow { display: none; }
.library-intro h1 { font-size: 31px; letter-spacing: -.8px; }
.search-box { min-height: 62px; padding-left: 14px; padding-right: 14px; }
.search-box input { height: 60px; font-size: 16px; letter-spacing: -.25px; }
.search-box input::placeholder { font-size: 16px; letter-spacing: -.4px; }
.search-hint { font-size: 10px; line-height: 1.6; }
.browse-action-row { margin-bottom: 14px; }
.browse-button { font-size: 13px; }
.browse-action-note { display: none; }
.collection-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 12px; margin-top: 19px; }
.collection-heading h2 { flex: 1 0 145px; font-size: 23px; }
#result-count { font-size: 10px; }
.alphabet-nav { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 5px; padding-bottom: 18px; }
.alphabet-letter { min-width: 0; min-height: 44px; font-size: 13px; }
.letter-heading { margin-top: 18px; margin-bottom: 12px; }
.letter-results { gap: 8px; }
.ginan-open { min-height: 87px; padding-top: 16px; padding-bottom: 16px; }
.ginan-card .subtitle { font-size: 10px; line-height: 1.6; }
.library-summary { margin-bottom: 16px; }
.continue-card { min-height: 66px; }
.sticky-audio { margin-top: 10px; padding: 9px 10px; top: max(6px, env(safe-area-inset-top)); }
.audio-heading { gap: 8px; }
.audio-heading .eyebrow { font-size: 8px; }
.recording-label { font-size: 9px; }
.recording-details summary { font-size: 10px; }
.verse-labels { margin-top: 16px; }
.source-warning, .excerpt-notice, .translation-notice { font-size: 12px; }
}
@media (max-width: 360px) {
.alphabet-nav { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.search-box { gap: 8px; padding-left: 12px; padding-right: 12px; }
.search-box input::placeholder { letter-spacing: -.7px; }
.search-box > svg { width: 18px; height: 18px; }
.verse-labels { font-size: 8px; letter-spacing: .2px; }
}
@media print {
.sticky-audio, .recording-details, .browse-action-row, .alphabet-nav { display: none !important; }
}

/* Keep secondary tools below the large search field. */
.search-options, .library-actions, .recent-searches, .topic-searches { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search-options { justify-content: space-between; margin: 0 0 8px; }
.search-options label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.search-options select, .filter-fields select { min-width: 0; max-width: 100%; min-height: 44px; padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font-size: 16px; }
.library-actions { margin-bottom: 16px; }
.library-actions .button-secondary, .search-options .button-secondary { min-height: 44px; padding: 8px 12px; font-size: 12px; }
.library-filters { margin-bottom: 20px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.library-filters > summary { min-height: 48px; padding: 12px 0; color: var(--green); font-size: 13px; cursor: pointer; }
.library-filters[open] { padding-bottom: 14px; }
.filter-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.filter-fields label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.library-filters .source-note { margin-top: 10px; }
.topic-searches { margin-top: 12px; font-size: 12px; color: var(--muted); }
.topic-searches > span { flex-basis: 100%; }
.topic-searches button, .recent-search-chip { min-height: 44px; max-width: 100%; padding: 8px 12px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); color: var(--green); font-size: 12px; overflow-wrap: anywhere; }
.recent-searches { margin: 12px 0; }
.recent-searches > span { width: 100%; }
.opening-preview { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-top: 7px; font-size: 13px; line-height: 1.55; color: var(--muted); }
.match-context { font-weight: 600; }
.personal-menu { display: grid; gap: 10px; margin-top: 16px; }
.personal-menu .button-secondary { min-height: 44px; margin-top: 0; padding: 10px 14px; text-align: left; }
.verse-actions-button { min-height: 44px; padding: 8px 10px; border-radius: 6px; background: transparent; color: var(--green); font-size: 12px; }
.verse-actions-button:hover { background: var(--green-soft); }
.verse-row.playing-verse { box-shadow: inset 3px 0 0 var(--green); background: var(--reading-highlight, var(--green-soft)); }
.correction-label { display: grid; gap: 8px; margin: 18px 0; font-size: 14px; }
.correction-input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--ink); font: 16px/1.5 var(--sans); resize: vertical; }
:root[data-reading-palette] .alphabet-letter { background: var(--surface); color: var(--green); border-color: var(--line); }
:root[data-reading-palette] .alphabet-letter:hover { background: var(--green-soft); }
:root[data-reading-palette] .playback-button[aria-pressed="true"] { color: var(--reading-button-ink); }
:root[data-reading-palette] .playback-status { color: var(--reading-warning-ink); }
:root[data-reading-palette] .playback-mini { background: var(--reading-highlight); }
@media (max-width: 700px), (max-height: 540px) and (pointer: coarse) {
.search-options { gap: 6px; }
.search-options label { flex: 1 1 170px; }
.search-options select { flex: 1; width: 140px; font-size: 16px; }
.filter-fields { grid-template-columns: 1fr; }
.library-actions { gap: 6px; }
.library-actions .button-secondary { flex: 1 1 auto; }
.opening-preview { font-size: 12px; }
.reader-toolbar > .button-secondary { min-height: 44px; }
}
@media print { .pl-verse-tools, .verse-actions-button, .library-actions, .library-filters, #mini-player { display: none !important; } }

/* Keep a followed verse below the measured audio controls. */
.verse-row, .section-heading, .refrain-row, .verse-labels { scroll-margin-top: calc(var(--playback-sticky-height, 112px) + 22px + env(safe-area-inset-top)); }

/* Personal highlights retain contrast in the dark reading theme. */
:root[data-reading-palette="dark"] .verse-row.pl-highlight-gold { background: #443c25; }
:root[data-reading-palette="dark"] .verse-row.pl-highlight-green { background: #273f31; }
:root[data-reading-palette="dark"] .verse-row.pl-highlight-blue { background: #273b4c; }

/* Use a full touch target for select controls in iPhone Safari. */
:is(.search-options, .filter-fields, .reading-settings, .playback-player, .pl-panel) select { -webkit-appearance: none; appearance: none; min-height: 44px; height: 44px; padding-right: 30px; border: 1px solid var(--line); border-radius: 7px; background-color: var(--surface); background-image: linear-gradient(45deg, transparent 50%, var(--green) 50%), linear-gradient(135deg, var(--green) 50%, transparent 50%); background-position: calc(100% - 14px) 19px, calc(100% - 9px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }

/* Let source controls scroll clear of the player and the phone navigation. */
.source-tools, .source-tools summary, .reader-source, .pl-verse-tools { scroll-margin-top: calc(var(--playback-sticky-height, 112px) + 22px + env(safe-area-inset-top)); scroll-margin-bottom: calc(80px + env(safe-area-inset-bottom)); }

/* Keep Close visible while long instructions and settings scroll. */
dialog { padding: 56px 24px 24px; overflow: hidden; }
#dialog-content { max-height: calc(100dvh - 130px); min-width: 0; padding: 2px 4px; overflow-y: auto; overscroll-behavior: contain; }
.dialog-close { z-index: 2; background: var(--surface); }
