.markdown-body {
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.8;
  font-size: 16px;
  color: #111;
}

.markdown-body > *:first-child {
  margin-top: 0;
}

.markdown-body > *:last-child {
  margin-bottom: 0;
}

.markdown-body h1 {
  font-size: 1.9rem;
  margin: 24px 0 12px;
}

.markdown-body h2 {
  font-size: 1.5rem;
  margin: 22px 0 10px;
  scroll-margin-top: 1.25em;
}

.markdown-body h3 {
  font-size: 1.25rem;
  margin: 18px 0 8px;
  scroll-margin-top: 1.15em;
}

.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-size: 1.05rem;
  margin: 16px 0 8px;
  scroll-margin-top: 1.05em;
}

.markdown-body p {
  margin: 0 0 12px;
}

.markdown-body ul,
.markdown-body ol {
  margin: 0 0 12px;
  padding-left: 1.6em;
}

.markdown-body li {
  margin: 0 0 4px;
}

.markdown-body li > p {
  margin: 0 0 6px;
}

.markdown-body blockquote {
  border-left: 4px solid #d0d0d0;
  margin: 0 0 16px;
  padding: 2px 0 2px 16px;
  color: #444;
}

.markdown-body blockquote > :last-child {
  margin-bottom: 0;
}

.markdown-body pre {
  padding: 0;
  margin: 0 0 16px;
  border-radius: 0;
  overflow-x: auto;
  background: #fafafa;
  border: 1px solid #e6e6e6;
}

.markdown-body pre code.hljs {
  display: block;
  padding: 12px 14px;
  overflow-x: auto;
  background: transparent;
}

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.markdown-body :not(pre) > code {
  background: #f0f0f0;
  padding: 2px 6px;
  border-radius: 4px;
}

.markdown-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 0 0 16px;
  font-size: 0.95em;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid #d4d4d4;
  padding: 8px 10px;
  vertical-align: top;
}

.markdown-body th {
  background: #f6f6f6;
  font-weight: 600;
}

.markdown-body hr {
  margin: 20px 0;
  border: 0;
  border-top: 1px solid #ddd;
}

.markdown-body a {
  text-decoration: underline;
}

.markdown-body li:has(> input[type="checkbox"]) {
  list-style: none;
  margin-left: -1.5em;
  padding-left: 0;
}

.markdown-body input[type="checkbox"] {
  margin-right: 6px;
  vertical-align: middle;
}

.markdown-body img {
  max-width: 100%;
  height: auto;
}

.markdown-body .katex-display {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding: 8px 0;
}

.markdown-body .katex {
  max-width: 100%;
}

.markdown-body .mermaid {
  margin: 16px 0;
  overflow-x: auto;
  text-align: center;
}

.markdown-pending .markdown-loading {
  color: #666;
  margin: 0;
}

@media (max-width: 1024px) {
  .markdown-body {
    font-size: 15.5px;
  }

  .markdown-body h1 {
    font-size: 1.75rem;
  }

  .markdown-body h2 {
    font-size: 1.4rem;
  }
}

@media (max-width: 768px) {
  .markdown-body {
    font-size: 15px;
    line-height: 1.75;
  }

  .markdown-body h1 {
    font-size: 1.55rem;
  }

  .markdown-body h2 {
    font-size: 1.28rem;
  }

  .markdown-body h3 {
    font-size: 1.1rem;
  }

  .markdown-body table {
    display: block;
    overflow-x: auto;
    font-size: 0.92em;
  }

  .markdown-body blockquote {
    padding-left: 14px;
  }
}

@media (max-width: 480px) {
  .markdown-body {
    font-size: 14.5px;
    line-height: 1.72;
  }

  .markdown-body h1 {
    font-size: 1.35rem;
  }

  .markdown-body h2 {
    font-size: 1.18rem;
  }

  .markdown-body h3 {
    font-size: 1.02rem;
  }

  .markdown-body ul,
  .markdown-body ol {
    padding-left: 1.35em;
  }

  .markdown-body pre code.hljs {
    padding: 10px 12px;
  }

  .markdown-body th,
  .markdown-body td {
    padding: 7px 8px;
  }
}
