
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--fx-bg);
}
::-webkit-scrollbar-thumb {
    background: var(--fx-border-strong);
    border-radius: 4px;
    border: 2px solid var(--fx-bg);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--fx-ac1);
}

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--fx-border-strong) var(--fx-bg);
}

html {
    scrollbar-color: transparent transparent;
}
html.fx-page-scrolling {
    scrollbar-color: color-mix(in srgb, var(--fx-text-main) 24%, transparent) transparent;
}
html::-webkit-scrollbar-track {
    background: transparent;
}
html::-webkit-scrollbar-thumb,
html::-webkit-scrollbar-thumb:hover {
    background: transparent;
    border-color: transparent;
    background-clip: padding-box;
}
html.fx-page-scrolling::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--fx-text-main) 24%, transparent);
    border-color: transparent;
    background-clip: padding-box;
}
html.fx-page-scrolling::-webkit-scrollbar-thumb:hover {
    background: var(--fx-ac1);
}

@media (forced-colors: active) {
    html,
    html.fx-page-scrolling { scrollbar-color: auto; }
}

/* === Selection === */
::selection {
    background: var(--fx-ac2);
    color: var(--fx-text-inverse);
}


/* ============================================================
   2. LOADING INDICATORS
   ============================================================ */
/* Older cached pages/scripts may still insert this node. Never block navigation. */
#fx-preloader { display: none !important; }

.fx-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(var(--fx-ac1-rgb), .3);
    border-top-color: var(--fx-ac2);
    border-radius: 50%;
    animation: fx-spin 0.8s linear infinite;
}
@keyframes fx-spin { to { transform: rotate(360deg); } }



.fx-sidebar {
    position: fixed;
    top: 12px; left: 12px; bottom: 12px;
    width: var(--fx-sidebar-w);
    background: color-mix(in srgb, var(--fx-bg) 50%, transparent);
    border-right: 0;
    border-radius: var(--fx-radius-lg);
    box-shadow: inset 0 1px color-mix(in srgb, var(--fx-text-main) 4%, transparent);
    -webkit-backdrop-filter: blur(24px) saturate(145%);
    backdrop-filter: blur(24px) saturate(145%);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    padding: 12px;
    box-sizing: border-box;
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.fx-sidebar-close { display: none; }


.fx-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
}

.fx-nav::-webkit-scrollbar { width: 4px; }
.fx-nav::-webkit-scrollbar-thumb { background: var(--fx-border-strong); border-radius: 4px; }

.fx-nav-section { margin-bottom: 16px; }

.fx-nav-section summary {
    list-style: none;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    color: var(--fx-text-muted);
    padding: 8px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.fx-nav-section summary:hover { color: var(--fx-text-main); }
.fx-nav-section summary::after {
    content: '▾';
    font-size: 10px;
    transition: transform 0.2s;
}
.fx-nav-section[open] summary::after { transform: rotate(180deg); }


.fx-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 2px;
    text-decoration: none;
    color: var(--fx-text-main);
    font-size: 14px;
    border-radius: var(--fx-radius-sm);
    transition: all 0.2s ease;
    font-weight: 500;
    position: relative;
}

.fx-nav-icon {
    font-size: 16px;
    opacity: 0.7;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.fx-nav a:hover {
    background: var(--fx-bg-hover);
    color: var(--fx-text-main);
}
.fx-nav a:hover .fx-nav-icon { opacity: 1; }

/* === Активная ссылка === */
.fx-nav a.active {
    background: var(--fx-ac1-soft);
    color: var(--fx-text-main);
    font-weight: 600;
}
.fx-nav a.active .fx-nav-icon {
    color: var(--fx-ac1);
    opacity: 1;
}
/* Полоска слева — через box-shadow inset (НЕ занимает ::before, ::after) */
.fx-nav a.active {
    box-shadow: inset 3px 0 0 var(--fx-ac1),
                inset 3px 0 10px -3px var(--fx-ac1);
}


.fx-userpill {
    margin-top: 16px;
    padding: 12px;
    background: var(--fx-bg-elevated);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-md);
    cursor: pointer;
    transition: 0.2s;
}
.fx-userpill:hover {
    border-color: var(--fx-border-strong);
    background: var(--fx-bg-hover);
}


@media (min-width: 769px) {
    .fx-stage {
        margin-left: calc(var(--fx-sidebar-w) + 12px);
        width: auto;
    }
}



.fx-topbar {
    display: flex;
    align-items: center;
    height: 52px;
    padding: 12px 12px 0;
    box-sizing: border-box;
    background: transparent;
    border: 0;
    box-shadow: none;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
}



.fx-burger {
    display: none;
}


@keyframes titlePingPong {
    0%, 15%   { transform: translateX(0); }
    85%, 100% { transform: translateX(var(--scroll-dist)); }
}

