/* 问卷调查 H5 —— 移动端样式 */
:root {
  --brand: #0e7c66;
  --brand-deep: #0a5c4c;
  --brand-soft: #e6f4f0;
  --bg: #f2f5f4;
  --card: #ffffff;
  --text: #16211e;
  --text-2: #5e706b;
  --text-3: #93a19c;
  --line: #e4ebe8;
  --low: #17a673;
  --mid: #e8930c;
  --high: #d93a3a;
  --danger: #d93a3a;
}

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

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
}

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

/* 顶栏 */
.topbar {
  background: var(--brand);
  color: #fff;
  padding: 22px 20px 18px;
}
.topbar-inner { max-width: 640px; margin: 0 auto; }
.topbar h1 { font-size: 22px; font-weight: 700; letter-spacing: 0.5px; }
.topbar p { font-size: 13px; opacity: 0.85; margin-top: 4px; }

/* 卡片 */
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px 18px;
  margin-top: 14px;
  box-shadow: 0 4px 14px rgba(16, 45, 38, 0.06);
}

.card-title { font-size: 15px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }

/* 问卷卡片 */
.survey-card {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  margin-top: 14px;
  box-shadow: 0 4px 14px rgba(16, 45, 38, 0.06);
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.12s ease;
}
.survey-card:active { transform: scale(0.985); }
.sv-title { font-size: 18px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 8px; }
.sv-desc { font-size: 14px; color: var(--text-2); margin-top: 6px; }
.sv-meta { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.tag {
  font-size: 12px; padding: 3px 10px; border-radius: 999px;
  background: var(--brand-soft); color: var(--brand-deep);
}
.tag.plain { background: #f0f3f2; color: var(--text-2); }
.sv-go { margin-top: 14px; color: var(--brand); font-weight: 600; font-size: 15px; }

.empty {
  text-align: center; color: var(--text-3); padding: 48px 0; font-size: 15px;
}

/* 问卷描述页 */
.hero-title { font-size: 22px; font-weight: 700; margin-top: 4px; }
.hero-desc { font-size: 15px; color: var(--text-2); margin-top: 10px; }
.hero-meta { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

/* 表单 */
.field-label { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.input, .textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: 16px; font-family: inherit; color: var(--text);
  background: #fff; outline: none;
}
.input:focus, .textarea:focus { border-color: var(--brand); }
.textarea { min-height: 96px; resize: vertical; }
.hint { font-size: 12.5px; color: var(--text-3); margin-top: 6px; text-align: right; }

/* 题目 */
.progress-wrap { margin-top: 14px; }
.progress-text { font-size: 13px; color: var(--text-2); display: flex; justify-content: space-between; }
.progress-bar { height: 8px; background: #e2eae7; border-radius: 999px; margin-top: 6px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--brand); border-radius: 999px; transition: width 0.25s ease; }

.q-no {
  display: inline-block; font-size: 12px; font-weight: 700; color: var(--brand);
  background: var(--brand-soft); border-radius: 8px; padding: 2px 10px; margin-bottom: 10px;
}
.q-text { font-size: 19px; font-weight: 600; line-height: 1.5; }
.q-req { color: var(--danger); margin-left: 2px; }
.q-hint { font-size: 13px; color: var(--text-3); margin-top: 8px; }

/* 选项 */
.option {
  display: flex; align-items: center; gap: 12px;
  border: 1.5px solid var(--line); border-radius: 14px;
  padding: 14px 16px; margin-top: 12px; cursor: pointer;
  font-size: 16px; background: #fff; transition: all 0.12s ease;
  width: 100%; text-align: left; font-family: inherit; color: var(--text);
}
.option:active { background: #f6faf9; }
.option.checked {
  border-color: var(--brand); background: var(--brand-soft); font-weight: 600;
}
.opt-box {
  flex: none; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid #c3d2cd; position: relative;
}
.option.checkbox .opt-box { border-radius: 6px; }
.option.checked .opt-box { border-color: var(--brand); background: var(--brand); }
.option.checked .opt-box::after {
  content: ""; position: absolute; left: 6.5px; top: 3px;
  width: 5px; height: 10px; border: solid #fff; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
}
.opt-score { margin-left: auto; flex: none; font-size: 12.5px; color: var(--text-3); }

/* 底部按钮 */
.btn {
  display: inline-block; border: none; border-radius: 14px; cursor: pointer;
  font-size: 16px; font-weight: 600; font-family: inherit; text-align: center;
  padding: 13px 22px; transition: opacity 0.12s ease;
}
.btn:active { opacity: 0.85; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-block { display: block; width: 100%; }
.btn-ghost { background: #fff; color: var(--text-2); border: 1.5px solid var(--line); }
.nav-bar { display: flex; gap: 12px; margin-top: 22px; }
.nav-bar .btn { flex: 1; padding: 14px 0; font-size: 17px; }

/* 结果页 */
.result-hero {
  background: linear-gradient(135deg, var(--brand), var(--brand-deep));
  color: #fff; border-radius: 20px; padding: 26px 22px; margin-top: 14px;
  box-shadow: 0 10px 24px rgba(14, 124, 102, 0.25);
}
.result-hero .label { font-size: 14px; opacity: 0.85; }
.result-hero .num { font-size: 52px; font-weight: 800; line-height: 1.15; }
.result-hero .num small { font-size: 18px; font-weight: 500; opacity: 0.85; }
.result-hero .meta { margin-top: 10px; font-size: 13px; opacity: 0.85; }

.level-chip {
  display: inline-block; margin-top: 12px; padding: 5px 16px; border-radius: 999px;
  font-size: 15px; font-weight: 700; background: rgba(255,255,255,0.18);
}

.summary-card { border-left: 4px solid var(--brand); }
.summary-card .sum-text { font-size: 16px; font-weight: 600; }
.summary-card .adv-text { font-size: 14.5px; color: var(--text-2); margin-top: 8px; }

.detail-row { padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: none; }
.d-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.d-name { flex: 1; font-size: 15px; color: var(--text); min-width: 0; }
.d-score { flex: none; white-space: nowrap; font-size: 14px; color: var(--brand); font-weight: 600; }
.d-answer { margin-top: 4px; font-size: 15px; font-weight: 600; color: var(--brand-deep); }

/* 历史记录 */
.rec-card { margin-top: 12px; }
.rec-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rec-title { font-size: 16px; font-weight: 700; }
.rec-time { font-size: 12.5px; color: var(--text-3); flex: none; }
.rec-sub { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }
.rec-foot { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.rec-level { font-size: 13px; font-weight: 600; color: var(--brand); background: var(--brand-soft); border-radius: 999px; padding: 3px 12px; }
.rec-link { margin-left: auto; color: var(--brand); font-size: 14px; font-weight: 600; cursor: pointer; }

/* 状态页 */
.state-box { text-align: center; padding: 60px 20px; color: var(--text-3); }
.state-box .big { font-size: 42px; margin-bottom: 12px; }
.state-box .msg { font-size: 15px; }
.spin {
  width: 34px; height: 34px; margin: 0 auto 14px; border-radius: 50%;
  border: 3.5px solid var(--line); border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 弹层 toast */
#toast {
  position: fixed; left: 50%; bottom: 12%; transform: translateX(-50%) translateY(8px);
  background: rgba(22, 33, 30, 0.92); color: #fff; font-size: 14.5px;
  padding: 10px 20px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: all 0.22s ease; max-width: 82vw; text-align: center; z-index: 99;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }
.muted { color: var(--text-3); font-size: 13px; }

/* 用户条 */
.user-bar {
  max-width: 640px; margin: 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 8px 20px 0;
}
.user-bar .ub-avatar {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  background: #dfe9e6; border: 2px solid rgba(255,255,255,0.7);
}
.user-bar .ub-name { color: #fff; font-size: 14.5px; font-weight: 600; }
.user-bar .ub-guest { color: rgba(255,255,255,0.75); font-size: 13.5px; }
.user-bar.action { cursor: pointer; }
.user-bar .ub-login {
  display: inline-flex; align-items: center; gap: 6px;
  background: #12b76a; color: #fff; font-size: 13.5px; font-weight: 600;
  border-radius: 999px; padding: 6px 14px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.user-bar .ub-login::before { content: ""; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; opacity: 0.9; }

/* 性别选择（问卷介绍页） */
.gender-row { display: flex; gap: 12px; }
.gender-btn {
  flex: 1; height: 48px; border-radius: 12px;
  border: 1.5px solid #dfe8e4; background: #fff;
  font-size: 16px; color: var(--text-2); cursor: pointer;
  transition: all .15s;
}
.gender-btn.checked {
  border-color: var(--brand); background: #eaf6f2;
  color: var(--brand); font-weight: 600;
}

/* 提交频率限制提示（问卷介绍页） */
.cooldown-tip {
  margin-top: 12px; padding: 9px 13px;
  border-radius: 10px; background: #f3f7f5;
  color: #5e706b; font-size: 13.5px; line-height: 1.5;
}
