/* 健康体质调查表 · 样式 */
:root {
  --ink: #1f2a24;
  --ink-2: #4a5a51;
  --ink-3: #7d8c84;
  --line: #e3e8e2;
  --bg: #f5f7f3;
  --card: #ffffff;
  --brand: #2f6b4f;
  --brand-2: #3f8a63;
  --brand-soft: #eaf3ed;
  --accent: #b8860b;
  --danger: #c0392b;
  --warn-bg: #fff8e6;
  --warn-line: #f0d9a0;
  --info-bg: #eef5ff;
  --info-line: #c9dcf7;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(31, 42, 36, .06);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; }
p { margin: 0 0 10px; }
button { font-family: inherit; }
.hidden { display: none !important; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.wrap { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 720px; }

/* 顶栏 */
.topbar {
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-2) 100%);
  color: #fff;
  padding: 14px 0;
  box-shadow: var(--shadow);
  position: sticky; top: 0; z-index: 50;
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .logo { font-size: 26px; }
.brand h1 { font-size: 18px; }
.brand p { margin: 0; font-size: 12px; opacity: .85; }
.badge {
  background: rgba(255, 255, 255, .2);
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 999px; padding: 4px 12px; font-size: 12px;
}
.topbar a, .topbar .link { color: #fff; text-decoration: none; font-size: 13px; opacity: .9; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  margin: 18px 0;
  border: 1px solid var(--line);
}
.screen { padding-bottom: 60px; }

/* 康养者欢迎卡 */
.welcome-card { padding: 24px 22px; }
.welcome-hero { text-align: center; margin-bottom: 14px; }
.welcome-hero .hero-emoji { font-size: 40px; display: block; line-height: 1.2; }
.welcome-card h2 { font-size: 21px; color: var(--brand); margin: 6px 0 8px; }
.welcome-lead { font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.tip-list { font-size: 13.5px; }
.tip-list li { margin-bottom: 4px; }
.disclosure {
  border: 1px solid var(--line); border-radius: 10px; background: #fbfdfb;
  padding: 8px 12px; margin-top: 8px;
}
.disclosure summary {
  cursor: pointer; font-size: 13.5px; color: var(--brand); font-weight: 500;
  list-style: none; padding: 2px 0;
}
.disclosure summary::-webkit-details-marker { display: none; }
.disclosure summary::before { content: '▸ '; color: var(--brand-2); }
.disclosure[open] summary::before { content: '▾ '; }
.disclosure .disclaimer { margin: 10px 0 4px; }
.disclosure .part-list { margin: 10px 0 4px; }
.intro-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
#draftHint { margin: 10px 0 0; text-align: center; }

/* 管理员登录（欢迎界面下方） */
.admin-login-card { padding: 18px 20px; background: #fafbfa; border-style: dashed; }
.al-head { margin-bottom: 12px; }
.al-head h3 { font-size: 15px; color: var(--ink-2); }
.al-head p { margin: 4px 0 0; }
.al-form { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.al-form .field { flex: 1 1 220px; }
.al-actions { display: flex; gap: 10px; flex-wrap: wrap; flex: 1 1 100%; }
.admin-login-card .error-box { margin-top: 12px; }

/* 页脚 */
.site-foot {
  margin-top: 10px; padding: 22px 0 30px; border-top: 1px solid var(--line);
  text-align: center; color: var(--ink-3); font-size: 12px; background: #f0f3ef;
}
.site-foot .foot-note { margin: 0 0 6px; }
.site-foot .foot-admin { margin: 0; }
.admin-entry {
  color: #9aa8a0; text-decoration: none; font-size: 12px;
  border-bottom: 1px dashed #c6d0c9; padding-bottom: 1px;
}
.admin-entry:hover { color: var(--brand); border-bottom-color: var(--brand); }

.disclaimer {
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  color: #7a5b12;
}
.part-list, .tip-list, .guide-list, .mini-list { margin: 0; padding-left: 20px; font-size: 14px; color: var(--ink-2); }
.part-list li, .tip-list li { margin-bottom: 6px; }
.guide-list li, .mini-list li { margin-bottom: 4px; }
.intro-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.footnote { text-align: center; color: var(--ink-3); font-size: 12px; }

/* 按钮 */
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 15px;
  cursor: pointer;
  transition: .15s;
}
.btn:hover { border-color: var(--brand-2); color: var(--brand); }
.btn.primary {
  background: var(--brand); border-color: var(--brand); color: #fff;
  box-shadow: 0 2px 8px rgba(47, 107, 79, .25);
}
.btn.primary:hover { background: var(--brand-2); color: #fff; }
.btn.primary.submit { background: #b4451f; border-color: #b4451f; box-shadow: 0 2px 8px rgba(180, 69, 31, .25); }
.btn.ghost { background: transparent; }
.btn.big { padding: 13px 30px; font-size: 16px; }
.btn.small { padding: 7px 14px; font-size: 13px; }
.btn.tiny { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* 进度 */
.progress-bar { margin: 18px 0 0; }
.progress-track { height: 6px; background: #e2e7e1; border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width .3s; }
.step-chips { display: flex; gap: 8px; overflow-x: auto; padding: 12px 2px 4px; -webkit-overflow-scrolling: touch; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  border: 1px solid var(--line); background: #fff; color: var(--ink-3);
  border-radius: 999px; padding: 5px 12px; font-size: 12.5px; cursor: pointer;
}
.chip-no {
  width: 18px; height: 18px; border-radius: 50%; background: #eef1ee; color: var(--ink-3);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
}
.chip.current { border-color: var(--brand); color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.chip.current .chip-no { background: var(--brand); color: #fff; }
.chip.done { color: var(--brand-2); border-color: #cfe3d6; }
.chip.done .chip-no { background: #cfe3d6; color: #2f6b4f; }

/* 步骤头 */
.step-head { border-bottom: 1px dashed var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.step-no {
  display: inline-block; background: var(--brand-soft); color: var(--brand);
  font-size: 12px; padding: 2px 10px; border-radius: 999px; margin-bottom: 6px;
}
.step-head h2 { font-size: 19px; }
.step-subtitle { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; }
.block-subtitle {
  font-size: 15px; margin: 22px 0 10px; padding-left: 10px;
  border-left: 3px solid var(--brand); color: var(--brand);
}

/* 提示条 */
.note { border-radius: 10px; padding: 11px 14px; font-size: 13.5px; margin: 12px 0; }
.note.info { background: var(--info-bg); border: 1px solid var(--info-line); color: #24486f; }
.note.warn { background: var(--warn-bg); border: 1px solid var(--warn-line); color: #7a5b12; }

/* 字段 */
.fields-grid { display: flex; flex-wrap: wrap; gap: 14px 16px; margin: 10px 0 4px; }
.field { position: relative; }
.field.w-full { flex: 1 1 100%; }
.field.w-half { flex: 1 1 calc(50% - 8px); min-width: 200px; }
.field.w-third { flex: 1 1 calc(33.33% - 11px); min-width: 140px; }
.field-label { display: block; font-size: 13.5px; color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.field-label .req { color: var(--danger); }
.input {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 15px; font-family: inherit; color: var(--ink);
  background: #fdfefd; transition: .15s;
}
.input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(63, 138, 99, .12); background: #fff; }
.input.textarea { resize: vertical; line-height: 1.6; }
.input.invalid, .pill.invalid, .pills.invalid { border-color: var(--danger) !important; box-shadow: 0 0 0 3px rgba(192, 57, 43, .1); }
.unit { position: absolute; right: 12px; bottom: 10px; font-size: 12px; color: var(--ink-3); pointer-events: none; }
.field-error { color: var(--danger); font-size: 12px; margin-top: 4px; }

/* 药丸选项 */
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  border: 1px solid var(--line); background: #fff; color: var(--ink-2);
  border-radius: 999px; padding: 8px 16px; font-size: 14px; cursor: pointer; transition: .15s;
}
.pill:hover { border-color: var(--brand-2); color: var(--brand); }
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.pill-abc { min-width: 108px; text-align: center; }
.pill-life { min-width: 92px; text-align: center; }
.checkbox-holder { padding: 8px 0; }
.checkbox-line { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.checkbox-line input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--brand); flex: none; }

/* 题目组 */
.qgroup { border: 1px solid var(--line); border-radius: 12px; margin: 14px 0; overflow: hidden; background: #fff; }
.qgroup-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #f7faf7; padding: 10px 14px; border-bottom: 1px solid var(--line);
}
.qgroup-head h4 { font-size: 14.5px; color: var(--brand); }
.qgroup-head .tag { font-size: 12px; color: var(--ink-3); }
.q-row {
  display: flex; align-items: center; gap: 14px; padding: 11px 14px;
  border-bottom: 1px solid #f1f4f0; flex-wrap: wrap;
}
.q-row:last-child { border-bottom: none; }
.q-row.invalid { background: #fff6f5; box-shadow: inset 3px 0 0 var(--danger); }
.q-text { flex: 1 1 320px; font-size: 14.5px; display: flex; gap: 8px; align-items: baseline; }
.q-no { color: var(--brand-2); font-weight: 600; font-size: 13px; min-width: 20px; }
.q-row.compact .q-text { font-size: 14px; }

/* 照片 */
.photo-box { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; background: #fcfdfc; }
.hidden-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.photo-drop {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  border-radius: 10px; padding: 18px 10px; cursor: pointer; text-align: center;
  background: #fff; border: 1px solid var(--line);
}
.photo-drop:hover { border-color: var(--brand-2); }
.photo-icon { font-size: 24px; }
.photo-tip { font-size: 12.5px; color: var(--ink-2); }
.photo-preview { margin-top: 10px; text-align: center; }
.photo-preview img { max-width: 100%; max-height: 260px; border-radius: 10px; border: 1px solid var(--line); }

/* 汇总 */
.summary-card { background: #fbfdfb; border: 1px solid var(--line); border-radius: 12px; padding: 6px 16px 14px; }
.sum-block { padding: 12px 0; border-bottom: 1px dashed var(--line); }
.sum-block:last-child { border-bottom: none; }
.sum-block h4 { font-size: 14px; color: var(--brand); margin-bottom: 8px; }
.kv-grid { display: flex; flex-wrap: wrap; gap: 8px 18px; }
.kv { font-size: 14px; }
.kv .k { color: var(--ink-3); margin-right: 6px; font-size: 13px; }
.kv .v { font-weight: 500; }
.kv .v.empty { color: var(--ink-3); font-weight: 400; }
.score-list { display: flex; flex-direction: column; gap: 8px; }
.score-line { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.score-name { flex: 0 0 132px; color: var(--ink-2); }
.score-track { flex: 1; height: 8px; background: #edf0ed; border-radius: 999px; overflow: hidden; }
.score-fill { height: 100%; background: linear-gradient(90deg, #d98c3a, #c0392b); border-radius: 999px; }
.score-fill.good { background: linear-gradient(90deg, var(--brand-2), var(--brand)); }
.score-val { flex: 0 0 52px; text-align: right; color: var(--ink-3); }

/* 错误框 */
.error-box {
  margin-top: 16px; background: #fdf0ee; border: 1px solid #f3c9c2;
  border-left: 4px solid var(--danger); border-radius: 10px; padding: 12px 14px;
  color: #96271a; font-size: 14px;
}
.error-box ul { margin: 6px 0 0; padding-left: 20px; }

/* 底部导航 */
.nav-bar {
  position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px;
  background: rgba(245, 247, 243, .95); backdrop-filter: blur(6px);
  padding: 12px 0; margin-top: 8px; border-top: 1px solid var(--line);
}
.nav-spacer { flex: 1; }

/* 完成页 */
.done-card { text-align: center; padding: 34px 20px; }
.done-icon { font-size: 44px; }
.done-card h2 { font-size: 20px; color: var(--brand); margin: 8px 0 12px; }
.done-id { font-size: 15px; }
.done-id b { color: var(--accent); letter-spacing: .5px; }
.done-time { color: var(--ink-3); font-size: 13px; }
.done-note { background: var(--brand-soft); border-radius: 10px; padding: 14px; margin: 16px 0; font-size: 14px; color: var(--ink-2); text-align: left; }

/* 提交遮罩 */
.loading {
  position: fixed; inset: 0; background: rgba(255, 255, 255, .86);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  z-index: 99; font-size: 15px; color: var(--brand);
}
.spinner {
  width: 38px; height: 38px; border: 4px solid var(--brand-soft);
  border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .wrap { padding: 0 12px; }
  .card { padding: 16px 14px; }
  .field.w-half, .field.w-third { flex: 1 1 100%; }
  .q-text { flex: 1 1 100%; }
  .pills { width: 100%; }
  .pill-abc, .pill-life { flex: 1 1 30%; min-width: 84px; padding: 9px 6px; font-size: 13px; }
  .brand h1 { font-size: 16px; }
  .brand p { display: none; }
}
