:root {
  /* Wedding warm palette: terracotta + honey-gold + sage, on warm ivory */
  --ink: #2a1f1c;          /* warm near-black, hint of brown */
  --ink-soft: #6b5751;     /* warm taupe (replaced slate) */
  --bg: #faf6ee;           /* warm ivory */
  --card: #ffffff;
  --line: #ead8c4;         /* soft blush-beige */
  --accent: #8d4f3e;       /* terracotta (replaced coffee brown) */
  --accent-soft: #b07a6b;  /* rose-clay */
  --gold: #c89854;         /* warm honey-gold */
  --sage: #6b8a6c;         /* sage green accent */
  --blush: #e8c4b0;        /* soft blush */
  --danger: #a23838;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(45,25,20,0.07), 0 8px 24px rgba(45,25,20,0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 17px;
}

.wrap { max-width: 760px; margin: 0 auto; padding: 0 20px; }

.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; }
.brand {
  font-size: 22px;
  font-weight: bold;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}
.brand span { color: var(--gold); font-weight: normal; font-style: italic; }
nav a { color: var(--ink-soft); text-decoration: none; margin-left: 20px; font-size: 14px; }
nav a:hover { color: var(--accent); }
nav a.pro-link { color: var(--accent-soft); }
nav a.kit-link { color: var(--accent-soft); }
nav a.agency-link { color: var(--accent-soft); }
.pro-tag, .kit-tag, .agency-tag { color: #fff; font-size: 9px; padding: 2px 5px; border-radius: 3px; margin-left: 3px; vertical-align: middle; font-family: -apple-system, sans-serif; font-weight: bold; letter-spacing: 0.05em; }
.pro-tag { background: var(--gold); }
.kit-tag { background: var(--sage); }
.agency-tag { background: #6b2f24; }
@media (max-width: 900px) {
  nav a { margin-left: 8px; font-size: 12px; }
  .pro-tag, .kit-tag { display: none; }
}
@media (max-width: 600px) {
  nav a:not(:first-child):not(:last-child) { display: none; }
}

.app { padding: 40px 20px 80px; }

.hero { text-align: center; margin-bottom: 32px; }
.hero h1 {
  font-size: 32px;
  line-height: 1.25;
  margin: 0 0 12px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.hero .lede {
  font-size: 18px;
  color: var(--ink-soft);
  margin: 0 auto;
  max-width: 580px;
}
.trial-note {
  display: inline-block;
  margin-top: 16px;
  background: #fff8e6;
  border: 1px solid #f0d896;
  border-radius: var(--radius);
  padding: 8px 14px;
  font-size: 14px;
  color: #6b4d12;
}
.trial-note.muted { background: #f1ede4; border-color: var(--line); color: var(--ink-soft); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}
.card h2 {
  margin: 0 0 24px;
  font-size: 22px;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
@media (max-width: 600px) { .row { grid-template-columns: 1fr; } }

label { display: block; margin-bottom: 16px; }
label > span {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: var(--ink);
  margin-bottom: 6px;
  font-family: -apple-system, sans-serif;
}
label em { color: var(--danger); font-style: normal; }

input[type="text"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fafaf7;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-soft);
  background: #fff;
}
textarea { resize: vertical; min-height: 80px; }

.btn-primary, button.btn-primary {
  display: block;
  width: 100%;
  padding: 14px 28px;
  font-size: 17px;
  font-weight: bold;
  font-family: -apple-system, sans-serif;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  letter-spacing: 0.02em;
  transition: background 0.15s;
  margin-top: 8px;
}
.btn-primary:hover { background: #6b2f24; }
.btn-primary:disabled { background: #a89b8e; cursor: not-allowed; }

.output { padding: 32px; }
.output-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  flex-wrap: wrap;
}
.output-actions button {
  padding: 8px 14px;
  font-size: 14px;
  font-family: -apple-system, sans-serif;
  background: #f1ede4;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}
.output-actions button:hover { background: #e8e2d4; }

#sermonText, #resultText {
  white-space: pre-wrap;
  font-size: 17px;
  line-height: 1.75;
  color: var(--ink);
}
#sermonText, #resultText h1, #sermonText, #resultText h2, #sermonText, #resultText h3 {
  color: var(--accent);
  font-family: Georgia, serif;
}

.loading { text-align: center; padding: 60px 20px; }
.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

dialog {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: 0 12px 48px rgba(0,0,0,0.2);
  max-width: 420px;
  width: 90%;
  background: var(--card);
}
dialog::backdrop { background: rgba(45,25,20,0.5); }
dialog h3 { margin: 0 0 8px; color: var(--accent); }
dialog .muted { color: var(--ink-soft); font-size: 14px; margin: 0 0 16px; font-family: -apple-system, sans-serif; }
dialog input { margin-bottom: 16px; font-family: monospace; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; }
.dialog-actions button { padding: 10px 18px; border-radius: var(--radius); border: 1px solid var(--line); background: #f1ede4; cursor: pointer; font-family: -apple-system, sans-serif; font-size: 14px; }
.dialog-actions .btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }

.foot {
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 24px 0;
  text-align: center;
  font-size: 14px;
  color: var(--ink-soft);
  font-family: -apple-system, sans-serif;
  margin-top: 60px;
}
.foot a { color: var(--accent); }

@media print {
  .topbar, .foot, .output-actions, #sermonForm, .hero, .loading { display: none !important; }
  .card { border: none; box-shadow: none; padding: 0; }
}
