/* ============ LiveSpark 风格深色主题 ============ */
* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --bg: #0e0e13;
  --bg-2: #121218;
  --surface: #191921;
  --surface-2: #20202a;
  --input: #22222c;
  --border: #2a2a36;
  --border-lite: #333342;
  --text: #ececf4;
  --muted: #8f8fa5;
  --primary: #a55eff;      /* 暖紫品红，脱离"默认紫" */
  --primary-2: #c06bff;
  --grad: linear-gradient(100deg, #7b3ff2, #c45cff 70%, #e58bff);
  --gold: #f2b544;         /* 金色：荣誉/奖励语义专用 */
  --radius: 12px;
}
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--text);
  line-height: 1.5; font-size: 14px;
}
a { color: var(--primary-2); text-decoration: none; }
button { font-family: inherit; }
[hidden] { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2e2e3c; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(14,14,19,.88); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; gap: 16px;
}
.topbar .logo { font-size: 17px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.topbar .logo .mark {
  width: 26px; height: 26px; border-radius: 7px; background: var(--grad);
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 800; letter-spacing: -0.5px;
}
.topbar .logo .logo-sub { color: var(--muted); font-size: 12px; font-weight: 500; margin-left: 2px; }
@media (max-width: 720px) { .topbar .logo .logo-sub { display: none; } }
.topbar .spacer { flex: 1; }
.topbar a.navlink { color: var(--muted); font-size: 13px; padding: 6px 10px; border-radius: 7px; }
.topbar a.navlink:hover { color: var(--text); background: var(--surface-2); }

/* ============ 首页 ============ */
.hero {
  max-width: 1120px; margin: 0 auto; padding: 72px 24px 48px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: center;
}
.hero h1 { font-size: 40px; line-height: 1.25; font-weight: 800; letter-spacing: -0.5px; color: #fff; }
.hero h1 .grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { color: var(--muted); font-size: 16px; margin: 16px 0 28px; max-width: 460px; }
.hero .cta-row { display: flex; gap: 14px; align-items: center; }
.trust-row { display: flex; gap: 18px; margin-top: 18px; flex-wrap: wrap; }
.trust-row span { color: #a8a8bd; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.trust-row span::before { content: '✓'; color: var(--gold); font-weight: 700; font-size: 12px; }
.btn-grad {
  display: inline-block; background: var(--grad); color: #fff; border: 0; cursor: pointer;
  padding: 13px 34px; border-radius: 12px; font-size: 16px; font-weight: 600;
  box-shadow: 0 6px 22px rgba(150,90,255,.4); transition: .15s;
  white-space: nowrap; flex: none;
}
.btn-grad:hover { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(150,90,255,.55); filter: brightness(1.08); }
.btn-ghost {
  display: inline-block; background: transparent; color: var(--text); border: 1px solid var(--border-lite);
  padding: 12px 24px; border-radius: 12px; font-size: 15px; cursor: pointer; transition: .15s;
}
.btn-ghost:hover { border-color: var(--primary); color: #fff; background: rgba(139,92,246,.1); }
.hero .hero-stage {
  background: linear-gradient(160deg, #1a1626, #131019);
  border: 1px solid var(--border); border-radius: 18px; padding: 22px;
  box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.hero-stage canvas, .hero-stage video { width: 100%; height: auto; display: block; border-radius: 8px; }
.hero-stage .cap { color: #8f8fa5; font-size: 12px; text-align: center; margin-top: 10px; }

.home-sec { max-width: 1120px; margin: 0 auto; padding: 40px 24px; }
.home-sec h2 { font-size: 24px; font-weight: 700; margin-bottom: 8px; color: #fff; }
.home-sec .sub { color: var(--muted); margin-bottom: 26px; }
.feat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; transition: .15s;
}
.feat:hover { border-color: var(--border-lite); }
.feat .ico { margin-bottom: 10px; }
.feat .ico svg { width: 28px; height: 28px; color: var(--primary-2); display: block; }
.feat h3 { font-size: 15px; margin-bottom: 6px; color: #fff; }
.feat p { color: var(--muted); font-size: 13px; }

.gal-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.gal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; cursor: pointer; transition: .15s; display: block; color: var(--text);
}
.gal-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 10px 30px rgba(150,90,255,.2); }
.gal-card .thumb {
  height: 120px; background:
    linear-gradient(45deg, #1c1c26 25%, transparent 25%, transparent 75%, #1c1c26 75%),
    linear-gradient(45deg, #1c1c26 25%, transparent 25%, transparent 75%, #1c1c26 75%), #14141b;
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 10px; overflow: hidden;
}
.gal-card .thumb canvas, .gal-card .thumb img { max-width: 100%; max-height: 100%; }
.gal-card .meta { padding: 12px 14px; }
.gal-card .meta .nm { font-weight: 600; font-size: 14px; color: #fff; }
.gal-card .meta .ds { color: var(--muted); font-size: 12px; margin-top: 2px; }
.gal-card .tag {
  display: inline-block; margin-top: 6px; font-size: 11px; padding: 2px 8px; border-radius: 10px;
  background: rgba(242,181,68,.14); color: var(--gold); border: 1px solid rgba(242,181,68,.28);
}
.gal-card.soon {
  border-style: dashed; border-color: var(--border); cursor: default;
  display: flex; align-items: center; justify-content: center; min-height: 190px;
}
.gal-card.soon:hover { border-color: var(--border-lite); transform: none; box-shadow: none; }
.gal-card.soon .soon-inner { text-align: center; color: var(--muted); padding: 20px; }
.gal-card.soon .soon-inner .s1 { font-size: 15px; color: #a8a8bd; font-weight: 600; margin-bottom: 6px; }
.gal-card.soon .soon-inner .s2 { font-size: 12px; }
.gal-card.soon .soon-tag {
  display: inline-block; margin-top: 10px; font-size: 11px; padding: 2px 10px; border-radius: 10px;
  border: 1px dashed rgba(242,181,68,.45); color: var(--gold);
}

.home-foot { text-align: center; color: #5c5c70; font-size: 12px; padding: 40px 0 48px; }

/* 三步出图 */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; counter-reset: step; }
.step {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; position: relative; transition: .15s;
}
.step:hover { border-color: var(--border-lite); }
.step .num {
  counter-increment: step;
  width: 30px; height: 30px; border-radius: 50%; background: var(--grad);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 12px;
}
.step .num::before { content: counter(step); }
.step h3 { font-size: 15px; color: #fff; margin-bottom: 6px; }
.step p { color: var(--muted); font-size: 13px; }
.step .arrow { position: absolute; right: -14px; top: 50%; transform: translateY(-50%); color: #4d3f78; font-size: 18px; z-index: 1; }
.step:last-child .arrow { display: none; }

/* FAQ */
.faq { max-width: 760px; margin: 0 auto; }
.faq details {
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 10px; overflow: hidden;
}
.faq details[open] { border-color: var(--border-lite); }
.faq summary {
  cursor: pointer; padding: 14px 18px; font-size: 14px; font-weight: 600; color: #e6e6f0;
  list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--primary-2); font-size: 18px; font-weight: 700; flex: none; }
.faq details[open] summary::after { content: '−'; }
.faq .ans { padding: 0 18px 14px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.faq .ans b { color: #cfcfdd; font-weight: 600; }

/* ============ 编辑器 ============ */
.editor { display: flex; height: calc(100vh - 56px); overflow: hidden; }

/* 左侧模板列表 */
.tpl-side {
  flex: 0 0 300px; border-right: 1px solid var(--border); background: var(--bg-2);
  overflow-y: auto; padding: 16px;
}
.tpl-side h2 { font-size: 12px; color: var(--muted); font-weight: 600; margin: 4px 0 12px; letter-spacing: 1px; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px;
  cursor: pointer; overflow: hidden; transition: .15s; padding: 0; text-align: left;
}
.tpl-card:hover { border-color: #4d3f78; }
.tpl-card.on { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), 0 4px 18px rgba(150,90,255,.25); background: #1d1a2a; }
.tpl-card .thumb {
  height: 84px; background:
    linear-gradient(45deg, #1c1c26 25%, transparent 25%, transparent 75%, #1c1c26 75%),
    linear-gradient(45deg, #1c1c26 25%, transparent 25%, transparent 75%, #1c1c26 75%), #14141b;
  background-size: 14px 14px; background-position: 0 0, 7px 7px;
  display: flex; align-items: center; justify-content: center;
  padding: 6px; overflow: hidden;
}
.tpl-card .thumb canvas, .tpl-card .thumb img { max-width: 100%; max-height: 100%; }
.tpl-card .nm { font-size: 12px; font-weight: 600; padding: 7px 9px 2px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tpl-card .ds { font-size: 10px; color: var(--muted); padding: 0 9px 9px; }
.tpl-card .bdg { float: right; font-size: 9px; background: var(--grad); color: #fff; border-radius: 8px; padding: 1px 6px; }

/* 中间配置区 */
.workbench {
  flex: 1; min-width: 0; display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr; gap: 0;
}
.config-pane { border-right: 1px solid var(--border); overflow-y: auto; padding: 18px; background: var(--bg); }
.config-pane h2.pane-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; color: #fff; }

.group {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px;
}
.group .g-title { font-size: 12px; font-weight: 700; color: #d9caff; margin-bottom: 12px; display: flex; align-items: center; gap: 6px; }
.group .g-title::before { content: ''; width: 4px; height: 14px; border-radius: 2px; background: var(--grad); }

.field { margin-bottom: 12px; }
.field:last-child { margin-bottom: 0; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input[type=text], .field select {
  width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; color: var(--text); background: var(--input);
}
.field input[type=text]:focus, .field select:focus { outline: none; border-color: var(--primary); background: #26262f; }
.field input[type=text]::placeholder { color: #5c5c72; }
.field select option { background: var(--surface); color: var(--text); }
.field input[type=color] {
  width: 100%; height: 36px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--input); cursor: pointer; padding: 3px;
}
.field input[type=range] { width: 100%; accent-color: var(--primary); cursor: pointer; }
.field .rv { float: right; color: #c4a5ff; font-weight: 700; }

.seg { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--input); }
.seg button { flex: 1; background: transparent; color: var(--muted); border: 0; padding: 8px 4px; cursor: pointer; font-size: 12px; transition: .12s; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--primary); color: #fff; font-weight: 600; }

.upload { display: flex; align-items: center; gap: 10px; }
.upload .thumb {
  width: 46px; height: 46px; border-radius: 9px; background: var(--input); border: 1px dashed #45455a;
  flex: none; display: flex; align-items: center; justify-content: center; color: #6c6c84; font-size: 11px; overflow: hidden;
}
.upload .thumb img { width: 100%; height: 100%; object-fit: cover; }
.upload label.btn {
  display: inline-block; padding: 8px 12px; font-size: 12px; cursor: pointer;
  border: 1px solid var(--border-lite); border-radius: 8px; background: var(--surface-2); color: var(--text);
}
.upload label.btn:hover { border-color: var(--primary); color: #c4a5ff; }
.upload input[type=file] { display: none; }
.upload .ghost {
  padding: 8px 12px; font-size: 12px; cursor: pointer; border: 1px solid var(--border);
  border-radius: 8px; background: transparent; color: var(--muted);
}
.upload .ghost:hover { color: var(--text); border-color: var(--border-lite); }

/* ============ 右侧预览区 ============ */
.preview-pane { display: flex; flex-direction: column; overflow: hidden; background: var(--bg-2); }
.preview-toolbar {
  padding: 12px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; background: var(--bg-2);
}
.preview-toolbar .title { font-size: 13px; font-weight: 700; color: #fff; }
.preview-toolbar .spacer { flex: 1; }
.preview-toolbar .hint { font-size: 12px; color: var(--muted); }

.preview-stage {
  flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.preview-stage canvas { max-width: 100%; height: auto; border-radius: 4px; }

/* 深色棋盘格（LiveSpark 风格） */
.bg-checker {
  background-color: #14141a;
  background-image:
    linear-gradient(45deg, #1e1e27 25%, transparent 25%, transparent 75%, #1e1e27 75%),
    linear-gradient(45deg, #1e1e27 25%, transparent 25%, transparent 75%, #1e1e27 75%);
  background-size: 20px 20px; background-position: 0 0, 10px 10px;
}
.bg-dark { background: radial-gradient(circle at 50% 40%, #23233a, #101018 75%); }
.bg-light { background: #e9e9ef; }
.bg-scene {
  background: radial-gradient(circle at 20% 30%, #3d2c55, transparent 50%),
              radial-gradient(circle at 80% 70%, #23364f, transparent 55%),
              linear-gradient(160deg, #191426, #101620);
}

/* 预览区底部：导出坞 */
.export-dock {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 14px 18px 16px;
  max-height: 46%;
  overflow-y: auto;
}
.export-dock .dock-head {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.export-dock .dock-head .t { font-size: 13px; font-weight: 700; color: #fff; }
.export-dock .dock-head .spacer { flex: 1; }

.export-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.export-grid label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; min-width: 0; }
.export-grid select {
  width: 100%; min-width: 0; padding: 8px 8px; border: 1px solid var(--border); border-radius: 8px; font: inherit;
  background: var(--input); color: var(--text);
}
.export-grid select option { background: var(--surface); color: var(--text); }
.fmt-hint { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 10px; padding: 8px 12px; background: rgba(124,92,255,.08); border: 1px solid rgba(124,92,255,.22); border-radius: 8px; }
.fmt-hint:empty { display: none; }

.btn-export {
  width: 100%; padding: 12px; background: var(--grad); color: #fff; border: 0;
  border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: 0 4px 16px rgba(150,90,255,.35);
}
.btn-export:hover { filter: brightness(1.08); }
.btn-export:disabled { opacity: .75; cursor: wait; }
.btn-export .spin {
  display: inline-block; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  margin-right: 9px; vertical-align: -2px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.progress { position: relative; margin-top: 12px; height: 20px; background: var(--input); border-radius: 7px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--grad); transition: width .15s; }
.progress span { position: absolute; inset: 0; text-align: center; line-height: 20px; font-size: 11px; color: var(--text); }

.result { margin-top: 12px; }
.result .rimg {
  border-radius: 9px; padding: 8px; text-align: center;
  background-color: #14141a;
  background-image:
    linear-gradient(45deg, #1e1e27 25%, transparent 25%, transparent 75%, #1e1e27 75%),
    linear-gradient(45deg, #1e1e27 25%, transparent 25%, transparent 75%, #1e1e27 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px;
}
.result .rimg img, .result .rimg video { max-width: 100%; }
.result .rinfo { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 10px; font-size: 12px; color: var(--muted); }
.result .dl { background: var(--primary); color: #fff; border-radius: 8px; padding: 7px 16px; font-size: 12px; font-weight: 600; }

/* 导出成功态：OBS 三步接入 */
.use-steps { margin-top: 10px; padding: 12px 14px; border-radius: 9px; background: rgba(242,181,68,.07); border: 1px solid rgba(242,181,68,.25); }
.use-steps .ut { font-size: 12px; font-weight: 700; color: var(--gold); margin-bottom: 8px; }
.use-steps ol { margin: 0; padding-left: 20px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.use-steps ol li::marker { color: var(--gold); font-weight: 700; }

/* 草稿自动保存提示 */
.draft-hint { color: #6c6c84; font-size: 11px; text-align: center; padding: 10px 0 2px; }

.notice-warn {
  margin: 0 18px; padding: 10px 14px; background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.35);
  border-radius: 9px; font-size: 12px; color: #fbbf24; display: none;
}

/* ============ 移动端适配（≤860px） ============ */
@media (max-width: 860px) {
  /* ---- 首页 ---- */
  .hero { grid-template-columns: 1fr; padding: 36px 16px 28px; gap: 26px; }
  .hero h1 { font-size: 27px; }
  .hero p.lead { font-size: 14px; margin: 12px 0 20px; max-width: none; }
  .hero .cta-row { flex-wrap: wrap; gap: 10px; }
  .hero-stage { padding: 14px; }
  .home-sec { padding: 30px 16px; }
  .feat-grid, .steps { grid-template-columns: 1fr; }
  .step .arrow { display: none; }
  .trust-row { gap: 12px; }
  /* 画廊 2 列，展示图放大 */
  .gal-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .gal-card .thumb { height: 150px; }
  .gal-card.soon { min-height: 218px; }
  .faq summary { font-size: 13px; padding: 12px 14px; }

  /* ---- 编辑器：三栏改纵向，预览置顶 ---- */
  .editor { flex-direction: column; height: auto; overflow: visible; }
  .tpl-side {
    flex: none; width: auto; border-right: 0; border-bottom: 1px solid var(--border);
    padding: 10px 12px; overflow: hidden;
  }
  .tpl-side h2 { margin: 0 0 8px; }
  .tpl-grid { display: flex; overflow-x: auto; gap: 10px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .tpl-card { flex: 0 0 128px; }
  .workbench { display: flex; flex-direction: column; }
  .preview-pane { order: -1; overflow: visible; }
  .preview-toolbar { flex-wrap: wrap; padding: 10px 14px; }
  #bgSeg { width: auto !important; }
  .preview-stage { min-height: 300px; padding: 16px; }
  .preview-stage canvas { max-height: 340px; }
  .export-dock { max-height: none; overflow: visible; padding: 12px 14px; }
  .export-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .config-pane { border-right: 0; overflow: visible; padding: 14px; }
  .notice-warn { margin: 0 14px; }
}
