/* ==========================================================================
   房颤抗凝决策器（2024 ESC CHA₂DS₂-VA / CHA₂DS₂-VASc + HAS-BLED + NOACs）
   公众号「心灵维修工」 · 统一医学深蓝/青绿移动优先临床视觉体系
   ========================================================================== */

: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;

  /* Clinical Status Tokens */
  --green-fg: #15803d;
  --green-bg: #dcfce7;
  --green-border: #bbf7d0;
  --green-accent: #16a34a;

  --amber-fg: #b45309;
  --amber-bg: #fef3c7;
  --amber-border: #fde68a;
  --amber-accent: #d97706;

  --orange-fg: #c2410c;
  --orange-bg: #ffedd5;
  --orange-border: #fed7aa;
  --orange-accent: #ea580c;

  --red-fg: #b91c1c;
  --red-bg: #fee2e2;
  --red-border: #fecaca;
  --red-accent: #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 {
  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: 660px;
  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: 19.5px;
  font-weight: 700;
  line-height: 1.25;
}

.header-subtitle {
  margin: 8px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.84);
  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: 660px;
  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: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.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-wrap: wrap;
}

/* Valvular AF Top Safety Gate */
.safety-gate-card {
  border: 1.5px solid #fecaca;
  background: linear-gradient(135deg, #fffafa 0%, #fff5f5 100%);
  padding: 14px 16px;
}

.safety-gate-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.safety-gate-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  color: var(--red-fg);
}

.safety-gate-sub {
  margin: 6px 0 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.valvular-alert-banner {
  margin-top: 12px;
  background: #fef2f2;
  border: 1.5px solid #ef4444;
  border-left: 5px solid #b91c1c;
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  color: #7f1d1d;
  font-size: 13.5px;
  line-height: 1.55;
}

.valvular-alert-banner strong {
  display: block;
  font-size: 14.5px;
  margin-bottom: 4px;
  color: #991b1b;
}

/* Form Sections */
.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: 10px;
  flex-wrap: wrap;
}

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

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

.live-score-pill {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: #e8f1f8;
  color: var(--navy-800);
  font-variant-numeric: tabular-nums;
}

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

.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: 5px;
}

.req {
  color: var(--red-accent);
}

.opt-tag {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-muted);
}

.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: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(--red-accent);
  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-unit {
  padding: 0 10px 0 4px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* Segmented Controls & Unit Toggle */
.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;
}

.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 {
  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;
}

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

/* Live CrCl Strip */
.crcl-strip {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--teal-50);
  border: 1px solid #99f6e4;
  color: var(--teal-700);
}

.crcl-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.crcl-val {
  font-size: 17px;
  font-weight: 800;
  color: var(--navy-800);
  font-variant-numeric: tabular-nums;
}

.crcl-note {
  margin-top: 4px;
  font-size: 12px;
  color: var(--teal-700);
  line-height: 1.4;
}

/* Tap Chips with Point Badges */
.chip-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.tap-chip {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px 10px;
  background: var(--bg-subtle);
  border: 1.5px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  transition: all 0.15s ease;
  min-height: 44px;
}

.tap-chip:hover {
  border-color: #94a3b8;
}

.tap-chip input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip-check {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 1.5px solid #94a3b8;
  background: #ffffff;
  flex-shrink: 0;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chip-check::after {
  content: "";
  width: 9px;
  height: 5px;
  border-left: 2px solid #ffffff;
  border-bottom: 2px solid #ffffff;
  transform: rotate(-45deg) translate(1px, -1px);
  opacity: 0;
}

.tap-chip.checked {
  background: #f0f9ff;
  border-color: var(--navy-700);
}

.tap-chip.checked .chip-check {
  background: var(--navy-800);
  border-color: var(--navy-800);
}

.tap-chip.checked .chip-check::after {
  opacity: 1;
}

.tap-chip.auto-synced {
  background: #f0fdfa;
  border-color: #5eead4;
}

.tap-chip.auto-synced .chip-check {
  background: var(--teal-700);
  border-color: var(--teal-700);
}

.tap-chip.auto-synced .chip-check::after {
  opacity: 1;
}

.tap-chip.danger-chip.checked {
  background: #fff1f2;
  border-color: var(--red-accent);
}

.tap-chip.danger-chip.checked .chip-check {
  background: var(--red-accent);
  border-color: var(--red-accent);
}

.chip-body {
  flex: 1;
  min-width: 0;
}

.chip-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.chip-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.35;
}

