/* ---- Design tokens (matched to the PDF report palette) ---- */
:root {
  --beige-light: #f1ecc5;
  --beige-warm:  #e5ccb0;
  --ink:         #2a2a2a;
  --ink-soft:    #5a5a5a;
  --line:        #d8c8a8;
  --accent:      #8a6a3b;
  --accent-dark: #6a4f2a;
  --danger:      #b03a2e;
  --radius:      14px;
  --shadow:      0 6px 18px rgba(60, 40, 10, 0.08);
  --shadow-lg:   0 12px 32px rgba(60, 40, 10, 0.14);
  --font-sans:   -apple-system, BlinkMacSystemFont, "Segoe UI",
                 "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
                 "Helvetica Neue", Arial, sans-serif;
  --font-serif:  "STHeiti", "Songti SC", "Source Han Serif SC",
                 "Noto Serif CJK SC", "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(ellipse at top, var(--beige-light) 0%, var(--beige-warm) 100%);
  color: var(--ink);
  font-family: var(--font-sans);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  min-height: calc(100vh - 112px); /* 100vh minus .page top+bottom padding */
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 0 32px;
}
.hero-badge {
  display: inline-block;
  background: rgba(255, 253, 246, 0.7);
  border: 1px solid var(--line);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 600;
  margin: 0 0 10px;
  letter-spacing: 0.04em;
  color: var(--accent-dark);
}
.hero-subtitle {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.5;
}
.hero-intro {
  margin: 0 auto 28px;
  max-width: 620px;
  color: var(--accent-dark);
  font-size: 20px;
  line-height: 1.75;
  letter-spacing: 0.02em;
}

/* Benefit cards grid */
.hero-benefits {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin: 0 auto 28px;
  max-width: 760px;
}
.benefit-card {
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 14px 16px;
  text-align: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
.benefit-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.benefit-icon {
  display: block;
  font-size: 40px;
  margin-bottom: 8px;
  line-height: 1;
}
.benefit-card h3 {
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 5px;
  color: var(--accent-dark);
  letter-spacing: 0.04em;
}
.benefit-card p {
  margin: 0;
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.5;
}

/* Hero CTA button */
.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 13px 32px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(138, 106, 59, 0.25);
}
.hero-cta:hover {
  background: var(--accent-dark);
  box-shadow: 0 6px 18px rgba(138, 106, 59, 0.35);
}
.hero-cta:active { transform: translateY(1px); }
.hero-cta-arrow {
  font-size: 16px;
  animation: bounce-down 1.4s ease-in-out infinite;
}
@keyframes bounce-down {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(3px); }
}

/* ---- Cards ---- */
.card {
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 24px;
}

/* ---- Form ---- */
.form-card { padding: 32px; }

/* Segmented report-type selector */
.segmented {
  display: flex;
  background: #f6efdb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
  gap: 4px;
}
.segmented-option {
  flex: 1;
  background: transparent;
  border: none;
  border-radius: 7px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.segmented-option:hover:not(.active) {
  background: rgba(255, 255, 255, 0.5);
  color: var(--ink);
}
.segmented-option.active {
  background: #fffdf6;
  color: var(--accent-dark);
  box-shadow: 0 1px 3px rgba(60, 40, 10, 0.12);
}
.badge-soon {
  display: inline-block;
  background: var(--beige-warm);
  color: var(--accent-dark);
  border: 1px solid var(--line);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.4;
}

/* Short description below the report-type selector. */
.report-description {
  margin: -12px 0 22px;
  padding: 0 4px;
  color: var(--ink-soft);
  font-size: 13.5px;
  line-height: 1.65;
  letter-spacing: 0.02em;
  min-height: 1.65em; /* prevent layout shift when descriptions swap */
}

.form-section + .form-section { margin-top: 8px; }
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-dark);
  letter-spacing: 0.06em;
  margin: 0 0 10px;
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.field {
  flex: 1 1 140px;
  display: flex;
  flex-direction: column;
}
.field label {
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.field input {
  appearance: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;
  color: var(--ink);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 106, 59, 0.15);
}
/* Hide spinner buttons on number inputs (cleaner look) */
.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.field input[type="number"] {
  -moz-appearance: textfield;
}

