/* ==========================================================================
   AHA PREVENT 2024 Cardiovascular Risk Calculator — 公众号「心灵维修工」
   Medical-grade mobile-first clinical UI (375px-430px WeChat optimized)
   ========================================================================== */

:root {
  --bg-page: #f3f6f9;
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-helper: #f1f5f9;
  --border-subtle: #e2e8f0;
  --border-strong: #cbd5e1;

  --navy-900: #0c233b;
  --navy-800: #123456;
  --navy-700: #1a4673;
  --teal-700: #0f766e;
  --teal-600: #0d7c7b;
  --teal-50: #f0fdfa;
  --teal-200: #99f6e4;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  /* Risk Tiers */
  --risk-low-fg: #15803d;
  --risk-low-bg: #dcfce7;
  --risk-low-border: #bbf7d0;
  --risk-low-bar: #16a34a;

  --risk-borderline-fg: #b45309;
  --risk-borderline-bg: #fef3c7;
  --risk-borderline-border: #fde68a;
  --risk-borderline-bar: #f59e0b;

  --risk-intermediate-fg: #c2410c;
  --risk-intermediate-bg: #ffedd5;
  --risk-intermediate-border: #fed7aa;
  --risk-intermediate-bar: #ea580c;

  --risk-high-fg: #b91c1c;
  --risk-high-bg: #fee2e2;
  --risk-high-border: #fecaca;
  --risk-high-bar: #dc2626;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 2px 10px rgba(15, 23, 42, 0.05), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-modal: 0 20px 50px rgba(15, 23, 42, 0.25);

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-primary);
  background-color: var(--bg-page);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* App Shell */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 62%, #154a66 100%);
  color: #ffffff;
  padding: 18px 16px 20px;
}

.header-inner {
  max-width: 640px;
  margin: 0 auto;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #ffffff;
}

.brand-text {
  min-width: 0;
}

.brand-pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #99f6e4;
  margin-bottom: 2px;
}

.site-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.header-subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
  line-height: 1.45;
}

/* Disclaimer Banner */
.disclaimer-banner {
  background: #e8f1f8;
  border-bottom: 1px solid #d1e2f0;
  color: var(--navy-800);
  padding: 9px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  line-height: 1.4;
}

.disclaimer-icon {
  flex-shrink: 0;
  color: var(--teal-700);
}

/* Main Content */
.main-content {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 12px 24px;
  flex: 1;
}

/* Cards */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 18px 16px;
  margin-bottom: 16px;
}

.card-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
}

.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy-800);
}

.card-desc {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--text-muted);
}

.quick-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Form Groups */
.form-group-block {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px dashed var(--border-subtle);
}

.form-group-block:last-of-type {
  border-bottom: none;
  margin-bottom: 14px;
  padding-bottom: 0;
}

.section-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.section-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-label-row .section-label {
  margin-bottom: 0;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.field-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.field-label-sm {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.req {
  color: var(--risk-high-bar);
}

.field-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Inputs */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-height: 44px;
}

.input-wrap.sm {
  min-height: 40px;
}

.input-wrap:focus-within {
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(13, 124, 123, 0.14);
}

.input-wrap.has-error {
  border-color: var(--risk-high-bar);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.input-wrap input {
  width: 100%;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  padding: 9px 8px 9px 12px;
  font-size: 16px;
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.input-wrap.sm input {
  font-size: 15px;
  padding: 7px 6px 7px 10px;
}

.input-unit {
  padding: 0 10px 0 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Derived Non-HDL strip */
.derived-strip {
  margin-top: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--teal-50);
  border: 1px solid #ccfbf1;
  font-size: 13px;
  color: var(--teal-700);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-variant-numeric: tabular-nums;
}

/* Segmented Controls */
.segmented-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-helper);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 3px;
  min-height: 44px;
  gap: 3px;
}

.segmented-control.sm {
  min-height: 38px;
  min-width: 124px;
}

.seg-btn {
  border: none;
  background: transparent;
  border-radius: 6px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 6px 10px;
}

.seg-btn.active {
  background: var(--navy-800);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(18, 52, 86, 0.25);
}

/* Unit Toggle */
.unit-toggle {
  display: inline-flex;
  background: var(--bg-helper);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.unit-btn {
  border: none;
  background: transparent;
  padding: 5px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.unit-toggle.sm .unit-btn {
  padding: 4px 8px;
  font-size: 12px;
}

.unit-btn.active {
  background: #ffffff;
  color: var(--navy-800);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.12);
}

/* Inline Collapsible Helpers (BMI & eGFR) */
.label-with-helper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.label-with-helper .field-label {
  margin-bottom: 0;
}

.helper-toggle {
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  color: var(--navy-700);
  border-radius: 999px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: background-color 0.15s ease;
}

.helper-toggle:hover {
  background: #e0f2fe;
}

.helper-toggle[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.chevron {
  display: inline-block;
  transition: transform 0.18s ease;
}

.helper-panel {
  margin-top: 10px;
  padding: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-left: 3px solid var(--teal-600);
  border-radius: var(--radius-sm);
}

.helper-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.helper-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 8px;
}

.helper-title-row .helper-title {
  margin-bottom: 0;
}

.helper-result {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--teal-700);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Risk Factors Toggle Grid */
.toggle-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toggle-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
}

.toggle-label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Optional Biomarkers */
.optional-block {
  background: #f8fafc;
  margin: 0 -16px 14px;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
}

.optional-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--teal-700);
  background: var(--teal-50);
  border: 1px solid #99f6e4;
  padding: 2px 8px;
  border-radius: 999px;
}

