/* Graced — design tokens and components.
   The palette and type come from the Appetiser Apps hi-fi screens: Linen ground, Sage primary, Brass accent,
   Spectral italic for titles, Literata for reading and UI. A church (tenant) overrides the custom properties
   at runtime (AppState.ApplyTheme), so every colour below must come from a token. */

@font-face { font-family: "Spectral"; font-style: italic; font-weight: 300; font-display: swap; src: url(../fonts/spectral-latin-300-italic.woff2) format("woff2"); }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 400; font-display: swap; src: url(../fonts/spectral-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Spectral"; font-style: italic; font-weight: 500; font-display: swap; src: url(../fonts/spectral-latin-500-italic.woff2) format("woff2"); }
@font-face { font-family: "Spectral"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/spectral-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 400; font-display: swap; src: url(../fonts/literata-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Literata"; font-style: italic; font-weight: 400; font-display: swap; src: url(../fonts/literata-latin-400-italic.woff2) format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/literata-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Literata"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/literata-latin-600-normal.woff2) format("woff2"); }

:root {
    color-scheme: light;
    /* surfaces */
    --ground: #F3EDE1;        /* behind cards: a shade under linen */
    --linen: #F7F2E8;         /* the page */
    --paper: #FCF9F2;         /* cards, sheets */
    --paper-sunk: #EFE8DA;    /* wells, inputs */
    --rule: #E5DCCB;
    --rule-strong: #D6CBB6;
    /* ink */
    --ink: #2B2924;
    --ink-2: #5C574C;
    --ink-3: #7D7666;         /* large or decorative only */
    /* brand */
    --primary: #4E5E52;       /* Sage */
    --primary-ink: #3D4A40;
    --on-primary: #F7F2E8;
    --primary-wash: #E2E5DA;
    --accent: #C2A04F;        /* Brass */
    --accent-ink: #7A6224;
    --accent-wash: #F2E6C4;
    /* highlights: per-line rounded marks in the reader */
    --hl-brass: #F1E2B4;  --hl-brass-edge: #E2CC8A;
    --hl-sage: #DCE5D3;   --hl-sage-edge: #BFCDB3;
    --hl-rose: #F3DAD0;   --hl-rose-edge: #E3BCAE;
    --hl-sky: #D7E4EA;    --hl-sky-edge: #B6CCD6;
    /* people colours */
    --m-sage: #6E8A73; --m-brass: #B8913A; --m-sky: #5F8FA6; --m-rose: #B9705E;
    /* map */
    --sea: #B9CFC9; --sea-deep: #9DBDB6; --land: #EADDBF; --land-edge: #CDB98F; --river: #8FB2AE; --route: #5A4A2C;

    --shadow-1: 0 1px 1px rgba(80, 62, 26, .05), 0 2px 8px -2px rgba(80, 62, 26, .10);
    --shadow-2: 0 2px 4px rgba(80, 62, 26, .06), 0 14px 32px -10px rgba(80, 62, 26, .26);
    --shadow-sheet: 0 -8px 40px -12px rgba(40, 30, 10, .30);
    --scrim: rgba(43, 36, 24, .34);

    --f-display: "Spectral", "Iowan Old Style", Georgia, serif;
    --f-text: "Literata", "Iowan Old Style", Georgia, serif;
    --reader-scale: 1;

    --r-sm: 10px; --r-md: 14px; --r-lg: 18px; --r-xl: 26px;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --tabbar-h: 64px;
    --kb: 0px;
    --ease-out: cubic-bezier(.2, .8, .2, 1);
    --ease-spring: cubic-bezier(.32, 1.1, .5, 1);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme=light]) {
        color-scheme: dark;
        --ground: #161A17; --linen: #1B201C; --paper: #232924; --paper-sunk: #2A312B;
        --rule: #333B34; --rule-strong: #414A42;
        --ink: #ECE6D8; --ink-2: #B9B2A2; --ink-3: #8F8878;
        --primary: #A9BEA9; --primary-ink: #C3D4C1; --on-primary: #1B201C; --primary-wash: #2C352E;
        --accent: #D4B262; --accent-ink: #E2C680; --accent-wash: #3A3424;
        --hl-brass: #4A4026; --hl-brass-edge: #6A5A30; --hl-sage: #2F3D33; --hl-sage-edge: #43574A;
        --hl-rose: #4A3530; --hl-rose-edge: #664840; --hl-sky: #2C3D45; --hl-sky-edge: #3F5763;
        --m-sage: #8FAE94; --m-brass: #D4B262; --m-sky: #86B3C8; --m-rose: #D59481;
        --sea: #24353A; --sea-deep: #1D2C30; --land: #3A3627; --land-edge: #575036; --river: #3F5F63; --route: #E2C680;
        --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 10px 30px -10px rgba(0,0,0,.6); --scrim: rgba(0,0,0,.5);
    }
}
:root[data-theme=dark] {
    color-scheme: dark;
    --ground: #161A17; --linen: #1B201C; --paper: #232924; --paper-sunk: #2A312B;
    --rule: #333B34; --rule-strong: #414A42;
    --ink: #ECE6D8; --ink-2: #B9B2A2; --ink-3: #8F8878;
    --primary: #A9BEA9; --primary-ink: #C3D4C1; --on-primary: #1B201C; --primary-wash: #2C352E;
    --accent: #D4B262; --accent-ink: #E2C680; --accent-wash: #3A3424;
    --hl-brass: #4A4026; --hl-brass-edge: #6A5A30; --hl-sage: #2F3D33; --hl-sage-edge: #43574A;
    --hl-rose: #4A3530; --hl-rose-edge: #664840; --hl-sky: #2C3D45; --hl-sky-edge: #3F5763;
    --m-sage: #8FAE94; --m-brass: #D4B262; --m-sky: #86B3C8; --m-rose: #D59481;
    --sea: #24353A; --sea-deep: #1D2C30; --land: #3A3627; --land-edge: #575036; --river: #3F5F63; --route: #E2C680;
    --shadow-1: 0 1px 2px rgba(0,0,0,.3); --shadow-2: 0 10px 30px -10px rgba(0,0,0,.6); --scrim: rgba(0,0,0,.5);
}

