/* 学习动力测评系统 —— 通用样式 */
:root {
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --brand-soft: #eff6ff;
  --bg: #f5f7fa;
  --card: #ffffff;
  --line: #e3e8ef;
  --text: #1f2937;
  --text-2: #4b5563;
  --muted: #6b7280;
  --ok: #16a34a;
  --warn: #f59e0b;
  --danger: #dc2626;
  --dim-a: #3b82f6;
  --dim-b: #f59e0b;
  --dim-c: #8b5cf6;
  --dim-d: #ef4444;
  --radius: 12px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.75;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* 顶栏 */
.topbar {
  background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 50;
}
.topbar-in {
  max-width: 1080px; margin: 0 auto; padding: 0 20px; height: 58px;
  display: flex; align-items: center; gap: 16px;
}
.logo { font-weight: 700; font-size: 17px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.logo-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); }
.spacer { flex: 1; }
.nav { display: flex; gap: 4px; }
.nav a { padding: 7px 12px; border-radius: 8px; color: var(--text-2); font-size: 14px; }
.nav a:hover { background: var(--brand-soft); color: var(--brand); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.user-chip { font-size: 13px; color: var(--muted); }

/* 布局 */
.wrap { max-width: 1080px; margin: 0 auto; padding: 26px 20px 60px; }
.wrap-narrow { max-width: 560px; }
h1 { font-size: 24px; margin: 0 0 8px; }
h2 { font-size: 19px; margin: 26px 0 12px; padding-left: 11px; border-left: 4px solid var(--brand); }
h3 { font-size: 16px; margin: 18px 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); font-size: 13px; }
.small { font-size: 13px; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px 22px; margin-bottom: 16px;
}
.card-t { font-size: 16px; font-weight: 700; margin-bottom: 12px; }