.optional-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Validation Alert Box */
.validation-box {
  background: var(--risk-high-bg);
  border: 1px solid var(--risk-high-border);
  color: var(--risk-high-fg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  margin-bottom: 14px;
}

.validation-box ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

.validation-box li {
  margin: 2px 0;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-outline-teal {
  font-family: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  text-decoration: none;
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:active,
.btn-secondary:active,
.btn-outline-teal:active {
  transform: scale(0.985);
}

.btn-primary {
  background: linear-gradient(135deg, var(--navy-800) 0%, #155373 100%);
  color: #ffffff;
  border: none;
  min-height: 48px;
  padding: 11px 18px;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(18, 52, 86, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--navy-900) 0%, var(--navy-800) 100%);
}

.btn-calculate {
  width: 100%;
  font-size: 16.5px;
  letter-spacing: 0.02em;
}

.btn-secondary {
  background: #ffffff;
  color: var(--navy-800);
  border: 1.5px solid var(--navy-800);
  min-height: 46px;
  padding: 10px 14px;
  font-size: 15px;
}

.btn-secondary:hover {
  background: #f1f5f9;
}

.btn-ghost {
  background: var(--bg-helper);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.btn-ghost:hover {
  background: #e2e8f0;
  color: var(--text-primary);
}

.btn-xs {
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 6px;
}

.btn-outline-teal {
  background: #ffffff;
  color: var(--teal-700);
  border: 1.5px solid var(--teal-600);
  padding: 9px 14px;
  font-size: 14px;
  min-height: 40px;
}

.btn-outline-teal:hover {
  background: var(--teal-50);
}

/* ==========================================================================
   Result Section
   ========================================================================== */
.result-section {
  animation: fadeSlideUp 0.28s ease-out;
}

@keyframes fadeSlideUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-hero-card {
  border-top: 4px solid var(--navy-800);
}

.result-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.model-badge {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy-800);
  background: #e8f1f8;
  border: 1px solid #cbdceb;
  padding: 4px 10px;
  border-radius: 999px;
}

.patient-chip {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-helper);
  padding: 4px 10px;
  border-radius: 999px;
}

.hero-metric {
  text-align: center;
  padding: 8px 4px 12px;
}

.hero-label {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.hero-value-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 6px 0;
  flex-wrap: wrap;
}

.hero-percent {
  font-size: 46px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--navy-800);
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  border: 1px solid transparent;
}

.tier-low {
  color: var(--risk-low-fg);
  background: var(--risk-low-bg);
  border-color: var(--risk-low-border);
}

.tier-borderline {
  color: var(--risk-borderline-fg);
  background: var(--risk-borderline-bg);
  border-color: var(--risk-borderline-border);
}

.tier-intermediate {
  color: var(--risk-intermediate-fg);
  background: var(--risk-intermediate-bg);
  border-color: var(--risk-intermediate-border);
}

.tier-high {
  color: var(--risk-high-fg);
  background: var(--risk-high-bg);
  border-color: var(--risk-high-border);
}

.hero-subcaption {
  font-size: 13px;
  color: var(--text-muted);
}

/* Horizontal Risk Gauge */
.risk-gauge {
  margin: 14px 0 18px;
  padding: 4px 2px 18px;
}

.gauge-pointer-track {
  position: relative;
  height: 16px;
  margin-bottom: 3px;
}

.gauge-pointer {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  transition: left 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.gauge-pointer-dot {
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid var(--navy-900);
}

.gauge-bar {
  display: flex;
  height: 24px;
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.12);
}

.gauge-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
}

.seg-low { background: var(--risk-low-bar); }
.seg-borderline { background: var(--risk-borderline-bar); }
.seg-intermediate { background: var(--risk-intermediate-bar); }
.seg-high { background: var(--risk-high-bar); }

