/* ==========================================================================
   问卷系统样式 —— 移动优先，无外部字体/CDN（国内加载快、断网也能用）
   ========================================================================== */

:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --ink: #16181d;
  --ink-2: #4a5058;
  --muted: #8a9099;
  --line: #e3e6ea;
  --line-2: #eef0f3;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-weak: #e6f4f2;
  --ok: #15803d;
  --warn: #b91c1c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.06);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #171a20;
    --ink: #e9ecf1;
    --ink-2: #b9c0ca;
    --muted: #7c848f;
    --line: #2a2f38;
    --line-2: #22262e;
    --accent: #2dd4bf;
    --accent-ink: #06251f;
    --accent-weak: #10312c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

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

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-size-adjust: 100%;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}

.is-hidden { display: none !important; }

/* ---------------------------------------------------------------- 顶部进度 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  padding: 12px 2px 8px;
  background: linear-gradient(var(--bg) 70%, transparent);
  backdrop-filter: blur(8px);
}

.progress {
  height: 5px;
  border-radius: 99px;
  background: var(--line-2);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.28s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

#partText { color: var(--ink-2); font-weight: 600; }

.meta-right { display: inline-flex; align-items: center; gap: 10px; }

.saved {
  opacity: 0;
  transition: opacity 0.25s ease;
  color: var(--ok);
  font-weight: 600;
}
.saved.show { opacity: 1; }

/* ---------------------------------------------------------------- 舞台 */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 6px 0 12px;
  min-height: 0;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px 24px;
  animation: rise 0.26s cubic-bezier(0.22, 0.7, 0.3, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
  .progress-fill { transition: none; }
}

.part-banner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-weak);
  padding: 3px 10px;
  border-radius: 99px;
  margin-bottom: 12px;
}

.part-intro {
  font-size: 14.5px;
  color: var(--ink-2);
  background: var(--line-2);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 0 8px 8px 0;
  margin: 0 0 16px;
  white-space: pre-line;
}

.q-text {
  font-size: 19px;
  line-height: 1.5;
  font-weight: 650;
  margin: 0 0 6px;
  letter-spacing: 0.01em;
}

.q-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.55;
  /* 副说明里可能有换行（比如 Q13 的第二句），让它真的换行 */
  white-space: pre-line;
}

.q-variant {
  font-size: 13.5px;
  color: var(--accent);
  background: var(--accent-weak);
  padding: 8px 11px;
  border-radius: 8px;
  margin: 10px 0 0;
}

/* ---------------------------------------------------------------- 选项 */

.opts { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

.opt {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 14px 15px;
  min-height: 52px;
  background: var(--card);
  color: var(--ink);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  font: inherit;
  font-size: 15.5px;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, transform 0.06s;
}

.opt:active { transform: scale(0.994); }

.opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.opt .mark {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  border: 1.8px solid var(--line);
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: border-color 0.16s, background 0.16s;
}

.opt.is-multi .mark { border-radius: 6px; }

.opt .mark::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.16s, transform 0.16s;
  transform: scale(0.4);
}

.opt.is-multi .mark::after { border-radius: 2px; width: 11px; height: 11px; }

.opt.is-on {
  border-color: var(--accent);
  background: var(--accent-weak);
}

.opt.is-on .mark {
  border-color: var(--accent);
  background: var(--accent);
}
.opt.is-on .mark::after { background: var(--accent-ink); transform: scale(1); }

.opt .lab { flex: 1; }
.opt .hint { display: block; font-size: 12.5px; color: var(--muted); margin-top: 3px; }

/* 五级量表：横向 */

.scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin-top: 20px;
}

.scale-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 12px 2px;
  min-height: 56px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: var(--card);
  color: var(--ink-2);
  font: inherit;
  font-variant-numeric: tabular-nums;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s, color 0.16s;
}

.scale-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.scale-btn.is-on {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.anchors {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

/* 五级量表：纵向带文字标签 */

.scale-vert { display: flex; flex-direction: column; gap: 9px; margin-top: 18px; }

.scale-vert .opt { min-height: 48px; align-items: center; }
.scale-vert .opt .num {
  flex: none;
  width: 22px;
  font-weight: 700;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.scale-vert .opt.is-on .num { color: var(--accent); }

/* 数字输入 */

.num-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
}

.num-input {
  flex: 1;
  max-width: 200px;
  padding: 14px 16px;
  font-size: 22px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 11px;
  outline: none;
  text-align: center;
}

.num-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }

/* 占位符要明显比填进去的数字弱，否则会被误认为已经填好了 */
.num-input::placeholder {
  font-weight: 400;
  font-size: 16px;
  color: var(--muted);
  opacity: 1;
}
.num-unit { color: var(--muted); font-size: 15px; }
.num-hint { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* 其他补充输入 */

.other-wrap { margin-top: 10px; animation: rise 0.2s ease; }

.other-input {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  /* iOS 上输入框字号 < 16px 会在聚焦时自动放大页面，所以这里不能小于 16 */
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  outline: none;
}

.other-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-weak); }

/* ---------------------------------------------------------------- 底部 */

.nav {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  gap: 10px;
  padding: 10px 0 calc(10px + var(--safe-b));
  /* 实底而不是渐变：渐变会让长选项列表的最后一个看起来被切掉 */
  background: var(--bg);
  border-top: 1px solid var(--line-2);
}

.btn {
  font: inherit;
  font-size: 16px;
  font-weight: 650;
  border-radius: 12px;
  padding: 14px 18px;
  min-height: 50px;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: opacity 0.16s, background 0.16s, transform 0.06s;
}

