* { box-sizing: border-box; }
:root {
  --primary: #B01E28;
  --primary-d: #8E1620;
  --ink: #1D1B1A;
  --ink-2: #5A5450;
  --ink-3: #8B8480;
  --bg: #F4F5F7;
  --card: #fff;
  --line: #E4E6EA;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(20, 18, 17, .04), 0 8px 24px rgba(20, 18, 17, .05);
}
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--primary); text-decoration: none; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 20% 0%, #FFF 0%, #F4F5F7 60%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 16px;
  padding: 34px 30px 28px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.login-logo { font-size: 19px; font-weight: 900; letter-spacing: .5px; }
.login-logo span { color: var(--primary); }
.login-sub { font-size: 12px; color: var(--ink-3); margin: 8px 0 24px; letter-spacing: .5px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; font-weight: 600; }
.input, .select, .textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line);
  border-radius: 9px; background: #fff; outline: none; transition: .15s;
}
.input:focus, .textarea:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(176, 30, 40, .08); }
.textarea { resize: vertical; min-height: 84px; line-height: 1.65; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 9px; border: 1px solid var(--line);
  background: #fff; cursor: pointer; font-weight: 600; transition: .15s; white-space: nowrap;
}
.btn:hover { background: #FAFAFB; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-d); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; border-radius: 7px; }
.btn.danger { color: var(--primary); border-color: rgba(176,30,40,.28); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 主框架 ---------- */
.top {
  height: 56px; background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 22px; padding: 0 20px;
  position: sticky; top: 0; z-index: 50;
}
.brand { font-size: 15px; font-weight: 900; letter-spacing: .3px; }
.brand span { color: var(--primary); }
.nav { display: flex; gap: 4px; }
.nav a {
  padding: 7px 13px; border-radius: 8px; color: var(--ink-2);
  font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.nav a.on { background: rgba(176, 30, 40, .08); color: var(--primary); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.who { font-size: 13px; color: var(--ink-2); }
.who b { color: var(--ink); }

.page { padding: 22px; max-width: 1180px; margin: 0 auto; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.page-title { font-size: 20px; font-weight: 800; margin: 0; }
.page-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 4px; }
.spacer { flex: 1; }

/* ---------- 图册卡片 ---------- */
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.acard {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
  transition: .18s;
}
.acard:hover { transform: translateY(-2px); box-shadow: 0 6px 26px rgba(20,18,17,.09); }
.acard-cover { aspect-ratio: 16/10; background: linear-gradient(135deg, #2C2422, #6B4B44); position: relative; overflow: hidden; }
.acard-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.acard-cover .none { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.5); font-size: 12px; }
.badge {
  position: absolute; top: 10px; left: 10px; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 700; background: rgba(255,255,255,.92); color: var(--ink-2);
}
.badge.live { background: #1E8E4E; color: #fff; }
.acard-body { padding: 13px 14px; flex: 1; display: flex; flex-direction: column; }
.acard-title { font-size: 15px; font-weight: 800; }
.acard-meta { font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.acard-acts { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.empty {
  grid-column: 1/-1; padding: 60px 20px; text-align: center; color: var(--ink-3);
  background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); line-height: 2;
}

/* ---------- 编辑器 ---------- */
.editor { height: calc(100vh - 56px); display: grid; grid-template-columns: 250px 1fr 340px; }
.pane { overflow-y: auto; background: #fff; }
.pane.left { border-right: 1px solid var(--line); }
.pane.right { border-left: 1px solid var(--line); }
.pane.mid { background: #E9EAEE; display: flex; flex-direction: column; align-items: center; padding: 18px 10px 0; overflow: hidden; }

.ed-head {
  position: sticky; top: 0; background: #fff; z-index: 5;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.ed-head .t { font-size: 13px; font-weight: 800; color: var(--ink-2); }

.blk-list { padding: 8px; }
.blk-item {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px; border-radius: 9px; cursor: pointer;
  border: 1px solid transparent; margin-bottom: 4px; background: #FAFAFB;
  font-size: 13px; user-select: none;
}
.blk-item:hover { background: #F2F3F6; }
.blk-item.on { border-color: var(--primary); background: rgba(176,30,40,.05); }
.blk-item.drag { opacity: .4; }
.blk-ico {
  width: 24px; height: 24px; border-radius: 6px; background: #fff; border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center; font-size: 13px; flex: 0 0 auto;
}
.blk-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk-grip { color: #C4C7CE; cursor: grab; font-size: 13px; }

.add-block { padding: 8px 12px 16px; }
.add-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.add-panel button {
  padding: 9px 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff;
  cursor: pointer; font-size: 12px; text-align: center; line-height: 1.5;
}
.add-panel button:hover { border-color: var(--primary); color: var(--primary); }
.add-panel button i { display: block; font-style: normal; font-size: 15px; margin-bottom: 2px; }

.phone {
  width: 390px; height: calc(100vh - 96px); background: #fff;
  border-radius: 22px 22px 0 0; overflow-y: auto; overflow-x: hidden;
  box-shadow: 0 10px 40px rgba(0,0,0,.16); transform-origin: top center;
}
.phone-tools {
  width: 390px; display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 8px; font-size: 12px; color: var(--ink-3);
}
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; background: transparent; padding: 5px 11px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.seg button.on { background: var(--ink); color: #fff; }

.prop { padding: 14px; }
.prop h4 { margin: 0 0 12px; font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--ink-3); }
.prop .field label { font-size: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hint { font-size: 11.5px; color: var(--ink-3); line-height: 1.6; margin-top: 4px; }
.color-in { display: flex; gap: 8px; align-items: center; }
.color-in input[type=color] { width: 38px; height: 36px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }

/* 图片字段 */
.imgf { display: flex; gap: 10px; align-items: flex-start; }
.imgf-pic {
  width: 78px; height: 78px; border-radius: 9px; border: 1px dashed var(--line);
  background: #FAFAFB center/cover no-repeat; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--ink-3);
  overflow: hidden;
}
.imgf-pic img { width: 100%; height: 100%; object-fit: cover; }
.imgf-acts { display: flex; flex-direction: column; gap: 5px; }
.imgf-acts .btn { padding: 5px 10px; font-size: 12px; }

/* 列表项编辑 */
.list-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: #FCFCFD;
}
.list-item .li-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.list-item .li-head b { font-size: 12px; color: var(--ink-2); }
.list-item .li-head .btn { margin-left: auto; }

/* 子图片九宫格 */
.substrip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sub-label { font-size: 11.5px; color: var(--ink-2); font-weight: 600; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(20,18,17,.42); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: #fff; border-radius: 15px; box-shadow: 0 20px 60px rgba(0,0,0,.24);
  width: 100%; max-width: 430px; padding: 24px; max-height: 90vh; overflow-y: auto;
}
.modal h3 { margin: 0 0 6px; font-size: 17px; }
.modal .m-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 18px; line-height: 1.6; }
.modal-acts { display: flex; gap: 9px; margin-top: 20px; }
.qr-box { text-align: center; padding: 12px 0 4px; }
.qr-box canvas, .qr-box img { border-radius: 10px; background: #fff; }

/* 分享海报弹窗 */
.modal-poster { max-width: 400px; }
.poster-wrap {
  background: #F3EDE6; border-radius: 14px; overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12);
  min-height: 120px; display: flex; align-items: center; justify-content: center;
}
.poster-wrap img { width: 100%; display: block; }
.poster-loading { padding: 64px 16px; font-size: 12.5px; color: var(--ink-3); }
.p-url { font-size: 11.5px; color: var(--ink-3); word-break: break-all; text-align: center; margin-top: 12px; line-height: 1.5; }
.p-hint { font-size: 12px; color: var(--ink-2); text-align: center; margin-top: 10px; line-height: 1.5; }
.p-alt { display: block; text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 12px; cursor: pointer; text-decoration: underline; }
.tpl-row { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 14px; }
.tpl-chip {
  display: inline-flex; align-items: center; gap: 5px;
  font: 600 12.5px/1 inherit; padding: 7px 11px; border-radius: 999px;
  border: 1.5px solid rgba(44,36,34,.14); background: #fff; color: var(--ink-2);
  cursor: pointer; transition: all .15s;
}
.tpl-chip i { width: 13px; height: 13px; border-radius: 4px; border: 1px solid rgba(0,0,0,.12); }
.tpl-chip:hover { border-color: var(--primary); color: var(--ink); }
.tpl-chip.on { border-color: var(--primary); background: rgba(176,30,40,.08); color: var(--primary); }

/* 表格 */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; }
.table th { background: #FAFAFB; font-size: 12px; color: var(--ink-3); font-weight: 700; letter-spacing: .4px; }
.table tr:last-child td { border-bottom: none; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: #F1F2F5; color: var(--ink-2); }
.pill.green { background: rgba(30,142,78,.1); color: #1E8E4E; }
.pill.red { background: rgba(176,30,40,.09); color: var(--primary); }

/* 提示条 */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 13px; z-index: 200; box-shadow: 0 8px 24px rgba(0,0,0,.2);
  animation: tin .2s ease;
}
@keyframes tin { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

.save-state { font-size: 12px; color: var(--ink-3); }
.save-state.ok { color: #1E8E4E; }

/* 展示区域调整弹窗（裁剪式：原图比例 + 黑遮罩 + 白框镂空） */
.btn.adjusted { border-color: rgba(176, 30, 40, .45); color: var(--primary); }
.fx-modal { max-width: 430px; }
.fx-frame {
  position: relative; margin: 0 auto; overflow: hidden;
  background: #141210; border-radius: 12px;
  cursor: grab; touch-action: none; user-select: none;
}
.fx-frame.grabbing { cursor: grabbing; }
.fx-img {
  position: absolute; display: block;
  pointer-events: none; -webkit-user-drag: none;
}
.fx-hole {
  position: absolute;
  box-shadow: 0 0 0 3000px rgba(0, 0, 0, .56);
  border: 1.5px solid rgba(255, 255, 255, .9);
  pointer-events: none;
}
.fx-hole::before, .fx-hole::after {
  content: ''; position: absolute; width: 14px; height: 14px;
  border: 2.5px solid #fff;
}
.fx-hole::before { left: -2px; top: -2px; border-right: none; border-bottom: none; }
.fx-hole::after { right: -2px; bottom: -2px; border-left: none; border-top: none; }
.fx-badge {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 8px; z-index: 2;
  font-size: 10.5px; color: #fff; background: rgba(20, 18, 17, .55);
  padding: 3px 8px; border-radius: 999px; pointer-events: none; white-space: nowrap;
}
.fx-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.fx-lab { font-size: 12.5px; color: var(--ink-2); font-weight: 600; flex: 0 0 auto; }
.fx-zoom { flex: 1; accent-color: var(--primary); }
.fx-zoom-val { font-size: 12.5px; min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }

/* 预览里点出的弹窗（渲染器 append 到 body，admin 页面也要有同款样式） */
.lb-mask, .lg-mask { --line: #E4E6EA; --muted: #8B8480; --radius: 18px; }
.lb-mask {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(14, 11, 10, .93);
  display: flex; align-items: center; justify-content: center;
}
.lb-stage { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 56px 68px 76px; }
.lb-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; background: #1B1716; }
.lb-close {
  position: absolute; top: 16px; right: 16px; z-index: 2;
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 46px; height: 46px; border: none; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff;
  font-size: 30px; line-height: 1; cursor: pointer; padding-bottom: 4px;
}
.lb-prev { left: 14px; } .lb-next { right: 14px; }
.lb-foot {
  position: absolute; left: 0; right: 0; bottom: 20px; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: rgba(255, 255, 255, .82); font-size: 13px; text-align: center; padding: 0 20px;
}
.lg-mask {
  background: rgba(14, 11, 10, .9); padding: 18px;
}
.lg-panel {
  width: min(760px, 100%); max-height: min(86vh, 920px);
  background: #fff; border-radius: 16px; overflow: hidden;
  display: flex; flex-direction: column;
}
.lg-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 13px 16px; border-bottom: 1px solid var(--line); flex: 0 0 auto;
}
.lg-title { font-size: 15.5px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-close {
  width: 34px; height: 34px; flex: 0 0 auto; border: none; border-radius: 50%;
  background: #F3EDE6; font-size: 14px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.lg-grid {
  overflow-y: auto; padding: 14px;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  align-content: start;
}
.lg-cell { margin: 0; border-radius: 10px; overflow: hidden; background: #F3EDE6; cursor: zoom-in; }
.lg-cell img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block; }
.lg-cell figcaption {
  font-size: 11.5px; padding: 6px 8px; color: var(--muted);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

@media (max-width: 1024px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .pane.mid { display: none; }
  .pane { border: none !important; }
}
