html,
body {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    Helvetica Neue,
    PingFang SC,
    Microsoft YaHei,
    Source Han Sans SC,
    Noto Sans CJK SC,
    WenQuanYi Micro Hei,
    sans-serif;
  font-size: 16px;
  width: 100%;
  height: 100%;
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: #e7fbe9;
  background: linear-gradient(90deg, rgba(231, 251, 233, 1) 0%, rgba(224, 238, 255, 1) 100%);
  background-size: cover;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: bold;
  margin-bottom: 0.5em;
}

h1 {
  font-size: 2em;
}
h2 {
  font-size: 1.5em;
}
h3 {
  font-size: 1.2em;
}
h4 {
  font-size: 1em;
}
h5 {
  font-size: 0.8em;
}
h6 {
  font-size: 0.6em;
}

.markdown-content {
  width: 100%;
}

ol,
ul,
li,
.markdown-content p,
.markdown-content code,
.markdown-content pre {
  font-size: 1em;
}

div object {
  display: none;
}

.markdown-content canvas {
  width: 100%;
  box-sizing: border-box;
}

.markdown-content.viewer {
  padding: 1em;
}

.entry li ul,
.entry li ol,
.viewer li ul,
.viewer li ol {
  margin-left: -1.5em;
}

.viewer li {
  line-height: 1.8;
}

.viewer blockquote li {
  margin-left: -1.5em;
}

details {
  margin: 1em 0;
}

details summary {
  font-size: 18px;
  font-weight: 500;
}

.markdown-content img {
  max-width: 100%;
}

pre {
  height: fit-content;
  max-height: 300px;
  border-radius: 6px;
  margin-top: 0.5em;
  margin-bottom: 0.5em;
}

code {
  background-color: #f8f8f9;
  padding: 2px 6px;
  border-radius: 6px;
}

blockquote {
  height: fit-content;
  max-height: 500px;
  background: #f8f8f9;
  border-left: 6px solid #e83e8c;
  border-radius: 6px;
  padding: 0.5em 0.8em;
  overflow: auto;
}

ul li p,
ol li p {
  margin-bottom: 0;
}

blockquote p {
  margin: 0;
  line-height: 1.6;
}

.header {
  width: 100%;
  height: 40px;
  box-sizing: border-box;
  background: #f8f8f9;
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 9;
}

.header .title {
  font-size: 1.5em;
  font-weight: 600;
  margin-left: 0.6em;
}

li.fold-panel > ul,
li.fold-panel > ol {
  display: none;
}

li.fold-panel:hover > ul,
li.fold-panel:hover > ol {
  display: block;
}

a:link {
  text-decoration: none;
  border-radius: 3px;
}

a:hover {
  background-color: #f8f8f9;
  color: #bd4147;
}

.opacity {
  opacity: 0;
}

.arrow-icon {
  background-image: url(../../images/top.png);
  width: 30px;
  height: 30px;
  display: block;
  background-size: contain;
}

.scroll-top {
  cursor: pointer;
  position: sticky;
  float: right;
  margin-right: 20px;
  bottom: 60px;
  width: 40px;
  height: 40px;
  padding: 5px;
  background-color: #007bff;
  border-radius: 50%;
  transition: all 0.3s ease;
  box-shadow:
    0 0 3px 0 rgba(0, 0, 0, 0.12),
    0 3px 3px 0 rgba(0, 0, 0, 0.24);
  z-index: 10;
}

.scroll-top:hover {
  background-color: #0569d3;
}

.markdown-content table {
  width: 100%;
  overflow: auto;
  border-spacing: 0;
  border-collapse: collapse;
  margin: 1em 0;
}

.markdown-content table th {
  font-weight: 600;
  background-color: #f6f8fa;
}

.markdown-content table th,
.markdown-content table td {
  padding: 4px 12px;
  border: 1px solid #d0d7de;
}

.markdown-content table tr {
  background-color: #ffffff;
  border-top: 1px solid #d0d7de;
}

