.m-render {

  pre, code {
    direction: ltr;
    text-align: left;
    white-space: pre;
    word-spacing: normal;
    word-break: normal;
    word-wrap: normal;
    tab-size: 4;
    hyphens: none;
  }

  pre {
    position: relative;
    margin: 0;
    max-height: 600px;

    code {
      display: block;
      padding:
        var(--code-view-padding-top)
        var(--code-view-padding-right)
        var(--code-view-padding-bottom)
        var(--code-view-padding-left);
      width: fit-content;
      min-width: 100%;
      line-height: var(--code-view-line-height);
      font-size: var(--code-view-font-size);
      font-weight: 400;
      color: var(--code-view-text-color);
    }
  }

  .f-code-view, .f-example-view {
    position: relative;
    background-color: var(--code-view-background);
    border: 1px solid var(--code-view-border-color);
    border-radius: var(--code-view-border-radius);
    overflow: hidden;
    width: 100%;

    .f-code-controls {
      position: absolute;
      top: 0;
      right: 0;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 4px;
      z-index: 3;
      padding: 10px 10px 0 0;
      border-radius: inherit;
      pointer-events: none;
      background-color: transparent;
      transition: background-color 0.2s ease;
    }

    .f-copy-button {
      border: none;
      border-radius: 8px;
      position: relative;
      min-width: 32px;
      height: 32px;
      width: 32px;
      padding: 0;
      background-color: transparent;
      opacity: 1;
      cursor: pointer;
      color: var(--secondary-text);
      line-height: 0;
      pointer-events: auto;
      transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;

      &:hover {
        background-color: var(--code-view-copy-button-hover-background);
        color: var(--primary-text);
      }
    }

    .f-copy-icon,
    .f-copy-success-icon {
      position: absolute;
      inset: 0;
      margin: auto;
      width: 16px;
      height: 16px;
      background-color: currentColor;
      mask-position: center;
      mask-repeat: no-repeat;
      mask-size: 16px 16px;
      transition: transform 0.22s ease, opacity 0.18s ease;
      transform: scale(1);
      opacity: 1;
    }

    .f-copy-icon {
      mask-image: var(--copy-icon);

      &.hidden {
        transform: scale(0.6);
        opacity: 0;
      }
    }

    .f-copy-success-icon {
      mask-image: var(--check-icon);
      transform: scale(0.6);
      opacity: 0;

      &.visible {
        transform: scale(1);
        opacity: 1;
      }
    }

    .f-fullscreen-button {
      position: absolute;
      top: 12px;
      right: 14px;
      border: 1px solid var(--code-view-copy-button-border-color);
      border-radius: 999px;
      width: 34px;
      height: 34px;
      z-index: 3;
      background-color: var(--code-view-copy-button-background);
      opacity: 0;
      cursor: pointer;
      transition: background-color 0.25s, opacity 0.25s;

      &::before {
        content: "";
        position: absolute;
        inset: 0;
        margin: auto;
        width: 14px;
        height: 14px;
        background-color: var(--secondary-text);
        mask-image: var(--fullscreen-icon);
        mask-position: center;
        mask-repeat: no-repeat;
        mask-size: 14px 14px;
      }

      &.exit {
        &::before {
          mask-image: var(--fullscreen-exit-icon);
        }
      }

      &:hover {
        background-color: var(--code-view-copy-button-hover-background);

        &::before {
          background-color: var(--primary-text);
        }
      }
    }

    .f-code-language {
      pointer-events: none;
      position: absolute;
      top: 18px;
      right: 12px;
      z-index: 2;
      display: block;
      max-width: calc(100% - 24px);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      text-align: right;
      font-size: 10px;
      line-height: 1;
      font-weight: 400;
      color: var(--code-view-lang-color);
      transition: opacity 0.4s;
      letter-spacing: 0.02em;
      opacity: 0.72;
    }

    @media (hover: hover) and (pointer: fine) {
      .f-copy-button {
        opacity: 0;
        pointer-events: none;
        transform: scale(0.92);
      }

      &:hover,
      &:focus-within {
        .f-code-controls {
          background-color: var(--code-view-background);
        }

        .f-copy-button {
          opacity: 1;
          pointer-events: auto;
          transform: scale(1);

          &:active {
            opacity: 0.7;
          }
        }

        .f-code-language {
          opacity: 0;
        }
      }
    }

    &:hover,
    &:focus-within {
      .f-fullscreen-button {
        opacity: 1;

        &:active {
          opacity: 0.1;
        }
      }
    }
  }

  .f-code-view {
    .f-code-scroll {
      width: 100%;
      height: 100%;
      overflow: auto;
      border-radius: inherit;
    }
  }

  .f-example-view {
    width: 100%;
    height: 300px;
    overflow: hidden;
    box-shadow: var(--shadow-1);

    &.f-example-view-fullscreen {
      background-color: var(--background-color);
      border-radius: 0;
      border-color: transparent;
      box-shadow: none;
    }

    &:fullscreen {
      background-color: var(--background-color);
      border-radius: 0;
      border-color: transparent;
      box-shadow: none;
    }

    &::backdrop {
      background-color: var(--background-color);
    }

    .f-example-iframe {
      width: 100%;
      height: 100%;
      border: none;
    }

    .f-example-loading-overlay {
      position: absolute;
      inset: 0;
      z-index: 2;
      display: flex;
      align-items: center;
      justify-content: center;
      background-color: color-mix(in srgb, var(--code-view-background) 84%, transparent);
      backdrop-filter: blur(6px);
    }

    .f-loading-dots {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      min-height: 24px;
      color: var(--secondary-text);
    }

    .f-loading-dot {
      width: 8px;
      height: 8px;
      border-radius: 999px;
      background-color: currentColor;
      animation: f-loading-dot-pulse 1s infinite both;

      &:nth-child(2) {
        animation-delay: 0.2s;
      }

      &:nth-child(3) {
        animation-delay: 0.4s;
      }
    }

    &.f-example-view-fullscreen .f-fullscreen-button {
      opacity: 1;
    }
  }

  @media (hover: none) {
    .f-example-view .f-fullscreen-button {
      opacity: 1;
    }
  }
}

@keyframes f-loading-dot-pulse {
  0% {
    opacity: 0.15;
  }

  20% {
    opacity: 0.4;
  }

  100% {
    opacity: 0.15;
  }
}
