/* ============================================================
   Cobb Angels · 一脊一竹 · App Styles
   Brand palette: bamboo green #2DB146, near-black #1A1A1A
   ============================================================ */

:root {
  --bamboo: #2DB146;
  --bamboo-dark: #208a35;
  --bamboo-soft: #e6f5ea;
  --bamboo-faint: #f4fbf6;
  --accent: #1A1A1A;
  --text: #1A1A1A;
  --text-mute: #5b6470;
  --text-faint: #8e98a3;
  --bg: #ffffff;
  --bg-soft: #f7f9f8;
  --border: #e6e9e7;
  --danger: #e0383e;
  --warn: #e58a1c;
  --safe: #2DB146;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 8px 24px rgba(0,0,0,0.08);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; overflow: hidden; }
body { overscroll-behavior: none; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
input, select { font: inherit; }
ol, ul { margin: 0; padding: 0; list-style: none; }

/* ============ 页面切换 ============ */
.page {
  position: fixed; inset: 0;
  display: none; flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
.page.active { display: flex; }

/* ============ 顶栏 ============ */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: calc(var(--safe-top) + 12px) calc(16px + var(--safe-right)) 12px calc(16px + var(--safe-left));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  min-height: 56px;
  position: relative;
  z-index: 10;
}
.topbar .brand-img { width: 22px; height: 48px; object-fit: contain; flex: 0 0 auto; }
.topbar .brand-text { line-height: 1.15; flex: 1; }
.topbar .brand-text strong { display: block; font-size: 15px; color: var(--accent); }
.topbar .brand-text span { font-size: 11px; color: var(--text-mute); letter-spacing: 0.5px; }
.topbar h1 { margin: 0; font-size: 17px; font-weight: 600; flex: 1; text-align: center; color: var(--accent); }
.topbar.topbar-page { justify-content: space-between; }
.icon-btn { width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: var(--accent); }
.icon-btn:hover, .icon-btn:active { background: var(--bg-soft); }

/* Globe-icon language switcher + popup in home topbar */
.lang-wrap { position: relative; flex: 0 0 auto; }
.lang-globe { color: var(--bamboo-dark); }
.lang-popup {
  position: absolute;
  top: 100%;
  inset-inline-end: 0;
  margin-top: 6px;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  padding: 6px;
  z-index: 100;
  display: flex; flex-direction: column;
}
.lang-popup[hidden] { display: none; }
.lang-opt {
  padding: 9px 12px;
  text-align: start;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  border: 0;
  transition: background .12s ease;
  white-space: nowrap;
}
.lang-opt:hover { background: var(--bg-soft); }
.lang-opt.active {
  background: var(--bamboo-faint);
  color: var(--bamboo-dark);
  font-weight: 600;
}
.lang-opt.active::after {
  content: '✓';
  margin-inline-start: 8px;
  color: var(--bamboo);
}

/* Drag-over visual on photo slots */
.photo-slot.dragover {
  border-color: var(--bamboo);
  border-style: solid;
  background: var(--bamboo-soft);
  box-shadow: 0 0 0 3px rgba(45,177,70,0.2);
}
.photo-slot.dragover .slot-placeholder {
  color: var(--bamboo-dark);
  font-weight: 600;
}

/* ============ 启动屏 ============ */
.splash {
  background: linear-gradient(160deg, var(--bamboo-soft) 0%, #fff 60%);
  align-items: center; justify-content: center;
  padding: calc(var(--safe-top) + 24px) calc(var(--safe-right) + 24px) calc(var(--safe-bot) + 24px) calc(var(--safe-left) + 24px);
}
.splash-inner { text-align: center; padding: 0; animation: fadeUp .8s ease both; }
.splash-logo { width: 66px; height: 144px; margin: 0 auto 24px; object-fit: contain; }
.splash-title { margin: 0 0 8px; font-size: 32px; font-weight: 700; color: var(--accent); letter-spacing: 6px; }
.splash-sub { margin: 0 0 32px; color: var(--text-mute); font-size: 14px; letter-spacing: 1px; }
.splash-progress { width: 180px; height: 3px; margin: 0 auto 14px; background: rgba(45,177,70,0.15); border-radius: 3px; overflow: hidden; }
.splash-bar { width: 30%; height: 100%; background: var(--bamboo); border-radius: 3px; animation: splashBar 1.6s ease-in-out infinite; }
.splash-note { font-size: 12px; color: var(--text-faint); margin: 0; }
@keyframes splashBar {
  0% { transform: translateX(-100%); width: 30%; }
  50% { width: 60%; }
  100% { transform: translateX(380%); width: 30%; }
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ============ 主内容 ============ */
.page-main, .home-main {
  flex: 1;
  overflow-y: auto;
  padding: 20px calc(16px + var(--safe-right)) calc(20px + var(--safe-bot)) calc(16px + var(--safe-left));
  -webkit-overflow-scrolling: touch;
}

/* ============ 首页 ============ */
.hero { padding: 4px 0 16px; }
.hero h2 { margin: 0 0 10px; font-size: 26px; font-weight: 700; color: var(--accent); line-height: 1.25; }
.hero p { margin: 0; color: var(--text-mute); font-size: 14px; line-height: 1.6; }

/* Module / sub-project tag above the hero heading */
.hero-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.module-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--bamboo-dark);
  background: var(--bamboo-faint);
  border: 1px solid rgba(45,177,70,0.2);
  padding: 3px 10px 4px;
  border-radius: 999px;
  text-transform: none;
}
.module-tag.aim {
  color: #fff;
  background: var(--bamboo-dark);
  border-color: var(--bamboo-dark);
  letter-spacing: 1.5px;
}
.module-tag sup { font-size: 8px; vertical-align: super; margin-left: 1px; opacity: 0.85; }

.metrics-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin: 16px 0 22px;
}
.metric-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--bamboo-faint);
  color: var(--bamboo-dark);
  font-size: 12px;
  border: 1px solid rgba(45,177,70,0.15);
}
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--bamboo); }

.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 14px 18px;
  background: var(--bamboo);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  border-radius: 14px;
  box-shadow: 0 6px 14px rgba(45,177,70,0.28);
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
}
.cta:hover { background: var(--bamboo-dark); }
.cta:active { transform: scale(0.985); box-shadow: 0 3px 8px rgba(45,177,70,0.24); }
.cta:disabled { opacity: 0.45; box-shadow: none; cursor: not-allowed; }
.cta.secondary {
  background: #fff;
  color: var(--bamboo-dark);
  border: 1.5px solid var(--bamboo);
  box-shadow: none;
}
.cta.secondary:hover { background: var(--bamboo-faint); }
.cta.wide { margin-top: 12px; }
.cta.cta-stack { flex-wrap: wrap; row-gap: 0; padding: 12px 18px 13px; }
.cta.cta-stack .cta-main { flex: 0 1 auto; font-size: 16px; }
.cta.cta-stack .cta-sub { flex-basis: 100%; font-size: 11px; font-weight: 500; opacity: 0.85; letter-spacing: 0.6px; margin-top: -2px; }

.info-card {
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
}
.info-card.subtle { background: var(--bg-soft); border-color: transparent; }
.info-card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--accent); }
.info-card ol { padding-left: 0; counter-reset: step; }
.info-card ol li {
  position: relative;
  padding: 8px 0 8px 32px;
  font-size: 14px;
  color: var(--text);
  line-height: 1.55;
  counter-increment: step;
}
.info-card ol li::before {
  content: counter(step);
  position: absolute; left: 0; top: 8px;
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bamboo-soft); color: var(--bamboo-dark);
  border-radius: 50%; font-size: 12px; font-weight: 600;
}
.info-card p { margin: 0; font-size: 13px; line-height: 1.7; color: var(--text-mute); }
.info-card strong { color: var(--accent); }
.flow-list .flow-tip-link {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--bamboo-dark);
  border-bottom: 1px dashed var(--bamboo);
  padding-bottom: 1px;
  text-decoration: none;
  vertical-align: baseline;
}
.flow-list .flow-tip-link:active { opacity: 0.6; }

/* ===== 拍摄说明卡(合并版) ===== */
.info-card.shoot-tips { padding-bottom: 14px; }
.pose-combo { padding-top: 4px; }
.pose-illustration {
  display: block;
  width: 100%;
  height: auto;
  background: var(--bamboo-faint);
  border-radius: 14px;
  padding: 8px 4px;
  margin-bottom: 14px;
}

