.survey-body {
  min-height: 100vh;
  background:
    radial-gradient(1000px 420px at 50% -120px, rgba(79, 124, 255, 0.16), transparent 70%),
    var(--bg);
}

.survey-shell {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 64px;
}

.survey-progress {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(244, 246, 250, 0.88);
  backdrop-filter: blur(10px);
  padding: 10px 0;
}
.survey-progress-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 99px;
  background: #e3e8f4;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--brand), #7ea2ff);
  transition: width 0.3s ease;
}
.progress-label { font-size: 12px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }

.survey-hero {
  padding: 26px 4px 18px;
}
.survey-hero h1 {
  font-size: 25px;
  line-height: 1.4;
  letter-spacing: 0.2px;
}
.survey-hero .hero-desc {
  margin-top: 12px;
  font-size: 14px;
  color: var(--text-2);
  white-space: pre-wrap;
}
.hero-meta {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 4px 10px;
}
.pill.ghost { background: rgba(255, 255, 255, 0.8); color: var(--text-2); border: 1px solid var(--line); }

.survey-page { display: none; }
.survey-page.active { display: block; animation: pageIn 0.32s ease; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 4px 12px;
}
.page-head h2 { font-size: 18px; }
.page-head .page-index { font-size: 12px; color: var(--text-3); }

.q-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
  border: 1px solid transparent;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  scroll-margin-top: 70px;
}
.q-card.invalid {
  border-color: #f1b6b8;
  box-shadow: 0 0 0 3px rgba(229, 72, 77, 0.08);
}
.q-title {
  font-size: 15.5px;
  font-weight: 600;
  line-height: 1.65;
  color: var(--text);
  word-break: break-word;
}
.q-title .req { color: var(--danger); margin-right: 3px; font-weight: 700; }
.q-desc {
  display: block;
  margin-top: 3px;
  font-size: 12.5px;
  color: var(--text-3);
  font-weight: 400;
  white-space: pre-wrap;
}
.q-body { margin-top: 12px; }
.q-error {
  display: none;
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: 6px;
  padding: 6px 10px;
}
.q-card.invalid .q-error { display: block; }

.options { display: flex; flex-direction: column; gap: 8px; }
.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  cursor: pointer;
  transition: 0.15s ease;
  background: #fff;
  font-size: 14.5px;
  line-height: 1.55;
}
.option:hover { border-color: #c4d1f5; background: #fafbff; }
.option input { position: absolute; opacity: 0; pointer-events: none; }
.option .mark {
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid #c3cad8;
  margin-top: 2px;
  position: relative;
  transition: 0.15s ease;
  background: #fff;
}
.option.multi .mark { border-radius: 5px; }
.option .mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand);
  transform: scale(0);
  transition: transform 0.15s ease;
}
.option.multi .mark::after { border-radius: 2px; }
.option:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 2px 8px rgba(79, 124, 255, 0.1);
}
.option:has(input:checked) .mark { border-color: var(--brand); }
.option:has(input:checked) .mark::after { transform: scale(1); }
.option .opt-text { flex: 1; }

.q-tip { font-size: 12px; color: var(--text-3); margin-top: 8px; }

.matrix-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px 2px; }
.matrix {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 460px;
  font-size: 13px;
}
.matrix th, .matrix td { border-bottom: 1px solid var(--line); padding: 8px 6px; text-align: center; vertical-align: middle; }
.matrix thead th {
  font-weight: 500;
  color: var(--text-2);
  font-size: 12.5px;
  white-space: nowrap;
  background: #f8f9fc;
}
.matrix thead th:first-child { border-radius: 8px 0 0 0; text-align: left; padding-left: 10px; }
.matrix thead th:last-child { border-radius: 0 8px 0 0; }
.matrix tbody th {
  text-align: left;
  font-weight: 400;
  color: var(--text);
  line-height: 1.5;
  padding: 10px;
  min-width: 220px;
}
.matrix td { width: 62px; }
.matrix tr:last-child th, .matrix tr:last-child td { border-bottom: none; }
.matrix .cell-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid #d3dae7;
  cursor: pointer;
  transition: 0.15s ease;
  position: relative;
  background: #fff;
}
.matrix .cell-label:hover { border-color: var(--brand); }
.matrix .cell-label input { position: absolute; opacity: 0; pointer-events: none; }
.matrix .cell-label:has(input:checked) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.matrix .cell-label:has(input:checked)::after {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
}
.matrix-invalid { outline: 2px solid rgba(229, 72, 77, 0.35); outline-offset: 4px; border-radius: 6px; }

.text-input-count { text-align: right; font-size: 12px; color: var(--text-3); margin-top: 5px; }

.q-index {
  color: var(--text-3);
  font-weight: 500;
  margin-right: 2px;
}