/* ---------- base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
    background: var(--linen);
    color: var(--ink);
    font: 400 15px/1.5 var(--f-text);
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    font-variant-numeric: oldstyle-nums proportional-nums;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
::selection { background: var(--accent-wash); color: var(--ink); }
input, textarea { caret-color: var(--primary); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
/* UI chrome isn't text to select or long-press; reading text, notes and inputs are. */
.chrome, .tabbar, .topbar, button, .row, .seg { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.title { font: italic 400 34px/1.1 var(--f-display); letter-spacing: -0.01em; }
.title-m { font: italic 400 26px/1.15 var(--f-display); }
.title-s { font: italic 400 20px/1.2 var(--f-display); }
.title-xs { font: italic 400 17px/1.25 var(--f-display); }
.eyebrow { font: 500 10.5px/1.3 var(--f-text); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-2); }
.meta { font-size: 12.5px; color: var(--ink-2); }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.tabnum { font-variant-numeric: lining-nums tabular-nums; }
.link-u { text-decoration: underline; text-decoration-color: var(--rule-strong); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.link-u:hover { text-decoration-color: var(--ink-2); }

/* ---------- boot ---------- */

.boot { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 12px; background: var(--linen); color: var(--accent); }
.boot-mark { width: 84px; height: 84px; }
.boot-mark path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: boot-draw 1.4s var(--ease-out) forwards; }
.boot-mark path:nth-child(2) { animation-delay: .15s; }
.boot-mark path:nth-child(3) { animation-delay: .5s; }
.boot-name { font: italic 400 30px var(--f-display); color: var(--primary); opacity: 0; animation: fade-in .8s .5s forwards; }
@keyframes boot-draw { to { stroke-dashoffset: 0; } }
@keyframes fade-in { to { opacity: 1; } }

#blazor-error-ui {
    display: none; position: fixed; left: 12px; right: 12px; bottom: calc(12px + var(--safe-bottom)); z-index: 100;
    background: var(--paper); color: var(--ink); padding: 12px 16px; border-radius: var(--r-md); box-shadow: var(--shadow-2);
}
#blazor-error-ui .reload { text-decoration: underline; margin-left: 8px; }
#blazor-error-ui .dismiss { float: right; font-size: 20px; line-height: 1; }

/* ---------- app frame: the page scroller, the ghost of the last page, the tab bar ---------- */

.app { position: fixed; inset: 0; background: var(--ground); }
@media (min-width: 640px) {
    /* On a desktop the app sits as a phone-width column, so the POC reads as the phone app it is. */
    .app { inset: 0; max-width: 460px; margin: 0 auto; box-shadow: 0 0 0 1px var(--rule), 0 30px 80px -30px rgba(0,0,0,.25); }
}
.stage { position: absolute; inset: 0; overflow: hidden; }
#page, .ghost {
    position: absolute; inset: 0;
    overflow-y: auto; overflow-x: hidden; overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    background: var(--linen);
    padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px);
    scrollbar-width: none;
}
#page::-webkit-scrollbar { display: none; }
.app.no-tabbar #page { padding-bottom: 0; }
.app.no-tabbar #page::after { content: ""; display: block; height: calc(var(--safe-bottom) + 24px); }
.app.no-tabbar #page:has(.chapter-foot)::after { display: none; }
/* Stacking within .stage: on a push the old page sits UNDER the new one sliding over it; on a pop or a tab
   fade it sits OVER the page it reveals. (It used to live outside .app, where it painted over everything and a
   push showed the old page covering the new.) */
#ghost-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
/* Push: level 0, and earlier in the DOM than #page, so the page paints over it. #page itself takes no z-index:
   that would make it a stacking context and trap its sheets and action bar under the tab bar. */
#ghost-layer[data-dir=push] { z-index: 0; }
.ghost { position: fixed; pointer-events: none; }

/* Entering pages animate with fill-mode BACKWARDS, never both/forwards: a transform left on #page after the
   animation makes it the containing block for position:fixed children, and the sheets and the verse action
   bar would then be pinned inside the scrolling page instead of the screen. */
.enter-push { animation: push-in 420ms var(--ease-out) backwards; box-shadow: -10px 0 30px -12px rgba(30, 20, 0, .25); }
.leave-push { animation: push-under 420ms var(--ease-out) both; }
.enter-pop { animation: pop-in 380ms var(--ease-out) backwards; }
.leave-pop { animation: pop-out 380ms var(--ease-out) both; box-shadow: -10px 0 30px -12px rgba(30, 20, 0, .25); }
.enter-fade { animation: fade-up 260ms var(--ease-out) backwards; }
.leave-fade { animation: fade-out 160ms ease-out both; }
.enter-swiped { animation: pop-in 220ms var(--ease-out) backwards; }
@keyframes push-in { from { transform: translate3d(100%, 0, 0); } }
@keyframes push-under { to { transform: translate3d(-28%, 0, 0); filter: brightness(.92); } }
@keyframes pop-in { from { transform: translate3d(-28%, 0, 0); filter: brightness(.92); } }
@keyframes pop-out { to { transform: translate3d(100%, 0, 0); } }
@keyframes fade-up { from { opacity: 0; transform: translate3d(0, 6px, 0); } }
@keyframes fade-out { to { opacity: 0; } }
#page.dragging { box-shadow: -10px 0 30px -12px rgba(30, 20, 0, .3); transition: none; }
@media (prefers-reduced-motion: reduce) {
    .enter-push, .enter-pop, .enter-fade, .enter-swiped, .leave-push, .leave-pop, .leave-fade { animation: none; }
}

