/**
 * pay-main.css —— 分钱机制诊断
 * 移动端优先。配色：深青（临床感，对应「体检/问诊」的定位）
 */

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

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

body {
  font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: #F8FAFC;
  color: #1E293B;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app-container {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: #ffffff;
  position: relative;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
}

/* ========== 页面区域 ========== */
.page-section {
  display: none;
  min-height: 100vh;
  padding: 20px 20px 40px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.page-section.active { opacity: 1; transform: translateY(0); }
#page-welcome { display: block; }

/* ========== 进度条 ========== */
#progress-container {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffff;
  padding: 12px 20px 8px;
  border-bottom: 1px solid #F1F5F9;
}
#progress-bar {
  height: 6px;
  background: linear-gradient(90deg, #0F766E, #14B8A6);
  border-radius: 3px;
  width: 0%;
  transition: width 0.4s ease;
}
.progress-text {
  display: block;
  font-size: 11px;
  color: #64748B;
  margin-top: 4px;
  text-align: right;
}

/* ========== 欢迎页 ========== */
.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  text-align: center;
  padding: 40px 0;
}
.welcome-hero .icon {
  width: 80px; height: 80px;
  background: linear-gradient(135deg, #0F766E, #14B8A6);
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; color: #fff;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(15, 118, 110, 0.25);
}
.welcome-flow {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; font-size: 12px; color: #94A3B8; margin-bottom: 40px;
}
.welcome-flow span.line { width: 56px; height: 1px; background: #E2E8F0; }

/* ========== 按钮 ========== */
.btn-primary {
  display: inline-block;
  padding: 14px 32px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #0F766E, #0D9488);
  color: #ffffff;
  font-size: 16px; font-weight: 700;
  cursor: pointer; width: 100%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 4px 12px rgba(15, 118, 110, 0.25);
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
}
.btn-primary:active { transform: scale(0.97); box-shadow: 0 2px 6px rgba(15,118,110,0.2); }
.btn-primary:disabled { background: #94A3B8; box-shadow: none; cursor: not-allowed; }

.btn-ghost {
  display: inline-block;
  padding: 12px 20px;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  background: #fff;
  color: #475569;
  font-size: 15px; font-weight: 600;
  cursor: pointer; width: 100%;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
}
.btn-ghost:active { transform: scale(0.98); }

.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row > * { flex: 1; }

/* ========== 选项卡 ========== */
.option-card {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  background: #ffffff;
  margin-bottom: 10px;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
.option-card:active { transform: scale(0.99); }
.option-card.selected {
  border-color: #0F766E;
  background: #F0FDFA;
  box-shadow: 0 0 0 1px #0F766E;
}
.option-card .opt-main { flex: 1; }
.option-card .opt-title { font-size: 15px; font-weight: 600; color: #1E293B; }
.option-card .opt-hint { font-size: 12px; color: #94A3B8; margin-top: 2px; }
.option-card .opt-check {
  width: 22px; height: 22px; flex-shrink: 0;
  border: 2px solid #CBD5E1; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent;
  transition: all 0.2s ease;
}
.option-card.selected .opt-check {
  background: #0F766E; border-color: #0F766E; color: #fff;
}

/* ========== 团队选择 ========== */
.team-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.team-card {
  padding: 18px 12px;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  text-align: center;
  cursor: pointer;
  background: #fff;
  transition: all 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none; -webkit-user-select: none;
}
.team-card:active { transform: scale(0.97); }
.team-card.selected {
  border-color: #0F766E;
  background: #F0FDFA;
  box-shadow: 0 0 0 1px #0F766E;
}
.team-card .t-icon { font-size: 26px; display: block; margin-bottom: 6px; }
.team-card .t-name { font-size: 13.5px; font-weight: 700; color: #334155; line-height: 1.4; display: block; }
.team-card .t-desc { font-size: 11px; color: #94A3B8; line-height: 1.4; display: block; margin-top: 3px; }
.team-card.selected .t-desc { color: #0F766E; opacity: 0.75; }

/* ========== 症状卡（三态） ========== */
.symptom-card {
  padding: 14px 16px;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  background: #fff;
  margin-bottom: 10px;
  transition: all 0.2s ease;
}
.symptom-card.on { border-color: #0F766E; background: #F0FDFA; }
.symptom-text {
  font-size: 14.5px;
  color: #1E293B;
  line-height: 1.5;
  margin-bottom: 10px;
}
.sev-row { display: flex; gap: 6px; }
.sev-btn {
  flex: 1;
  padding: 9px 4px;
  border: 1.5px solid #E2E8F0;
  border-radius: 10px;
  background: #fff;
  font-size: 12.5px;
  color: #64748B;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.sev-btn:active { transform: scale(0.96); }
.sev-btn[data-sev="1"].on { border-color: #F59E0B; background: #FFFBEB; color: #B45309; font-weight: 700; }
.sev-btn[data-sev="2"].on { border-color: #DC2626; background: #FEF2F2; color: #B91C1C; font-weight: 700; }
.sym-sub {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #E2E8F0;
  display: none;
}
.sym-sub.show { display: block; }
.sym-sub .sub-label { font-size: 12px; color: #94A3B8; margin-bottom: 6px; }
.sym-sub .dur-row { display: flex; gap: 6px; }
.dur-btn {
  flex: 1; padding: 7px 4px;
  border: 1.5px solid #E2E8F0; border-radius: 9px;
  background: #fff; font-size: 12px; color: #64748B;
  cursor: pointer; font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}
.dur-btn.on { border-color: #0F766E; background: #F0FDFA; color: #0F766E; font-weight: 700; }

/* ========== 通用标题 ========== */
.h-sec { font-size: 20px; font-weight: 800; color: #0F172A; line-height: 1.35; margin-bottom: 8px; }
.p-sec { font-size: 13.5px; color: #64748B; line-height: 1.6; margin-bottom: 20px; }

.note-box {
  background: #F8FAFC;
  border-left: 3px solid #CBD5E1;
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
  font-size: 12.5px;
  color: #64748B;
  line-height: 1.6;
  margin-bottom: 18px;
}
.note-box.warn { background: #FFFBEB; border-left-color: #F59E0B; color: #92400E; }

/* ========== 结果页 · 病因链 ========== */
.chain-card {
  border: 1px solid #E2E8F0;
  border-radius: 16px;
  padding: 18px;
  margin-bottom: 14px;
  background: #fff;
}
.chain-card.rank-1 { border-color: #0F766E; box-shadow: 0 4px 18px rgba(15,118,110,0.10); }
.chain-rank {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  margin-bottom: 12px;
  letter-spacing: 0.5px;
}
.rank-1 .chain-rank { background: #0F766E; color: #fff; }
.rank-2 .chain-rank { background: #E2E8F0; color: #475569; }
.rank-3 .chain-rank { background: #F1F5F9; color: #94A3B8; }

.chain-flow { margin-bottom: 14px; }
.chain-node {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 9px 0;
}
.chain-node .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #CBD5E1; flex-shrink: 0; margin-top: 8px;
}
.chain-node.root .dot { background: #0F766E; }
.chain-node.derived .dot { background: #F59E0B; }
.chain-node .n-label {
  font-size: 10.5px; color: #94A3B8; letter-spacing: 0.5px; display: block; margin-bottom: 1px;
}
.chain-node .n-name { font-size: 15px; font-weight: 700; color: #0F172A; }
.chain-node .n-plain { font-size: 12.5px; color: #64748B; margin-top: 2px; line-height: 1.5; }
.chain-arrow { font-size: 12px; color: #CBD5E1; padding-left: 3px; }

.chain-evidence {
  background: #F8FAFC;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}
.chain-evidence .ev-label { font-size: 11px; color: #94A3B8; margin-bottom: 6px; }
.chain-evidence ul { list-style: none; }
.chain-evidence li {
  font-size: 13px; color: #334155; line-height: 1.55;
  padding-left: 14px; position: relative; margin-bottom: 4px;
}
.chain-evidence li::before {
  content: '·'; position: absolute; left: 4px; color: #0F766E; font-weight: 700;
}

/* 症状级排除条件（只跟他勾的那条症状有关，不放大到病因层） */
.sym-exclude {
  margin-top: 4px;
  padding: 6px 9px;
  background: #FFFFFF;
  border-left: 2px solid #CBD5E1;
  border-radius: 0 6px 6px 0;
  font-size: 11.5px;
  color: #64748B;
  line-height: 1.55;
}

/* 通用判断 */
.principle-card {
  background: #F8FAFC;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 14px;
}
.principle-card ul { list-style: none; }
.principle-card li {
  font-size: 13.5px;
  color: #334155;
  line-height: 1.7;
  padding-left: 34px;
  position: relative;
  margin-bottom: 12px;
}
.principle-card li:last-child { margin-bottom: 0; }
.principle-card .p-id {
  position: absolute; left: 0; top: 1px;
  font-size: 10px; font-weight: 700;
  background: #0F766E; color: #fff;
  padding: 1px 6px; border-radius: 5px;
  letter-spacing: 0.3px;
}

.chain-block { margin-bottom: 12px; }
.chain-block:last-child { margin-bottom: 0; }
.chain-block .b-label {
  font-size: 11px; color: #94A3B8; letter-spacing: 0.5px; margin-bottom: 4px;
}
.chain-block .b-body { font-size: 13.5px; color: #334155; line-height: 1.6; }
.knob-pill {
  display: inline-block;
  background: #F0FDFA; border: 1px solid #99F6E4;
  color: #0F766E; font-size: 12.5px; font-weight: 700;
  padding: 3px 10px; border-radius: 20px; margin-bottom: 6px;
}

/* ========== 鉴别诊断 ========== */
.excl-item {
  border-left: 2px solid #E2E8F0;
  padding-left: 10px;
  margin-bottom: 10px;
}
.excl-item:last-child { margin-bottom: 0; }
.excl-alt {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  margin-bottom: 3px;
}
.excl-how {
  font-size: 12.5px;
  color: #64748B;
  line-height: 1.6;
}

/* ========== 初步结论卡 ========== */
.script-card {
  background: #ffffff;
  border: 1px solid #E2E8F0;
  border-left: 4px solid #0F766E;
  border-radius: 6px 16px 16px 6px;
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: 0 2px 14px rgba(15, 118, 110, 0.07);
}
.script-card .sc-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; letter-spacing: 0.8px; font-weight: 700;
  color: #0F766E; margin-bottom: 12px;
}
.script-card .sc-label::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #0F766E; flex-shrink: 0;
}
.script-card .sc-body {
  font-size: 15px; line-height: 1.9;
  color: #1E293B; margin-bottom: 16px;
}
.script-card .sc-body b { color: #0F766E; font-weight: 700; }
.sc-copy {
  display: block; width: 100%;
  padding: 12px;
  border: none; border-radius: 12px;
  background: #0F766E;
  color: #fff; font-size: 14px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.sc-copy:active { background: #115E59; }

/* ========== 保存结果卡 ========== */
.capture-card {
  border: 2px dashed #99F6E4;
  border-radius: 16px;
  padding: 18px;
  background: #F0FDFA;
  margin-bottom: 14px;
}
.capture-card .cap-title { font-size: 15px; font-weight: 700; color: #0F766E; margin-bottom: 6px; }
.capture-card .cap-desc { font-size: 12.5px; color: #0F766E; opacity: 0.85; line-height: 1.6; margin-bottom: 12px; }
.cap-link {
  background: #ffffff;
  border: 1px solid #99F6E4;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 11.5px;
  color: #64748B;
  word-break: break-all;
  line-height: 1.5;
  margin-bottom: 10px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  max-height: 56px;
  overflow: hidden;
}
.capture-card .cap-note {
  font-size: 11px; color: #0F766E; opacity: 0.7;
  text-align: center; margin-top: 10px;
}

/* ========== L2 入口 ========== */
.l2-card {
  background: linear-gradient(135deg, #0F766E, #115E59);
  border-radius: 16px;
  padding: 22px 20px 20px;
  text-align: center;
  color: #ffffff;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.l2-card::before {
  content: '';
  position: absolute; top: -24px; right: -24px;
  width: 96px; height: 96px;
  background: rgba(255,255,255,0.06);
  border-radius: 50%;
}
.l2-card .l2-hint {
  font-size: 13px; color: rgba(255,255,255,0.75);
  margin-bottom: 8px; letter-spacing: 0.5px;
}
.l2-card .l2-title {
  font-size: 18px; font-weight: 800; color: #fff;
  margin-bottom: 12px; line-height: 1.4;
}
.l2-card .l2-feats {
  display: flex; flex-wrap: wrap;
  justify-content: center; align-items: center;
  gap: 3px 7px;
  font-size: 11.5px; color: rgba(255,255,255,0.7);
  margin-bottom: 18px;
}
.l2-card .l2-btn {
  display: block; width: 100%;
  padding: 14px 20px;
  border: none; border-radius: 14px;
  background: #ffffff; color: #0F766E;
  font-size: 16px; font-weight: 700;
  cursor: pointer; font-family: inherit;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.15s ease;
}
.l2-card .l2-btn:active { transform: scale(0.97); }
.l2-card .l2-price {
  font-size: 26px; font-weight: 800; color: #fff;
  margin: 12px 0 0; letter-spacing: 1px;
}
.l2-card .l2-note {
  font-size: 11px; color: rgba(255,255,255,0.6);
  margin-top: 8px;
}

/* ========== 边界说明 ========== */
.boundary-card {
  background: #F8FAFC;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}
.boundary-card .bd-title {
  font-size: 12px; font-weight: 700; color: #64748B;
  letter-spacing: 0.5px; margin-bottom: 10px;
}
.boundary-card ul { list-style: none; }
.boundary-card li {
  font-size: 12px; color: #64748B; line-height: 1.65;
  padding-left: 14px; position: relative; margin-bottom: 7px;
}
.boundary-card li::before {
  content: '—'; position: absolute; left: 0; color: #CBD5E1;
}

/* ========== 预警清单（预测模式） ========== */
.warn-list { list-style: none; }
.warn-list li {
  font-size: 13.5px; color: #334155; line-height: 1.55;
  padding: 10px 12px 10px 32px;
  background: #FFFBEB;
  border-radius: 10px;
  margin-bottom: 8px;
  position: relative;
}
.warn-list li::before {
  content: '⚠'; position: absolute; left: 11px; top: 10px; font-size: 12px; color: #F59E0B;
}

/* ========== 空状态 / 提示 ========== */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}
.empty-state .e-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state .e-title { font-size: 17px; font-weight: 700; color: #0F172A; margin-bottom: 8px; }
.empty-state .e-desc { font-size: 13.5px; color: #64748B; line-height: 1.65; }

/* ========== 底部 ========== */
.footer-note {
  font-size: 11.5px;
  color: #CBD5E1;
  text-align: center;
  margin-top: 24px;
  line-height: 1.7;
}

/* ========== 加载 ========== */
.loading-content {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 80vh; text-align: center;
}
.loading-spinner {
  width: 48px; height: 48px;
  border: 4px solid #E2E8F0; border-top-color: #0F766E;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading-text { font-size: 14px; color: #64748B; }

/* ========== 动画 ========== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-fade-in-up { animation: fadeInUp 0.4s ease forwards; }

/* ========== 移动端 ========== */
@media (max-width: 480px) {
  .app-container { box-shadow: none; }
  .page-section { padding: 16px 16px 32px; }
}
