:root {
  --bg: #faf8f4;
  --surface: #ffffff;
  --text: #1f1d1a;
  --muted: #6d675e;
  --faint: #a39d93;
  --line: #e7e2d9;
  --accent: #8a4b14;
  --accent-soft: #f4e9dc;
  --hit: #fff4d6;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 16px rgba(40, 30, 10, .05);
  --serif: "Source Serif 4", Georgia, serif;
  --sans: Inter, system-ui, -apple-system, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513; --surface: #1f1e1b; --text: #ece8e1; --muted: #a8a196; --faint: #6f6a62;
    --line: #34322d; --accent: #e0a564; --accent-soft: #3a2c1d; --hit: #3a3220;
    --shadow: 0 1px 2px rgba(0,0,0,.3);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); }
button { font: inherit; color: inherit; cursor: pointer; }

.top {
  position: sticky; top: 0; z-index: 10; display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
  padding: 12px 24px; background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--serif); font-weight: 600; font-size: 20px; color: var(--text); text-decoration: none; }
.search { flex: 1 1 420px; display: flex; min-width: 0; }
.search input {
  flex: 1; min-width: 0; padding: 11px 14px; font-size: 15px; border: 1px solid var(--line); border-right: 0;
  border-radius: 10px 0 0 10px; background: var(--surface); color: var(--text); outline: none;
}
.search input:focus { border-color: var(--accent); }
.search button {
  padding: 0 18px; border: 1px solid var(--accent); background: var(--accent); color: var(--bg);
  border-radius: 0 10px 10px 0; font-weight: 600;
}
.controls { display: flex; gap: 14px; align-items: center; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 10px; font-size: 13px; color: var(--muted); }
.seg button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.toggle { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }

main { max-width: 820px; margin: 0 auto; padding: 24px 16px 80px; }
.intro { text-align: center; padding: 48px 0 16px; }
.intro h1 { font-family: var(--serif); font-weight: 600; font-size: 34px; margin: 0 0 8px; }
.intro p { color: var(--muted); margin: 0 0 24px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chips button {
  border: 1px solid var(--line); background: var(--surface); padding: 7px 12px; border-radius: 999px;
  font-size: 13px; color: var(--muted);
}
.chips button:hover { border-color: var(--accent); color: var(--accent); }

.meta { color: var(--faint); font-size: 12px; margin: 4px 2px 12px; min-height: 16px; }
.answer {
  background: var(--accent-soft); border-radius: 12px; padding: 16px 18px; margin-bottom: 16px;
  font-family: var(--serif); font-size: 17px; line-height: 1.55;
}
.answer .label { font-family: var(--sans); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); font-weight: 600; margin-bottom: 6px; }
.answer a { color: var(--accent); }
.answer.loading { color: var(--muted); font-style: italic; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px;
  margin-bottom: 12px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.ref { font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0; font-size: 15px; }
.ref:hover { text-decoration: underline; }
a.ref, a.link { text-decoration: none; }
.xref a.sref { color: var(--accent); font-weight: 600; text-decoration: none; }
.heading { color: var(--muted); font-size: 13px; }
.text { font-family: var(--serif); font-size: 18px; line-height: 1.6; }
.text .v { }
.text .v.ctx { color: var(--muted); }
.text sup { font-family: var(--sans); font-size: 10px; color: var(--faint); margin-right: 2px; }
.card-foot { display: flex; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--faint); align-items: center; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font-size: 12px; }
.link:hover { color: var(--accent); }
.why { margin-left: auto; }
.xrefs { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 10px; display: grid; gap: 8px; }
.xref { font-size: 14px; line-height: 1.45; }
.xref b { color: var(--accent); font-weight: 600; cursor: pointer; }
.empty { color: var(--muted); text-align: center; padding: 40px 0; }
.skeleton { height: 96px; border-radius: 12px; margin-bottom: 12px;
  background: linear-gradient(90deg, var(--surface), var(--line), var(--surface)); background-size: 200% 100%;
  animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }

.reader {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); z-index: 20;
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: -8px 0 30px rgba(0,0,0,.12);
  display: flex; flex-direction: column;
}
.reader-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.reader-head h2 { flex: 1; margin: 0; font-family: var(--serif); font-size: 20px; text-align: center; }
.reader-head button { border: 0; background: none; font-size: 20px; padding: 4px 10px; color: var(--muted); }
.reader-body { overflow: auto; padding: 20px 24px 60px; font-family: var(--serif); font-size: 18px; line-height: 1.7; }
.reader-body .v.mark { background: var(--hit); border-radius: 3px; }
.reader-body h3 { font-family: var(--sans); font-size: 13px; color: var(--muted); margin: 18px 0 4px; }

.smeta { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.card.sermon .ref { font-family: var(--serif); font-size: 19px; text-align: left; }
.keyref { color: var(--accent); }
.excerpt { font-size: 16.5px; color: var(--text); }
.reader.sermon-mode #prev, .reader.sermon-mode #next { visibility: hidden; }
.reader.sermon-mode .reader-head h2 { font-size: 18px; }
.reader-body p { margin: 0 0 14px; font-size: 17px; }
.reader-body p.mark { background: var(--hit); border-radius: 4px; box-shadow: 0 0 0 6px var(--hit); }
.reader-body .key { font-style: italic; }
.reader-body .source { font-family: var(--sans); font-size: 12px; color: var(--faint); margin-top: 28px; }
.reader-body .source a { color: var(--muted); }

/* account menu (shared look) */
.account { font-size: 14px; }
.signin { color: var(--accent); font-weight: 600; text-decoration: none; }
.menu { position: relative; }
.menu summary { list-style: none; cursor: pointer; padding: 6px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu summary::-webkit-details-marker { display: none; }
.menu-body { position: absolute; right: 0; top: calc(100% + 6px); min-width: 200px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow); padding: 6px; display: grid; z-index: 30; }
.menu-body a, .menu-body button { text-align: left; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; border: 0; background: none; font-size: 14px; }
.menu-body a:hover, .menu-body button:hover { background: var(--accent-soft); }
.menu-email { padding: 6px 10px 8px; color: var(--faint); font-size: 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }


@media (max-width: 640px) {
  .top { padding: 10px 16px; gap: 10px; }
  .search { flex-basis: 100%; order: 3; }
  .intro h1 { font-size: 26px; }
  .text { font-size: 17px; }
}
