/* 诊断页布局。配色、字号和导航来自 assets/site.css。 */

main#root { width: min(880px, 100%); margin: 0 auto; padding: 18px 16px 48px; }
.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 18px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  min-width: 0;
  max-width: 100%;
}
.card h1, .card h2 { font-size: 1.35rem; margin: 0 0 8px; line-height: 1.35; }
.card h3 { font-size: 1.05rem; margin: 12px 0 4px; }
.muted { color: var(--muted); }
.small { font-size: 0.92rem; }
.err { color: var(--bad); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; min-width: 0; }
button.good { background: var(--ok); border-color: transparent; color: var(--on-ok); }
button.bad { background: var(--bad); border-color: transparent; color: var(--on-bad); }
button:disabled { opacity: .55; cursor: not-allowed; }
label { font-weight: 700; }

.banner { background: var(--brand-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 14px; }
.banner.demo { background: var(--warn-bg); }
.chapter-browser > summary { cursor: pointer; font-weight: 800; min-height: 44px; display: flex; align-items: center; }
.vol { border: 1px solid var(--line); border-radius: 12px; margin: 8px 0; background: var(--bg-elev); }
.vol > summary { padding: 10px 12px; font-weight: 800; cursor: pointer; background: var(--bg-muted); border-radius: 12px; }
.chap { margin: 0 8px 8px; }
.chap-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 4px; font-weight: 800; border-bottom: 1px solid var(--line); }
.chap-head .t { flex: 1 1 160px; min-width: 0; overflow-wrap: anywhere; }
.topic-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.topic-row .nm { flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; font-weight: 700; }
.topic-row .sec { color: var(--muted); font-size: 0.88rem; }
#search { margin-top: 8px; }

