:root {
  --bg: #faf6f1; --panel: #fff; --ink: #2a1f2d; --ink-soft: #7d6f78; --line: #ece3dc;
  --rose: #e2678a; --rose-deep: #c94a72; --rose-soft: #fde8ee; --plum: #2a1f2d;
  --radius: 14px;
  --ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--ui); color: var(--ink); background: var(--bg); font-size: 15px; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

/* ---- 顶栏 ---- */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px; background: var(--plum); color: #fff; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand { color: inherit; text-decoration: none; }
.brand .logo { width: 36px; height: 36px; display: grid; place-items: center; flex: none; }
.brand .logo svg { width: 100%; height: 100%; }
.brand b { display: block; font-size: 15px; letter-spacing: .02em; }
.brand small { display: block; font-size: 12px; opacity: .7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.actions { display: flex; gap: 8px; flex: none; }
.top .ghost { border-color: rgba(255,255,255,.25); color: #fff; background: rgba(255,255,255,.06); }

.primary, .ghost { border-radius: 999px; padding: 8px 16px; font-size: 14px; border: 1px solid transparent; white-space: nowrap; }
.primary { background: var(--rose); color: #fff; box-shadow: 0 6px 16px rgba(226, 103, 138, .35); }
.primary:hover { background: var(--rose-deep); }
.ghost { background: #fff; border-color: var(--line); }
.ghost:hover { border-color: var(--rose); }
.danger { color: #b3443b; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

/* ---- 两栏 ---- */
.app { display: grid; grid-template-columns: minmax(360px, 480px) 1fr; height: calc(100% - 54px); }
.panel { overflow-y: auto; padding: 16px 16px 60px; border-right: 1px solid var(--line); background: var(--bg); }
.preview { display: grid; grid-template-rows: auto 1fr auto; min-height: 0; background: radial-gradient(ellipse at 50% 20%, #f3ebe4, #e7ddd5); }

.block { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.block h2 { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; font-size: 16px; }
.block h2 span { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--rose-soft); color: var(--rose-deep); font-size: 13px; }
.block h2 em { font-style: normal; }
.block.foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: none; border: none; padding: 4px; }
.status { font-size: 12px; color: var(--ink-soft); }

/* ---- 模板卡 ---- */
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tpl { text-align: left; border: 2px solid var(--line); background: #fff; border-radius: 12px; padding: 0; overflow: hidden; transition: border-color .2s, transform .2s; }
.tpl:hover { transform: translateY(-2px); }
.tpl.on { border-color: var(--rose); box-shadow: 0 6px 18px rgba(226, 103, 138, .25); }
.tpl .sw { height: 64px; display: flex; align-items: flex-end; padding: 8px; }
.tpl .sw i { font-style: normal; font-size: 11px; color: #fff; background: rgba(0,0,0,.28); border-radius: 999px; padding: 2px 8px; }
.tpl b { display: block; padding: 8px 10px 2px; font-size: 14px; }
.tpl small { display: block; padding: 0 10px 10px; font-size: 11.5px; color: var(--ink-soft); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---- 表单 ---- */
.group { border-top: 1px dashed var(--line); padding-top: 10px; margin-top: 10px; }
.group:first-child { border-top: none; margin-top: 0; padding-top: 0; }
.group > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; cursor: pointer; padding: 6px 0 10px; font-weight: 600; color: var(--rose-deep); }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::after { content: "▾"; color: var(--ink-soft); transition: transform .2s; }
.group:not([open]) > summary::after { transform: rotate(-90deg); }
.group > summary .peek { font-weight: 400; font-size: 12px; color: var(--ink-soft); margin-left: auto; margin-right: 10px; }
.field { margin-bottom: 14px; }
.field > label, .field > .lab { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; }
.field > label .count { font-variant-numeric: tabular-nums; opacity: .7; }
.field input[type="text"], .field input[type="date"], .field input[type="number"], .field select, .field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fffdfb; font-size: 16px; /* 16px：iPhone 不会自动放大 */
}
.field textarea { resize: vertical; min-height: 84px; line-height: 1.6; }
.field input:focus, .field textarea:focus { border-color: var(--rose); outline: none; box-shadow: 0 0 0 3px var(--rose-soft); }
.hint { margin: 6px 0 0; font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; background: #fffdfb; flex-wrap: wrap; }
.seg button { border: none; background: none; border-radius: 999px; padding: 6px 14px; font-size: 14px; }
.seg button.on { background: var(--plum); color: #fff; }
.musicfile { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.musicfile .fname { font-size: 12px; color: var(--ink-soft); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.musicfile audio { width: 100%; height: 36px; }

.img { display: flex; gap: 12px; align-items: center; }
.img .thumb { width: 76px; height: 76px; border-radius: 10px; flex: none; background: #f2ebe5 center / cover no-repeat; border: 1px dashed #d8ccc3;
  display: grid; place-items: center; color: #c4b5ab; font-size: 26px; cursor: pointer; }
.img .thumb.has { border-style: solid; color: transparent; }
.img .btns { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.img .btns .ghost { padding: 6px 12px; font-size: 13px; }
.img .meta { font-size: 11px; color: var(--ink-soft); }

.list .item { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; background: #fffdfb; }
.list .item-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.list .item-head b { font-size: 13px; color: var(--rose-deep); margin-right: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .item-head button { border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 30px; height: 30px; padding: 0; font-size: 14px; }
.list .item-head button:disabled { opacity: .35; cursor: default; }
.list .add { width: 100%; border: 1.5px dashed #e3b8c6; background: var(--rose-soft); color: var(--rose-deep); border-radius: 12px; padding: 10px; }
.list .add:disabled { opacity: .5; }
.list .item .field:last-child { margin-bottom: 0; }

/* ---- 预览 ---- */
.steps { display: flex; gap: 6px; padding: 12px 16px; overflow-x: auto; scrollbar-width: none; }
.steps::-webkit-scrollbar { display: none; }
.steps button { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-size: 13px; white-space: nowrap; }
.steps button.on { background: var(--plum); color: #fff; border-color: var(--plum); }
.phone-area { position: relative; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.phone { width: 390px; height: 800px; border-radius: 44px; background: #111; padding: 12px; box-shadow: 0 30px 70px rgba(42, 31, 45, .35), inset 0 0 0 2px #333;
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); transform-origin: center center; }
.phone iframe { width: 100%; height: 100%; border: 0; border-radius: 34px; background: #fff; display: block; }
.phone.dev-tablet { width: 860px; height: 1200px; border-radius: 46px; padding: 22px; }
.phone.dev-tablet iframe { border-radius: 24px; }
.phone.dev-desktop { width: 1440px; height: 936px; border-radius: 14px; padding: 36px 0 0; background: #e8e2ea; box-shadow: 0 30px 70px rgba(42, 31, 45, .3); }
.phone.dev-desktop::before { content: ""; position: absolute; left: 18px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: #ff6b6b; box-shadow: 18px 0 0 #ffd166, 36px 0 0 #6bd17a; }
.phone.dev-desktop iframe { border-radius: 0 0 14px 14px; }
.devices button { padding: 5px 11px; font-size: 12.5px; }
#sizeInfo.warn { color: #c0392b; font-weight: 600; }
.occ { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 12px; }
.occ button { border: 1px solid var(--line); background: #fffdfb; border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.occ button.on { background: var(--rose); border-color: var(--rose); color: #fff; }
.media .thumb.vid { position: relative; background: #111; overflow: hidden; }
.media .thumb.vid video { width: 100%; height: 100%; object-fit: cover; display: block; }
.media .thumb.vid b { position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-size: 20px; text-shadow: 0 2px 6px rgba(0,0,0,.5); }
.vjob { margin-top: 10px; padding: 12px; border-radius: 12px; background: #fff7ea; border: 1px solid #f2d39a; }
.vjob p { margin: 0 0 8px; font-size: 13px; line-height: 1.5; }
.vjob .bar { height: 6px; border-radius: 3px; background: #f2e3c4; overflow: hidden; margin-bottom: 8px; }
.vjob .bar i { display: block; height: 100%; width: 0; background: var(--rose); transition: width .3s; }
.vjob .go { padding: 7px 16px; font-size: 13px; }
.pv-foot { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 10px 16px 14px; font-size: 12px; color: var(--ink-soft); }

.mobilebar, .sheet { display: none; }
.toast { position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 60;
  background: var(--plum); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 90vw; text-align: center; }

/* ---- 手机：编辑 / 预览 两个分页 ---- */
@media (max-width: 900px) {
  .hide-sm { display: none !important; }
  .app { display: block; height: auto; }
  .panel { border-right: none; padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px)); overflow: visible; }
  .preview { display: none; position: fixed; inset: 54px 0 calc(58px + env(safe-area-inset-bottom, 0px)); }
  body.view-preview .panel { display: none; }
  body.view-preview .preview { display: grid; }
  .phone.dev-phone { position: static; width: 100%; height: 100%; border-radius: 0; padding: 0; box-shadow: none; background: none; transform: none !important; }
  .phone.dev-phone iframe { border-radius: 0; }
  .phone-area { place-items: stretch; }
  .pv-foot { flex-wrap: wrap; gap: 8px; }
  .pv-foot { padding: 8px; }
  .tpls { grid-auto-flow: column; grid-template-columns: none; grid-auto-columns: 46%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .tpl { scroll-snap-align: start; }
  .mobilebar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px)); gap: 6px; }
  .mobilebar button { flex: 1; border: none; background: none; border-radius: 10px; padding: 10px; font-size: 15px; color: var(--ink-soft); }
  .mobilebar button.on { background: var(--rose-soft); color: var(--rose-deep); font-weight: 600; }
  .sheet:not([hidden]) { display: grid; position: fixed; inset: 0; z-index: 50; background: rgba(42, 31, 45, .45); align-items: end; }
  .sheet-card { background: #fff; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); display: grid; gap: 10px; }
  .sheet-card button { padding: 13px; font-size: 16px; }
}

/* ================= 购买链接 / 解锁 ================= */
a.ghost { text-decoration: none; display: inline-flex; align-items: center; }
.unlock h2 .badge { margin-left: auto; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #fff1d6; color: #9a6a12; }
.unlock.on { border-color: #b9e4c9; background: #f6fcf8; }
.unlock.on h2 .badge { background: #dcf3e4; color: #23794a; }
.unlock .hint { margin: 0 0 12px; }
.unlockRow { display: flex; gap: 8px; }
.unlockRow input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #fffdfb; font-size: 16px; letter-spacing: .12em; text-transform: uppercase; font-family: ui-monospace, Menlo, monospace; }
.payRow { display: grid; gap: 8px; margin-top: 10px; }
.payRow:not(:has(:not([hidden]))) { display: none; }
.payRow button, .lock-card button.pay { padding: 12px; font-size: 15px; }
.host { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.host .hint { margin: 0; }
.host button.pay { padding: 12px; font-size: 15px; }
.hostLink { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: #fff; border: 1px solid #b9e4c9; }
.hostLink a#hostUrl { font-family: ui-monospace, Menlo, monospace; font-size: 13.5px; color: var(--rose-deep); word-break: break-all; }
.hostBtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hostBtns .ghost { justify-content: center; padding: 9px; text-align: center; color: inherit; }
.hostStatus { margin: 4px 0 0; font-size: 13px; color: var(--ink-soft, #7d6f78); }
.hostStatus.on { color: #2e8b57; font-weight: 700; }
.unlockRow input:focus { border-color: var(--rose); outline: none; box-shadow: 0 0 0 3px var(--rose-soft); }
.unlock.on .unlockRow, .unlock.on .buyLink { display: none; }
.buyLink { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--rose-deep); }

/* ================= 没解锁时按导出 ================= */
.lock:not([hidden]) { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(42, 31, 45, .5); }
.lock-card { width: min(100%, 380px); background: #fff; border-radius: 22px; padding: 24px 22px 18px; text-align: center; display: grid; gap: 10px; box-shadow: 0 30px 60px rgba(0,0,0,.25); animation: lockIn .4s cubic-bezier(.2,1.4,.4,1); }
@keyframes lockIn { from { transform: translateY(16px) scale(.96); opacity: 0; } }
.lock-face { width: 64px; height: 64px; margin: -54px auto 0; background: #fff; border-radius: 50%; padding: 6px; box-shadow: 0 8px 20px rgba(42,31,45,.15); }
.lock-face svg { width: 100%; height: 100%; }
.lock-card h3 { margin: 4px 0 0; font-size: 19px; }
.lock-card p { margin: 0 0 6px; font-size: 14px; color: var(--ink-soft); line-height: 1.6; }
.lock-card .primary, .lock-card .ghost { display: block; color: inherit; text-decoration: none; padding: 12px; font-size: 15px; text-align: center; }
.lock-card .primary { color: #fff; }
.lock-card .link { background: none; border: none; color: var(--ink-soft); font-size: 13px; padding: 6px; }

/* 语言选择 */
.langSel { font: inherit; font-size: 13.5px; color: inherit; background: #fffdfb; border: 1px solid var(--line); border-radius: 999px; padding: 7px 28px 7px 12px; max-width: 150px;
  appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; cursor: pointer; }
.langSel.wide { max-width: none; width: 100%; border-radius: 12px; padding: 10px 30px 10px 12px; font-size: 15px; }
.top .langSel { color: #fff; background-color: rgba(255,255,255,.06); border-color: rgba(255,255,255,.25); max-width: 120px; }
.top .langSel option { color: #2a1f2d; }
@media (max-width: 640px) { .top .langSel { max-width: 96px; font-size: 12.5px; } }
/* 外观选项：一格一格 */
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; }
.choice { display: grid; justify-items: center; gap: 6px; padding: 9px 4px 8px; border: 1.5px solid var(--line); border-radius: 12px; background: #fffdfb; font-size: 12.5px; line-height: 1.25; text-align: center; cursor: pointer; }
.choice .ic { width: 34px; height: 34px; display: grid; place-items: center; font-size: 22px; line-height: 1; }
.choice .ic.sw { border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.choice.on { border-color: var(--plum); background: #fbf2f6; box-shadow: 0 0 0 2px rgba(0, 0, 0, .02); font-weight: 700; }
.choice .tl { overflow-wrap: break-word; hyphens: auto; font-size: 12px; }
/* 已付款 + "我的网页"私人链接 */
.paidBox { display: grid; gap: 10px; margin: 0 0 12px; }
.paidLine { margin: 0; font-weight: 700; color: #23794a; }
.myKey { display: grid; gap: 6px; padding: 12px; border-radius: 12px; background: #fffaf0; border: 1px dashed #e8c77a; }
.myKey .hint { margin: 0; }
.myKey code { display: block; padding: 8px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 13px; overflow-wrap: anywhere; user-select: all; }
.unlock.on.paid .unlockRow { display: none; }
/* 邀请函：出席回复名单 */
.pay.rsvp { background: linear-gradient(135deg, #7a5bb5, #c94a72); }
.guests { display: grid; gap: 8px; padding: 12px; border-radius: 12px; background: #fff; border: 1px solid var(--line); }
.guestsSum { margin: 0; font-weight: 700; }
.guestList { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 320px; overflow-y: auto; }
.guestList li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 10px; border-radius: 10px; background: #f6fcf8; font-size: 14px; }
.guestList li.n { background: #faf6f6; color: var(--ink-soft); }
.guestList li span { font-size: 12.5px; font-weight: 700; }
.guestList li em { grid-column: 1 / -1; font-style: normal; font-size: 13px; color: var(--ink-soft); overflow-wrap: anywhere; }