.primary-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 28px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.05s;
}
.primary-btn:hover:not(:disabled) {
  background: var(--accent-dark);
}
.primary-btn:active:not(:disabled) { transform: translateY(1px); }
.primary-btn:disabled {
  background: #b9a684;
  cursor: not-allowed;
}

/* Textarea for the relationship "situation" field */
textarea {
  appearance: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 15px;
  color: var(--ink);
  font-family: inherit;
  width: 100%;
  resize: vertical;
  min-height: 96px;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(138, 106, 59, 0.15);
}

.error {
  color: var(--danger);
  font-size: 14px;
  margin-top: 12px;
  min-height: 1.2em;
}

/* Result note banner (used for the relationship placeholder message) */
.result-note {
  background: #fdf3da;
  border: 1px solid #e8c97a;
  border-left: 4px solid var(--accent);
  color: #6a4f2a;
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 16px;
  white-space: pre-line;
}

/* ---- Loading popup overlay ---- */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(42, 42, 42, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}
.loading-overlay[hidden] { display: none; }

.loading-popup {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 24px 32px;
  font-size: 15px;
  color: var(--ink);
  animation: pop-in 0.2s ease-out;
}
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Result ---- */
.result-card { padding: 20px; }
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
  padding: 0 8px;
}
.result-header h2 {
  font-family: var(--font-serif);
  font-size: 22px;
  margin: 0;
  color: var(--accent-dark);
}
.result-actions { display: flex; gap: 8px; }

.ghost-btn {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  display: inline-block;
  transition: background 0.15s, color 0.15s;
}
.ghost-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* PDF stage: holds the iframe + an overlay (paywall) on top of it. */
.pdf-stage {
  position: relative;
  width: 100%;
  margin: 0 0 12px;
}

#pdfFrame {
  width: 100%;
  height: 820px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f1e3;
}

/* Page-count banner: sits above the iframe, below the header. */
.page-banner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  margin: 12px 0 14px;
  background: #fdf3da;
  border: 1px solid #e2c98a;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink);
}
.page-banner-text strong {
  color: var(--accent-dark);
  font-weight: 700;
}
.page-banner-sep {
  color: var(--ink-soft);
  opacity: 0.6;
}
.page-banner-status {
  color: var(--ink-soft);
}

/* Paywall overlay: covers the bottom 40% of the iframe with a soft fade. */
.paywall {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 55%;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0 16px 28px;
  background: linear-gradient(
    to bottom,
    rgba(246, 241, 227, 0) 0%,
    rgba(246, 241, 227, 0.85) 35%,
    rgba(246, 241, 227, 0.98) 100%
  );
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
  pointer-events: auto;
  z-index: 2;
}
.paywall-inner {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 22px;
  box-shadow: 0 6px 24px rgba(70, 50, 20, 0.10);
  text-align: center;
  max-width: 460px;
  width: 100%;
}
.paywall-eyebrow {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent-dark);
  text-transform: uppercase;
}
.paywall-title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
}
.paywall-title span {
  color: var(--accent-dark);
}
.paywall-help {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
}
.paywall-help strong {
  color: var(--accent-dark);
}
.paywall .primary-btn {
  width: auto;
  min-width: 200px;
}
.hint {
  color: var(--ink-soft);
  font-size: 12px;
  text-align: center;
  margin: 10px 0 0;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  color: var(--ink-soft);
  font-size: 12px;
  margin-top: 24px;
}
.footer p { margin: 0; }

