/* ============================================================
   aivitals — 临床体检报告视觉体系（原创）
   Design tokens：
     纸白 #fafaf7 / 墨黑 #16181d / 体征红 #c2410c（唯一 accent）
     分割线 #e4e2dc / 弱化字 #6f6d66
   原则：胆量只花在脉搏线一处，其余全部安静、纪律化
   ============================================================ */
:root {
  --paper: #fafaf7;
  --ink: #16181d;
  --ink-soft: #45443f;
  --muted: #6f6d66;
  --line: #e4e2dc;
  --line-strong: #16181d;
  --red: #c2410c;
  --red-soft: #fdf0e7;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font-family: var(--sans); line-height: 1.7; font-size: 16px;
}
::selection { background: var(--red); color: #fff; }

/* ---------- 脉搏线（唯一的大胆元素） ---------- */
.pulse {
  color: var(--red);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px 0;
}
.pulse svg { display: block; width: min(1080px, 100%); height: 40px; margin: 0 auto; }
.pulse path { stroke-dasharray: 2600; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .pulse path { stroke-dashoffset: 2600; animation: draw 1.6s ease-out .2s forwards; }
}
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- 纸张容器 ---------- */
.sheet { max-width: 760px; margin: 0 auto; padding: 0 24px 80px; }

/* ---------- 病历头 ---------- */
.chart-head {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding: 26px 0 18px; border-bottom: 2px solid var(--line-strong);
}
.brand { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand-dot { color: var(--red); }
.brand-sub { margin-left: 12px; font-size: 13px; color: var(--muted); font-weight: 400; }
.chart-nav { display: flex; align-items: baseline; gap: 22px; }
.chart-nav a {
  font-size: 14px; font-weight: 600; color: var(--ink); text-decoration: none;
  border-bottom: 2px solid var(--red); padding-bottom: 2px;
}
.chart-meta { display: flex; gap: 20px; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- 报告面板：我的（主）+ 公开（次） ---------- */
.stats {
  margin: 40px 0 0;
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px;
}
.mine-panel, .public-panel {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 18px 22px 20px;
  display: flex; flex-direction: column;
}
.mine-preview { flex: 1; }
.public-panel .stats-body { flex: 1; align-content: center; }
.mine-panel { border-top: 3px solid var(--red); }
.public-panel { border-top: 3px solid var(--ink); }
.mine-head {
  display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px;
}
.stats-label {
  font-family: var(--mono); font-size: 11.5px; color: var(--red); letter-spacing: 0.1em; font-weight: 700;
}
.public-panel .stats-label { color: var(--muted); }
.mine-all {
  font-size: 12.5px; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.mine-all:hover { color: var(--red); }
.mine-preview { min-height: 52px; }
.mine-item {
  display: flex; align-items: center; gap: 12px; padding: 6px 0;
  text-decoration: none; color: var(--ink);
}
.mine-item + .mine-item { border-top: 1px solid var(--line); }
.mine-item img { width: 40px; height: 40px; border-radius: 8px; }
.mine-item .mi-main { flex: 1; min-width: 0; }
.mine-item .mi-l1 { font-size: 14px; font-weight: 600; }
.mine-item .mi-l1 b { font-family: var(--mono); margin-right: 6px; }
.mine-item .mi-l2 { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.mine-empty { color: var(--muted); font-size: 13.5px; }
.mine-empty a { color: var(--red); }
.stats-body { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.stat-big b { font-family: var(--mono); font-size: 34px; font-weight: 800; margin-right: 8px; line-height: 1; }
.stat-big span { color: var(--muted); font-size: 13px; }
.stat-rest { display: flex; gap: 8px; flex-wrap: wrap; }
.stats-link {
  font-size: 13px; font-weight: 600; color: var(--ink); text-decoration: none; white-space: nowrap;
}
.stats-link:hover { color: var(--red); }
.stat-chip {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: 12.5px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px 4px 5px;
}
.stat-chip img { border-radius: 50%; }
.stat-chip b { font-weight: 700; }

/* ---------- 主诉区 ---------- */
.intake { padding: 64px 0 48px; border-bottom: 1px solid var(--line); }
.intake h1 {
  font-size: clamp(38px, 7vw, 58px); line-height: 1.15; font-weight: 800; letter-spacing: -0.02em;
}
.intake .lead { margin-top: 22px; font-size: 17px; color: var(--ink-soft); max-width: 34em; }
.intake .lead em { font-style: normal; font-weight: 700; box-shadow: inset 0 -0.45em var(--red-soft); }

/* ---------- 检查流程 ---------- */
.procedure { list-style: none; }
.procedure > li { display: grid; grid-template-columns: 72px 1fr; gap: 20px;
  padding: 36px 0; border-bottom: 1px solid var(--line);
}
.procedure > li[hidden] { display: none; }
.proc-no { font-family: var(--mono); font-size: 13px; color: var(--red); padding-top: 6px; }
.proc-body h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.proc-body > p { margin: 8px 0 18px; color: var(--ink-soft); font-size: 15px; max-width: 36em; }

.order-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------- 提交方式切换 ---------- */
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 16px 0 20px; }
.mode input { position: absolute; opacity: 0; pointer-events: none; }
.mode-box {
  display: block; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 12px 16px; cursor: pointer; transition: border-color .12s ease, background .12s ease;
  height: 100%;
}
.mode-box b { display: block; font-size: 14.5px; }
.mode-box small { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.55; }
.mode input:checked + .mode-box { border-color: var(--red); background: var(--red-soft); }
.mode input:checked + .mode-box b::after { content: " ✓"; color: var(--red); }
.mode input:focus-visible + .mode-box { outline: 2px solid var(--red); outline-offset: 2px; }

/* ---------- 自动提交等待说明 ---------- */
.auto-note {
  padding: 26px 0; border-bottom: 1px solid var(--line);
}
.auto-note h2 { font-size: 20px; font-weight: 700; }
.auto-note p { margin-top: 10px; color: var(--ink-soft); font-size: 15px; max-width: 36em; }
.auto-note b { color: var(--ink); }
.auto-note a { color: var(--ink); }
.order-note { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.btn-primary {
  font-family: var(--sans); font-size: 15px; font-weight: 600;
  background: var(--ink); color: var(--paper); border: none; border-radius: 999px;
  padding: 11px 26px; cursor: pointer;
  transition: transform .1s ease, background .15s ease;
}
.btn-primary:hover { background: #000; }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { opacity: .55; cursor: default; }
.btn-ghost {
  font-family: var(--sans); font-size: 14px; font-weight: 600;
  background: transparent; color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 999px; padding: 9px 20px; cursor: pointer;
  transition: transform .1s ease, background .15s ease;
}
.btn-ghost:hover { background: #efede7; }
.btn-ghost:active { transform: scale(0.98); }
:is(button, input, textarea, a):focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }

#prompt-fallback {
  margin-top: 14px; padding: 14px; max-height: 240px; overflow: auto;
  background: #f1efe9; border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--mono); font-size: 12px; white-space: pre-wrap;
}
textarea, .share-row input {
  width: 100%; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; font-family: var(--mono); font-size: 13px; line-height: 1.6;
}
textarea { resize: vertical; }
textarea:focus, .share-row input:focus { outline: none; border-color: var(--ink); }
#paste-area { margin-bottom: 18px; }
#nick-input { flex: 1; min-width: 200px; font-family: var(--sans); font-size: 14px; }

/* ---------- 体检报告 ---------- */
.report { padding-top: 44px; }
.report[hidden] { display: none; }
.report-head { display: flex; align-items: center; gap: 16px; border-bottom: 2px solid var(--line-strong); padding-bottom: 16px; }
.report-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.report-stamp {
  font-family: var(--mono); font-size: 12px; color: var(--red);
  border: 1.5px solid var(--red); border-radius: 6px; padding: 3px 10px;
  transform: rotate(-4deg);
}

.report-main {
  display: grid; grid-template-columns: 220px 1fr; gap: 32px;
  padding: 32px 0; border-bottom: 1px solid var(--line);
}
.r-code {
  font-size: 64px; font-weight: 800; letter-spacing: 0.02em; line-height: 1;
  font-family: var(--mono);
}
.r-name { font-size: 19px; font-weight: 700; margin-top: 14px; display: flex; align-items: center; gap: 10px; }
.r-char { width: 52px; height: 52px; border-radius: 10px; }
.r-tagline { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.r-desc p { color: var(--ink-soft); font-size: 15px; }
.r-self { margin-top: 12px; font-style: italic; color: var(--muted); }

.r-section { padding: 26px 0; border-bottom: 1px solid var(--line); }
.r-section h3 {
  font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.08em; margin-bottom: 16px;
}
.r-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; }

.dims { display: grid; gap: 18px; }
.dim-head { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 7px; }
.dim-head b { font-family: var(--mono); font-weight: 600; }
.bar { height: 6px; background: #eceae4; border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--ink); border-radius: 3px; transition: width .8s cubic-bezier(.2,.8,.2,1); }

.r-list { list-style: none; }
.r-list li { padding: 5px 0 5px 20px; position: relative; font-size: 14.5px; color: var(--ink-soft); }
.r-list li::before { content: "—"; position: absolute; left: 0; color: var(--red); font-family: var(--mono); }

.r-meta { display: flex; flex-wrap: wrap; gap: 10px; }
.chip {
  font-family: var(--mono); font-size: 12.5px;
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; background: #fff;
}
.chip .ck { color: var(--muted); margin-right: 6px; }

.r-user-main { font-size: 17px; }
.r-user-main b {
  font-family: var(--mono); font-size: 24px; font-weight: 700; margin-right: 12px; color: var(--red);
}
.r-evidence { margin-top: 8px; color: var(--muted); font-size: 14px; }

.share-row { display: flex; gap: 10px; flex-wrap: wrap; }
.share-row input { flex: 1; min-width: 220px; }
.submit-row { margin-top: 12px; }
.fine { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.fine a { color: var(--ink); }

/* ---------- 十六型图谱 ---------- */
.atlas { padding: 56px 0 8px; }
.atlas-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.01em; }
.atlas-head p { margin: 10px 0 24px; color: var(--muted); font-size: 14.5px; max-width: 36em; }
.type-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
}
.tcell {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 0 0 14px; text-align: center; cursor: pointer; font-family: var(--sans);
  text-decoration: none; color: var(--ink); display: block; overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease;
}
.tcell:hover { transform: translateY(-4px); box-shadow: 0 10px 28px rgba(22,24,29,.1); }
.tcell:hover .tc-code { text-decoration: underline; }
.tc-char { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.tc-code { display: block; font-family: var(--mono); font-size: 15px; font-weight: 800; letter-spacing: 0.04em; margin-top: 12px; }
.tc-name { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.tc-count { display: block; font-family: var(--mono); font-size: 11px; color: var(--muted); margin-top: 5px; }
.tc-count.has { color: var(--red); }

/* 图谱下的分布统计 */
.atlas-stats { margin-top: 16px; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- 弹窗档案 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(22,24,29,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 4px;
  max-width: 540px; width: 100%; max-height: 86vh; overflow: auto;
  padding: 30px 32px; position: relative;
}
.modal-close {
  position: absolute; top: 16px; right: 16px; background: none; border: none;
  color: var(--muted); font-size: 18px; cursor: pointer; line-height: 1;
}
.modal-close:hover { color: var(--ink); }
.m-top { display: flex; align-items: center; gap: 18px; }
.m-char { width: 110px; height: 110px; border-radius: 14px; }
.m-code { font-family: var(--mono); font-size: 40px; font-weight: 800; }
.m-name { font-size: 16px; font-weight: 700; margin-top: 4px; }
.m-name .grp { font-weight: 400; color: var(--muted); }
.m-tagline { font-family: var(--mono); font-size: 12.5px; color: var(--red); margin-top: 10px; }
.m-desc { margin-top: 14px; color: var(--ink-soft); font-size: 14.5px; }
.m-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 20px; }
.m-cols h4 { font-family: var(--mono); font-size: 11.5px; color: var(--muted); letter-spacing: 0.08em; margin-bottom: 8px; }
.m-cols ul { list-style: none; }
.m-cols li { font-size: 13.5px; color: var(--ink-soft); padding: 3px 0 3px 18px; position: relative; }
.m-cols li::before { content: "—"; position: absolute; left: 0; color: var(--red); font-family: var(--mono); }

/* ---------- FAQ ---------- */
.faq { padding: 56px 0 0; }
.faq h2 { font-size: 24px; font-weight: 800; margin-bottom: 18px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  cursor: pointer; font-weight: 600; font-size: 15.5px; padding: 14px 0; list-style: none;
  display: flex; justify-content: space-between; align-items: center;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--muted); font-size: 18px; }
.faq details[open] summary::after { content: "–"; }
.faq p { padding: 0 0 16px; color: var(--ink-soft); font-size: 14.5px; max-width: 40em; }

/* ---------- 页脚 ---------- */
.colophon {
  margin-top: 64px; padding-top: 20px; border-top: 2px solid var(--line-strong);
  font-family: var(--mono); font-size: 12px; color: var(--muted);
}

/* ---------- 响应式 ---------- */
@media (max-width: 680px) {
  .procedure > li { grid-template-columns: 1fr; gap: 8px; }
  .proc-no { padding-top: 0; }
  .report-main { grid-template-columns: 1fr; gap: 20px; }
  .r-two-col { grid-template-columns: 1fr; gap: 0; }
  .r-two-col > div:first-child { padding-bottom: 22px; border-bottom: 1px solid var(--line); margin-bottom: 22px; }
  .type-grid { grid-template-columns: repeat(2, 1fr); }
  .mode-switch { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr; }
  .chart-meta { display: none; }
  .intake { padding: 44px 0 36px; }
}

/* ---------- 语言切换（右侧双选项组） ---------- */
.lang-group {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden;
}
.lang-opt {
  font-family: var(--mono); font-size: 12px; font-weight: 700; cursor: pointer;
  background: transparent; color: var(--muted); border: none;
  padding: 4px 13px; transition: background .12s ease, color .12s ease;
}
.lang-opt:hover { color: var(--ink); }
.lang-opt.active { background: var(--ink); color: var(--paper); }

/* ---------- 复制成功反馈 ---------- */
.btn-primary.flashing { background: #15803d; }
.btn-ghost.flashing { border-color: #15803d; color: #15803d; }