.tabbar {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(var(--tabs, 5), 1fr);
    padding: 6px 4px calc(6px + var(--safe-bottom));
    background: color-mix(in srgb, var(--paper) 94%, transparent);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
    border-top: 1px solid var(--rule);
    transition: transform 260ms var(--ease-out);
    /* An exact height, so what sits above it (.cta-bar, the page's bottom padding) can rely on --tabbar-h. */
    height: calc(var(--tabbar-h) + var(--safe-bottom)); box-sizing: border-box; align-items: start;
}
.app.no-tabbar .tabbar { transform: translateY(110%); }
.tab { display: grid; justify-items: center; gap: 3px; padding: 6px 0 2px; color: var(--ink-3); font-size: 10.5px; letter-spacing: .01em; }
.tab .ic { transition: transform 200ms var(--ease-spring); }
.tab[aria-current=page] { color: var(--primary-ink); }
.tab[aria-current=page] .ic { stroke-width: 2; }
.tab:active .ic { transform: scale(.88); }

/* ---------- top bars ---------- */

.topbar {
    position: sticky; top: 0; z-index: 5;
    display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
    min-height: 52px; padding: calc(var(--safe-top) + 4px) 8px 4px;
    background: color-mix(in srgb, var(--linen) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.topbar.ruled { border-bottom: 1px solid var(--rule); }
.topbar .center { justify-self: center; text-align: center; min-width: 0; }
.topbar .end { justify-self: end; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; color: var(--ink-2); }
.icon-btn:active { background: var(--paper-sunk); }
.back-label { display: flex; align-items: center; gap: 4px; color: var(--ink-2); }

.page-head { padding: calc(var(--safe-top) + 22px) 20px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.page-head .sub { margin-top: 6px; color: var(--ink-2); }
.section { padding: 0 16px; }
.section + .section { margin-top: 22px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 4px 8px; }

/* ---------- cards, rows, lists ---------- */

.card { background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-1); }
.card-pad { padding: 16px; }
.stack { display: grid; gap: 10px; }
.tile {
    display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center;
    padding: 14px 16px; background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-1);
    transition: transform 160ms var(--ease-out), box-shadow 160ms;
}
.tile:active { transform: scale(.985); }
.tile .glyph { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-wash); color: var(--accent-ink); overflow: hidden; }
.tile .glyph.sage { background: var(--primary-wash); color: var(--primary-ink); }
.tile .glyph img { width: 100%; height: 100%; object-fit: cover; }
.tile .chev { color: var(--ink-3); }

.list { display: grid; }
.row {
    display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
    padding: 12px 4px; border-top: 1px solid var(--rule); min-height: 56px; text-align: left; width: 100%;
}
.list > .row:first-child { border-top: 0; }
.row:active { background: color-mix(in srgb, var(--paper-sunk) 60%, transparent); }
.row .chev { color: var(--ink-3); }
.row .thumb { width: 40px; height: 40px; border-radius: 9px; overflow: hidden; background: var(--paper-sunk); display: grid; place-items: center; }
.row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-title { font: italic 400 18px/1.25 var(--f-display); }
.row-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 1px; }
.row.no-lead { grid-template-columns: 1fr auto; }

/* ---------- controls ---------- */

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-1); position: relative; }
.seg button { position: relative; z-index: 1; padding: 8px 6px; border-radius: 9px; color: var(--ink-2); font-size: 13.5px; transition: color 200ms; }
.seg button[aria-pressed=true] { color: var(--on-primary); }
.seg .thumb-bg { position: absolute; z-index: 0; top: 3px; bottom: 3px; border-radius: 9px; background: var(--primary); transition: transform 320ms var(--ease-spring), width 320ms var(--ease-out); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 12px; font-size: 15px; transition: transform 140ms var(--ease-out), background 200ms; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-secondary { background: var(--paper); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.btn-ghost { color: var(--primary-ink); }
.btn-accent { background: var(--accent); color: #2B2410; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13.5px; border-radius: 10px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule-strong); font-size: 13px; color: var(--ink); }
.pill[aria-pressed=true] { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }

.field { display: grid; gap: 6px; }
.field label { font-size: 12.5px; color: var(--ink-2); }
.input, .textarea {
    width: 100%; border: 0; border-radius: 12px; background: var(--paper-sunk); color: var(--ink);
    padding: 12px 14px; font-size: 16px; outline: none; box-shadow: inset 0 0 0 1px transparent; transition: box-shadow 160ms;
}
.input:focus, .textarea:focus { box-shadow: inset 0 0 0 1.5px var(--primary); }
.textarea { min-height: 120px; resize: none; line-height: 1.55; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }

.search-box { display: flex; align-items: center; gap: 10px; padding: 0 14px; height: 44px; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-1); color: var(--ink-2); }
.search-box input { flex: 1; border: 0; background: none; outline: none; font-size: 16px; color: var(--ink); min-width: 0; }

.toggle { position: relative; width: 50px; height: 30px; border-radius: 999px; background: var(--rule-strong); transition: background 200ms; flex: none; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 240ms var(--ease-spring); }
.toggle[aria-checked=true] { background: var(--primary); }
.toggle[aria-checked=true]::after { transform: translateX(20px); }

.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font: italic 500 15px var(--f-display); color: var(--paper); background: var(--m-sage); flex: none; }
.avatar.sm { width: 22px; height: 22px; font-size: 12px; }
.avatar.lg { width: 48px; height: 48px; font-size: 22px; }
.avatar.ring { box-shadow: 0 0 0 2px var(--linen); }
.m-sage { background: var(--m-sage); } .m-brass { background: var(--m-brass); } .m-sky { background: var(--m-sky); } .m-rose { background: var(--m-rose); }
.avatar-stack { display: flex; } .avatar-stack .avatar + .avatar { margin-left: -7px; }
.avatar-btn { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--paper); box-shadow: var(--shadow-1); font: 500 13px var(--f-text); color: var(--ink); }

