*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html,
body {
  height: 100%;
  margin: 0;
}

.marky-body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.marky-app {
  isolation: isolate;
}

.marky-header,
.marky-footer,
.marky-pane-label {
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

.marky-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border-radius: 0.5rem;
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease, transform 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.marky-btn:active {
  transform: scale(0.97);
}

.marky-btn:focus-visible {
  outline: 2px solid rgb(139 92 246);
  outline-offset: 2px;
}

.marky-btn-icon {
  padding: 0.5rem;
  color: rgb(100 116 139);
  background: transparent;
  border-color: rgb(226 232 240);
}

.marky-btn-icon:hover {
  background: rgb(241 245 249);
  color: rgb(51 65 85);
}

.dark .marky-btn-icon {
  color: rgb(148 163 184);
  border-color: rgb(51 65 85);
}

.dark .marky-btn-icon:hover {
  background: rgb(30 41 59);
  color: rgb(226 232 240);
}

.marky-btn-ghost {
  color: rgb(71 85 105);
  background: rgb(248 250 252);
  border-color: rgb(226 232 240);
}

.marky-btn-ghost:hover {
  background: rgb(241 245 249);
  color: rgb(15 23 42);
}

.dark .marky-btn-ghost {
  color: rgb(203 213 225);
  background: rgb(30 41 59);
  border-color: rgb(51 65 85);
}

.dark .marky-btn-ghost:hover {
  background: rgb(51 65 85);
  color: rgb(248 250 252);
}

.marky-btn-danger {
  color: rgb(220 38 38);
  background: rgb(254 242 242);
  border-color: rgb(254 202 202);
}

.marky-btn-danger:hover {
  background: rgb(254 226 226);
  color: rgb(185 28 28);
}

.dark .marky-btn-danger {
  color: rgb(248 113 113);
  background: rgb(69 10 10 / 0.35);
  border-color: rgb(127 29 29 / 0.5);
}

.dark .marky-btn-danger:hover {
  background: rgb(127 29 29 / 0.45);
  color: rgb(252 165 165);
}

.marky-save-indicator {
  will-change: transform;
}

.marky-save-indicator.is-saving {
  transform: scaleX(1);
  transition-duration: 0.15s;
}

.marky-save-indicator.is-saved {
  transform: scaleX(1);
  opacity: 0.6;
  transition-duration: 0.4s;
}

.marky-main-split {
  display: grid;
  grid-template-columns: minmax(10rem, 1fr) 10px minmax(10rem, 1fr);
  grid-template-rows: minmax(0, 1fr);
  overflow: hidden;
}

.marky-main-split.is-resizing,
body.marky-split-active {
  cursor: col-resize;
  user-select: none;
}

body.marky-split-active .marky-editor {
  pointer-events: none;
}

.marky-main-split.is-resizing .marky-pane,
.marky-main-split.is-resizing .marky-split-handle {
  transition: none;
}

.marky-split-handle {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  touch-action: none;
  cursor: col-resize;
  background: rgb(226 232 240);
  transition: background-color 0.2s ease;
}

.marky-split-handle::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -6px;
  right: -6px;
}

.dark .marky-split-handle {
  background: rgb(30 41 59);
}

.marky-split-handle::before {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 3px;
  height: 2.5rem;
  border-radius: 999px;
  background: rgb(148 163 184);
  opacity: 0.55;
  transition: opacity 0.2s ease, background-color 0.2s ease, height 0.2s ease, width 0.2s ease;
}

.marky-split-handle:hover::before,
.marky-split-handle:focus-visible::before,
.marky-main-split.is-resizing .marky-split-handle::before {
  opacity: 1;
  background: rgb(139 92 246);
}

.marky-split-handle:hover,
.marky-split-handle:focus-visible {
  background: rgb(221 214 254);
}

.dark .marky-split-handle:hover,
.dark .marky-split-handle:focus-visible {
  background: rgb(46 16 101 / 0.45);
}

.marky-split-handle:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px rgb(139 92 246);
}

.marky-pane {
  min-height: 0;
  min-width: 0;
  background: rgb(255 255 255);
  transition: background-color 0.3s ease;
}

.dark .marky-pane {
  background: rgb(15 23 42);
}

