@media (max-width: 768px) {
    .section.free-test {
        overflow-x: hidden;
    }

    .free-test__container {
        max-width: 100%;
        padding-left: 16px;
        padding-right: 16px;
    }

    .test__topbar {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
        padding: 0 16px;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 12px;
    }

    .test__topbar .logo {
        min-width: 0;
        gap: 10px;
    }

    .test__topbar .logo-title {
        min-width: 0;
        font-size: 22px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .test__topbar .test__head-item:first-of-type {
        justify-self: end;
    }

    .test__topbar .test__head-item:nth-of-type(2) {
        display: none;
    }

    .test__question,
    .test__answers-wrapper,
    .test__question-answers,
    .test__question-answers.image-buttons {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .test__question {
        overflow-x: hidden;
    }

    .test__question-description {
        max-width: 100%;
        overflow-wrap: anywhere;
    }

    .test__question--img {
        width: min(100%, 360px);
        max-height: 180px;
        object-fit: contain;
    }

    .test__question-button {
        width: calc(50% - 8px);
        max-width: calc(50% - 8px);
        min-width: 0;
        margin: 0 4px 12px;
        padding-left: 8px;
        padding-right: 8px;
    }
}

@media (max-width: 360px) {
    .test__question-button {
        width: min(100%, 260px);
        max-width: 260px;
        margin-left: 0;
        margin-right: 0;
    }
}

.test-input__wrapper-m {
    width: 100%;
    max-width: 260px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.test__question-answers.input-answer {
    width: 100%;
    justify-content: center;
}

.test__question-answers.input-answer .test-input__wrapper-m {
    width: min(260px, 100%);
}

.test-input__wrapper-m--answered {
    max-width: 260px;
}

.test__answer-input__text {
    width: min(260px, 100%);
    min-width: 0;
    flex: 0 1 260px;
    height: 44px;
    padding: 0 16px;
    border: 1px solid #e3e7ee;
    border-radius: 9px;
    background: #ffffff;
    color: #242833;
    box-shadow: 0 12px 28px rgba(23, 36, 58, 0.1);
    box-sizing: border-box;
    font-size: 16px;
    font-weight: 300;
    line-height: 1;
    text-align: center;
}

.test__answer-input__text::placeholder {
    color: transparent;
    opacity: 1;
}

.test__answer-input__text:focus-visible {
    border-color: #174ea6;
    outline: 2px solid rgba(23, 78, 166, 0.25);
    outline-offset: 2px;
}

.test-input__wrapper-m span {
    display: none;
}

.test__question-button {
    min-width: 150px;
    min-height: 46px;
    padding: 8px 26px;
    font-size: 18px;
}

.test__question-answers.math-buttons {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 18px clamp(12px, 2.4vw, 28px);
}

.test__question-answers.math-buttons > div:not(.buttons-math__wrapper) {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1ch;
    line-height: 1;
}

.test__question-answers.math-buttons .buttons-math__wrapper {
    flex: 0 0 auto;
}

.test__question-answers.math-buttons .button-math.button-math-answer {
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    .test-input__wrapper-m {
        max-width: 220px;
    }

    .test__answer-input__text {
        width: 100%;
        flex-basis: auto;
        height: 42px;
        font-size: 16px;
    }

    .test__question-answers.math-buttons {
        width: 100%;
        gap: 14px 12px;
        font-size: 20px;
    }

    .test__question-answers.math-buttons .buttons-math__wrapper {
        gap: 8px;
    }

    .test__question-answers.math-buttons .button-math.button-math-answer {
        width: 40px;
        height: 40px;
    }
}