.badge { display: inline-flex; align-items: center; gap: 3px; padding: 1px 7px; border-radius: 999px; font-size: 11px; line-height: 18px; background: var(--accent-wash); color: var(--accent-ink); font-variant-numeric: lining-nums; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }

.toast {
    position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 16px); z-index: 60;
    transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
    padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--linen); font-size: 13.5px; white-space: nowrap;
    transition: transform 300ms var(--ease-spring), opacity 200ms;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

.update-bar {
    position: fixed; z-index: 70; left: 12px; right: 12px; top: calc(var(--safe-top) + 8px);
    max-width: 436px; margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 8px 8px 8px 16px; border-radius: 16px;
    background: var(--ink); color: var(--linen); font-size: 14px; box-shadow: var(--shadow-2);
    animation: fade-up 300ms var(--ease-out) backwards;
}

.empty { padding: 36px 24px; text-align: center; color: var(--ink-2); display: grid; gap: 10px; justify-items: center; }
.empty .title-s { color: var(--ink); }

.skeleton { background: linear-gradient(90deg, var(--paper-sunk), var(--paper), var(--paper-sunk)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- bottom sheet ---------- */

.sheet { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
.sheet-scrim { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity 280ms; }
.sheet-panel {
    position: absolute; left: 0; right: 0; bottom: 0; max-height: calc(100% - var(--safe-top) - 40px);
    display: flex; flex-direction: column;
    background: var(--paper); border-radius: 22px 22px 0 0; box-shadow: var(--shadow-sheet);
    transform: translate3d(0, 105%, 0); transition: transform 420ms var(--ease-spring);
    padding-bottom: max(var(--kb), var(--safe-bottom));
}
@media (min-width: 640px) { .sheet-panel { max-width: 460px; margin: 0 auto; } }
.sheet-panel.dragging { transition: none; }
/* A closed sheet is hidden outright once it has slid away, so no edge of it shows during a page transition. */
.sheet:not(.open) .sheet-panel { visibility: hidden; transition: transform 420ms var(--ease-spring), visibility 0s 420ms; }
.sheet.open { pointer-events: auto; }
.sheet.open .sheet-scrim { opacity: 1; }
.sheet.open .sheet-panel { transform: translate3d(0, 0, 0); }
.sheet-grab-zone { padding: 8px 16px 4px; touch-action: none; cursor: grab; }
.sheet-grab { width: 38px; height: 5px; border-radius: 3px; background: var(--rule-strong); margin: 0 auto 8px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 32px; }
.sheet-body { overflow-y: auto; padding: 4px 16px 16px; overscroll-behavior: contain; }
.sheet-foot { padding: 8px 16px 12px; border-top: 1px solid var(--rule); }

/* ---------- home ---------- */

.hero { position: relative; height: 290px; overflow: hidden; background: var(--paper-sunk); }
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, color-mix(in srgb, var(--linen) 55%, transparent) 0%, transparent 32%, transparent 62%, var(--linen) 100%); }
.hero-top { position: absolute; z-index: 2; left: 0; right: 0; top: 0; padding: calc(var(--safe-top) + 18px) 20px 0; display: flex; justify-content: space-between; align-items: center; }
.hero-top .greeting { font: italic 400 24px var(--f-display); color: var(--ink); }
.scene-card { position: relative; z-index: 3; margin: -96px 12px 0; padding: 18px 18px 16px; }
.scene-card .title-m { margin: 8px 0 8px; }
.scene-card .read-links { display: flex; gap: 14px; align-items: baseline; margin-top: 12px; font-size: 13px; }

.activity { display: grid; grid-template-columns: auto 1fr; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--rule); align-items: start; }
.activity:first-child { border-top: 0; }
.activity q { quotes: "“" "”"; font-style: italic; }

/* ---------- bible lists ---------- */

