* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: radial-gradient(circle at top, #f3f0ff 0, #e9e7ff 40%, #e2e8f0 100%);
  color: #1f2937;
  min-height: 100vh;
  overflow-x: hidden;
}

.page-wrap {
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 16px 16px 24px;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: max(24px, env(safe-area-inset-bottom));
}

.app {
  width: 100%;
  max-width: 720px;
  background: rgba(255, 255, 255, 0.96);
  border-radius: 16px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  position: relative;
}

.app::before {
  content: '';
  position: absolute;
  inset: -40%;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, 0.15), transparent 55%),
    radial-gradient(circle at 90% 0%, rgba(212, 173, 86, 0.20), transparent 55%),
    radial-gradient(circle at 50% 100%, rgba(19, 37, 61, 0.22), transparent 60%);
  opacity: 0.8;
  z-index: -1;
}

.header {
  padding: 20px 20px 16px;
  text-align: center;
  /* 农历精算版：偏“命理书卷风”，使用深蓝金色调与普通版区分 */
  background: linear-gradient(135deg, #1e3a8a, #a855f7);
  color: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  position: relative;
  overflow: hidden;
}

.header::after {
  content: '';
  position: absolute;
  top: -40%;
  left: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle at 30% 0%, rgba(255, 255, 255, 0.52), transparent 60%);
  opacity: 0.0;
  transform: translateX(-40%);
  animation: headerGlow 12s ease-in-out infinite;
}

@keyframes headerGlow {
  0% {
    opacity: 0;
    transform: translateX(-40%);
  }
  35% {
    opacity: 0.6;
    transform: translateX(40%);
  }
  60% {
    opacity: 0;
    transform: translateX(80%);
  }
  100% {
    opacity: 0;
    transform: translateX(80%);
  }
}

.title {
  font-size: 22px;
  letter-spacing: 0.18em;
  text-indent: 0.18em;
  margin-bottom: 6px;
}

.sub-title {
  font-size: 13px;
  opacity: 0.95;
}

.vision-text {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.9;
}

.form-section {
  padding: 18px 20px 4px;
}

.form-box {
  background: #f6f7ff;
  border-radius: 12px;
  padding: 14px 16px 18px;
  border: 1px solid rgba(148,163,184,.55);
  margin-bottom: 8px;
}

.form-group-two {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 16px;
  max-width: 640px;
  margin: 0 auto;
}

.person-block {
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px 12px;
  border: 1px solid rgba(148,163,184,.55);
}

.person-label {
  font-size: 14px;
  font-weight: 600;
  color: #4c1d95;
  margin-bottom: 8px;
  text-align: center;
}

.field-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* 生日：与姓名、时辰同一左栏宽度(40px)+间距(8px)，右栏年/月/日整体垂直居中 */
.field-row.field-row-birthday {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  grid-template-rows: auto;
  column-gap: 8px;
  align-items: center;
}

.field-row-birthday .field-label {
  grid-column: 1;
  align-self: center;
  justify-self: center;
  width: auto;
  flex-shrink: 0;
  text-align: center;
  line-height: 1.35;
}

.field-row-birthday .birthday-group {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
  flex: initial;
}

.field-row-birthday .birthday-group select {
  width: 100%;
  flex: none;
  min-height: 44px;
  padding: 8px 6px;
  border-radius: 6px;
  border: 1px solid rgba(148,163,184,.9);
  font-size: 13px;
  background: #fff;
  color: #374151;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.field-row-birthday .birthday-group select:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 0 1px rgba(168,85,247,.35);
}

.field-row-birthday input[type="hidden"] {
  display: none !important;
}

.field-label {
  width: 40px;
  font-size: 13px;
  color: #374151;
}

.field-input {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid rgba(148,163,184,.9);
  font-size: 13px;
  background: #fff;
}

.field-input:focus {
  outline: none;
  border-color: #a855f7;
  box-shadow: 0 0 0 1px rgba(168,85,247,.35);
}

.error-msg {
  min-height: 16px;
  font-size: 12px;
  color: #b52a2a;
  margin-top: 2px;
}

.submit-btn {
  margin-top: 14px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #4c1d95, #a855f7);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22);
}

.submit-btn:active {
  transform: translateY(0);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.18);
}

.tip-text {
  margin-top: 6px;
  font-size: 12px;
  color: #7a5a42;
  text-align: center;
}

.result-section {
  padding: 10px 20px 18px;
  display: none;
}

.result-card {
  background: #f3f5ff;
  border-radius: 12px;
  padding: 14px 16px 18px;
  border: 1px solid rgba(129,140,248,.45);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  transform: translateY(6px);
  opacity: 0.0;
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
}

