/* Сториз mhave (модуль mhave.stories). Раскладка только на flex. */

html.mhs-lock,
html.mhs-lock body {
    overflow: hidden !important;
}

/* ===================== Блок кружков на главной ===================== */

.mhs-block {
    margin: 0 0 32px;
}

.mhs-block__title {
    margin: 0 0 16px;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.25;
    color: #1a1a1a;
}

.mhs-block__list {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding: 4px 2px 8px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.mhs-block__list::-webkit-scrollbar {
    display: none;
}

.mhs-circle {
    display: flex;
    flex: 0 0 104px;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    scroll-snap-align: start;
    font: inherit;
    color: inherit;
}

.mhs-circle__ring {
    display: flex;
    width: 96px;
    height: 96px;
    padding: 3px;
    border-radius: 50%;
    background: linear-gradient(45deg, #f5b27a, #e0567c 45%, #8f5bd8);
    transition: transform .2s ease;
}

.mhs-circle.is-seen .mhs-circle__ring {
    background: #d5d5d5;
}

.mhs-circle:hover .mhs-circle__ring {
    transform: scale(1.04);
}

.mhs-circle__img {
    display: flex;
    flex: 1 1 auto;
    overflow: hidden;
    border: 3px solid #fff;
    border-radius: 50%;
    background: #eee;
}

.mhs-circle__img img,
.mhs-circle__img video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.mhs-circle__name {
    display: -webkit-box;
    max-width: 100%;
    overflow: hidden;
    font-size: 13px;
    line-height: 1.3;
    text-align: center;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

@media (max-width: 767px) {
    .mhs-block__list {
        gap: 12px;
    }

    .mhs-circle {
        flex-basis: 76px;
    }

    .mhs-circle__ring {
        width: 72px;
        height: 72px;
    }

    .mhs-circle__name {
        font-size: 12px;
    }
}

/* ===================== Вертикальные карточки ===================== */

.mhs-block__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 16px;
}

.mhs-block__head .mhs-block__title {
    margin: 0;
}

.mhs-block__arrows {
    display: flex;
    flex: 0 0 auto;
    gap: 8px;
    margin-left: auto;
}

.mhs-block__arrows[hidden] {
    display: none;
}

.mhs-block__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #d9d9de;
    border-radius: 50%;
    background: #fff;
    color: #1a1a1a;
    cursor: pointer;
    transition: border-color .15s ease, opacity .15s ease;
}

.mhs-block__arrow:hover {
    border-color: #1a1a1a;
}

.mhs-block__arrow:disabled {
    opacity: .35;
    cursor: default;
}

.mhs-block--cards .mhs-block__list {
    --mhs-cards: 6;
    --mhs-gap: 24px;
    gap: var(--mhs-gap);
    padding: 0;
    scroll-snap-type: x mandatory;
}

.mhs-card {
    position: relative;
    display: flex;
    flex: 0 0 calc((100% - var(--mhs-gap) * (var(--mhs-cards) - 1)) / var(--mhs-cards));
    flex-direction: column;
    justify-content: space-between;
    min-width: 0;
    aspect-ratio: 9 / 16;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 28px;
    background: #2b2b30;
    color: #fff;
    text-align: left;
    cursor: pointer;
    scroll-snap-align: start;
    font: inherit;
    isolation: isolate;
}

.mhs-card__video {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    transition: transform .4s ease;
}

.mhs-card:hover .mhs-card__video {
    transform: scale(1.03);
}

/* затемнение сверху под текст и лёгкое снизу */
.mhs-card::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, .15) 32%, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .12) 100%);
}

.mhs-card__head {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 20px 18px 0;
}

.mhs-card__subtitle {
    overflow: hidden;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    text-overflow: ellipsis;
    opacity: .92;
}

.mhs-card__title {
    display: -webkit-box;
    overflow: hidden;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.2;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.mhs-card__play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin: -30px 0 0 -30px;
    padding-left: 3px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .92);
    color: #111;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
    transition: transform .2s ease, opacity .2s ease;
}

