:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e6e8ee;
  --brand: #2563eb;
  --brand-ink: #1d4ed8;
  --brand-soft: #eef3ff;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

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

a { color: var(--brand); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px 64px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(255,255,255,.86);
  backdrop-filter: saturate(1.6) blur(12px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 980px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px;
}
.logo { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; }
.logo-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700;
}
.spacer { flex: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 6px 12px; font-size: 13px; font-weight: 600;
}
.chip b { color: var(--brand); font-size: 15px; }
.chip-btn { background: var(--brand); border-color: var(--brand); color: #fff; }
.chip-btn:hover { background: var(--brand-ink); }

/* ---------- 标题 ---------- */
.hero { padding: 22px 0 6px; }
.hero h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.4px; }
.hero p { margin: 0; color: var(--ink-2); font-size: 14px; }

/* ---------- 工具切换 ---------- */
.tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 6px; margin: 16px 0; box-shadow: var(--shadow);
}
.tab {
  border: 0; background: transparent; border-radius: 10px; padding: 10px 6px;
  color: var(--ink-2); font-weight: 600; font-size: 14px; line-height: 1.25;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  transition: .18s;
}
.tab small { font-weight: 500; font-size: 11px; color: var(--ink-3); }
.tab.active { background: var(--brand-soft); color: var(--brand-ink); }
.tab.active small { color: var(--brand-ink); opacity: .75; }

/* ---------- 面板 ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px;
}
.panel h2 { margin: 0 0 4px; font-size: 16px; }
.panel .sub { margin: 0 0 14px; color: var(--ink-3); font-size: 13px; }

/* ---------- 上传区 ---------- */
.drop {
  border: 1.5px dashed #c9d0dd; border-radius: 14px; background: #fafbff;
  padding: 28px 16px; text-align: center; cursor: pointer; transition: .18s;
  position: relative; overflow: hidden;
}
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop .icon { font-size: 26px; }
.drop .t { font-weight: 600; margin-top: 6px; }
.drop .s { color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.drop img.preview { max-width: 100%; max-height: 320px; border-radius: 10px; display: block; margin: 0 auto; }

/* ---------- 表单 ---------- */
.field { margin-top: 14px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
select, input[type=text], input[type=password], input[type=email], input[type=number] {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; font-size: 14px; color: var(--ink); outline: none; transition: .15s;
}
select:focus, input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.hint { font-size: 12px; color: var(--ink-3); margin-top: 6px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  border-radius: 12px; padding: 11px 18px; font-size: 15px; font-weight: 600; transition: .18s;
}
.btn:hover { border-color: #cbd5e1; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-ink); }
.btn.primary:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btnrow { display: grid; grid-template-columns: 1fr; gap: 10px; }
.btnrow .btn { padding: 11px 12px; font-size: 15px; white-space: nowrap; }
.s.center { text-align: center; }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------- 结果 ---------- */
.result-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.result-card {
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff;
  position: relative;
}
.result-card img { width: 100%; display: block; background: #fff; }
.result-card .bar { padding: 8px 10px; display: flex; gap: 8px; align-items: center; }
.result-card .bar .name { font-size: 12px; color: var(--ink-3); flex: 1; }

.skeleton {
  aspect-ratio: 1/1; border-radius: 12px;
  background: linear-gradient(100deg, #eef1f6 30%, #f7f9fc 50%, #eef1f6 70%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite linear;
}
@keyframes shimmer { from { background-position: 180% 0; } to { background-position: -20% 0; } }

/* ---------- 状态 ---------- */
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.dot.ok { background: var(--ok); }
.dot.err { background: var(--err); }
.dot.warn { background: var(--warn); }

.alert {
  border-radius: 10px; padding: 10px 12px; font-size: 13px; margin-top: 12px;
  background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412;
}
.alert.err { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.42); z-index: 60;
  display: grid; place-items: center; padding: 16px; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  width: 100%; max-width: 420px; background: #fff; border-radius: 18px; padding: 20px;
  box-shadow: 0 24px 60px rgba(15,23,42,.24); animation: pop .18s ease;
}
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal p { margin: 0 0 14px; color: var(--ink-3); font-size: 13px; }
.modal .close { position: absolute; }

/* ---------- 页脚 ---------- */
footer { padding: 20px 0 8px; color: var(--ink-3); font-size: 12px; text-align: center; }
footer a { color: var(--ink-3); text-decoration: underline; margin: 0 6px; }

/* ---------- 促销主图编辑器 ---------- */
.promo-wrap { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 760px) { .promo-wrap { grid-template-columns: 1.1fr .9fr; align-items: start; } }
canvas.editor { width: 100%; border-radius: 12px; border: 1px solid var(--line); display: block; }

/* ---------- 移动端 ---------- */
@media (max-width: 600px) {
  .hero h1 { font-size: 20px; }
  .panel { padding: 14px; border-radius: 14px; }
  .tab { font-size: 13px; padding: 9px 4px; }
  .tab small { display: none; }
}

/* 演示模式提示条 */
.notice { margin: 14px 0 0; padding: 10px 14px; border-radius: 12px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 12.5px; line-height: 1.6; }

/* 字段级说明文字 */
.field .s { margin-top: 6px; font-size: 12.5px; color: var(--ink-3); line-height: 1.5; }

/* 促销主图：画布与提示 */
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 14px; }
@media (min-width: 620px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.editor { width: 100%; max-width: 520px; height: auto; display: block; border: 1px solid var(--line); border-radius: 12px; background: #fff; box-shadow: 0 6px 20px rgba(15, 23, 42, .06); }
.tips { margin-top: 14px; padding: 12px 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; }
.tips b { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.tips ul { margin: 0; padding-left: 18px; }
.tips li { font-size: 12.5px; color: var(--ink-3); line-height: 1.7; }

@media (min-width: 620px) {
  .btnrow { grid-template-columns: 1fr 1fr; }
}
