:root {
  color-scheme: light;
  --page: #eef2f5;
  --panel: #ffffff;
  --text: #26313c;
  --muted: #687786;
  --line: #dce4ea;
  --accent: #2e7d52;
  --accent-strong: #245f40;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--page);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafb;
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
}

button:hover {
  border-color: #bccbd7;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.primary:hover {
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.app {
  display: grid;
  grid-template-columns: minmax(380px, 520px) minmax(420px, 1fr);
  gap: 24px;
  width: min(1460px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.editor,
.preview-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.editor {
  padding: 22px;
}

.titlebar,
.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.icon-button {
  width: 56px;
  padding: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span,
.group-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 125, 82, 0.13);
}

.group {
  margin-top: 18px;
}

.group-title {
  margin-bottom: 8px;
}

.chips-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.status.ok {
  color: var(--accent);
}

.status.err {
  color: #b42318;
}

.history {
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.history-list button {
  height: 30px;
  padding: 0 10px;
  font-size: 12px;
}

.preview-shell {
  min-width: 0;
  padding: 18px;
}

.preview-toolbar {
  height: 42px;
  margin-bottom: 14px;
}

.preview {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 122px);
  border: 1px dashed #cbd6df;
  border-radius: 8px;
  background: #f9fbfc;
  overflow: auto;
  padding: 16px;
}

canvas {
  display: block;
  width: min(100%, 520px);
  height: auto;
  border-radius: 8px;
  box-shadow: 0 12px 34px rgba(31, 41, 55, 0.14);
}

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

  .preview {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .app {
    width: min(100vw - 20px, 1460px);
    padding: 10px 0;
  }

  .editor,
  .preview-shell {
    padding: 14px;
  }

  .form-grid,
  .chips-row {
    grid-template-columns: 1fr;
  }
}
