@font-face { font-family: "Allo"; src: url("fonts/Allo-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Allo"; src: url("fonts/Allo-Oblique.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Allo"; src: url("fonts/Allo-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Allo"; src: url("fonts/Allo-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Allo"; src: url("fonts/Allo-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
/* Knowing God: warm paper and ink. One accent (ember), one "done" colour (sage). */
:root {
  --paper: #F6F1E9; --surface: #FFFCF7; --sunk: #EFE8DC; --ink: #1F1A14; --ink-soft: #645A4E; --ink-faint: #958A7C;
  --line: #E2D8C9; --ember: #B4532A; --ember-wash: #F3E1D4; --sage: #56705B; --sage-wash: #E2EADF; --gold: #8E6E2F;
  --hl: #F6E3A1; --hl-friend: #D3E0EE; --on-accent: #FFFCF7;
  --serif: "Allo", "New York", "Iowan Old Style", "Source Serif 4", Georgia, serif;
  --sans: "Allo", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --read: 18px; --r-s: 10px; --r-m: 16px; --r-l: 24px; --gut: 20px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #15120F; --surface: #1F1B17; --sunk: #0F0D0B; --ink: #EEE7DB; --ink-soft: #A99F92; --ink-faint: #766D62;
    --line: #332D27; --ember: #E08A5F; --ember-wash: #3A2419; --sage: #93B49A; --sage-wash: #1F2B21; --gold: #D2B36F;
    --hl: #5A4A1C; --hl-friend: #22344A; --on-accent: #15120F; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #15120F; --surface: #1F1B17; --sunk: #0F0D0B; --ink: #EEE7DB; --ink-soft: #A99F92; --ink-faint: #766D62;
  --line: #332D27; --ember: #E08A5F; --ember-wash: #3A2419; --sage: #93B49A; --sage-wash: #1F2B21; --gold: #D2B36F;
  --hl: #5A4A1C; --hl-friend: #22344A; --on-accent: #15120F; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 16px; line-height: 1.5; }
body { min-height: 100dvh; overflow-x: hidden; }
a { color: var(--ember); text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
img, svg { display: block; }
.boot { height: 100dvh; display: grid; place-items: center; font-family: var(--serif); font-size: 28px; color: var(--ink-faint); }

/* Layout */
.page { max-width: 680px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) var(--gut) calc(env(safe-area-inset-bottom) + 110px); }
.topbar { display: flex; align-items: center; gap: 8px; min-height: 44px; margin-bottom: 8px; }
.topbar .spacer { flex: 1; }
.topbar h2 { font: 600 17px var(--sans); margin: 0; flex: 1; text-align: center; color: var(--ink-soft); }
.iconbtn { width: 44px; height: 44px; border-radius: 22px; display: grid; place-items: center; color: var(--ink); }
.iconbtn:hover { background: var(--sunk); }
.iconbtn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.stack > * + * { margin-top: 28px; }
.stack-s > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.grow { flex: 1; min-width: 0; }

/* Type */
.display { font: 600 34px/1.12 var(--serif); letter-spacing: -0.01em; margin: 0; }
.h1 { font: 600 28px/1.2 var(--serif); margin: 0; }
.h2 { font: 600 22px/1.25 var(--serif); margin: 0; }
.h3 { font: 600 19px/1.3 var(--serif); margin: 0; }
.eyebrow { font: 600 12px var(--sans); color: var(--ink-soft); letter-spacing: 0.01em; }
.eyebrow.ember { color: var(--ember); }
.soft { color: var(--ink-soft); }
.faint { color: var(--ink-faint); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.reading { font: 400 var(--read)/1.65 var(--serif); }
.reading.sans { font-family: var(--sans); }
.reading p { margin: 0 0 1em; }
.scripture { font: 400 calc(var(--read) + 1px)/1.7 var(--serif); }
.scripture sup { color: var(--gold); font: 600 0.6em var(--sans); margin-right: 3px; }
.refline { font: 600 14px var(--sans); color: var(--gold); }
.quote { border-left: 2px solid color-mix(in srgb, var(--gold) 55%, transparent); padding-left: 16px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.section-head .h3 + .soft { margin-top: 2px; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: var(--r-m); padding: 16px; }
.card.tight { padding: 12px 14px; }
.wash { background: color-mix(in srgb, var(--ember-wash) 65%, transparent); border-radius: var(--r-l); padding: 18px; }
.list { background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: var(--r-m); overflow: hidden; }
.list > * { display: flex; align-items: center; gap: 14px; padding: 13px 16px; width: 100%; text-align: left; }
.list > * + * { border-top: 1px solid var(--line); }
.list .chev { color: var(--ink-faint); margin-left: auto; }
.tap { transition: transform .12s ease; }
.tap:active { transform: scale(0.985); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: var(--r-m); font-weight: 600; font-size: 17px; background: var(--ember); color: var(--on-accent); width: 100%; }
.btn.quiet { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn.sage { background: var(--sage); }
.btn.small { min-height: 40px; font-size: 15px; width: auto; padding: 0 14px; border-radius: 12px; }
.btn:disabled { opacity: 0.45; cursor: default; }
.link { color: var(--ember); font-weight: 500; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); font-size: 15px; color: var(--ink); white-space: nowrap; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); font-weight: 600; }
.refchip { display: inline-flex; align-items: center; gap: 5px; min-height: 32px; padding: 0 11px; border-radius: 16px; background: color-mix(in srgb, var(--gold) 12%, transparent); color: var(--gold); font: 500 14px var(--sans); }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 12px; font: 500 11.5px var(--sans); }
.badge.scripture { color: var(--gold); background: color-mix(in srgb, var(--gold) 12%, transparent); }
.badge.background { color: var(--ink-soft); background: color-mix(in srgb, var(--ink-soft) 12%, transparent); }
.badge.note { color: var(--ember); background: color-mix(in srgb, var(--ember) 11%, transparent); }
.badge.pastor { color: var(--sage); background: color-mix(in srgb, var(--sage) 13%, transparent); }
.badge.friend { color: var(--ink); background: var(--hl-friend); }
.seg { display: flex; background: var(--sunk); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; min-height: 34px; border-radius: 9px; font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 8%); }
.hscroll { display: flex; gap: 14px; overflow-x: auto; scrollbar-width: none; margin: 0 calc(-1 * var(--gut)); padding: 0 var(--gut) 4px; scroll-snap-type: x proximity; }
.hscroll::-webkit-scrollbar { display: none; }
.hscroll > * { scroll-snap-align: start; flex: none; }

/* Forms */
.field { display: block; }
.field > span { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.input, textarea.input, select.input { width: 100%; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-s); font-size: 16px; }
textarea.input { min-height: 110px; resize: vertical; line-height: 1.55; }
textarea.input.serif { font-family: var(--serif); font-size: 17px; }
.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 0; }
.toggle input { width: 46px; height: 28px; appearance: none; border-radius: 14px; background: var(--line); position: relative; flex: none; cursor: pointer; transition: background .2s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 11px; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgb(0 0 0 / 20%); }
.toggle input:checked { background: var(--ember); }
.toggle input:checked::after { transform: translateX(18px); }
.error { background: var(--ember-wash); color: var(--ink); padding: 12px 14px; border-radius: var(--r-s); font-size: 15px; }

/* Cover art */
.cover { position: relative; overflow: hidden; border-radius: var(--r-m); background: var(--sky); }
.cover .sun { position: absolute; border-radius: 50%; background: var(--sun); }
.cover svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tile { width: 156px; text-align: left; }
.tile .cover { height: 196px; }
.tile .t { font-weight: 600; margin-top: 10px; }

/* Tabs */
.tabs { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 10px); width: min(560px, calc(100% - 20px));
  display: flex; justify-content: space-around; padding: 6px; border-radius: 30px; z-index: 20;
  background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(20px) saturate(1.4); -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); box-shadow: 0 6px 24px rgb(0 0 0 / 8%); }
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0 4px; border-radius: 22px; color: var(--ink); font-size: 11px; font-weight: 500; }
.tabs a svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs a.on { color: var(--ember); background: color-mix(in srgb, var(--ember) 9%, transparent); }
.tabs a .dot { position: absolute; }

/* Lesson player */
.player { position: fixed; inset: 0; background: var(--paper); z-index: 30; display: flex; flex-direction: column; }
.player .bar { max-width: 680px; width: 100%; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 8px) var(--gut) 6px; }
.rail { display: flex; gap: 4px; margin-top: 6px; }
.rail i { flex: 1; height: 3px; border-radius: 2px; background: var(--line); transition: background .3s; }
.rail i.on { background: var(--ember); }
.player .body { flex: 1; overflow-y: auto; }
.player .body > div { max-width: 680px; margin: 0 auto; padding: 16px var(--gut) 40px; }
.player .foot { max-width: 680px; width: 100%; margin: 0 auto; display: flex; gap: 12px; padding: 12px var(--gut) calc(env(safe-area-inset-bottom) + 12px); }
.player .foot .btn.quiet { width: 64px; flex: none; }
.card-enter { animation: cardIn .35s cubic-bezier(.2,.8,.2,1); }
@keyframes cardIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.option { width: 100%; text-align: left; padding: 14px; border-radius: var(--r-s); background: var(--surface); border: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; }
.option.right { background: var(--sage-wash); }
.option.wrong { background: var(--ember-wash); }
.explain { padding: 14px; border-radius: var(--r-s); }
.explain.right { background: var(--sage-wash); } .explain.wrong { background: var(--ember-wash); }
.explain b { display: block; font-size: 15px; margin-bottom: 4px; }
.explain.right b { color: var(--sage); } .explain.wrong b { color: var(--ember); }

/* Timeline */
.timeline { position: relative; }
.timeline .ev { display: grid; grid-template-columns: 14px 1fr; gap: 14px; padding-bottom: 18px; position: relative; }
.timeline .ev::before { content: ""; position: absolute; left: 6px; top: 16px; bottom: 0; width: 2px; background: var(--line); }
.timeline .ev:last-child::before { display: none; }
.timeline .dotc { width: 10px; height: 10px; border-radius: 5px; background: var(--ember); margin: 7px 0 0 2px; }
.timeline .dotc.done { background: var(--sage); }

/* Sheet */
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / 32%); z-index: 40; animation: fade .2s; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; max-height: 92dvh; z-index: 41; background: var(--paper); border-radius: 22px 22px 0 0; display: flex; flex-direction: column; animation: up .3s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -8px 40px rgb(0 0 0 / 15%); }
@media (min-width: 720px) { .sheet { left: 50%; width: 640px; transform: translateX(-50%); bottom: 24px; border-radius: 22px; max-height: 86dvh; animation: fade .2s; } }
.sheet header { display: flex; align-items: center; gap: 8px; padding: 10px 12px 6px 20px; }
.sheet header h3 { flex: 1; margin: 0; font: 600 17px var(--sans); }
.sheet .content { overflow-y: auto; padding: 6px var(--gut) calc(env(safe-area-inset-bottom) + 24px); }
.grab { width: 36px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 0; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* Bible reader */
.verse { display: grid; grid-template-columns: 22px 1fr; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; }
.verse .n { text-align: right; color: var(--gold); font: 600 12px var(--sans); padding-top: 0.45em; }
.verse.sel { background: var(--sunk); }
.verse.hl { background: var(--hl); }
.verse.hl-friend { background: var(--hl-friend); }
.verse .who { font: 500 11px var(--sans); color: var(--ink-soft); }
.chapters { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; padding: 10px 0; }
.chapters a { display: grid; place-items: center; min-height: 40px; background: var(--sunk); border-radius: 8px; color: var(--ink); font-variant-numeric: tabular-nums; }
details.book summary { list-style: none; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; font-weight: 500; }
details.book summary::-webkit-details-marker { display: none; }

/* Devotional */
.para { border-radius: 6px; padding: 2px 0; transition: background .2s; }
.para.hl { background: var(--hl); padding: 6px 8px; }
.prayer { background: color-mix(in srgb, var(--ember-wash) 55%, transparent); border-radius: var(--r-m); padding: 16px; }
.prayer .reading { font-style: italic; }

/* Feed */
.post { background: var(--surface); border: 1px solid color-mix(in srgb, var(--line) 75%, transparent); border-radius: var(--r-m); padding: 16px; }
.post .meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.avatar { width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; font: 600 13px var(--sans); color: var(--on-accent); background: var(--ember); flex: none; }
.avatar.b { background: var(--sage); }
.reacts { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.react { display: inline-flex; gap: 6px; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--line); font-size: 14px; }
.react.on { background: var(--sage-wash); border-color: transparent; color: var(--sage); font-weight: 600; }
.comment { padding: 8px 0 0; font-size: 15px; }
.comment b { font-weight: 600; margin-right: 6px; }
.progress-bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.progress-bar i { display: block; height: 100%; background: var(--ember); border-radius: 3px; }
.progress-bar.b i { background: var(--sage); }

/* Mini player */
.mini { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 86px); width: min(560px, calc(100% - 20px)); z-index: 19;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line); border-radius: var(--r-m); padding: 10px 12px; box-shadow: 0 6px 24px rgb(0 0 0 / 10%); }
.mini input[type=range] { width: 100%; accent-color: var(--ember); }

/* Toast */
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 96px); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60;
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 20px; font-size: 15px; font-weight: 500; transition: all .25s; max-width: calc(100% - 40px); text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }

.empty { text-align: center; padding: 36px 16px; color: var(--ink-soft); }
.empty .h3 { color: var(--ink); margin: 8px 0 6px; }
.ring { width: 34px; height: 34px; flex: none; }
.ring circle { fill: none; stroke-width: 3; }
hr.rule { border: 0; border-top: 1px solid var(--line); margin: 0; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
