.koutao-mermaid-diagram {
  box-sizing: border-box; width: 100%; max-width: 100%;
  margin: 1.25em 0; padding: 8px 0; overflow-x: auto;
  text-align: center; background: transparent;
}
.koutao-mermaid-diagram > svg {
  display: block; width: 100%; max-width: 100%; height: auto; margin: 0 auto;
}
pre.wp-block-code.koutao-mermaid[hidden] { display: none !important; }

/* Scoped to diagrams: remove decorative shadows without changing node fills. */
.koutao-mermaid-diagram > svg .node,
.koutao-mermaid-diagram > svg .node > rect,
.koutao-mermaid-diagram > svg .node > path,
.koutao-mermaid-diagram > svg .node > polygon,
.koutao-mermaid-diagram > svg .node > g {
  filter: none !important;
  box-shadow: none !important;
}

/* Special deterministic layout: responsive and independent of Mermaid's auto-layout. */
.koutao-mermaid-diagram.koutao-mermaid-vertical > svg {
  display: block; width: 100%; height: auto; max-width: 100%;
  overflow: visible; font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* Precise layouts: constrain to the reading column, not the full page. */
.koutao-mermaid-diagram.koutao-mermaid-precise {
  width: 100% !important;
  max-width: min(630px, var(--wp--style--global--content-size, 630px)) !important;
  margin-left: auto !important;
  margin-right: auto !important;
  min-width: 0;
}

/* Generic canvas: fixed logical geometry, optionally switch to a mobile scene. */
.koutao-mermaid-diagram.koutao-mermaid-canvas { max-width: min(var(--koutao-canvas-width, 630px), var(--wp--style--global--content-size, 630px)) !important; }
.koutao-mermaid-diagram.koutao-mermaid-canvas > svg { overflow: hidden; }

/* Static SVG is the primary Canvas output, even with JS disabled. */
.km-static > .km-static-desktop { display:block; }
.km-static > .km-static-mobile { display:none !important; }
@media (max-width:439px) {
  .km-static.km-has-mobile > .km-static-desktop { display:none !important; }
  .km-static.km-has-mobile > .km-static-mobile { display:block !important; }
}
@container (max-width:439px) {
  .km-static.km-has-mobile > .km-static-desktop { display:none !important; }
  .km-static.km-has-mobile > .km-static-mobile { display:block !important; }
}
.km-legacy-shell > pre.koutao-mermaid, .km-legacy-fallback[hidden] {display:none !important;}