.result-card.is-active {
  transform: translateY(0);
  opacity: 1;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

.result-title {
  font-size: 16px;
  font-weight: 600;
  color: #4c1d95;
  margin-bottom: 10px;
  text-align: center;
}

.score-row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(129,140,248,.35);
  border-radius: 12px;
  background: #fff;
}

.score-circle {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 4px solid rgba(139, 32, 32, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 30% 20%, #ffe9c9 0, #fce0c0 40%, #f5d1b1 100%);
  color: #4c1d95;
  font-weight: 700;
}

.score-circle span {
  line-height: 1.1;
}

#scoreValue {
  font-size: 20px;
}

.score-unit {
  font-size: 11px;
  opacity: 0.9;
}

.score-text {
  min-width: 0;
  display: grid;
  gap: 8px;
}

.score-level {
  font-size: 14px;
  font-weight: 600;
  color: #8b2020;
  line-height: 1.55;
  margin: 0;
  text-align: left;
  background: #fff8f2;
  border: 1px solid rgba(139, 32, 32, 0.22);
  border-radius: 10px;
  padding: 8px 14px;
}

.score-summary {
  margin-top: 0;
  font-size: 13px;
  color: #5b3a2b;
  line-height: 1.7;
  text-align: left;
  background: #f6f8ff;
  border: 1px solid rgba(76, 29, 149, 0.2);
  border-radius: 10px;
  padding: 8px 14px;
}

