.mermaid-thumbnail {
  position: relative;
  margin: 24px 0;
  border-radius: 8px;
  overflow: hidden;
}
.mermaid-thumbnail .mermaid {
  border: none;
  border-radius: 0;
  margin: 0;
  padding: 0;
}
.mermaid-expand-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  color: #495057;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  backdrop-filter: blur(4px);
}
.mermaid-expand-btn:hover {
  background: #fff;
  border-color: #0d6efd;
  color: #0d6efd;
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.25);
}
.mermaid-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10560;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mermaidOverlayIn 0.2s ease-out;
}
@keyframes mermaidOverlayIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.mermaid-overlay-svg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  transition: transform 0.05s linear;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
  box-sizing: border-box;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.mermaid-overlay-svg::-webkit-scrollbar {
  display: none;
}
.mermaid-overlay-svg:active {
  cursor: grabbing;
}
.mermaid-overlay-svg svg {
  display: block;
  transform-origin: center center;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  max-width: 100%;
  height: auto;
  flex-shrink: 0;
}
.mermaid-overlay-toolbar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(30, 30, 30, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 6px 12px;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.mermaid-overlay-toolbar .zoom-label {
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 50px;
  text-align: center;
  user-select: none;
}
.mermaid-overlay-toolbar button {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  background: transparent;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.mermaid-overlay-toolbar button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
}
.mermaid-overlay-toolbar .mermaid-close-btn {
  margin-left: 8px;
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(220, 53, 69, 0.2);
  border-color: rgba(220, 53, 69, 0.3);
}
.mermaid-overlay-toolbar .mermaid-close-btn:hover {
  background: rgba(220, 53, 69, 0.4);
  border-color: rgba(220, 53, 69, 0.6);
}
