/* ============================================================
   AI 沉浸式模拟面试官 —— 界面样式
   设计取向：浅色专业控制台，报告区可直出 A4 PDF
   ============================================================ */
:root {
  --ink: #141b2d;
  --ink-2: #33405c;
  --muted: #6b7488;
  --line: #e4e8f0;
  --bg: #f3f5f9;
  --card: #ffffff;
  --brand: #2f4bd6;
  --brand-soft: #eef1ff;
  --cv: #0f8a6a;
  --cv-soft: #e8f6f1;
  --warn: #b45309;
  --warn-soft: #fdf4e7;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 27, 45, 0.04), 0 8px 24px rgba(20, 27, 45, 0.05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
b, strong { font-weight: 650; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }

.app { min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: 1280px; margin: 0 auto; padding: 22px 24px 40px; }

/* ------------------------------ 顶栏 ------------------------------ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 12px 24px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 11px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(140deg, #2f4bd6, #5b3fd8);
  color: #fff; font-weight: 700; font-size: 13px;
  display: grid; place-items: center; letter-spacing: 0.04em;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text strong { font-size: 15px; }
.brand-text span { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.privacy-chips { display: flex; gap: 6px; }
.chip {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line);
}
.chip-safe { background: var(--cv-soft); color: #0b6a52; border-color: #cdece1; }
.agent-count { font-size: 12px; color: var(--muted); }
.agent-count b { color: var(--brand); font-size: 15px; }

/* ------------------------------ 通用卡片 ------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; flex-wrap: wrap;
}
.card-head h2 { font-size: 16px; }
.muted { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 12px; }
.warn-text { color: var(--warn); font-size: 12px; margin-top: 10px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
input[type="text"], input[type="number"], textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fbfcfe;
  transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { resize: vertical; line-height: 1.7; }
input:focus, textarea:focus, select:focus {
  outline: none; border-color: #9aa9f2; box-shadow: 0 0 0 3px rgba(47, 75, 214, 0.1);
}
input[type="file"] {
  font-size: 12px; padding: 8px; border: 1px dashed #c9d2e3;
  border-radius: 10px; background: #fafbfe; width: 100%;
}

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 16px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.06s, background 0.15s, border-color 0.15s, opacity 0.15s;
  background: #eef1f7;
  color: var(--ink);
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 6px 16px rgba(47, 75, 214, 0.22); }
.btn-primary:hover:not(:disabled) { background: #2741c2; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { border-color: #c3cce0; }
.btn-danger-ghost { background: #fff; border-color: #f0c9c5; color: var(--danger); }
.btn-danger-ghost:hover:not(:disabled) { background: #fdf3f2; }
.btn-lg { width: 100%; padding: 12px 18px; font-size: 15px; margin-top: 6px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ------------------------------ 准备区 ------------------------------ */
.setup-grid { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 18px; margin-bottom: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }

.dossier-preview {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fbfcfe;
  min-height: 90px;
  font-size: 13px;
}
.dossier-preview.empty { color: var(--muted); display: grid; place-items: center; }
.dossier-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.dossier-head > div { display: flex; flex-direction: column; gap: 2px; }
.ds-name { font-size: 15px; }
.conf { font-size: 11px; color: var(--cv); background: var(--cv-soft); padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.ds-block { margin-bottom: 10px; display: flex; gap: 10px; align-items: flex-start; }
.ds-label { font-size: 11px; color: var(--muted); width: 58px; flex: none; padding-top: 3px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: var(--brand-soft); color: #2a3fae; border: 1px solid #dde3ff;
}
.ds-projects { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.ds-projects li { display: flex; gap: 8px; flex-wrap: wrap; }
.unconfirmed ul { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: #8a5310; }
.warn-dot { width: 6px; height: 6px; border-radius: 50%; background: #e39a3c; display: inline-block; margin-right: 6px; }

.switch-line {
  display: flex; justify-content: space-between; align-items: center; gap: 14px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcfe;
  margin-bottom: 16px;
}
.switch-line strong { font-size: 13px; }
.switch-line p { margin-top: 2px; }
.switch { position: relative; width: 44px; height: 24px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.slider {
  position: absolute; inset: 0; background: #d6dce8; border-radius: 999px;
  transition: background 0.2s; pointer-events: none;
}
.slider::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}
.switch input:checked + .slider { background: #e0763a; }
.switch input:checked + .slider::after { transform: translateX(20px); }

.sop { border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 14px; }
.sop h3 { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.sop-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.sop-list li {
  display: flex; justify-content: space-between; align-items: center;
  background: #f7f9fc; border-radius: 8px; padding: 7px 10px; font-size: 12px;
}
.sop-list li span { color: var(--muted); font-size: 11px; }

.manual-toggle { margin-bottom: 10px; }
.manual-box {
  border: 1px solid var(--line); border-radius: 12px; padding: 14px;
  background: #fbfcfe; margin-bottom: 12px;
}

/* ------------------------------ Agent 流程图 ------------------------------ */
.agent-map { margin-top: 0; }
.flow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.flow-node {
  flex: 1 1 150px; min-width: 140px;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px;
  background: #fbfcfe; display: flex; flex-direction: column; gap: 2px;
}
.flow-node b { font-size: 13px; }
.flow-node em { font-size: 11px; color: var(--muted); font-style: normal; }
.flow-tag { font-size: 10px; color: var(--muted); letter-spacing: 0.04em; }
.flow-live { border-color: #dde3ff; background: #f6f8ff; }
.flow-final { border-color: #cdece1; background: var(--cv-soft); }
.flow-cv { border-color: #cdece1; background: var(--cv-soft); flex: none; width: 210px; }
.flow-arrow { color: #b9c2d6; font-size: 18px; flex: none; }
.flow-side { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.flow-arrow-cv { font-size: 11px; color: var(--cv); flex: 1; letter-spacing: 0.06em; }
.agent-map .hint { margin-top: 10px; }

/* ------------------------------ 面试区 ------------------------------ */
.interview-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 74px; }
.video-card {
  position: relative; border-radius: var(--radius); overflow: hidden;
  background: #0f1524; aspect-ratio: 4 / 3; border: 1px solid #1b2438;
}
.video-card video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); display: block; }
.video-fallback {
  position: absolute; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center;
  color: #dbe3f4; background: repeating-linear-gradient(135deg, #121a2c, #121a2c 12px, #151e33 12px, #151e33 24px);
  text-align: center; gap: 4px;
}
.video-fallback span { font-weight: 650; font-size: 15px; }
.video-fallback p { font-size: 12px; color: #93a0bb; }
.video-fallback.show { display: flex; }
.video-badge {
  position: absolute; left: 10px; bottom: 10px;
  display: flex; align-items: center; gap: 6px;
  background: rgba(10, 14, 24, 0.7); color: #e7ecf8; font-size: 11px;
  padding: 4px 9px; border-radius: 999px; backdrop-filter: blur(6px);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: #e7b23c; display: inline-block; }
.dot.live { background: #34d399; box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.18); }
.dot.off { background: #f87171; }

.rail-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.rail-card h3 { font-size: 13px; margin-bottom: 8px; }
.cv-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.cv-stats li {
  background: #f7f9fc; border-radius: 8px; padding: 8px 10px;
  display: flex; flex-direction: column; gap: 1px;
}
.cv-stats span { font-size: 10px; color: var(--muted); }
.cv-stats b { font-size: 15px; color: var(--cv); }
.meta-list { display: flex; flex-direction: column; gap: 6px; }
.meta-list li { display: flex; justify-content: space-between; font-size: 12px; }
.meta-list span { color: var(--muted); }
.meta-list b { font-weight: 600; }

.chat-col { display: flex; flex-direction: column; gap: 12px; min-height: 60vh; }
.degrade-banner {
  display: flex; gap: 10px; align-items: center;
  background: var(--warn-soft); border: 1px solid #f2ddc0; color: #8a5310;
  border-radius: 12px; padding: 10px 14px; font-size: 12px;
}
.degrade-banner b { color: #7a4708; }

.stepper {
  display: flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); overflow-x: auto;
}
.step { display: flex; align-items: center; gap: 8px; flex: none; }
.step-index {
  width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  background: #eef1f7; color: var(--muted); font-size: 11px; font-weight: 700;
}
.step.current .step-index { background: var(--brand); color: #fff; }
.step.done .step-index { background: var(--cv-soft); color: var(--cv); }
.step-text { display: flex; flex-direction: column; line-height: 1.25; }
.step-text b { font-size: 12px; }
.step.current .step-text b { color: var(--brand); }
.step-text em { font-size: 10px; color: var(--muted); font-style: normal; }
.step-line { flex: 1; height: 1px; background: var(--line); min-width: 12px; }

.transcript {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; min-height: 260px; max-height: 46vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: var(--shadow);
}
.transcript:empty::before {
  content: "面试开始后，对话会实时出现在这里。";
  color: var(--muted); font-size: 12px; margin: auto;
}
.turn { display: flex; flex-direction: column; gap: 8px; }
.msg { max-width: 88%; border-radius: 12px; padding: 10px 13px; font-size: 13px; }
.msg-q { background: #f6f8ff; border: 1px solid #e2e8ff; align-self: flex-start; }
.msg-a { background: #f7fbf9; border: 1px solid #dcf0e8; align-self: flex-end; }
.msg-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 3px; }
.msg-meta .who { font-size: 11px; font-weight: 700; color: var(--brand); }
.msg-a .who { color: var(--cv); }
.msg-meta .stage { font-size: 10px; color: var(--muted); background: rgba(0, 0, 0, 0.03); padding: 1px 6px; border-radius: 999px; }
.msg p { white-space: pre-wrap; word-break: break-word; }

.composer {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
}
.question-card { border-left: 3px solid var(--brand); background: #fbfcff; border-radius: 8px; padding: 10px 14px; }
.q-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
#q-speaker { font-size: 12px; font-weight: 700; color: var(--brand); }
.q-tag { font-size: 10px; color: var(--muted); background: #eef1f7; padding: 1px 7px; border-radius: 999px; }
#q-text { font-size: 14px; line-height: 1.65; }
.composer textarea { min-height: 88px; }
.composer-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.composer-actions .hint { margin-left: auto; }

/* ------------------------------ 报告 ------------------------------ */
.report-shell { max-width: 980px; margin: 0 auto; }
.report-actions {
  display: flex; gap: 12px; align-items: center; margin-bottom: 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  box-shadow: var(--shadow);
}
.report {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 30px 34px 26px; box-shadow: var(--shadow);
}
.r-head { display: flex; flex-direction: column; gap: 16px; border-bottom: 2px solid var(--ink); padding-bottom: 18px; }
.r-kicker { font-size: 11px; letter-spacing: 0.08em; color: var(--brand); font-weight: 700; }
.r-title h1 { font-size: 25px; margin: 4px 0 2px; letter-spacing: -0.02em; }
.r-title p { color: var(--muted); font-size: 12px; }
.r-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 18px; }
.r-meta div { display: flex; flex-direction: column; gap: 1px; border-left: 2px solid var(--line); padding-left: 9px; }
.r-meta span { font-size: 10px; color: var(--muted); }
.r-meta b { font-size: 13px; }
.r-degraded {
  background: var(--warn-soft); border: 1px solid #f2ddc0; color: #7a4708;
  border-radius: 8px; padding: 8px 12px; font-size: 12px;
}

.score-block { display: grid; grid-template-columns: 260px 1fr; gap: 22px; align-items: center; padding: 22px 0; border-bottom: 1px solid var(--line); }
.total-card { display: flex; flex-direction: column; gap: 4px; }
.total-label { font-size: 11px; color: var(--muted); letter-spacing: 0.04em; }
.total-num { font-size: 46px; line-height: 1.05; font-weight: 700; color: var(--ink); letter-spacing: -0.03em; }
.total-num em { font-size: 15px; color: var(--muted); font-style: normal; font-weight: 500; margin-left: 2px; }
.total-split { font-size: 12px; color: var(--ink-2); }
.total-split b { color: var(--brand); }
.total-card small { font-size: 11px; color: var(--muted); line-height: 1.5; }
.radar-wrap { display: flex; flex-direction: column; align-items: center; }
#radar-canvas { width: 100%; max-width: 420px; height: 320px; }
.radar-note { font-size: 11px; color: var(--muted); }

.r-section { padding: 20px 0 4px; border-bottom: 1px solid var(--line); }
.r-section:last-of-type { border-bottom: none; }
.r-section > h2 { font-size: 16px; display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.r-section > h2 span { font-size: 11px; color: var(--muted); font-weight: 400; }
.dim-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }
.dim-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fbfcfe; }
.dim-card.content { border-top: 3px solid var(--brand); }
.dim-card.posture { border-top: 3px solid var(--cv); background: #fafdfc; }
.dim-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.dim-title { display: flex; flex-direction: column; gap: 1px; }
.dim-title b { font-size: 13px; }
.owner { font-size: 10px; color: var(--muted); }
.dim-score { font-size: 13px; color: var(--muted); white-space: nowrap; }
.dim-score strong { font-size: 22px; color: var(--ink); letter-spacing: -0.02em; }
.dim-score em { font-style: normal; font-size: 12px; color: var(--muted); }
.basis { font-size: 11px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.evidence { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.evidence li { font-size: 11.5px; color: var(--ink-2); padding-left: 10px; border-left: 2px solid #e6ebf5; line-height: 1.55; }
.evidence q { quotes: "「" "」"; color: var(--ink); }
.evidence li span { color: var(--muted); margin-left: 6px; font-size: 10.5px; }

.obs { margin-top: 14px; background: #f7f9fc; border-radius: 10px; padding: 12px 14px; }
.obs h3 { font-size: 12px; margin-bottom: 6px; color: var(--ink-2); }
.obs ul { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--ink-2); }

.caveat { margin-top: 12px; border: 1px dashed #cdece1; background: var(--cv-soft); border-radius: 10px; padding: 12px 14px; }
.caveat > b { font-size: 12px; color: #0b6a52; }
.caveat ul { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: #22564a; line-height: 1.55; }
.posture-empty { border: 1px dashed #e4d3b8; background: var(--warn-soft); border-radius: 10px; padding: 14px; }
.posture-empty b { font-size: 13px; color: #7a4708; }
.posture-empty p { font-size: 12px; color: #8a5310; margin-top: 4px; }

.conflict { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; background: #fbfcfe; }
.conflict-head { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.conflict-head b { font-size: 13px; }
.conflict-head span { font-size: 11px; color: var(--muted); }
.conflict p { font-size: 12px; color: var(--ink-2); margin-top: 5px; }

.sug-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sug-col { background: #fbfcfe; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.sug-col h3 { font-size: 12px; margin-bottom: 8px; }
.sug-col h3 span { font-size: 10px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.sug-col ul { display: flex; flex-direction: column; gap: 6px; }
.sug-col li { font-size: 12px; line-height: 1.6; padding-left: 12px; position: relative; color: var(--ink-2); }
.sug-col li::before { content: "·"; position: absolute; left: 2px; color: var(--brand); font-weight: 700; }
.sug-col:last-child li::before { color: var(--cv); }

.audit-list { display: flex; flex-direction: column; gap: 4px; }
.audit-list li {
  display: grid; grid-template-columns: 210px 130px 60px 1fr; gap: 8px;
  font-size: 11px; padding: 5px 8px; border-radius: 6px; background: #f8fafc; align-items: center;
}
.audit-list code { color: var(--ink-2); }
.audit-list span { color: var(--muted); }
.audit-list b { color: var(--brand); }
.audit-list em { font-style: normal; color: var(--cv); }
.audit-note { margin-top: 8px; font-size: 11px; color: var(--muted); }

.r-foot { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.r-foot ul { display: flex; flex-direction: column; gap: 3px; }
.r-foot li { font-size: 10.5px; color: var(--muted); line-height: 1.5; }
.r-sign { margin-top: 8px; font-size: 10px; color: #9aa3b5; }

/* ------------------------------ 其它 ------------------------------ */
.footer {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 14px 24px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px;
}
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: rgba(20, 27, 45, 0.94); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 12.5px; z-index: 100; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  max-width: 80vw; text-align: center;
}

/* ------------------------------ 响应式（移动端接力查看） ------------------------------ */
@media (max-width: 980px) {
  main { padding: 16px 14px 32px; }
  .setup-grid, .interview-grid { grid-template-columns: 1fr; }
  .rail { position: static; }
  .video-card { max-height: 42vh; aspect-ratio: auto; height: 36vh; }
  .score-block { grid-template-columns: 1fr; }
  .r-meta { grid-template-columns: 1fr 1fr; }
  .sug-grid { grid-template-columns: 1fr; }
  .topbar-right .privacy-chips { display: none; }
  .transcript { max-height: 40vh; }
  .report { padding: 20px 16px; }
  .audit-list li { grid-template-columns: 1fr; gap: 2px; }
}

/* ------------------------------ 打印 / 导出 PDF ------------------------------ */
@media print {
  @page { size: A4; margin: 12mm; }
  html, body { background: #fff; font-size: 11.5px; }
  .topbar, .footer, .no-print, #setup, #interview { display: none !important; }
  main { padding: 0; max-width: none; }
  #report { display: block !important; }
  .report-shell { max-width: none; }
  .report { border: none; box-shadow: none; padding: 0; border-radius: 0; }
  .r-head { border-bottom-width: 1.5px; }
  .r-title h1 { font-size: 20px; }
  .r-section, .dim-card, .sug-col, .conflict, .total-card { break-inside: avoid; page-break-inside: avoid; }
  .r-section { padding: 14px 0 2px; }
  .score-block { padding: 14px 0; gap: 14px; }
  .dim-grid { gap: 8px; }
  #radar-canvas { height: 250px; }
  .r-foot { margin-top: 10px; }
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* ------------------------------ file:// 运行方式提示 ------------------------------ */
/* 仅在双击 index.html（file 协议）时显示；http 模式下该元素带 hidden，不参与布局 */
.file-mode-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 18px;
  background: #fdf4e7;
  border-bottom: 1px solid #f2ddc0;
  color: #8a5310;
  font-size: 12.5px;
  line-height: 1.6;
  text-align: center;
}
.file-mode-banner b { color: #7a4708; }
@media print {
  .file-mode-banner { display: none !important; }
}

/* ------------------------------ 语音听写 ------------------------------ */
/* 麦克风按钮沿用 .btn / .btn-ghost 的视觉语言，只补图标位与录音态 */
.btn-mic { display: inline-flex; align-items: center; gap: 6px; padding: 9px 12px; }
.btn-mic svg { width: 15px; height: 15px; flex: none; }
.btn-mic .mic-label { font-weight: 600; }
.btn-mic.is-listening {
  background: #fdf1f0;
  border-color: #f0c9c5;
  color: var(--danger);
  box-shadow: 0 0 0 3px rgba(180, 35, 24, 0.08);
}
.btn-mic.is-listening svg { animation: micPulse 1.2s ease-in-out infinite; }
@keyframes micPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(0.92); }
}

/* 语音提示弹窗：白卡片 + 蓝色主按钮，沿用页面既有设计 token */
.speech-modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 27, 45, 0.38);
}
.speech-modal {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 18px 48px rgba(20, 27, 45, 0.18);
  padding: 20px 22px;
}
.speech-modal h4 { font-size: 15px; margin-bottom: 8px; }
.speech-modal p { font-size: 13px; color: var(--ink-2); line-height: 1.7; white-space: pre-wrap; }
.speech-modal .btn { margin-top: 16px; width: 100%; }

/* ============================================================
   移动端响应式适配（追加块，靠层叠覆盖上方规则，不改前文任何一行）
   作用范围：≤1024 布局、触屏设备尺寸、≤640 竖屏、横屏矮视口
   配色沿用 :root 的 --brand / --cv / --line，不新增色板
   ============================================================ */

/* ---------- ① 平板与手机：取消左右分栏，改上下堆叠 ---------- */
@media (max-width: 1024px) {
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { overflow-x: hidden; overflow-x: clip; }

  .interview-grid { grid-template-columns: 1fr; gap: 14px; }
  .rail { position: static; top: auto; }
  .chat-col { min-height: 0; }

  /* 微信/旧内核不支持 backdrop-filter，统一改实色，避免顶栏内容透出 */
  .topbar {
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  main { padding: 16px 16px 32px; }

  /* 视频：绝对定位铺满容器 + contain 等比缩放（不裁剪、不拉伸） */
  .video-card video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center center;
    transform: scaleX(-1); /* 保持镜像预览 */
  }

  /* 长文本一律可断行，杜绝横向溢出 */
  .msg p, #q-text, .evidence li, .basis, .sug-col li, .conflict p,
  .r-meta b, .total-split, .ds-projects li, .audit-list li, .audit-list code,
  .obs ul, .caveat ul, .posture-empty p, .dossier-preview, .brand-text strong {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  /* 网格/弹性子项可收缩，是从根上防溢出的关键 */
  .card, .rail-card, .dim-card, .sug-col, .obs, .caveat,
  .score-block > *, .r-meta > *, .dim-head > *, .chat-col > *, .interview-grid > * {
    min-width: 0;
  }

  .app { min-height: 100vh; }
  @supports (height: 100dvh) {
    .app { min-height: 100dvh; }
  }
}

/* ---------- ② 触屏设备：放大点击目标与输入框 ---------- */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
    padding: 11px 16px;
    font-size: 15px;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
  .btn-lg { padding: 13px 18px; font-size: 16px; }
  .btn-mic { min-height: 44px; padding: 11px 12px; }
  .btn-mic svg { width: 17px; height: 17px; }

  input[type="text"], input[type="number"], select { min-height: 46px; font-size: 16px; }
  textarea, #answer {
    font-size: 16px;      /* 16px 起，iOS/微信聚焦时不会放大页面 */
    padding: 12px 14px;
    resize: none;
  }

  .switch { width: 48px; height: 28px; }
  .slider::after { width: 22px; height: 22px; }

  .transcript, .stepper { -webkit-overflow-scrolling: touch; }

  /* 微信内降级提示：仅在摄像头不可用（.video-fallback.show）时出现，纯 CSS 文案 */
  .video-fallback p::after {
    content: "若在微信内打开且无法调用摄像头：点右上角「···」→「在浏览器打开」后重试；也可直接用纯文本模式完成面试，评分与报告不受影响。";
    display: block;
    margin-top: 6px;
    padding: 0 10px;
    font-size: 11px;
    line-height: 1.7;
    color: #8ea0c4;
  }
}

/* ---------- ③ 手机竖屏 ---------- */
@media (max-width: 640px) {
  body { font-size: 15px; }
  main { padding: 12px 12px calc(24px + env(safe-area-inset-bottom)); }

  /* 顶栏：实色替代毛玻璃（微信旧内核不支持 backdrop-filter），避免内容透出 */
  .topbar {
    padding: 10px 12px;
    gap: 10px;
    background: #fff;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .brand-mark { width: 32px; height: 32px; }
  .brand-text strong { font-size: 14px; }
  .brand-text span { font-size: 10px; }
  .agent-count { font-size: 11px; }

  .card { padding: 16px 14px; }
  .card-head { margin-bottom: 12px; gap: 6px; }
  .card-head h2 { font-size: 15px; }
  .report { padding: 18px 14px 16px; }

  /* 触控兜底（与 ② 重复，防止个别内核识别不到 pointer 媒体特性） */
  .btn { min-height: 44px; font-size: 15px; }
  input[type="text"], input[type="number"], select, textarea, #answer { font-size: 16px; }
  .composer textarea { min-height: 120px; }
  .field > span { font-size: 13px; }
  .manual-box { padding: 12px; }
  .grid-2 { grid-template-columns: 1fr; }

  /* 视频：竖屏定高，画面等比填满，宁可上下留黑边也不裁切成畸形 */
  .video-card {
    height: 32vh;
    min-height: 168px;
    max-height: 300px;
    aspect-ratio: auto;
  }
  .video-fallback span { font-size: 14px; }
  .video-fallback p { font-size: 11px; padding: 0 12px; }

  /* 面试台 */
  .rail { gap: 12px; }
  .rail-card { padding: 14px 12px; }
  .stepper { padding: 9px 10px; gap: 3px; border-radius: 12px; }
  .step { gap: 6px; }
  .step-index { width: 22px; height: 22px; }
  .step-text b { font-size: 11px; }
  .step-text em { font-size: 9px; }
  .step-line { min-width: 8px; }
  .transcript {
    padding: 14px 12px;
    max-height: 42vh;
    min-height: 180px;
    gap: 12px;
    border-radius: 12px;
    overscroll-behavior: contain;
  }
  .msg { max-width: 94%; font-size: 14px; padding: 9px 12px; }
  .msg-meta .who { font-size: 12px; }
  .degrade-banner { flex-direction: column; align-items: flex-start; gap: 4px; font-size: 12px; }
  .composer { padding: 12px; gap: 9px; border-radius: 12px; }
  .question-card { padding: 10px 12px; }
  #q-text { font-size: 15px; }

  /* 按钮排布：提交独占一行，语音/暂停/结束并排，指尖更好点，也不会挤成一条 */
  .composer-actions { gap: 8px; }
  #btn-answer { order: 1; flex: 1 1 100%; }
  #btn-speech { order: 2; flex: 1 1 30%; }
  #btn-pause { order: 3; flex: 1 1 30%; }
  #btn-finish { order: 4; flex: 1 1 30%; }
  .composer-actions .hint {
    order: 5;
    flex: 1 1 100%;
    margin-left: 0;
    text-align: center;
  }

  /* 报告：标题与总分用 clamp 自适应，绝不撑破屏宽 */
  .r-head { gap: 12px; }
  .r-title h1 { font-size: clamp(19px, 5.6vw, 24px); }
  .r-meta { grid-template-columns: 1fr 1fr; gap: 8px 12px; }
  .score-block { padding: 16px 0; gap: 10px; }
  .total-num { font-size: clamp(32px, 11vw, 44px); }
  .radar-wrap { width: 100%; }
  #radar-canvas { height: clamp(210px, 62vw, 290px); }
  .r-section { padding: 16px 0 2px; }
  .r-section > h2 { font-size: 15px; flex-wrap: wrap; gap: 6px; }
  .dim-grid { grid-template-columns: 1fr; gap: 10px; }
  .dim-score strong { font-size: clamp(19px, 5.4vw, 22px); }
  .sug-col { padding: 12px; }
  .audit-list li { font-size: 10.5px; padding: 7px 9px; }
  .report-actions { gap: 8px; padding: 10px 12px; }
  .report-actions .btn { flex: 1 1 100%; }
  .report-actions .hint { flex: 1 1 100%; }

  /* 准备区：资料块改纵向，流程图改竖直箭头 */
  .dossier-head { flex-wrap: wrap; }
  .ds-block { flex-direction: column; gap: 4px; }
  .ds-label { width: auto; padding-top: 0; }
  .switch-line { padding: 10px 12px; }
  .sop-list { gap: 5px; }
  .sop-list li { font-size: 11px; padding: 6px 8px; }
  .flow { flex-direction: column; align-items: stretch; }
  .flow-arrow { transform: rotate(90deg); align-self: center; }
  .flow-node { min-width: 0; }
  .flow-cv { width: 100%; }
  .flow-side { flex-direction: column; align-items: stretch; }
  .flow-arrow-cv { text-align: center; }

  .footer {
    flex-direction: column;
    gap: 4px;
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
    font-size: 10.5px;
  }
  .toast { bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 92vw; font-size: 13px; }
  .file-mode-banner { padding: 8px 12px; font-size: 12px; }
  .speech-modal-mask { padding: 16px; }
  .speech-modal { padding: 18px 16px; }
  .speech-modal .btn { min-height: 44px; }
}

/* ---------- ④ 手机横屏（矮视口）：压扁视频、统计卡并排，减少滚动 ---------- */
@media (orientation: landscape) and (max-height: 540px) {
  main {
    padding-top: 8px;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    padding-left: calc(12px + env(safe-area-inset-left));
    padding-right: calc(12px + env(safe-area-inset-right));
  }
  .topbar { padding: 6px 12px; }
  .brand-mark { width: 28px; height: 28px; font-size: 12px; }
  .brand-text span { display: none; }

  /* 视频横向铺满、高度收窄；rail 内部两列，视频独占一行 */
  .video-card {
    height: 34vh;
    min-height: 120px;
    max-height: 200px;
    grid-column: 1 / -1;
  }
  .rail { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: start; }
  .rail-card { padding: 12px; }

  .stepper { padding: 7px 10px; }
  .transcript { max-height: 30vh; min-height: 120px; }
  .chat-col { gap: 8px; }
  .composer { padding: 10px; gap: 8px; }
  .composer textarea { min-height: 84px; height: 84px; } /* 横屏高度紧张，压住 rows=4 的默认撑高 */

  /* 横屏宽度足够，撤销竖屏的整行按钮，恢复一排 */
  #btn-answer { order: 0; flex: 1 1 auto; }
  #btn-speech { order: 0; flex: 1 1 auto; }
  #btn-pause { order: 0; flex: 1 1 auto; }
  #btn-finish { order: 0; flex: 1 1 auto; }
  .composer-actions .hint { order: 0; flex: 0 1 auto; margin-left: auto; text-align: right; }

  .report { padding: 16px 14px; }
  #radar-canvas { height: clamp(180px, 44vh, 240px); }
}

/* ---------- ⑤ 超窄屏（≤400）：进一步收字号与间距 ---------- */
@media (max-width: 400px) {
  main { padding-left: 10px; padding-right: 10px; }
  .card { padding: 14px 12px; }
  .r-meta { grid-template-columns: 1fr; }
  .r-title h1 { font-size: 19px; }
  .total-num { font-size: 32px; }
  .sop-list { grid-template-columns: 1fr; }
  .btn { padding: 11px 12px; font-size: 14px; }
  #btn-speech, #btn-pause, #btn-finish { flex: 1 1 45%; }
  .step-text b { font-size: 10.5px; }
  .msg { max-width: 97%; }
}