/* ================= 学业潜能测评 · 全局样式 ================= */
:root {
  --blue: #1f4e8c;
  --blue-d: #16365f;
  --ink: #26313d;
  --sub: #64748b;
  --line: #e3e9f2;
  --bg: #f2f6fc;
  --card: #ffffff;
  --power: #c0392b;
  --regular: #2471a3;
  --reflect: #1e8449;
  --amber: #b7791f;
  --good: #1e8449;
  --bad: #c0392b;
  --mid: #b7791f;
  --r: 14px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.7;
}
button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

/* ---------- 顶栏 ---------- */
.topbar {
  background: linear-gradient(100deg, var(--blue-d), var(--blue));
  color: #fff; padding: 10px 22px; display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 10px rgba(22,54,95,.18); position: sticky; top: 0; z-index: 50;
}
.topbar .brand { font-size: 17px; font-weight: 700; letter-spacing: .5px; }
.topbar .brand small { font-weight: 400; opacity: .75; margin-left: 10px; font-size: 12px; letter-spacing: 1px; }
.topbar .step { font-size: 13px; opacity: .9; }

.wrap { max-width: 900px; margin: 0 auto; padding: 26px 16px 70px; }
.view { display: none; }
.view.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1; transform:none;} }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: 0 2px 14px rgba(30,58,95,.07); padding: 22px 24px; margin-bottom: 18px; border: 1px solid rgba(227,233,242,.8); }
.card h2 { font-size: 18px; color: var(--blue-d); margin-bottom: 8px; }
.card .sub { color: var(--sub); font-size: 13px; margin-bottom: 14px; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }

/* ---------- 首页 ---------- */
.hero { text-align: center; padding: 8px 6px 2px; }
.hero h1 { font-size: 27px; color: var(--blue-d); letter-spacing: 1px; }
.hero .badge { display:inline-block; margin-top:10px; font-size:12px; color:var(--blue); background:#e8f0fb; border:1px solid #cdddf3; border-radius:20px; padding:3px 12px;}
.hero p.desc { color: var(--sub); margin: 12px auto 0; max-width: 620px; font-size: 14px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 4px; }
.field input, .field select {
  width: 100%; border: 1px solid #ccd7e5; border-radius: 9px; padding: 9px 12px; font-size: 15px;
  background: #fff; outline: none; transition: border .15s;
}
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,78,140,.12); }