.dimension-panel {
  margin-top: 10px;
  padding: 12px 12px 14px;
  background: linear-gradient(180deg, #fffdf8, #f8f6ff);
  border: 1px solid rgba(129, 140, 248, 0.35);
  border-radius: 12px;
}

.dimension-title {
  font-size: 14px;
  font-weight: 700;
  color: #4c1d95;
  text-align: center;
  margin-bottom: 6px;
}

.dimension-hint {
  font-size: 11px;
  color: #64748b;
  line-height: 1.55;
  text-align: center;
  margin-bottom: 10px;
}

.dimension-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dim-row {
  display: grid;
  grid-template-columns: 5.5em minmax(0, 1fr) 2.5em;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.dim-label {
  color: #475569;
  font-weight: 600;
  white-space: nowrap;
}

.dim-meter {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.dim-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, #a855f7);
  min-width: 4px;
  transition: width 0.35s ease;
}

.dim-num {
  text-align: right;
  font-weight: 700;
  color: #4c1d95;
  font-variant-numeric: tabular-nums;
}

.match-box-label {
  display: inline-block;
  min-width: 4.6em;
  margin-right: 0;
  font-size: 12px;
  color: #6b7280;
  text-align: left;
}

.match-box-value {
  display: inline-block;
  padding-left: 2ch;
  font-weight: 600;
  color: inherit;
}

.detail-row {
  margin-top: 12px;
  font-size: 14px;
  color: #334155;
  background: #fff;
  border: 1px solid rgba(129,140,248,.35);
  border-radius: 10px;
  padding: 10px 12px 12px;
}

.detail-row h3 {
  font-size: 14px;
  margin-bottom: 8px;
  color: #4c1d95;
  text-align: center;
  border-bottom: 1px solid rgba(129,140,248,.25);
  padding-bottom: 4px;
}

.detail-item {
  margin-bottom: 8px;
  line-height: 1.7;
  display: flex;
  align-items: stretch;
  justify-content: center;
  column-gap: 8px;
}

.detail-item:last-child {
  margin-bottom: 0;
}

.detail-teaser-tip {
  margin-top: 12px; padding: 12px 14px; background: linear-gradient(135deg, #f0ebe0 0%, #e6dfd0 100%);
  border: 1px solid #d4c8b0; border-radius: 8px; font-size: 14px; color: #5a5040;
  display: block;
}

.detail-tag {
  display: inline-block;
  flex: 0 0 7.6em;
  min-width: 7.6em;
  max-width: 7.6em;
  font-weight: 600;
  color: #334155;
  white-space: normal;
  background: #eef2ff;
  border: 1px solid rgba(129,140,248,.25);
  border-radius: 8px;
  padding: 7px 8px;
  text-align: center;
}

.detail-sub .detail-tag {
  visibility: hidden;
}
.detail-text {
  display: block;
  flex: 1;
  background: #f8faff;
  border: 1px solid rgba(129,140,248,.25);
  border-radius: 8px;
  padding: 7px 10px;
}

.bazi-line-sub {
  display: inline-block;
  padding-top: 2px;
}

.pay-modal {
  display: none;
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  z-index: 10100;
  background: rgba(0,0,0,0.55);
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.pay-modal.is-open { display: flex; }
.pay-modal-inner {
  background: #f3f4ff;
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 14px 48px rgba(0,0,0,0.22);
}
.pay-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #1e3a8a, #a855f7);
  color: #fff;
  font-weight: 700;
}
.pay-close { background: none; border: none; color: #fff; font-size: 24px; line-height: 1; cursor: pointer; padding: 0 4px; }
.pay-modal-body { padding: 16px; }
.pay-amount {
  border: 1px solid #e0d4c0;
  border-radius: 10px;
  background: #fffef9;
  padding: 14px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 14px;
}
.pay-amount-label { font-size: 13px; color: #7a6a4d; }
.pay-amount-value { font-size: 22px; font-weight: 900; color: #4c1d95; }
.pay-methods { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
.pay-method {
  border-radius: 10px;
  border: 1px solid #d4c4a8;
  background: #fff;
  padding: 12px;
  font-size: 15px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.pay-method:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(0,0,0,0.1); border-color: #a855f7; }
.pay-method-wechat { color: #0f8a3a; }
.pay-tip { font-size: 12px; color: #7a6a4d; line-height: 1.6; }
.pay-modal-actions {
  display: flex;
  gap: 12px;
  padding: 16px;
  justify-content: center;
  border-top: 1px solid #e0d4c0;
  background: rgba(255,255,255,0.5);
}
.pay-btn { padding: 10px 20px; border-radius: 8px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit; }
.pay-btn-secondary { border: 1px solid #c4a882; background: #fff; color: #5b3a2b; }
.pay-btn-primary { border: none; background: linear-gradient(135deg, #4c1d95, #a855f7); color: #fff; }
.pay-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

/* 结果区下载按钮：确保文案严格居中 */
#downloadReportBtn,
.download-report-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.result-download-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-top: 8px;
  margin-bottom: 4px;
}

.unlock-full-btn {
  min-width: 240px;
  width: min(100%, 320px);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #374151;
  border: 2px solid rgba(148, 163, 184, 0.85);
  background: linear-gradient(180deg, #ffffff, #f3f6ff);
  box-shadow: 0 8px 20px rgba(30, 41, 59, 0.08);
}

.unlock-full-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(30, 41, 59, 0.12);
  border-color: #a855f7;
}

.report-preview-tip {
  width: min(100%, 680px);
  margin: 2px auto 0;
  font-size: 12px;
  color: #705944;
  line-height: 1.58;
  text-align: center;
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(170, 145, 113, 0.32);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(247, 247, 252, 0.92));
}

.footer-note {
  padding: 10px 20px 18px;
  font-size: 12px;
  color: #7a5a42;
  text-align: center;
  border-top: 1px solid #ead8c5;
  background: linear-gradient(to top, #f5e6d3, #f9efe4);
}

.footer-note p {
  max-width: 540px;
  margin: 0 auto;
  line-height: 1.6;
}

.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
}

.footer-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

@media (max-width: 720px) {
  .form-section {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }

  .form-group-two {
    grid-template-columns: 1fr;
    max-width: 100%;
    gap: 14px;
  }

  .person-block {
    min-width: 0;
  }
}

@media (max-width: 480px) {
  .page-wrap {
    padding: 10px;
  }

  .header {
    padding: 16px 12px 12px;
  }

  .title {
    font-size: 20px;
  }

  .form-section,
  .result-section {
    padding-left: 12px;
    padding-right: 12px;
  }

  .form-group-two {
    gap: 12px;
  }

  .person-block {
    padding: 10px 10px 12px;
  }

  .score-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .score-circle {
    margin: 0 auto;
  }

  .dim-row {
    grid-template-columns: 4.8em minmax(0, 1fr) 2.2em;
    font-size: 11px;
    gap: 6px;
  }

  .dimension-hint {
    font-size: 10px;
  }

  .pay-modal { padding: 10px; }
  .pay-methods { grid-template-columns: 1fr; }
  .pay-modal-actions { flex-direction: column; }
  .pay-modal-actions .pay-btn { width: 100%; }
}

/* 微信支付二维码弹窗 */
.payqr-box {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10120;
}
.payqr-box.is-open {
  display: flex;
}
.payqr-inner {
  background: #fff9f0;
  border-radius: 10px;
  padding: 16px 18px 18px;
  width: 280px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
  border: 2px solid #8b2020;
}
.payqr-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  position: relative;
}
.payqr-title {
  font-size: 15px;
  font-weight: 700;
  color: #8b2020;
  text-align: center;
}
.payqr-close-btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  color: #5b3a2b;
}
.payqr-body {
  text-align: center;
}
.payqr-qrcode {
  width: 220px;
  height: 220px;
  margin: 0 auto 10px;
  background: #fff;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.payqr-tip {
  font-size: 12px;
  color: rgba(0,0,0,0.7);
  margin-bottom: 0;
}

