:root {
  --gold: #D4AF37;
  --gold-dim: rgba(212, 175, 55, .35);
  --gold-soft: rgba(212, 175, 55, .1);
  --bg: #101010;
  --bg-1: #161616;
  --bg-2: #1d1d1d;
  --bg-3: #262626;
  --line: #2c2c2c;
  --text: #EDEDED;
  --text-2: #9a9a9a;
  --text-3: #6b6b6b;
  --green: #2f9e63;
  --red: #cf4a40;
  --radius: 12px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(16, 16, 16, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--gold), #8a6f1e);
  color: #101010;
  font-weight: 800;
  font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand { display: flex; flex-direction: column; line-height: 1.25; }
.brand b { font-size: 15px; letter-spacing: .5px; }
.brand span { font-size: 11px; color: var(--text-3); }

.seg {
  margin-left: auto;
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--text-2);
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 12.5px;
  cursor: pointer;
  transition: .18s;
  white-space: nowrap;
}
.seg button.on {
  background: var(--gold);
  color: #141414;
  font-weight: 700;
}

/* ---------- 合规提示条 ---------- */
.notice {
  margin: 12px 16px 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-dim);
  font-size: 12.5px;
  color: #c8ab63;
  display: flex; gap: 8px; align-items: flex-start;
}

/* ---------- 分类 ---------- */
.cats {
  display: flex;
  gap: 8px;
  padding: 14px 16px 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: .18s;
}
.cat.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); font-weight: 600; }

/* ---------- 工具网格 ---------- */
.tools {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 10px;
  padding: 12px 16px 100px;
}
.tool {
  position: relative;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 13px 13px 11px;
  cursor: pointer;
  transition: .18s;
  overflow: hidden;
}
.tool:hover { border-color: var(--gold-dim); background: var(--bg-2); transform: translateY(-2px); }
.tool.blocked { opacity: .5; }
.tool .tag {
  position: absolute; top: 9px; right: 9px;
  font-size: 10px; padding: 1px 6px; border-radius: 5px;
  background: var(--bg-3); color: var(--text-3);
}
.tool .tag.vip { background: var(--gold-soft); color: var(--gold); border: 1px solid var(--gold-dim); }
.tool .tag.comp { background: rgba(47,158,99,.14); color: var(--green); border: 1px solid rgba(47,158,99,.3); }
.tool h4 { margin: 0 0 5px; font-size: 14px; font-weight: 600; }
.tool p { margin: 0; font-size: 11.5px; color: var(--text-3); line-height: 1.5; min-height: 34px; }
.tool .foot { margin-top: 8px; font-size: 11px; color: var(--text-3); display: flex; align-items: center; gap: 5px; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--gold); }

.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }

