:root {
  --bg: #f5f1e8;
  --paper: #fffdf8;
  --ink: #1f2a2c;
  --muted: #697274;
  --line: #d9d2c4;
  --accent: #6c4d2f;
  --accent-dark: #503820;
  --soft: #eee5d7;
  --shadow: 0 16px 45px rgba(50, 42, 30, .08);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #fffdf7 0, var(--bg) 42rem);
  color: var(--ink);
}
a { color: inherit; }
.page { width: min(900px, calc(100% - 32px)); margin: 0 auto; padding: 72px 0 42px; }
.hero { text-align: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 800; color: var(--accent); }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(2.3rem, 6vw, 4.6rem); line-height: .98; margin: 12px 0 18px; letter-spacing: -.03em; }
.lead { max-width: 690px; margin: 0 auto; color: var(--muted); font-size: 1.08rem; line-height: 1.7; }
.search-box { margin: 36px auto 0; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); padding: 14px; border-radius: 20px; text-align: left; }
textarea { width: 100%; resize: vertical; min-height: 92px; border: 0; outline: 0; background: transparent; color: var(--ink); font: inherit; font-size: 1.08rem; line-height: 1.55; padding: 8px 10px; }
textarea::placeholder { color: #999287; }
.search-actions { display: flex; align-items: center; gap: 16px; justify-content: space-between; border-top: 1px solid var(--line); padding: 12px 4px 0 10px; }
.examples { color: var(--muted); font-size: .85rem; }
button, .primary-link { border: 0; border-radius: 999px; padding: 12px 18px; font-weight: 800; background: var(--accent); color: white; cursor: pointer; text-decoration: none; white-space: nowrap; }
button:hover, .primary-link:hover { background: var(--accent-dark); }
button:disabled { opacity: .65; cursor: wait; }
.status { min-height: 28px; margin: 30px 0 10px; text-align: center; color: var(--muted); }
.results { display: grid; gap: 18px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); }
.result-card { padding: 28px; }
.result-topline { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.result-card h2 { font-family: Georgia, "Times New Roman", serif; font-size: 2rem; margin: 5px 0 0; }
.match-badge { background: var(--soft); color: var(--accent-dark); padding: 7px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
blockquote { margin: 24px 0 18px; padding: 0 0 0 20px; border-left: 3px solid var(--accent); font-family: Georgia, "Times New Roman", serif; font-size: 1.25rem; line-height: 1.7; }
.reason { color: var(--muted); line-height: 1.6; }
.result-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; }
.secondary-link { font-weight: 750; color: var(--accent); text-underline-offset: 3px; }
footer { margin: 40px auto 0; max-width: 760px; color: var(--muted); font-size: .88rem; line-height: 1.6; text-align: center; }
.sr-only { position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0; }
.chapter-page { max-width: 760px; }
.back { display: inline-block; margin-bottom: 34px; color: var(--accent); font-weight: 750; text-decoration: none; }
.chapter-header { text-align: center; margin-bottom: 24px; }
.chapter-header h1 { font-size: clamp(2.4rem, 7vw, 4rem); }
.chapter-text { padding: 28px 34px; }
.chapter-text p { font-family: Georgia, "Times New Roman", serif; font-size: 1.13rem; line-height: 1.78; margin: .55em 0; }
.chapter-text sup { color: var(--accent); font-family: Inter, sans-serif; font-size: .7em; font-weight: 800; margin-right: 4px; }
.source-note { color: var(--muted); text-align: center; font-size: .86rem; line-height: 1.5; }
.error-card { padding: 24px; }
@media (max-width: 650px) {
  .page { padding-top: 42px; }
  .search-actions, .result-topline { align-items: stretch; flex-direction: column; }
  button { width: 100%; }
  .examples { line-height: 1.45; }
  .result-card, .chapter-text { padding: 22px; }
  .result-actions { align-items: flex-start; flex-direction: column; }
}
.chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 28px;
}

.chapter-nav-side {
    flex: 1;
}

.chapter-nav-next {
    text-align: right;
}

.chapter-button {
    display: inline-block;
    text-decoration: none;
}

@media (max-width: 600px) {
    .chapter-nav {
        gap: 10px;
    }

    .chapter-button {
        font-size: 14px;
        padding-left: 12px;
        padding-right: 12px;
    }
}