:root { color-scheme: light;
  --bg: #FBF7F1; --card: #FFFFFF; --ink: #2A2226; --muted: #6E6268; --line: #ECE3D9;
  --plum: #2B1B2E; --wine: #6B2D3C; --gold: #B8862B; --gold-soft: #F4E7CC;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --r: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 18px 10px; background: rgba(251,247,241,.92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 20px; color: var(--plum); }
.brand b { color: var(--wine); }
.pill { font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--gold); background: var(--gold-soft); padding: 4px 10px; border-radius: 99px; }

main { max-width: 720px; margin: 0 auto; padding: 8px 18px calc(96px + env(safe-area-inset-bottom)); }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.hero { padding: 26px 0 12px; }
.eyebrow { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); }
.hero h1 { margin: 6px 0 6px; font: 600 clamp(28px, 6vw, 38px)/1.15 var(--serif); color: var(--plum); }
.sub { margin: 0; color: var(--muted); }

.ask { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.ask textarea { width: 100%; resize: none; border: 1.5px solid var(--line); border-radius: var(--r); padding: 14px 16px; background: var(--card); font-size: 17px; outline: none; min-height: 64px; }
.ask textarea:focus { border-color: var(--gold); }

.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 600; cursor: pointer; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--plum); color: #fff; }
.btn.ghost { background: transparent; border: 1.5px solid var(--line); color: var(--plum); }
.btn.small { padding: 8px 14px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 6px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 7px 13px; font-size: 14px; cursor: pointer; color: var(--plum); }
.chip:hover { border-color: var(--gold); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; margin-top: 16px; }
.card h3 { margin: 0 0 8px; font: 600 20px/1.25 var(--serif); color: var(--plum); }
.card p { margin: 0 0 10px; }

.answer .art { margin: -18px -18px 16px; border-radius: var(--r) var(--r) 0 0; overflow: hidden; line-height: 0; }
.answer .art svg { width: 100%; height: auto; display: block; }
.answer h2 { margin: 0 0 10px; font: 600 24px/1.2 var(--serif); color: var(--plum); }
.answer .body p { margin: 0 0 12px; }
.verse { border-left: 3px solid var(--gold); padding: 4px 0 4px 14px; margin: 16px 0; }
.verse .ref { font-weight: 700; color: var(--wine); font-size: 14px; letter-spacing: .02em; }
.verse blockquote { margin: 4px 0 6px; font: 18px/1.55 var(--serif); }
.verse .why { margin: 0; font-size: 14px; color: var(--muted); }
.verse .link { font-size: 14px; color: var(--gold); background: none; border: 0; padding: 0; cursor: pointer; font-weight: 600; }
.crisis { background: #FFF4F2; border-color: #F2C6BE; }
.fb { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 14px; color: var(--muted); }
.fb button { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 12px; cursor: pointer; }
.fb button.on { background: var(--gold-soft); border-color: var(--gold); }

.thinking { display: flex; align-items: center; gap: 10px; color: var(--muted); }
.dots span { display: inline-block; width: 7px; height: 7px; margin-right: 3px; border-radius: 50%; background: var(--gold); animation: bob 1s infinite; }
.dots span:nth-child(2) { animation-delay: .15s; } .dots span:nth-child(3) { animation-delay: .3s; }
@keyframes bob { 0%,100% { opacity: .3; transform: none; } 50% { opacity: 1; transform: translateY(-3px); } }
.error { color: var(--wine); }

.reader-bar { position: sticky; top: var(--hdr, 56px); margin: 0 -18px; padding-left: 18px !important; padding-right: 18px !important; z-index: 4; display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; padding: 12px 0 8px; background: var(--bg); }
.reader-bar select, .jump input { width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px 12px; background: var(--card); }
.jump { display: flex; gap: 8px; margin-bottom: 6px; }
.chapter h2 { font: 600 28px/1.2 var(--serif); color: var(--plum); margin: 18px 0 14px; }
.chapter p { font: 19px/1.75 var(--serif); margin: 0; }
.chapter sup { font: 700 11px var(--sans); color: var(--gold); margin: 0 3px 0 6px; }
.chapter .hl { background: var(--gold-soft); border-radius: 4px; }
.pager { display: flex; justify-content: space-between; margin-top: 24px; }

.about p { color: var(--ink); }
.fine { font-size: 13px; color: var(--muted); margin-top: 20px; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; justify-content: center; gap: 4px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.95); backdrop-filter: blur(10px); border-top: 1px solid var(--line); }
.tabs button { flex: 0 1 120px; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; padding: 6px; border-radius: 12px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button span { font-size: 18px; line-height: 1; }
.tabs button.on { color: var(--plum); background: var(--gold-soft); }

.toast { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--plum); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; transition: .25s; z-index: 10; }
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (min-width: 900px) {
  main { max-width: 760px; }
  .hero h1 { font-size: 42px; }
}
.fbnote { display: flex; gap: 8px; margin-top: 10px; }
.fbnote textarea, .fbdump { flex: 1; width: 100%; border: 1.5px solid var(--line); border-radius: 12px; padding: 10px; font-size: 16px; resize: vertical; background: var(--card); }
.fbdump { margin-top: 10px; min-height: 120px; }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
.trpick { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.trpick select { border: 1.5px solid var(--line); border-radius: 10px; padding: 6px 10px; background: var(--card); font-size: 16px; color: var(--plum); }
