:root {
  --ink: #18312b; --muted: #687a75; --paper: #f7f5ef; --white: #fff;
  --green: #173f35; --green-2: #2d6254; --gold: #c89f56; --line: #dce2dd;
  --error: #9d2f2f; --shadow: 0 14px 40px rgba(20, 49, 42, .08); --radius: 18px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: linear-gradient(180deg, #eef3ef 0, var(--paper) 320px); font: 16px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.skip-link { position: fixed; left: 1rem; top: -4rem; z-index: 20; padding: .7rem 1rem; color: white; background: var(--green); border-radius: 8px; }
.skip-link:focus { top: 1rem; }
.site-header { display: flex; align-items: center; gap: .75rem; min-height: 72px; max-width: 1180px; margin: auto; padding: .8rem 1rem; }
.site-header h1 { margin: 0; font-family: Georgia, serif; font-size: 1.35rem; letter-spacing: -.02em; }
.site-header p { display: none; margin: 0; color: var(--muted); font-size: .85rem; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: white; background: var(--green); font: 700 .75rem Georgia, serif; }
.app-shell { width: min(1180px, calc(100% - 1.25rem)); margin: .4rem auto 4rem; display: grid; gap: 1rem; }
.panel { padding: 1.15rem; background: rgba(255,255,255,.96); border: 1px solid rgba(220,226,221,.9); border-radius: var(--radius); box-shadow: var(--shadow); }
.section-heading { display: flex; gap: .8rem; align-items: flex-start; margin-bottom: 1.25rem; }
.section-heading > span { color: var(--gold); font-weight: 800; letter-spacing: .08em; font-size: .75rem; padding-top: .3rem; }
h2 { margin: 0; font: 600 1.5rem/1.2 Georgia, serif; }
.section-heading p, .result-header p { margin: .25rem 0 0; color: var(--muted); }
.primary-fields, .control-grid { display: grid; gap: .95rem; }
.field { display: grid; gap: .35rem; }
label { font-size: .83rem; font-weight: 750; letter-spacing: .02em; }
input, select, textarea { width: 100%; min-height: 46px; padding: .7rem .8rem; color: var(--ink); background: #fbfcfa; border: 1px solid #bfcac4; border-radius: 10px; }
input::placeholder { color: #87958f; }
small { color: var(--muted); font-size: .76rem; }
.field-error { color: var(--error); }
.customize { margin: 1.2rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.customize summary { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 0; font-weight: 700; cursor: pointer; }
.customize summary span { flex: 0 0 auto; color: var(--muted); font-size: .73rem; text-transform: uppercase; letter-spacing: .06em; }
.control-grid { padding: 0 0 1.1rem; }
.primary-button { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: .85rem 1rem; border: 0; border-radius: 11px; color: white; background: var(--green); font-weight: 750; }
.primary-button:hover { background: var(--green-2); }
.primary-button:disabled { opacity: .65; cursor: wait; }
.message { margin-top: 1rem; padding: .75rem; border-radius: 9px; }
.error-message { color: #762525; background: #fbe9e7; border: 1px solid #e8c0bb; }
.job-panel { background: var(--green); color: white; }
.status-top, .status-meta, .result-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.eyebrow { margin: 0 0 .2rem !important; color: var(--gold) !important; font-size: .7rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
#progressValue { font: 600 1.55rem Georgia, serif; }
progress { width: 100%; height: 10px; margin: 1rem 0 .45rem; accent-color: var(--gold); }
.status-meta { color: #d9e5e1; font-size: .8rem; }
.result-layout { display: grid; gap: 1rem; }
.toc-panel { align-self: start; }
.toc-panel nav { display: grid; gap: .35rem; margin-top: .8rem; }
.toc-panel a { color: var(--green-2); text-decoration: none; font-size: .88rem; border-left: 2px solid var(--line); padding-left: .65rem; }
.toc-panel a.sub { margin-left: .65rem; font-size: .8rem; }
.result-header { padding-bottom: 1rem; border-bottom: 1px solid var(--line); }
.secondary-button, .sticky-actions button { padding: .55rem .7rem; color: var(--green); background: white; border: 1px solid #b7c5bf; border-radius: 8px; font-size: .78rem; font-weight: 700; }
.sermon-content { padding: 1rem 0 4rem; font-family: Georgia, serif; font-size: 1.05rem; }
.sermon-content h1 { font-size: 2rem; line-height: 1.15; }
.sermon-content h2 { margin-top: 1.8rem; padding-bottom: .35rem; border-bottom: 1px solid var(--line); }
.sermon-content h3 { margin-top: 1.4rem; }
.sermon-content blockquote { margin-inline: 0; padding: .5rem 1rem; color: var(--green-2); border-left: 3px solid var(--gold); background: #f7f5ed; }
.sermon-content a { color: #1d5d88; overflow-wrap: anywhere; }
#markdownEditor { min-height: 60vh; margin-top: 1rem; font: .9rem/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; resize: vertical; }
.sticky-actions { position: sticky; bottom: .6rem; display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; padding: .55rem; background: rgba(247,245,239,.96); border: 1px solid var(--line); border-radius: 12px; backdrop-filter: blur(10px); }
.recent-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.recent-list button { width: 100%; display: flex; justify-content: space-between; gap: .5rem; padding: .7rem; text-align: left; background: #fafbf9; border: 1px solid var(--line); border-radius: 9px; }
.recent-list small { white-space: nowrap; }
.empty-state { color: var(--muted); font-size: .9rem; }
.toast { position: fixed; z-index: 10; left: 50%; bottom: 1.2rem; transform: translateX(-50%); padding: .7rem 1rem; color: white; background: #142d27; border-radius: 9px; box-shadow: var(--shadow); }
.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; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #d7a84b; outline-offset: 3px; }
@media (min-width: 640px) {
  .site-header p { display: block; }
  .panel { padding: 1.6rem; }
  .primary-fields { grid-template-columns: minmax(0, 2.2fr) minmax(150px, .8fr); }
  .control-grid { grid-template-columns: 1fr 1fr; }
  .control-grid .full { grid-column: 1 / -1; }
  .primary-button { width: auto; min-width: 220px; margin-left: auto; gap: 2rem; }
  .sticky-actions { display: flex; justify-content: flex-end; }
}
@media (min-width: 900px) {
  .app-shell { gap: 1.35rem; }
  .result-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .toc-panel { position: sticky; top: 1rem; }
  .control-grid { grid-template-columns: repeat(4, 1fr); }
}
@media print {
  body { background: white; }
  .site-header, .form-panel, .job-panel, .toc-panel, .recent-panel, .sticky-actions, .result-header button { display: none !important; }
  .app-shell, .result-layout { display: block; width: 100%; margin: 0; }
  .panel { border: 0; box-shadow: none; padding: 0; }
  .sermon-content { font-size: 11pt; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