/* 星级评分 */
.rating { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.star { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; }
.star input { position: absolute; opacity: 0; pointer-events: none; }
.star-icon { font-size: 32px; line-height: 1; color: #d9dfea; transition: 0.15s ease; }
.star-num { font-size: 11.5px; color: var(--text-3); }
.star:hover .star-icon { color: #ffb400; }
.star:has(input:checked) .star-icon { color: #ffb400; text-shadow: 0 2px 6px rgba(255, 180, 0, 0.32); }
.star:has(input:checked) .star-num { color: #a06a00; font-weight: 600; }
.rating-labels { display: flex; justify-content: space-between; margin-top: 6px; font-size: 12px; color: var(--text-3); max-width: 380px; }

/* 排序题 */
.ranking { display: flex; flex-direction: column; gap: 6px; }
.rank-item {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 10px;
  background: #fff;
}
.rank-no {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  font-weight: 600;
}
.rank-label { flex: 1; font-size: 14px; }
.rank-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text-2);
  cursor: pointer;
}
.rank-btn:hover { border-color: var(--brand); color: var(--brand); }

/* 多项填空 */
.blank-list { display: flex; flex-direction: column; gap: 8px; }
.blank-row { display: flex; align-items: center; gap: 10px; }
.blank-label { flex: none; min-width: 96px; font-size: 13px; color: var(--text-2); }
.blank-row .input { flex: 1; }

.matrix .cell-label.multi { border-radius: 6px; }
.matrix .cell-label.multi:has(input:checked)::after { border-radius: 2px; }

.form-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.form-table th {
  text-align: left;
  font-weight: 500;
  color: var(--text-2);
  font-size: 12.5px;
  padding: 6px 8px 8px;
  border-bottom: 1px solid var(--line);
  width: 50%;
}
.form-table td { padding: 8px 8px 4px; vertical-align: top; }
.form-table textarea { min-height: 74px; }

.upload-box {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border: 1px dashed #cdd6e6;
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfe;
}
.upload-box.done { border-style: solid; border-color: #b9e3d3; background: #f3fbf8; }
.upload-name { font-size: 12.5px; color: var(--text-2); word-break: break-all; }
.upload-box .file-input { display: none; }

.survey-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
}
.survey-nav .nav-spacer { flex: 1; }
.nav-dots { display: flex; gap: 5px; align-items: center; }
.nav-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #d5dcea;
  transition: 0.2s;
}
.nav-dot.active { background: var(--brand); transform: scale(1.4); }

.survey-footer {
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  margin-top: 26px;
}
.survey-footer a { color: var(--text-3); }

/* 加载 / 结果 / 提示 */
.state-screen {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  gap: 12px;
}
.state-screen h2 { font-size: 20px; }
.state-screen p { color: var(--text-2); max-width: 420px; font-size: 14px; }
.state-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 28px;
}
.state-icon.ok { background: #e8f7f0; color: var(--ok); }
.state-icon.ok::after {
  content: "";
  width: 20px;
  height: 10px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: rotate(-45deg) translate(1px, -2px);
}
.state-icon.warn { background: #fff5e6; color: #d98300; }

.draft-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff8e8;
  border: 1px solid #f5e0b5;
  color: #8a5a00;
  font-size: 12.5px;
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
}
.draft-banner .spacer { flex: 1; }

.preview-banner {
  background: #fff4e6;
  color: #a35a00;
  font-size: 13px;
  text-align: center;
  padding: 7px 12px;
}

@media (max-width: 640px) {
  .survey-shell { padding: 0 12px 48px; }
  .survey-hero { padding: 18px 2px 12px; }
  .survey-hero h1 { font-size: 20px; }
  .q-card { padding: 15px 14px 13px; border-radius: 10px; }
  .q-title { font-size: 15px; }
  .matrix { min-width: 420px; }
  .matrix tbody th { min-width: 170px; font-size: 12.5px; }
  .nav-dots { display: none; }
  .survey-nav .btn { flex: 1; }
  .survey-nav .btn-primary { flex: 1.4; }
  .form-table, .form-table tbody, .form-table tr, .form-table td, .form-table th { display: block; width: 100%; }
  .form-table thead { display: none; }
  .form-table th { border: none; padding: 8px 0 4px; }
  .form-table td { padding: 0 0 6px; }
  .form-table tr { padding-bottom: 8px; }
}
/* 题号与必填标记间距 */
.q-index { margin-right: 4px; }

/* 小屏矩阵自适应，避免列被裁切 */
@media (max-width: 640px) {
  .matrix { min-width: 100%; }
  .matrix tbody th { min-width: 120px; font-size: 12px; padding: 8px 6px; }
  .matrix td { width: auto; padding: 6px 4px; }
  .matrix .cell-label { width: 24px; height: 24px; }
}