.btn { border: 0; border-radius: 10px; padding: 12px 26px; font-size: 16px; font-weight: 700; color: #fff; background: linear-gradient(120deg, var(--blue), #2f6cb5); box-shadow: 0 4px 14px rgba(31,78,140,.28); transition: transform .1s, box-shadow .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(31,78,140,.34); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background:#fff; color: var(--blue); border:1px solid #bcd0ea; box-shadow:none; font-weight:600; }
.btn.small { font-size: 13px; padding: 7px 14px; border-radius: 8px; }
.btn[disabled] { opacity:.5; cursor:not-allowed; transform:none; box-shadow:none; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.demo { font-size: 12px; color: var(--sub); margin-top: 12px; }
.demo a { color: var(--blue); cursor: pointer; text-decoration: underline; }

/* ---------- 答题页 ---------- */
.quiz-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.quiz-head .qcount { font-size: 13px; color: var(--sub); }
.progress-track { height: 10px; background: #e4ebf5; border-radius: 99px; overflow: hidden; flex: 1; min-width: 180px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), #4a8ac8); width: 0%; transition: width .3s; border-radius: 99px; }

.qcard { min-height: 300px; display: flex; flex-direction: column; justify-content: space-between; }
.qmeta { display: flex; justify-content: space-between; align-items: center; color: var(--sub); font-size: 13px; }
.qnum { font-size: 12px; background: #eef3fb; color: var(--blue); border-radius: 8px; padding: 2px 10px; font-weight: 700; }
.qstem { font-size: 20px; font-weight: 600; color: var(--ink); margin: 22px 0 26px; line-height: 1.8; }

/* 9点量表 */
.scale { display: flex; align-items: flex-start; gap: 4px; flex-wrap: wrap; }
.scale .opt { flex: 1 1 0; min-width: 52px; text-align: center; }
.scale .opt input { position: absolute; opacity: 0; pointer-events: none; }
.scale .opt label {
  display: block; border: 1.5px solid #ccd7e5; border-radius: 10px; padding: 10px 0; font-size: 16px; font-weight: 700;
  color: var(--sub); cursor: pointer; transition: all .15s; background: #fff; user-select: none;
}
.scale .opt:hover label { border-color: #9db9dd; }
.scale .opt input:checked + label { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 3px 10px rgba(31,78,140,.3); }
.scale-anchors { display: flex; justify-content: space-between; color: var(--sub); font-size: 12px; margin: 8px 4px 0; }

/* A/B 迫选 */
.abwrap { display: grid; grid-template-columns: 1fr; gap: 12px; }
.ab-opt { display: flex; gap: 12px; align-items: flex-start; border: 1.5px solid #ccd7e5; border-radius: 12px; padding: 14px 16px; cursor: pointer; background: #fff; transition: all .15s; }
.ab-opt:hover { border-color: #9db9dd; }
.ab-opt.on { border-color: var(--blue); background: #eef5fd; box-shadow: 0 0 0 3px rgba(31,78,140,.12); }
.ab-opt .tag { flex: none; width: 30px; height: 30px; border-radius: 50%; background: #eef3fb; color: var(--blue); display: flex; align-items: center; justify-content: center; font-weight: 800; }
.ab-opt.on .tag { background: var(--blue); color: #fff; }
.ab-opt .txt { flex: 1; font-size: 15.5px; line-height: 1.7; }
.ab-opt .mark { color: #fff; }

.qnav { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 22px; }
.qnav .spacer { width: 96px; }
.qsubmit-hint { font-size: 12px; color: var(--amber); text-align: center; margin-top: 8px; }

/* 答题卡 */
details.sheet { margin-top: 16px; }
details.sheet summary { cursor: pointer; color: var(--blue); font-size: 14px; font-weight: 600; list-style: none; }
details.sheet summary::before { content: '▸ '; }
details.sheet[open] summary::before { content: '▾ '; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 6px; margin-top: 10px; }
.sheet-grid button { height: 34px; border-radius: 8px; border: 1.5px dashed #e05252; background: #fff; font-size: 13px; color: #c0392b; }
.sheet-grid button.done { background: var(--blue); border-color: var(--blue); border-style: solid; color: #fff; }
.sheet-grid button.cur { outline: 2px solid var(--amber); }
.sheet-grid button.ab { font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: 42px; transform: translateX(-50%); background: #26313d; color: #fff; padding: 10px 20px; border-radius: 99px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .25s, bottom .25s; z-index: 99; }
.toast.show { opacity: 1; bottom: 52px; }

/* ---------- 确认弹窗（沙箱 iframe 中原生 confirm 不可用，使用页面内弹窗） ---------- */
.modal-mask { position: fixed; inset: 0; background: rgba(18, 30, 43, .48); display: flex; align-items: center; justify-content: center; z-index: 300; animation: fadeIn .18s ease; }
.modal-box { background: #fff; border-radius: 16px; box-shadow: 0 18px 50px rgba(10, 25, 41, .28); width: min(92vw, 420px); padding: 26px 26px 20px; text-align: center; animation: popIn .18s ease; }
.modal-title { font-size: 18px; font-weight: 700; color: var(--blue-d, #1b4f72); margin-bottom: 10px; }
.modal-msg { font-size: 14.5px; color: #3d4a5a; line-height: 1.75; margin-bottom: 20px; white-space: pre-line; }
.modal-btns { display: flex; gap: 12px; justify-content: center; }
.modal-btns .btn { min-width: 130px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- 报告通用 ---------- */
.rep-actions { display: flex; gap: 10px; justify-content: center; margin-bottom: 20px; flex-wrap: wrap; }
.section-title { font-size: 19px; color: var(--blue-d); border-left: 5px solid var(--blue); padding-left: 12px; margin: 26px 0 14px; }
.card.rep h3 { color: var(--blue-d); }

/* 有效性与图例 */
.banner-warn { background: #fdf3e3; border: 1px solid #eed9ae; color: #7a5b13; border-radius: 12px; padding: 12px 16px; font-size: 14px; margin-bottom: 14px; }
.score-legend { margin: 12px 0; }
.legend-chip { display: inline-block; border-radius: 99px; padding: 4px 12px; font-size: 12.5px; white-space: nowrap; margin: 0 10px 8px 0; }
.legend-chip.high { background:#e7f4ea; color: var(--good); border:1px solid #bfe3c7;}
.legend-chip.mid { background:#fdf3e3; color: var(--mid); border:1px solid #eed9ae;}
.legend-chip.low { background:#fbe9e7; color: var(--bad); border:1px solid #f2c3bd;}

/* 三大维度 */
.sup-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 700px) { .sup-row { grid-template-columns: 1fr; } .form-grid{grid-template-columns:1fr;} }
.sup-card { border: 1px solid var(--line); border-radius: 13px; padding: 16px; text-align: center; background: #fff; min-width: 0; overflow-wrap: break-word; }
.sup-card .sname { font-size: 15px; font-weight: 800; }
.sup-card .score { font-size: 40px; font-weight: 800; line-height: 1.1; }
.sup-card .of { color: var(--sub); font-size: 13px; }
.sup-card .tag { display: inline-block; margin-top: 8px; font-size: 13px; padding: 2px 14px; border-radius: 99px; color: #fff; }
.tag.high { background: var(--good); } .tag.low { background: var(--bad); }

.combo-box { border: 2px solid #f0c98f; background: linear-gradient(120deg,#fffaf1,#fef3e0); border-radius: 14px; padding: 16px 20px; margin-top: 14px; }
.combo-box .ct { font-weight: 800; color:#8a5a10; font-size: 16px; }
.combo-box .cx { font-size: 13px; color:#8a5a10; margin-top: 4px; }

/* 雷达 */
.radar-wrap { text-align: center; }
.radar-wrap svg { max-width: 100%; }
.radar-tip { font-size: 12px; color: var(--sub); }

/* 维度卡片 */
.group-title { font-size: 17px; font-weight: 800; color: var(--blue-d); margin: 26px 0 4px; display:flex; align-items:center; gap:8px; }
.group-title small { color: var(--sub); font-weight: 400; font-size: 12px; }
.dim-card { border: 1px solid var(--line); border-left: 4px solid var(--blue); border-radius: 11px; padding: 12px 16px; margin-bottom: 10px; background: #fff; }
.dim-card.power { border-left-color: var(--power);} .dim-card.regular { border-left-color: var(--regular);} .dim-card.reflect { border-left-color: var(--reflect);} .dim-card.none { border-left-color:#8a97a5;}
.dim-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.dim-name { font-weight: 700; font-size: 15px; }
.dim-score { display: flex; align-items: center; gap: 8px; }
.dim-score b { font-size: 17px; }
.bar-track { flex: 1; min-width: 120px; height: 8px; background: #e9eef5; border-radius: 99px; overflow: hidden; margin: 8px 0 4px; }
.bar-fill { height: 100%; border-radius: 99px; }
.bar-fill.high { background: linear-gradient(90deg,#27ae60,#52c07a); }
.bar-fill.mid { background: linear-gradient(90deg,#e0a03a,#f0c05e); }
.bar-fill.low { background: linear-gradient(90deg,#d64545,#ef7a7a); }
.dim-def { color: var(--sub); font-size: 13px; margin: 6px 0 2px; }
.dim-mean { font-size: 13.5px; margin-top: 4px; }
.dim-advice { margin-top: 6px; font-size: 13.5px; background: #f6f9fd; border-radius: 9px; padding: 8px 12px; border-left: 3px solid #bcd0ea; }
.dim-advice b { color: var(--blue); }

/* 风格 / MBTI */
.st-item, .mbti-pair { margin-bottom: 12px; }
.st-head, .pair-head { display:flex; justify-content: space-between; font-size:14px; margin-bottom:4px; }
.st-strong { display: inline-block; background:#e7f4ea; color:var(--good); border-radius:99px; font-size:11px; padding:0 8px; }
.pair-bar { display:flex; height:16px; border-radius:99px; overflow:hidden; background:#edf1f7; }
.pair-bar .side { display:flex; align-items:center; justify-content:center; color:#fff; font-size:11px; font-weight:700; min-width:0; }
.type-code { font-size: 30px; font-weight: 800; color: var(--blue); letter-spacing: 4px; }
.letter-list { display:grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media(max-width:700px){ .letter-list{grid-template-columns:1fr;} }
.letter-item { border:1px solid var(--line); border-radius:10px; padding: 10px 12px; }
.letter-item b { color: var(--blue); }

/* 建议汇总 */
.tips-list { counter-reset: tip; }
.tips-list .tip { position:relative; padding: 9px 0 9px 34px; border-bottom:1px dashed var(--line); font-size:14px; }
.tips-list .tip:last-child { border-bottom:0; }
.tips-list .tip::before { counter-increment: tip; content: counter(tip); position:absolute; left:0; top:10px; width:22px; height:22px; border-radius:50%; background:var(--blue); color:#fff; font-size:12px; font-weight:700; display:flex; align-items:center; justify-content:center; }

.foot-note { text-align:center; color:var(--sub); font-size:12px; margin-top:26px; }

/* 报告末尾联系老师 / 微信二维码 */
.contact-card { text-align: center; }
.contact-title { font-size: 16px; font-weight: 700; color: var(--blue-d); margin-bottom: 16px; }
.contact-body { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; }
.qr-wrap { text-align: center; }
.qr-img { width: 140px; height: 140px; border: 1px solid var(--line); border-radius: 10px; object-fit: contain; background: #fff; }
.qr-caption { font-size: 12px; color: var(--sub); margin-top: 8px; }
.contact-info { text-align: left; font-size: 14px; color: #3d4a5a; }
.ci-row { margin-bottom: 8px; }
.ci-row span { color: var(--sub); margin-right: 8px; }

/* 预约一对一解读入口（交互元素，不进 PDF） */
.appt-card { text-align: center; margin-top: 18px; }
.appt-title { font-size: 16px; font-weight: 700; color: var(--blue-d); margin-bottom: 8px; }
.appt-desc { font-size: 13px; color: var(--sub); margin-bottom: 16px; }
.appt-modal { text-align: left; }
.appt-modal .fld { margin-bottom: 14px; }
.appt-modal label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 6px; }
.appt-modal input, .appt-modal textarea, .appt-modal select {
  width: 100%; padding: 10px 12px; font-size: 14px; border: 1px solid #cfdbe7; border-radius: 8px; font-family: inherit; box-sizing: border-box;
}
.appt-modal input:focus, .appt-modal textarea:focus, .appt-modal select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,78,140,.12); outline: none; }
.appt-modal .btns { display: flex; gap: 12px; justify-content: flex-end; margin-top: 6px; }
.appt-modal .err { color: #c0392b; font-size: 13px; min-height: 18px; margin-top: 6px; }

/* ---------- 移动端响应式（P2 #16） ---------- */
@media (max-width: 700px) {
  .wrap { padding: 16px 12px 60px; }
  .topbar { padding: 9px 14px; }
  .topbar .brand { font-size: 15px; }
  .topbar .brand small { display: none; }
  .topbar .step { font-size: 12px; }
  .hero h1 { font-size: 21px; }
  .hero p.desc { font-size: 13px; }
  .card { padding: 18px 15px; }
  .card h2 { font-size: 16.5px; }
  .form-grid { grid-template-columns: 1fr; gap: 10px; }
  .qstem { font-size: 17px; margin: 16px 0 18px; line-height: 1.7; }
  .quiz-head { gap: 8px; }
  .progress-track { min-width: 100px; }
  .scale { gap: 3px; }
  .scale .opt { min-width: 0; }
  .scale .opt label { padding: 9px 0; font-size: 14px; }
  .scale-anchors { font-size: 11px; }
  .ab-opt { padding: 12px 12px; }
  .ab-opt .txt { font-size: 14.5px; }
  .qnav { flex-wrap: wrap; }
  .qnav .spacer { display: none; }
  .qnav .btn { flex: 1; }
  .sheet-grid { grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); }
  .section-title { font-size: 17px; }
  .sup-card .score { font-size: 32px; }
  .type-code { font-size: 24px; letter-spacing: 2px; }
  .contact-body { flex-direction: column; }
  .rep-actions .btn { flex: 1 1 100%; }
  .dim-top { gap: 6px; }
  .bar-track { min-width: 90px; }
}

/* ---------- 诊断摘要卡（结论先行） ---------- */
.summary-card { border-top: 3px solid var(--blue); }
.sum-conclusion { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.sum-conclusion-label { font-size: 12px; color: #fff; background: var(--blue); border-radius: 6px; padding: 2px 10px; font-weight: 700; }
.sum-conclusion-title { font-size: 20px; font-weight: 800; color: var(--blue-d); }
.sum-sups { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.sum-sup { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; text-align: center; }
.sum-sup-name { font-size: 13px; font-weight: 700; }
.sum-sup-score { font-size: 28px; font-weight: 800; line-height: 1.2; }
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.sum-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fbfcfe; }
.sum-block-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.sum-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.sum-chip { font-size: 12.5px; border-radius: 8px; padding: 3px 10px; }
.sum-chip b { margin-left: 2px; }
.sum-chip.good { background: #e8f4ec; color: var(--good); }
.sum-chip.bad { background: #fdecea; color: var(--bad); }
.sum-advice { font-size: 14px; background: #fff8ec; border: 1px solid #f3e2b8; border-left: 3px solid #e6a23c; border-radius: 9px; padding: 10px 14px; }
.sum-advice b { color: #b7791f; }
@media (max-width: 700px) {
  .sum-sups { grid-template-columns: 1fr; }
  .sum-grid { grid-template-columns: 1fr; }
}

/* ---------- 家长版速读 ---------- */
.parent-section { border-top: 3px solid #2e9e6b; }
.parent-intro { font-size: 13.5px; color: var(--sub); margin-bottom: 12px; }
.parent-list { display: flex; flex-direction: column; gap: 8px; }
.parent-item { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; background: #fff; }
.parent-item .pi-ico { flex: none; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 2px; }
.parent-item .pi-body { font-size: 13.5px; line-height: 1.6; }
.parent-item .pi-body b { color: var(--blue-d); }
.pi-good { background: var(--good); }
.pi-bad { background: var(--bad); }
.pi-tip { background: #e6a23c; }

/* ---------- 咨询师速览（后台专用） ---------- */
.consult-view { border-top: 3px solid #7d3c98; }
.consult-stat { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.consult-stat .cs-cell { border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; background: #fbfcfe; }
.consult-stat .cs-num { font-size: 22px; font-weight: 800; color: var(--blue-d); }
.consult-stat .cs-lbl { font-size: 12px; color: var(--sub); }
.cs-warn { font-size: 12px; color: var(--bad); font-weight: 700; }
.consult-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.consult-table th, .consult-table td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; }
.consult-table th { background: #eef3fb; color: var(--blue-d); font-weight: 700; }
.consult-table td.num { text-align: right; font-weight: 700; }
.consult-table tr.band-high td.num { color: var(--good); }
.consult-table tr.band-mid td.num { color: var(--mid); }
.consult-table tr.band-low td.num { color: var(--bad); }
.consult-table tr.band-low { background: #fdf6f6; }
.consult-alert { margin-top: 4px; }
.consult-alert .ca-item { font-size: 13.5px; padding: 7px 0 7px 28px; position: relative; border-bottom: 1px dashed var(--line); }
.consult-alert .ca-item::before { content: '!'; position: absolute; left: 2px; top: 8px; width: 18px; height: 18px; border-radius: 50%; background: var(--bad); color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
@media (max-width: 700px) {
  .consult-stat { grid-template-columns: 1fr 1fr; }
}

/* 打印 */
@media print {
  .topbar, .rep-actions, .appt-card, .contact-card { display: none !important; }
  body { background: #fff; }
  .card, .dim-card, .sum-block, .parent-item { break-inside: avoid; box-shadow: none; }
  .consult-table, .consult-table tr { break-inside: avoid; }
  .radar-wrap svg { page-break-inside: avoid; }
  .wrap { max-width: 100%; padding: 0; }
}
