:root {
  color-scheme: light;
  --bg: #f2efe8;
  --paper: #fffaf0;
  --paper-strong: #fffdf8;
  --ink: #1e1f19;
  --muted: #5e6253;
  --line: #d8cfbe;
  --line-strong: #bba98e;
  --accent: #c45d1f;
  --accent-strong: #8a3e12;
  --code-bg: #2b2f2a;
  --code-ink: #f2f1eb;
  --shadow: 0 18px 40px rgba(85, 64, 39, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(196, 93, 31, 0.14), transparent 28%),
    linear-gradient(180deg, #f9f3e7 0%, var(--bg) 100%);
}

button,
select,
textarea,
a {
  font: inherit;
}

.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 32px 20px 40px;
}

.hero {
  max-width: 52ch;
  margin-bottom: 28px;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 6px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-strong);
}

.hero h1,
.panel h2,
.table-card h3 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
}

.hero h1 {
  font-size: clamp(1.4rem, 1.8vw, 2rem);
  line-height: 1.1;
  margin-bottom: 0;
}

.intro {
  max-width: 62ch;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.panel,
.table-card {
  background: rgba(255, 250, 240, 0.88);
  border: 1px solid rgba(187, 169, 142, 0.85);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(340px, 1fr);
  gap: 20px;
}

.panel {
  border-radius: 28px;
  padding: 20px;
}

.panel-head,
.table-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-head {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 5px 12px;
  font-size: 0.82rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff7ef;
  text-decoration: none;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

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

.ghost-button {
  background: transparent;
  color: var(--accent-strong);
  border-color: var(--line-strong);
}

.field {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.field span,
.panel-note {
  font-size: 0.92rem;
  color: var(--muted);
}

.field.compact {
  margin-top: 0;
}

textarea,
select {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  color: var(--ink);
}

textarea {
  min-height: 72vh;
  margin-top: 18px;
  padding: 12px 18px;
  resize: vertical;
  line-height: 1.55;
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-size: 0.95rem;
}

select {
  min-height: 44px;
  padding: 0 14px;
}

.status {
  font-size: 0.85rem;
}

.status,
.subtle,
.table-note {
  margin: 0;
  color: var(--muted);
}

.subtle {
  font-size: 0.9rem;
}

.preview {
  min-height: 72vh;
  margin-top: 18px;
  padding: 12px 22px 22px;
  border-radius: 22px;
  background: var(--paper);
  border: 1px solid var(--line);
  overflow: auto;
}

.preview > :first-child {
  margin-top: 0;
}

.preview h1,
.preview h2,
.preview h3,
.preview h4,
.preview h5,
.preview h6 {
  margin-top: 1.1em;
  margin-bottom: 0.45em;
}

.preview p,
.preview ul,
.preview ol,
.preview blockquote,
.preview pre {
  margin-top: 0;
  margin-bottom: 1em;
}

.preview a {
  color: var(--accent-strong);
}

.preview pre,
.preview code.inline-code {
  font-family: "SFMono-Regular", "Menlo", "Consolas", monospace;
}

.preview pre {
  padding: 14px 16px;
  overflow: auto;
  border-radius: 18px;
  background: var(--code-bg);
  color: var(--code-ink);
}

.preview code.inline-code {
  padding: 0.12em 0.34em;
  border-radius: 0.4em;
  background: rgba(43, 47, 42, 0.08);
}

.preview blockquote {
  padding: 14px 18px;
  border-left: 4px solid var(--accent);
  background: rgba(196, 93, 31, 0.07);
}

.preview .spoiler {
  color: transparent;
  background: var(--ink);
  border-radius: 0.28em;
  padding: 0 0.22em;
}

@media (max-width: 980px) {
  textarea,
  .preview {
    min-height: 50vh;
  }

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

  .panel-head,
  .table-card-head {
    flex-direction: column;
    align-items: flex-start;
  }
}

.table-placeholder {
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px dashed var(--line-strong);
  background: rgba(196, 93, 31, 0.06);
}

.table-placeholder p:last-child {
  margin-bottom: 0;
}

.table-exports {
  margin-top: 18px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.table-export-list {
  display: grid;
  gap: 16px;
}

.table-card {
  padding: 16px;
  border-radius: 22px;
}

.table-svg-wrap {
  margin-top: 14px;
  overflow: auto;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--line);
}

.table-svg-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.toast {
  position: fixed;
  top: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 10px 24px;
  border-radius: 999px;
  background: var(--code-bg);
  color: var(--code-ink);
  font-size: 0.92rem;
  opacity: 0;
  transition: opacity 200ms ease, transform 200ms ease;
  pointer-events: none;
  z-index: 100;
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.hidden {
  display: none;
}
