/* wuyi_mermaid 1.1.0 · 无忆研习社Style配套插件 · 莫潇羽工作室 */
.wuyi-mermaid {
    margin: 1.5em 0;
    padding: 16px 12px 8px;
    border: 1px solid rgba(127, 127, 127, .18);
    border-radius: 8px;
    background: rgba(127, 127, 127, .03);
    text-align: center;
    max-width: 100%;
    box-sizing: border-box;
}
.wuyi-mermaid-canvas {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    /* 固定排版参数：不跟随正文的阅读字号 / 行高调节，避免标签文字溢出方框 */
    font-size: 16px;
    line-height: 1.5;
    letter-spacing: normal;
    text-indent: 0;
    white-space: normal;
}
.wuyi-mermaid-canvas svg {
    max-width: 100%;
    height: auto;
    display: inline-block;
}
.wuyi-mermaid-zoomable { cursor: zoom-in; }
.wuyi-mermaid-bar {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin-top: 6px;
}
.wuyi-mermaid .wuyi-mermaid-btn {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    width: auto;
    height: auto;
    min-width: 0;
    box-shadow: none;
    text-shadow: none;
    font-family: inherit;
    font-weight: normal;
    font-size: 12px;
    line-height: 1.6;
    padding: 1px 10px;
    border: 1px solid rgba(127, 127, 127, .3);
    border-radius: 4px;
    background: transparent;
    color: inherit;
    opacity: .7;
    cursor: pointer;
}
.wuyi-mermaid .wuyi-mermaid-btn:hover { opacity: 1; }
.wuyi-mermaid-btn[hidden] { display: none; }
.wuyi-mermaid pre.wuyi-mermaid-src {
    color: inherit;
    border: 0;
    max-height: 420px;
    position: static;
    line-height: 1.6;
    text-align: left;
    margin: 8px 0 4px;
    padding: 10px 12px;
    font-size: 13px;
    white-space: pre;
    overflow-x: auto;
    border-radius: 6px;
    background: rgba(127, 127, 127, .08);
}
.wuyi-mermaid pre.wuyi-mermaid-src[hidden] { display: none; }
.wuyi-mermaid-error {
    margin: 8px 0 4px;
    padding: 6px 10px;
    font-size: 12px;
    color: #b45309;
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    border-radius: 4px;
}
.wuyi-mermaid-zoom {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, .72);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    box-sizing: border-box;
    cursor: zoom-out;
}
.wuyi-mermaid-zoom-inner {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
    max-width: 100%;
    max-height: 100%;
    overflow: auto;
    cursor: default;
    box-sizing: border-box;
}
.wuyi-mermaid-zoom-inner svg {
    width: min(1400px, 92vw);
    height: auto;
}
.wuyi-mermaid-zoom .wuyi-mermaid-zoom-close {
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none;
    padding: 0;
    position: fixed;
    top: 12px;
    right: 16px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 28px;
    line-height: 40px;
    cursor: pointer;
}
@media (max-width: 640px) {
    .wuyi-mermaid { padding: 12px 6px 6px; }
    .wuyi-mermaid-zoom { padding: 8px; }
    .wuyi-mermaid-zoom-inner { padding: 10px; }
    .wuyi-mermaid-zoom-inner svg { width: 180vw; }
}
/* 主题护眼 / 墨水屏模式下保持图表清晰 */
.dl-eink .wuyi-mermaid { filter: none; }
@media print {
    .wuyi-mermaid-bar, .wuyi-mermaid-src { display: none !important; }
    .wuyi-mermaid { border: 0; }
}
.wuyi-mermaid-zoom.is-dark .wuyi-mermaid-zoom-inner { background: #1f2430; }