.marky-pane-editor {
  background: rgb(248 250 252);
}

.dark .marky-pane-editor {
  background: rgb(2 6 23);
}

.marky-editor-wrap {
  background: inherit;
}

.marky-editor {
  display: block;
  padding: 1.25rem 1.5rem;
  border: none;
  caret-color: rgb(124 58 237);
}

.dark .marky-editor {
  caret-color: rgb(167 139 250);
}

.marky-editor::selection {
  background: rgb(221 214 254);
}

.dark .marky-editor::selection {
  background: rgb(76 29 149 / 0.45);
}

.marky-preview-scroll {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: rgb(203 213 225) transparent;
}

.dark .marky-preview-scroll {
  scrollbar-color: rgb(51 65 85) transparent;
}

.marky-preview-scroll::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.marky-preview-scroll::-webkit-scrollbar-thumb {
  background: rgb(203 213 225);
  border-radius: 999px;
}

.dark .marky-preview-scroll::-webkit-scrollbar-thumb {
  background: rgb(51 65 85);
}

.marky-preview:empty::before {
  content: "Your rendered Markdown will appear here.";
  color: rgb(148 163 184);
  font-style: italic;
  font-size: 0.9375rem;
}

.marky-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
}

.marky-preview table {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.marky-preview :not(pre) > code {
  font-size: 0.875em;
}

.marky-code-block {
  margin: 1.25rem 0;
  border-radius: 0.625rem;
  overflow: hidden;
  border: 1px solid rgb(226 232 240);
  background: rgb(248 250 252);
}

.dark .marky-code-block {
  border-color: rgb(30 41 59);
  background: rgb(15 23 42);
}

.marky-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  border-bottom: 1px solid rgb(226 232 240);
  background: rgb(241 245 249);
}

.dark .marky-code-header {
  border-bottom-color: rgb(30 41 59);
  background: rgb(2 6 23);
}

.marky-code-lang {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: rgb(100 116 139);
}

.dark .marky-code-lang {
  color: rgb(148 163 184);
}

.marky-code-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem 0.625rem;
  border-radius: 0.375rem;
  border: 1px solid rgb(226 232 240);
  background: rgb(255 255 255);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  color: rgb(71 85 105);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.marky-code-copy:hover {
  background: rgb(241 245 249);
  color: rgb(15 23 42);
}

.marky-code-copy.is-copied {
  border-color: rgb(167 243 208);
  background: rgb(236 253 245);
  color: rgb(5 150 105);
}

.dark .marky-code-copy {
  border-color: rgb(51 65 85);
  background: rgb(30 41 59);
  color: rgb(203 213 225);
}

.dark .marky-code-copy:hover {
  background: rgb(51 65 85);
  color: rgb(248 250 252);
}

.dark .marky-code-copy.is-copied {
  border-color: rgb(6 78 59);
  background: rgb(6 78 59 / 0.35);
  color: rgb(110 231 183);
}

.marky-code-copy:focus-visible {
  outline: 2px solid rgb(139 92 246);
  outline-offset: 2px;
}

.marky-preview pre.marky-pre {
  margin: 0;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  background: transparent;
  border-radius: 0;
}

.marky-preview pre.marky-pre code.hljs {
  display: block;
  padding: 0;
  background: transparent;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8125rem;
  line-height: 1.65;
  tab-size: 2;
}

.marky-preview .hljs {
  background: transparent;
}

@media (max-width: 1023px) {
  .marky-main-split {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(8rem, 1fr) 10px minmax(8rem, 1fr);
    overflow: hidden;
  }

  .marky-split-handle {
    cursor: row-resize;
  }

  .marky-split-handle::after {
    top: -6px;
    bottom: -6px;
    left: 0;
    right: 0;
  }

  .marky-main-split.is-resizing,
  body.marky-split-active {
    cursor: row-resize;
  }

  .marky-split-handle::before {
    width: 2.5rem;
    height: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .marky-body,
  .marky-header,
  .marky-footer,
  .marky-pane,
  .marky-btn,
  .marky-save-indicator {
    transition-duration: 0.01ms !important;
  }

  .marky-preview-scroll {
    scroll-behavior: auto;
  }
}
