:root {
  --bg: #f4ede3;
  --surface: rgba(255, 252, 246, 0.92);
  --surface-strong: #fffaf1;
  --ink: #23170f;
  --muted: #6c5b4a;
  --line: rgba(50, 30, 14, 0.12);
  --red: #c14c2b;
  --blue: #245a8d;
  --gold: #b68423;
  --green: #41694b;
  --shadow: 0 20px 60px rgba(78, 48, 19, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI Variable", "Noto Sans SC", "PingFang SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(193, 76, 43, 0.18), transparent 26%),
    radial-gradient(circle at bottom right, rgba(36, 90, 141, 0.16), transparent 24%),
    linear-gradient(135deg, #f7f1e8 0%, #efe4d6 45%, #f6eee4 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(35, 23, 15, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(35, 23, 15, 0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.75), transparent 90%);
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(145deg, rgba(255, 250, 241, 0.95), rgba(255, 245, 231, 0.88));
  box-shadow: var(--shadow);
}

.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  top: -60px;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(36, 90, 141, 0.22), transparent 72%);
}

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

h1 {
  margin: 0;
  font-family: "Georgia", "Times New Roman", serif;
  font-size: clamp(40px, 8vw, 72px);
  line-height: 0.98;
}

.hero-copy {
  width: min(720px, 100%);
  margin: 18px 0 0;
  font-size: 18px;
  line-height: 1.7;
  color: var(--muted);
}

.hero-actions,
.grid {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.hero-actions {
  margin-top: 24px;
}

.workspace {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 22px;
}

.output-panel {
  padding: 22px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

.panel-heading h2,
.panel-heading h3 {
  margin: 0;
  font-size: 22px;
}

.panel-tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(35, 23, 15, 0.06);
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field span {
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
  color: var(--muted);
}

textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(35, 23, 15, 0.12);
  border-radius: 16px;
  background: var(--surface-strong);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

textarea:focus,
select:focus {
  outline: 2px solid rgba(36, 90, 141, 0.22);
  border-color: rgba(36, 90, 141, 0.4);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

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

.primary-button {
  background: linear-gradient(135deg, #1d4d78, #275e8f);
  color: #fffdf9;
  box-shadow: 0 12px 30px rgba(36, 90, 141, 0.22);
}

.ghost-button {
  background: rgba(35, 23, 15, 0.05);
  color: var(--ink);
}

.wide-button {
  width: 100%;
  margin-top: 6px;
}

.output-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.result-card,
.markdown-panel {
  padding: 18px;
  border-radius: 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
}

.result-card h3 {
  margin: 0 0 12px;
  font-size: 18px;
}

.result-card p,
.result-card li {
  line-height: 1.7;
  color: var(--muted);
}

.result-card ul,
.result-card ol {
  margin: 0;
  padding-left: 20px;
}

.accent-red {
  box-shadow: inset 0 0 0 1px rgba(193, 76, 43, 0.16);
}

.accent-blue {
  box-shadow: inset 0 0 0 1px rgba(36, 90, 141, 0.16);
}

.accent-gold {
  box-shadow: inset 0 0 0 1px rgba(182, 132, 35, 0.16);
}

.accent-green {
  box-shadow: inset 0 0 0 1px rgba(65, 105, 75, 0.16);
}

.markdown-panel {
  margin-top: 14px;
}

#markdown-output {
  min-height: 280px;
  background: #fffdf9;
}

@media (max-width: 980px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .output-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100% - 18px, 1180px);
    padding-top: 18px;
  }

  .hero,
  .input-panel,
  .output-panel {
    padding: 18px;
  }

  h1 {
    font-size: 42px;
  }
}