.gauge-ticks {
  position: relative;
  height: 18px;
  margin-top: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.gauge-ticks span {
  position: absolute;
  transform: translateX(-50%);
}

.gauge-ticks span:first-child {
  transform: none;
}

.gauge-ticks span.tick-end {
  transform: translateX(-100%);
}

/* Optional Impact Banner */
.impact-banner {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-left: 4px solid var(--navy-700);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin-bottom: 16px;
}

.impact-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 4px;
}

.impact-body {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

/* Outcome Grids */
.outcome-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
}

.outcome-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy-800);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.outcome-age-tag {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-helper);
  padding: 2px 8px;
  border-radius: 999px;
}

.outcome-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.outcome-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 8px;
  text-align: center;
}

.outcome-box.highlight {
  background: #f0f7ff;
  border-color: #bfdbfe;
}

.outcome-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.outcome-en {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.outcome-val {
  margin-top: 6px;
  font-size: 21px;
  font-weight: 800;
  color: var(--navy-800);
  font-variant-numeric: tabular-nums;
}

.age-note-box {
  background: var(--bg-subtle);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Clinical Interpretation Card */
.clinical-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.guideline-tag {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--teal-700);
  background: var(--teal-50);
  border: 1px solid #99f6e4;
  padding: 3px 8px;
  border-radius: 999px;
}

.ldl-target-box {
  background: linear-gradient(135deg, #f0f7ff 0%, #f0fdfa 100%);
  border: 1px solid #cce3f6;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 14px;
}

.ldl-target-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.ldl-target-value {
  margin-top: 4px;
  font-size: 16px;
  font-weight: 700;
  color: var(--navy-800);
  font-variant-numeric: tabular-nums;
}

.clinical-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-primary);
  font-size: 14.5px;
  line-height: 1.6;
}

.clinical-list li {
  margin-bottom: 8px;
}

.clinical-list li:last-child {
  margin-bottom: 0;
}

/* Action Buttons Bar */
.action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

/* WeChat Official Account CTA Card */
.wechat-cta-card {
  background: linear-gradient(135deg, #ffffff 0%, #f2f9f8 100%);
  border: 1px solid #cce6e4;
}

.wechat-cta-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.wechat-info {
  flex: 1;
  min-width: 0;
}

.wechat-kicker {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-700);
  letter-spacing: 0.04em;
}

.wechat-name {
  margin: 2px 0 6px;
  font-size: 20px;
  font-weight: 800;
  color: var(--navy-800);
}

.wechat-desc {
  margin: 0 0 12px;
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.wechat-qr-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
}

.qr-frame {
  width: 120px;
  height: 120px;
  border-radius: 12px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.06);
}

.qr-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.qr-fallback {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 3px;
}

.qr-fallback-title {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--navy-800);
}

.qr-fallback-hint {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.25;
}

.qr-caption {
  margin-top: 6px;
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Footer */
.site-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 4px 16px 28px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
}

.site-footer p {
  margin: 4px 0;
}

.footer-brand {
  font-weight: 600;
  color: var(--navy-800);
  margin-top: 8px !important;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-sheet {
  background: #ffffff;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  margin: 0;
  font-size: 16px;
  color: var(--navy-800);
}

.modal-close {
  border: none;
  background: var(--bg-helper);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
}

.modal-tip {
  background: var(--teal-50);
  color: var(--teal-700);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
  border-bottom: 1px solid #ccfbf1;
}

.modal-preview-wrap {
  padding: 12px;
  overflow-y: auto;
  background: #e2e8f0;
  text-align: center;
  flex: 1;
}

.modal-preview-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.16);
  display: block;
  margin: 0 auto;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  z-index: 1200;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.25);
  max-width: 90vw;
  text-align: center;
  animation: toastIn 0.2s ease-out;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translate(-50%, 10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

/* Responsive adjustments */
@media (max-width: 420px) {
  .site-header h1 {
    font-size: 18.5px;
  }

  .card {
    padding: 16px 13px;
  }

  .optional-block {
    margin: 0 -13px 14px;
    padding: 14px 13px 16px;
  }

  .field-grid.two-col {
    grid-template-columns: 1fr;
  }

  .action-bar {
    grid-template-columns: 1fr;
  }

  .wechat-cta-body {
    flex-direction: column;
    text-align: center;
  }

  .outcome-val {
    font-size: 19px;
  }

  .hero-percent {
    font-size: 42px;
  }
}

@media (min-width: 680px) {
  .site-header {
    padding: 24px 20px 26px;
  }

  .site-header h1 {
    font-size: 23px;
  }

  .main-content {
    padding: 22px 16px 32px;
  }

  .card {
    padding: 22px 22px;
  }

  .optional-block {
    margin: 0 -22px 16px;
    padding: 16px 22px 18px;
  }
}
