:root {
  --bg: #f4f5f8;
  --panel: #ffffff;
  --ink: #17181a;
  --muted: #6b7280;
  --line: #e7e9ef;
  --green: #07c160;
  --green-dark: #06ad56;
  --radius: 16px;
  --shadow: 0 20px 50px -28px rgba(15, 20, 35, .45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(900px 480px at 8% -8%, rgba(7, 193, 96, .16), transparent 62%),
    radial-gradient(760px 420px at 104% -4%, rgba(96, 125, 255, .14), transparent 58%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------- 顶栏 ---------------------------------- */
.topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 34px 24px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  width: 44px; height: 44px; border-radius: 13px; flex: none;
  background: linear-gradient(140deg, var(--green), #3ad07f);
  box-shadow: 0 10px 22px -10px rgba(7, 193, 96, .9);
  position: relative;
}
.logo::after {
  content: ""; position: absolute; inset: 13px 11px auto; height: 13px;
  border-radius: 3px; background: #fff;
}
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: .2px; }
.topbar p { margin: 2px 0 0; font-size: 13px; color: var(--muted); }
.topbar-meta code {
  font-size: 12px; color: var(--muted); background: #fff;
  border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px;
}

/* ---------------------------------- 布局 ---------------------------------- */
.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
  gap: 22px;
  align-items: start;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0 0 18px; font-size: 15px; letter-spacing: .4px; color: var(--muted); font-weight: 600; }

/* ---------------------------------- 表单 ---------------------------------- */
.field { margin-bottom: 18px; }
.field > label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; margin-bottom: 7px;
}
.req { font-size: 11px; color: #fff; background: var(--green); border-radius: 5px; padding: 1px 6px; font-weight: 500; }
.hint { margin: 6px 0 0; font-size: 12px; color: #9096a5; }
.hint code { background: #f1f2f6; border-radius: 4px; padding: 1px 5px; }

input[type="text"], input[type="url"], input[type="number"], textarea {
  width: 100%;
  padding: 11px 13px;
  font: inherit;
  color: var(--ink);
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { resize: vertical; min-height: 76px; }
input:focus, textarea:focus { border-color: var(--green); background: #fff; box-shadow: 0 0 0 3px rgba(7, 193, 96, .14); }
input::placeholder, textarea::placeholder { color: #b6bac6; }

/* 上传 */
.uploader {
  position: relative;
  display: grid; place-items: center;
  min-height: 132px;
  border: 1.5px dashed #d3d7e0;
  border-radius: 14px;
  background: #fafbfc;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s, background .15s;
}
.uploader:hover, .uploader:focus-visible, .uploader.is-drag { border-color: var(--green); background: #f4fbf7; outline: none; }
.uploader-empty { text-align: center; color: var(--muted); }
.uploader-empty strong { display: block; font-size: 14px; color: #454a56; }
.uploader-empty span { font-size: 12px; color: #9096a5; }
.uploader img { width: 100%; height: 100%; max-height: 200px; object-fit: cover; }
.url-row { margin-top: 10px; }

/* 内置预设图标 */
.presets { margin-top: 14px; }
.presets-label { display: block; font-size: 12px; color: #9096a5; margin-bottom: 8px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 8px; }
.preset {
  padding: 0; border: 2px solid transparent; border-radius: 11px; background: #fafbfc;
  cursor: pointer; overflow: hidden; aspect-ratio: 1; line-height: 0;
  transition: border-color .15s, transform .08s;
}
.preset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preset:hover { border-color: #cfd4de; }
.preset:active { transform: translateY(1px); }
.preset.is-active { border-color: var(--green); }
.preset:focus-visible { outline: 2px solid rgba(7, 193, 96, .45); outline-offset: 2px; }

.link-btn {
  margin-top: 8px; border: 0; background: none; padding: 0;
  color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline;
}
.link-btn:hover { color: #d33; }

/* 高级 */
.advanced {
  border-top: 1px solid var(--line);
  padding-top: 14px; margin: 4px 0 18px;
}
.advanced summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.advanced summary::marker { color: #b6bac6; }
.advanced .field { margin-top: 16px; }
input[type="color"] {
  width: 56px; height: 34px; padding: 2px; border: 1px solid var(--line);
  border-radius: 9px; background: #fafbfc; cursor: pointer;
}
/* 跳转方式选择 */
.choices { display: grid; gap: 8px; }
.choice {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px;
  background: #fafbfc; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.choice:hover { border-color: #cfd4de; }
.choice input { margin: 2px 0 0; accent-color: var(--green); flex: none; }
.choice-body { display: block; min-width: 0; }
.choice-body b { display: block; font-size: 13.5px; font-weight: 600; }
.choice-body em { display: block; font-style: normal; font-size: 12px; color: #9096a5; }
.choice:has(input:checked) { border-color: var(--green); background: #f4fbf7; }
.choice input:focus-visible + .choice-body b { outline: 2px solid rgba(7, 193, 96, .35); outline-offset: 3px; border-radius: 4px; }

/* 按钮 */
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn {
  font: inherit; font-size: 14px; font-weight: 600;
  padding: 11px 18px; border-radius: 11px; border: 1px solid transparent;
  cursor: pointer; transition: transform .08s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--green); color: #fff; flex: 1 1 auto; }
.btn.primary:hover { background: var(--green-dark); }
.btn.ghost { background: #fff; border-color: var(--line); color: #454a56; }
.btn.ghost:hover:not(:disabled) { border-color: #c9cdd8; background: #fafbfc; }
.btn.small { padding: 9px 14px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.status { margin: 10px 0 0; font-size: 13px; min-height: 19px; color: var(--muted); }
.status[data-tone="error"] { color: #d33; }
.status[data-tone="ok"] { color: var(--green-dark); }

.result {
  margin-top: 16px; padding: 14px; border-radius: 14px;
  background: #f3fbf6; border: 1px solid #d3f0de;
}
.result label { display: block; font-size: 12px; font-weight: 600; color: #2f6b4c; margin-bottom: 7px; }
.result label.label-gap { margin-top: 14px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { background: #fff; font-size: 13px; }

/* ---------------------------------- 预览 ---------------------------------- */
.preview { position: sticky; top: 20px; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.preview-head h2 { margin: 0; }
.tabs { display: inline-flex; padding: 3px; background: #f1f2f6; border-radius: 10px; }
.tab {
  font: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
  padding: 6px 12px; border: 0; border-radius: 8px; background: none; cursor: pointer;
}
.tab.is-active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 20, 35, .12); }

.phone {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 10px;
  background: #1b1d22;
  border-radius: 38px;
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, .6), inset 0 0 0 2px #2c2f36;
}
.phone-notch {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 108px; height: 22px; background: #1b1d22; border-radius: 0 0 14px 14px; z-index: 3;
}
.phone-screen {
  position: relative;
  height: 520px;
  border-radius: 30px;
  overflow: hidden;
  background: #ededed;
}
.view { display: none; height: 100%; flex-direction: column; }
.view.is-active { display: flex; }

/* 聊天气泡 */
.chat-bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 30px 14px 10px;
  background: #ededed;
  border-bottom: 1px solid #dcdcdc;
  font-size: 15px; font-weight: 600;
}
.chat-back { font-size: 22px; color: #333; line-height: 1; }
.chat-body { flex: 1; padding: 16px 12px; overflow: auto; }
.bubble-row { display: flex; justify-content: flex-start; }
.wxcard-wrap { width: 100%; max-width: 262px; }
.bubble-card {
  position: relative;
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 20, 35, .06);
  color: #17181a;
  transition: background .18s;
}
.bubble-main { flex: 1; min-width: 0; }
.bubble-title {
  margin: 0; font-size: 16px; font-weight: 600; line-height: 1.35; color: #17181a;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.bubble-desc {
  margin: 6px 0 0; font-size: 13.5px; line-height: 1.4; color: #9a9a9a;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.bubble-desc:empty, .bubble-desc.is-empty { display: none; }
.bubble-foot { margin: 8px 2px 0; font-size: 11.5px; color: #b2b2b2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bubble-thumb {
  width: 64px; height: 64px; flex: none;
  border-radius: 4px; overflow: hidden; background: #ededed;
}
.bubble-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-ph { display: none; width: 100%; height: 100%; }
.bubble-thumb[data-empty="true"] .thumb-ph,
.landing-thumb[data-empty="true"] .thumb-ph {
  display: block;
  background: repeating-linear-gradient(45deg, #ededed 0 6px, #e4e4e4 6px 12px);
}
.chat-time { margin: 0 0 10px; font-size: 11px; color: #9aa0a8; }
.chat-input {
  padding: 10px 12px 14px; background: #ededed; border-top: 1px solid #dcdcdc;
  font-size: 13px; color: #a0a4ac;
}

/* 落地页 */
.view-page { background: #ededed; }
.landing { padding: 18px 14px 30px; height: 100%; overflow: auto; background: #ededed; }
.landing-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 14px; background: #fff; border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 20, 35, .06);
}
.landing-main { flex: 1; min-width: 0; }
.landing-main h3 {
  margin: 0; font-size: 16px; font-weight: 600; line-height: 1.35; color: #17181a;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.landing-main p {
  margin: 6px 0 0; font-size: 13.5px; line-height: 1.4; color: #9a9a9a;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.landing-main p:empty { display: none; }
.landing-thumb {
  width: 64px; height: 64px; flex: none;
  border-radius: 4px; overflow: hidden; background: #ededed;
}
.landing-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.landing-meta { margin: 9px 2px 0; font-size: 11.5px; color: #b2b2b2; word-break: break-all; }
.landing-cta {
  margin-top: 16px; padding: 12px; border-radius: 10px; text-align: center;
  background: var(--green); color: #fff; font-size: 14px; font-weight: 600;
}
.landing-cta.is-off { background: #dcdcdc; color: #a0a4ac; }

/* 说明 */
.tips { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px; }
.tips summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); }
.tips ul { margin: 12px 0 0; padding-left: 18px; font-size: 12.5px; color: #5f6472; }
.tips li { margin-bottom: 8px; }
.tips code { background: #f1f2f6; border-radius: 4px; padding: 1px 5px; }

.foot { max-width: 1180px; margin: 0 auto; padding: 0 24px 30px; font-size: 12px; color: #a0a4ac; }

@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .preview { position: static; }
}
@media (max-width: 480px) {
  .topbar { padding: 22px 16px 6px; }
  .layout { padding: 14px 16px 32px; }
  .panel { padding: 18px 16px; }
}