:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #dbe6f7;
  --paper: #f5f8ff;
  --panel: #ffffff;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --shadow: 0 18px 45px rgba(37, 99, 235, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  min-height: 100vh;
  padding: 24px;
}

.workspace,
.settings {
  min-width: 0;
}

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

.topbar {
  margin-bottom: 18px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 32px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 19px;
}

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

.primary-button,
.secondary-button,
.layout-grid button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

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

.secondary-button,
.layout-grid button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.dropzone {
  position: relative;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 72px;
  border: 2px dashed #b7c8e6;
  border-radius: 8px;
  background: #eef5ff;
  padding: 12px 14px;
  color: var(--ink);
}

.dropzone.is-dragging {
  border-color: var(--accent);
  background: #eaf2ff;
}

.dropzone input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dropzone span {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 26px;
  font-weight: 900;
}

.dropzone strong {
  display: block;
  font-size: 15px;
  line-height: 1.35;
}

.panel-title span,
.preview-head span,
.image-item span,
.list-empty {
  color: var(--muted);
}

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

.preview-panel {
  overflow: hidden;
}

.preview-head,
.panel {
  padding: 18px;
}

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

.canvas-wrap {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 360px;
  max-height: 62vh;
  overflow: auto;
  padding: 28px;
  background:
    linear-gradient(45deg, #eef3fb 25%, transparent 25%),
    linear-gradient(-45deg, #eef3fb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3fb 75%),
    linear-gradient(-45deg, transparent 75%, #eef3fb 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

canvas {
  width: auto;
  max-width: min(100%, 760px);
  max-height: 54vh;
  height: auto;
  background: #fff;
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.16);
}

canvas.is-editable {
  cursor: grab;
}

canvas.is-editable.is-dragging {
  cursor: grabbing;
}

.empty-state {
  position: absolute;
  color: var(--muted);
  font-weight: 800;
}

.settings {
  display: grid;
  align-content: start;
  gap: 16px;
}

.panel {
  display: grid;
  gap: 12px;
}

.layout-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.layout-grid button.is-active {
  background: var(--accent);
  color: #fff;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 0 10px;
}

.free-tip {
  padding-top: 2px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.6;
}

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

  .topbar,
  .preview-head {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .canvas-wrap {
    min-height: 300px;
    max-height: 56vh;
    padding: 16px;
  }

  canvas {
    max-width: min(100%, 620px);
    max-height: 48vh;
  }
}