.combo-tips {
  padding-left: 0;
  margin: 0;
  list-style: none;
}
.combo-tips li {
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text);
  padding: 4px 0 4px 22px;
  position: relative;
}
.combo-tips li::before {
  content: '';
  position: absolute;
  left: 6px; top: 13px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--bamboo);
  box-shadow: 0 0 0 3px rgba(45,177,70,0.15);
}
.combo-tips li strong { color: var(--bamboo-dark); }

/* 拍摄说明 · 两段式编号列表 */
.shoot-sections {
  margin: 14px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.shoot-section {
  background: rgba(45,177,70,0.04);
  border: 1px solid rgba(45,177,70,0.18);
  border-radius: 12px;
  padding: 12px 14px 14px;
}
.shoot-section-title {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--bamboo-dark);
}
.shoot-section-list {
  counter-reset: shoot-item;
  list-style: none;
  padding-left: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.shoot-section-list li {
  counter-increment: shoot-item;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  padding-left: 32px;
  position: relative;
  min-height: 22px;
}
.shoot-section-list li::before {
  content: counter(shoot-item);
  position: absolute;
  left: 0; top: 0;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--bamboo);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.shoot-section-list li strong { color: var(--bamboo-dark); }

.pose-illustration.highlight {
  box-shadow: 0 0 0 3px rgba(45,177,70,0.4);
  animation: poseFlash 1.6s ease;
}
@keyframes poseFlash {
  0% { box-shadow: 0 0 0 5px rgba(45,177,70,0.55); }
  100% { box-shadow: 0 0 0 3px rgba(45,177,70,0.0); }
}
/* 高亮某一侧(直立 / 前屈) */
#pose-combo svg #combo-standing,
#pose-combo svg #combo-bend { transition: opacity .25s ease; }
#pose-combo.focus-standing #combo-bend,
#pose-combo.focus-bend #combo-standing { opacity: 0.35; }

.report-link {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 24px auto 0; padding: 12px 16px;
  font-size: 14px; font-weight: 600;
  color: var(--bamboo-dark);
  background: var(--bamboo-faint);
  border: 1px dashed rgba(45,177,70,0.35);
  border-radius: 12px;
  text-decoration: none;
  transition: background .15s ease, transform .15s ease;
}
.report-link:hover { background: var(--bamboo-soft); }
.report-link:active { transform: scale(0.985); }
.report-link-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bamboo); box-shadow: 0 0 0 4px rgba(45,177,70,0.18);
}

.foot { padding: 20px 0 10px; text-align: center; color: var(--text-faint); font-size: 11px; letter-spacing: 0.5px; line-height: 1.6; }
.foot sup { font-size: 7px; vertical-align: super; margin-left: 1px; }
.foot-icp { color: var(--text-faint); font-size: 10px; letter-spacing: 0.3px; opacity: 0.8; }

/* ============ 指引页 ============ */
.guide-figure {
  background: var(--bamboo-faint);
  border-radius: 16px;
  padding: 14px;
  display: flex; justify-content: center;
  margin-bottom: 12px;
}
.silhouette { width: 100px; height: auto; }

.block-title {
  margin: 18px 0 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.tip-list li {
  position: relative;
  padding: 10px 12px 10px 40px;
  margin-bottom: 8px;
  background: var(--bg-soft);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.tip-list .num {
  position: absolute; left: 12px; top: 11px;
  width: 20px; height: 20px;
  background: var(--bamboo); color: #fff;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}
.tip-list strong { color: var(--bamboo-dark); }

/* ============ 拍照页 ============ */
.capture-main { padding-bottom: calc(20px + var(--safe-bot)); }
.capture-step {
  padding: 12px 14px;
  background: var(--bamboo-faint);
  border-radius: 12px;
  margin-bottom: 16px;
}
.step-label { font-size: 13px; color: var(--bamboo-dark); font-weight: 600; }
.step-hint { font-size: 12px; color: var(--text-mute); margin-top: 4px; }

.photo-slots {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-bottom: 16px;
}
.photo-slot {
  border: 1.5px dashed var(--border);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg-soft);
  transition: border-color .2s ease;
}
.photo-slot.has-photo { border-style: solid; border-color: var(--bamboo); }
.photo-slot.active { border-color: var(--bamboo); background: var(--bamboo-faint); }
.slot-label {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-mute);
  border-bottom: 1px solid transparent;
}
.photo-slot.has-photo .slot-label { color: var(--bamboo-dark); font-weight: 600; }
.slot-img-wrap {
  aspect-ratio: 3/4;
  display: flex; align-items: center; justify-content: center;
  position: relative;
  overflow: hidden;
}
.slot-img-wrap img { width: 100%; height: 100%; object-fit: cover; }
.slot-placeholder {
  color: var(--text-faint); font-size: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
}
.slot-placeholder .slot-icon {
  color: var(--bamboo);
  opacity: 0.55;
}
.photo-slot.active .slot-placeholder .slot-icon { opacity: 1; }
.photo-slot.active .slot-placeholder { color: var(--bamboo-dark); }

.capture-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.capture-actions .cta { padding: 12px 10px; font-size: 14px; }

/* Inline AI model picker right above the analyze button */
.ai-selector {
  background: var(--bamboo-faint);
  border: 1px solid rgba(45,177,70,0.18);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 6px 0 10px;
}
.ai-selector-row {
  display: flex; align-items: center; gap: 10px;
}
.ai-selector-label {
  display: inline-flex; align-items: center; gap: 6px;
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--bamboo-dark);
  font-weight: 600;
}
.ai-selector-select {
  flex: 1;
  padding: 8px 30px 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23208a35' stroke-width='2.5'><polyline points='6 9 12 15 18 9'/></svg>")
    no-repeat right 8px center / 14px;
  color: var(--text);
  font-size: 13px;
  appearance: none; -webkit-appearance: none;
  outline: none;
  cursor: pointer;
}
.ai-selector-select:focus {
  border-color: var(--bamboo);
  box-shadow: 0 0 0 3px rgba(45,177,70,0.15);
}
.ai-selector-status {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint);
  min-height: 14px;
}
.ai-selector-status.ok    { color: var(--bamboo-dark); }
.ai-selector-status.warn  { color: #b87014; }
.ai-selector-status.muted { color: var(--text-faint); }

/* Compare-mode toggle + multi-provider pills (capture page) */
.ai-compare-row {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed rgba(45,177,70,0.25);
}
.ai-compare-switch {
  position: relative;
  width: 38px; height: 22px;
  flex: 0 0 auto;
  cursor: pointer;
}
.ai-compare-switch input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer; z-index: 2;
}
.ai-compare-track {
  position: absolute; inset: 0;
  background: #d4dad6;
  border-radius: 999px;
  transition: background .15s ease;
}
.ai-compare-track::after {
  content: '';
  position: absolute; left: 2px; top: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .15s ease;
}
.ai-compare-switch input:checked + .ai-compare-track { background: var(--bamboo); }
.ai-compare-switch input:checked + .ai-compare-track::after { transform: translateX(16px); }
.ai-compare-info { display: flex; flex-direction: column; gap: 1px; line-height: 1.2; }
.ai-compare-title { font-size: 13px; font-weight: 600; color: var(--bamboo-dark); }
.ai-compare-hint  { font-size: 11px; color: var(--text-faint); }

