/* =========================================================================
 * Brilliantet 留学方向测评 · 样式
 * 移动端优先（375px 基准），桌面端居中适配为卡片流。
 * 主色：靛蓝 #2E4B8F | 强调：活力橙 #F5A623 | 浅底：#F4F6FB
 * ========================================================================= */

:root {
  --primary: #2E4B8F;
  --primary-dark: #223b6f;
  --accent: #F5A623;
  --accent-dark: #dd8f12;
  --bg: #F4F6FB;
  --card: #FFFFFF;
  --text: #1F2937;
  --text-2: #6B7280;
  --line: #E5E9F2;
  --success: #16A34A;
  --radius: 16px;
  --radius-sm: 12px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --maxw: 480px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

body {
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

#app {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh; /* 与答题页 100dvh 对齐，移动端地址栏伸缩稳定 */
  display: flex;
  flex-direction: column;
}

/* ============ 视图切换 ============ */
.view { display: none; }
.view.is-active { display: flex; animation: fadeUp 300ms var(--ease); }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 1px 3px rgba(30, 41, 59, 0.06);
  padding: 20px;
}

/* ============ 欢迎页 ============ */
#view-welcome {
  flex-direction: column;
  justify-content: center;
  padding: 24px 16px 16px;
  flex: 1;
}
.welcome-card { text-align: center; padding: 28px 22px; }
.brand-badge {
  display: inline-block;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--primary);
  background: rgba(46, 75, 143, 0.08);
  border: 1px solid rgba(46, 75, 143, 0.15);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.welcome-title { font-size: 24px; line-height: 1.4; font-weight: 700; margin-bottom: 12px; }
.welcome-desc { font-size: 14px; color: var(--text-2); margin-bottom: 20px; }
.welcome-desc strong { color: var(--primary); font-weight: 600; }
.meta-list { list-style: none; margin-bottom: 22px; text-align: left; }
.meta-list li { font-size: 14px; color: var(--text-2); padding: 6px 0; display: flex; align-items: center; gap: 8px; }
.dot { font-style: normal; }
.tiny-note { margin-top: 12px; font-size: 12px; color: var(--text-2); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  min-height: 48px;
  padding: 0 20px;
  transition: transform 0.15s var(--ease), box-shadow 0.15s var(--ease), opacity 0.15s;
  font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-dark); box-shadow: 0 4px 14px rgba(46, 75, 143, 0.35); }
.btn-accent { background: var(--accent); color: #fff; width: 100%; }
.btn-accent:active { background: var(--accent-dark); box-shadow: 0 4px 14px rgba(245, 166, 35, 0.4); }
.btn-lg { width: 100%; height: 52px; font-size: 17px; }
.btn-ghost {
  background: #fff;
  color: var(--primary);
  border: 1px solid var(--line);
  box-shadow: none;
  flex: 1;
  min-height: 46px;
}

/* ============ 页脚 ============ */
.app-footer {
  text-align: center;
  font-size: 11px;
  color: #9aa3b2;
  padding: 18px 16px 22px;
  line-height: 1.6;
}

/* ============ 答题页 ============ */
#view-quiz {
  height: 100vh;
  height: 100dvh; /* 移动端地址栏伸缩稳定：答题页固定=可视视口高度，不随内容增长 */
  flex-direction: column;
  flex: 0 0 auto;
  min-height: 0;
  overflow: hidden;
}
.quiz-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
}
.prev-btn, .next-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 22px;
  line-height: 1;
  color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}
.prev-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.quiz-progress-wrap { flex: 1; }
.progress-track { height: 8px; background: #E6EAF3; border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 260ms var(--ease);
}
.quiz-count { text-align: center; font-size: 12px; color: var(--text-2); margin-top: 4px; }

/* 答题页纵向弹性布局：header 固定、内容区独立滚动（min-height:0）、footer 始终贴底 */
.quiz-body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 6px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
/* 底部“下一题”显式通栏主按钮：
   .btn 基础类为 inline-flex，WebKit 下 <button> 即使 display:block 也不会自动拉伸（shrink-to-fit），
   必须显式 width:100% 才能铺满内容区；不依赖内联 style.display 决定的宽度行为。 */
#btn-next-bottom {
  width: 100%;
  display: block;
  text-align: center;
  box-sizing: border-box;
}
.part-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--accent-dark);
  background: rgba(245, 166, 35, 0.12);
  padding: 2px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}