.fx-page-title {
    margin: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    font-size: 18px;
    font-weight: 700;
    color: var(--fx-text-main);
}
.fx-page-title.is-overflowing {
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0%, #000 5%, #000 95%, transparent 100%);
}
.fx-page-title-inner {
    display: inline-block;
    padding: 0 5px;
}


@media (max-width: 768px) {
    /* Мобильное меню — отдельная стеклянная панель по центру viewport. */
    .fx-sidebar {
        --fx-menu-edge: max(16px, env(safe-area-inset-left, 0px), env(safe-area-inset-right, 0px));
        --fx-menu-edge-y: max(16px, env(safe-area-inset-top, 0px), env(safe-area-inset-bottom, 0px));
        --fx-menu-surround: rgba(0, 0, 0, .35);
        top: 50%; left: 50%; bottom: auto;
        width: min(360px, calc(100% - var(--fx-menu-edge) * 2));
        height: min(760px, calc(100vh - var(--fx-menu-edge-y) * 2));
        height: min(760px, calc(100dvh - var(--fx-menu-edge-y) * 2));
        max-height: 100%;
        padding: 10px;
        border: 1px solid var(--fx-border);
        border-radius: var(--fx-radius-lg);
        background: color-mix(in srgb, var(--fx-bg-deep) 45%, transparent);
        -webkit-backdrop-filter: blur(24px) saturate(145%);
        backdrop-filter: blur(24px) saturate(145%);
        /* Внешняя тень не рисуется внутри скруглённой рамки и не затемняет стекло. */
        box-shadow: 0 12px 38px rgba(0, 0, 0, .2), inset 0 1px rgba(255, 255, 255, .08),
                    0 0 0 100vmax var(--fx-menu-surround);
        transform: translate(-50%, calc(-50% + 12px)) scale(.98);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        overscroll-behavior: contain;
    }
    body.fx-sidebar-open .fx-sidebar {
        transform: translate(-50%, -50%);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    .fx-sidebar > :not(.fx-nav) { flex-shrink: 0; }
    .fx-sidebar .fx-nav { min-height: 0; overscroll-behavior: contain; }
    .fx-sidebar .fx-brand { padding: 8px 8px 14px 12px; }
    .fx-sidebar-close {
        display: grid; place-items: center; flex: 0 0 44px;
        width: 44px; height: 44px; padding: 0;
        border: 1px solid var(--fx-border); border-radius: var(--fx-radius-pill);
        background: var(--fx-bg-hover); color: var(--fx-text-main);
        font: inherit; cursor: pointer;
    }
    .fx-sidebar-close svg { width: 18px; height: 18px; }
    .fx-sidebar-close:hover { background: color-mix(in srgb, var(--fx-text-main) 12%, transparent); }
    .fx-sidebar-close:focus-visible { outline: 2px solid var(--fx-ac2); outline-offset: 2px; }
    @supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
        .fx-sidebar { background: var(--fx-bg-elevated); }
    }
    @media (prefers-reduced-transparency: reduce) {
        .fx-sidebar { --fx-menu-surround: rgba(0, 0, 0, .5); background: var(--fx-bg-elevated); -webkit-backdrop-filter: none; backdrop-filter: none; }
    }

    /* Контент на всю ширину */
    .fx-stage {
        margin-left: 0;
    }

    .fx-burger {
        display: flex;
        width: 40px;
        height: 40px;
        background: transparent;
        border: none;
        color: var(--fx-text-main);
        align-items: center;
        justify-content: center;
        font-size: 26px;
        cursor: pointer;
        transition: opacity 0.2s ease;
        flex-shrink: 0;
        position: relative;
        padding: 0;
        z-index: 5;
    }
    .fx-burger:hover {
        opacity: 0.75;
    }
    .fx-burger:active {
        transform: scale(0.95);
    }

    .fx-topbar {
        gap: 12px;
        justify-content: flex-start;
        height: 52px;
        position: relative;
    }

    .fx-page-title {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        max-width: 68vw;
        text-align: center;
    }
    /* Внутренний контейнер для анимации скролла длинных названий */
    .fx-page-title-inner {
        display: inline-block;
        padding: 0 5px;
    }

    /* Только лёгкое размытие страницы; затемнение снаружи рамки задаёт тень sidebar. */
    body.fx-sidebar-open::after {
        content: "";
        position: fixed;
        inset: 0;
        background: transparent;
        -webkit-backdrop-filter: blur(3px);
        backdrop-filter: blur(3px);
        z-index: 900;
    }
    @media (prefers-reduced-transparency: reduce) {
        body.fx-sidebar-open::after {
            -webkit-backdrop-filter: none;
            backdrop-filter: none;
        }
    }

    /* Breadcrumbs прячем на мобайле */
    .fx-breadcrumbs { display: none; }
}


