.sir-mermaid {
  color: #bababa;
  border-radius: 7px;
  border: 1px solid #3a3f4b;
  margin: .75rem 0;
  overflow: hidden;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 200px;
  transition: height .2s ease, min-height .2s ease, aspect-ratio .2s ease;
}

.sir-mermaid-zoom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: 32px;
  transform-origin: center center;
  transition: transform .2s cubic-bezier(0.23, 1, 0.32, 1);
  display: inline-block;
  will-change: transform;
  margin: auto;
}

.sir-mermaid svg {
  max-width: 100%;
  height: auto;
  display: block;
  margin: auto;
}

.sir-mermaid .sir-bar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 32px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, .25);
  border-bottom: 1px solid rgba(255, 255, 255, .06);
  z-index: 3;
  backdrop-filter: blur(5px);
}

.sir-mermaid .sir-title {
  font-size: 12px;
  color: #e5e7eb;
  letter-spacing: .02em;
}

.sir-mermaid .sir-eye {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: #e5e7eb;
  cursor: pointer;
}

.sir-mermaid .sir-eye:hover {
  color: #ffffff;
}

.sir-mermaid .sir-eye svg {
  width: 18px;
  height: 18px;
  color: currentColor;
}

.sir-mermaid .sir-placeholder {
  position: absolute;
  left: 0;
  right: 0;
  top: 32px;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #9ca3af;
  font-size: 12px;
  pointer-events: none;
}

.sir-mermaid .sir-tools {
  position: absolute;
  right: 8px;
  top: 40px;
  display: flex;
  gap: 6px;
  z-index: 2;
}

.sir-mermaid .sir-tools button {
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .08);
  color: #e5e7eb;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.sir-mermaid .sir-tools button:hover {
  background: rgba(0, 0, 0, .5);
}

.sir-mermaid.sir-dragging {
  cursor: grabbing;
}


/* 折叠：当未渲染（存在占位符）时，收起高度，仅保留工具栏与少量可视区域 */
.sir-mermaid:has(.sir-placeholder) {
  aspect-ratio: auto;
  min-height: 0;
  height: 56px;
}

/* 展开：占位符消失后，使用更顺滑的贝塞尔曲线进行展开过渡 */
.sir-mermaid:not(:has(.sir-placeholder)) {
  transition: height .36s cubic-bezier(0.23, 1, 0.32, 1),
    min-height .36s cubic-bezier(0.23, 1, 0.32, 1),
    aspect-ratio .36s cubic-bezier(0.23, 1, 0.32, 1);
}