/* ---------- 工作区弹层 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  z-index: 100; display: none;
  align-items: flex-end; justify-content: center;
}
.mask.on { display: flex; }
.sheet {
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  background: var(--bg-1);
  border-radius: 16px 16px 0 0;
  border: 1px solid var(--line);
  border-bottom: 0;
  display: flex; flex-direction: column;
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(20px); opacity: .6; } }
.sheet-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.sheet-head b { font-size: 15px; }
.sheet-head .x {
  margin-left: auto; width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-3); border: 0; color: var(--text-2);
  font-size: 16px; cursor: pointer; line-height: 1;
}
.sheet-body { padding: 14px 16px; overflow-y: auto; flex: 1; }
.sheet-foot {
  padding: 12px 16px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; background: var(--bg-1);
}

/* ---------- 表单 ---------- */
.row { margin-bottom: 14px; }
.preview-box { background: var(--bg-3); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 6px; }
.preview-box .demo-h { width: 100%; font-size: 12px; color: var(--text-3); margin-bottom: 8px; }
.preview-box .demo-grid { display: flex; flex-wrap: wrap; gap: 10px; }
.preview-box .demo-item { flex: 1; min-width: 116px; }
.preview-box .demo-item canvas { width: 100%; height: auto; border-radius: 8px; background: #0d0d0d; display: block; box-shadow: 0 1px 6px rgba(0,0,0,.3); }
.preview-box .demo-item .demo-cap { font-size: 11px; color: var(--text-2); margin-top: 5px; text-align: center; line-height: 1.4; }

/* ---------- 工具「使用说明 + 实例效果」块 ---------- */
.tool-intro {
  margin-bottom: 16px; border-radius: 12px; overflow: hidden;
  background: linear-gradient(180deg, rgba(212,175,55,.09), rgba(212,175,55,.03));
  border: 1px solid var(--gold-dim, rgba(212,175,55,.28));
}
.tool-intro .ti-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 13px; font-size: 12.5px; font-weight: 600; color: var(--gold);
}
.tool-intro .ti-head .ti-t::before { content: '📌 '; font-size: 12px; }
.tool-intro .ti-x {
  font-size: 11.5px; font-weight: 400; color: var(--text-3);
  border: 1px solid var(--line); border-radius: 20px; padding: 2px 10px; cursor: pointer;
}
.tool-intro .ti-body { padding: 0 12px 12px; }
.tool-intro .ti-demo { margin: 0 0 10px; }
.tool-intro .ti-steps {
  margin: 0; padding: 0 0 0 18px; font-size: 12px; color: var(--text-2); line-height: 1.85;
}
.tool-intro .ti-steps li { margin-bottom: 3px; }
.tool-intro .ti-steps li::marker { color: var(--gold); font-weight: 700; }
.tool-intro .ti-faq { margin-top: 10px; border-top: 1px dashed var(--line); padding-top: 9px; }
.tool-intro .ti-qa { font-size: 11.5px; line-height: 1.75; margin-bottom: 6px; color: var(--text-3); }
.tool-intro .ti-qa b { color: var(--text-2); display: block; }
.tool-intro .ti-qa b::before { content: 'Q '; color: var(--gold); }
.row > label {
  display: block; font-size: 12.5px; color: var(--text-2);
  margin-bottom: 6px; font-weight: 600;
}
input[type=text], input[type=number], textarea, select {
  width: 100%;
  background: var(--bg-3);
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 76px; line-height: 1.6; }
input[type=range] { width: 100%; accent-color: var(--gold); }
input[type=color] {
  width: 46px; height: 32px; padding: 0;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer;
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.inline > span { font-size: 12px; color: var(--text-3); min-width: 52px; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  padding: 5px 12px; border-radius: 8px; font-size: 12.5px;
  background: var(--bg-3); border: 1px solid var(--line);
  color: var(--text-2); cursor: pointer; transition: .15s;
}
.chip.on { background: var(--gold-soft); border-color: var(--gold); color: var(--gold); font-weight: 600; }

.btn {
  flex: 1;
  padding: 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg-3);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: .18s;
  font-family: inherit;
}
.btn:hover { border-color: var(--gold-dim); }
.btn.pri {
  background: linear-gradient(135deg, var(--gold), #a8862a);
  color: #141414; border: 0;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }

.dropzone {
  border: 1.5px dashed var(--gold-dim);
  border-radius: var(--radius);
  padding: 26px 16px;
  text-align: center;
  color: var(--text-2);
  background: var(--gold-soft);
  cursor: pointer;
  transition: .18s;
}
.dropzone:hover, .dropzone.over { border-color: var(--gold); background: rgba(212,175,55,.16); }
.dropzone b { display: block; color: var(--gold); font-size: 14px; margin-bottom: 3px; }
.dropzone span { font-size: 12px; color: var(--text-3); }

.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 7px; margin-top: 10px; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .del {
  position: absolute; top: 2px; right: 2px;
  width: 17px; height: 17px; border-radius: 50%;
  background: rgba(0,0,0,.7); color: #fff; border: 0;
  font-size: 11px; line-height: 1; cursor: pointer;
}
.thumb .num {
  position: absolute; bottom: 2px; left: 2px;
  font-size: 9px; padding: 0 4px; border-radius: 3px;
  background: rgba(0,0,0,.65); color: var(--gold);
}

.preview-box {
  margin-top: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg-3); padding: 8px; min-height: 80px;
  display: flex; align-items: center; justify-content: center;
}
.preview-box img, .preview-box canvas { max-width: 100%; max-height: 320px; border-radius: 6px; }
.result {
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px;
  font-size: 13.5px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-all;
  user-select: all;
}
.result b { color: var(--gold); }

/* ---------- 下载队列面板 ---------- */
.queue {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: calc(100% - 32px); max-width: 460px;
  background: var(--bg-2); border: 1px solid var(--gold-dim);
  border-radius: 12px; padding: 12px 14px; z-index: 200;
  box-shadow: 0 8px 30px rgba(0,0,0,.6);
  display: none;
}
.queue.on { display: block; }
.queue .qt { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin-bottom: 8px; }
.queue .qt .n { margin-left: auto; color: var(--gold); font-size: 12px; }
.bar { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--gold); width: 0; transition: width .25s; }
.queue .tip { margin-top: 7px; font-size: 11.5px; color: var(--text-3); }