.ai-compare-list {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.ai-compare-list[hidden] { display: none; }
.ai-compare-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
  transition: border-color .12s ease, background .12s ease;
}
.ai-compare-pill input { margin: 0; accent-color: var(--bamboo); flex: 0 0 auto; }
.ai-compare-pill .pill-label { flex: 1; line-height: 1.2; }
.ai-compare-pill .pill-key-state {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  flex: 0 0 auto;
  font-weight: 700;
}
.ai-compare-pill .pill-key-state.ok      { background: var(--bamboo-soft);  color: var(--bamboo-dark); }
.ai-compare-pill .pill-key-state.missing { background: #fdecec;             color: #b03036; }
.ai-compare-pill .pill-key-state.proxy   { background: #eaf2fb;             color: #1b62b3; }
.ai-compare-pill.checked { border-color: var(--bamboo); background: var(--bamboo-faint); }
#ai-single-row.hidden-mode { display: none; }

/* OpenRouter sub-model picker — only visible when the OpenRouter pill is checked */
.ai-or-models {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid #d6caf0;
  background: #f5f1fc;
  border-radius: 10px;
}
.ai-or-models[hidden] { display: none; }
.ai-or-models-head {
  display: flex; align-items: baseline; gap: 8px;
  font-size: 12px; font-weight: 600; color: #5b21b6;
  margin-bottom: 8px;
}
.ai-or-models-hint { font-size: 10.5px; color: #8e8e93; font-weight: 400; }
.ai-or-models-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 2px;
}
.ai-or-models-list::-webkit-scrollbar { width: 6px; }
.ai-or-models-list::-webkit-scrollbar-thumb { background: rgba(45,177,70,0.3); border-radius: 3px; }
.ai-or-pill {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 9px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11.5px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.ai-or-pill input { margin: 0; accent-color: #7c3aed; flex: 0 0 auto; }
.ai-or-pill .or-pill-label   { flex: 1; line-height: 1.2; }
.ai-or-pill .or-pill-id      { font-size: 10px; color: var(--text-faint); }
.ai-or-pill .or-pill-remove  {
  margin-inline-start: auto;
  width: 16px; height: 16px; border: 0; background: transparent;
  color: #b03036; font-size: 14px; line-height: 1;
  cursor: pointer; padding: 0;
}
.ai-or-pill.checked { border-color: #7c3aed; background: #ede9fe; }

/* 更多模型 · 折叠下级菜单 */
.ai-or-more { grid-column: 1 / -1; }
.ai-or-more-summary {
  list-style: none;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 9px;
  font-size: 11.5px; font-weight: 600;
  color: var(--accent);
  background: var(--bg-soft);
  border: 1px dashed var(--border);
  border-radius: 7px;
  cursor: pointer;
  user-select: none;
}
.ai-or-more-summary::-webkit-details-marker { display: none; }
.ai-or-more-summary::before {
  content: '▸'; font-size: 10px; transition: transform .2s ease; color: var(--text-mute);
}
.ai-or-more[open] .ai-or-more-summary::before { transform: rotate(90deg); }
.ai-or-more-count {
  display: inline-block; min-width: 16px; text-align: center;
  background: rgba(124,58,237,0.12); color: #7c3aed;
  font-size: 10px; font-weight: 700; border-radius: 999px; padding: 0 5px;
}
.ai-or-more-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
  margin-top: 5px;
}

.ai-or-models-add {
  display: flex; gap: 6px;
  margin-top: 8px;
}
.ai-or-models-add input {
  flex: 1;
  padding: 6px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  font-size: 11.5px;
  outline: none;
}
.ai-or-models-add input:focus { border-color: #7c3aed; }
.ai-or-models-add-btn {
  padding: 6px 12px;
  border: 1px solid #7c3aed;
  background: #fff;
  color: #5b21b6;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.ai-or-models-add-btn:hover { background: #ede9fe; }

/* Comparison report */
.compare-stat-row {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin: 6px 0 14px;
}
.compare-stat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bamboo-faint);
  color: var(--bamboo-dark);
  border: 1px solid rgba(45,177,70,0.18);
}
.compare-stat-pill.error { background: #fdecec; color: #b03036; border-color: rgba(176,48,54,0.2); }
.compare-stat-pill.warn  { background: #fff5e6; color: #b87014; border-color: rgba(184,112,20,0.2); }
.compare-stat-pill .swatch { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.compare-stat-pill .ms    { font-weight: 500; opacity: 0.7; }

.compare-legend {
  display: flex; flex-wrap: wrap; gap: 10px 16px;
  padding: 8px 10px;
  margin-top: 2px;
  background: rgba(0,0,0,0.03);
  border-radius: 8px;
  font-size: 11px;
  color: var(--text-mute);
}
.compare-legend-item {
  display: inline-flex; align-items: center; gap: 6px;
}
.compare-legend-item .swatch {
  width: 14px; height: 3px; border-radius: 2px;
  display: inline-block;
}

.compare-table-wrap {
  margin: 6px 0 18px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  min-width: 360px;
}
.compare-table th, .compare-table td {
  padding: 9px 10px;
  text-align: start;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.compare-table thead th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--accent);
  position: sticky; top: 0;
  font-size: 11.5px;
}
.compare-table tbody th {
  background: var(--bg-soft);
  font-weight: 600;
  color: var(--text-mute);
  font-size: 11.5px;
  position: sticky; left: 0;
  z-index: 1;
}
.compare-table tbody tr:last-child td,
.compare-table tbody tr:last-child th { border-bottom: 0; }
.compare-table .cell-value { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.compare-table .cell-mock  { color: #b87014; }
.compare-table .cell-fail  { color: #b03036; }
.compare-table .cell-best  { color: var(--bamboo-dark); }
.compare-table .head-swatch {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-inline-end: 6px;
  vertical-align: middle;
}
.compare-table .consensus-row th,
.compare-table .consensus-row td {
  background: var(--bamboo-faint);
  font-weight: 700;
}

/* ===== 统计分析卡片 ===== */
.compare-stats {
  margin: 6px 0 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}
.compare-stats-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 14px 9px;
  border-bottom: 1px solid var(--border);
}
.compare-stats-head h4 {
  margin: 0; font-size: 13.5px; font-weight: 700; color: var(--text);
}
.compare-stats-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stats-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px; min-width: 460px;
}
.stats-table th, .stats-table td {
  padding: 8px 10px; text-align: end; white-space: nowrap;
  border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.stats-table thead th {
  background: var(--bg-soft); color: var(--accent);
  font-weight: 600; font-size: 11px; text-align: end;
  position: sticky; top: 0;
}
.stats-table th.col-metric, .stats-table td.col-metric {
  text-align: start; font-weight: 600; color: var(--text-mute);
  position: sticky; left: 0; background: var(--bg-soft); z-index: 1;
}
.stats-table tbody tr:last-child td { border-bottom: 0; }
.stats-table .col-median { color: var(--bamboo-dark); font-weight: 700; }
.stats-agree {
  display: inline-block; min-width: 30px; text-align: center;
  padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.stats-agree.high { background: rgba(45,177,70,0.14);  color: var(--bamboo-dark); }
.stats-agree.mid  { background: rgba(232,146,10,0.16); color: #B36B00; }
.stats-agree.low  { background: rgba(209,75,60,0.14);  color: #C0392B; }
.compare-stats-note {
  padding: 9px 14px; font-size: 11px; line-height: 1.6;
  color: var(--text-mute); background: var(--bg-soft);
  border-top: 1px solid var(--border);
}
.compare-stats-note strong { color: var(--text); }
.compare-stats-foot { padding: 10px 14px 12px; font-size: 12px; line-height: 1.6; }
.compare-stats-foot .sf-row { display: flex; gap: 7px; margin-bottom: 5px; }
.compare-stats-foot .sf-row:last-child { margin-bottom: 0; }
.compare-stats-foot .sf-tag {
  flex: 0 0 auto; font-weight: 700; font-size: 11px;
  padding: 1px 8px; border-radius: 6px; height: fit-content;
  background: var(--bamboo-faint); color: var(--bamboo-dark);
}
.compare-stats-foot .sf-tag.warn { background: rgba(232,146,10,0.16); color: #B36B00; }
.compare-stats-foot .sf-text { color: var(--text); }

.compare-ai-list { display: flex; flex-direction: column; gap: 10px; }
.compare-ai-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
}
.compare-ai-card.fail { border-color: rgba(176,48,54,0.3); background: #fff7f7; }
.compare-ai-card-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 6px;
}
.compare-ai-card-head .swatch { width: 10px; height: 10px; border-radius: 50%; }
.compare-ai-card-head .ms { margin-inline-start: auto; font-size: 11px; color: var(--text-faint); font-weight: 500; }
.compare-ai-card-body {
  font-size: 13px;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
}
.compare-ai-card-body.fail { color: #b03036; }

/* Report preview modal — shown before saving so the user can review the PNG */
.report-preview-overlay {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
  padding: calc(20px + var(--safe-top)) 20px calc(20px + var(--safe-bot));
  animation: previewFade .15s ease-out;
}
.report-preview-overlay[hidden] { display: none; }
@keyframes previewFade { from { opacity: 0; } to { opacity: 1; } }
.report-preview-card {
  background: var(--bg);
  border-radius: 16px;
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.4);
  animation: previewPop .2s cubic-bezier(0.2, 0.8, 0.2, 1.1);
}
@keyframes previewPop { from { transform: scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }
.report-preview-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
  font-weight: 600;
  color: var(--accent);
  flex: 0 0 auto;
}
.report-preview-close {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; background: transparent;
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-mute);
  padding: 0;
}
.report-preview-close:hover { background: var(--bg-soft); color: var(--accent); }
.report-preview-img-wrap {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--bg-soft);
  padding: 14px;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
}
.report-preview-img-wrap img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.12);
}
.report-preview-actions {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
  padding: 14px 18px calc(14px + var(--safe-bot));
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex: 0 0 auto;
}
.report-preview-actions .cta { padding: 12px 14px; font-size: 15px; }

/* Key status display in settings */
.key-status {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--bg-soft);
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-mute);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
.key-status.builtin { color: var(--bamboo-dark); background: var(--bamboo-faint); }
.key-status.empty   { color: #b87014; background: #fff4e6; }
.key-status .key-mask { letter-spacing: 0.4px; }
.key-status .key-clear {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", sans-serif;
  font-size: 11px;
  padding: 3px 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-mute);
  cursor: pointer;
}
.key-status .key-clear:hover { background: var(--bg-soft); color: var(--accent); }

/* ============ 分析中 ============ */
#page-analyzing { background: linear-gradient(160deg, #fff, var(--bamboo-faint)); align-items: center; justify-content: center; padding: calc(var(--safe-top) + 24px) calc(var(--safe-right) + 24px) calc(var(--safe-bot) + 24px) calc(var(--safe-left) + 24px); }
.analyzing-wrap { text-align: center; padding: 0 28px; max-width: 360px; }
.ring-spin { position: relative; width: 110px; height: 110px; margin: 0 auto 18px; }
.ring-spin svg { position: absolute; inset: 0; width: 100%; height: 100%; animation: spin 1.4s linear infinite; transform-origin: center; }
.spin-logo { position: absolute; left: 50%; top: 50%; width: 32px; height: 70px; transform: translate(-50%,-50%); object-fit: contain; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

#analyzing-title { font-size: 20px; font-weight: 600; color: var(--accent); margin: 0 0 4px; }
.analyzing-step { color: var(--text-mute); font-size: 13px; min-height: 1.2em; margin: 0 0 22px; }
.step-list { text-align: left; }
.step-list li {
  padding: 8px 0 8px 28px;
  position: relative;
  font-size: 13px;
  color: var(--text-faint);
  transition: color .3s ease;
}
.step-list li::before {
  content: ""; position: absolute; left: 4px; top: 13px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--border);
  transition: background .3s ease, transform .3s ease;
}
.step-list li.done { color: var(--text); }
.step-list li.done::before { background: var(--bamboo); }
.step-list li.active { color: var(--bamboo-dark); font-weight: 600; }
.step-list li.active::before { background: var(--bamboo); box-shadow: 0 0 0 4px rgba(45,177,70,0.18); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* 对比模式 · 各模型实时进度 */
.analyzing-models {
  text-align: left;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.am-row {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  padding: 6px 10px;
  border-radius: 9px;
  background: var(--card-soft, rgba(0,0,0,0.025));
  transition: background .25s ease;
}
.am-dot {
  width: 11px; height: 11px; border-radius: 50%;
  flex: 0 0 auto;
  border: 2px solid var(--bamboo);
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
.am-name {
  flex: 1 1 auto;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.am-status {
  flex: 0 0 auto;
  font-size: 11.5px;
  color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.am-row.done { background: rgba(45,177,70,0.08); }
.am-row.done .am-dot { animation: none; border: none; background: var(--bamboo); position: relative; }
.am-row.done .am-dot::after {
  content: ""; position: absolute; left: 3px; top: 1px;
  width: 3px; height: 6px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.am-row.done .am-status { color: var(--bamboo-dark); font-weight: 600; }
.am-row.warn { background: rgba(255,170,0,0.08); }
.am-row.warn .am-dot { animation: none; border: none; background: #E8920A; }
.am-row.warn .am-status { color: #B36B00; }
.am-row.error { background: rgba(220,70,60,0.07); }
.am-row.error .am-dot { animation: none; border: none; background: #D14B3C; }
.am-row.error .am-status { color: #C0392B; }

/* ============ 结果页 ============ */
.result-main { padding-bottom: calc(28px + var(--safe-bot)); }
.risk-card {
  padding: 18px 18px;
  border-radius: 16px;
  background: var(--bamboo-faint);
  border-left: 4px solid var(--bamboo);
  margin-bottom: 18px;
}
.risk-card.risk-low { background: #eaf6ee; border-color: var(--safe); }
.risk-card.risk-mid { background: #fff5e6; border-color: var(--warn); }
.risk-card.risk-high { background: #fdecec; border-color: var(--danger); }
.risk-level { font-size: 18px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.risk-desc { font-size: 13px; color: var(--text-mute); line-height: 1.55; }

.xray-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.xtab {
  flex: 1;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text-mute);
  font-size: 12px;
}
.xtab.active { background: var(--bamboo); color: #fff; font-weight: 600; }

.xray-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 3/4;
  background: #0a1420;
  border-radius: 12px;
  overflow: hidden;
}
.xray-stage canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
#overlay-canvas { pointer-events: none; }
.xray-note { font-size: 11px; color: var(--text-faint); margin: 8px 2px 0; line-height: 1.5; }

.metrics-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.metric-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
}
.metric-label { font-size: 12px; color: var(--text-mute); }
.metric-value {
  font-size: 24px; font-weight: 700; color: var(--accent);
  margin-top: 4px; display: flex; align-items: baseline; gap: 4px;
}
.metric-value .unit { font-size: 13px; font-weight: 500; color: var(--text-faint); }
.metric-bar {
  height: 4px; background: var(--border); border-radius: 4px; margin-top: 8px; overflow: hidden;
}
.metric-bar-fill { height: 100%; background: var(--bamboo); width: 0%; transition: width .8s ease, background .3s; border-radius: 4px; }
.metric-bar-fill.warn { background: var(--warn); }
.metric-bar-fill.danger { background: var(--danger); }

/* Small "generated by" badge above the AI summary */
.model-badge {
  display: inline-block;
  padding: 4px 10px 5px;
  margin-bottom: 8px;
  background: var(--bamboo-faint);
  color: var(--bamboo-dark);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid rgba(45,177,70,0.18);
  letter-spacing: 0.2px;
}
.model-badge.mock {
  background: #fff5e6;
  color: #b87014;
  border-color: rgba(184,112,20,0.2);
}
.model-badge:empty { display: none; }

.ai-report {
  padding: 14px 16px;
  background: var(--bg-soft);
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
}

/* ===== AI 生成 CT 影像 ===== */
.ai-ct-section { margin-top: 22px; }
.aict-sub { font-size: 12px; color: var(--text-mute); line-height: 1.6; margin: 2px 0 12px; }
.aict-btn { width: 100%; }
.aict-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
  margin-top: 14px;
}
@media (max-width: 560px) { .aict-grid { grid-template-columns: 1fr; } }
.aict-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: #0d0f12;
  display: flex; flex-direction: column;
}
.aict-card-head {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 11px;
  background: var(--bg-soft);
  font-size: 12px; font-weight: 600; color: var(--text);
  border-bottom: 1px solid var(--border);
}
.aict-card-head .ms { margin-inline-start: auto; font-size: 11px; color: var(--text-faint); font-weight: 400; font-variant-numeric: tabular-nums; }
.aict-card-head .dot {
  width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid var(--bamboo); border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
.aict-card.done .dot { animation: none; border: none; background: var(--bamboo); }
.aict-card.error .dot { animation: none; border: none; background: #D14B3C; }
.aict-stage {
  position: relative; width: 100%; aspect-ratio: 3 / 4;
  display: flex; align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(0deg, #111418 0 1px, transparent 1px 22px),
    repeating-linear-gradient(90deg, #111418 0 1px, transparent 1px 22px),
    #0d0f12;
}
.aict-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.aict-stage .aict-pending { color: var(--text-faint); font-size: 12px; text-align: center; padding: 0 14px; line-height: 1.6; }
.aict-stage .aict-err { color: #E08; color: #ff9b8e; font-size: 11.5px; text-align: center; padding: 0 14px; line-height: 1.6; }
.aict-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 7px 11px;
}
.aict-tag {
  font-size: 9px; letter-spacing: 0.6px; font-weight: 700;
  color: var(--text-faint); text-transform: uppercase;
}
.aict-save {
  font-size: 11px; color: var(--bamboo-dark); font-weight: 600;
  background: none; border: 0; cursor: pointer; padding: 2px 4px;
}
.aict-save[disabled] { color: var(--text-faint); cursor: default; }
.aict-note { font-size: 11px; color: var(--text-mute); line-height: 1.6; margin-top: 12px; }
.aict-note strong { color: #C0392B; }

.suggestions li {
  position: relative;
  padding: 10px 12px 10px 36px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
}
.suggestions li::before {
  content: ""; position: absolute; left: 12px; top: 14px;
  width: 14px; height: 14px;
  background: var(--bamboo) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='white'><path d='M6 10.78L3.22 8l-.94.94L6 12.66l8-8-.94-.94z'/></svg>") center/10px no-repeat;
  border-radius: 50%;
}

.result-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px;
}

.disclaimer {
  margin: 18px 0 0;
  padding: 12px 14px;
  font-size: 11px;
  color: var(--text-faint);
  line-height: 1.6;
  background: var(--bg-soft);
  border-radius: 10px;
}

/* ============ 设置页 ============ */
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; color: var(--text-mute); margin-bottom: 6px; }
.form-row input, .form-row select {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-row input:focus, .form-row select:focus {
  border-color: var(--bamboo);
  box-shadow: 0 0 0 3px rgba(45,177,70,0.15);
}
.about { padding: 14px 16px; background: var(--bg-soft); border-radius: 12px; }
.about p { margin: 0 0 4px; font-size: 13px; color: var(--text); }
.about p.muted { color: var(--text-faint); font-size: 12px; margin-top: 8px; }

/* ============ Toast ============ */
.toast {
  position: fixed;
  left: 50%; bottom: calc(64px + var(--safe-bot));
  transform: translateX(-50%) translateY(20px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(26,26,26,0.92);
  color: #fff;
  font-size: 13px;
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease, transform .25s ease;
  z-index: 1000;
  max-width: 80%;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   RTL (Arabic) overrides — flip directional layout where needed
   ============================================================ */
[dir="rtl"] .rtl-flip { transform: scaleX(-1); }
[dir="rtl"] .tip-list li { padding: 10px 40px 10px 12px; }
[dir="rtl"] .tip-list .num { left: auto; right: 12px; }
[dir="rtl"] .info-card ol li { padding: 8px 32px 8px 0; }
[dir="rtl"] .info-card ol li::before { left: auto; right: 0; }
[dir="rtl"] .suggestions li { padding: 10px 36px 10px 12px; }
[dir="rtl"] .suggestions li::before { left: auto; right: 12px; }
[dir="rtl"] .risk-card { border-left: 0; border-right: 4px solid var(--bamboo); }
[dir="rtl"] .risk-card.risk-low { border-right-color: var(--safe); }
[dir="rtl"] .risk-card.risk-mid { border-right-color: var(--warn); }
[dir="rtl"] .risk-card.risk-high { border-right-color: var(--danger); }
[dir="rtl"] .ai-selector-select {
  background-position: left 8px center;
  padding: 8px 10px 8px 30px;
}
[dir="rtl"] .topbar h1 { text-align: center; }
[dir="rtl"] body, [dir="rtl"] input, [dir="rtl"] select, [dir="rtl"] textarea {
  font-family: -apple-system, BlinkMacSystemFont, "SF Arabic", "Geeza Pro", "Tahoma", "Segoe UI", sans-serif;
}

/* ============ 桌面预览适配 ============ */
/* Phone-mockup preview for tablet widths (720–1023px) — same as v1 */
@media (min-width: 720px) and (max-width: 1023.98px) {
  body::before {
    content: "";
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #f0f4f1, #fafbfa);
    z-index: -1;
  }
  .page {
    position: relative; inset: auto;
    max-width: 420px; height: 90vh; max-height: 880px;
    margin: 4vh auto;
    border-radius: 32px;
    box-shadow: var(--shadow-md), 0 0 0 8px #1a1a1a;
    overflow: hidden;
  }
  .page.active { display: flex; }
  .page:not(.active) { display: none; }
  body { display: block; overflow: auto; }
}

/* Real desktop layout (≥1024px) — wider canvas, two-column on the
   pages that have a natural split: capture (photos / controls) and
   result (visualization / data). Home / guide / settings stay
   single-column but breathe more. */
@media (min-width: 1024px) {
  body { display: block; overflow: auto; background: #f0f4f1; }
  body::before {
    content: "";
    position: fixed; inset: 0;
    background: linear-gradient(135deg, #f0f4f1, #fafbfa);
    z-index: -1;
  }
  .page {
    position: relative; inset: auto;
    max-width: 1180px;
    height: 92vh; max-height: 960px;
    margin: 3vh auto;
    border-radius: 18px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    background: var(--bg);
  }
  .page.active { display: flex; }
  .page:not(.active) { display: none; }

  /* Slightly larger top bar / typography for desktop reading distance */
  .topbar { min-height: 64px; padding-block: 14px; }
  .topbar h1 { font-size: 18px; }
  .hero h2 { font-size: 30px; }

  /* Centered comfortable max-width on the single-column pages */
  #page-home .home-main,
  #page-guide .page-main,
  #page-settings .page-main,
  #page-analyzing .analyzing-wrap {
    max-width: 720px;
    margin-inline: auto;
    padding-inline: 32px;
  }

  /* Capture page: photo slots on the left, AI controls + analyze on the right */
  #page-capture .capture-main {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
    column-gap: 36px; row-gap: 16px;
    padding: 28px 40px 36px;
    align-content: start;
    max-width: 1100px;
    margin-inline: auto;
    width: 100%;
  }
  /* 顶部:capture-step + 被检者信息(横跨两列);下方左:photo-slots / 右:AI selector + 分析按钮 */
  #page-capture .capture-step      { grid-row: 1; grid-column: 1 / -1; }
  #page-capture .subject-info      { grid-row: 2; grid-column: 1 / -1; margin: 0; align-self: start; }
  #page-capture .photo-slots       { grid-row: 3; grid-column: 1; align-self: start; }
  #page-capture #file-gallery      { display: none; }
  #page-capture .ai-selector       { grid-row: 3; grid-column: 2; margin: 0; align-self: start; }
  /* 按钮紧贴 AI selector 下方,而非顶到底 */
  #page-capture #btn-analyze       { grid-row: 4; grid-column: 2; align-self: start; margin-top: 0; }
  #page-capture .capture-actions   { grid-row: 5; grid-column: 1 / -1; align-self: start; }
  /* 限制照片框的最大高度,避免在大屏上撑过头 */
  #page-capture .photo-slot .slot-img-wrap { aspect-ratio: 3 / 4; max-height: 360px; }
  /* Bigger photo previews on desktop */
  #page-capture .photo-slot .slot-img-wrap { aspect-ratio: 3 / 4; }
  /* Side-by-side checkbox pills (3 cols) on wide screens */
  .ai-compare-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }

  /* Result page: wider, with the X-ray + risk on the left and the data on the right */
  #page-result .result-main {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    column-gap: 36px; row-gap: 18px;
    padding: 28px 40px 36px;
    align-content: start;
    max-width: 1140px;
    margin-inline: auto;
    width: 100%;
  }
  /* Both view containers participate as direct grid children so their
     inner sections can be column-placed. Hidden ones still collapse. */
  #page-result .result-single,
  #page-result .result-compare { display: contents; }
  #page-result .result-single[hidden],
  #page-result .result-compare[hidden] { display: none !important; }

  /* Single-result layout */
  #page-result .risk-card,
  #page-result .result-actions,
  #page-result .disclaimer        { grid-column: 1 / -1; }
  #page-result .xray-wrap         { grid-column: 1; grid-row: span 4; align-self: start; }
  #page-result h3.block-title     { grid-column: 2; margin-top: 0; }
  #page-result .metrics-grid      { grid-column: 2; }
  #page-result .model-badge,
  #page-result .ai-report         { grid-column: 2; }
  #page-result .suggestions       { grid-column: 2; }

  /* Compare-result layout */
  #page-result .compare-stat-row  { grid-column: 1 / -1; }
  #page-result .compare-xray-wrap { grid-column: 1; grid-row: span 4; align-self: start; }
  #page-result .compare-table-wrap{ grid-column: 2; }
  #page-result .compare-ai-list   { grid-column: 2; }
}

/* ============ 模型对比测试页 ============ */
.dev-entry { margin-top: 14px; text-align: center; opacity: 0.7; }
.dev-link {
  display: inline-block;
  font-size: 12px;
  color: var(--text-mute);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px dashed var(--border);
  border-radius: 999px;
  transition: opacity .15s ease;
}
.dev-link:hover { opacity: 1; color: var(--bamboo-dark); border-color: var(--bamboo); }

.test-main { padding-bottom: 80px; }
.test-section {
  margin-top: 16px;
  padding: 14px 16px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
}
.test-section-title {
  margin: 0 0 12px;
  font-size: 13px; font-weight: 700;
  color: var(--bamboo-dark);
  letter-spacing: 0.4px;
}
.test-samples {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.test-sample-slot {
  border: 2px dashed var(--border);
  border-radius: 12px;
  background: var(--bg-soft);
  padding: 10px;
  aspect-ratio: 3 / 4;
  display: flex; flex-direction: column; gap: 6px;
  cursor: pointer; transition: border-color .15s ease, background .15s ease;
}
.test-sample-slot:hover, .test-sample-slot.active { border-color: var(--bamboo); background: var(--bamboo-faint); }
.test-sample-slot.has-photo { border-style: solid; border-color: var(--bamboo); background: #fff; }
.test-sample-slot .slot-label { font-size: 11px; font-weight: 600; color: var(--text-mute); }
.test-sample-slot .slot-img-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; overflow: hidden; background: #fff;
}
.test-sample-slot.has-photo .slot-img-wrap { background: #000; }
.test-sample-slot img { width: 100%; height: 100%; object-fit: cover; }
.test-sample-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.chip-btn {
  font-size: 12px;
  padding: 6px 12px;
  background: var(--bamboo-faint);
  color: var(--bamboo-dark);
  border: 1px solid rgba(45,177,70,0.18);
  border-radius: 999px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.chip-btn:hover { background: var(--bamboo-soft); }
.chip-btn:active { transform: scale(0.96); }
.chip-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.test-model-group { margin-bottom: 14px; }
.test-model-group-head {
  font-size: 11px; font-weight: 700;
  color: var(--bamboo-dark);
  letter-spacing: 1.2px;
  margin: 6px 0 8px;
}
.test-group-hint { font-weight: 500; color: var(--text-faint); letter-spacing: 0; }
.test-model-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s ease;
}
.test-model-row:hover { background: var(--bg-soft); }
.test-model-row input { accent-color: var(--bamboo); }

.test-options {
  display: flex; gap: 12px;
  margin: 12px 0 6px;
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: 10px;
}
.test-opt { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-mute); }
.test-opt select {
  font-size: 12px; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 6px; background: #fff;
}

.test-controls { display: flex; gap: 10px; margin-top: 12px; }
.test-controls .cta { flex: 1; padding: 12px 18px; font-size: 14px; }

.test-progress-meta {
  font-size: 12px; color: var(--text-mute);
  margin-bottom: 8px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.test-progress-bar {
  height: 8px; background: var(--bg-soft); border-radius: 4px; overflow: hidden;
}
.test-progress-fill {
  height: 100%; width: 0%; background: var(--bamboo);
  transition: width .3s ease;
}

.test-table-wrap { overflow-x: auto; }
.test-table {
  width: 100%;
  font-size: 12px;
  border-collapse: collapse;
}
.test-table th, .test-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.test-table th {
  font-size: 10.5px; font-weight: 700; color: var(--bamboo-dark);
  letter-spacing: 0.6px; text-transform: uppercase;
  background: var(--bg-soft);
}
.test-table td.model-cell { font-weight: 600; color: var(--text); }
.test-table td.status-cell { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 11px; }
.test-table .status-queued { color: var(--text-faint); }
.test-table .status-running { color: #d97706; animation: testPulse 1s ease-in-out infinite; }
.test-table .status-done { color: var(--bamboo-dark); }
.test-table .status-error { color: #dc2626; }
@keyframes testPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.test-table td.metric-cell { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.test-table .json-toggle {
  font-size: 11px; color: var(--bamboo-dark); cursor: pointer;
  text-decoration: underline dotted;
}
.test-table tr.json-row td {
  background: #fafbfc;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px; line-height: 1.5;
  white-space: pre-wrap; word-break: break-all;
  color: var(--text-mute);
}

.test-agreement {
  margin-top: 14px; padding: 12px 14px;
  background: var(--bamboo-faint);
  border: 1px dashed rgba(45,177,70,0.3);
  border-radius: 10px;
  font-size: 12px; line-height: 1.7;
}
.test-agreement .ag-row { display: flex; gap: 6px; }
.test-agreement .ag-key { color: var(--bamboo-dark); font-weight: 700; min-width: 110px; }
.test-agreement .ag-val { color: var(--text); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.test-agreement .ag-good { color: var(--bamboo-dark); margin-left: 4px; }
.test-agreement .ag-bad { color: #dc2626; margin-left: 4px; }

.test-tools { display: flex; gap: 10px; flex-wrap: wrap; }

/* ====== OR family 折叠组 ====== */
.or-presets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.or-family {
  margin-bottom: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-soft);
}
.or-family[open] { background: #fff; }
.or-family > summary {
  list-style: none;
  cursor: pointer;
  padding: 9px 12px;
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600;
  color: var(--text);
  border-radius: 10px;
  user-select: none;
}
.or-family > summary::-webkit-details-marker { display: none; }
.or-family > summary::before {
  content: '▸';
  font-size: 10px; color: var(--bamboo-dark);
  transition: transform .15s ease;
  display: inline-block;
}
.or-family[open] > summary::before { transform: rotate(90deg); }
.or-family .or-fam-name { flex: 1; }
.or-family .or-fam-count {
  background: var(--bamboo-faint);
  color: var(--bamboo-dark);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}
.or-family .or-fam-toggle {
  font-size: 10.5px;
  padding: 3px 9px;
  background: transparent;
  color: var(--bamboo-dark);
  border: 1px solid var(--bamboo);
  border-radius: 999px;
  cursor: pointer;
}
.or-family .or-fam-toggle:hover { background: var(--bamboo-faint); }
.or-family .test-model-row {
  padding: 6px 12px 6px 28px;
  font-size: 12.5px;
}
.or-family .test-model-row:first-of-type { margin-top: 2px; }
.or-family .test-model-row:last-child { padding-bottom: 10px; }
.or-custom-row {
  display: flex; gap: 6px; padding: 8px 12px 10px;
}
.or-custom-input {
  flex: 1; padding: 6px 10px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 12px;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
.or-custom-list { padding: 0 12px 8px; display: flex; flex-direction: column; gap: 2px; }

/* ============ 历史报告 / 日历 ============ */
.history-main { padding-bottom: 60px; }
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.cal-title { margin: 0; font-size: 17px; font-weight: 700; color: var(--accent); }

.cal-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  margin-bottom: 14px;
}
.cal-stat {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  text-align: center;
}
.cal-stat-label { display: block; font-size: 10.5px; color: var(--text-faint); margin-bottom: 4px; letter-spacing: 0.5px; }
.cal-stat-val { display: block; font-size: 15px; font-weight: 700; color: var(--bamboo-dark); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

.cal-wrap {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px;
}
.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin-bottom: 6px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 11px; font-weight: 700;
  color: var(--text-mute);
  padding: 4px 0;
  letter-spacing: 0.6px;
}
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
}
.cal-cell {
  aspect-ratio: 1 / 1;
  border: 1px solid transparent;
  border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  position: relative;
  transition: background .12s ease, border-color .12s ease;
  background: #fff;
}
.cal-cell.outside { color: var(--text-faint); opacity: 0.35; cursor: default; }
.cal-cell:not(.outside):hover { background: var(--bamboo-faint); border-color: var(--bamboo); }
.cal-cell.has-report { background: var(--bamboo-faint); border-color: rgba(45,177,70,0.15); }
.cal-cell.has-report:hover { border-color: var(--bamboo); }
.cal-cell.selected { background: var(--bamboo); color: #fff; border-color: var(--bamboo); }
.cal-cell.selected:hover { background: var(--bamboo-dark); }
.cal-cell.today { box-shadow: 0 0 0 2px rgba(45,177,70,0.35) inset; }
.cal-cell.today.selected { box-shadow: none; }
.cal-cell .cal-day-num { font-weight: 600; line-height: 1; }
.cal-cell .cal-dot {
  width: 7px; height: 7px; border-radius: 50%;
}
.cal-cell .cal-dot.sev-low  { background: #2DB146; }
.cal-cell .cal-dot.sev-mid  { background: #e58a1c; }
.cal-cell .cal-dot.sev-high { background: #e0383e; }
.cal-cell .cal-dot.sev-none { background: transparent; }
.cal-cell.selected .cal-dot { box-shadow: 0 0 0 1.5px rgba(255,255,255,0.6); }

.history-detail {
  margin-top: 14px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 80px;
}
.history-detail-empty {
  color: var(--text-faint); font-size: 13px; line-height: 1.7; text-align: center; padding: 10px 0;
}
.history-detail h3 {
  margin: 0 0 10px;
  font-size: 14px; font-weight: 700; color: var(--bamboo-dark);
  display: flex; align-items: center; gap: 8px;
}
.history-detail .sev-tag {
  font-size: 10px; padding: 2px 8px; border-radius: 999px; font-weight: 700;
  letter-spacing: 0.5px;
}
.history-detail .sev-tag.sev-low { background: rgba(45,177,70,0.15); color: #208a35; }
.history-detail .sev-tag.sev-mid { background: rgba(229,138,28,0.18); color: #a85f00; }
.history-detail .sev-tag.sev-high { background: rgba(224,56,62,0.15); color: #b22025; }
.history-detail .src-tag {
  font-size: 9.5px; padding: 1.5px 6px; border-radius: 999px;
  background: var(--bg-soft); color: var(--text-faint);
  font-weight: 600; letter-spacing: 0.5px; margin-left: auto;
}
.history-metrics {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px;
  margin: 10px 0;
}
.history-metric {
  background: var(--bg-soft);
  border-radius: 8px;
  padding: 8px 10px;
}
.history-metric-label { display: block; font-size: 10px; color: var(--text-faint); margin-bottom: 3px; letter-spacing: 0.4px; }
.history-metric-val { display: block; font-size: 14px; font-weight: 700; color: var(--text); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }
.history-summary {
  margin: 8px 0 0;
  font-size: 12.5px; color: var(--text-mute); line-height: 1.65;
  padding: 8px 10px;
  background: var(--bamboo-faint);
  border-radius: 8px;
  border-left: 3px solid var(--bamboo);
}

.history-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.history-hint { margin-top: 10px; font-size: 11px; color: var(--text-faint); line-height: 1.6; }

/* 首页底部"开始筛查"入口 - 稍小一号、上下有间距 */
.home-bottom-cta { margin-top: 14px; padding: 12px 18px; }
.home-bottom-cta .cta-main { font-size: 15px; }
.home-bottom-cta .cta-sub { font-size: 10px; }

/* 顶栏品牌区:公司署名 */
.topbar .brand-text .brand-by {
  display: block;
  font-size: 9.5px;
  color: var(--text-faint);
  letter-spacing: 0.3px;
  margin-top: 1px;
  line-height: 1.2;
}
.topbar .brand-text .brand-by a {
  color: var(--bamboo-dark);
  text-decoration: none;
  font-weight: 600;
}
.topbar .brand-text .brand-by a:hover { text-decoration: underline; }

/* 页脚:公司署名一行 */
.foot .foot-by { color: var(--text-faint); font-size: 10px; letter-spacing: 0.3px; display: inline-block; margin-top: 2px; }
.foot .foot-by a { color: var(--bamboo-dark); font-weight: 600; text-decoration: none; }
.foot .foot-by a:hover { text-decoration: underline; }

/* ============ 定价 / 订阅�?============ */
.pricing-main { padding-bottom: 60px; }
.pricing-hero { text-align: center; padding: 8px 0 18px; }
.pricing-hero h2 { margin: 0 0 6px; font-size: 20px; font-weight: 700; color: var(--accent); }
.pricing-hero p { margin: 0; font-size: 13px; color: var(--text-mute); }

.plan-status {
  margin-bottom: 12px;
  padding: 10px 14px;
  background: var(--bamboo-faint);
  border: 1px solid rgba(45,177,70,0.2);
  border-radius: 10px;
  font-size: 13px;
  color: var(--bamboo-dark);
  display: flex; align-items: center; gap: 10px;
}
.plan-status .ps-tag {
  background: var(--bamboo); color: #fff;
  padding: 2px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
}

.plan-card {
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  padding: 18px 18px 16px;
  margin-bottom: 14px;
  position: relative;
}
.plan-card.plan-featured {
  border-color: var(--bamboo);
  background: linear-gradient(180deg, #F4FBF6 0%, #fff 60%);
  box-shadow: 0 8px 24px rgba(45,177,70,0.1);
}
.plan-badge {
  position: absolute; top: -10px; right: 16px;
  background: var(--bamboo-dark); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  padding: 4px 12px; border-radius: 999px;
  box-shadow: 0 3px 8px rgba(34,138,53,0.3);
}
.plan-head { margin-bottom: 6px; }
.plan-name { margin: 0; font-size: 17px; font-weight: 700; color: var(--accent); }
.plan-price { font-weight: 800; color: var(--accent); display: flex; align-items: baseline; gap: 2px; margin-bottom: 4px; }
.plan-price .plan-cur { font-size: 16px; }
.plan-price .plan-amt { font-size: 36px; letter-spacing: -0.5px; }
.plan-price .plan-unit { font-size: 13px; color: var(--text-mute); margin-left: 4px; font-weight: 500; }
.plan-deduct {
  background: var(--bamboo-faint); color: var(--bamboo-dark);
  padding: 5px 10px; border-radius: 8px;
  font-size: 11.5px; display: inline-block; margin-bottom: 10px; font-weight: 600;
}
.plan-saving { font-size: 12px; color: var(--bamboo-dark); margin-bottom: 10px; font-weight: 600; }
.plan-benefits { padding-left: 0; margin: 8px 0 14px; list-style: none; }
.plan-benefits li {
  position: relative; padding: 5px 0 5px 22px;
  font-size: 13px; line-height: 1.5; color: var(--text);
}
.plan-benefits li::before {
  content: 'OK'; font-size: 0;
  position: absolute; left: 0; top: 5px;
  width: 14px; height: 14px;
  background: var(--bamboo);
  border-radius: 50%;
  background-image: linear-gradient(45deg, transparent 40%, #fff 40%, #fff 50%, transparent 50%);
}
.plan-benefits li::after {
  content: '\2713';
  position: absolute; left: 2px; top: 4px;
  color: var(--bamboo); font-weight: 800; font-size: 13px;
}
.plan-cta {
  width: 100%; padding: 12px 16px; border-radius: 12px;
  font-size: 14px; font-weight: 700; cursor: pointer;
  transition: transform .15s ease;
}
.plan-cta:active { transform: scale(0.985); }
.plan-cta-primary { background: var(--bamboo); color: #fff; border: 0; box-shadow: 0 6px 14px rgba(45,177,70,0.28); }
.plan-cta-primary:hover { background: var(--bamboo-dark); }
.plan-cta-secondary { background: #fff; color: var(--accent); border: 1.5px solid var(--border); }
.plan-cta-secondary:hover { border-color: var(--bamboo); color: var(--bamboo-dark); }

.pricing-footnote { text-align: center; font-size: 11px; color: var(--text-faint); margin: 6px 0 18px; }
.gift-card-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 16px; }
.gift-entry-btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 14px; background: #fff;
  border: 1.5px dashed var(--bamboo); border-radius: 12px;
  color: var(--bamboo-dark); font-size: 13px; font-weight: 600; cursor: pointer;
}
.gift-entry-btn:hover { background: var(--bamboo-faint); }
.pricing-disclaimer { font-size: 11px; color: var(--text-faint); line-height: 1.65; text-align: center; }
.report-link-pricing { background: linear-gradient(135deg, #f4fbf6, #e6f5ea); border: 1px solid rgba(45,177,70,0.25); color: var(--bamboo-dark); font-weight: 700; }
.report-link-pricing .report-link-dot { display: none; }

/* ============ 模拟支付弹窗 ============ */
.pay-modal {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
  animation: payFadeIn .2s ease;
}
@keyframes payFadeIn { from { opacity: 0; } to { opacity: 1; } }
.pay-modal-card {
  background: #fff; border-radius: 18px;
  width: 100%; max-width: 380px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  animation: paySlideUp .25s ease;
}
@keyframes paySlideUp { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.pay-modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); }
.pay-modal-head h3 { margin: 0; font-size: 16px; font-weight: 700; color: var(--accent); }
.pay-modal-close { width: 30px; height: 30px; border: 0; background: transparent; font-size: 16px; color: var(--text-mute); cursor: pointer; border-radius: 50%; }
.pay-modal-close:hover { background: var(--bg-soft); }
.pay-modal-body { padding: 18px; flex: 1; overflow-y: auto; }
.pay-modal-foot { padding: 12px 18px 16px; display: flex; gap: 10px; border-top: 1px solid var(--border); }
.pay-modal-foot .cta { flex: 1; padding: 11px 16px; font-size: 14px; }

.pay-plan-info { display: flex; align-items: center; justify-content: space-between; background: var(--bg-soft); padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; }
.pay-plan-info span { font-size: 14px; color: var(--text); }
.pay-plan-info strong { font-size: 22px; color: var(--bamboo-dark); font-weight: 800; }

.pay-methods { display: flex; flex-direction: column; gap: 8px; }
.pay-method { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; }
.pay-method.active { border-color: var(--bamboo); background: var(--bamboo-faint); }
.pay-method input { display: none; }
.pay-method-icon { width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: #fff; letter-spacing: 0.5px; }
.pay-method-icon.wechat { background: #07C160; }
.pay-method-icon.alipay { background: #1677FF; }
.pay-method-name { flex: 1; font-size: 14px; font-weight: 600; }
.pay-method-check { color: var(--bamboo); font-weight: 800; opacity: 0; }
.pay-method.active .pay-method-check { opacity: 1; }

.pay-qr-area { text-align: center; padding: 8px 0; }
.pay-qr-frame { width: 180px; height: 180px; margin: 0 auto 12px; border: 2px solid var(--border); border-radius: 12px; background: #fff; padding: 14px; position: relative; overflow: hidden; }
.pay-qr-frame::before, .pay-qr-frame::after { content: ''; position: absolute; width: 16px; height: 16px; border: 3px solid var(--bamboo); }
.pay-qr-frame::before { top: -3px; left: -3px; border-right: 0; border-bottom: 0; }
.pay-qr-frame::after { bottom: -3px; right: -3px; border-left: 0; border-top: 0; }
.pay-qr-pattern {
  width: 100%; height: 100%;
  background-image:
    linear-gradient(45deg, #1A1A1A 25%, transparent 25%),
    linear-gradient(-45deg, #1A1A1A 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #1A1A1A 75%),
    linear-gradient(-45deg, transparent 75%, #1A1A1A 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  border-radius: 4px;
}
.pay-qr-hint { font-size: 12px; color: var(--text-mute); margin-bottom: 6px; }
.pay-countdown { font-size: 16px; font-weight: 700; color: var(--bamboo-dark); font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; }

.pay-success { text-align: center; padding: 12px 0; }
.pay-success-ring { width: 80px; height: 80px; margin: 0 auto 14px; border-radius: 50%; background: var(--bamboo); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 40px; font-weight: 800; animation: paySuccessPop .4s cubic-bezier(0.34, 1.56, 0.64, 1); box-shadow: 0 8px 20px rgba(45,177,70,0.3); }
@keyframes paySuccessPop { 0% { transform: scale(0.2); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.pay-success-text { font-size: 18px; font-weight: 700; color: var(--bamboo-dark); margin-bottom: 6px; }
.pay-success-sub { font-size: 12px; color: var(--text-mute); }

/* 礼品�?*/
.gift-sub { font-size: 12px; color: var(--text-mute); line-height: 1.6; margin: 0 0 14px; text-align: center; }
.gift-options { display: flex; flex-direction: column; gap: 8px; }
.gift-option { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 12px; cursor: pointer; }
.gift-option input { display: none; }
.gift-option.active { border-color: var(--bamboo); background: var(--bamboo-faint); }
.gift-amt { font-size: 22px; font-weight: 800; color: var(--accent); }
.gift-tag { background: var(--bg-soft); color: var(--text-mute); padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; margin-left: auto; }
.gift-option.active .gift-tag { background: var(--bamboo); color: #fff; }

.gift-card-display { text-align: center; }
.gift-card-art { background: linear-gradient(135deg, #2DB146 0%, #228a35 100%); color: #fff; border-radius: 16px; padding: 20px 18px; margin-bottom: 14px; position: relative; overflow: hidden; box-shadow: 0 12px 28px rgba(45,177,70,0.35); }
.gift-card-brand { font-size: 11px; opacity: 0.85; letter-spacing: 1px; margin-bottom: 8px; }
.gift-card-amount { font-size: 34px; font-weight: 800; line-height: 1; margin-bottom: 4px; }
.gift-card-tier { font-size: 12px; opacity: 0.9; margin-bottom: 14px; }
.gift-card-code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 14px; background: rgba(255,255,255,0.18); padding: 8px 12px; border-radius: 8px; letter-spacing: 2px; display: inline-block; }

.gift-redeem-input { width: 100%; padding: 14px 16px; border: 1.5px solid var(--border); border-radius: 12px; font-size: 16px; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 2px; text-align: center; text-transform: uppercase; box-sizing: border-box; }
.gift-redeem-input:focus { outline: none; border-color: var(--bamboo); }
.gift-redeem-msg { font-size: 12px; color: var(--text-mute); margin-top: 10px; min-height: 18px; text-align: center; }
.gift-redeem-msg.error { color: #dc2626; }
.gift-redeem-msg.ok { color: var(--bamboo-dark); font-weight: 700; }

/* 历史报告页底部 CTA */
.history-bottom-cta { margin-top: 18px; padding: 12px 18px; }
.history-bottom-cta .cta-main { font-size: 15px; }
.history-bottom-cta .cta-sub { font-size: 10px; }

/* 关键修复:hidden 属性必须能真正隐藏 modal(高于 .pay-modal display:flex 的优先级) */
.pay-modal[hidden] { display: none !important; }

/* 首页主 CTA 下方快捷入口(订阅 + 历史) */
.home-quick-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0 4px; }
.quick-tile {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  background: #fff;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: var(--text);
  transition: border-color .15s ease, background .15s ease, transform .12s ease;
}
.quick-tile:hover { border-color: var(--bamboo); background: var(--bamboo-faint); }
.quick-tile:active { transform: scale(0.985); }
.quick-tile svg { color: var(--bamboo-dark); flex: 0 0 22px; }
.quick-tile-text { flex: 1; line-height: 1.25; min-width: 0; }
.quick-tile-text strong { display: block; font-size: 14px; font-weight: 700; color: var(--accent); margin-bottom: 2px; }
.quick-tile-text small { display: block; font-size: 10.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quick-tile-arrow { color: var(--text-faint); font-size: 16px; line-height: 1; }
.quick-tile-pricing { background: linear-gradient(135deg, #F4FBF6 0%, #E6F5EA 100%); border-color: rgba(45,177,70,0.25); }
.quick-tile-history { background: #fff; }

/* ============ 被检者信�?拍照页输入区) ============ */
.subject-info {
  margin-top: 18px;
  padding: 12px 14px 14px;
  background: var(--bamboo-faint);
  border: 1px solid rgba(45,177,70,0.18);
  border-radius: 12px;
}
.subject-info-head {
  font-size: 13px; font-weight: 700; color: var(--bamboo-dark);
  margin-bottom: 12px;
  display: flex; align-items: baseline; gap: 6px;
  letter-spacing: 0.3px;
}
.subject-info-head .subject-info-hint {
  font-size: 11px; color: var(--text-faint); font-weight: 500;
}
.subject-info-row {
  display: grid;
  grid-template-columns: 1fr 0.8fr 0.7fr;
  gap: 10px;
}
.subject-field { display: flex; flex-direction: column; gap: 4px; }
.subject-label {
  font-size: 11px; color: var(--text-mute); letter-spacing: 0.4px;
}
.subject-field input, .subject-field select {
  width: 100%;
  padding: 9px 10px;
  font-size: 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
  transition: border-color .15s ease, background .15s ease;
}
.subject-field input:focus, .subject-field select:focus {
  outline: none; border-color: var(--bamboo); background: #fff;
}
.subject-field select { appearance: none; padding-right: 22px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><polyline points='1 1 5 5 9 1' fill='none' stroke='%232DB146' stroke-width='1.5'/></svg>");
  background-repeat: no-repeat; background-position: right 8px center;
}

/* 报告顶部:被检者条 */
.subject-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
  background: linear-gradient(135deg, #F4FBF6 0%, #E6F5EA 100%);
  border: 1px solid rgba(45,177,70,0.18);
  border-radius: 12px;
}
.subject-banner-icon { font-size: 22px; flex: 0 0 24px; }
.subject-banner-text { flex: 1; line-height: 1.25; min-width: 0; }
.subject-banner-name { display: block; font-size: 15px; font-weight: 700; color: var(--accent); }
.subject-banner-meta { display: block; font-size: 11px; color: var(--text-mute); margin-top: 2px; }
.subject-banner-date {
  font-size: 11px; color: var(--bamboo-dark); font-weight: 600;
  white-space: nowrap;
  background: rgba(255,255,255,0.7);
  padding: 4px 10px; border-radius: 999px;
}

/* 历史:当日报告 modal 卡片稍大 */
.history-day-card { max-width: 440px; }
.history-day-card .pay-modal-foot .cta { font-size: 13px; padding: 9px 12px; }

/* 历史:当日虚拟 X 光 */
.history-xray {
  position: relative;
  margin: 10px 0 12px;
  border-radius: 12px;
  overflow: hidden;
  background: #0a0a0a;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
}
.history-xray img {
  display: block;
  width: 100%;
  max-width: 280px;
  margin: 0 auto;
  aspect-ratio: 200 / 280;
  object-fit: cover;
}
.history-xray-tag {
  position: absolute;
  top: 8px; right: 8px;
  background: rgba(45,177,70,0.85);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 9px;
  border-radius: 999px;
}
