/* 家事文书 v1 — 手机优先；品牌色提为 CSS 变量，便于 A/B（见 :root 注释） */
:root {
  --brand: #ff5a5f;        /* 主品牌色：珊瑚红（偏“亲民/警示”，现默认） */
  --brand-2: #ff7a6b;      /* 头部渐变辅色 */
  --brand-active: #e84a4f; /* 按下态 */
  /* A/B 测试法律信任感：把上面三行换成深蓝即可一键切换
     --brand:#1f4e79; --brand-2:#2f6db0; --brand-active:#163a5a; */
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: #f6f4ef;
  color: #2b2722;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }

.app-head {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 30px 20px 26px;
  text-align: center;
}
.app-head h1 { margin: 0; font-size: 30px; letter-spacing: 3px; }
.app-head .tag { margin: 8px 0 0; font-size: 14px; opacity: 0.95; }
.app-head .trust-line {
  margin: 14px auto 0; display: inline-block;
  font-size: 12.5px; color: #fff;
  background: rgba(255,255,255,.18); padding: 5px 14px; border-radius: 14px;
}

.app-main { max-width: 560px; margin: 0 auto; padding: 18px 16px 40px; }
/* 桌面放宽，让文书纸张感（A4 比例）有空间 */
@media (min-width: 700px) { .app-main { max-width: 860px; } }
.app-foot {
  text-align: center; font-size: 12px; color: #8a8378;
  padding: 16px; border-top: 1px solid #ece8e0;
}

/* 首页文书卡片 */
.doc-grid { display: grid; gap: 14px; }
.doc-card {
  display: block; width: 100%; text-align: left;
  background: #fff; border: 1px solid #ece8e0; border-radius: 16px;
  padding: 18px 18px 16px; cursor: pointer; transition: .15s;
  box-shadow: 0 2px 10px rgba(0,0,0,.03);
}
.doc-card:hover { border-color: var(--brand); transform: translateY(-1px); }
.doc-card .doc-name { font-size: 19px; font-weight: 700; }
.doc-card .doc-desc { font-size: 13px; color: #5a544c; margin-top: 6px; }
.doc-card .card-meta {
  margin-top: 10px; display: inline-block;
  font-size: 12px; font-weight: 600; color: var(--brand);
  background: #fff3f3; padding: 3px 10px; border-radius: 10px;
}
.doc-card.soon { opacity: .5; cursor: not-allowed; }
.doc-card .doc-soon {
  display: inline-block; margin-top: 8px; font-size: 11px;
  color: var(--brand); background: #ffe8e8; padding: 2px 8px; border-radius: 10px;
}

/* 向导 */
.progress { font-size: 12px; color: var(--brand); font-weight: 600; margin-bottom: 10px; }
.q-label { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.q-label .req { color: var(--brand); }
.q-hint { font-size: 12px; color: #8a8378; margin-bottom: 12px; }
.inp-wrap { margin-bottom: 18px; }
.inp-wrap input, .inp-wrap select {
  width: 100%; padding: 13px 14px; font-size: 16px;
  border: 1px solid #d9d3c8; border-radius: 12px; background: #fff; color: #2b2722;
}
.inp-wrap input:focus, .inp-wrap select:focus { outline: none; border-color: var(--brand); }

/* group 可重复字段编辑器 */
.group-editor { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.group-row {
  border: 1px solid #e4ddcf; border-radius: 14px; padding: 14px 14px 6px;
  background: #fbf9f4; display: flex; flex-direction: column; gap: 10px; position: relative;
}
.group-row .grp-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #6b645a; }
.group-row .grp-field input, .group-row .grp-field select {
  width: 100%; padding: 11px 12px; font-size: 15px;
  border: 1px solid #d9d3c8; border-radius: 10px; background: #fff; color: #2b2722;
}
.group-row .grp-field input:focus, .group-row .grp-field select:focus { outline: none; border-color: var(--brand); }
.group-del {
  align-self: flex-end; margin-top: 2px; padding: 6px 12px; font-size: 13px;
  color: #c0392b; background: #fff; border: 1px solid #e6c3bd; border-radius: 8px; cursor: pointer;
}
.group-add { width: 100%; margin-bottom: 18px; }

.wiz-actions { display: flex; gap: 10px; }
.btn-primary, .btn-ghost {
  flex: 1; padding: 13px; font-size: 16px; font-weight: 700; border-radius: 12px;
  border: none; cursor: pointer;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:active { background: var(--brand-active); }
.btn-ghost { background: #fff; color: #5a544c; border: 1px solid #d9d3c8; }

/* 结果 */
.res-head {
  font-size: 22px; font-weight: 800; margin: 0 0 4px;
  letter-spacing: 1px; text-align: center;
}
.res-badge {
  display: inline-block; font-size: 12px; color: #3a6ea5;
  background: #eef4fb; border: 1px solid #d6e4f5;
  padding: 3px 10px; border-radius: 10px; margin: 0 0 10px;
}
.res-sub {
  text-align: center; font-size: 12px; color: #8a8378; margin-bottom: 14px;
  font-style: italic;
}

/* 文书纸张感 + 宋体（提升正式/信任感） */
.doc-page {
  max-width: 794px; margin: 16px auto;
  background: #fff; padding: 48px 56px;
  box-shadow: 0 2px 12px rgba(0,0,0,.08);
  font-family: "SimSun", "Songti SC", "Noto Serif SC", serif;
  font-size: 15px; line-height: 2; color: #1a1a1a;
  white-space: pre-wrap; word-break: break-word;
  text-align: justify; text-indent: 2em;
}
.doc-page::first-line { font-weight: 700; text-indent: 0; }
/* 免费版禁止手动选中复制正文（仅拦 doc-page；指南/提示不受影响） */
.doc-page.no-copy, .doc-page.no-copy * {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.result.is-unlocked .doc-page { border: 1px solid #d6cfb8; }
@media (max-width: 600px) { .doc-page { padding: 24px 18px; } }

.brand-mark { display: none; }
.disclaimer {
  margin: 12px 0; padding: 12px 14px; font-size: 12.5px; color: #9a5b00;
  background: #fff6e6; border: 1px solid #ffe2ad; border-radius: 12px;
}
.block-sec { margin-top: 16px; }
.block-sec h4 { margin: 0 0 8px; font-size: 15px; }
.block-sec ul { margin: 0; padding-left: 18px; }
.block-sec li { font-size: 13px; color: #5a544c; margin-bottom: 6px; }
.block-sec .guide b { color: #2b2722; }
.legal-box { border: 1px solid #e3e8ee; background: #f7fafc; }
.legal-box h4 { color: #1f4e79; }
.legal-status {
  font-size: 12px; color: #b08a3a; background: #fff7e6;
  display: inline-block; padding: 3px 10px; border-radius: 10px; margin-bottom: 8px;
}
.legal-box .legal li { color: #4a5562; }
.res-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* 付费墙相关 */
.preview-badge {
  display: inline-block; font-size: 11px; color: #c9a23a;
  background: #fff7e0; border: 1px solid #ffe2ad; padding: 2px 9px; border-radius: 10px; margin-bottom: 10px;
}
.result.is-unlocked .preview-badge { display: none; }

.linkbtn {
  background: none; border: none; color: #b0a89c; font-size: 12px;
  text-decoration: underline; cursor: pointer; padding: 0; margin-left: 6px;
}

/* 付费弹窗 */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal-overlay.hidden { display: none; }
.modal {
  position: relative; background: #fff; border-radius: 20px; max-width: 400px; width: 100%;
  padding: 22px 22px 24px; max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-close {
  position: absolute; top: 10px; right: 14px; background: none; border: none;
  font-size: 24px; line-height: 1; color: #b0a89c; cursor: pointer;
}
.pw-title { font-size: 20px; font-weight: 800; margin-bottom: 6px; }
.pw-sub { font-size: 13px; color: #8a8378; margin-bottom: 14px; }
.pw-list { margin: 0 0 16px; padding-left: 18px; }
.pw-list li { font-size: 13px; margin-bottom: 6px; }
.pw-list .ok { color: #2e9e6b; }
.pw-list .no { color: #b08a3a; }
.buy-row { display: flex; gap: 10px; margin-bottom: 14px; }
.buy-btn {
  flex: 1; padding: 13px 8px; border-radius: 12px; font-weight: 700; border: none;
  cursor: pointer; color: #fff; font-size: 14px;
}
.buy-single { background: var(--brand); }
.buy-bundle { background: #ff7a3c; }
.pw-divider { text-align: center; font-size: 12px; color: #8a8378; margin: 4px 0 10px; }
.pw-input {
  width: 100%; padding: 12px; border: 1px solid #d9d3c8; border-radius: 10px;
  font-size: 15px; box-sizing: border-box; margin-bottom: 8px;
}
.pw-verify {
  width: 100%; padding: 13px; border-radius: 12px; background: #2b2722; color: #fff;
  font-weight: 700; border: none; cursor: pointer; font-size: 15px;
}

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%);
  background: rgba(43,39,34,.95); color: #fff; padding: 11px 18px; border-radius: 22px;
  font-size: 14px; z-index: 60; opacity: 0; transition: opacity .25s; pointer-events: none;
  max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; }

/* 反馈入口：右下角悬浮按钮 + 弹窗 */
#fb-fab {
  position: fixed; right: 18px; bottom: 26px; z-index: 45;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--brand); color: #fff; font-size: 24px;
  border: none; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.28);
}
#fb-fab:active { transform: scale(.95); }
.fb-text {
  width: 100%; padding: 12px; border: 1px solid #d9d3c8; border-radius: 10px;
  font-size: 14px; box-sizing: border-box; resize: vertical; font-family: inherit;
  margin-bottom: 10px;
}
.fb-hint {
  font-size: 11px; color: #b0a89c; white-space: pre-line;
  background: #f6f4ef; border: 1px dashed #e0d9cc; border-radius: 10px;
  padding: 8px 10px; margin-bottom: 10px;
}

/* 打印：只留纸张文书，解锁版干净、免费版带尾注+水印 */
@media print {
  @page { margin: 2cm 1.8cm; }
  body { background: #fff; }
  .app-head, .app-foot, .res-actions, .block-sec, .disclaimer,
  .res-sub, .res-badge, .preview-badge { display: none !important; }
  .doc-page { box-shadow: none; margin: 0; padding: 0; max-width: 100%; border: none; }
  .res-head { text-align: left; font-size: 18px; margin-bottom: 16px; }

  /* 打印页脚品牌尾注（未解锁时显示） */
  .brand-mark {
    display: block !important; white-space: pre-line; margin-top: 24px; padding-top: 10px;
    border-top: 1px solid #bbb; font-size: 12px; color: #777; text-align: center;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  }
  .result.is-unlocked .brand-mark { display: none !important; }

  /* 文书正面右下角来源戳记，防无痕转用（仅未解锁打印时显） */
  .doc-page::after {
    content: "家事文书 · 非律师意见 · 仅供草稿参考";
    display: block; margin-top: 32px; padding-top: 10px;
    border-top: 1px dashed #bbb;
    text-align: right; font-size: 12px; color: #999; text-indent: 0;
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  }
  .result.is-unlocked .doc-page::after { display: none; }
}