.quiz-title { font-size: 20px; line-height: 1.45; font-weight: 700; margin-bottom: 8px; }
.quiz-hint { font-size: 13px; color: var(--text-2); margin-bottom: 18px; }

.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 16px;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease);
  font-family: inherit;
}
.option:active { transform: scale(0.99); }
.option.is-selected {
  border-color: var(--primary);
  background: rgba(46, 75, 143, 0.06);
}
.option.is-selected::before {
  content: "✓";
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  width: 22px; height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.option:not(.is-selected)::before {
  content: "";
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--line);
  flex-shrink: 0;
}

/* 5 点量表 */
.scale-row { display: flex; flex-direction: column; gap: 8px; }
.scale-item { display: flex; align-items: center; justify-content: space-between; min-height: 52px; }
.scale-label { font-size: 14px; color: var(--text-2); flex: 1; }
.scale-dots { display: flex; gap: 8px; }
.scale-dot {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-2);
}
.scale-dot.is-selected { border-color: var(--primary); background: var(--primary); color: #fff; }

.quiz-footer {
  padding: 12px 16px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  z-index: 5;
  background: var(--bg);
}

/* 通用按钮禁用态（矩阵量表页“下一页”置灰） */
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

/* 矩阵量表页（Part2 一页 6 行） */
.lg-grid { display: flex; flex-direction: column; gap: 6px; }
.lg-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); padding: 0 4px 6px; }
.lg-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 60px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.lg-row:last-child { border-bottom: none; }
.lg-text { flex: 1 1 58%; font-size: 15px; line-height: 1.45; color: var(--text-1); }
.lg-dots { flex: 0 0 40%; display: flex; justify-content: space-between; gap: 4px; }
.lg-dot {
  width: 30px; height: 30px; max-width: 100%;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s var(--ease);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: var(--text-2);
  padding: 0;
}
.lg-dot.is-selected { border-color: var(--primary); background: var(--primary); color: #fff; }

/* ============ 加载页 ============ */
#view-loading { flex-direction: column; justify-content: center; align-items: center; padding: 24px 16px; flex: 1; }
.loading-card { text-align: center; padding: 40px 20px; min-height: 220px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.spinner {
  width: 44px; height: 44px;
  border: 4px solid #e6eaf3;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin-bottom: 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-title { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.loading-text { font-size: 14px; color: var(--text-2); min-height: 44px; }

/* ============ 结果页 ============ */
#view-result { flex-direction: column; flex: 1; }
.result-scroll { overflow-y: auto; padding: 20px 16px 8px; }
.result-head { text-align: center; margin-bottom: 16px; }
.result-kicker { font-size: 13px; color: var(--text-2); letter-spacing: 1px; margin-bottom: 6px; }
.result-title { font-size: 24px; font-weight: 800; color: var(--primary); line-height: 1.3; }
.result-slogan { font-size: 14px; color: var(--accent-dark); margin-top: 4px; }

.radar-card { margin-bottom: 14px; padding: 12px 12px 8px; }
.radar-card canvas { max-width: 100%; }

.type-card { margin-bottom: 14px; }
.type-card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.type-emoji { font-size: 34px; width: 58px; height: 58px; background: rgba(46, 75, 143, 0.08); border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.type-name { font-size: 20px; font-weight: 700; color: var(--primary); }
.type-en { font-size: 13px; color: var(--text-2); letter-spacing: 0.4px; }
.type-desc { font-size: 14.5px; color: var(--text); background: var(--bg); padding: 12px 14px; border-radius: var(--radius-sm); }

.section-block { margin-top: 18px; }
.section-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 10px; }

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 6px;
  /* 负外边距抵消 .card 左右 20px padding，让横滑轨道满宽、可横向滑动；
     同时用等量左右内边距，使首个 chip 与正文（标题）左对齐、末个 chip 右侧保留对称留白，
     不产生整页横向溢出（scrollWidth 控制在轨道内部）。 */
  margin-right: -20px;
  margin-left: -20px;
  padding-right: 20px;
  padding-left: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.chip-scroll::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  min-height: 34px;
  padding: 6px 13px;
  font-size: 13.5px;
  color: var(--primary);
  background: rgba(46, 75, 143, 0.07);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.major-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.major-list li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.major-list li::before { content: "◆"; color: var(--accent); font-size: 9px; margin-top: 5px; flex-shrink: 0; }

/* ============ v2：岗位发展区 ============ */
.career-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 8px;
}
.career-ico { flex-shrink: 0; }
.career-label {
  flex-shrink: 0;
  font-weight: 600;
  color: var(--primary);
}

/* ============ v2：四地硕士项目推荐 ============ */
.program-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 4px;
  /* 负外边距抵消 .card 左右 padding，轨道满宽可滑动；等量左右内边距保证首 tab 与正文左对齐、
     末 tab 右侧保留对称留白，且不产生整页横向溢出。 */
  margin-right: -20px;
  margin-left: -20px;
  padding-right: 20px;
  padding-left: 20px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.program-tabs::-webkit-scrollbar { display: none; }
.program-tab {
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 16px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--bg);
  border: 1.5px solid transparent;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.program-tab.is-active {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}
.program-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.program-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}
.program-item-name { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1.4; }
.program-item-school { font-size: 12.5px; color: var(--primary); font-weight: 600; }
.program-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.program-tag {
  font-size: 11px;
  color: var(--accent-dark);
  background: rgba(245, 166, 35, 0.14);
  border-radius: 999px;
  padding: 2px 8px;
}

/* v2：副类型卡跨地区代表项目 */
.sub-programs { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sub-program-item {
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
}
.sub-program-item b { color: var(--primary); font-weight: 600; }

/* 副类型卡片 */
.type-card-sub { border: 1px dashed var(--line); box-shadow: none; }
.sub-tag { font-size: 12px; color: var(--accent-dark); margin-bottom: 6px; letter-spacing: 0.5px; }
.sub-desc { font-size: 13.5px; color: var(--text-2); margin-bottom: 12px; }
.sub-jobs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.sub-jobs .chip { font-size: 12px; min-height: 28px; }
.sub-majors { font-size: 13px; color: var(--text); }
.sub-majors p { margin-bottom: 4px; }
.sub-majors b { color: var(--primary); }

/* 留资卡片 */
.lead-card { margin-bottom: 14px; }
.lead-title { font-size: 18px; font-weight: 700; color: var(--primary); margin-bottom: 4px; }
.lead-sub { font-size: 13px; color: var(--text-2); margin-bottom: 16px; }
.lead-form { display: flex; flex-direction: column; gap: 14px; }
.field-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 6px; font-weight: 600; }
.field-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus { border-color: var(--primary); }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-select {
  min-height: 36px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.chip-select.is-selected { border-color: var(--primary); background: rgba(46, 75, 143, 0.08); color: var(--primary); font-weight: 600; }
.lead-error {
  font-size: 12.5px;
  color: #dc2626;
  min-height: 0;
  display: none;
  background: rgba(220, 38, 38, 0.06);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.lead-error.show { display: block; }

/* 留资字段单项错误 */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-error {
  display: none;
  font-size: 12px;
  color: #dc2626;
}
.field.has-error .field-input { border-color: #dc2626; }
.field.has-error .field-error { display: block; }
/* 四地硕士项目推荐说明小字 */
.program-note { font-size: 12px; color: var(--text-2); margin: 4px 0 12px; line-height: 1.6; }
.lead-success { text-align: center; }
.success-check { font-size: 15px; font-weight: 700; color: var(--success); margin-bottom: 14px; }
.qr-placeholder {
  width: 120px; height: 120px;
  margin: 0 auto 12px;
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-2);
  background: #fafbfe;
}
.lead-hint { font-size: 12px; color: var(--text-2); }

.result-actions { display: flex; gap: 10px; margin: 8px 0 4px; }

/* ============ 雷达图降级进度条 ============ */
#radar-canvas { height: 260px; }
.fb-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.fb-name { width: 86px; font-size: 12px; color: var(--text-2); flex-shrink: 0; text-align: right; }
.fb-track { flex: 1; height: 10px; background: #E6EAF3; border-radius: 999px; overflow: hidden; }
.fb-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--primary), var(--accent)); }
.fb-val { width: 34px; font-size: 12px; color: var(--primary); font-weight: 700; text-align: left; flex-shrink: 0; }

/* ============ 桌面端居中增强 ============ */
@media (min-width: 481px) {
  .welcome-title { font-size: 26px; }
}