.btn:active { transform: scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn.primary {
  flex: 1;
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: var(--shadow);
}

.btn.primary[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}

.btn.ghost {
  background: transparent;
  color: var(--ink-2);
  border-color: var(--line);
  flex: 0 0 auto;
  min-width: 92px;
}

.btn.block { width: 100%; flex: 0 0 auto; }

.btn.ghost[disabled] { opacity: 0.35; cursor: default; }

/* ---------------------------------------------------------------- 介绍页 / 结束页 */

.hero { padding: 26px 22px 28px; }

.hero h1 {
  font-size: 23px;
  line-height: 1.4;
  margin: 0 0 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero .lead { color: var(--ink-2); font-size: 15.5px; margin: 0 0 16px; }

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.chip {
  font-size: 12.5px;
  color: var(--ink-2);
  background: var(--line-2);
  border-radius: 99px;
  padding: 4px 11px;
}

.ul { margin: 0 0 16px; padding-left: 20px; color: var(--ink-2); font-size: 14.5px; }
.ul li { margin: 6px 0; }

.box {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 15px;
  margin: 0 0 16px;
  font-size: 14.5px;
  color: var(--ink-2);
  line-height: 1.6;
}

.box b { color: var(--ink); }

.consent {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding: 14px 15px;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
  cursor: pointer;
  margin-bottom: 16px;
  transition: border-color 0.16s, background 0.16s;
}

.consent.is-on { border-color: var(--accent); background: var(--accent-weak); }

.consent input { margin: 3px 0 0; width: 18px; height: 18px; accent-color: var(--accent); flex: none; }

.footnote { font-size: 12.5px; color: var(--muted); text-align: center; margin-top: 14px; }

/* 测试模式提示条 */
.test-flag {
  margin: 0 0 10px;
  padding: 9px 12px;
  border-radius: 10px;
  background: #fef3c7;
  color: #92400e;
  font-size: 13px;
  font-weight: 650;
  text-align: center;
  letter-spacing: 0.01em;
}

@media (prefers-color-scheme: dark) {
  .test-flag { background: #3a2c05; color: #fbbf24; }
}

.btn.retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  text-decoration: none;
  color: var(--accent);
  border-color: var(--accent);
}

/* 题库题的「答完领称号」提醒 */
.pool-notice {
  margin: 16px 0 0;
  padding: 10px 13px;
  border-radius: 10px;
  background: var(--accent-weak);
  color: var(--accent);
  font-size: 13.5px;
  font-weight: 600;
  text-align: center;
}

/* ---------------------------------------------------------------- 集卡称号 */

.badge-card {
  margin-top: 14px;
  padding: 22px 18px 20px;
  border-radius: 16px;
  text-align: center;
  color: #fff;
  background: linear-gradient(135deg, #0f766e 0%, #0d9488 55%, #14b8a6 100%);
  box-shadow: 0 10px 30px rgba(15, 118, 110, 0.22);
  animation: rise 0.35s cubic-bezier(0.22, 0.7, 0.3, 1);
}

.badge-kicker { font-size: 12px; letter-spacing: 0.18em; opacity: 0.8; }

.badge-title {
  font-size: 24px;
  font-weight: 750;
  margin: 8px 0 10px;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.badge-sub {
  font-size: 12.5px;
  opacity: 0.85;
  line-height: 1.6;
  white-space: pre-line;
  word-break: break-word;
}

.badge-sub a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.9;
}

/* ---------------------------------------------------------------- 访谈报名 */

.iv-card { margin-top: 14px; }
.iv-card p { font-size: 14.5px; color: var(--ink-2); line-height: 1.65; margin: 0 0 10px; }
.iv-card b { color: var(--ink); }
.iv-card .ul { font-size: 14px; margin-bottom: 12px; }
.iv-title { font-size: 18px; margin: 0 0 12px; font-weight: 700; letter-spacing: -0.01em; }
.iv-soft { font-size: 13.5px; color: var(--muted); margin: 0; }

.iv-form { margin-top: 14px; }

.iv-hint {
  background: var(--line-2);
  border-radius: 10px;
  padding: 11px 13px;
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0 0 6px;
}

.iv-label {
  display: block;
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  margin: 18px 0 8px;
}
.iv-label span { font-weight: 400; color: var(--muted); font-size: 13px; }

.iv-input,
.iv-textarea {
  width: 100%;
  padding: 12px 14px;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}

.iv-input:focus,
.iv-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-weak);
}

.iv-textarea { resize: vertical; line-height: 1.55; min-height: 84px; }

.iv-opts { margin-top: 0; gap: 8px; }
.iv-opts .opt { padding: 12px 14px; min-height: 46px; font-size: 15px; }

.iv-form .consent { margin: 20px 0 14px; font-size: 13.5px; }

.iv-form .footnote a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1px;
}
.iv-form .footnote a:hover { color: var(--ink-2); }

.iv-done {
  margin-top: 14px;
  text-align: center;
  color: var(--ok);
  font-size: 14.5px;
}
.iv-done p { margin: 0; }

.done-mark {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: var(--accent-weak);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 30px;
  margin: 0 auto 18px;
}

.center { text-align: center; }
.center h2 { margin: 0 0 8px; font-size: 20px; }
.center p { color: var(--ink-2); margin: 0 0 8px; }

.loading {
  padding: 60px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
}

/* ---------------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(88px + var(--safe-b));
  transform: translate(-50%, 12px);
  background: rgba(22, 24, 29, 0.92);
  color: #fff;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 99px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  max-width: 88vw;
  text-align: center;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- 桌面微调 */

@media (min-width: 640px) {
  body { font-size: 16.5px; }
  .q-text { font-size: 21px; }
  .app { padding: 0 24px; }
  .card { padding: 28px 26px 30px; }
  .btn.primary { flex: 0 0 220px; margin-left: auto; }
  .nav { justify-content: space-between; }
}