.toast {
  position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%);
  background: rgba(30,30,30,.96); border: 1px solid var(--line);
  color: var(--text); padding: 9px 16px; border-radius: 999px;
  font-size: 13px; z-index: 300; opacity: 0; pointer-events: none;
  transition: opacity .25s; white-space: nowrap;
  max-width: 90vw; overflow: hidden; text-overflow: ellipsis;
}
.toast.on { opacity: 1; }

@media (max-width: 520px) {
  .tools { grid-template-columns: repeat(2, 1fr); padding: 12px 12px 100px; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .brand span { display: none; }
}

/* ---------- 嵌入模式(内嵌于 CCBL / pcexe) ---------- */
.embed .topbar { display: none; }
.embed .notice { margin-top: 0; border-radius: 0; }
.embed .tools { padding-bottom: 24px; }
/* iframe 内铺满: 避免父级滚动条双层 */
html.embed, body.embed { height: 100%; overflow-x: hidden; }

/* ---------- 三图合成 GIF 槽位 ---------- */
.gfslots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.gfslot { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px; }
.gfslot-top { display: flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-2); margin-bottom: 6px; }
.gfslot-top b { flex: 1; font-weight: 600; color: var(--text); }
.gfmv { background: var(--bg-3); border: 1px solid var(--line); color: var(--text-2); font-size: 10.5px; border-radius: 6px; padding: 2px 6px; cursor: pointer; }
.gfmv:active { border-color: var(--gold); color: var(--gold); }
.gfslot-img { position: relative; width: 100%; aspect-ratio: 1 / 1; border: 1px dashed var(--line); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11.5px; color: var(--text-3); overflow: hidden; cursor: pointer; background: var(--bg-1); }
.gfslot-img.filled { border-style: solid; border-color: var(--gold-dim); }
.gfslot-img img { width: 100%; height: 100%; object-fit: cover; }
.gfslot-row { display: flex; align-items: center; gap: 5px; margin-top: 7px; font-size: 10.5px; color: var(--text-3); }
.gfslot-row span { white-space: nowrap; }
.gfslot-row input[type=range] { flex: 1; min-width: 0; }
.gfslot-row b { color: var(--gold); font-weight: 600; min-width: 30px; text-align: right; }

/* ---------- 抖音评论区效果 ---------- */
.if-cmt { background: #0b0b0e; border: 1px solid var(--line); border-radius: 12px; padding: 10px; max-width: 340px; }
.if-cmt-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.if-ava { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg,#D4AF37,#8a6f1e); display: inline-block; }
.if-uname { font-size: 11.5px; color: var(--text-2); }
.if-cmt canvas { width: 100%; height: auto; border-radius: 8px; display: block; cursor: pointer; }
.if-cmt-bar { display: flex; gap: 16px; font-size: 11.5px; color: var(--text-3); margin-top: 8px; }
.if-cmt-note { font-size: 11px; color: var(--text-3); line-height: 1.6; margin-top: 8px; }

/* ---------- 背景模板库 ---------- */
.tpl-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-bottom: 10px; }
.tpl-item { border: 1px solid var(--line); border-radius: 8px; padding: 3px; cursor: pointer; background: var(--bg-2); text-align: center; }
.tpl-item.on { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold-dim) inset; }
.tpl-item canvas { width: 100%; height: auto; border-radius: 6px; display: block; }
.tpl-item span { display: block; font-size: 10px; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- 选项提示条 ---------- */
.opt-tip { margin: -4px 0 14px; padding: 9px 11px; border-radius: 9px; background: rgba(212,175,55,.08); border: 1px solid var(--gold-dim); font-size: 11.5px; color: #c8ab63; line-height: 1.7; }
.opt-tip b { color: var(--gold); }

@media (max-width: 520px) {
  .gfslots { gap: 6px; }
  .gfslot { padding: 6px; }
  .tpl-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- 实例展示区紧凑化: 小图并排(对标竞品示例条) ---------- */
.preview-box .demo-h { flex: 0 0 100%; width: 100%; }
.preview-box .demo-grid { display: flex; flex-wrap: wrap; gap: 9px; align-items: flex-start; }
.preview-box .demo-item { flex: 0 0 auto; width: calc(33.333% - 6px); max-width: 108px; min-width: 72px; }
.preview-box .demo-item canvas { width: 100%; height: auto; aspect-ratio: 1 / 1; }
.preview-box .demo-item .demo-cap { font-size: 10.5px; line-height: 1.35; }
.preview-box.demo-box { display: block; align-items: stretch; justify-content: flex-start; }

/* 使用说明步骤: 隐藏有序列表序号(正文自带 ①②③) */
.tool-intro .ti-steps { list-style: none; padding-left: 2px; }
.tool-intro .ti-steps li { padding-left: 0; }
