:root {
  --ink: #2A2622;
  --ink-2: #5A524A;
  --ink-3: #8C8279;
  --line: #E8E2D9;
  --bg: #FBF9F5;
  --card: #FFFFFF;
  --brand: #8C6A4A;
  --brand-deep: #6B4E34;
  --brand-soft: #F3EBE1;
  --accent: #B5533C;
  --accent-soft: #FBEDE9;
  --ok: #4A7C59;
  --ok-soft: #EAF3EC;
  --warn: #B8873A;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(42, 38, 34, .06);
  --shadow-lg: 0 8px 32px rgba(42, 38, 34, .1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== 顶部进度 ===== */
.progress {
  position: sticky; top: 0; z-index: 20;
  background: rgba(251, 249, 245, .94);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 12px 20px calc(12px);
}
.progress-inner { max-width: 560px; margin: 0 auto; }
.progress-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.progress-title { font-size: 14px; font-weight: 600; letter-spacing: .02em; }
.progress-count { font-size: 12px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.progress-track { height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-deep)); border-radius: 999px; transition: width .35s cubic-bezier(.4,0,.2,1); }

/* ===== 页面容器 ===== */
.wrap { max-width: 560px; margin: 0 auto; padding: 24px 20px 120px; }
.wrap.wide { max-width: 880px; }

.hero { text-align: center; padding: 32px 20px 28px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand-soft); color: var(--brand-deep);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  letter-spacing: .04em; margin-bottom: 14px;
}
.hero h1 { font-size: 25px; font-weight: 700; letter-spacing: -.01em; margin-bottom: 10px; }
.hero p { color: var(--ink-2); font-size: 14px; }
.hero .sub { color: var(--ink-3); font-size: 13px; margin-top: 8px; }

/* ===== 卡片 ===== */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title { font-size: 16px; font-weight: 650; margin-bottom: 4px; }
.card-desc { font-size: 13px; color: var(--ink-3); margin-bottom: 18px; }

/* ===== 表单 ===== */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.label .req { color: var(--accent); margin-left: 3px; }
.hint { font-size: 12px; color: var(--ink-3); margin-bottom: 8px; }

input[type=text], input[type=number], input[type=tel], select, textarea {
  width: 100%; padding: 11px 13px; font-size: 15px; font-family: inherit;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line); border-radius: 10px;
  transition: border-color .18s, box-shadow .18s;
  -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(140, 106, 74, .12);
}
textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238C8279' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
@media (max-width: 400px) { .grid-3 { grid-template-columns: 1fr 1fr; } }

/* ===== 选项芯片 ===== */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px;
  background: #fff; font-size: 13px; color: var(--ink-2); cursor: pointer;
  transition: all .16s; user-select: none;
}
.chip:hover { border-color: var(--brand); color: var(--brand-deep); }
.chip.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 500; }

/* ===== 体质测评 ===== */
.q-group { margin-bottom: 24px; }
.q-group-head {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
  font-size: 13px; font-weight: 650; color: var(--brand-deep);
}
.q-group-head .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.q-group-desc { font-size: 12px; color: var(--ink-3); font-weight: 400; margin-left: auto; }
.q-item { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.q-item:last-child { border-bottom: none; }
.q-text { font-size: 14px; margin-bottom: 10px; }
.q-scale { display: flex; gap: 6px; }
.q-scale button {
  flex: 1; padding: 7px 2px; font-size: 12px; font-family: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink-3); cursor: pointer; transition: all .15s;
}
.q-scale button.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ===== 上传 ===== */
.upload-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.upload-box {
  aspect-ratio: 1; border: 1.5px dashed var(--line); border-radius: 12px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; cursor: pointer; color: var(--ink-3); font-size: 11px;
  background: #FCFAF7; transition: all .16s; position: relative; overflow: hidden;
}
.upload-box:hover { border-color: var(--brand); color: var(--brand); }
.upload-box img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.upload-box .x {
  position: absolute; top: 3px; right: 3px; z-index: 2;
  width: 18px; height: 18px; border-radius: 50%; background: rgba(42,38,34,.62);
  color: #fff; font-size: 13px; line-height: 17px; text-align: center; cursor: pointer;
}
.tongue-guide {
  background: var(--brand-soft); border-radius: 10px; padding: 12px 14px;
  font-size: 12px; color: var(--brand-deep); margin-bottom: 14px; line-height: 1.7;
}

/* ===== 按钮 ===== */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; font-size: 15px; font-weight: 600; font-family: inherit;
  color: #fff; background: var(--brand); border: none; border-radius: 12px;
  cursor: pointer; transition: all .18s; box-shadow: 0 3px 12px rgba(140, 106, 74, .25);
}
.btn:active { transform: translateY(1px); box-shadow: 0 1px 6px rgba(140, 106, 74, .25); }
.btn.ghost { background: #fff; color: var(--brand-deep); border: 1px solid var(--line); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.footer-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  background: rgba(251, 249, 245, .96); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
}
.footer-inner { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }
.footer-inner .btn { flex: 1; }

/* ===== 结果页 ===== */
.result-grade {
  text-align: center; padding: 28px 20px;
  border-radius: var(--radius); margin-bottom: 16px; color: #fff;
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
}
.result-grade.g-S { background: linear-gradient(135deg, #B5533C, #8A3A28); }
.result-grade.g-A { background: linear-gradient(135deg, #B8873A, #8A6420); }
.result-grade.g-B { background: linear-gradient(135deg, #6C8A7A, #4A6B5B); }
.result-grade.g-C { background: linear-gradient(135deg, #8C8279, #6B635B); }
.result-score { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.result-score small { font-size: 14px; font-weight: 400; opacity: .8; margin-left: 3px; }
.result-label { margin-top: 10px; font-size: 16px; font-weight: 600; }
.result-hint { margin-top: 6px; font-size: 13px; opacity: .85; }

.cons-grid { display: grid; gap: 10px; }
.cons-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 12px;
}
.cons-name { font-size: 14px; font-weight: 600; }
.cons-desc { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.cons-bar { width: 90px; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; flex-shrink: 0; }
.cons-bar i { display: block; height: 100%; background: var(--brand); border-radius: 999px; }
.cons-bar i.hi { background: var(--accent); }

.tips { background: var(--ok-soft); border-radius: 12px; padding: 16px; }
.tips h4 { font-size: 14px; font-weight: 650; color: var(--ok); margin-bottom: 10px; }
.tips li { font-size: 13px; color: var(--ink-2); margin-left: 18px; margin-bottom: 7px; line-height: 1.65; }

.split { display: flex; gap: 8px; }
.split > * { flex: 1; }

/* ===== 加载/提示 ===== */
.toast {
  position: fixed; left: 50%; bottom: 100px; transform: translateX(-50%);
  background: rgba(42, 38, 34, .9); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: 13px; z-index: 100; opacity: 0;
  pointer-events: none; transition: opacity .25s; max-width: 80%; text-align: center;
}
.toast.show { opacity: 1; }

.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.notice {
  background: var(--accent-soft); border-radius: 10px; padding: 12px 14px;
  font-size: 12.5px; color: #8A3A28; line-height: 1.6; margin-bottom: 16px;
}