.markdown-content table tr:nth-child(2n) {
  background-color: #f6f8fa;
}

.markdown-content table img {
  background-color: transparent;
}

.layout-container {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
}
.layout-container.home {
  height: calc(100% - 80px);
}

.content-area {
  height: 100%;
  flex: 1;
  box-sizing: border-box;
  overflow: auto;
  position: relative;
}

.content-area::-webkit-scrollbar,
.sidebar-area::-webkit-scrollbar {
  width: 0.5em;
}
.content-area::-webkit-scrollbar-thumb,
.sidebar-area::-webkit-scrollbar-thumb {
  background: #a09f9f;
  border-radius: 0.25em;
}
.content-area::-webkit-scrollbar-thumb:hover,
.sidebar-area::-webkit-scrollbar-thumb:hover {
  background: #808080;
}

.sidebar-area {
  width: fit-content;
  min-width: 180px;
  max-width: 15%;
  height: 100%;
  box-sizing: border-box;
  border-left: 2px solid #b1c8cd;
  overflow: auto;
}

.sidebar-area .sidebar-title {
  font-size: 1.2em;
  font-weight: bold;
  border-bottom: 2px solid #b1c8cd;
  padding-left: 0.5em;
  height: 50px;
  line-height: 50px;
}

.entry ~ .sidebar-area {
  height: 100%;
  max-height: 100%;
  box-sizing: border-box;
  overflow: auto;
}

.sidebar-area::-webkit-scrollbar {
  width: 0.5em;
}

.toc-nav {
  font-size: 1em;
}

.toc-nav p {
  color: #666;
  padding-left: 1em;
}

.toc-nav ul {
  list-style: none;
  padding: 0 0.8em;
}

.viewer blockquote dl,
.viewer blockquote ol,
.viewer blockquote ul {
  margin: 0;
}

.toc-nav li {
  margin: 0.5em 0;
  line-height: 1.5;
}

.toc-nav a {
  box-sizing: border-box;
  color: #333;
  text-decoration: none;
  transition: color 0.2s;
  word-break: break-word;
  white-space: pre-wrap;
}

.toc-nav a:hover {
  color: #007bff;
  background-color: transparent;
}
.load-fail {
  text-align: center;
  padding: 40px;
  color: red;
}

#view-container {
  width: 100%;
  box-sizing: border-box;
  overflow: auto;
  padding: 0;
  margin: 0;
}
#view-container canvas {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: block;
  margin: 0 auto 16px;
}
#view-container canvas:last-child {
  margin-bottom: 0;
}

@media screen and (max-width: 768px) {
  .header .title {
    margin-left: 0.3em;
  }

  .row .col-md-2,
  .row .col-md-3 {
    border-right: none;
  }

  .scroll-top {
    right: 20px;
    bottom: 60px;
    z-index: 9;
  }

  .sidebar-area {
    display: none;
  }
}

@media screen and (min-width: 768px) {
  .layout-container.home #markdown-content {
    height: 100%;
  }
}

@media print {
  html,
  body {
    overflow: visible;
    height: auto;
  }

  .content-area {
    overflow: visible;
    height: auto;
  }

  .header,
  .sidebar-area,
  .scroll-top,
  .nav-container {
    display: none;
  }

  .layout-container {
    height: auto;
    margin-top: 0;
    display: block;
  }

  .markdown-content.viewer {
    padding: 0;
    max-width: 100%;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6,
  pre,
  code,
  blockquote,
  table,
  tr,
  img {
    page-break-inside: avoid;
  }

  h1,
  h2,
  h3 {
    page-break-after: avoid;
  }

  pre,
  blockquote {
    max-height: none;
    overflow: visible;
  }

  #view-container {
    width: 100%;
    margin: 0;
    padding: 0;
  }
  #view-container canvas {
    margin: 0 auto;
    width: 100%;
    max-width: 100%;
    height: auto;
    page-break-inside: avoid;
    break-inside: avoid;
  }
  #view-container canvas:last-child {
    margin-bottom: 0;
  }
}
