/* === 基础 === */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 15px; line-height: 1.65; color: #2c3e36;
  background: linear-gradient(180deg, #f4fbf7 0%, #fbfdfb 100%);
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}

button { font-family: inherit; cursor: pointer; }

/* === 顶栏 === */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: linear-gradient(135deg, #5DB783 0%, #4A9D6F 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(74,157,111,0.12);
}
.topbar-inner {
  max-width: 720px; margin: 0 auto;
  padding: 12px 16px;
}
.brand {
  font-size: 17px; font-weight: 600; margin: 0 0 8px 0;
  display: flex; align-items: center; gap: 6px;
}
.progress-wrap { display: flex; align-items: center; gap: 10px; }
.progress-text { font-size: 12px; opacity: .92; min-width: 36px; }
.progress {
  flex: 1; height: 6px; background: rgba(255,255,255,0.25);
  border-radius: 3px; overflow: hidden;
}
.progress-bar {
  height: 100%; width: 0;
  background: linear-gradient(90deg, #B8E6C1 0%, #7FD09A 100%);
  transition: width .3s ease;
}

/* === 主容器 === */
.container {
  max-width: 720px; margin: 0 auto;
  padding: 16px;
}
.loading {
  text-align: center; color: #88b89c;
  padding: 40px 0;
  font-size: 14px;
}

/* === 卡片 === */
.card {
  background: #fff;
  border-radius: 14px;
  padding: 20px 18px;
  margin: 0 0 14px 0;
  box-shadow: 0 1px 4px rgba(56,118,82,0.04), 0 4px 12px rgba(56,118,82,0.03);
}
.section-title {
  font-size: 18px; font-weight: 600;
  color: #2c5e42; margin: 0 0 8px 0;
}
.section-intro {
  font-size: 13.5px; color: #5a7d67;
  margin: 0 0 16px 0;
  padding: 12px 14px;
  background: #eef8f1;
  border-radius: 10px;
  border-left: 3px solid #7FD09A;
  white-space: pre-wrap;
  line-height: 1.7;
}

/* === 题目 === */
.q {
  margin: 0 0 18px 0;
  padding: 0 0 16px 0;
  border-bottom: 1px dashed #e2f0e7;
}
.q:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.q-title {
  font-size: 15px; font-weight: 500; color: #2c3e36;
  margin: 0 0 10px 0; line-height: 1.6;
}
.q-hint {
  font-size: 12.5px; color: #88b89c;
  margin: 6px 0 10px 0;
}
.req { color: #e07a5f; margin-left: 3px; }

/* 单选 / 多选 */
.opts { display: flex; flex-direction: column; gap: 9px; }
.opt {
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  background: #f8fcf9;
  border: 1.5px solid #d4eadc;
  border-radius: 24px;
  cursor: pointer;
  transition: all .15s ease;
  font-size: 14.5px; color: #3d5a4b;
  line-height: 1.5;
  -webkit-user-select: none; user-select: none;
}
.opt:hover { border-color: #7FD09A; background: #edf9f1; }
.opt.selected {
  background: #e4f6ea;
  border-color: #4A9D6F;
  color: #1d5c3d;
  font-weight: 500;
}
.opt-checkbox {
  width: 20px; height: 20px; flex-shrink: 0;
  border: 1.5px solid #a8d6b8; background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: transparent;
  border-radius: 50%;
}
.opt.selected .opt-checkbox {
  background: #4A9D6F; border-color: #4A9D6F; color: #fff;
}
.opt-radio.selected::after { color: #fff; font-size: 11px; content: '✓'; font-weight: bold; }

/* 矩阵 */
.matrix {
  margin: 10px 0 0 0;
  border: 1px solid #d4eadc;
  border-radius: 10px;
  overflow: hidden;
}
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
.matrix-table th, .matrix-table td {
  padding: 10px 6px;
  text-align: center;
  border-bottom: 1px solid #eef7f1;
  vertical-align: middle;
}
.matrix-table th {
  background: #eef8f1;
  font-weight: 500;
  color: #5a7d67;
  font-size: 12.5px;
  line-height: 1.4;
}
.matrix-table td:first-child {
  text-align: left; padding-left: 12px;
  line-height: 1.5; color: #2c3e36;
  min-width: 100px;
}
.matrix-table tr:last-child td { border-bottom: none; }
.matrix-table label {
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 6px 4px;
  border-radius: 6px;
  margin: -6px -4px;
}
.matrix-table label:hover { background: #edf9f1; }
.matrix-table input[type=radio] { display: none; }
.matrix-table input[type=radio]:checked + span {
  color: #fff; background: #4A9D6F;
  width: 28px; height: 28px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: bold;
}
.matrix-table label > span {
  display: inline-block;
  min-width: 24px;
  padding: 4px 6px;
  border-radius: 6px;
  font-size: 12.5px;
  color: #5a7d67;
  transition: all .15s ease;
}

/* 滑块 */
.slider-wrap { padding: 14px 8px; }
.slider-value {
  text-align: center;
  font-size: 28px; font-weight: 700;
  color: #4A9D6F; margin-bottom: 8px;
}
.slider-row { display: flex; align-items: center; gap: 12px; }
.slider-label { font-size: 12px; color: #88b89c; min-width: 60px; }
.slider-label.right { text-align: right; }
.slider {
  flex: 1; -webkit-appearance: none; appearance: none;
  height: 6px; background: #d4eadc; border-radius: 3px; outline: none;
  -webkit-tap-highlight-color: transparent;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 24px; height: 24px; border-radius: 50%;
  background: #4A9D6F; cursor: pointer;
  box-shadow: 0 2px 6px rgba(74,157,111,0.4);
}
.slider::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: #4A9D6F; cursor: pointer; border: none;
}

/* 文本 */
.textarea {
  width: 100%;
  min-height: 84px;
  padding: 12px 14px;
  font-size: 14.5px;
  font-family: inherit;
  border: 1.5px solid #d4eadc;
  border-radius: 16px;
  resize: vertical;
  background: #f8fcf9;
  transition: border-color .15s;
  line-height: 1.6;
}
.textarea:focus { border-color: #4A9D6F; background: #fff; outline: none; }

/* 其他文本输入 */
.other-input {
  margin-top: 8px;
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  border: 1.5px solid #d4eadc;
  border-radius: 16px;
  background: #f8fcf9;
}
.other-input:focus { border-color: #4A9D6F; background: #fff; outline: none; }

/* 按钮 */
.btn-row {
  display: flex; gap: 10px;
  margin: 18px 0 0 0;
  padding: 0;
}
.btn {
  flex: 1;
  padding: 14px 20px;
  font-size: 15px; font-weight: 600;
  border: none; border-radius: 24px;
  cursor: pointer;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary {
  background: linear-gradient(135deg, #5DB783 0%, #4A9D6F 100%);
  color: #fff;
  box-shadow: 0 2px 8px rgba(74,157,111,0.25);
}
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled {
  background: #cce8d7; cursor: not-allowed;
  box-shadow: none;
}
.btn-ghost {
  background: #eef8f1; color: #4a7a5e;
}
.btn-ghost:active { background: #dff4e5; }

/* 错误提示 */
.err-msg {
  color: #d65a4a; font-size: 12.5px;
  margin-top: 6px;
  display: none;
}
.q.has-error .err-msg { display: block; }
.q.has-error .opt { border-color: #e57373; }

/* 完成页 */
.done { text-align: center; padding: 40px 24px; }
.big-emoji { font-size: 64px; margin-bottom: 12px; }
.done h2 { margin: 0 0 16px 0; color: #2c5e42; }
.done-body {
  text-align: left;
  background: #eef8f1;
  padding: 16px;
  border-radius: 12px;
  font-size: 13.5px;
  color: #3d5a4b;
  line-height: 1.7;
  white-space: pre-wrap;
  margin-bottom: 14px;
}
.done-tip { font-size: 12.5px; color: #88b89c; }

/* 页脚 */
.footer {
  text-align: center;
  font-size: 12px; color: #88b89c;
  padding: 20px 16px;
}

/* === 移动端微调 === */
@media (max-width: 480px) {
  .container { padding: 12px; }
  .card { padding: 16px 14px; }
  .section-title { font-size: 17px; }
  .q-title { font-size: 14.5px; }
  .opt { padding: 12px 14px; font-size: 14px; }
  .matrix-table { font-size: 12.5px; }
  .matrix-table td:first-child {
    font-size: 12.5px; padding-left: 8px; min-width: 90px;
  }
  .matrix-table th, .matrix-table td { padding: 8px 3px; }
  .matrix-table label > span { padding: 3px 4px; font-size: 12px; }
  .brand { font-size: 15.5px; }
}

/* 防止 iOS 输入法挡按钮 */
.btn-row { padding-bottom: 20px; }