.book-thumb { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; font: italic 500 13px var(--f-display); color: var(--ink); position: relative; overflow: hidden; }
.book-thumb::before { content: ""; position: absolute; inset: 0; background: var(--wash, var(--accent-wash)); }
.book-thumb span { position: relative; }
.g-law { --wash: #EADBB4; } .g-history { --wash: #E3D4C0; } .g-wisdom { --wash: #D8E0CC; } .g-prophets { --wash: #D5DCE2; }
.g-gospels { --wash: #EFD9C5; } .g-acts { --wash: #E6DAC2; } .g-letters { --wash: #DCE3D5; } .g-revelation { --wash: #E1D3D6; }
:root[data-theme=dark] .book-thumb::before { opacity: .22; }
@media (prefers-color-scheme: dark) { :root:not([data-theme=light]) .book-thumb::before { opacity: .22; } }
.progress-line { height: 2px; border-radius: 1px; background: var(--rule); margin-top: 6px; width: 120px; overflow: hidden; }
.progress-line span { display: block; height: 100%; background: var(--accent); }

.chapter-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.chapter-grid button { aspect-ratio: 1; border-radius: 10px; background: var(--paper-sunk); font-variant-numeric: lining-nums; font-size: 15px; }
.chapter-grid button[aria-current=true] { background: var(--primary); color: var(--on-primary); }
.chapter-grid button.read { box-shadow: inset 0 -2px 0 var(--accent); }

.letter-index { position: sticky; top: 60px; }

/* ---------- reader ---------- */

.reader-top { grid-template-columns: 44px 1fr auto; }
.chapter-title { display: inline-flex; align-items: center; gap: 4px; font: italic 400 19px var(--f-display); padding: 6px 10px; border-radius: 10px; }
.chapter-title:active { background: var(--paper-sunk); }
.tr-chip { font: 500 11px var(--f-text); letter-spacing: .06em; padding: 4px 7px; border-radius: 7px; color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--rule-strong); margin-right: 2px; }
.aa { font: 400 16px var(--f-display); }

.reader {
    padding: 10px 22px 40px;
    font: 400 calc(17px * var(--reader-scale))/1.78 var(--f-text);
    max-width: 38em; margin: 0 auto;
    hanging-punctuation: first;
    text-wrap: pretty;
}
.reader.spectral { font-family: var(--f-display); font-style: normal; font-size: calc(18px * var(--reader-scale)); }
.reader p.para { margin: 0 0 .9em; }
.verse { cursor: pointer; border-radius: 4px; transition: background 160ms; scroll-margin-top: 90px; }
.vn { font-size: .6em; vertical-align: .55em; line-height: 0; color: var(--ink-2); font-variant-numeric: lining-nums; margin-right: .18em; padding-left: .1em; }
.verse.sel { background: var(--primary-wash); box-shadow: 0 0 0 2px var(--primary-wash); }
.verse.sel .txt { text-decoration: underline; text-decoration-color: var(--primary); text-decoration-thickness: 1.5px; text-underline-offset: 4px; }
.verse.flash { animation: flash 1.8s ease-out; }
@keyframes flash { 0%, 30% { background: var(--accent-wash); } 100% { background: transparent; } }
.hl {
    -webkit-box-decoration-break: clone; box-decoration-break: clone;
    border-radius: 5px; padding: 1px 3px; margin: 0 -3px;
}
.hl-brass { background: var(--hl-brass); box-shadow: inset 0 0 0 1px var(--hl-brass-edge); }
.hl-sage { background: var(--hl-sage); box-shadow: inset 0 0 0 1px var(--hl-sage-edge); }
.hl-rose { background: var(--hl-rose); box-shadow: inset 0 0 0 1px var(--hl-rose-edge); }
.hl-sky { background: var(--hl-sky); box-shadow: inset 0 0 0 1px var(--hl-sky-edge); }
.hl-other { background: none; box-shadow: none; text-decoration: underline wavy; text-decoration-thickness: 1px; text-underline-offset: 5px; }
.hl-other.c-brass { text-decoration-color: var(--m-brass); } .hl-other.c-sky { text-decoration-color: var(--m-sky); }
.hl-other.c-rose { text-decoration-color: var(--m-rose); } .hl-other.c-sage { text-decoration-color: var(--m-sage); }
.ent { text-decoration: underline dotted; text-decoration-color: var(--ink-3); text-decoration-thickness: 1.5px; text-underline-offset: 4px; cursor: pointer; }
.ent:hover, .ent:active { text-decoration-color: var(--primary); color: var(--primary-ink); }
.ent.place { text-decoration-style: dashed; }
.note-badge { display: inline-flex; align-items: center; gap: 3px; vertical-align: .12em; margin-left: .3em; padding: 0 6px; height: 19px; border-radius: 999px; background: var(--accent-wash); color: var(--accent-ink); font: 500 11px/19px var(--f-text); font-variant-numeric: lining-nums; box-shadow: inset 0 0 0 1px var(--hl-brass-edge); }
.note-badge.unread::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-left: 2px; }
.chapter-heading { font: italic 400 15px var(--f-display); color: var(--ink-2); margin: 0 0 10px; }
.ps-title { font-style: italic; color: var(--ink-2); font-size: .92em; display: block; margin-bottom: .6em; }

.chapter-foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 18px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--rule); background: var(--linen); color: var(--ink-2); position: sticky; bottom: 0; z-index: 4; }
.chapter-foot button { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; padding: 6px 4px; }
.chapter-foot button[disabled] { visibility: hidden; }

.actionbar {
    position: fixed; z-index: 20; left: 12px; right: 12px; bottom: calc(64px + var(--safe-bottom));
    max-width: 436px; margin: 0 auto;
    display: grid; grid-template-columns: repeat(4, 1fr);
    background: var(--paper); border-radius: 18px; box-shadow: var(--shadow-2);
    padding: 8px 6px; transform: translateY(140%); opacity: 0; transition: transform 360ms var(--ease-spring), opacity 200ms;
}
.actionbar.show { transform: translateY(0); opacity: 1; }
.actionbar button { display: grid; justify-items: center; gap: 4px; padding: 6px 0; font-size: 12px; color: var(--ink-2); border-radius: 12px; }
.actionbar button:active { background: var(--paper-sunk); }
.actionbar button .ic { color: var(--ink); }
.swatches { display: flex; gap: 12px; justify-content: center; padding: 6px 0 2px; grid-column: 1 / -1; }
.swatch { width: 30px; height: 30px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); transition: transform 160ms var(--ease-spring); }
.swatch[aria-pressed=true] { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--primary); }
.swatch:active { transform: scale(.9); }
.swatch.brass { background: var(--hl-brass); } .swatch.sage { background: var(--hl-sage); } .swatch.rose { background: var(--hl-rose); } .swatch.sky { background: var(--hl-sky); }
.swatch.clear { background: var(--paper-sunk); display: grid; place-items: center; color: var(--ink-2); }