.mhs-card:hover .mhs-card__play {
    transform: scale(1.08);
}

.mhs-card.is-playing .mhs-card__play {
    opacity: 0;
}

@media (max-width: 1199px) {
    .mhs-block--cards .mhs-block__list {
        --mhs-cards: 4;
    }
}

@media (max-width: 767px) {
    .mhs-block--cards .mhs-block__list {
        --mhs-cards: 2.3;
        --mhs-gap: 12px;
    }

    .mhs-card {
        border-radius: 20px;
    }

    .mhs-card__head {
        padding: 14px 12px 0;
    }

    .mhs-card__subtitle {
        font-size: 12px;
    }

    .mhs-card__title {
        font-size: 16px;
    }

    .mhs-card__play {
        width: 48px;
        height: 48px;
        margin: -24px 0 0 -24px;
    }

    .mhs-card__play svg {
        width: 20px;
        height: 20px;
    }
}

/* ===================== Модалка-плеер ===================== */

.mhs-modal {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    opacity: 0;
    transition: opacity .2s ease;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.mhs-modal.is-open {
    opacity: 1;
}

.mhs-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(12, 12, 14, .88);
}

.mhs-modal button {
    font-family: inherit;
}

.mhs-stage {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: min(92vh, 860px);
    width: calc(min(92vh, 860px) * 9 / 16);
    max-width: 100vw;
    overflow: hidden;
    border-radius: 14px;
    background: #000;
    color: #fff;
    transform: scale(.96);
    transition: transform .2s ease;
    user-select: none;
    -webkit-user-select: none;
}

.mhs-modal.is-open .mhs-stage {
    transform: none;
}

.mhs-media {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mhs-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.mhs-media.is-portrait .mhs-video {
    object-fit: cover;
}

/* фото-слайд: та же логика, что у видео */
.mhs-image {
    display: none;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
}

.mhs-modal.is-image .mhs-image {
    display: block;
}

.mhs-modal.is-image .mhs-video {
    display: none;
}

.mhs-media.is-portrait .mhs-image {
    object-fit: cover;
}

/* у фото нечего озвучивать */
.mhs-modal.is-image .mhs-sound {
    display: none;
}

.mhs-tap {
    position: absolute;
    top: 70px;
    bottom: 120px;
    z-index: 1;
    cursor: pointer;
    touch-action: pan-y;
}

.mhs-tap--prev {
    left: 0;
    width: 33%;
}

.mhs-tap--next {
    right: 0;
    width: 67%;
}

/* верх: пагинация и шапка */
.mhs-top {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 12px 28px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0));
}

.mhs-progress {
    display: flex;
    gap: 4px;
}

.mhs-progress__item {
    position: relative;
    display: flex;
    flex: 1 1 0;
    height: 3px;
    overflow: hidden;
    border-radius: 2px;
    background: rgba(255, 255, 255, .35);
}

.mhs-progress__item i {
    width: 0;
    height: 100%;
    background: #fff;
}

.mhs-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.mhs-head__group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.mhs-head__avatar {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.mhs-head__name {
    overflow: hidden;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, .4);
}

.mhs-head__actions {
    display: flex;
    flex: 0 0 auto;
    gap: 4px;
}

.mhs-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .25);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease;
}

.mhs-btn:hover {
    background: rgba(0, 0, 0, .45);
}

/* кнопка звука: перечёркнута, пока звук выключен */
.mhs-sound .mhs-ico-cross {
    display: none;
}

.mhs-sound.is-muted .mhs-ico-cross {
    display: inline;
}

.mhs-sound.is-muted .mhs-ico-wave {
    display: none;
}

/* низ: название, описание, «Подробнее» */
.mhs-bottom {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 48px 16px 20px;
    background: linear-gradient(to top, rgba(0, 0, 0, .75), rgba(0, 0, 0, 0));
    transition: background .2s ease;
}

.mhs-bottom[hidden],
.mhs-bottom [hidden] {
    display: none !important;
}

.mhs-title {
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
}

