#mermaid-modal {
  display: none;
}

.mermaid-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.mermaid-modal-content {
  position: relative;
  background: #ffffff;
  border-radius: 12px;
  padding: 2.5rem;
  max-width: 96vw;
  max-height: 94vh;
  overflow: auto;
  box-shadow: 0 16px 64px rgba(0, 0, 0, 0.5);
}

[data-md-color-scheme="slate"] .mermaid-modal-content {
  background: #1e1e2e;
}

.mermaid-modal-close {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 2.5rem;
  background: rgba(0, 0, 0, 0.6);
  border: none;
  cursor: pointer;
  color: #fff;
  line-height: 1;
  z-index: 100000;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.mermaid-modal-close:hover {
  background: rgba(207, 255, 94, 0.3);
}

.mermaid-modal-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 70vw;
  min-height: 50vh;
}

.mermaid-modal-body svg {
  max-width: 92vw;
  max-height: 88vh;
}

/* Hover hint on diagrams */
.mermaid[data-zoom-ready] {
  transition: outline 0.2s, box-shadow 0.2s;
  border-radius: 8px;
}

.mermaid[data-zoom-ready]:hover {
  outline: 2px solid var(--md-accent-fg-color, #2027B7);
  outline-offset: 6px;
  box-shadow: 0 0 0 6px rgba(32, 39, 183, 0.08);
}