.fx-cookie-banner {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translate(-50%, 150%);
    width: 90%;
    max-width: 400px;
    background: color-mix(in srgb, var(--fx-bg-elevated) 95%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-lg);
    padding: 20px;
    z-index: 10000;
    box-shadow: var(--fx-shadow-lg);
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1);
}
.fx-cookie-banner.show {
    transform: translate(-50%, 0);
}

.fx-cookie-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 800;
    color: var(--fx-text-main);
}

.fx-cookie-text {
    font-size: 12px;
    color: var(--fx-text-muted);
    line-height: 1.5;
}
.fx-cookie-text a {
    color: var(--fx-text-muted);
    text-decoration: underline;
    text-decoration-color: var(--fx-border-strong);
    transition: 0.2s;
}
.fx-cookie-text a:hover {
    color: var(--fx-text-main);
    text-decoration-color: currentColor;
}

.fx-cookie-btn {
    background: var(--fx-text-main);
    border: none;
    color: var(--fx-bg);
    font-weight: 800;
    padding: 12px;
    border-radius: var(--fx-radius-md);
    cursor: pointer;
    transition: 0.2s;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 5px;
}
.fx-cookie-btn:hover {
    background: var(--fx-ac2);
    box-shadow: 0 0 20px rgba(var(--fx-ac2-rgb), .4);
}


.fx-toast-container {
    position: fixed;
    top: max(16px, env(safe-area-inset-top));
    left: 50%;
    width: min(680px, calc(100vw - 32px));
    max-height: calc(100dvh - max(32px, env(safe-area-inset-top)));
    transform: translateX(-50%);
    z-index: 10001;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    pointer-events: none;
}

.fx-toast {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: color-mix(in srgb, var(--fx-bg-elevated) 90%, transparent);
    backdrop-filter: blur(10px);
    border: 1px solid var(--fx-border);
    color: var(--fx-text-main);
    padding: 13px 16px;
    border-radius: var(--fx-radius-sm);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
    box-shadow: var(--fx-shadow-md);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: auto;
}
.fx-toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}
.fx-toast.success { border-color: var(--fx-success); color: var(--fx-success); }
.fx-toast.warning { border-color: var(--fx-warning); color: var(--fx-warning); }
.fx-toast.error   { border-color: var(--fx-error); color: var(--fx-error); }
.fx-toast i       { flex: 0 0 auto; line-height: 1.45; }
.fx-toast span    { min-width: 0; color: var(--fx-text-main); white-space: normal; overflow-wrap: anywhere; word-break: break-word; }

@media (max-width: 600px) {
    .fx-toast-container { width: calc(100vw - 20px); }
    .fx-toast { padding: 12px 14px; border-radius: var(--fx-radius-sm); }
}



.fx-scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--fx-bg-elevated) 82%, transparent);
    border: 1px solid var(--fx-border);
    backdrop-filter: blur(10px);
    color: var(--fx-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    z-index: 9000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.fx-scroll-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
.fx-scroll-top:hover {
    background: var(--fx-ac1);
    border-color: var(--fx-ac1);
    box-shadow: 0 5px 15px var(--fx-ac1-glow);
}
@media (max-width: 600px) {
    .fx-scroll-top { bottom: 80px; right: 20px; }
}


.fx-breadcrumbs {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin: 40px 0 20px 0;
    font-size: 8px;
    font-weight: 300;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    width: 100%;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}
.fx-breadcrumbs:hover { opacity: 1; }

.fx-breadcrumbs a {
    color: color-mix(in srgb, var(--fx-text-main) 60%, transparent);
    text-decoration: none;
    transition: 0.2s ease;
}
.fx-breadcrumbs a:hover {
    color: var(--fx-ac2);
    text-shadow: 0 0 8px rgba(var(--fx-ac2-rgb), .3);
}
.fx-breadcrumbs .separator {
    color: color-mix(in srgb, var(--fx-text-main) 20%, transparent);
    font-size: 10px;
}
.fx-breadcrumbs .current {
    color: color-mix(in srgb, var(--fx-text-main) 40%, transparent);
    font-size: 10px;
    font-weight: 400;
}

select:not([multiple]):not([size]):not([data-fx-select="native"]) {
    width: 100%;
    min-height: 44px;
    padding: 10px 40px 10px 14px;
    color: var(--fx-text-main);
    background-color: var(--fx-bg-deep);
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px;
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-sm);
    outline: none;
    appearance: none;
    color-scheme: dark;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--fx-transition);
}
select:not([multiple]):not([size]):not([data-fx-select="native"]):hover,
select:not([multiple]):not([size]):not([data-fx-select="native"]):focus-visible {
    border-color: color-mix(in srgb, var(--fx-ac1) 65%, transparent);
    background-color: var(--fx-bg-hover);
    box-shadow: 0 0 0 3px rgba(var(--fx-ac1-rgb), .09);
}
select:not([multiple]):not([size]):not([data-fx-select="native"]) option {
    color: var(--fx-text-main);
    background: var(--fx-bg-elevated);
}
[data-theme="light"] select:not([multiple]):not([size]):not([data-fx-select="native"]) {
    color-scheme: light;
}

