:root {
  --bg: #f4efe5;
  --bg-accent: #e9dcc4;
  --panel: rgba(255, 252, 247, 0.92);
  --panel-strong: #fffaf1;
  --ink: #1c1a17;
  --muted: #665f55;
  --line: rgba(53, 43, 28, 0.12);
  --primary: #8f2d1d;
  --primary-dark: #6d2014;
  --add: #16754a;
  --del: #a12626;
  --shadow: 0 24px 60px rgba(73, 54, 24, 0.14);
  --radius: 22px;
  --mono: "SFMono-Regular", "Menlo", "Consolas", monospace;
  --display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.85), transparent 34%),
    radial-gradient(circle at bottom right, rgba(143, 45, 29, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, #efe4cf 100%);
  font-family: var(--display);
}

.page-shell {
  width: min(1400px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.hero,
.workspace,
.editor-grid,
.preview-grid,
.section-head,
.button-row,
.options-grid {
  display: grid;
  gap: 16px;
}

.hero {
  grid-template-columns: 2fr 1fr;
  align-items: stretch;
  margin-bottom: 20px;
}

.hero-copy,
.hero-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 28px;
}

.hero-card {
  padding: 22px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(255, 250, 241, 0.95), rgba(242, 229, 206, 0.95));
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--primary);
}

h1,
h2 {
  margin: 0;
  font-weight: 700;
}

h1 {
  font-size: clamp(2.2rem, 4vw, 4.2rem);
  line-height: 0.95;
  max-width: 11ch;
}

h2 {
  font-size: 1.3rem;
}

.hero-text,
.status,
.notes-list,
.meta,
.stat-label,
.option-card small {
  color: var(--muted);
}

.hero-text {
  max-width: 60ch;
  font-size: 1rem;
  line-height: 1.55;
  margin: 16px 0 0;
}

.workspace {
  gap: 20px;
}

.panel {
  padding: 18px;
}

.controls-panel,
.output-panel,
.notes-panel {
  background: var(--panel-strong);
}

.section-head {
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 14px;
}

.button-row {
  grid-auto-flow: column;
  grid-auto-columns: max-content;
}

.options-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.style-config {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(245, 239, 229, 0.55);
}

.compact-head {
  margin-bottom: 10px;
}

.style-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.style-grid label {
  display: grid;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.style-grid input,
.style-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdf9;
  color: var(--ink);
  padding: 10px 12px;
  font: 0.9rem/1.2 var(--mono);
}

.style-grid input[type="color"] {
  min-height: 44px;
  padding: 4px;
}

.option-card {
  display: flex;
  align-items: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(245, 239, 229, 0.7);
}

.option-card input {
  margin-top: 3px;
}

.editor-grid,
.preview-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-panel textarea,
.output-panel textarea {
  width: 100%;
  min-height: 360px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #fffdf9;
  color: var(--ink);
  font: 0.94rem/1.5 var(--mono);
}

.output-panel textarea {
  min-height: 320px;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 11px 16px;
  font: 600 0.9rem/1 var(--mono);
  cursor: pointer;
  transition: transform 140ms ease, background-color 140ms ease, color 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary-button {
  color: #fff9f2;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.ghost-button {
  color: var(--ink);
  background: rgba(143, 45, 29, 0.08);
}

.ghost-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.stat {
  display: grid;
  gap: 4px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.stat:last-child {
  border-bottom: 0;
}

.stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-value {
  font-family: var(--mono);
  font-size: 1rem;
}

.status,
.meta,
.notes-list {
  font-size: 0.92rem;
}

.preview {
  --preview-add: var(--add);
  --preview-del: var(--del);
  min-height: 320px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: #fffdf9;
  font: 0.98rem/1.6 var(--display);
  white-space: pre-wrap;
  word-break: break-word;
}

.preview .add {
  color: var(--preview-add);
  background: color-mix(in srgb, var(--preview-add) 14%, white);
  border-radius: 6px;
  padding: 0 2px;
}

.preview .del {
  color: var(--preview-del);
  background: color-mix(in srgb, var(--preview-del) 12%, white);
  text-decoration: line-through;
  border-radius: 6px;
  padding: 0 2px;
}

.notes-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.55;
}

@media (max-width: 980px) {
  .hero,
  .editor-grid,
  .preview-grid,
  .section-head {
    grid-template-columns: 1fr;
  }

  .button-row {
    grid-auto-flow: row;
  }

  .page-shell {
    width: min(100vw - 20px, 1400px);
    padding-top: 14px;
  }

  .hero-copy,
  .hero-card,
  .panel {
    padding: 16px;
  }
}