.mhs-text {
    display: -webkit-box;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-line;
    -webkit-line-clamp: var(--mhs-lines, 4);
    -webkit-box-orient: vertical;
}

.mhs-more {
    padding: 0;
    border: 0;
    background: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

.mhs-link {
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: stretch;
    min-height: 44px;
    margin-top: 4px;
    padding: 10px 16px;
    border-radius: 10px;
    background: #fff;
    color: #111 !important;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none !important;
}

.mhs-modal.is-expanded .mhs-bottom {
    background: rgba(0, 0, 0, .8);
}

.mhs-modal.is-expanded .mhs-text {
    display: block;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-line-clamp: unset;
    overscroll-behavior: contain;
}

/* стрелки по бокам (десктоп) */
.mhs-nav {
    position: relative;
    z-index: 1;
    display: flex;
    flex: 0 0 48px;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
    transition: background .15s ease, opacity .15s ease;
}

.mhs-nav:hover {
    background: rgba(255, 255, 255, .26);
}

.mhs-nav.is-disabled {
    opacity: .35;
}

/* загрузка / ошибка / автозапуск запрещён */
.mhs-loader {
    display: none;
    width: 42px;
    height: 42px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mhs-spin .8s linear infinite;
    position: absolute;
}

.mhs-modal.is-loading .mhs-loader {
    display: block;
}

.mhs-error {
    display: none;
    position: absolute;
    padding: 0 24px;
    font-size: 14px;
    text-align: center;
}

.mhs-modal.is-error .mhs-error {
    display: block;
}

.mhs-modal.is-error .mhs-loader {
    display: none;
}

.mhs-play {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 3;
    display: none;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    margin: -36px 0 0 -36px;
    padding: 0 0 0 4px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, .5);
    color: #fff;
    cursor: pointer;
}

.mhs-modal.is-blocked .mhs-play {
    display: flex;
}

@keyframes mhs-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 767px) {
    .mhs-modal {
        gap: 0;
    }

    .mhs-nav {
        display: none;
    }

    .mhs-stage {
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }

    .mhs-top {
        padding-top: max(12px, env(safe-area-inset-top));
    }

    .mhs-bottom {
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }
}

/* ===================== Виджет ===================== */

.mhs-widget {
    position: fixed;
    left: var(--mhs-left, 20px);
    bottom: calc(var(--mhs-bottom, 50px) + var(--mhs-panel, 0px));
    z-index: 990;
    display: flex;
    width: var(--mhs-w, 120px);
    height: calc(var(--mhs-w, 120px) * 16 / 9);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .3s ease, transform .3s ease;
    pointer-events: none;
}

.mhs-widget.is-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}

.mhs-widget__preview {
    position: relative;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: flex-end;
    overflow: hidden;
    padding: 0;
    border: 2px solid #fff;
    border-radius: 14px;
    background: #222;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .25);
    cursor: pointer;
    transition: transform .2s ease;
}

.mhs-widget__preview:hover {
    transform: scale(1.03);
}

.mhs-widget__video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.mhs-widget__play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    padding-left: 2px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .35);
    color: #fff;
}

.mhs-widget__play svg {
    width: 18px;
    height: 18px;
}

.mhs-widget__name {
    position: relative;
    display: -webkit-box;
    overflow: hidden;
    padding: 20px 8px 8px;
    background: linear-gradient(to top, rgba(0, 0, 0, .7), rgba(0, 0, 0, 0));
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.mhs-widget__close {
    position: absolute;
    top: -10px;
    right: -10px;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .2);
    cursor: pointer;
}

.mhs-widget__close svg {
    width: 14px;
    height: 14px;
}

@media (max-width: 767px) {
    .mhs-widget {
        bottom: calc(var(--mhs-bottom-m, 50px) + var(--mhs-panel, 0px));
        width: var(--mhs-w-m, 90px);
        height: calc(var(--mhs-w-m, 90px) * 16 / 9);
    }

    .mhs-widget__name {
        font-size: 11px;
    }
}