.pt-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  background: #e2e8f0;
  color: var(--navy-800);
  flex-shrink: 0;
}

.tap-chip.checked .pt-badge,
.tap-chip.auto-synced .pt-badge {
  background: var(--navy-800);
  color: #ffffff;
}

.chip-sub {
  display: block;
  font-size: 11.5px;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: 2px;
}

.sync-note {
  font-size: 12px;
  color: var(--teal-700);
  margin-bottom: 8px;
}

/* Validation Box */
.validation-box {
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  color: var(--red-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;
}

/* 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;
}

.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;
}

.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 Dashboard
   ========================================================================== */
.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);
}

/* 3-Metric Score Strip */
.score-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.score-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 11px 8px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.score-card-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1.25;
}

.score-card-sub {
  font-size: 10.5px;
  color: var(--text-muted);
}

.score-card-val {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.1;
  color: var(--navy-800);
  font-variant-numeric: tabular-nums;
}

.score-pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
}

.pill-green { background: var(--green-bg); color: var(--green-fg); }
.pill-amber { background: var(--amber-bg); color: var(--amber-fg); }
.pill-orange { background: var(--orange-bg); color: var(--orange-fg); }
.pill-red { background: var(--red-bg); color: var(--red-fg); }

.score-annual {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Recommendation Box */
.oac-rec-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--navy-800);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-primary);
  line-height: 1.55;
}

.oac-rec-box.danger {
  background: #fef2f2;
  border-color: #fecaca;
  border-left-color: var(--red-accent);
  color: #7f1d1d;
}

.oac-rec-box strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14.5px;
}

/* HAS-BLED Modifiable Factors Box */
.hasbled-banner {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-left: 4px solid var(--amber-accent);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  margin-bottom: 12px;
  font-size: 13.5px;
  color: #78350f;
  line-height: 1.5;
}

.hasbled-banner strong {
  display: block;
  margin-bottom: 4px;
  color: #92400e;
}

.hasbled-banner ul {
  margin: 4px 0 0;
  padding-left: 18px;
}

/* 4-NOAC Dose Cards Grid */
.noac-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.crcl-badge {
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-700);
  background: var(--teal-50);
  border: 1px solid #99f6e4;
  padding: 3px 9px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}

.noac-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.noac-card {
  border-radius: var(--radius-md);
  border: 1.5px solid var(--border-subtle);
  background: #ffffff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.noac-card.status-standard {
  border-color: var(--green-border);
  border-top: 4px solid var(--green-accent);
}

.noac-card.status-reduced {
  border-color: var(--amber-border);
  border-top: 4px solid var(--amber-accent);
}

.noac-card.status-caution {
  border-color: var(--orange-border);
  border-top: 4px solid var(--orange-accent);
}

.noac-card.status-contraindicated {
  border-color: var(--red-border);
  border-top: 4px solid var(--red-accent);
  background: #fffafa;
}

.noac-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.noac-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-800);
}

.noac-en {
  font-size: 11px;
  color: var(--text-muted);
}

.noac-status-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.status-standard .noac-status-tag { background: var(--green-bg); color: var(--green-fg); }
.status-reduced .noac-status-tag { background: var(--amber-bg); color: var(--amber-fg); }
.status-caution .noac-status-tag { background: var(--orange-bg); color: var(--orange-fg); }
.status-contraindicated .noac-status-tag { background: var(--red-bg); color: var(--red-fg); }

.noac-dose {
  font-size: 20px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.status-contraindicated .noac-dose {
  color: var(--red-fg);
}

.noac-rationale {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
}

.noac-pearl {
  font-size: 11.5px;
  color: var(--teal-700);
  background: var(--teal-50);
  border-radius: 6px;
  padding: 5px 7px;
  line-height: 1.4;
  margin-top: auto;
}

.followup-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* Action 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);
}

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

/* Footer */
.site-footer {
  max-width: 660px;
  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 */
@media (max-width: 480px) {
  .site-header h1 {
    font-size: 18px;
  }

  .card {
    padding: 16px 13px;
  }

  .field-grid.two-col,
  .chip-grid,
  .noac-grid,
  .action-bar {
    grid-template-columns: 1fr;
  }

  .score-card-val {
    font-size: 24px;
  }

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

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

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

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

  .card {
    padding: 22px 22px;
  }
}
