:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1d2129;
  --muted: #6b7280;
  --line: #e5e7eb;
  --accent: #2563eb;
  --accent-soft: #eaf1ff;
  --danger: #d93025;
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --card: #1c1f24;
    --text: #e8eaed;
    --muted: #9aa0a6;
    --line: #2e333a;
    --accent: #5b8def;
    --accent-soft: #1f2a40;
    --danger: #f28b82;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

.progress { position: fixed; inset: 0 0 auto 0; height: 3px; background: transparent; z-index: 10; }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 16px calc(40px + env(safe-area-inset-bottom));
}

.head { padding: 8px 4px 16px; }
.head h1 { font-size: 24px; line-height: 1.35; margin: 0 0 8px; }
.muted { color: var(--muted); margin: 0; }

.q {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 18px 16px 14px;
  margin: 0 0 14px;
  min-width: 0;
  transition: border-color .2s;
}
.q.bad { border-color: var(--danger); }
.q legend {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 17px;
}
.q legend + * { clear: both; }
.num {
  flex: none;
  min-width: 24px;
  height: 24px;
  border-radius: 12px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  display: inline-grid;
  place-items: center;
  margin-top: 1px;
}
.qt { flex: 1; }
.req, .opt {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 6px;
  border-radius: 6px;
  margin-top: 3px;
}
.req { color: var(--danger); background: rgba(217, 48, 37, .1); }
.opt { color: var(--muted); background: rgba(128, 134, 145, .14); }

.opts { display: grid; gap: 8px; }
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .15s, border-color .15s;
}
.choice:hover { border-color: var(--accent); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.mark {
  flex: none;
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  display: grid;
  place-items: center;
  transition: all .15s;
}
.is-single .mark { border-radius: 50%; }
.is-multi .mark { border-radius: 5px; }
.choice:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.choice input:checked + .mark { border-color: var(--accent); background: var(--accent); }
.is-single input:checked + .mark::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff;
}
.is-multi input:checked + .mark::after {
  content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}
.choice input:focus-visible + .mark { outline: 2px solid var(--accent); outline-offset: 2px; }

textarea {
  width: 100%;
  font: inherit;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--accent); }

.err { color: var(--danger); font-size: 14px; margin: 8px 2px 0; min-height: 0; }
.err:empty { display: none; }
.form-err { text-align: center; }

.submit {
  display: block;
  width: 100%;
  margin-top: 20px;
  padding: 14px;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.submit:disabled { opacity: .6; cursor: default; }

.done { text-align: center; padding: 60px 16px; }
.check {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 34px; display: grid; place-items: center;
}
.done h2 { margin: 0 0 8px; }

/* ---------- 结果页 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
}
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row input {
  flex: 1 1 200px; font: inherit; color: inherit; background: transparent;
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
}
.btn {
  font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff; cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--accent); }
.stat-num { font-size: 32px; font-weight: 700; line-height: 1.2; }
.bar-row { margin: 10px 0; }
.bar-label { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.bar-label span:last-child { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-track { height: 8px; border-radius: 4px; background: var(--accent-soft); margin-top: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.texts { margin: 0; padding-left: 18px; }
.texts li { margin: 6px 0; word-break: break-word; }
