:root {
    --gsh2toc-top: 90px;
    --gsh2toc-bg: #111827;
    --gsh2toc-border: #263248;
    --gsh2toc-text: #ffffff;
    --gsh2toc-muted: #cbd5e1;
    --gsh2toc-accent: #ff315f;
    --gsh2toc-active-bg: rgba(255, 49, 95, .14);
}

.gsh2toc {
    width: 100%;
    max-width: 100%;
    margin: 0;
    font-family: inherit;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .22s ease, transform .22s ease, visibility .22s ease;
}

.gsh2toc.is-ready {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.gsh2toc.gsh2toc--sidebar {
    position: sticky;
    top: var(--gsh2toc-top);
    z-index: 10;
    align-self: start;
    margin-top: 14px;
}

.gsh2toc__inner {
    overflow: hidden;
    background: var(--gsh2toc-bg);
    border: 1px solid var(--gsh2toc-border);
    border-radius: 14px;
    box-shadow: none;
}

.gsh2toc__header {
    width: 100%;
    min-height: 58px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 15px 18px;
    border: 0;
    border-bottom: 1px solid var(--gsh2toc-border);
    background: transparent;
    color: var(--gsh2toc-text);
    cursor: pointer;
    text-align: left;
}

.gsh2toc__title {
    font-size: 18px;
    line-height: 1.2;
    font-weight: 700;
    color: #39e063;
}

.gsh2toc__chevron {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-2px);
    transition: transform .2s ease;
}

.gsh2toc.is-collapsed .gsh2toc__chevron {
    transform: rotate(-135deg) translate(-2px, -2px);
}

.gsh2toc__body {
    max-height: min(62vh, 520px);
    overflow: hidden;
    transition: max-height .25s ease;
}

.gsh2toc.is-collapsed .gsh2toc__body {
    max-height: 0;
}

.gsh2toc__nav {
    max-height: min(62vh, 520px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #64748b transparent;
}

.gsh2toc__nav::-webkit-scrollbar { width: 7px; }
.gsh2toc__nav::-webkit-scrollbar-thumb { background: #64748b; border-radius: 999px; }
.gsh2toc__nav::-webkit-scrollbar-track { background: transparent; }

.gsh2toc__list {
    list-style: none;
    margin: 0;
    padding: 8px 10px 12px;
}

.gsh2toc__item {
    margin: 0;
    padding: 0;
}

.gsh2toc__link {
    position: relative;
    display: block;
    margin: 3px 0;
    padding: 12px 14px 12px 28px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--gsh2toc-text);
    text-decoration: none;
    font-size: 16px;
    line-height: 1.25;
    font-weight: 600;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.gsh2toc__link::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 7px solid currentColor;
    transform: translateY(-50%);
    opacity: .9;
}

.gsh2toc__link:hover {
    background: rgba(255,255,255,.055);
    border-color: var(--gsh2toc-border);
    color: var(--gsh2toc-accent);
}

.gsh2toc__link.is-active {
    background: var(--gsh2toc-active-bg);
    border-color: rgba(255, 49, 95, .45);
    color: var(--gsh2toc-accent);
}

.gsh2toc-shortcode { display: none; }
html { scroll-behavior: smooth; }

@media (max-width: 980px) {
    .gsh2toc,
    .gsh2toc.gsh2toc--mobile,
    .gsh2toc.gsh2toc--shortcode {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        max-width: none;
        margin: 0 0 26px;
    }

    .gsh2toc__body,
    .gsh2toc__nav {
        max-height: 380px;
    }
}

@media (max-width: 600px) {
    .gsh2toc__title { font-size: 18px; }
    .gsh2toc__link { font-size: 15px; padding: 12px 14px 12px 27px; }
    .gsh2toc__inner { border-radius: 12px; }
}

/* Гарантовано приховує старі кнопки H2/H3/H4 усередині статті. */
.grtoc,
#gsh2toc-inline,
.gsh2toc-inline,
.gsh2toc-inline-sentinel {
    display: none !important;
}

.gsh2toc-align-spacer { display:block; width:100%; height:0; flex:0 0 auto; }
@media (max-width:980px){ .gsh2toc-align-spacer{display:none!important;height:0!important;} }

/* v2.0: без position:fixed, щоб блок не стрибав праворуч */
.gsh2toc.gsh2toc--sidebar.is-fixed { position: sticky !important; left: auto !important; width: 100% !important; top: var(--gsh2toc-top) !important; margin-top: 14px !important; }
.gsh2toc-placeholder { display:none !important; height:0 !important; }


/* v2.1: крапки замість стрілок та салатовий hover */
.gsh2toc__link {
    background: var(--gsh2toc-bg) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

.gsh2toc__link::before {
    content: '' !important;
    position: absolute;
    left: 13px;
    top: 50%;
    width: 6px;
    height: 6px;
    border: 0 !important;
    border-radius: 50%;
    background: #ffffff;
    transform: translateY(-50%);
    opacity: .95;
}

.gsh2toc__link:hover {
    background: #9cff00 !important;
    color: #111827 !important;
    border-color: #9cff00 !important;
}

.gsh2toc__link:hover::before {
    background: #111827;
}

.gsh2toc__link.is-active {
    background: var(--gsh2toc-bg) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

.gsh2toc__link.is-active::before {
    background: #9cff00;
}

.gsh2toc__link.is-active:hover {
    background: #9cff00 !important;
    color: #111827 !important;
    border-color: #9cff00 !important;
}

.gsh2toc__link.is-active:hover::before {
    background: #111827;
}
