* {
  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, #f7f4ff 0, #efecff 38%, #eaf1ff 72%, #e7edf7 100%);
  color: #2b1f1a;
  min-height: 100vh;
  overflow-x: hidden;
}

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

.app {
  width: 100%;
  max-width: 720px;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 16px;
  box-shadow: 0 20px 52px rgba(42, 34, 73, 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, #312e81, #7c3aed 58%, #a855f7);
  color: #fff;
  box-shadow: 0 8px 18px rgba(49, 46, 129, 0.28);
  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.16em;
  text-indent: 0.16em;
  margin-bottom: 6px;
}

.sub-title {
  font-size: 11px;
  line-height: 1.55;
  opacity: 0.95;
}

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

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

.form-box {
  background: linear-gradient(180deg, #fbf5ea, #f8efe1);
  border-radius: 12px;
  padding: 14px 16px 18px;
  border: 1px solid #e4d0b6;
}

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

.person-block {
  background: linear-gradient(180deg, #fffdf8, #fff8ee);
  border-radius: 10px;
  padding: 10px 12px 12px;
  border: 1px solid #ebdbc7;
}

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

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

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

.field-input {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #decab2;
  font-size: 13px;
  background: #fffdf9;
}

.field-input:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.22);
}

.field-row-ymd .birthday-group,
.range-row-ymd .birthday-group {
  flex: 1;
  min-width: 0;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.birthday-group .birthday-select {
  flex: 1;
  min-width: 56px;
  padding: 8px 6px;
  border-radius: 6px;
  border: 1px solid #decab2;
  font-size: 13px;
  background: #fffdf9;
  color: #2b1f1a;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.birthday-group .birthday-select:focus {
  outline: none;
  border-color: #8b5cf6;
  box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.22);
}

.range-block {
  margin-top: 6px;
  background: linear-gradient(180deg, #fff9ef, #fff5e8);
  border-radius: 10px;
  padding: 10px 12px 10px;
  border: 1px dashed #dec8ac;
}

.range-title {
  font-size: 13px;
  font-weight: 600;
  color: #5b21b6;
  margin-bottom: 6px;
  text-align: center;
}

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

.range-tip {
  margin-top: 2px;
  font-size: 12px;
  color: #7a5a42;
  line-height: 1.6;
}

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

.form-cta-box {
  margin-top: 14px;
  padding: 14px 14px 12px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(216, 195, 168, 0.95);
  border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.form-cta-box .submit-btn {
  margin-top: 0;
}

.submit-btn {
  margin-top: 14px;
  width: 100%;
  border: none;
  border-radius: 999px;
  padding: 12px 16px;
  background: linear-gradient(135deg, #5b21b6, #7c3aed 52%, #a855f7);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-indent: 0.16em;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(91, 33, 182, 0.28);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(91, 33, 182, 0.34);
}

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

/* 单行展示：窄屏可横向轻扫阅读 */
.tip-text-scroll {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  border: 1px solid rgba(224, 203, 176, 0.9);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  text-align: center;
  scrollbar-width: thin;
}

.tip-text-scroll::-webkit-scrollbar {
  height: 4px;
}

.tip-text-scroll::-webkit-scrollbar-thumb {
  background: rgba(139, 115, 85, 0.35);
  border-radius: 4px;
}

.tip-text-scroll .tip-text {
  display: inline-block;
  margin: 0;
  padding: 0;
  font-size: 11px;
  letter-spacing: -0.02em;
  color: #6b5344;
  line-height: 1.55;
  white-space: nowrap;
  text-align: center;
  max-width: none;
}

.result-section {
  padding: 10px 20px 18px;
  display: none;
  flex-direction: column;
  gap: 10px;
}

.result-card {
  background: linear-gradient(180deg, #fffdfb, #fff9f2);
  border-radius: 12px;
  padding: 14px 14px 14px;
  border: 1px solid rgba(206, 176, 120, 0.45);
  box-shadow: 0 7px 16px rgba(62, 38, 19, 0.06);
}

.result-title {
  font-size: 15px;
  font-weight: 700;
  color: #5b21b6;
  margin-bottom: 8px;
  text-align: center;
}

.result-hint {
  font-size: 12px;
  color: #7a5a42;
  text-align: center;
  line-height: 1.58;
  max-width: 560px;
  margin-left: auto;
  margin-right: auto;
}

/* 首块双段说明单独缩小，避免视觉过重 */
#pairSummary,
#pairDetail {
  font-size: 11px;
  line-height: 1.6;
}

.date-list {
  list-style: none;
  margin-top: 6px;
  padding-left: 0;
}

.date-item {
  background: linear-gradient(180deg, #fcfaf5, #f8f4eb);
  border-radius: 12px;
  border: 1px solid rgba(154, 128, 96, 0.22);
  padding: 9px;
  font-size: 12.5px;
  color: #3d2e24;
  margin-bottom: 9px;
  box-shadow: 0 4px 12px rgba(61, 46, 36, 0.06);
}

.date-item-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1.28fr) minmax(0, 0.72fr);
  gap: 7px;
  align-items: stretch;
}

.date-item-grid > .date-col {
  min-width: 0;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(173, 151, 121, 0.2);
  border-radius: 9px;
  padding: 9px 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.date-col-line {
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.date-col-yiji {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

.date-col-yiji .date-sub {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  text-align: left;
}

.date-col-score {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.date-main {
  font-weight: 600;
  font-size: 12.5px;
  margin-bottom: 7px;
  line-height: 1.36;
  color: #2f241c;
}

.date-sub {
  font-size: 11px;
  color: #6b5344;
  line-height: 1.52;
}

.date-yiji-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.yiji-tag {
  flex: 0 0 24px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 0;
  line-height: 1.35;
}
.yiji-tag.yi {
  background: rgba(16, 185, 129, 0.14);
  color: #0f766e;
  border: none;
}
.yiji-tag.ji {
  background: rgba(244, 63, 94, 0.12);
  color: #9f1239;
  border: none;
}
.yiji-text {
  flex: 1;
  min-width: 0;
  font-size: 11px;
  line-height: 1.5;
}

.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: linear-gradient(180deg, #f4efff, #ebe3ff);
  border: 1px solid rgba(124, 58, 237, 0.28);
  color: #4c1d95;
}

.date-reason {
  display: block;
  font-size: 11px;
  color: #6b5344;
  line-height: 1.52;
  text-align: center;
  width: 100%;
  margin: 0;
  word-break: keep-all;
}

.pay-modal {
  display: none;
  position: fixed;
  left: 0; top: 0; right: 0; bottom: 0;
  z-index: 10050;
  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: #f5f0e6;
  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-method:disabled { opacity: 0.65; cursor: not-allowed; }
.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; }

/* 结果区「下载报告」：避免 inline-flex 导致文字贴左 */
.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));
}

#downloadReportBtn.pay-btn-primary,
.download-report-btn.pay-btn-primary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  min-width: 240px;
  width: min(100%, 320px);
  box-sizing: border-box;
  padding-top: 12px;
  padding-bottom: 12px;
}

.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-scroll {
  overflow: visible;
  text-align: center;
  display: block;
}

.footer-note-scroll p {
  display: block;
  max-width: 540px;
  margin: 0 auto;
  padding: 0;
  font-size: 11px;
  line-height: 1.6;
  color: #6b5344;
  white-space: normal;
}

/* 提高选择器优先级，避免被 .footer-note-scroll p 覆盖导致错位 */
.footer-note-scroll .footer-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 10px;
  white-space: normal;
  text-align: center;
  vertical-align: middle;
  width: auto;
  margin: 0 auto;
  padding: 0;
}

.footer-note-scroll .footer-brand span {
  display: block;
  text-align: center;
  word-break: normal;
  max-width: none;
}

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

@media (max-width: 720px) {
  .date-item {
    padding: 10px;
  }

  .date-item-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

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

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

  .title {
    font-size: 20px;
  }

  .form-section,
  .result-section {
    padding-left: max(12px, env(safe-area-inset-left));
    padding-right: max(12px, env(safe-area-inset-right));
  }

  .form-group-two {
    grid-template-columns: 1fr;
    gap: 12px;
  }

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

  /* 窄屏：年/月/日横向三等分，触控高度足够 */
  .field-row-ymd .birthday-group,
  .range-row-ymd .birthday-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    flex-wrap: nowrap;
  }

  .birthday-group .birthday-select {
    flex: none;
    min-width: 0;
    width: 100%;
    min-height: 44px;
    font-size: 12px;
    padding: 8px 4px;
  }

  .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: 10060;
}
.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 #4c1d95;
}
.payqr-header {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  position: relative;
}
.payqr-title {
  font-size: 15px;
  font-weight: 700;
  color: #4c1d95;
  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;
}

