:root {
  --bg: #f4f6f7;
  --card: #ffffff;
  --ink: #1b2126;
  --muted: #6b7480;
  --line: #e3e7ea;
  --brand: #2f6f6b;
  --brand-dark: #245753;
  --brand-soft: #e7f1f0;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warn: #8a5a00;
  --warn-soft: #fff8e6;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 10px 28px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 16px;
  background: rgba(244, 246, 247, .92);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid transparent;
}

.brand { font-weight: 600; font-size: 15px; color: var(--ink); }
a.brand:hover { color: var(--brand); }

.topbar-tag {
  font-size: 12px;
  letter-spacing: .08em;
  color: var(--brand-dark);
  background: var(--brand-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.page {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 48px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px 22px;
  margin-bottom: 18px;
}

.hero { padding: 30px 24px 26px; }

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  letter-spacing: .12em;
  color: var(--brand);
  text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.35; margin: 0 0 12px; font-weight: 650; }
h1 { font-size: 26px; letter-spacing: -.01em; }
h2 { font-size: 21px; }
h3 { font-size: 17px; }

.lead { color: #3d4650; margin: 0 0 18px; }
.muted { color: var(--muted); margin: 0 0 16px; font-size: 15px; }
.hint { color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.center { text-align: center; }
.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

.facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.facts li {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: baseline;
  font-size: 14px;
  color: #39424c;
}

.facts b {
  font-size: 13px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 8px;
  text-align: center;
  padding: 2px 0;
  font-weight: 600;
}

.choice-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
  margin-bottom: 18px;
}

@media (min-width: 640px) {
  .choice-grid { grid-template-columns: 1fr 1fr; }
}

.choice {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 20px;
  color: var(--ink);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.choice:hover {
  transform: translateY(-2px);
  border-color: #c9d6d4;
  box-shadow: 0 12px 30px rgba(16, 24, 40, .09);
}

.choice-tag { font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.choice h2 { margin: 6px 0 8px; font-size: 24px; }
.choice p { margin: 0 0 18px; color: #4a545f; font-size: 14.5px; flex: 1; }
.choice-cta { font-weight: 600; color: var(--brand); font-size: 15px; }
.choice-note {
  margin-top: 8px;
  font-size: 12px;
  color: var(--warn);
  background: var(--warn-soft);
  border-radius: 8px;
  padding: 4px 8px;
  align-self: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, opacity .15s ease;
  text-align: center;
}

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-ghost { background: #fff; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover:not(:disabled) { border-color: #c6ccd2; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { display: flex; width: 100%; margin-top: 18px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.row .btn { flex: 1 1 140px; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--brand);
  font: inherit;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ---------- 答题 ---------- */

.quiz-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.progress {
  height: 6px;
  background: #edf0f2;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress > span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brand);
  border-radius: 999px;
  transition: width .25s ease;
}

.quiz-form { margin-top: 4px; }
.quiz { scroll-margin-top: 72px; }

.q {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 20px 0 6px;
}

.q:first-child { border-top: 0; padding-top: 8px; }

.q legend {
  display: block;
  width: 100%;
  padding: 0;
  margin-bottom: 12px;
  font-size: 16px;
  font-weight: 600;
  color: #212a31;
}

.q-num { color: var(--muted); font-weight: 500; margin-right: 6px; }
.q-tag {
  margin-left: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  vertical-align: 2px;
}

.opts { display: grid; gap: 8px; }

.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  font-size: 15px;
  transition: border-color .12s ease, background .12s ease;
}

.opt:hover { border-color: #cdd3d8; background: #fcfdfd; }
.opt input {
  flex: none;
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
  margin: 0;
}
.opt input:checked + span { font-weight: 600; }
.opt:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

.q.missing legend { color: var(--danger); }
.q.missing .opts {
  outline: 2px dashed #efc2bd;
  outline-offset: 6px;
  border-radius: 12px;
}

.quiz .nav {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  padding-top: 4px;
}

.quiz .nav .btn { flex: 1; }
.quiz .nav .btn-ghost { flex: 0 0 34%; }

/* ---------- 提示条 ---------- */

.alert {
  margin-top: 16px;
  padding: 11px 14px;
  border-radius: 12px;
  font-size: 14px;
  background: var(--warn-soft);
  color: var(--warn);
  border: 1px solid #f1e2bd;
}

.alert-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #f6d3cf;
}

.alert-ok {
  background: var(--brand-soft);
  color: var(--brand-dark);
  border-color: #cfe3e1;
}

/* ---------- 视频 ---------- */

.video-wrap {
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  margin: 4px 0 8px;
  aspect-ratio: 16 / 9;
}

.video-wrap video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.video-missing {
  border: 1px dashed #c9ced3;
  border-radius: 14px;
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  background: #fafbfb;
  margin: 4px 0 8px;
}

/* ---------- 编号 ---------- */

.code-box {
  margin: 18px 0 6px;
  padding: 20px 14px;
  text-align: center;
  border: 1.5px dashed #b9cdcb;
  background: var(--brand-soft);
  border-radius: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(19px, 5.4vw, 28px);
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--brand-dark);
  word-break: break-all;
  user-select: all;
}

.code-form { display: grid; gap: 10px; margin-top: 6px; }

.code-input {
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: #fff;
  color: var(--ink);
}

.code-input:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
  border-color: transparent;
}

/* ---------- 完成 ---------- */

.done-mark {
  width: 58px;
  height: 58px;
  margin: 4px auto 16px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  display: grid;
  place-items: center;
  font-size: 30px;
  font-weight: 700;
}

/* ---------- 管理页 ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}

.stat b { display: block; font-size: 24px; line-height: 1.2; }
.stat span { font-size: 12px; color: var(--muted); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  white-space: nowrap;
}

table.data th, table.data td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

table.data th {
  background: #fafbfb;
  font-weight: 600;
  color: #4a545f;
  position: sticky;
  top: 0;
}

table.data tr:last-child td { border-bottom: 0; }

.badge {
  display: inline-block;
  font-size: 11.5px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef1f3;
  color: #5a636d;
}

.badge.ok { background: var(--brand-soft); color: var(--brand-dark); }
.badge.wait { background: var(--warn-soft); color: var(--warn); }

/* ---------- 底部与提示 ---------- */

.footer {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px 28px;
  color: #98a0a8;
  font-size: 12px;
  text-align: center;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  background: rgba(27, 33, 38, .92);
  color: #fff;
  font-size: 14px;
  padding: 9px 16px;
  border-radius: 999px;
  z-index: 100;
  animation: toast-in .18s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, 6px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (max-width: 480px) {
  .card { padding: 20px 16px; border-radius: 14px; }
  .hero { padding: 24px 18px; }
  h1 { font-size: 23px; }
  .q legend { font-size: 15.5px; }
  .opt { font-size: 14.5px; padding: 10px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* 研究一：每套问卷的指导语作为独立标题块，与题目分开 */
.sec-head {
  margin: 2px 0 20px;
  padding: 16px 18px;
  background: #f2f6fa;
  border-left: 4px solid #8fadc4;
  border-radius: 8px;
}
.sec-intro {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.85;
  color: #2f4457;
}
.sec-head + .q { border-top: 0; padding-top: 0; }
.text-answer {
  width: 100%;
  margin-top: 4px;
  padding: 12px 14px;
  font-size: 16px;
  border: 1px solid #d3d9df;
  border-radius: 10px;
  background: #fff;
}
.text-answer:focus {
  outline: none;
  border-color: #5b8db8;
  box-shadow: 0 0 0 3px rgba(91, 141, 184, .15);
}
.opts-long { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* 二测完成页的事后解说 */
.debrief {
  margin: 22px 0 6px;
  padding: 16px 18px;
  background: #f7f8fa;
  border: 1px solid #e3e7ec;
  border-radius: 10px;
  text-align: left;
}
.debrief h3 { margin: 0 0 8px; font-size: 15px; color: #33475b; }
.debrief p { margin: 0; font-size: 13.5px; line-height: 1.9; color: #4a5b6b; }
