/* 患者端样式：适老化，大字体、高对比、整行卡片选项（见 SPEC §6）。
   零外部资源，纯本地 CSS。主色医疗蓝绿 #0e7490 系。 */

:root {
  --primary: #0e7490;
  --primary-dark: #0b5c72;
  --primary-light: #e0f2f7;
  --text: #1a1a1a;
  --muted: #5a6b72;
  --bg: #f4f7f8;
  --card: #ffffff;
  --ok: #15803d;
  --danger: #b91c1c;
  --border: #cfd8dc;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 20px;               /* 基础字号 ≥20px */
  line-height: 1.7;              /* 行高 ≥1.6 */
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 18px calc(120px + env(safe-area-inset-bottom, 0px));
  overflow-wrap: break-word;
}

.topbar {
  background: var(--primary);
  color: #fff;
  padding: 14px 84px;   /* 两侧留出字体切换按钮的位置，长标题自动换行不重叠 */
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.scale-title {
  font-size: 23px; font-weight: 800; margin: 6px 0 2px;
  word-break: keep-all; overflow-wrap: anywhere;
}
.scale-meta { color: var(--muted); font-size: 17px; margin-bottom: 12px; }
.instruction {
  background: var(--primary-light);
  border-left: 6px solid var(--primary);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 19px;
  margin: 14px 0;
}

.card {
  background: var(--card);
  border-radius: 12px;
  padding: 18px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  margin-bottom: 16px;
}

/* 进度条 */
.progress {
  position: sticky;
  top: 0;
  z-index: 15;
  background: var(--bg);
  padding: 12px 0 6px;
}
.progress-text { font-size: 18px; color: var(--muted); margin-bottom: 6px; text-align: center; }
.progress-bar { height: 12px; background: #dbe7eb; border-radius: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--primary); width: 0; transition: width .25s ease; }

/* 题目 */
.q-card { display: none; }
.q-card.active { display: block; }
.q-card.q-invalid { outline: 3px solid var(--danger); outline-offset: 2px; }
.q-no { color: var(--primary); font-weight: 800; font-size: 19px; }
.q-text { font-size: 23px; font-weight: 700; line-height: 1.6; margin: 6px 0 4px; }  /* 题干 22-24px 加粗 */
.q-help { color: var(--muted); font-size: 17px; margin-bottom: 10px; }
.q-section { color: var(--primary-dark); font-weight: 800; font-size: 20px; margin: 4px 0 10px; }

/* 整行大卡片选项 */
.options { margin-top: 12px; }
.opt {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 60px;             /* 高度 ≥56px */
  padding: 12px 16px;
  margin-bottom: 12px;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  font-size: 21px;
  text-align: left;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.opt:active { background: #eef6f9; }
.opt .opt-label { flex: 1; }
.opt .opt-desc { display:block; color: var(--muted); font-size: 16px; margin-top: 2px; }
.opt .opt-check {
  width: 30px; height: 30px; flex: 0 0 30px; margin-left: 12px;
  border-radius: 50%; border: 2px solid var(--border); position: relative;
}
.opt.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  font-weight: 700;
}
.opt.selected .opt-check { background: var(--primary); border-color: var(--primary); }
.opt.selected .opt-check::after {
  content: ""; position: absolute; left: 9px; top: 4px;
  width: 8px; height: 15px; border: solid #fff; border-width: 0 4px 4px 0;
  transform: rotate(45deg);
}

/* 数值/时间/文本输入 */
.field { margin-top: 10px; display: flex; align-items: center; gap: 10px; }
.field input[type=number], .field input[type=time], .field input[type=text] {
  font-size: 22px;
  padding: 14px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  width: 100%;
  max-width: 260px;
}
.field .unit { font-size: 19px; color: var(--muted); }
.info-text { font-size: 19px; color: var(--text); background:#fbfdfe; border:1px dashed var(--border); border-radius:10px; padding:12px 14px; }

/* 底部固定导航 */
.navbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  background: #fff; border-top: 1px solid var(--border);
  display: flex; gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
  z-index: 30;
}
.btn {
  flex: 1; min-height: 54px;      /* 大按钮 ≥52px */
  font-size: 21px; font-weight: 700;
  border: none; border-radius: 12px; cursor: pointer;
  padding: 12px;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); }
.btn-ghost { background: #eef2f4; color: var(--text); }
.btn-primary:disabled { background: #9bbcc7; cursor: not-allowed; }
.btn-block { width: 100%; }

.hint { color: var(--danger); font-size: 18px; margin-top: 10px; min-height: 24px; }
.hint.soft { color: var(--muted); }

/* 状态徽章 */
.badge { display:inline-block; padding: 3px 12px; border-radius: 999px; font-size: 16px; font-weight: 700; white-space: nowrap; }
.badge-done { background: #dcfce7; color: var(--ok); }
.badge-todo { background: #fef3c7; color: #92400e; }

/* 入口/同意页 */
.consent { font-size: 19px; line-height: 1.8; white-space: pre-wrap; }
.scale-list-item {
  display:flex; align-items:center; justify-content: space-between;
  padding: 14px 4px; border-bottom: 1px solid #eef2f4; font-size: 20px;
}
.scale-list-item:last-child { border-bottom: none; }

/* 患者自选问卷大卡片（适老化：大字号、大点击区） */
.pick-card {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 78px; padding: 18px 20px; margin-bottom: 14px;
  border: 2px solid #cfe0e6; border-radius: 14px; background: #fff;
  font-size: 22px; line-height: 1.5; text-decoration: none; color: var(--text);
}
.pick-card:last-child { margin-bottom: 0; }
.pick-card-todo:active { background: #eef7fa; }
.pick-card-done { border-style: dashed; border-color: #dbe3e6; background: #f7f9fa; color: var(--muted); }
.pick-name { font-weight: 700; }
.pick-go { color: var(--primary); font-size: 19px; white-space: nowrap; }

/* 完成页 */
.done-wrap { text-align: center; padding: 60px 20px; }
.done-check {
  width: 110px; height: 110px; margin: 0 auto 20px;
  border-radius: 50%; background: var(--ok);
  position: relative; animation: pop .4s ease;
}
.done-check::after {
  content:""; position:absolute; left:38px; top:22px;
  width: 26px; height: 52px; border: solid #fff; border-width: 0 10px 10px 0;
  transform: rotate(45deg);
}
@keyframes pop { 0% { transform: scale(.4); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.done-title { font-size: 26px; font-weight: 800; margin: 10px 0; }
.done-sub { font-size: 20px; color: var(--muted); }

.center { text-align: center; }
.mt { margin-top: 16px; }
.big-num { font-size: 40px; font-weight: 800; color: var(--primary); }
a { color: var(--primary); }

/* ---------- 适老化：字体三档缩放（zoom 在微信/主流移动浏览器均支持） ---------- */
body.font-lg { zoom: 1.15; }
body.font-xl { zoom: 1.3; }
body.font-lg .wrap { padding-bottom: calc(150px + env(safe-area-inset-bottom, 0px)); }
body.font-xl .wrap { padding-bottom: calc(180px + env(safe-area-inset-bottom, 0px)); }
.font-toggle {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.55); border-radius: 8px;
  font-size: 14px; padding: 6px 10px; cursor: pointer; white-space: nowrap;
}

/* ---------- 知情同意勾选（说明页：不悬浮，跟在问卷清单下方，避免遮挡清单） ---------- */
.navbar-consent {
  position: static;
  flex-direction: column;
  gap: 12px;
  background: var(--card);
  border: 2px solid var(--primary-light);
  border-radius: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  padding: 16px;
  margin-bottom: 16px;
}
.consent-check {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700; width: 100%;
}
.consent-check input[type=checkbox] {
  width: 26px; height: 26px; flex: 0 0 26px; accent-color: var(--primary);
}
.btn.disabled, .btn.disabled:active { background: #9bbcc7; }

/* ---------- 患者自填基本信息页 ---------- */
.info-field { margin: 18px 0; }
.info-label { display: block; font-size: 21px; font-weight: 800; margin-bottom: 10px; }
.info-input {
  width: 100%; font-size: 23px; padding: 16px 14px;
  border: 2px solid var(--border); border-radius: 12px;
}
.info-input:focus { border-color: var(--primary); outline: none; }
.sex-options { display: flex; gap: 14px; }
.sex-opt { flex: 1; position: relative; }
.sex-opt input {
  position: absolute; opacity: 0; width: 1px; height: 1px;
}
.sex-opt span {
  display: flex; align-items: center; justify-content: center;
  min-height: 64px; font-size: 23px; font-weight: 700;
  border: 2px solid var(--border); border-radius: 12px; background: #fff;
  cursor: pointer;
}
.sex-opt input:checked + span {
  border-color: var(--primary); background: var(--primary-light);
  color: var(--primary-dark);
}

/* ---------- 草稿续填提示条 ---------- */
.draft-banner {
  background: #fef9e7; border: 2px solid #f0d264; border-radius: 12px;
  padding: 14px 16px; margin-bottom: 16px;
}
.draft-banner-text { font-size: 19px; font-weight: 700; margin-bottom: 12px; }
.draft-banner-actions { display: flex; gap: 12px; }
.draft-banner-actions .btn { min-height: 48px; font-size: 19px; }

@media (max-width: 420px) {
  .topbar { padding-left: 68px; padding-right: 68px; }
  .scale-title { font-size: 22px; }
}