/* 按钮 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand); color: #fff; border: none; border-radius: 8px;
  padding: 9px 18px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn:disabled { background: #9ca3af; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--text-2); border: 1px solid var(--line); }
.btn-ghost:hover { background: #f3f4f6; color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field input, .field select {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.form-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

/* 提示 */
.msg { padding: 10px 14px; border-radius: 8px; font-size: 14px; margin-bottom: 14px; display: none; }
.msg.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.msg.ok { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.msg.info { background: var(--brand-soft); color: var(--brand-dark); border: 1px solid #bfdbfe; }

/* 首页 */
.hero {
  background: linear-gradient(135deg, #2563eb 0%, #3b82f6 55%, #60a5fa 100%);
  color: #fff; border-radius: 16px; padding: 40px 36px; margin-bottom: 18px;
}
.hero h1 { font-size: 28px; margin-bottom: 10px; }
.hero p { opacity: .95; margin-bottom: 4px; }
.hero .btn { background: #fff; color: var(--brand); font-weight: 600; }
.hero .btn-ghost { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.5); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step-n { width: 26px; height: 26px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.dim-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dim-card { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fff; }
.dim-card .bar { height: 4px; border-radius: 2px; margin-bottom: 10px; }
.dim-tag { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 4px; display: inline-block; margin-bottom: 6px; }

/* 测评页 */
.survey-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.progress { height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 10px 0 18px; }
.progress-in { height: 100%; background: var(--brand); width: 0; transition: width .25s; }
.q-group { margin-bottom: 22px; }
.q-group-t { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.q-item { padding: 14px 0; border-bottom: 1px dashed var(--line); }
.q-item:last-child { border-bottom: none; }
.q-text { margin-bottom: 10px; }
.q-no { display: inline-block; width: 24px; height: 24px; line-height: 24px; text-align: center;
  background: #f3f4f6; border-radius: 6px; font-size: 12px; color: var(--muted); margin-right: 8px; }
.opts { display: flex; gap: 8px; flex-wrap: wrap; }
.opt {
  flex: 1; min-width: 74px; text-align: center; padding: 8px 4px; border: 1px solid var(--line);
  border-radius: 8px; cursor: pointer; font-size: 14px; background: #fff; user-select: none;
  transition: all .15s;
}
.opt:hover { border-color: var(--brand); background: var(--brand-soft); }
.opt.on { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.q-item.warn { background: #fffbeb; margin: 0 -12px; padding: 14px 12px; border-radius: 8px; }

/* 结果 */
.score-box { display: grid; grid-template-columns: 260px 1fr; gap: 22px; align-items: center; }
.type-badge { display: inline-block; background: var(--brand); color: #fff; padding: 5px 16px;
  border-radius: 20px; font-size: 15px; font-weight: 700; }
.dim-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.dim-name { width: 92px; font-size: 14px; font-weight: 600; }
.dim-bar-wrap { flex: 1; height: 20px; background: #f1f5f9; border-radius: 4px; overflow: hidden; position: relative; }
.dim-bar { height: 100%; border-radius: 4px; }
.dim-val { width: 74px; font-size: 13px; color: var(--text-2); }
.step-item { display: flex; gap: 12px; margin-bottom: 14px; }
.step-i { flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--brand-soft); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.quote { background: #f8fafc; border-left: 3px solid var(--brand); padding: 12px 16px; border-radius: 0 8px 8px 0; margin: 10px 0; }
.tip-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; padding: 14px 16px; }
.alert-box { background: #fef2f2; border: 1px solid #fecaca; border-radius: 8px; padding: 14px 16px; }
.alert-box.warn { background: #fffbeb; border-color: #fde68a; }

/* 表格 */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
th { background: #f8fafc; font-weight: 700; font-size: 13px; }
.tbl-wrap { overflow-x: auto; }

/* 后台 */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.stat-n { font-size: 24px; font-weight: 700; color: var(--brand); line-height: 1.2; }
.stat-l { font-size: 12px; color: var(--muted); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin-bottom: 0; }
.filters input, .filters select { width: auto; min-width: 130px; }
.list-tbl td { font-size: 13px; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.pill-a { background: #eff6ff; color: #1d4ed8; }
.pill-b { background: #fffbeb; color: #b45309; }
.pill-c { background: #f5f3ff; color: #6d28d9; }
.pill-d { background: #fef2f2; color: #b91c1c; }
.pill-gray { background: #f3f4f6; color: #4b5563; }
.pill-high { background: #fee2e2; color: #b91c1c; }
.pill-mid { background: #ffedd5; color: #c2410c; }
.pill-low { background: #e0f2fe; color: #0369a1; }
.pill-none { background: #f3f4f6; color: #6b7280; }

/* 报告页 */
.report { background: #fff; max-width: 820px; margin: 0 auto; padding: 34px 38px; }
.report-h { border-bottom: 2px solid var(--brand); padding-bottom: 12px; margin-bottom: 20px; }
.report-h h1 { font-size: 22px; }
.report-meta { font-size: 13px; color: var(--muted); display: flex; gap: 18px; flex-wrap: wrap; }
.no-print { }

/* 打印 */
@media print {
  body { background: #fff; font-size: 12px; line-height: 1.6; }
  .topbar, .no-print, .btn, .nav { display: none !important; }
  .wrap { padding: 0; max-width: none; }
  .report { max-width: none; padding: 0; }
  .card { border: none; padding: 0; margin-bottom: 14px; page-break-inside: avoid; }
  h2 { page-break-after: avoid; }
  table { page-break-inside: avoid; }
  a { color: #000; text-decoration: none; }
}

/* ---- 平板 ---- */
@media (max-width: 860px) {
  .steps, .dim-grid { grid-template-columns: 1fr 1fr; }
  .score-box { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .form-2 { grid-template-columns: 1fr; }
  .wrap { padding: 20px 16px 48px; }
}

/* ---- 手机 ---- */
@media (max-width: 640px) {
  /* 顶栏 */
  .topbar-in { padding: 0 12px; height: auto; min-height: 52px; gap: 8px; flex-wrap: wrap; }
  .logo { font-size: 15px; }
  .nav a { padding: 7px 9px; font-size: 13px; }
  .user-chip { font-size: 12px; }
  .uc-name { display: none; }

  /* 布局 */
  .wrap { padding: 14px 12px 40px; }
  h1 { font-size: 20px; }
  h2 { font-size: 17px; margin: 20px 0 10px; }
  h3 { font-size: 15px; }
  .card { padding: 15px 14px; margin-bottom: 12px; }
  .card-t { font-size: 15px; }

  /* 首页 Hero */
  .hero { padding: 26px 18px; border-radius: 12px; }
  .hero h1 { font-size: 21px; }
  .hero .btn-row { flex-direction: column; }
  .hero .btn { width: 100%; }
  .steps, .dim-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat { padding: 12px; }
  .stat-n { font-size: 21px; }

  /* 按钮：触控目标 ≥44px */
  .btn { padding: 12px 18px; font-size: 15px; min-height: 44px; }
  .btn-sm { padding: 9px 12px; font-size: 13px; min-height: 38px; }
  .btn-row > .btn { flex: 1 1 auto; }

  /* 表单：字号 16px 防止 iOS 自动放大 */
  .field input, .field select,
  .filters input, .filters select { font-size: 16px; padding: 11px 12px; }
  .form-2 { gap: 0; }

  /* 后台筛选：两列排布 */
  .filters { gap: 8px; }
  .filters .field { flex: 1 1 calc(50% - 8px); }
  .filters input, .filters select { width: 100%; min-width: 0; }
  .filters .btn { flex: 1 1 100%; }

  /* 测评页：选项改 2×2 网格，触控友好 */
  .opts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .opt { min-width: 0; padding: 12px 4px; min-height: 46px; font-size: 15px; }
  .q-item { padding: 12px 0; }
  .q-item.warn { margin: 0; padding: 12px 10px; }
  .q-group { margin-bottom: 16px; }

  /* 结果页 */
  .score-box { gap: 14px; }
  .score-box svg { display: block; width: 100%; max-width: 300px; height: auto; margin: 0 auto; }
  .dim-row { gap: 8px; margin-bottom: 10px; }
  .dim-name { width: 66px; font-size: 13px; }
  .dim-val { width: 58px; font-size: 12px; }
  .type-badge { font-size: 14px; padding: 4px 12px; }
  .step-item { gap: 9px; }

  /* 报告页 */
  .report { padding: 18px 14px; }
  .report-h h1 { font-size: 19px; }
  .report-meta { gap: 10px; font-size: 12px; }

  /* 表格：窄屏横向滚动，不挤压 */
  .tbl-wrap { -webkit-overflow-scrolling: touch; }
  .tbl-wrap table { min-width: 420px; }
  .list-tbl { min-width: 560px; }
}

/* ---- 手机底部悬浮操作条（仅测评页用） ---- */
.mobile-bar { display: none; }
@media (max-width: 640px) {
  .mobile-bar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: #fff; border-top: 1px solid var(--line);
    padding: 10px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, .06);
  }
  .mb-cnt { font-size: 13px; color: var(--muted); white-space: nowrap; }
  .mobile-bar .btn { flex: 1; min-height: 44px; }
  body.has-mbar { padding-bottom: 74px; }
}
