/* figkit：声明式静态图解组件库（样张）
   md 里写 ```fig {JSON} ```，figkit.js 按 type 渲染。
   尺寸全部用 em：网页 .fk 字号 14px，小红书截图里 10px，同一份样式等比缩放。
   颜色语义：蓝=信息/当前，绿=正确/新增/有效，琥珀=变化/注意，红=出错/丢失，灰=历史/失效 */
.fk {
  --brand: #1f56c4; --brand-w: #eef3fc; --brand-b: #c9d8f4;
  --ink: #1f2328; --ink-2: #47505a; --mute: #676f79;
  --line: #e6e8eb; --bg-2: #f7f8f9;
  --ok: #1f7a4d; --ok-w: #e8f3ec; --ok-b: #b7dcc5;
  --warn: #a86b12; --warn-w: #fbf1de; --warn-b: #ebd3a6; --hl: #fff2b8;
  --bad: #b6534d; --bad-w: #f8ecea; --bad-b: #e8c2be;
  --off: #8a939e; --off-w: #f0f1f3;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: var(--fk-fs, 14px); line-height: 1.6; color: var(--ink);
  margin: 1.8em 0; border: 1px solid var(--line); border-radius: .7em; padding: 1.25em 1.5em 1.1em; background: #fff;
}
.fk * { box-sizing: border-box; }
.fk-t { font-weight: 700; font-size: 1.07em; }
.fk-q { color: var(--mute); font-size: .93em; margin: .3em 0 1.1em; }
.fk-foot { margin-top: 1em; padding-top: .7em; border-top: 1px dashed var(--line); font-size: .93em; color: var(--ink-2); line-height: 1.7; }
.fk-foot b { color: var(--ink); }
.fk code, .fk .k { font-family: var(--mono); font-size: .9em; background: var(--bg-2); padding: 0 .3em; border-radius: .2em; }
.fk.narrow { padding: 1em .9em .9em; }

/* 色调（多个组件共用） */
.fk .t-blue { --c: var(--brand); --cw: var(--brand-w); --cb: var(--brand-b); }
.fk .t-green { --c: var(--ok); --cw: var(--ok-w); --cb: var(--ok-b); }
.fk .t-orange { --c: var(--warn); --cw: var(--warn-w); --cb: var(--warn-b); }
.fk .t-red { --c: var(--bad); --cw: var(--bad-w); --cb: var(--bad-b); }
.fk .t-gray { --c: var(--off); --cw: var(--off-w); --cb: var(--line); }

/* ---------- timeline：横向时间线，窄版改竖排 ---------- */
.fk .tl { display: grid; grid-template-columns: repeat(var(--n), 1fr); }
.fk .tl-e { position: relative; padding: 0 .4em; text-align: center; }
.fk .tl-d { font-weight: 700; font-size: .93em; color: var(--c); }
.fk .tl-dot { position: relative; height: 1.3em; }
.fk .tl-dot::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px solid var(--line); }
.fk .tl-e:first-child .tl-dot::before { left: 50%; }
.fk .tl-e:last-child .tl-dot::before { right: 50%; }
.fk .tl-dot::after { content: ""; position: absolute; left: 50%; top: 50%; width: .8em; height: .8em; margin: -.4em 0 0 -.4em; border-radius: 50%; background: var(--c); }
.fk .tl-x { margin-top: .4em; font-size: .9em; line-height: 1.55; background: var(--cw); border: 1px solid var(--cb); border-radius: .5em; padding: .5em .55em; }
.fk.narrow .tl { grid-template-columns: 1fr; }
.fk.narrow .tl-e { display: grid; grid-template-columns: 4.6em 1.4em 1fr; text-align: left; padding: 0 0 .55em; align-items: start; }
.fk.narrow .tl-d { padding-top: .35em; }
.fk.narrow .tl-dot { height: auto; align-self: stretch; }
.fk.narrow .tl-dot::before { left: 50%; right: auto; top: 0; bottom: -.55em; border-top: 0; border-left: 2px solid var(--line); }
.fk.narrow .tl-e:first-child .tl-dot::before { top: .9em; left: 50%; }
.fk.narrow .tl-e:last-child .tl-dot::before { bottom: auto; height: .9em; }
.fk.narrow .tl-dot::after { top: .95em; }
.fk.narrow .tl-x { margin-top: 0; }