.fx-select-native {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    min-height: 0 !important;
    margin: -1px !important;
    padding: 0 !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    clip-path: inset(50%) !important;
    border: 0 !important;
    white-space: nowrap !important;
    pointer-events: none !important;
}
.fx-custom-select {
    position: relative;
    width: 100%;
    min-width: 0;
    font-family: inherit;
}
.fx-custom-select--auto {
    width: auto;
    min-width: var(--fx-select-min-width);
}
.fx-custom-select-toggle {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 44px;
    align-items: center;
    padding: 10px 40px 10px 14px;
    overflow: hidden;
    color: var(--fx-text-main);
    background: linear-gradient(180deg, var(--fx-bg-subtle), transparent), var(--fx-bg-deep);
    border: 1px solid var(--fx-border);
    border-radius: var(--fx-radius-sm);
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    text-align: left;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: var(--fx-transition);
}
.fx-custom-select-toggle::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 15px;
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--fx-text-muted);
    border-bottom: 2px solid var(--fx-text-muted);
    transform: translateY(-70%) rotate(45deg);
    transition: transform .2s ease, border-color .2s ease;
}
.fx-custom-select:hover .fx-custom-select-toggle,
.fx-custom-select.open .fx-custom-select-toggle,
.fx-custom-select-toggle:focus-visible {
    border-color: color-mix(in srgb, var(--fx-ac1) 65%, transparent);
    background: linear-gradient(180deg, rgba(var(--fx-ac1-rgb), .09), rgba(var(--fx-ac2-rgb), .025)), var(--fx-bg-deep);
    box-shadow: 0 0 0 3px rgba(var(--fx-ac1-rgb), .09);
    outline: none;
}
.fx-custom-select.open .fx-custom-select-toggle::after {
    border-color: var(--fx-ac2);
    transform: translateY(-25%) rotate(225deg);
}
.fx-custom-select-toggle:disabled {
    opacity: .48;
    cursor: not-allowed;
}
.fx-custom-select-menu {
    position: absolute;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    z-index: 1000;
    max-height: min(250px, 45vh);
    padding: 6px;
    overflow-y: auto;
    background: var(--fx-bg-elevated);
    border: 1px solid var(--fx-border-strong);
    border-radius: var(--fx-radius-sm);
    box-shadow: var(--fx-shadow-lg);
    backdrop-filter: blur(16px);
    scrollbar-width: thin;
}
.fx-custom-select-menu[hidden] { display: none; }
.fx-custom-select-group {
    padding: 8px 10px 5px;
    color: var(--fx-text-dim);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .7px;
    text-transform: uppercase;
}
.fx-custom-select-option {
    position: relative;
    display: flex;
    width: 100%;
    min-height: 38px;
    align-items: center;
    padding: 8px 30px 8px 10px;
    color: var(--fx-text-muted);
    background: transparent;
    border: 0;
    border-radius: var(--fx-radius-sm);
    font: inherit;
    font-size: 12px;
    font-weight: 650;
    text-align: left;
    cursor: pointer;
}
.fx-custom-select-option:hover,
.fx-custom-select-option:focus-visible {
    color: var(--fx-text-main);
    background: rgba(var(--fx-ac1-rgb), .13);
    outline: none;
}
.fx-custom-select-option.selected {
    color: var(--fx-ac2);
    background: rgba(var(--fx-ac2-rgb), .09);
}
.fx-custom-select-option.selected::after {
    content: '\2713';
    position: absolute;
    right: 11px;
    color: var(--fx-ac2);
    font-weight: 900;
}
.fx-custom-select-option:disabled {
    opacity: .4;
    cursor: not-allowed;
}
@media (max-width: 600px) {
    .fx-custom-select--auto {
        width: 100%;
        min-width: 0;
    }
}

.fx-tool-page,
.fx-page-shell {
    padding-top: 0 !important;
    margin-top: 0 !important;
}
.fx-tool-page > .fx-tool-hero:first-child,
.fx-page-shell > .fx-page-hero:first-child {
    margin-top: 30px !important;
}
.fx-tool-hero--direct,
.fx-page-hero--direct {
    margin-top: 0 !important;
    padding-top: 30px !important;
}