.progress { height: 14px; background: var(--bg-muted); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--junior)); border-radius: inherit; }
.q-title { font-size: 1.45rem; margin: 8px 0; overflow-wrap: anywhere; }
.q-text { font-size: 1.2rem; line-height: 1.6; padding: 12px 14px; background: var(--bg-muted); border-left: 4px solid var(--brand); border-radius: 8px; margin: 12px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.reason { color: var(--muted); }
.ans-input { width: 100%; font-size: 1.1rem; }
.notice { color: var(--warn); background: var(--warn-bg); padding: 8px 12px; border-radius: 10px; margin-top: 12px; }
.verdict { padding: 10px 12px; border-radius: 10px; margin: 10px 0; font-weight: 800; }
.verdict.ok { background: var(--ok-bg); color: var(--ok); }
.verdict.no { background: var(--bad-bg); color: var(--bad); }
.refans { background: var(--ok-bg); border: 1px dashed var(--ok); padding: 10px 12px; border-radius: 10px; margin: 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.explain { background: var(--junior-soft); border-left: 4px solid var(--junior); padding: 10px 12px; border-radius: 8px; margin: 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.choices { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
button.choice { text-align: left; width: 100%; min-height: 48px; padding: 12px 14px; font-size: 1.05rem; font-weight: 600; white-space: pre-wrap; }
button.choice.picked { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 2px var(--brand); }

.tag { display: inline-block; font-size: 0.78rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-right: 4px; background: var(--bg-muted); color: var(--text); vertical-align: 1px; }
.tag.weak { background: var(--bad-bg); color: var(--bad); }
.tag.mastered { background: var(--ok-bg); color: var(--ok); }
.tag.unknown { background: var(--unk-bg); color: var(--unk); }
.tag.shaky { background: var(--diagram-shaky-bg); color: var(--diagram-shaky); }
.tag.root { background: var(--bad); color: var(--on-bad); }
.tag.target { background: var(--junior); color: var(--on-brand); }
.tag.ext { background: var(--junior-soft); color: var(--text); }
.tag.diff-basic { background: var(--ok-bg); color: var(--ok); }
.tag.diff-standard { background: var(--junior-soft); color: var(--text); }
.tag.diff-advanced { background: #fae8ff; color: #86198f; }
@media (prefers-color-scheme: dark) {
  .tag.diff-advanced { background: #581c87; color: #f5d0fe; }
}

.stats { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.stat { flex: 1 1 100px; min-width: 0; padding: 10px 12px; border-radius: 12px; text-align: center; background: var(--bg-muted); }
.stat b { display: block; font-size: 1.8rem; line-height: 1.1; }
.stat.ok { background: var(--ok-bg); color: var(--ok); }
.stat.bad { background: var(--bad-bg); color: var(--bad); }
.stat.shaky { background: var(--diagram-shaky-bg); color: var(--diagram-shaky); }
.stat.unk { background: var(--unk-bg); color: var(--unk); }
.stat.ask { background: var(--junior-soft); color: var(--text); }
details.topic { border-bottom: 1px solid var(--line); padding: 4px 0; }
details.topic > summary { cursor: pointer; padding: 8px 0; min-height: 44px; overflow-wrap: anywhere; }
details.topic > .body { padding: 4px 0 10px 8px; }
.body ul { margin: 4px 0; padding-left: 1.2em; }
.std { margin: 8px 0; padding: 8px 10px; background: var(--bg-muted); border-left: 3px solid var(--brand); border-radius: 8px; overflow-wrap: anywhere; }
.std code { color: var(--text); }
.std .conf { color: var(--muted); margin-left: 4px; }
ol.path { padding-left: 0; list-style: none; counter-reset: step; margin: 0; }
ol.path > li { counter-increment: step; position: relative; padding-left: 40px; min-width: 0; }
ol.path > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 8px;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  background: var(--brand);
  color: var(--on-brand);
  text-align: center;
  line-height: 28px;
  font-size: 0.85rem;
  font-weight: 800;
}
details.chap-sum > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.chap-name { flex: 1 1 200px; min-width: 0; font-weight: 800; }
.chap-counts { display: inline-flex; flex-wrap: wrap; gap: 4px 0; }
.chap-bar { flex: 1 1 100%; display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--bg-muted); }
.chap-bar i { display: block; height: 100%; }
.chap-bar .m { background: var(--ok); }
.chap-bar .s { background: var(--diagram-shaky); }
.chap-bar .w { background: var(--bad); }
.chap-bar .u { background: var(--unk); opacity: .45; }
.chap-names { margin: 6px 0; overflow-wrap: anywhere; }
#out-of-scope { margin-top: 4px; }
#log { overflow-x: auto; max-width: 100%; }
table.log { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 0.95rem; }
table.log th, table.log td { border-bottom: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
table.log select { min-height: 44px; }
.path-graph { position: relative; max-width: 100%; }
#path-cy {
  height: 460px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
}
.legend { display: flex; gap: 8px 14px; flex-wrap: wrap; font-size: 0.92rem; margin: 8px 0; padding: 0; list-style: none; align-items: center; font-weight: 700; color: var(--muted); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 14px; height: 14px; border-radius: 4px; border: 2px solid transparent; display: inline-block; }
.sw-p { background: var(--node-primary-bg); border-color: var(--node-primary); }
.sw-j { background: var(--node-junior-bg); border-color: var(--node-junior); }
.sw-root { background: var(--diagram-bad-bg); border-color: var(--diagram-bad); }
.sw-target { background: var(--node-current-bg); border-color: var(--node-current-border); }
.line-hard, .line-soft, .line-skip { width: 22px; height: 0; border-radius: 0; border: none; border-top: 2px solid var(--edge); background: none; }
.line-soft { border-top-style: dashed; border-top-color: var(--edge-soft); }
.line-skip { border-top-style: dotted; border-top-color: var(--edge-soft); }

@media (max-width: 640px) {
  .card { padding: 14px 12px; }
  .q-title { font-size: 1.28rem; }
  #path-cy { height: 380px; }
}

@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  main#root { max-width: none; padding: 0; }
  .card { break-inside: avoid-page; box-shadow: none; }
  details.topic { break-inside: avoid; }
  #path-cy { height: 520px; border: none; background: #fff; }
  a { color: inherit; text-decoration: none; }
  select { border: none; appearance: none; -webkit-appearance: none; }
}