/* 结论框（多个组件共用） */
.fk-res { margin-top: .9em; border-radius: .55em; padding: .65em .9em; font-size: .93em; line-height: 1.65; background: var(--cw); border: 1px solid var(--cb); }
.fk-res b.h { display: block; color: var(--c); margin-bottom: .15em; }

/* ---------- tables：带标记的数据表，可以多块竖排，块之间加箭头 ---------- */
.fk .tb-p { border-radius: .55em; background: var(--bg-2); padding: .7em .8em .8em; }
.fk .tb-p.t-red { background: var(--bad-w); }
.fk .tb-h { display: flex; align-items: center; gap: .45em; font-size: .93em; margin-bottom: .25em; }
.fk .tb-h i { font-style: normal; display: inline-flex; width: 1.5em; height: 1.5em; border-radius: 50%; background: var(--ink); color: #fff; font-size: .85em; align-items: center; justify-content: center; flex: none; }
.fk .tb-h .bdg { font-size: .85em; padding: .05em .55em; border-radius: 1em; background: var(--cw, #fff); color: var(--c, var(--mute)); border: 1px solid var(--cb, var(--line)); white-space: nowrap; }
.fk .tb-n { font-size: .86em; color: var(--mute); margin-bottom: .5em; line-height: 1.55; }
.fk .tb { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86em; line-height: 1.4; background: #fff; border: 1px solid var(--line); border-radius: .4em; overflow: hidden; }
.fk .tb th, .fk .tb td { padding: .4em .5em; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.fk .tb tr:last-child td { border-bottom: 0; }
.fk .tb th { background: #fafbfc; color: var(--mute); font-weight: 600; font-family: var(--mono); font-size: .92em; }
.fk .tb td { font-family: var(--mono); }
.fk .tb td.zh { font-family: inherit; }
.fk .tb .m-chg { background: var(--hl); font-weight: 700; }
.fk .tb .m-new { color: var(--ok); font-weight: 700; }
.fk .tb .m-old s { color: var(--bad); text-decoration: none; position: relative; }
.fk .tb .m-old s::after { content: ""; position: absolute; left: -.1em; right: -.1em; top: 52%; border-top: .12em solid var(--bad); }
.fk .tb .m-key { font-weight: 700; color: var(--brand); }
.fk .tb tr.r-dim td { color: var(--off); background: #fbfbfc; }
.fk .tb tr.r-new td { background: var(--ok-w); }
.fk .tb tr.r-closed td { background: #fbfbfc; }
.fk .tb tr.r-del td { color: var(--bad); text-decoration: line-through; background: var(--bad-w); }
.fk .tb .fk-tag { font-family: inherit; font-size: .9em; font-weight: 700; padding: .05em .5em; border-radius: 1em; background: var(--cw); color: var(--c); border: 1px solid var(--cb); }
.fk .tb-ar { text-align: center; color: var(--mute); font-size: .9em; padding: .35em 0; }
.fk .tb-ar b { color: var(--ink); }
.fk.narrow .tb th, .fk.narrow .tb td { padding: .38em .32em; }
.fk.narrow .tb { font-size: .8em; }

/* ---------- gantt：每行一段有效期，竖线标出某一天落在哪一行 ---------- */
.fk .gt { --lw: 9.5em; position: relative; }
.fk.narrow .gt { --lw: 6.4em; }
.fk .gt-ax, .fk .gt-r { display: grid; grid-template-columns: var(--lw) 1fr; align-items: center; }
.fk .gt-ax { height: 1.6em; }
.fk .gt-tks { position: relative; height: 100%; border-bottom: 1px solid var(--line); }
.fk .gt-tk { position: absolute; bottom: .2em; font-size: .8em; color: var(--mute); padding-left: .3em; border-left: 1px solid var(--line); line-height: 1.1; height: 1.4em; }
.fk .gt-r { padding: .45em 0; }
.fk .gt-l { font-size: .88em; line-height: 1.35; padding-right: .6em; }
.fk .gt-l b { display: block; }
.fk .gt-l small { display: block; color: var(--mute); font-size: .9em; }
.fk .gt-tr { position: relative; height: 2.3em; }
.fk .gt-bar { position: absolute; top: 0; bottom: 0; border-radius: .4em; background: var(--cw); border: 1px solid var(--cb); color: var(--c); font-size: .8em; font-family: var(--mono); display: flex; align-items: center; justify-content: center; white-space: nowrap; overflow: visible; }
.fk .gt-bar.open { border-right: 0; border-radius: .4em 0 0 .4em; background: linear-gradient(90deg, var(--cw) 80%, rgba(255,255,255,0)); }
.fk .gt-bar.out span { position: absolute; top: 50%; transform: translateY(-50%); }
.fk .gt-bar.out-r span { left: calc(100% + .4em); }
.fk .gt-bar.out-l span { right: calc(100% + .4em); }
.fk .gt-r.hit .gt-bar { box-shadow: 0 0 0 2px var(--c); font-weight: 700; }
.fk .gt.has-mk { padding-top: 1.5em; }
.fk .gt-mk { position: absolute; top: 1.2em; bottom: 0; width: 0; border-left: 2px dashed var(--bad); z-index: 2; }
.fk .gt-mk span { position: absolute; top: -1.3em; left: -.2em; font-size: .8em; font-weight: 700; color: var(--bad); white-space: nowrap; background: #fff; padding: 0 .25em; }
.fk .gt-mk.left span { left: auto; right: -.2em; }

/* ---------- cols：几列卡片并排（窄版竖排），可以汇合到一个结果 ---------- */
.fk .cl { display: grid; grid-template-columns: repeat(var(--n), 1fr); gap: .7em; }
.fk.narrow .cl { grid-template-columns: 1fr; }
.fk .cl-c { border-radius: .55em; border: 1px solid var(--cb, var(--line)); background: var(--cw, #fff); padding: .65em .8em; font-size: .9em; line-height: 1.6; }
.fk .cl-h { font-weight: 700; color: var(--c, var(--ink)); margin-bottom: .25em; }
.fk .cl-h small { display: block; font-weight: 400; color: var(--mute); font-family: var(--mono); font-size: .88em; }
.fk .cl-c ul { margin: 0; padding-left: 1.1em; }
.fk .cl-c li { margin: .1em 0; }
.fk .cl-f { margin-top: .35em; font-size: .92em; color: var(--ink-2); }
.fk .cl-j { text-align: center; }
.fk .cl-ar { color: var(--mute); font-size: .9em; padding: .4em 0; }
.fk .cl-j .fk-res { margin-top: 0; text-align: left; }

/* ---------- bars：横向对比条 ---------- */
.fk .bs-r { display: grid; grid-template-columns: 10em 1fr; gap: .8em; align-items: center; padding: .4em 0; }
.fk.narrow .bs-r { grid-template-columns: 1fr; gap: .25em; }
.fk .bs-l { font-size: .9em; line-height: 1.35; }
.fk .bs-l b { display: block; }
.fk .bs-l small { color: var(--mute); }
.fk .bs-tr { display: flex; align-items: center; gap: .5em; min-width: 0; }
.fk .bs-b { height: 1.5em; border-radius: .3em; background: var(--c); min-width: 3px; flex: none; }
.fk .bs-b.in { display: flex; align-items: center; justify-content: flex-end; padding-right: .5em; }
.fk .bs-b.in .bs-v { color: #fff; }
.fk .bs-v { font-family: var(--mono); font-size: .88em; font-weight: 700; color: var(--c); white-space: nowrap; }

/* ---------- tree：自上而下决策树，窄版改缩进 ---------- */
.fk .dt { display: flex; flex-direction: column; align-items: center; min-width: max-content; --ln: #c3c9d0; }
.fk .dt-kids { display: flex; gap: 0; align-items: flex-start; position: relative; padding-top: 1.3em; }
.fk .dt-kids::before { content: ""; position: absolute; top: 0; left: 50%; height: 1.3em; border-left: 1.5px solid var(--ln); }
.fk .dt-k { display: flex; flex-direction: column; align-items: center; position: relative; padding: 1.3em .4em 0; }
.fk .dt-k::before { content: ""; position: absolute; top: 0; left: 0; right: 0; border-top: 1.5px solid var(--ln); }
.fk .dt-k:first-child::before { left: 50%; }
.fk .dt-k:last-child::before { right: 50%; }
.fk .dt-k::after { content: ""; position: absolute; top: 0; left: 50%; height: 1.3em; border-left: 1.5px solid var(--ln); }
.fk .dt-kids > .dt-k:first-child:last-child::before { display: none; }
.fk .dt .edge { position: relative; z-index: 1; font-size: .86em; color: var(--mute); background: #fff; padding: 0 .45em; margin: -.65em 0 .45em; line-height: 1.3em; }
.fk .nd { border-radius: .55em; padding: .55em .7em; font-size: .9em; line-height: 1.5; width: auto; min-width: 9em; max-width: 12.5em; text-wrap: balance; border: 1px solid var(--cb, var(--line)); background: var(--cw, #fff); text-align: center; }
.fk .nd b { color: var(--c, var(--ink)); }
.fk .nd small { display: block; color: var(--mute); font-size: .92em; margin-top: .15em; }
.fk .nd.q { background: #fff8e6; border-color: #f0dca8; font-weight: 700; width: auto; min-width: 11em; max-width: none; }
.fk .nd.q small { font-weight: 400; }
.fk .nd.root { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 700; width: auto; min-width: 15em; max-width: none; }
.fk.narrow .dt { min-width: 0; align-items: stretch; }
.fk.narrow .dt-kids { flex-direction: column; gap: .7em; padding: .7em 0 0 1em; margin-left: .7em; border-left: 1.5px solid var(--ln); align-items: stretch; }
.fk.narrow .dt-kids::before, .fk.narrow .dt-k::before, .fk.narrow .dt-k::after { display: none; }
.fk.narrow .dt-k { align-items: stretch; padding: 0; }
.fk.narrow .dt .edge { margin: 0 0 .3em; padding: 0; background: none; font-weight: 700; }
.fk.narrow .dt .edge::before { content: "└ "; color: var(--ln); }
.fk.narrow .nd, .fk.narrow .nd.q, .fk.narrow .nd.root { width: auto; min-width: 0; max-width: none; text-align: left; }

/* ---------- steps：编号步骤卡片，竖排连线 ---------- */
.fk .st-i { position: relative; display: grid; grid-template-columns: 2.2em 1fr; gap: .2em .7em; padding-bottom: .7em; }
.fk .st-i:last-child { padding-bottom: 0; }
.fk .st-i::before { content: ""; position: absolute; left: 1.1em; top: 2em; bottom: 0; border-left: 1.5px solid var(--line); }
.fk .st-i:last-child::before { display: none; }
.fk .st-n { width: 2em; height: 2em; border-radius: 50%; background: var(--c); color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center; font-size: .9em; margin-top: .15em; }
.fk .st-b { border: 1px solid var(--line); border-radius: .55em; padding: .5em .8em .6em; background: #fff; }
.fk .st-h { font-weight: 700; color: var(--c); }
.fk .st-t { font-size: .92em; line-height: 1.65; color: var(--ink-2); }
.fk .st-r { margin-top: .4em; font-size: .88em; font-weight: 700; color: var(--c); background: var(--cw); border: 1px solid var(--cb); border-radius: .4em; padding: .3em .6em; }

/* ---------- flow：横向流程链（可多行），窄版竖排 ---------- */
.fk .fl-row + .fl-row { margin-top: .9em; padding-top: .9em; border-top: 1px dashed var(--line); }
.fk .fl-lb { font-size: .86em; font-weight: 700; color: var(--mute); margin-bottom: .45em; }
.fk .fl { display: flex; align-items: stretch; }
.fk .fl-n { flex: 1 1 0; min-width: 0; border-radius: .55em; border: 1px solid var(--cb, var(--line)); background: var(--cw, #fff); padding: .5em .5em; text-align: center; font-size: .9em; line-height: 1.45; display: flex; flex-direction: column; justify-content: center; }
.fk .fl-n b { color: var(--c, var(--ink)); }
.fk .fl-n small { display: block; color: var(--mute); font-size: .9em; margin-top: .15em; }
.fk .fl-n.m-bad { border-style: dashed; border-color: var(--bad-b); background: var(--bad-w); }
.fk .fl-n.m-bad b { color: var(--bad); }
.fk .fl-n.m-off { opacity: .55; border-style: dashed; }
.fk .fl-a { flex: 0 0 auto; min-width: 2.4em; max-width: 6.5em; display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 0 .2em; position: relative; }
.fk .fl-a em { display: block; position: relative; width: 100%; min-width: 1.6em; height: 0; border-top: 1.5px solid #9aa3ad; margin: .3em 0; }
.fk .fl-a em::after { content: ""; position: absolute; right: -.1em; top: calc(-.32em - .75px); border-top: .32em solid transparent; border-bottom: .32em solid transparent; border-left: .55em solid #9aa3ad; }
.fk .fl-a span { font-size: .78em; color: var(--mute); line-height: 1.3; text-align: center; }
.fk .fl-a span:empty { display: none; }
.fk.narrow .fl { flex-direction: column; }
.fk.narrow .fl-n { text-align: left; }
.fk.narrow .fl-a { flex-direction: row; justify-content: flex-start; min-width: 0; max-width: none; padding: .25em 0 .25em 1.2em; gap: .5em; }
.fk.narrow .fl-a::before { content: "↓"; color: #9aa3ad; order: -1; }
.fk.narrow .fl-a em { display: none; }

/* ---------- layers：分层架构 / 扇出扇入，每层一条横带 ---------- */
.fk .ly { border-radius: .6em; background: var(--cw, var(--bg-2)); border: 1px solid var(--cb, var(--line)); padding: .55em .7em .7em; }
.fk .ly-h { font-size: .9em; margin-bottom: .45em; display: flex; align-items: baseline; gap: .6em; flex-wrap: wrap; }
.fk .ly-h b { color: var(--c, var(--ink)); }
.fk .ly-h small { color: var(--mute); font-size: .92em; }
.fk .ly-ns { display: flex; flex-wrap: wrap; gap: .5em; }
.fk .ly-ns .fl-n { flex: 1 1 7em; background: #fff; }
.fk .ly-ns .fl-n[class*=" t-"] { background: var(--cw); }
.fk .ly-note { margin-top: .45em; font-size: .85em; color: var(--ink-2); line-height: 1.55; }
.fk .ly-ar { text-align: center; color: var(--mute); font-size: .86em; padding: .35em 0; line-height: 1.4; }

/* ---------- seq：时序图，参与方竖线 + 消息箭头 ---------- */
.fk .sq { position: relative; padding-bottom: .4em; }
.fk .sq-ln { position: absolute; top: 1em; bottom: 0; border-left: 1.5px dashed #c9cfd6; }
.fk .sq-hd { position: relative; display: grid; grid-template-columns: repeat(var(--n), 1fr); margin-bottom: .5em; }
.fk .sq-hd div { text-align: center; padding: 0 .2em; }
.fk .sq-hd span { display: inline-block; background: var(--ink); color: #fff; font-weight: 700; font-size: .86em; border-radius: .4em; padding: .3em .65em; line-height: 1.35; }
.fk .sq-r { position: relative; padding: .2em 0; }
.fk .sq-m { position: relative; padding-bottom: .5em; }
.fk .sq-m span, .fk .sq-self span { display: block; font-size: .82em; line-height: 1.4; text-align: center; padding: 0 .4em .15em; }
/* 箭头上的字可以比箭头宽：居中向两边伸出去，最宽 20em，白底盖住经过的竖线 */
.fk .sq-m span { width: max-content; max-width: 20em; margin: 0; position: relative; left: 50%; transform: translateX(-50%); background: #fff; border-radius: .3em; }
.fk .sq-m span i, .fk .sq-self span i { font-style: normal; display: inline-flex; width: 1.4em; height: 1.4em; border-radius: 50%; background: var(--c, var(--brand)); color: #fff; font-size: .82em; align-items: center; justify-content: center; margin-right: .3em; vertical-align: .1em; }
.fk .sq-m::before { content: ""; position: absolute; left: 0; right: 0; bottom: .2em; border-top: 1.5px solid var(--c, #59636e); }
.fk .sq-m.sq-dash::before { border-top-style: dashed; }
.fk .sq-m::after { content: ""; position: absolute; bottom: -.07em; width: 0; height: 0; border-top: .32em solid transparent; border-bottom: .32em solid transparent; }
.fk .sq-m.r::after { right: -.05em; border-left: .55em solid var(--c, #59636e); }
.fk .sq-m.l::after { left: -.05em; border-right: .55em solid var(--c, #59636e); }
.fk .sq-self { border: 1.5px solid var(--c, #59636e); border-left: 0; border-radius: 0 .4em .4em 0; padding: .25em 0; margin-top: .1em; margin-bottom: .1em; background: #fff; }
.fk .sq-self span { text-align: left; }
.fk .sq-self.lf { border-left: 1.5px solid var(--c, #59636e); border-right: 0; border-radius: .4em 0 0 .4em; }
.fk .sq-self.lf span { text-align: right; }
.fk .sq-note { background: #fff8e6; border: 1px solid #f0dca8; border-radius: .4em; padding: .3em .6em; font-size: .82em; line-height: 1.5; text-align: center; position: relative; }

/* ---------- graph：实际测量文字，HTML 节点 + SVG 正交连线，不缩小字号 ---------- */
.fk .fk-graph { position: relative; width: 100%; min-height: 4em; isolation: isolate; }
.fk .fg-node { position: absolute; z-index: 2; border: 1.4px solid var(--cb); border-radius: .5em; background: var(--cw); padding: .65em .6em; text-align: center; line-height: 1.4; overflow-wrap: anywhere; }
.fk .fg-content { position: relative; z-index: 1; }
.fk .fg-content > b { display: block; color: var(--c); font-size: .93em; }
.fk .fg-content > small { display: block; font-size: .8em; margin-top: .3em; color: var(--ink-2); }
.fk .fg-node[data-shape="round"] { border-radius: 3em; }
.fk .fg-node[data-shape="circle"] { border-radius: 50%; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 1.1em; }
.fk .fg-node[data-shape="diamond"], .fk .fg-node[data-shape="cylinder"] { border: 0; background: none; }
.fk .fg-node[data-shape="diamond"] { padding: 2em 1.9em; }
.fk .fg-node[data-shape="cylinder"] { padding: 1.3em .65em; }
.fk .fg-shape { position: absolute; inset: 0; width: 100%; height: 100%; fill: var(--cw); stroke: var(--cb); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.fk .fg-shape > * { vector-effect: non-scaling-stroke; }
.fk .fg-group { position: absolute; z-index: -1; background: var(--cw); border: 1px dashed var(--cb); border-radius: .65em; }
.fk .fg-group > b { display: block; font-size: .82em; color: var(--ink-2); padding: .45em .8em; line-height: 1.4; overflow-wrap: anywhere; }
.fk .fg-edges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.fk .fg-line { fill: none; stroke: var(--c, var(--mute)); stroke-width: 1.35; stroke-linejoin: round; stroke-linecap: round; }
.fk .fg-dash { stroke-dasharray: 5 4; }
.fk .fg-arrow { fill: var(--c, var(--mute)); }
.fk .fg-label { position: absolute; z-index: 3; width: max-content; padding: .1em .35em; border-radius: .2em; font-size: .76em; line-height: 1.35; text-align: center; color: var(--c, var(--ink-2)); background: #fff; overflow-wrap: anywhere; }
.fk[data-type="graph"] .fk-b { min-width: 0; }

/* 文章正文的通用排版不进入静态图解；宽表在图内滚动。 */
.fk { max-width: 100%; }
.fk .fk-b { overflow-x: auto; }
.fk .tb { margin: 0; }
.fk .tb th, .fk .tb td { border-width: 0 0 1px; }
.fk .fk-tag::before { content: none; }
.fk .fk-steps { display: block; }
.fk .fk-steps, .fk .st-b { min-width: 0; }
