.ghrm-block {
  position: relative;
  margin: 16px 0;
  border: 1px solid var(--borderColor-default, #d0d7de);
  border-radius: 6px;
  overflow: hidden;
}

.ghrm-copy-host {
  position: relative;
}

.ghrm-copy-target {
  padding-right: 52px;
}

.ghrm-copy-button {
  position: absolute;
  top: 8px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--borderColor-default, #d0d7de);
  border-radius: 6px;
  background: color-mix(
    in srgb,
    var(--bgColor-default, #ffffff) 88%,
    transparent
  );
  color: var(--fgColor-muted, #636c76);
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.ghrm-copy-button::before {
  content: "";
  display: none;
  position: absolute;
  top: 50%;
  right: calc(100% + 8px);
  transform: translateY(-50%);
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--overlay-bgColor, #343942);
  color: var(--fgColor-onEmphasis, #ffffff);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  pointer-events: none;
}

.ghrm-copy-button:hover {
  color: var(--fgColor-default, #1f2328);
  background: var(--bgColor-default, #ffffff);
}

.ghrm-copy-button:focus-visible {
  outline: 2px solid var(--focus-outlineColor, #0969da);
  outline-offset: 2px;
}

.ghrm-copy-icon {
  fill: currentColor;
}

.ghrm-copy-icon-check {
  display: none;
}

.ghrm-copy-button.is-copied {
  color: var(--fgColor-success, #1a7f37);
}

.ghrm-copy-button.is-copied::before {
  content: attr(data-copy-feedback);
  display: block;
}

.ghrm-copy-button.is-copied .ghrm-copy-icon-copy {
  display: none;
}

.ghrm-copy-button.is-copied .ghrm-copy-icon-check {
  display: block;
}

body.ghrm-print .ghrm-copy-button,
body.ghrm-print .ghrm-render-actions,
body.ghrm-print .ghrm-mermaid-controls,
body.ghrm-print .leaflet-control-zoom {
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

body.ghrm-print .ghrm-copy-host:hover > .ghrm-copy-button,
body.ghrm-print .ghrm-copy-host:focus-within > .ghrm-copy-button,
body.ghrm-print .ghrm-mermaid:hover > .ghrm-render-actions,
body.ghrm-print .ghrm-mermaid:focus-within > .ghrm-render-actions,
body.ghrm-print .ghrm-mermaid:hover .ghrm-mermaid-controls,
body.ghrm-print .ghrm-mermaid:focus-within .ghrm-mermaid-controls,
body.ghrm-print .ghrm-geojson:hover .leaflet-control-zoom,
body.ghrm-print .ghrm-geojson:focus-within .leaflet-control-zoom,
body.ghrm-print .ghrm-topojson:hover .leaflet-control-zoom,
body.ghrm-print .ghrm-topojson:focus-within .leaflet-control-zoom {
  opacity: 1;
  pointer-events: auto;
}

.ghrm-mermaid-diagram,
.ghrm-map-canvas {
  background: var(--bgColor-default, #ffffff);
}

.ghrm-mermaid-diagram {
  position: relative;
  min-height: 200px;
  padding: 16px;
  text-align: center;
  overflow: visible;
}

.ghrm-mermaid-diagram svg {
  max-width: 100%;
  height: auto;
}

.ghrm-render-actions {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  display: flex;
  gap: 8px;
  padding: 8px 8px 0 0;
}

.ghrm-action-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--borderColor-default, #d0d7de);
  border-radius: 6px;
  background: var(--bgColor-default, #ffffff);
  color: var(--fgColor-muted, #636c76);
  cursor: pointer;
}

.ghrm-action-button::before {
  content: "";
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  padding: 4px 8px;
  border-radius: 6px;
  background: var(--overlay-bgColor, #343942);
  color: var(--fgColor-onEmphasis, #ffffff);
  font-size: 14px;
  line-height: 20px;
  white-space: nowrap;
  pointer-events: none;
}

.ghrm-action-button:hover {
  color: var(--fgColor-default, #1f2328);
}

.ghrm-action-button:focus-visible {
  outline: 2px solid var(--focus-outlineColor, #0969da);
  outline-offset: 2px;
}

.ghrm-action-button.is-copied {
  color: var(--fgColor-success, #1a7f37);
}

.ghrm-action-button.is-copied::before {
  content: attr(data-copy-feedback);
  display: block;
}

.ghrm-action-button.is-copied .ghrm-copy-icon-copy {
  display: none;
}

.ghrm-action-button.is-copied .ghrm-copy-icon-check {
  display: block;
}

.ghrm-action-icon {
  fill: currentColor;
}

.ghrm-mermaid-controls {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  grid-template-columns: repeat(3, 28px);
  grid-template-rows: repeat(3, 28px);
  gap: 4px;
  z-index: 2;
}

.ghrm-mermaid-controls button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--borderColor-muted, #d0d7de);
  border-radius: 6px;
  background: var(--bgColor-default, #ffffff);
  color: var(--fgColor-muted, #636c76);
  cursor: pointer;
}

.ghrm-mermaid-controls button:hover {
  background: var(--bgColor-muted, #f6f8fa);
  color: var(--fgColor-default, #1f2328);
}

.ghrm-mermaid-controls button:focus-visible {
  outline: 2px solid var(--focus-outlineColor, #0969da);
  outline-offset: 2px;
}

.ghrm-mermaid-controls button svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.ghrm-mermaid-controls button[data-action="up"] {
  grid-column: 2;
  grid-row: 1;
}
.ghrm-mermaid-controls button[data-action="zoom-in"] {
  grid-column: 3;
  grid-row: 1;
}
.ghrm-mermaid-controls button[data-action="left"] {
  grid-column: 1;
  grid-row: 2;
}
.ghrm-mermaid-controls button[data-action="reset"] {
  grid-column: 2;
  grid-row: 2;
}
.ghrm-mermaid-controls button[data-action="right"] {
  grid-column: 3;
  grid-row: 2;
}
.ghrm-mermaid-controls button[data-action="down"] {
  grid-column: 2;
  grid-row: 3;
}
.ghrm-mermaid-controls button[data-action="zoom-out"] {
  grid-column: 3;
  grid-row: 3;
}

.ghrm-mermaid:fullscreen {
  background: var(--bgColor-default, #ffffff);
}

.ghrm-mermaid:fullscreen .ghrm-mermaid-diagram {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
}

.ghrm-mermaid:fullscreen .ghrm-mermaid-diagram svg {
  max-height: 90vh;
}

.ghrm-map-canvas {
  height: 420px;
  position: relative;
}

.ghrm-map-offline {
  position: absolute;
  bottom: 10px;
  left: 10px;
  z-index: 1000;
  padding: 4px 8px;
  border-radius: 4px;
  background: var(--bgColor-muted, #f6f8fa);
  color: var(--fgColor-muted, #656d76);
  pointer-events: none;
}

.ghrm-map-offline svg {
  display: block;
  width: 20px;
  height: 20px;
}

.ghrm-mermaid-info {
  margin: 0;
  padding: 16px;
  color: var(--fgColor-default, #1f2328);
  font: inherit;
  text-align: left;
}

.ghrm-error {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid var(--borderColor-default, #d0d7de);
  color: var(--fgColor-danger, #d1242f);
  background: var(--bgColor-attention-muted, #fff8c5);
}

.markdown-body .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.ghrm-math-block {
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.markdown-body .hljs {
  color: var(--fgColor-default, #1f2328);
  background: transparent;
}

.markdown-body code.hljs,
.markdown-body pre code.hljs {
  display: inline;
  padding: 0;
  background: transparent;
  font-family: inherit;
}

.markdown-body pre code.hljs {
  font-size: inherit;
  line-height: inherit;
  color: var(--fgColor-default, #1f2328);
}

.markdown-body .hljs-comment,
.markdown-body .hljs-quote {
  color: var(--color-prettylights-syntax-comment);
}

.markdown-body .hljs-keyword,
.markdown-body .hljs-doctag,
.markdown-body .hljs-meta .hljs-keyword,
.markdown-body .hljs-template-tag,
.markdown-body .hljs-template-variable,
.markdown-body .hljs-type {
  color: var(--color-prettylights-syntax-keyword);
}

.markdown-body .hljs-title,
.markdown-body .hljs-title.class_,
.markdown-body .hljs-title.class_.inherited__,
.markdown-body .hljs-title.function_,
.markdown-body .hljs-built_in {
  color: var(--color-prettylights-syntax-entity);
}

.markdown-body .hljs-string,
.markdown-body .hljs-meta .hljs-string,
.markdown-body .hljs-regexp {
  color: var(--color-prettylights-syntax-string);
}

.markdown-body .hljs-attr,
.markdown-body .hljs-attribute,
.markdown-body .hljs-literal,
.markdown-body .hljs-meta,
.markdown-body .hljs-number,
.markdown-body .hljs-operator,
.markdown-body .hljs-selector-attr,
.markdown-body .hljs-selector-class,
.markdown-body .hljs-selector-id {
  color: var(--color-prettylights-syntax-constant);
}

.markdown-body .hljs-variable,
.markdown-body .hljs-symbol {
  color: var(--color-prettylights-syntax-variable);
}

.markdown-body .hljs-name,
.markdown-body .hljs-selector-pseudo,
.markdown-body .hljs-selector-tag {
  color: var(--color-prettylights-syntax-entity-tag);
}

.markdown-body .hljs-params,
.markdown-body .hljs-subst,
.markdown-body .hljs-punctuation {
  color: var(--fgColor-default, #1f2328);
}

.leaflet-container {
  font: inherit;
}

.leaflet-control-attribution {
  display: none;
}

.leaflet-control-zoom {
  border: 1px solid var(--borderColor-default, #d0d7de);
  border-radius: 6px;
  overflow: hidden;
}

.leaflet-control-zoom a {
  background: var(--bgColor-default, #ffffff);
  color: var(--fgColor-default, #1f2328);
  border-bottom: 1px solid var(--borderColor-default, #d0d7de);
  width: 30px;
  height: 30px;
  line-height: 30px;
  font-size: 16px;
  text-decoration: none;
  text-align: center;
  display: block;
}

.leaflet-control-zoom a:last-child {
  border-bottom: none;
}