/* ---- Payment screen ---- */
.payment-card { text-align: center; padding: 32px 24px; }
.payment-card h2 {
  font-family: var(--font-serif);
  color: var(--accent-dark);
  margin: 0 0 8px;
  font-size: 22px;
}
.payment-amount {
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 700;
  color: var(--accent);
  margin: 8px 0 12px;
  letter-spacing: 0.02em;
}
.payment-hint {
  color: var(--ink-soft);
  font-size: 14px;
  margin: 0 auto 18px;
  max-width: 460px;
  line-height: 1.6;
}
.payment-qr-wrap {
  display: flex;
  justify-content: center;
  margin: 16px auto 20px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  width: max-content;
}
.payment-qr-wrap img {
  display: block;
  width: 240px;
  height: 240px;
}
.payment-actions {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.payment-status {
  color: var(--ink-soft);
  font-size: 13px;
  margin: 12px 0 4px;
}
.dev-override {
  background: #fdf3da;
  border: 1px dashed #c9a05a;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 18px auto;
  max-width: 460px;
  text-align: left;
}
.dev-override-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-dark);
  margin: 0 0 6px;
  letter-spacing: 0.04em;
}
.dev-override-help {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.55;
  margin: 0 0 10px;
}
.link-btn {
  background: none;
  border: none;
  color: var(--ink-soft);
  text-decoration: underline;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  padding: 4px 8px;
}
.link-btn:hover { color: var(--accent-dark); }

/* ---- Payment status page ---- */
.status-card {
  text-align: center;
  padding: 32px 28px;
}
.status-card h2 {
  font-family: var(--font-serif);
  color: var(--accent-dark);
  margin: 12px 0 8px;
}
.status-message {
  color: var(--ink-soft);
  line-height: 1.65;
  margin: 0 auto 16px;
  max-width: 480px;
}
.status-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 18px;
}
.poll-status {
  color: var(--ink-soft);
  font-size: 13px;
  margin-top: 10px;
}

/* ---- Marketing section (dark banner, full-bleed) ---- */
.marketing {
  background: #4a3520;
  padding: 56px 24px 48px;
  width: 100%;
}
.marketing-inner {
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.marketing-item {
  flex: 1;
  padding: 0 24px;
  text-align: center;
}
.marketing-icon {
  display: block;
  font-size: 48px;
  margin-bottom: 16px;
  line-height: 1;
}
.marketing-item h2 {
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 600;
  margin: 0 0 14px;
  color: #f1ecc5;
  letter-spacing: 0.04em;
}
.marketing-desc {
  margin: 0 0 18px;
  font-size: 17px;
  line-height: 1.75;
  color: rgba(241, 236, 197, 0.82);
}
.marketing-points {
  list-style: none;
  margin: 0;
  padding: 0;
  text-align: left;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}
.marketing-points li {
  font-size: 16px;
  line-height: 1.7;
  color: rgba(241, 236, 197, 0.9);
  padding: 5px 0 5px 22px;
  position: relative;
}
.marketing-points li::before {
  content: "✦";
  position: absolute;
  left: 0;
  top: 5px;
  color: #d8c8a8;
  font-size: 14px;
}
.marketing-divider {
  width: 1px;
  background: rgba(216, 200, 168, 0.25);
  flex-shrink: 0;
}
.marketing-cta-wrap {
  text-align: center;
  margin-top: 40px;
}
.marketing-cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 15px 40px;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.05em;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.05s, box-shadow 0.15s;
  box-shadow: 0 4px 14px rgba(138, 106, 59, 0.35);
}
.marketing-cta:hover {
  background: var(--accent-dark);
  box-shadow: 0 6px 20px rgba(138, 106, 59, 0.45);
}
.marketing-cta:active { transform: translateY(1px); }

/* Extra spacing between the full-bleed marketing banner and the form */
.marketing + .page { padding-top: 72px; }

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .page { padding: 28px 16px 40px; }
  .hero { min-height: auto; padding: 48px 0 32px; }
  .hero h1 { font-size: 28px; }
  .hero-intro { font-size: 13px; }
  .hero-benefits { grid-template-columns: repeat(2, 1fr); }
  .form-card { padding: 22px; }
  #pdfFrame { height: 640px; }
  .marketing { padding: 40px 16px 32px; }
  .marketing-inner { flex-direction: column; gap: 28px; }
  .marketing-divider { width: 100%; height: 1px; }
  .marketing-item { padding: 0; }
  .marketing-item h2 { font-size: 22px; }
  .marketing-desc { font-size: 15px; }
  .marketing-points li { font-size: 14px; }
  .marketing-cta { font-size: 15px; padding: 13px 32px; }
}
