:root {
  /* 1rpx = 视口宽 / 750，与小程序 rpx 完全同义；桌面端锁 430px 保持手机观感 */
  --rpx: calc(min(100vw, 430px) / 750);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

/* ↓ 以下由 miniprogram/app.wxss 机械转换 */
/* 安睡守护Plus · 全局样式 */
.sg-page {
  background: #F5F7FB;
  font-size: calc(28 * var(--rpx));
  color: #2A3240;
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
}

.card {
  background: #fff;
  border-radius: calc(20 * var(--rpx));
  padding: calc(28 * var(--rpx));
  margin: calc(20 * var(--rpx)) calc(24 * var(--rpx));
  box-shadow: 0 calc(4 * var(--rpx)) calc(16 * var(--rpx)) rgba(42, 50, 64, 0.06);
}

.card-title {
  font-size: calc(30 * var(--rpx));
  font-weight: 600;
  margin-bottom: calc(16 * var(--rpx));
  color: #2A3240;
}

.btn-primary {
  background: #4A6CF7;
  color: #fff;
  border-radius: calc(48 * var(--rpx));
  font-size: calc(30 * var(--rpx));
  padding: calc(6 * var(--rpx)) 0;
}
.btn-primary.disabled { background: #B9C4F9; }

.btn-warn {
  background: #D64545;
  color: #fff;
  border-radius: calc(48 * var(--rpx));
  font-size: calc(30 * var(--rpx));
  padding: calc(6 * var(--rpx)) 0;
}

.btn-ghost {
  background: #EEF2FE;
  color: #4A6CF7;
  border-radius: calc(48 * var(--rpx));
  font-size: calc(28 * var(--rpx));
  padding: calc(6 * var(--rpx)) 0;
}

.muted { color: #8A93A6; font-size: calc(24 * var(--rpx)); }
.row { display: flex; align-items: center; }
.spacer { flex: 1; }

.tag {
  display: inline-block;
  padding: calc(4 * var(--rpx)) calc(18 * var(--rpx));
  border-radius: calc(999 * var(--rpx));
  font-size: calc(22 * var(--rpx));
}

/* ↓ miniprogram/pages/home/home.wxss */
.page { padding-bottom: calc(40 * var(--rpx)); }

.hero { background: linear-gradient(135deg, #4A6CF7, #6E8BFF); color: #fff; }
.hero .muted { color: rgba(255, 255, 255, 0.8); }
.hero-title .name { font-size: calc(36 * var(--rpx)); font-weight: 600; margin-bottom: calc(8 * var(--rpx)); }
.hero-badge {
  width: calc(84 * var(--rpx)); height: calc(84 * var(--rpx)); border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: calc(26 * var(--rpx));
}

.grid { display: flex; gap: calc(16 * var(--rpx)); }
.grid-item {
  flex: 1;
  background: #F8FAFE;
  border-radius: calc(16 * var(--rpx));
  padding: calc(24 * var(--rpx)) calc(16 * var(--rpx));
  text-align: center;
}
.gi-icon { font-size: calc(44 * var(--rpx)); margin-bottom: calc(12 * var(--rpx)); }
.gi-icon.hr { color: #E85B5B; }
.gi-icon.sn { color: #4A6CF7; }
.gi-icon.q { color: #E8A23A; }
.gi-title { font-size: calc(26 * var(--rpx)); font-weight: 600; margin-bottom: calc(8 * var(--rpx)); }
.gi-sub { font-size: calc(24 * var(--rpx)); color: #5A6478; min-height: calc(34 * var(--rpx)); }
.gi-date { margin-top: calc(4 * var(--rpx)); }

/* 首页报告入口卡：整卡可点，综合分与等级直接露出来 */
.report-card { border: calc(2 * var(--rpx)) solid #E6EBF5; }
.rc-sub { font-size: calc(24 * var(--rpx)); margin-top: calc(4 * var(--rpx)); }
.rc-score { display: flex; align-items: baseline; }
.rc-num { font-size: calc(56 * var(--rpx)); font-weight: 700; }
.rc-unit { font-size: calc(24 * var(--rpx)); margin-left: calc(6 * var(--rpx)); }
.rc-level {
  display: inline-block; margin-top: calc(16 * var(--rpx));
  padding: calc(6 * var(--rpx)) calc(20 * var(--rpx)); border-radius: calc(999 * var(--rpx)); font-size: calc(24 * var(--rpx));
}
.rc-more { margin-top: calc(16 * var(--rpx)); font-size: calc(26 * var(--rpx)); }

.explain { line-height: 1.8; }

.disclaimer { background: #FFF9EF; }

/* ↓ miniprogram/pages/heartrate/heartrate.wxss */
.page { padding-bottom: calc(40 * var(--rpx)); }

/*
 * 容器保持 3:4 竖屏比例（padding-top 技巧，wxss 无法用百分比 height 跟随宽度）。
 * 原因：camera 组件会把摄像头画面按容器尺寸居中裁剪后显示，
 * 若容器比例与摄像头帧比例（medium 常见 480×640）差太多，
 * 画面被裁掉一圈 → 引导框（按容器定位）与引擎 ROI（按帧坐标算）就对不齐，
 * 用户明明对准了框，ROI 却落在框外，肤色占比永远上不去。
 */
.camera-wrap {
  margin: calc(20 * var(--rpx)) calc(24 * var(--rpx));
  border-radius: calc(20 * var(--rpx));
  overflow: hidden;
  background: #1A2030;
  position: relative;
  width: auto;
  height: 0;
  padding-top: 133.33%;   /* 4/3 → 宽:高 = 3:4 */
}
.camera { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.placeholder {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
}
.ph-icon { font-size: calc(90 * var(--rpx)); color: #E85B5B; margin-bottom: calc(16 * var(--rpx)); }
.ph-text { font-size: calc(32 * var(--rpx)); font-weight: 600; margin-bottom: calc(8 * var(--rpx)); }
.ph-sub { font-size: calc(24 * var(--rpx)); color: #8A93A6; margin-bottom: calc(12 * var(--rpx)); }
.placeholder .muted { color: #8A93A6; }

/*
 * 引导框：与 utils/hr.js 的 ROI_REGIONS 对齐（ROI 覆盖 x 29%~71%、y 14%~50%）。
 * 取 x 26%~74%、y 10%~68%：脸填满此框时，额头落在上块 ROI、两颊落在左右两块 ROI。
 * 旧版 x20%/y15%/w60%/h70% 是按另一套 ROI 画的，换引擎后必须同步改，
 * 否则"照着框对准"反而把脸放错位置。
 */
.guide-box {
  position: absolute;
  left: 26%; top: 10%;
  width: 48%; height: 58%;
  border: calc(2 * var(--rpx)) solid rgba(255, 255, 255, 0.85);
  border-radius: calc(24 * var(--rpx));
}
.guide-corner {
  position: absolute;
  width: calc(32 * var(--rpx)); height: calc(32 * var(--rpx));
  border-color: #4ADE80;
  border-style: solid;
  border-width: 0;
}
.guide-corner.tl { left: calc(-4 * var(--rpx)); top: calc(-4 * var(--rpx)); border-left-width: calc(8 * var(--rpx)); border-top-width: calc(8 * var(--rpx)); border-top-left-radius: calc(12 * var(--rpx)); }
.guide-corner.tr { right: calc(-4 * var(--rpx)); top: calc(-4 * var(--rpx)); border-right-width: calc(8 * var(--rpx)); border-top-width: calc(8 * var(--rpx)); border-top-right-radius: calc(12 * var(--rpx)); }
.guide-corner.bl { left: calc(-4 * var(--rpx)); bottom: calc(-4 * var(--rpx)); border-left-width: calc(8 * var(--rpx)); border-bottom-width: calc(8 * var(--rpx)); border-bottom-left-radius: calc(12 * var(--rpx)); }
.guide-corner.br { right: calc(-4 * var(--rpx)); bottom: calc(-4 * var(--rpx)); border-right-width: calc(8 * var(--rpx)); border-bottom-width: calc(8 * var(--rpx)); border-bottom-right-radius: calc(12 * var(--rpx)); }
.guide-label {
  position: absolute;
  bottom: calc(-56 * var(--rpx));
  width: 100%;
  text-align: center;
  color: #4ADE80;
  font-size: calc(24 * var(--rpx));
}

.big-hr { display: flex; align-items: baseline; }
.hr-num { font-size: calc(88 * var(--rpx)); font-weight: 700; color: #E85B5B; line-height: 1; }
.hr-unit { font-size: calc(26 * var(--rpx)); color: #8A93A6; margin-left: calc(10 * var(--rpx)); }

/* 呼吸：与心率同源（同一段 RGB 的另一路带通），并列展示。
   中间这条竖线不是装饰 —— 它明确告诉使用者"这是同时测出来的两个指标"，
   而不是先测心率再切到另一个页面测呼吸。 */
.big-br { margin-left: calc(32 * var(--rpx)); padding-left: calc(32 * var(--rpx)); border-left: calc(2 * var(--rpx)) solid #E3E8F0; }
.br-cap { font-size: calc(22 * var(--rpx)); color: #8A93A6; margin-bottom: calc(8 * var(--rpx)); }
.br-line { display: flex; align-items: baseline; }
.br-num { font-size: calc(60 * var(--rpx)); font-weight: 700; color: #4A6CF7; line-height: 1; }
.br-unit { font-size: calc(24 * var(--rpx)); color: #8A93A6; margin-left: calc(8 * var(--rpx)); }

/* 呼吸状态行：倒计时 / 卡在哪一环 / 已出数 */
.br-tip {
  display: flex; align-items: flex-start;
  margin-top: calc(18 * var(--rpx)); padding: calc(12 * var(--rpx)) calc(16 * var(--rpx));
  background: #F0F4FF; border-radius: calc(12 * var(--rpx));
}
.br-tip-tag {
  flex-shrink: 0; font-size: calc(20 * var(--rpx)); color: #4A6CF7;
  background: #FFFFFF; border-radius: calc(6 * var(--rpx));
  padding: calc(4 * var(--rpx)) calc(10 * var(--rpx)); margin-right: calc(12 * var(--rpx)); margin-top: calc(4 * var(--rpx));
}
.br-tip-text { flex: 1; font-size: calc(24 * var(--rpx)); color: #3E4A63; line-height: 1.6; }

.meta { text-align: right; font-size: calc(24 * var(--rpx)); color: #8A93A6; line-height: 1.9; }
.meta-v { color: #2A3240; font-weight: 600; }

.progress-track {
  margin: calc(24 * var(--rpx)) 0 calc(16 * var(--rpx));
  height: calc(12 * var(--rpx));
  background: #EEF1F6;
  border-radius: calc(999 * var(--rpx));
  overflow: hidden;
}
.progress-bar { height: 100%; background: linear-gradient(90deg, #4A6CF7, #6E8BFF); border-radius: calc(999 * var(--rpx)); transition: width 0.3s; }

.status-line { font-size: calc(26 * var(--rpx)); color: #5A6478; margin-bottom: calc(12 * var(--rpx)); min-height: calc(40 * var(--rpx)); }
.hint-line {
  font-size: calc(26 * var(--rpx)); color: #D9730D; background: #FFF6EA;
  border-radius: calc(12 * var(--rpx)); padding: calc(14 * var(--rpx)) calc(18 * var(--rpx)); margin-bottom: calc(16 * var(--rpx)); line-height: 1.6;
}

/* 唯一面向使用者的采集状态：到底有没有识别到人脸。
   三态配色（绿/红/灰）比任何数字都直观 —— "肤色 47%" 使用者根本无法判断好坏。 */
.face-row {
  display: flex; align-items: center;
  padding: calc(18 * var(--rpx)) calc(20 * var(--rpx)); border-radius: calc(12 * var(--rpx)); margin-bottom: calc(16 * var(--rpx));
  background: #F6F8FC;
}
.face-dot {
  width: calc(16 * var(--rpx)); height: calc(16 * var(--rpx)); border-radius: 50%;
  margin-right: calc(14 * var(--rpx)); background: #C3CAD6; flex-shrink: 0;
}
.face-text { flex: 1; font-size: calc(28 * var(--rpx)); font-weight: 600; color: #5A6478; }
.face-more { font-size: calc(22 * var(--rpx)); color: #A2AABB; flex-shrink: 0; }

.face-row.ok { background: #EAF9F0; }
.face-row.ok .face-dot { background: #22C55E; }
.face-row.ok .face-text { color: #177A3E; }

.face-row.bad { background: #FFF1F1; }
.face-row.bad .face-dot { background: #E85B5B; }
.face-row.bad .face-text { color: #B33030; }

/* 内部参数：默认收起，点"详情"才展开（排障用，不给普通使用者看） */
.diag {
  display: flex; justify-content: space-between; flex-wrap: wrap;
  background: #F6F8FC; border-radius: calc(12 * var(--rpx)); padding: calc(16 * var(--rpx)) calc(18 * var(--rpx)); margin-bottom: calc(20 * var(--rpx));
}
/* 详情有 6 项，一行挤不下 → 固定 1/3 宽排两行 */
.diag-item {
  display: flex; flex-direction: column; align-items: center;
  flex: 0 0 33.33%; margin-bottom: calc(12 * var(--rpx));
}
.d-label { font-size: calc(22 * var(--rpx)); color: #8A93A6; margin-bottom: calc(6 * var(--rpx)); }
.d-val { font-size: calc(28 * var(--rpx)); font-weight: 600; color: #2A3240; }

.btn-row { display: flex; gap: calc(16 * var(--rpx)); margin-bottom: calc(16 * var(--rpx)); }
.btn-mini {
  flex: 1; font-size: calc(26 * var(--rpx)); padding: calc(14 * var(--rpx)) 0; margin: 0;
  background: #EEF1F6; color: #5A6478; border-radius: calc(12 * var(--rpx)); line-height: 1.5;
}
.btn-disabled {
  font-size: calc(30 * var(--rpx)); padding: calc(20 * var(--rpx)) 0; background: #EEF1F6;
  color: #A2AABB; border-radius: calc(12 * var(--rpx)); line-height: 1.5;
}

/* 刚保存的记录：结束后面板上直接可见，不用去猜存没存上 */
.saved-row { display: flex; align-items: baseline; margin-bottom: calc(8 * var(--rpx)); }
.saved-big { display: flex; align-items: baseline; }
.saved-num { font-size: calc(64 * var(--rpx)); font-weight: 700; color: #4A6CF7; line-height: 1; }
.saved-unit { font-size: calc(24 * var(--rpx)); color: #8A93A6; margin-left: calc(8 * var(--rpx)); }
.saved-br { margin-left: calc(40 * var(--rpx)); }
.saved-num2 { font-size: calc(44 * var(--rpx)); font-weight: 700; color: #4A6CF7; line-height: 1; }
.saved-detail { font-size: calc(24 * var(--rpx)); line-height: 1.8; }

.tips { line-height: 2; }

/* ↓ miniprogram/pages/monitor/monitor.wxss */
.page { padding-bottom: calc(40 * var(--rpx)); }

.intro { line-height: 1.8; margin-bottom: calc(24 * var(--rpx)); }

.count-block.right { text-align: right; }
.count-num { font-size: calc(64 * var(--rpx)); font-weight: 700; color: #4A6CF7; line-height: 1.2; }

.meter-track {
  margin: calc(28 * var(--rpx)) 0 calc(12 * var(--rpx));
  height: calc(20 * var(--rpx));
  background: #EEF1F6;
  border-radius: calc(999 * var(--rpx));
  overflow: hidden;
}
.meter-bar {
  height: 100%;
  background: linear-gradient(90deg, #4ADE80, #E8B33A, #D64545);
  border-radius: calc(999 * var(--rpx));
  transition: width 0.15s;
}
.meter-tip { text-align: center; }

.bars {
  display: flex;
  align-items: flex-end;
  height: calc(140 * var(--rpx));
  gap: calc(6 * var(--rpx));
  margin-bottom: calc(12 * var(--rpx));
}
.bar-wrap { flex: 1; display: flex; align-items: flex-end; height: 100%; }
.bar { width: 100%; min-height: calc(8 * var(--rpx)); border-radius: calc(6 * var(--rpx)) calc(6 * var(--rpx)) 0 0; }
.b0 { background: #C9D0DB; }
.b1 { background: #6E9BFF; }
.b2 { background: #E8B33A; }
.b3 { background: #D64545; }

.slider { flex: 1; margin: 0 calc(16 * var(--rpx)); }
.stop-btn { margin: calc(20 * var(--rpx)) calc(24 * var(--rpx)); }

/* ↓ miniprogram/pages/assess/assess.wxss */
.page { padding-bottom: calc(40 * var(--rpx)); }

.age-input {
  border: calc(2 * var(--rpx)) solid #E3E8F0;
  border-radius: calc(12 * var(--rpx));
  padding: calc(12 * var(--rpx)) calc(20 * var(--rpx));
  font-size: calc(30 * var(--rpx));
  margin-bottom: calc(12 * var(--rpx));
}

.q-sub { margin-bottom: calc(8 * var(--rpx)); }

.q { border-top: calc(2 * var(--rpx)) solid #F0F3F8; padding: calc(24 * var(--rpx)) 0 calc(8 * var(--rpx)); }
.q-domain { font-size: calc(22 * var(--rpx)); color: #4A6CF7; margin-bottom: calc(6 * var(--rpx)); }
.q-text { font-size: calc(28 * var(--rpx)); margin-bottom: calc(16 * var(--rpx)); line-height: 1.6; }

/* 七点 Likert：显示「从未 / 很少 / 偶尔 / 有时 / 多数时候 / 经常 / 总是」，
   不是 1~7 的数字。让家长凭印象选词，比让他们理解"4 分代表什么"可靠得多。 */
.opts { display: flex; flex-wrap: wrap; gap: calc(10 * var(--rpx)); }
.opt {
  flex: 0 0 auto;
  min-width: calc(96 * var(--rpx));
  text-align: center;
  padding: calc(12 * var(--rpx)) calc(18 * var(--rpx));
  border-radius: calc(10 * var(--rpx));
  background: #F3F5FA;
  color: #5A6478;
  font-size: calc(24 * var(--rpx));
}
.opt.on { background: #4A6CF7; color: #fff; font-weight: 600; }

.likert-hint {
  display: flex; justify-content: space-between;
  font-size: calc(20 * var(--rpx)); color: #B6BDCC; margin-top: calc(6 * var(--rpx));
}

.total { font-size: calc(40 * var(--rpx)); font-weight: 700; color: #4A6CF7; }

/* ↓ miniprogram/pages/report/report.wxss */
.page { padding-bottom: calc(40 * var(--rpx)); }

.score-card { text-align: center; padding: calc(48 * var(--rpx)) calc(28 * var(--rpx)); }
.score-label { font-size: calc(26 * var(--rpx)); color: #8A93A6; margin-bottom: calc(12 * var(--rpx)); }
.score-num { font-size: calc(120 * var(--rpx)); font-weight: 700; line-height: 1.1; }
.score-level {
  display: inline-block;
  color: #fff;
  font-size: calc(30 * var(--rpx));
  font-weight: 600;
  border-radius: calc(999 * var(--rpx));
  padding: calc(8 * var(--rpx)) calc(44 * var(--rpx));
  margin: calc(16 * var(--rpx)) 0 calc(20 * var(--rpx));
}
.weight-line { margin-top: calc(10 * var(--rpx)); }

.up-item { font-size: calc(26 * var(--rpx)); color: #D64545; line-height: 1.9; }

.part { margin-bottom: calc(28 * var(--rpx)); }
.part-name { font-size: calc(28 * var(--rpx)); font-weight: 600; }
.part-score { font-size: calc(28 * var(--rpx)); font-weight: 700; color: #4A6CF7; }
.part-score.na { color: #B7BECC; font-weight: 400; }
.track {
  height: calc(14 * var(--rpx));
  background: #EEF1F6;
  border-radius: calc(999 * var(--rpx));
  overflow: hidden;
  margin: calc(12 * var(--rpx)) 0 calc(10 * var(--rpx));
}
.fill { height: 100%; background: linear-gradient(90deg, #4A6CF7, #6E8BFF); border-radius: calc(999 * var(--rpx)); }

.metric { margin-bottom: calc(24 * var(--rpx)); }
.metric-name { font-size: calc(28 * var(--rpx)); font-weight: 600; }
.metric-val { font-size: calc(26 * var(--rpx)); color: #5A6478; margin-top: calc(10 * var(--rpx)); }
.tip { margin-top: calc(8 * var(--rpx)); }

.suggestion { font-size: calc(27 * var(--rpx)); line-height: 1.9; color: #3A4254; }

/* 五列（日期/心率/呼吸/鼾声/问卷）挤在一行：字号压到 calc(22 * var(--rpx))，日期列给宽一点 */
.h-row { display: flex; padding: calc(12 * var(--rpx)) 0; font-size: calc(22 * var(--rpx)); border-bottom: calc(1 * var(--rpx)) solid #F0F2F7; }
.h-head { color: #8A93A6; }
.c1 { flex: 1.5; }
.c2 { flex: 1; text-align: center; }
.h-times { font-size: calc(18 * var(--rpx)); color: #B6BDCC; margin-left: calc(4 * var(--rpx)); }

.quick-row { display: flex; gap: calc(16 * var(--rpx)); }
.qbtn { flex: 1; }

/* ↓ miniprogram/pages/mine/mine.wxss */
.form-row {
  display: flex;
  align-items: center;
  padding: calc(20 * var(--rpx)) 0;
  border-bottom: calc(1 * var(--rpx)) solid #F0F2F7;
}
.label { width: calc(200 * var(--rpx)); font-size: calc(27 * var(--rpx)); color: #5A6478; flex-shrink: 0; }
.input { flex: 1; font-size: calc(28 * var(--rpx)); }

.stat-row { justify-content: space-around; padding: calc(20 * var(--rpx)) 0 calc(28 * var(--rpx)); }
.stat { text-align: center; flex: 1; }
.stat-num { font-size: calc(44 * var(--rpx)); font-weight: 700; color: #4A6CF7; }

/* picker 的触发区必须撑满，否则点右侧空白没反应 */
.picker-val { color: #2A3240; }
.picker-val:empty::before { content: '请选择'; color: #B0B8C6; }

.bmi-row {
  display: flex;
  align-items: center;
  padding: calc(18 * var(--rpx)) 0 calc(4 * var(--rpx));
}
.bmi-val { font-size: calc(30 * var(--rpx)); font-weight: 600; color: #4A6CF7; }

.about { line-height: 2; }
.disclaimer { background: #FFF9EF; }

/* ↓ miniprogram/pages/records/records.wxss */
.tabs {
  display: flex;
  background: #fff;
  margin: calc(20 * var(--rpx)) calc(24 * var(--rpx)) 0;
  border-radius: calc(16 * var(--rpx));
  overflow: hidden;
}
.tab {
  flex: 1;
  text-align: center;
  padding: calc(20 * var(--rpx)) 0;
  font-size: calc(28 * var(--rpx));
  color: #8A93A6;
}
.tab.on {
  color: #4A6CF7;
  font-weight: 600;
  border-bottom: calc(4 * var(--rpx)) solid #4A6CF7;
}

.rec-head { display: flex; align-items: center; }
.rec-title { font-size: calc(34 * var(--rpx)); font-weight: 700; color: #2A3240; }
.grade {
  margin-left: calc(16 * var(--rpx));
  background: #EEF2FE;
  color: #4A6CF7;
}
.rec-sub { margin-top: calc(6 * var(--rpx)); }

.rec-row {
  display: flex;
  justify-content: space-between;
  padding: calc(14 * var(--rpx)) 0;
  border-top: calc(2 * var(--rpx)) solid #F0F3F8;
  margin-top: calc(8 * var(--rpx));
}
.rk { color: #8A93A6; font-size: calc(26 * var(--rpx)); flex-shrink: 0; }
.rv { color: #2A3240; font-size: calc(26 * var(--rpx)); text-align: right; margin-left: calc(24 * var(--rpx)); }

/* ↓ 网站外壳自有样式 */
/* ==========================================================================
   网站外壳样式（小程序没有的部分：导航栏 / 底部 tab / 弹窗 / 桌面居中）
   页面内样式全部由 miniprogram/**/*.wxss 机械转换而来，不在这里重写。
   ========================================================================== */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: #EDEFF5;
  color: #2A3240;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei",
               "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: #F5F7FB;
  overflow-x: hidden;
  padding-bottom: calc(56px + var(--safe-b));
  box-shadow: 0 0 40px rgba(20, 30, 60, 0.08);
}

/* ---------- 顶部导航（替代小程序的 navigationBar） ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  height: 48px;
  padding: 0 12px;
  background: #4A6CF7;
  color: #fff;
  font-size: 17px;
  font-weight: 600;
}
.nav-title { flex: 1; text-align: center; }
.nav-back, .nav-right { min-width: 34px; text-align: center; }
.nav-back { font-size: 26px; line-height: 1; cursor: pointer; user-select: none; }
.nav-back:active { opacity: 0.6; }

/* ---------- 底部 tabBar（替代 app.json 的 tabBar） ---------- */
.tabbar {
  position: fixed;
  z-index: 60;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: min(100vw, 430px);
  display: flex;
  background: #FFFFFF;
  border-top: 1px solid #E6EAF2;
  padding-bottom: var(--safe-b);
}
.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 56px;
  color: #9AA3B2;
  font-size: 11px;
  text-decoration: none;
  cursor: pointer;
}
.tabbar .tab i { font-style: normal; font-size: 20px; line-height: 1.2; }
.tabbar .tab.on { color: #4A6CF7; }

/* ---------- 页面容器 ---------- */
.page-root { min-height: calc(100vh - 48px - 56px); }
.sg-page { padding-bottom: calc(20 * var(--rpx)); }

/* ---------- 统一的按钮外观（小程序 button 有默认样式，web 要自己给） ---------- */
button {
  display: block;
  width: 100%;
  border: 0;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.5;
}
button:active { opacity: 0.85; }
button[disabled] { opacity: 0.5; cursor: default; }
.btn-primary.disabled { background: #B9C4F9; }
.btn-mini { width: auto; }

/* ---------- 表单控件 ---------- */
input, select {
  font-family: inherit;
  border: 0;
  background: transparent;
  color: inherit;
  outline: none;
  width: 100%;
}
input[type="range"] { padding: 0; -webkit-appearance: none; appearance: none; height: 28px; background: transparent; }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; background: #E3E8F0; border-radius: 999px; }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -9px;
  border-radius: 50%; background: #4A6CF7; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
input[type="range"]::-moz-range-track { height: 4px; background: #E3E8F0; border-radius: 999px; }
input[type="range"]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #4A6CF7; border: 2px solid #fff; }
input[type="date"] { color: #2A3240; }
.age-input { border: calc(2 * var(--rpx)) solid #E3E8F0; border-radius: calc(12 * var(--rpx)); }

/* ---------- 摄像头（小程序 <camera> → web <video> + 引导框） ---------- */
.camera-wrap { background: #1A2030; }
#cam-layer[hidden] { display: none; }
video.camera {
  object-fit: cover;              /* 与采集端的 cover 裁剪保持一致，见 media.js */
  background: #1A2030;
}
video.camera.mirror { transform: scaleX(-1); }   /* 前置自拍镜像，仅影响观感不影响采样 */
.guide-box { pointer-events: none; }
.guide-corner { position: absolute; }

/* ---------- Toast / Modal ---------- */
.sg-toast-layer {
  position: fixed;
  z-index: 200;
  left: 0; right: 0; top: 40%;
  display: flex; flex-direction: column; align-items: center;
  pointer-events: none;
}
.sg-toast {
  max-width: 76%;
  padding: 12px 18px;
  margin-bottom: 10px;
  background: rgba(26, 32, 48, 0.92);
  color: #fff;
  font-size: 14px;
  line-height: 1.6;
  border-radius: 10px;
  text-align: center;
  animation: sg-fade-in 0.18s ease-out;
}
.sg-toast.success::before { content: "✓ "; color: #4ADE80; }
@keyframes sg-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.sg-mask {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(20, 26, 40, 0.45);
  padding: 24px;
  animation: sg-fade-in 0.15s ease-out;
}
.sg-modal {
  width: 100%; max-width: 320px;
  background: #fff; border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(20, 30, 60, 0.25);
}
.sg-modal-title { padding: 22px 20px 0; font-size: 17px; font-weight: 600; text-align: center; }
.sg-modal-body {
  padding: 12px 22px 22px;
  font-size: 14px; line-height: 1.75; color: #5A6478;
  text-align: center; white-space: pre-wrap; word-break: break-word;
}
.sg-modal-btns { display: flex; border-top: 1px solid #EEF1F6; }
.sg-modal-btns button {
  flex: 1; padding: 13px 0; background: #fff;
  font-size: 16px; color: #5A6478; border-radius: 0;
}
.sg-modal-btns button + button { border-left: 1px solid #EEF1F6; }
.sg-modal-btns button.ok { color: #4A6CF7; font-weight: 600; }
.sg-modal-btns button.danger { color: #D64545; font-weight: 600; }

/* ---------- 采集不可用提示条（http 打开时出现在测量页顶部） ---------- */
.warn-banner {
  border-left: calc(6 * var(--rpx)) solid #E08A00;
  background: #FFF8EC;
}
.warn-banner .card-title { color: #B36B00; }
.warn-banner .muted { line-height: 1.7; }

/* 滑块：小程序 <slider> 的替身，占满中间那一列 */
.slider { flex: 1; margin: 0 calc(12 * var(--rpx)); }

.noscript { padding: 40px; text-align: center; color: #5A6478; }

/* ---------- 桌面端：给个背景，别让他悬在白色里 ---------- */
@media (min-width: 700px) {
  body { padding: 0; }
}
