:root {
  --bg: #f0f4f8;
  --bg-top: #e8f1fc;
  --fg: #0f172a;
  --accent: #1f6feb;
  --accent-soft: #eff6ff;
  --muted: #64748b;
  --card: #ffffff;
  --border: #e2e8f0;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
  font-size: 17px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 42%, #f8fafc 100%);
  background-attachment: fixed;
  color: var(--fg);
  font-family: "PingFang SC", "Noto Sans SC", "Source Han Sans SC", sans-serif;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
}
#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px 120px;
}
.loading, .state { text-align: center; padding: 48px 12px; color: var(--muted); }
.state h1 { font-size: 1.25rem; color: var(--fg); margin-bottom: 8px; }

/* —— 页头 —— */
.hero {
  border: 1px solid #dbeafe;
  border-radius: 24px;
  background: linear-gradient(135deg, #eff6ff 0%, #ffffff 55%, #f0fdfa 100%);
  padding: 18px 18px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.hero-kicker {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #94a3b8;
}
.hero-title {
  margin: 6px 0 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--fg);
  line-height: 1.35;
}
.hero-desc {
  margin: 8px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}
.greet { font-size: 1rem; margin: 0 0 12px; color: var(--muted); }
.anon-note {
  background: #eef4ff;
  color: #1849a9;
  padding: 12px 14px;
  border-radius: 14px;
  margin-bottom: 14px;
  font-size: 0.92rem;
  border: 1px solid #dbeafe;
}

/* —— 题卡 —— */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.q-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.q-badge {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: #1d4ed8;
  font-size: 0.85rem;
  font-weight: 700;
}
.q-title {
  flex: 1;
  font-weight: 650;
  font-size: 1.02rem;
  line-height: 1.45;
  padding-top: 4px;
  margin: 0;
}
.q-title .req { color: var(--danger); }
.q-meta {
  margin: -6px 0 12px 48px;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* —— 单选 / 多选选项 —— */
.opt-list { display: flex; flex-direction: column; gap: 10px; }
.opt {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: #fff;
  font-size: 1rem;
  text-align: left;
  color: #334155;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
  -webkit-appearance: none;
  appearance: none;
  font-family: inherit;
}
.opt:active { transform: scale(0.99); }
.opt.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #1e40af;
  font-weight: 650;
  box-shadow: 0 0 0 1px rgba(31, 111, 235, 0.12);
}
.opt-mark {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-right: 12px;
  border-radius: 999px;
  border: 2px solid #cbd5e1;
  background: #fff;
  position: relative;
}
.opt[data-multi] .opt-mark { border-radius: 6px; }
.opt.active .opt-mark {
  border-color: var(--accent);
  background: var(--accent);
}
.opt.active .opt-mark::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 2px;
  width: 6px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.opt-label { flex: 1; line-height: 1.4; }

/* —— 评分宫格 —— */
.rating-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
@media (min-width: 400px) {
  .rating-grid.cols-10 { grid-template-columns: repeat(10, 1fr); }
}
.rating-btn {
  min-height: 48px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: #334155;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, background .15s, color .15s;
  -webkit-appearance: none;
  appearance: none;
}
.rating-btn.active {
  border-color: #0f172a;
  background: #0f172a;
  color: #fff;
}
.rating-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  padding: 0 2px;
  font-size: 0.75rem;
  font-weight: 550;
  color: #94a3b8;
}

/* —— 文本输入 —— */
.input, .textarea {
  width: 100%;
  font-size: 1rem;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: 16px;
  background: #f8fafc;
  color: var(--fg);
  font-family: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input { min-height: 52px; }
.textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.input:focus, .textarea:focus {
  border-color: #93c5fd;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.12);
}

/* —— 底栏 —— */
.footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid #e2e8f0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 24px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.footer-inner {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.progress-text {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 550;
  white-space: nowrap;
}
.progress-track {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #3b82f6, #1d4ed8);
  transition: width .25s ease;
}
.footer-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.btn {
  min-height: 48px;
  border: none;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, opacity .15s;
}
.btn-primary {
  flex: 1.6;
  background: #0f172a;
  color: #fff;
}
.btn-primary:hover { background: #1e293b; }
.btn-secondary {
  flex: 1;
  background: #fff;
  color: #334155;
  border: 1.5px solid #cbd5e1;
}
.btn-secondary:hover { background: #f8fafc; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* 禁下拉：原生 select 不使用 */
select { display: none !important; }

/* 嵌入场景顶栏返回 */
.sf-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  min-height: 48px;
}
.sf-back {
  width: 48px;
  height: 48px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  color: var(--fg);
  font-family: inherit;
}
.sf-toolbar-title {
  font-size: 1.05rem;
  font-weight: 650;
  color: var(--fg);
}
