:root {
  --md-text-font: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
}

.md-typeset {
  font-size: 0.78rem;
  line-height: 1.75;
}

.md-typeset h1,
.md-typeset h2,
.md-typeset h3 {
  letter-spacing: 0;
}

.md-typeset h1 {
  font-weight: 700;
}

.md-typeset code {
  font-size: 0.85em;
}

.md-content__inner {
  --aibook-line-gutter: 2.25rem;
  --aibook-line-width: 1.55rem;
  --aibook-line-gap: 0.55rem;
  --aibook-list-line-gap: 1.95rem;
  counter-reset: aibook-line;
  padding-left: var(--aibook-line-gutter);
}

.md-content__inner > :is(
  h1,
  h2,
  h3,
  h4,
  p,
  table,
  blockquote,
  details,
  .arithmatex,
  .highlight,
  .mermaid
),
.md-content__inner > :is(ul, ol) > li {
  --aibook-line-top: 0.18rem;
  counter-increment: aibook-line;
  position: relative;
}

.md-content__inner > :is(
  h1,
  h2,
  h3,
  h4,
  p,
  table,
  blockquote,
  details,
  .arithmatex,
  .highlight,
  .mermaid
 )::before,
.md-content__inner > :is(ul, ol) > li::before {
  content: counter(aibook-line);
  position: absolute;
  right: calc(100% + var(--aibook-line-gap));
  top: var(--aibook-line-top);
  width: var(--aibook-line-width);
  color: var(--md-default-fg-color--lighter);
  font-family: var(--md-code-font-family);
  font-size: 0.58rem;
  line-height: 1;
  text-align: right;
  user-select: none;
}

.md-content__inner > :is(ul, ol) > li::before {
  --aibook-line-top: 0.32rem;
  right: calc(100% + var(--aibook-list-line-gap));
}

.md-content__inner > h1::before {
  --aibook-line-top: 0.48rem;
}

.md-content__inner > h2::before,
.md-content__inner > h3::before,
.md-content__inner > h4::before {
  --aibook-line-top: 0.32rem;
}

.md-content__inner > .highlight::before,
.md-content__inner > .md-typeset__scrollwrap::before {
  content: none;
}

.md-content__inner > .md-source-file::before,
.md-content__inner > .md-content__button::before {
  content: none;
}

.md-typeset .arithmatex {
  overflow-x: auto;
}

.md-typeset .aibook-csv-preview__toggle {
  background: var(--md-default-bg-color);
  border: 1px solid var(--md-primary-fg-color);
  border-radius: 0.25rem;
  color: var(--md-primary-fg-color);
  cursor: pointer;
  display: inline-flex;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.35;
  margin-left: 0.35rem;
  min-height: 1.35rem;
  padding: 0.08rem 0.42rem;
  user-select: none;
  vertical-align: 0.06rem;
}

.md-typeset .aibook-csv-preview__toggle:hover,
.md-typeset .aibook-csv-preview__toggle:focus {
  background: var(--md-accent-fg-color--transparent);
}

.md-typeset .aibook-csv-preview__panel {
  display: block;
  margin: 0.6rem 0 0;
}

.md-typeset .aibook-csv-preview__panel[hidden] {
  display: none;
}

.md-typeset .aibook-csv-preview__status,
.md-typeset .aibook-csv-preview__body {
  margin-top: 0.55rem;
}

.md-typeset .aibook-csv-preview__meta,
.md-typeset .aibook-csv-preview__source {
  color: var(--md-default-fg-color--light);
  font-size: 0.68rem;
  margin: 0.25rem 0;
}

.md-typeset .aibook-csv-preview__table-wrap {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.25rem;
  max-width: 100%;
  overflow-x: auto;
}

.md-typeset .aibook-csv-preview__table {
  display: table;
  font-size: 0.68rem;
  margin: 0;
  min-width: max-content;
  width: 100%;
}

.md-typeset .aibook-csv-preview__table th,
.md-typeset .aibook-csv-preview__table td {
  padding: 0.35rem 0.55rem;
  white-space: nowrap;
}

.md-main,
.md-main__inner,
.md-content,
.md-content__inner {
  max-width: 100%;
}

@media screen and (max-width: 76.1875em) {
  .md-content__inner {
    --aibook-line-gutter: 1.75rem;
    --aibook-line-width: 1.05rem;
    --aibook-line-gap: 0.42rem;
    --aibook-list-line-gap: 1.7rem;
  }
}

@media screen and (max-width: 44.9375em) {
  html,
  body,
  .md-container,
  .md-main,
  .md-main__inner,
  .md-content {
    overflow-x: clip;
  }

  .md-content__inner {
    padding-left: 0;
  }

  .md-content__inner > :is(
    h1,
    h2,
    h3,
    h4,
    p,
    table,
    blockquote,
    details,
    .arithmatex,
    .highlight,
    .mermaid
  )::before,
  .md-content__inner > :is(ul, ol) > li::before {
    content: none;
  }

  .md-footer__link {
    align-items: center;
    gap: 0.5rem;
    min-height: 4.6rem;
    padding-bottom: 0.75rem;
    padding-top: 0.75rem;
  }

  .md-footer__button {
    flex: 0 0 auto;
  }

  .md-footer__title {
    flex: 1 1 auto;
    min-width: 0;
  }

  .md-footer__direction {
    font-size: 0.58rem;
    margin-bottom: 0.2rem;
    opacity: 0.8;
  }

  .md-footer__title .md-ellipsis {
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    font-size: 0.78rem;
    line-height: 1.35;
    overflow: hidden;
    white-space: normal;
  }

  .md-footer__link--prev .md-footer__title {
    text-align: left;
  }

  .md-footer__link--next .md-footer__title {
    text-align: right;
  }
}
