html, body {
  color: #333;
  overflow-x: hidden;
  margin: 0;
  padding: 0;
  font-family: Helvetica, arial, freesans, clean, sans-serif;
  font-size: 1em;
  line-height: 1.5em;
  background-color: #fff;
  overscroll-behavior-y: none;
}

body {
  display: flex;
  flex-direction: column;
  height:100vh;
}

h1, h2, h3, h4, h5, h6, p {
  font-size: 1em;
  margin: 0;
  padding: 0;
  font-weight: normal;
}

p {
  margin: 1em;
}

a:link,
a:visited,
a:hover
a:active {
  text-decoration: none;
}

img {
  border: none;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  width: 100%;
  background-color: #444;
  font-size: 12px;
  color: #fff;
}

header a:link, header a:hover, header a:visited, header a:active {
  color: #fff;
}

header a:hover {
  text-decoration: underline;
}

#menu-items {
    display: flex;
    align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-right: 32px;
}

.view-mode-switcher {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid #777;
  border-radius: 4px;
}

.view-mode-switcher button {
  display: grid;
  width: 30px;
  height: 28px;
  padding: 6px;
  place-items: center;
  border: 0;
  border-right: 1px solid #777;
  color: #ddd;
  background: transparent;
  cursor: pointer;
}

.view-mode-switcher button:last-child {
  border-right: 0;
}

.view-mode-switcher button:hover {
  background: #555;
}

.view-mode-switcher button.active {
  color: #fff;
  background: #666;
}

.view-mode-switcher svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.25;
  stroke-linecap: round;
  stroke-linejoin: round;
}

#reset-button {
    margin-left: 16px;
}

#copy-button {
    margin-left: 16px;
}

#export-button {
    margin-left: 16px;
}

#sync-button {
    margin-left: 16px;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

header input[type="checkbox"] {
    vertical-align: middle;
    margin-right: 4px;
    margin-top: 0px;
}

#github {
    padding-right: 0;
}

#github img {
  display: block;
  width: 16px;
}

#github a {
  display: block;
  width: 16px;
}

footer {
  padding: 8px;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #fff;
  color: #fff;
  text-align: center;
  justify-content: center;
  align-items: center;
}

#container {
  flex-grow: 1;
  overflow: hidden;
  width: 100%;
  margin: 0 auto;
  background-color: #fff;
  border-bottom: 1px solid #e8e8e8;
  display: flex;
}

#editor-wrapper {
  height: 100%;
}

#editor {
  height: 100%;
}

#preview-wrapper {
  padding: 8px 16px 16px 16px;
}

.column {
  width: 50%;
  padding: 0;
  margin: 0;
  white-space: nowrap;
  vertical-align: top;
}

#preview.column {
  overflow-y: scroll;
  white-space: normal;
}

.markdown-body .mermaid {
  position: relative;
  overflow-x: auto;
  padding: 16px;
  text-align: center;
}

.markdown-body .mermaid svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

.mermaid-open-button {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  width: 32px;
  height: 32px;
  padding: 7px;
  place-items: center;
  border: 1px solid #d0d7de;
  border-radius: 6px;
  color: #57606a;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 2px rgba(31, 35, 40, 0.08);
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, background-color 120ms ease;
}

.mermaid:hover .mermaid-open-button,
.mermaid-open-button:focus-visible {
  opacity: 1;
}

.mermaid-open-button:hover {
  color: #24292f;
  background: #fff;
}

.mermaid-open-button svg {
  width: 16px !important;
  height: 16px !important;
  margin: 0 !important;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.markdown-body .mermaid-error {
  color: #cf222e;
  white-space: pre-wrap;
  text-align: left;
}

[data-theme="dark"] .markdown-body .mermaid-error {
  color: #ff7b72;
}

.split-container {
  display: flex;
  height: 100%;
  width: 100%;
}

#container.view-edit #edit,
#container.view-preview #preview {
  width: 100% !important;
}

#container.view-edit #preview,
#container.view-edit #split-divider,
#container.view-preview #edit,
#container.view-preview #split-divider {
  display: none;
}

.editor-pane,
.preview-pane {
  height: 100%;
}

.split-divider {
  width: 5px;
  background: #ccc;
  cursor: col-resize;
  z-index: 1;
}

.split-divider.hover {
  background: #999;
}

.split-divider.active {
  background: #666;
}

/* Dark theme overrides */
[data-theme="dark"] html, [data-theme="dark"] body {
  background-color: #212830;
  color: #e6edf3;
}

[data-theme="dark"] header {
  background-color: #333;
  color: #e6edf3;
}

[data-theme="dark"] header a:link, [data-theme="dark"] header a:hover, [data-theme="dark"] header a:visited {
  color: #e6edf3;
}

[data-theme="dark"] #container {
  background-color: #212830;
  border-bottom: 1px solid #1f2d3a;
}

[data-theme="dark"] .split-divider {
  background: #30363d;
}

[data-theme="dark"] .split-divider.hover {
  background: #444c56;
}

[data-theme="dark"] .split-divider.active {
  background: #768390;
}

[data-theme="dark"] .view-mode-switcher {
  border-color: #636c76;
}

[data-theme="dark"] .view-mode-switcher button {
  border-right-color: #636c76;
  color: #b1bac4;
}

[data-theme="dark"] .view-mode-switcher button:hover {
  background: #444c56;
}

[data-theme="dark"] .view-mode-switcher button.active {
  color: #fff;
  background: #545d68;
}

[data-theme="dark"] .mermaid-open-button {
  border-color: #444c56;
  color: #adbac7;
  background: rgba(45, 51, 59, 0.92);
}

[data-theme="dark"] .mermaid-open-button:hover {
  color: #fff;
  background: #373e47;
}

[data-theme="dark"] footer {
  background-color: #333;
}

@media (max-width: 760px) {
  header {
    padding: 8px;
  }

  #menu-items > div:first-child,
  #sync-button {
    display: none;
  }

  .header-actions {
    padding-right: 16px;
  }

  .mermaid-open-button {
    opacity: 1;
  }
}
