:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1d2430;
  --muted: #687080;
  --line: #dfe4ec;
  --orange: #ff5a1f;
  --pink: #f22466;
  --soft-orange: #fff1eb;
  --shadow: 0 18px 50px rgba(31, 43, 65, 0.12);
  font-family: "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 440px) minmax(420px, 1fr);
  gap: 24px;
  align-items: start;
}

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

.tool-panel {
  padding: 24px;
  position: sticky;
  top: 24px;
}

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

.panel-head h1 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: 0;
}

.panel-head p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.ghost-button,
.download-button,
.primary-button {
  border: 0;
  border-radius: 6px;
  min-height: 42px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 700;
}

.ghost-button {
  background: var(--soft-orange);
  color: var(--orange);
}

.primary-button {
  width: 100%;
  margin-top: 18px;
  color: #fff;
  background: linear-gradient(90deg, var(--orange), var(--pink));
}

.download-button {
  color: #fff;
  background: #202938;
}

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 160px;
  margin-top: 22px;
  padding: 18px;
  border: 1px dashed #ff8b5f;
  border-radius: 8px;
  background: #fff8f4;
  text-align: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.drop-zone.dragging {
  border-color: var(--pink);
  background: #fff0f5;
}

.drop-zone input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--orange), var(--pink));
  color: #fff;
  font-size: 28px;
  line-height: 1;
}

.drop-title {
  margin-top: 12px;
  font-size: 18px;
  font-weight: 800;
}

.drop-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.field-grid,
.editor {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

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

label {
  display: grid;
  gap: 8px;
  color: #344053;
  font-size: 13px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
  font-size: 14px;
  line-height: 1.45;
}

textarea {
  resize: vertical;
  min-height: 96px;
}

input:focus,
textarea:focus {
  border-color: #ff7a45;
  box-shadow: 0 0 0 3px rgba(255, 122, 69, 0.15);
}

.status {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.status.error {
  color: #c5221f;
}

.status.ok {
  color: #207245;
}

.preview-panel {
  min-width: 0;
  overflow: hidden;
}

.preview-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.preview-head div {
  display: grid;
  gap: 4px;
}

.preview-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.preview-head strong {
  font-size: 18px;
}

.canvas-wrap {
  max-height: calc(100vh - 130px);
  overflow: auto;
  padding: 24px;
  background:
    linear-gradient(45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2f7 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
  background-color: #f8fafc;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

canvas {
  display: block;
  width: min(100%, 740px);
  height: auto;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 10px 34px rgba(20, 29, 43, 0.18);
}

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

  .tool-panel {
    position: static;
  }

  .canvas-wrap {
    max-height: none;
  }
}

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

  .tool-panel,
  .preview-panel {
    border-radius: 8px;
  }

  .tool-panel {
    padding: 18px;
  }

  .panel-head,
  .preview-head {
    align-items: stretch;
    flex-direction: column;
  }

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

  .download-button,
  .ghost-button {
    width: 100%;
  }

  .canvas-wrap {
    padding: 12px;
  }
}
