:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e9f0;
  --brand: #3b82f6;
  --brand-d: #2563eb;
  --accent-soft: #eef4ff;
  --radius: 14px;
  --shadow: 0 6px 24px rgba(31, 41, 55, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  background: linear-gradient(120deg, #ffffff 0%, #eef4ff 100%);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  width: 48px; height: 48px; border-radius: 12px;
  background: #fff; display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.brand-text h1 { font-size: 19px; margin: 0; letter-spacing: .3px; }
.brand-text p { font-size: 12.5px; margin: 2px 0 0; color: var(--muted); }
.badge {
  font-size: 12.5px; color: var(--brand-d);
  background: var(--accent-soft);
  border: 1px solid #d6e4ff;
  padding: 7px 12px; border-radius: 999px; white-space: nowrap;
}

/* Layout */
.container { max-width: 1180px; margin: 0 auto; padding: 24px; }

/* Uploader */
.uploader { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 18px 0 8px; }
.dropzone {
  width: 100%; max-width: 620px;
  border: 2px dashed #c7d2e6; border-radius: var(--radius);
  background: #fff; padding: 40px 24px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s, transform .05s;
}
.dropzone:hover, .dropzone:focus { border-color: var(--brand); background: var(--accent-soft); outline: none; }
.dropzone.drag { border-color: var(--brand-d); background: #e3edff; }
.dz-icon { margin-bottom: 10px; }
.dz-title { font-size: 16px; margin: 0 0 4px; }
.dz-title .link { color: var(--brand-d); font-weight: 600; }
.dz-sub { font-size: 13px; color: var(--muted); margin: 0; }
.hint { font-size: 12.5px; color: var(--muted); text-align: center; max-width: 620px; }

/* Workspace */
.workspace { display: grid; grid-template-columns: 300px 1fr; gap: 22px; align-items: start; }

.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  position: sticky; top: 16px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel-head h2 { font-size: 15px; margin: 0; }

.field { margin-top: 16px; }
.field label { display: flex; justify-content: space-between; align-items: baseline; font-size: 13.5px; font-weight: 600; }
.field .val { color: var(--brand-d); font-weight: 700; font-variant-numeric: tabular-nums; }
.field small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.field.row { margin-top: 18px; }
.checkbox { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--brand); }

input[type="range"] {
  width: 100%; margin-top: 8px; accent-color: var(--brand); cursor: pointer;
}
select {
  width: 100%; margin-top: 8px; padding: 8px 10px; border-radius: 9px;
  border: 1px solid var(--line); background: #fff; font-size: 13.5px; color: var(--ink);
}

/* Preview */
.preview {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow);
}
.preview-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 14px;
}
.pager { display: flex; align-items: center; gap: 8px; }
.page-label { font-size: 13.5px; color: var(--muted); min-width: 92px; text-align: center; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; flex: 1; padding-bottom: 4px; }
.thumb {
  width: 42px; height: 56px; border: 2px solid transparent; border-radius: 6px;
  overflow: hidden; cursor: pointer; background: #f0f2f5; flex: 0 0 auto; padding: 0;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.active { border-color: var(--brand); }

.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pane { margin: 0; }
.pane figcaption {
  font-size: 12.5px; font-weight: 600; color: var(--muted);
  margin-bottom: 6px; text-align: center;
}
.canvas-wrap {
  background:
    linear-gradient(45deg, #eceff3 25%, transparent 25%) 0 0/16px 16px,
    linear-gradient(-45deg, #eceff3 25%, transparent 25%) 0 0/16px 16px,
    linear-gradient(45deg, transparent 75%, #eceff3 75%) 0 0/16px 16px,
    linear-gradient(-45deg, transparent 75%, #eceff3 75%) 0 0/16px 16px,
    #f7f9fc;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px; display: grid; place-items: center; min-height: 220px;
}
.canvas-wrap canvas { max-width: 100%; height: auto; box-shadow: 0 2px 10px rgba(0,0,0,.12); border-radius: 3px; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.busy { color: var(--brand-d); font-size: 13px; margin: 10px 0 0; }

/* Buttons */
.btn-primary, .btn-secondary, .btn-ghost {
  font-size: 14px; font-weight: 600; border-radius: 10px;
  padding: 10px 16px; cursor: pointer; border: 1px solid transparent;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-d); }
.btn-secondary { background: #fff; color: var(--brand-d); border-color: #c7d2e6; }
.btn-secondary:hover { background: var(--accent-soft); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { background: #f1f4f8; color: var(--ink); }
.btn-primary:active, .btn-secondary:active, .btn-ghost:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }

/* Footer */
.footer { text-align: center; color: var(--muted); font-size: 12.5px; padding: 24px; }
.footer a { color: var(--brand-d); }

/* Responsive */
@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; }
  .panel { position: static; }
  .compare { grid-template-columns: 1fr; }
}
