:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --primary: #8b5a2b;
  --primary-light: #c8955f;
  --L: #6ba368;   /* 隆-绿 */
  --C: #d4553a;   /* 赤巴-红 */
  --P: #3a7ca8;   /* 培根-蓝 */
  --text: #2f2a25;
  --muted: #8a837a;
  --line: #e2dccf;
}

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

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 64px;
}

/* 顶部 */
.header {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; padding: 16px 20px 0;
}
.header-inner { display: flex; flex-direction: column; padding-bottom: 10px; }
.header h1 { font-size: 19px; font-weight: 600; }
.subtitle { font-size: 12px; opacity: 0.85; letter-spacing: 2px; }
.progress-wrap { height: 4px; background: rgba(255,255,255,0.3); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: #fff; transition: width 0.3s; }

/* 屏幕 */
.screen { display: none; padding: 20px; animation: fade .3s; }
.screen.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* 欢迎页 */
.welcome { text-align: center; padding: 40px 10px; }
.logo { font-size: 56px; margin-bottom: 12px; }
.welcome h2 { font-size: 20px; margin-bottom: 16px; }
.desc { color: var(--muted); font-size: 14px; margin-bottom: 20px; text-align: left; }
.notice { background: #fff8ee; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 12px; color: var(--primary); text-align: left; margin-bottom: 24px; }

/* 按钮 */
.btn-primary {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer;
}
.btn-primary:active { opacity: 0.85; }
.btn-ghost {
  padding: 12px 20px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--text); font-size: 15px; cursor: pointer;
}
.btn-ghost:disabled { opacity: 0.4; }

/* 问卷 */
.group-title { font-size: 13px; color: var(--primary); font-weight: 600; margin-bottom: 10px; letter-spacing: 1px; }
.question .q-text { font-size: 17px; font-weight: 600; margin-bottom: 16px; }
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; background: var(--card); border: 2px solid var(--line);
  border-radius: 12px; cursor: pointer; transition: all .2s;
}
.option.checked { border-color: var(--primary); background: #fdf6ee; }
.option input { display: none; }
.opt-dot { width: 20px; height: 20px; border: 2px solid var(--muted); border-radius: 50%; flex-shrink: 0; position: relative; }
.option.checked .opt-dot { border-color: var(--primary); }
.option.checked .opt-dot::after { content: ''; position: absolute; inset: 3px; background: var(--primary); border-radius: 50%; }
.opt-label { font-size: 14px; }
.quiz-card.shake { animation: shake .4s; }
@keyframes shake { 0%,100%{transform:translateX(0);} 25%{transform:translateX(-8px);} 75%{transform:translateX(8px);} }
.tip { background: #ffe8e0; color: var(--C); font-size: 13px; padding: 8px 12px; border-radius: 8px; margin-bottom: 12px; }

.quiz-nav { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.q-index { font-size: 14px; color: var(--muted); }

/* 体征 */
.sensor-card h2 { font-size: 18px; margin-bottom: 6px; }
.hint { font-size: 12px; color: var(--muted); margin-bottom: 20px; }
.sensor-field { margin-bottom: 16px; }
.sensor-field label { display: block; font-size: 14px; margin-bottom: 6px; }
.sensor-field input {
  width: 100%; padding: 12px; border: 1.5px solid var(--line); border-radius: 10px;
  font-size: 16px; background: #fff;
}
.weight-config { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin: 20px 0; }
.weight-config label { font-size: 14px; font-weight: 600; }
.weight-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: 13px; }
.weight-row input { flex: 1; }

/* 结果 */
.result-card { background: var(--card); border-radius: 16px; padding: 20px; border: 1px solid var(--line); }
.result-card h2 { font-size: 18px; text-align: center; margin-bottom: 16px; }
.dominant { text-align: center; padding: 20px; border-radius: 14px; color: #fff; margin-bottom: 20px; }
.dominant.L { background: linear-gradient(135deg, var(--L), #8bc488); }
.dominant.C { background: linear-gradient(135deg, var(--C), #e07a5f); }
.dominant.P { background: linear-gradient(135deg, var(--P), #5aa0c9); }
.dom-label { font-size: 13px; opacity: 0.9; }
.dom-name { font-size: 28px; font-weight: 700; margin: 6px 0; }
.dom-level { font-size: 14px; opacity: 0.95; }

.bars { margin-bottom: 20px; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 13px; }
.bar-name { width: 76px; flex-shrink: 0; }
.bar-track { flex: 1; height: 14px; background: #eee; border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 7px; transition: width .6s; }
.bar-fill.L { background: var(--L); } .bar-fill.C { background: var(--C); } .bar-fill.P { background: var(--P); }
.bar-val { width: 40px; text-align: right; font-weight: 600; }
.detail { border-top: 1px solid var(--line); padding-top: 16px; font-size: 14px; }
.detail h3 { font-size: 14px; margin: 12px 0 4px; color: var(--primary); }
.detail p { color: var(--text); }
.detail .small { font-size: 12px; color: var(--muted); }
.detail .muted { color: var(--muted); font-style: italic; }
.constitution-desc { background: #fdf6ee; border-radius: 12px; padding: 14px; margin-top: 16px; font-size: 13px; }
.constitution-desc h3 { margin-bottom: 6px; }
.constitution-desc p { color: var(--text); }

.result-actions { display: flex; gap: 12px; margin-top: 20px; }
.result-actions .btn-primary { flex: 1; }

/* 底部tab */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; height: 60px;
  background: #fff; border-top: 1px solid var(--line);
  display: flex; z-index: 10;
}
.tab {
  flex: 1; border: none; background: none; font-size: 12px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer;
}
.tab.active { color: var(--primary); font-weight: 600; }
