.mermaid-interactive {
  cursor: zoom-in;
  transition: outline-color 180ms ease;
  overflow-x: auto;
  overflow-y: hidden;
  text-align: center;
}

.mermaid-interactive svg {
  display: inline-block;
  min-width: 0;
}

.mermaid-interactive:focus-visible {
  outline: 2px solid var(--vp-c-brand-1);
  outline-offset: 4px;
  border-radius: 0;
}

.mermaid-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
}

.mermaid-modal.is-open {
  display: block;
}

.mermaid-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.mermaid-modal__dialog {
  position: relative;
  z-index: 1;
  margin: 4vh auto;
  width: min(96vw, 1800px);
  max-height: 92vh;
  border: 1px solid var(--vp-c-border);
  border-radius: 0;
  background: var(--vp-c-bg);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), 0 24px 64px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.mermaid-modal__close {
  display: block;
  margin-left: auto;
  margin-right: 16px;
  margin-top: 12px;
  border: 1px solid var(--vp-c-border);
  border-radius: 0;
  padding: 4px 10px;
  background: var(--vp-c-bg-soft);
  color: var(--vp-c-text-1);
  font-family: var(--tui-font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease;
}

.mermaid-modal__close:hover {
  border-color: var(--vp-c-brand-1);
  color: var(--vp-c-brand-1);
}

.mermaid-modal__content {
  overflow: auto;
  max-height: calc(92vh - 56px);
  padding: 8px 16px 16px;
}

.mermaid-modal__content svg {
  max-width: none;
  width: max-content;
  height: auto;
  min-width: 100%;
}

body.mermaid-modal-open {
  overflow: hidden;
}
