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

.mstoc-placeholder {
    min-height: 1px;
}

.mstoc {
    position: relative;
    z-index: 5;
    width: 100%;
    max-width: var(--mstoc-max-width, 420px);
    margin: 0;
    padding: var(--mstoc-padding, 22px);
    overflow: hidden;
    direction: var(--mstoc-direction, rtl);
    color: var(--mstoc-text, #c5ced7);
    font-family: var(--mstoc-font-family, inherit);
    text-align: start;
    border: 1px solid var(--mstoc-border, #2f5669);
    border-radius: var(--mstoc-radius, 18px);
    background: var(--mstoc-bg-alpha, var(--mstoc-bg, #102635));
    isolation: isolate;
}

.mstoc::before {
    position: absolute;
    inset-block-start: 0;
    inset-inline-start: var(--mstoc-padding, 22px);
    width: 58px;
    height: 2px;
    content: "";
    border-radius: 0 0 10px 10px;
    background: var(--mstoc-accent, #35d6bd);
    box-shadow: 0 0 14px rgba(53, 214, 189, .55);
}

.mstoc--glass.mstoc-glass-enabled {
    background:
        linear-gradient(145deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .03) 48%, rgba(255, 255, 255, .01)),
        var(--mstoc-bg-alpha, rgba(16, 38, 53, .82));
    -webkit-backdrop-filter: blur(var(--mstoc-glass-blur, 16px)) saturate(150%);
    backdrop-filter: blur(var(--mstoc-glass-blur, 16px)) saturate(150%);
}

.mstoc--glass:not(.mstoc-glass-enabled),
.mstoc--boxed {
    background: var(--mstoc-bg-alpha, var(--mstoc-bg, #102635));
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}

.mstoc--minimal {
    max-width: none;
    padding-inline: 0;
    border-inline: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.mstoc--minimal::before {
    inset-inline-start: 0;
}

.mstoc__heading,
.mstoc__toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-height: 34px;
    margin: 0;
    padding: 0;
    color: var(--mstoc-title, #f7f9fc);
    font: inherit;
    text-align: start;
    border: 0;
    background: transparent;
}

button.mstoc__toggle {
    cursor: pointer;
}

.mstoc__title {
    display: block;
    color: var(--mstoc-title, #f7f9fc);
    font-size: var(--mstoc-title-size, 21px);
    font-weight: var(--mstoc-title-weight, 900);
    line-height: 1.55;
}

.mstoc__chevron {
    position: relative;
    width: 29px;
    height: 29px;
    flex: 0 0 29px;
    margin-inline-start: 12px;
    border: 1px solid var(--mstoc-border, #2f5669);
    border-radius: 9px;
    background: rgba(53, 214, 189, .08);
}

.mstoc__chevron::before,
.mstoc__chevron::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 2px;
    content: "";
    border-radius: 2px;
    background: var(--mstoc-accent, #35d6bd);
    transition: transform 180ms ease;
}

.mstoc__chevron::before {
    transform: translate(-78%, -50%) rotate(45deg);
}

.mstoc__chevron::after {
    transform: translate(-22%, -50%) rotate(-45deg);
}

.mstoc[data-collapsed="true"] .mstoc__chevron::before {
    transform: translate(-78%, -50%) rotate(-45deg);
}

.mstoc[data-collapsed="true"] .mstoc__chevron::after {
    transform: translate(-22%, -50%) rotate(45deg);
}

.mstoc__body {
    display: grid;
    grid-template-rows: 1fr;
    opacity: 1;
    transition: grid-template-rows 220ms ease, opacity 180ms ease, margin 220ms ease;
}

.mstoc__body > * {
    min-height: 0;
}

.mstoc[data-collapsed="true"] .mstoc__body {
    grid-template-rows: 0fr;
    margin-top: 0;
    opacity: 0;
    pointer-events: none;
}

.mstoc__list {
    display: grid;
    gap: var(--mstoc-item-gap, 6px);
    margin: 18px 0 0;
    padding: 0;
    overflow: hidden;
    list-style: none;
}

.mstoc__item {
    min-width: 0;
    margin: 0;
    padding: 0;
}

.mstoc__link {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-height: 42px;
    padding: 9px 10px;
    padding-inline-start: calc(10px + (var(--mstoc-depth, 0) * 15px));
    color: var(--mstoc-text, #c5ced7);
    font-size: var(--mstoc-item-size, 14px);
    font-weight: var(--mstoc-item-weight, 700);
    line-height: var(--mstoc-line-height, 1.8);
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.mstoc__link:hover,
.mstoc__link:focus-visible {
    color: var(--mstoc-hover, #fff);
    border-color: rgba(53, 214, 189, .35);
    background: rgba(53, 214, 189, .08);
    outline: none;
    transform: translateY(-1px);
}

.mstoc__link.is-active,
.mstoc__link[aria-current="location"] {
    color: var(--mstoc-active, #f4b400);
    border-color: rgba(244, 180, 0, .38);
    background: rgba(244, 180, 0, .08);
}

.mstoc__marker {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    width: auto;
    min-width: 19px;
    height: auto;
    flex: 0 0 auto;
    margin-top: .12em;
    padding: 0;
    color: var(--mstoc-accent, #35d6bd);
    font-size: .94em;
    font-weight: 900;
    line-height: inherit;
    direction: rtl;
    border: 0;
    border-radius: 0;
    background: transparent;
    text-shadow: 0 0 12px color-mix(in srgb, var(--mstoc-accent, #35d6bd) 55%, transparent);
}

.mstoc-show-numbers .mstoc__marker::after {
    width: 4px;
    height: 4px;
    margin-inline-start: 7px;
    content: "";
    border-radius: 50%;
    background: currentColor;
    opacity: .58;
}

.mstoc__link.is-active .mstoc__marker,
.mstoc__link[aria-current="location"] .mstoc__marker {
    color: var(--mstoc-active, #f4b400);
}

.mstoc-hide-numbers .mstoc__marker {
    width: 6px;
    min-width: 6px;
    height: 6px;
    flex-basis: 6px;
    margin-top: .8em;
    overflow: hidden;
    color: transparent;
    border: 0;
    border-radius: 50%;
    background: var(--mstoc-accent, #35d6bd);
    box-shadow: 0 0 8px rgba(53, 214, 189, .55);
    text-shadow: none;
}

.mstoc-hide-numbers .mstoc__marker::after {
    display: none;
}

.mstoc__link-text {
    min-width: 0;
}

.mstoc[class*="mstoc-fixed-"] {
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.mstoc-target-flash {
    animation: mstoc-target-flash 1.1s ease;
}

@keyframes mstoc-target-flash {
    0% { outline: 0 solid rgba(53, 214, 189, 0); }
    35% { outline: 4px solid rgba(53, 214, 189, .2); outline-offset: 6px; }
    100% { outline: 0 solid rgba(53, 214, 189, 0); outline-offset: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .mstoc *,
    .mstoc *::before,
    .mstoc *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}

.mstoc-sticky-anchor {
    display: block;
    width: 100%;
    height: 0;
    margin: 0;
    padding: 0;
    pointer-events: none;
}

.mstoc.mstoc-is-bounded-sticky {
    margin: 0;
    will-change: top;
}
