:root {
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1a1d21;
  --muted: #6b7280;
  --primary: #4f6ef7;
  --border: #e5e7eb;
  --low: #047857;
  --mid: #b45309;
  --high: #b91c1c;
  --radius: 12px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
.container { max-width: 860px; margin: 0 auto; padding: 24px 16px 64px; }
header.site { text-align: center; padding: 32px 0 8px; }
header.site h1 { font-size: 26px; margin-bottom: 6px; }
header.site p { color: var(--muted); }
.disclaimer {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 16px 0 28px;
  font-size: 14px;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.scale-card { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.scale-card h2 { font-size: 18px; margin-bottom: 4px; }
.scale-card p { color: var(--muted); font-size: 14px; }
.btn {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 22px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { opacity: 0.9; }
.btn[disabled] { background: #c3c8d4; cursor: not-allowed; }
.btn.ghost {
  background: transparent;
  color: var(--primary);
  border: 1px solid var(--primary);
}
.btn.danger { background: var(--high); }
.badge {
  display: inline-block;
  padding: 2px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.badge.low { background: var(--low); }
.badge.mid { background: var(--mid); }
.badge.high { background: var(--high); }
/* 答题页 */
.progress { height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; margin: 20px 0; }
.progress > div { height: 100%; background: var(--primary); transition: width 0.25s; }
.question { padding: 20px; }
.question h3 { font-size: 17px; margin-bottom: 16px; }
.options { display: grid; gap: 10px; }
.option {
  background: var(--card);
  font: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.option:hover { border-color: var(--primary); }
.option.selected { border-color: var(--primary); background: #eef1fe; }
/* 进度文字与题目切换动画 */
.progress-wrap { margin: 20px 0; }
.progress-wrap .progress { margin: 6px 0 0; }
.progress-text { font-size: 13px; color: var(--muted); }
.q-content.slide-fwd { animation: slide-fwd 0.18s ease-out; }
.q-content.slide-back { animation: slide-back 0.18s ease-out; }
@keyframes slide-fwd {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes slide-back {
  from { opacity: 0; transform: translateX(-16px); }
  to { opacity: 1; transform: translateX(0); }
}
/* 倒计时条 */
.countdown {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #eef1fe;
  border-radius: var(--radius);
  padding: 10px 14px;
  margin-top: 16px;
}
.countdown-track { flex: 1; height: 6px; background: #dfe4fb; border-radius: 3px; overflow: hidden; }
.countdown-fill { height: 100%; background: var(--primary); border-radius: 3px; animation: countdown-shrink 3s linear forwards; } /* 时长需与 test.js 的 COUNTDOWN_MS 一致 */
.countdown-text { font-size: 14px; white-space: nowrap; }
.countdown-cancel { padding: 4px 14px; font-size: 13px; white-space: nowrap; }
@keyframes countdown-shrink {
  from { width: 100%; }
  to { width: 0%; }
}
.option:active { transform: scale(0.98); }
@media (prefers-reduced-motion: reduce) {
  .q-content.slide-fwd, .q-content.slide-back, .countdown-fill { animation: none; }
  .progress > div { transition: none; }
}
/* 报告页 */
.report-total { display: flex; align-items: center; gap: 24px; }
.score-num { font-size: 52px; font-weight: 700; }
.bar-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.bar-row .label { width: 90px; font-size: 14px; flex-shrink: 0; }
.bar-row .track { flex: 1; height: 12px; background: var(--border); border-radius: 6px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 6px; }
.bar-row .num { width: 52px; text-align: right; font-size: 13px; color: var(--muted); }
.interp-section h2 { font-size: 17px; margin: 22px 0 8px; }
.interp-section p { color: #374151; font-size: 15px; }
.advice { background: #eef1fe; border-radius: var(--radius); padding: 16px; margin-top: 24px; }
.advice h2 { font-size: 16px; margin-bottom: 6px; }
footer.site { text-align: center; color: var(--muted); font-size: 13px; margin-top: 40px; }
footer.site a { color: var(--primary); margin: 0 10px; }
/* 历史页 */
.history-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.history-item .meta { flex: 1; }
.history-item .meta .scale { font-weight: 600; }
.history-item .meta .time { color: var(--muted); font-size: 13px; }
.history-item .score { text-align: right; margin-right: 12px; }
.empty-tip { text-align: center; color: var(--muted); padding: 48px 0; }
@media (max-width: 560px) {
  .scale-card { flex-direction: column; align-items: stretch; }
  .report-total { flex-direction: column; gap: 8px; }
  body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .option { padding: 14px 16px; }
  .question { padding: 16px 14px; }
  .countdown { flex-wrap: wrap; }
  .countdown-track { flex-basis: 100%; }
  .countdown-text { flex: 1; }
  #test-actions { flex-wrap: wrap; gap: 10px; }
  #test-actions .btn { flex: 1; padding: 12px 0; }
}

/* 登录与用户区 */
.text-input {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  font-size: 16px;
  font-family: inherit;
}
.text-input:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* 顶部固定导航栏 */
#navbar { position: sticky; top: 0; z-index: 100; }
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 6px 16px;
}
.nav-items { display: flex; gap: 6px; }
.nav-item {
  display: inline-block;
  padding: 9px 18px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
}
.nav-item:hover { color: var(--primary); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-user {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 14px;
  min-width: 0;
}
.nav-user .nickname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-switch { padding: 4px 14px; font-size: 13px; white-space: nowrap; }
@media (max-width: 560px) {
  .nav-item { padding: 8px 14px; font-size: 14px; }
  .nav-user { font-size: 13px; }
  .nav-switch { padding: 3px 10px; }
}
