:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f6efe5;
  --card: #fffaf2;
  --ink: #24190d;
  --muted: #705f49;
  --rose: #a64d58;
  --rose-dark: #74333b;
  --gold: #b77b1f;
  --line: #ead8bd;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgb(255 229 198 / 90%), transparent 38rem),
    linear-gradient(135deg, #fff8ec, var(--bg));
}
.app {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 48px 0;
}
.hero { margin-bottom: 22px; }
.eyebrow {
  color: var(--rose-dark);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
h1 {
  margin: 0;
  font-size: clamp(2.1rem, 7vw, 4.7rem);
  line-height: 0.95;
}
h2 { margin: 0; font-size: 1.05rem; }
.lede {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.1rem;
}
.card {
  background: color-mix(in srgb, var(--card) 94%, white);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 18px 60px rgb(98 59 31 / 12%);
  padding: 22px;
  margin: 18px 0;
}
.guardrail {
  display: flex;
  gap: 10px;
  align-items: center;
  border-color: color-mix(in srgb, var(--rose) 45%, var(--line));
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 750;
}
.wide { grid-column: 1 / -1; }
input, select, textarea, button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  font: inherit;
  background: white;
  color: var(--ink);
}
textarea { resize: vertical; }
button {
  border-color: var(--rose);
  background: linear-gradient(180deg, #c96b76, #953f49);
  color: white;
  font-weight: 850;
  cursor: pointer;
}
button.secondary {
  color: var(--rose-dark);
  border-color: var(--line);
  background: #fff6eb;
}
button:disabled {
  opacity: 0.7;
  cursor: wait;
}
.actions {
  display: flex;
  gap: 12px;
  margin: 18px 0;
}
.actions button { max-width: 260px; }
#polished.editing {
  padding: 14px;
  border: 2px solid var(--rose);
  border-radius: 14px;
  background: #fffdf8;
  outline: none;
}
.helper-text {
  margin: 12px 0 0;
  font-size: 0.9rem;
}
#emailPreview {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
}
.preview-card {
  background: #fffdf8;
}
.output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.output-card { margin: 0; }
.wide-output { grid-column: 1 / -1; }
.ai-output {
  border-color: color-mix(in srgb, var(--rose) 50%, var(--line));
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-heading button {
  width: auto;
  min-width: 92px;
}
.button-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
pre {
  white-space: pre-wrap;
  word-wrap: break-word;
  margin: 0;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  line-height: 1.45;
}
.small { font-size: 0.95rem; }
.muted { color: var(--muted); }
@media (max-width: 850px) {
  .form-grid, .output-grid { grid-template-columns: 1fr; }
  .app { padding: 30px 0; }
}
@media (max-width: 560px) {
  .guardrail, .actions, .button-row { flex-direction: column; align-items: stretch; }
  .actions button, .section-heading button { max-width: none; width: 100%; }
}