/* notes thread */
.thread { display: grid; gap: 10px; padding: 4px 0 8px; }
.bubble { max-width: 86%; padding: 10px 12px 11px; border-radius: 14px; background: var(--paper-sunk); }
.bubble.mine { justify-self: end; background: var(--primary-wash); }
.bubble-head { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); margin-bottom: 3px; }
.bubble-head b { font-weight: 600; color: var(--ink); }
.bubble-head .seen { margin-left: auto; color: var(--ink-3); }
.bubble p { font-size: 14.5px; line-height: 1.45; white-space: pre-wrap; }
.bubble .tr-note { font-size: 11.5px; color: var(--ink-2); margin-top: 4px; font-style: italic; }
.reply { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 22px; background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.reply textarea { flex: 1; border: 0; background: none; outline: none; resize: none; font-size: 16px; line-height: 1.4; padding: 6px 0; max-height: 120px; min-height: 32px; }
.send { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex: none; transition: transform 160ms var(--ease-spring), opacity 160ms; }
.send[disabled] { opacity: .35; }
.vis-row { display: flex; gap: 6px; padding: 8px 0 2px; flex-wrap: wrap; }
.vis-row .pill { font-size: 12px; padding: 4px 10px; }
.quote { font-size: 14px; line-height: 1.55; color: var(--ink-2); padding: 10px 12px; border-radius: 12px; background: var(--paper-sunk); margin: 6px 0 10px; }

/* ---------- people ---------- */

.profile-head { display: grid; grid-template-columns: 76px 1fr; gap: 14px; align-items: center; padding: 6px 20px 16px; }
.portrait { width: 76px; height: 76px; border-radius: 50%; overflow: hidden; background: var(--accent-wash); display: grid; place-items: center; font: italic 400 32px var(--f-display); color: var(--accent-ink); box-shadow: 0 0 0 3px var(--paper), var(--shadow-1); }
.portrait img { width: 100%; height: 100%; object-fit: cover; }
.portrait.sm { width: 40px; height: 40px; font-size: 18px; box-shadow: none; }
.profile-head h1 { font: italic 400 36px/1.05 var(--f-display); }
.glance { padding: 16px 16px 8px; }
.glance dl { display: grid; grid-template-columns: 96px 1fr; gap: 10px 14px; margin: 10px 0 0; font-size: 14px; }
.glance dt { color: var(--ink-2); }
.glance dd { margin: 0; line-height: 1.45; }
.glance .ref { color: var(--ink-2); font-size: 12.5px; white-space: nowrap; }
.prose { font-size: 16px; line-height: 1.65; padding: 0 20px; }
.prose p + p { margin-top: .8em; }
.timeline { display: grid; padding: 0 20px; }
.timeline .t-row { display: grid; grid-template-columns: 44px 1fr; gap: 12px; padding: 11px 0; border-top: 1px solid var(--rule); align-items: baseline; text-align: left; }
.timeline .t-row:first-child { border-top: 0; }
.timeline .age { font: italic 500 17px var(--f-display); color: var(--accent); font-variant-numeric: lining-nums; }
.timeline .age.none { color: var(--rule-strong); }
/* Sticky inside #page, whose bottom padding already clears the tab bar - and a sticky element's limit is the
   scroller's content box, padding excluded. So bottom:0 floated the bar 24px+ above the tab bar, and adding the
   tab bar's height again (as this once did) floated it a whole tab bar higher, with the page showing beneath it.
   A negative bottom equal to the padding's spare 24px sits it right on the tab bar. The fade is a band above the
   solid bar, not a see-through bar. */
.cta-bar {
    /* Its solid background runs down BEHIND the tab bar to the bottom of the screen, so no gap can open between
       the two whatever the tab bar's real height: bottom pulls it the whole padding down, and padding-bottom
       lifts the buttons back above the tab bar. */
    position: sticky; z-index: 4; margin-top: 24px;
    bottom: calc(-1 * (var(--tabbar-h) + var(--safe-bottom) + 24px));
    display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
    padding: 10px 16px calc(var(--tabbar-h) + var(--safe-bottom) + 12px);
    /* ...and the page's own bottom padding is given back, so at the end of the page it rests exactly where it
       sticks: no jump as the scroll runs out. */
    margin-bottom: calc(-1 * (var(--tabbar-h) + var(--safe-bottom) + 24px));
    background: var(--linen);
}
.cta-bar::before { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 24px; background: linear-gradient(transparent, var(--linen)); pointer-events: none; }
.app.no-tabbar .cta-bar { bottom: 0; padding-bottom: calc(12px + var(--safe-bottom)); margin-bottom: 0; }
.fact { padding: 14px 16px; border-radius: var(--r-md); background: var(--accent-wash); color: var(--ink); font-size: 14.5px; line-height: 1.5; margin: 0 16px; }
.fact .eyebrow { color: var(--accent-ink); margin-bottom: 4px; }
.family-tree { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px; }

.az { display: flex; gap: 2px; overflow-x: auto; padding: 0 12px 6px; scrollbar-width: none; }
.az button { min-width: 28px; height: 28px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.az button[aria-pressed=true] { background: var(--primary); color: var(--on-primary); }

/* ---------- maps ---------- */

.map-viewport { position: relative; height: 380px; overflow: hidden; touch-action: none; background: var(--sea); border-radius: var(--r-lg); margin: 0 12px; box-shadow: var(--shadow-1); cursor: grab; }
.map-viewport.tall { height: calc(100dvh - 300px); min-height: 340px; }
.map-content { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.map-content svg { display: block; }
.map-land { fill: var(--land); stroke: var(--land-edge); stroke-width: .9; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map-lake { fill: var(--sea); stroke: var(--sea-deep); stroke-width: .6; vector-effect: non-scaling-stroke; }
.map-river { fill: none; stroke: var(--river); stroke-width: 1.1; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.map-coast-glow { fill: none; stroke: var(--sea-deep); stroke-width: 6; opacity: .45; filter: blur(3px); vector-effect: non-scaling-stroke; }
.map-route { fill: none; stroke: var(--route); stroke-width: 2; stroke-dasharray: 6 5; stroke-linecap: round; vector-effect: non-scaling-stroke; opacity: .85; }
.map-route.draw { animation: route 2.2s var(--ease-out) both; }
@keyframes route { from { stroke-dashoffset: 300; opacity: 0; } to { opacity: .85; } }
.map-dot { fill: var(--ink-2); opacity: .55; }
.pin { position: absolute; transform: translate(-50%, -50%) scale(calc(1 / var(--pz, 1))); transform-origin: center; display: flex; align-items: center; gap: 6px; pointer-events: auto; }
.pin-n { width: 24px; height: 24px; border-radius: 50%; background: var(--paper); color: var(--ink); display: grid; place-items: center; font: 500 12px var(--f-text); font-variant-numeric: lining-nums; box-shadow: 0 0 0 1.5px var(--ink-2), var(--shadow-1); transition: background 200ms, color 200ms, transform 240ms var(--ease-spring); }
.pin.active .pin-n { background: var(--primary); color: var(--on-primary); box-shadow: 0 0 0 1.5px var(--primary), var(--shadow-2); transform: scale(1.15); }
.pin-label { position: absolute; left: 30px; top: 50%; transform: translateY(-50%); white-space: nowrap; padding: 4px 8px; border-radius: 8px; background: color-mix(in srgb, var(--paper) 94%, transparent); box-shadow: var(--shadow-1); font-size: 12.5px; line-height: 1.2; pointer-events: none; }
.pin-label small { display: block; font-size: 10.5px; color: var(--ink-2); }
.pin.left .pin-label { left: auto; right: 30px; }
.pin.place-dot .pin-n { width: 12px; height: 12px; background: var(--accent); box-shadow: 0 0 0 2px var(--paper); }
.map-controls { position: absolute; right: 10px; bottom: 10px; display: grid; gap: 6px; z-index: 3; }
.map-controls button { width: 36px; height: 36px; border-radius: 10px; background: var(--paper); box-shadow: var(--shadow-1); display: grid; place-items: center; color: var(--ink); }
.stop-panel { margin: 12px 12px 0; padding: 16px 18px; }
.stop-panel ul { margin: 10px 0 0; padding-left: 18px; font-size: 14.5px; line-height: 1.5; }
.stop-panel li + li { margin-top: 6px; }
.stop-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.stops-strip { display: flex; gap: 8px; overflow-x: auto; padding: 12px 12px 4px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.stops-strip::-webkit-scrollbar { display: none; }
.stops-strip button { flex: none; scroll-snap-align: start; display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow-1); font-size: 13px; }
.stops-strip button .pin-n { width: 22px; height: 22px; font-size: 11px; }
.stops-strip button[aria-current=true] { background: var(--primary); color: var(--on-primary); }

/* ---------- paywall ---------- */

.locked { position: relative; }
.locked > .lock-blur { filter: blur(5px); opacity: .55; pointer-events: none; user-select: none; max-height: 260px; overflow: hidden; -webkit-mask-image: linear-gradient(#000 30%, transparent); mask-image: linear-gradient(#000 30%, transparent); }
.lock-card { margin: -80px 16px 0; position: relative; z-index: 2; padding: 20px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.lock-card .glyph { width: 44px; height: 44px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-ink); display: grid; place-items: center; }
.plus-mark { font: italic 500 1em var(--f-display); color: var(--accent-ink); }

.plan { padding: 16px; border-radius: var(--r-lg); background: var(--paper); box-shadow: inset 0 0 0 1px var(--rule); display: grid; gap: 6px; text-align: left; width: 100%; }
.plan[aria-pressed=true] { box-shadow: inset 0 0 0 2px var(--primary); }
.plan .price { font: italic 400 22px var(--f-display); }

/* ---------- pray ---------- */

.music-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); transition: background 200ms; }
.music-btn[aria-pressed=true] { background: var(--accent); color: var(--paper); }
.music-btn[aria-pressed=true] .ic { animation: breathe 4s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(.86); } }
.prompt-list { display: grid; gap: 10px; padding: 0 16px; }
.prompt-list li { list-style: none; }
.step-card { padding: 18px; display: grid; gap: 8px; }
.step-letter { font: italic 400 46px/1 var(--f-display); color: var(--accent); }
.step-dots { display: flex; gap: 6px; justify-content: center; padding: 12px 0; }
.step-dots span { width: 6px; height: 6px; border-radius: 3px; background: var(--rule-strong); transition: width 260ms var(--ease-out), background 200ms; }
.step-dots span.on { width: 18px; background: var(--primary); }
.carousel { display: grid; grid-auto-flow: column; grid-auto-columns: calc(100% - 40px); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 4px 20px 8px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel > * { scroll-snap-align: center; }
.journal-entry { display: grid; gap: 4px; padding: 14px 4px; border-top: 1px solid var(--rule); text-align: left; width: 100%; }
.journal-entry:first-child { border-top: 0; }
.journal-entry .row-title { display: flex; align-items: center; gap: 8px; }
.answered { display: inline-flex; align-items: center; gap: 4px; font: 500 11px var(--f-text); color: var(--primary-ink); background: var(--primary-wash); padding: 2px 8px; border-radius: 999px; font-style: normal; }
.stale { color: var(--accent-ink); }
.prayed-log { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- lessons ---------- */

.series-card { padding: 18px; display: grid; gap: 10px; }
.meter { height: 4px; border-radius: 2px; background: var(--rule); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--primary); border-radius: 2px; transition: width 400ms var(--ease-out); }
.lesson-num { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: italic 500 15px var(--f-display); font-variant-numeric: lining-nums; box-shadow: inset 0 0 0 1px var(--rule-strong); color: var(--ink-2); }
.lesson-num.done { background: var(--primary); color: var(--on-primary); box-shadow: none; }
.church-banner { margin: 0 16px; padding: 16px 18px; border-radius: var(--r-lg); background: var(--primary); color: var(--on-primary); display: grid; gap: 4px; }
.church-banner .eyebrow { color: color-mix(in srgb, var(--on-primary) 75%, transparent); }
.reading-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 10px; background: var(--paper); box-shadow: var(--shadow-1); font-size: 14px; }
.questions { margin: 0; padding-left: 20px; display: grid; gap: 10px; font-size: 15.5px; line-height: 1.5; }

/* ---------- colouring ---------- */

.colour-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 16px; }
.colour-card { background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 10px; display: grid; gap: 8px; text-align: left; }
.colour-card .art { aspect-ratio: 1; border-radius: 12px; background: #FFFDF8; overflow: hidden; }
.colour-card .art img { width: 100%; height: 100%; object-fit: contain; }
.canvas-wrap { margin: 0 12px; border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1); background: #FFFDF8; aspect-ratio: 1; touch-action: none; }
.canvas-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; }
.tools { display: flex; justify-content: center; gap: 8px; padding: 12px 16px 4px; }
.tool { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: var(--ink-2); background: var(--paper); box-shadow: var(--shadow-1); }
.tool[aria-pressed=true] { background: var(--primary); color: var(--on-primary); }
.tool[disabled] { opacity: .4; }
.paints { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; padding: 12px 16px; }
.paint { aspect-ratio: 1; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); transition: transform 180ms var(--ease-spring); }
.paint[aria-pressed=true] { transform: scale(1.12); box-shadow: 0 0 0 2px var(--linen), 0 0 0 4px var(--ink); }
.sizes { display: flex; gap: 14px; align-items: center; justify-content: center; }
.size-dot { border-radius: 50%; background: var(--ink-2); }
.size-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; }
.size-btn[aria-pressed=true] { background: var(--paper-sunk); }

/* ---------- search ---------- */

.hit { display: grid; gap: 3px; padding: 12px 4px; border-top: 1px solid var(--rule); text-align: left; width: 100%; }
.hit:first-child { border-top: 0; }
.hit .ref { font: italic 400 15px var(--f-display); color: var(--primary-ink); }
.hit p { font-size: 14.5px; line-height: 1.5; }
mark { background: var(--hl-brass); color: inherit; border-radius: 3px; padding: 0 1px; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 92px 1fr 34px; align-items: center; gap: 8px; font-size: 12.5px; text-align: left; }
.bar-row .bar { height: 8px; border-radius: 4px; background: var(--primary-wash); overflow: hidden; }
.bar-row .bar span { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.bar-row .n { text-align: right; color: var(--ink-2); font-variant-numeric: lining-nums tabular-nums; }
.topic-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 16px; }
.topic-card { padding: 14px; border-radius: var(--r-md); background: var(--paper); box-shadow: var(--shadow-1); text-align: left; display: grid; gap: 4px; min-height: 88px; align-content: start; }
.topic-verse { padding: 14px 4px; border-top: 1px solid var(--rule); display: grid; gap: 4px; text-align: left; width: 100%; }
.topic-verse:first-child { border-top: 0; }
.topic-verse .ref { font: italic 400 15px var(--f-display); color: var(--primary-ink); }
.topic-verse p { font-size: 15px; line-height: 1.55; }

/* ---------- settings ---------- */

.set-group { margin: 0 16px; background: var(--paper); border-radius: var(--r-lg); box-shadow: var(--shadow-1); padding: 0 14px; }
.set-row { display: flex; align-items: center; gap: 12px; min-height: 54px; padding: 10px 0; border-top: 1px solid var(--rule); width: 100%; text-align: left; }
.set-row:first-child { border-top: 0; }
.set-row .grow { flex: 1; min-width: 0; }
.set-label { padding: 22px 20px 8px; }
.radio-dot { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--rule-strong); flex: none; }
.radio-dot.on { box-shadow: inset 0 0 0 6px var(--primary); }
.tenant-swatch { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font: italic 500 16px var(--f-display); color: #fff; flex: none; }

.ic { flex: none; display: block; }
