/* Approved page fixes (owner 2026-11-26), group: pages. See ms-site/design/site-audit/FINDINGS.md. */

/* ---------- 1. Toast after a payment (/payment/success/<id>; html.fxp-paid is set by fixes-pages.js) ----------
   Under the header instead of over the logo / EN (phone) or the right character (desktop): centred under
   the menu, 440px wide. The whole text, no clamp and no «Подробнее». «Задерживается»: a grey support button. */
html.fxp-paid .ms-toast-text {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
}

html.fxp-paid .ms-toast-more {
    display: none;
}

@media (min-width: 901px) {
    html.fxp-paid .ms-toast-stack {
        right: auto;
        left: 50%;
        width: 440px;
        margin-left: -220px;
    }
}

/* Phones: every toast (payment, /doplata nickname errors, ...) sits under the logo and EN, not over them. */
@media (max-width: 900px) {
    html:not(.dm) .ms-toast-stack,
    html:not(.dm) .ms-toast-reward {
        top: calc(env(safe-area-inset-top, 0px) + 80px);
    }
}

.fxp-act {
    margin-top: 10px;
}

a.fxp-support {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 32px;
    padding: 0 14px;
    border-radius: 8px;
    background: var(--ms-btn-grey);
    color: var(--ms-text-3);
    font-family: var(--font-family-second), Inter, sans-serif;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s, color 0.2s;
}

a.fxp-support:hover,
a.fxp-support:focus-visible {
    background: rgba(var(--ms-grey-rgb), 0.24);
    color: #fff;
    outline: none;
}

/* ---------- 2. /docs: the documents as cards like «Как зайти на сервер? · Инструкция ›» ---------- */
.legal-doc.docs-list h1 {
    margin-bottom: 20px;
}

.docs-list .docs-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.legal-doc.docs-list a.mvx-howto {
    display: flex;
    margin: 0;
    padding: 12px 14px;
    color: inherit;
    text-decoration: none;
}

.legal-doc.docs-list a.mvx-howto div {
    flex: 1;
    min-width: 0;
}

.legal-doc.docs-list a.mvx-howto span {
    color: #fff;
    line-height: 1.4;
}

.legal-doc.docs-list a.mvx-howto small {
    margin-top: 3px;
    line-height: 1.4;
}

.legal-doc.docs-list a.mvx-howto em {
    line-height: 1.4;
}

@media (max-width: 900px) {
    .legal-doc.docs-list h1 {
        margin-bottom: 16px;
    }

    .docs-list .docs-cards {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }
}

/* ---------- 3. /oferta, /privacy: contents and «наверх» on every width (owner 2026-11-29: the phone's were handier),
   a readable column on the desktop ---------- */
@media (min-width: 901px) {
    .legal-page .legal-doc:not(.docs-list) {
        max-width: 680px;
        margin-right: auto;
        margin-left: auto;
    }

    /* «Вернуться назад» starts where the text column does */
    .legal-page:has(.legal-doc:not(.docs-list)) > a.link-back {
        margin-left: max(0px, calc((100% - 680px) / 2));
    }
}

/* the title centred with its date line under it, as on the phone */
.legal-doc h1:first-of-type {
    text-align: center;
}

.legal-doc h1:first-of-type + :is(p, h4) {
    margin: 8px 0 18px;
    color: var(--ms-text-3);
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
    text-align: center;
}

.legal-doc h1:first-of-type + :is(p, h4) b {
    font-weight: inherit;
}

.legal-doc h2 {
    scroll-margin-top: 12px;
}

/* Wide screens: the title and its date line across the top, under them the contents (270px, in view while reading,
   the section being read marked) and the text (680px, ~72 characters a line); fixes-pages.js moves the blocks */
@media (min-width: 1180px) {
    .fxp-doc {
        display: grid;
        grid-template-columns: 270px minmax(0, 680px);
        column-gap: 48px;
        justify-content: center;
        align-items: start;
    }

    .fxp-doc > .legal-doc:not(.docs-list) {
        max-width: none;
        margin: 0;
        grid-column: 2;
        grid-row: 2;
    }

    .fxp-doc > .legal-doc.fxp-head {
        grid-column: 1 / -1;
        grid-row: 1;
        margin: 28px 0 0;
    }

    .fxp-doc > .fxp-head h4 {
        margin-bottom: 32px;
    }

    .fxp-doc > .fxp-toc {
        position: sticky;
        top: 24px;
        max-height: calc(100vh - 48px);
        overflow-y: auto;
        margin: 0;
        padding: 12px 6px 8px;
        grid-column: 1;
        grid-row: 2;
    }

    .fxp-doc > .fxp-toc .fxp-toc-head {
        padding: 0 8px;
        white-space: nowrap;
    }

    .fxp-doc > .fxp-toc.fxp-toc .fxp-toc-rest {
        display: block;
    }

    .fxp-doc > .fxp-toc .fxp-toc-more {
        display: none;
    }

    /* compact: the 19 sections of the offer fit a laptop screen */
    .fxp-doc > .fxp-toc a {
        padding: 5px 8px;
        border-radius: 7px;
        font-size: 12.5px;
        line-height: 17px;
        white-space: normal;
    }

    .fxp-doc > .fxp-toc a.is-here {
        background: rgba(var(--ms-buy-rgb), 0.1);
    }

    /* «Вернуться назад» starts where the two columns do */
    .content-main.legal-page:has(.fxp-doc) > a.link-back {
        margin-left: max(0px, calc((100% - 998px) / 2));
    }
}

.fxp-toc {
    margin: 0 0 20px;
    padding: 12px 14px 6px;
    border-radius: 12px;
    background: var(--ms-tile);
}

.fxp-toc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.fxp-toc-head b {
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 20px;
}

.fxp-toc-head span {
    color: var(--ms-text-3);
    font-size: 12px;
    font-weight: 500;
    line-height: 20px;
}

.fxp-toc a,
.fxp-toc-more {
    display: block;
    overflow: hidden;
    color: var(--ms-text-3);
    font-size: 13px;
    font-weight: 500;
    line-height: 32px;
    text-decoration: none;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* a long section title wraps instead of ending in «…» (owner 2026-11-29: 2 of the offer's 19 were cut on phones);
   one line stays 32px high */
.fxp-toc a {
    padding: 6px 0;
    line-height: 20px;
    text-overflow: clip;
    white-space: normal;
}

.fxp-toc a:hover {
    color: #fff;
}

.fxp-toc a.is-here {
    color: var(--ms-accent-text);
}

.fxp-toc-more {
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ms-accent-text);
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.fxp-toc:not(.is-open) .fxp-toc-rest {
    display: none;
}

.fxp-top {
    position: fixed;
    right: 16px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: var(--ms-field);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
    color: var(--ms-text-3);
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.2s, transform 0.2s;
}

.fxp-top.is-on {
    opacity: 1;
    pointer-events: auto;
    transform: none;
}
