.channelView {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    height: 100dvh;
    height: var(--vvh, 100dvh);
    background-color: #f7f8fa;
    position: relative;
    overflow: hidden;
    box-sizing: border-box;
}

.channelFeedScroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    /* Позицию при prepend постов сохраняет ChannelFeedController.
       Встроенное scroll anchoring добавляло к его сдвигу ещё один и
       возвращало ленту к посту, который браузер выбрал якорем. */
    overflow-anchor: none;
    padding: 1.5rem 2rem calc(5rem + env(safe-area-inset-bottom, 0px)) 2rem;
    scroll-behavior: smooth;
    box-sizing: border-box;
}

.channelPostsFeed {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}


.channelPostUnreadBadge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    background-color: #1b612a;
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
    vertical-align: middle;
    letter-spacing: 0.5px;
    animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: opacity 0.3s ease;
}

@keyframes highlightPost {
    0% {
        background-color: rgba(76, 175, 80, 0.32);
        box-shadow: 0 0 0 4px rgba(76, 175, 80, 0.28);
    }
    40% {
        background-color: rgba(76, 175, 80, 0.18);
        box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.15);
    }
    100% {
        background-color: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    }
}

.highlight-post {
    animation: highlightPost 2.5s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

.channelPost:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
}

.channelPostHeader {
    margin-bottom: 1rem;
}

.channelPostAuthorAvatar {
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid #e1e3e8;
}

.channelPostAuthorName {
    font-size: 15px;
    color: #1b612a;
}

.channelAdminBadge {
    display: inline-block;
    font-size: 10px;
    font-weight: bold;
    color: #1b612a;
    background-color: #e2f2e6;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
    vertical-align: middle;
}

.channelPostTitle {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 0.8rem 0;
    color: #191920;
    line-height: 1.35;
}

.channelPostText {
    font-size: 15px;
    line-height: 1.6;
    color: #2c2d33;
    word-break: break-word;
    white-space: pre-line;
}

.channelPostImgWrap {
    margin-top: 1rem;
    border-radius: 12px;
    overflow: hidden;
    max-height: 420px;
    background-color: #f0f1f4;
}

.channelPostImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.channelPostImg:hover {
    transform: scale(1.01);
}

.channelPostAudioWrap {
    margin-top: 1rem;
    background-color: #f7f8fa;
    border: 1px solid #e1e3e8;
    border-radius: 12px;
    padding: 0.8rem 1rem;
}

.channelPostVideoWrap {
    margin-top: 1rem;
    border-radius: 12px;
    overflow: hidden;
    background-color: #0b0f19;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.channelPostVideo {
    width: 100%;
    max-height: 480px;
    display: block;
    border-radius: 12px;
    background-color: #000;
}

.channelPostText a {
    color: #2563eb;
    text-decoration: underline;
    word-break: break-word;
}

.channelPostText a:hover {
    color: #1d4ed8;
}

/* Модальное окно просмотра полноразмерных фото (Lightbox) */
.channelLightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.channelLightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.channelLightboxBackdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(6px);
}

.channelLightboxContent {
    position: relative;
    max-width: 92vw;
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.channelLightboxImg {
    max-width: 92vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    animation: zoomInLightbox 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes zoomInLightbox {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.channelLightboxClose {
    position: absolute;
    top: -46px;
    right: 0;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: #fff;
    font-size: 28px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    line-height: 1;
    transition: background 0.2s;
}

.channelLightboxClose:hover {
    background: rgba(255, 255, 255, 0.3);
}

.channelPostFooter {
    margin-top: 1.2rem;
    padding-top: 0.8rem;
    border-top: 1px solid #f0f1f4;
}

.channelPostViews {
    user-select: none;
}

.channelLoader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1.5rem;
    color: #7b7e88;
    font-size: 14px;
}

.channelSpinner {
    width: 22px;
    height: 22px;
    border: 2px solid #e1e3e8;
    border-top-color: #1b612a;
    border-radius: 50%;
    animation: spinnerSpin 0.7s linear infinite;
}

@keyframes spinnerSpin {
    to { transform: rotate(360deg); }
}

.channelScrollBtn {
    position: absolute;
    right: 86px;
    bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #fff;
    color: #4a4a52;
    border: 1px solid #e1e3e8;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.channelScrollBtn:hover {
    background-color: #f7f8fa;
    color: #1b612a;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.channelScrollBtn:active {
    transform: translateY(0) scale(0.95);
}

.channelScrollBtn.has-unread {
    background-color: #1b612a;
    color: #fff;
}

/* Когда кнопка «вниз» скрыта — кнопка ответов сдвигается вправо на её место */
.channelScrollBtn.down-btn-hidden {
    right: 28px;
}

/* Прелоадер на кнопке ответов при долгом ответе сервера */
.channelScrollBtn.loading {
    pointer-events: none;
    cursor: default;
}

.channelScrollBtn.loading svg-icon {
    display: none;
}

.channelScrollBtn.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spinnerSpin 0.7s linear infinite;
}

.channelUnreadBadge{
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 8px;
    height: 18px;
    padding: 0 5px;
    border-radius: 50%;
    background-color: #141414;
    color: #fff;
    font-family: Arial, sans-serif;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.8;
    text-align: center;
    border: 2px solid #fff;
    box-shadow: 0 2px 6px rgba(27, 97, 42, 0.4);
    animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Кнопка «вниз» — перемотка к последнему посту (справа от кнопки ответов) */
.channelDownBtn {
    position: absolute;
    right: 28px;
    bottom: calc(26px + env(safe-area-inset-bottom, 0px));
    z-index: 20;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #fff;
    color: #4a4a52;
    border: 1px solid #e1e3e8;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
}

.channelDownBtn:hover {
    background-color: #f7f8fa;
    color: #1b612a;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.16);
}

.channelDownBtn:active {
    transform: translateY(0) scale(0.95);
}

/* Прелоадер на кнопке «вниз» при долгом ответе сервера */
.channelDownBtn.loading {
    pointer-events: none;
    cursor: default;
}

.channelDownBtn.loading svg-icon {
    display: none;
}

.channelDownBtn.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(27, 97, 42, 0.25);
    border-top-color: #1b612a;
    border-radius: 50%;
    animation: spinnerSpin 0.7s linear infinite;
}

/* Навигация по результатам поиска постов */
.channelSearchNav {
    height: 60px;
    padding: 0 16px;
    background-color: #ffffff;
    border-radius: 33px;
    box-shadow: 0 0 8px #f5f5f5;
    border: 1px solid #edf0f4;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    white-space: nowrap;
    z-index: 3;
    animation: fadeInSearchNav 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.channelSearchNav.empty {
    background-color: #fafbfd;
    border-color: #ebeef3;
}

@keyframes fadeInSearchNav {
    from {
        opacity: 0;
        transform: translateY(-4px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.channelSearchInfo {
    font-size: 13px;
    font-weight: 500;
    color: #3b3f46;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    padding: 0 4px;
}

.channelSearchInfo.empty {
    color: #8c909a;
    font-size: 13px;
    font-weight: 400;
}

.channelSearchArrow {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #e1e3e8;
    background-color: #f7f8fa;
    color: #1b612a;
    font-size: 13px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    flex-shrink: 0;
}

.channelSearchArrow:hover {
    background-color: #eef7f0;
    border-color: #1b612a;
    color: #1b612a;
}

.channelSearchArrow:active {
    transform: scale(0.92);
}

#channelSearchCancelBtn {
    color: #7b7e88;
    background-color: #f7f8fa;
    border-color: #e1e3e8;
    font-size: 13px;
    margin-left: 2px;
}

#channelSearchCancelBtn:hover {
    color: #d32f2f;
    background-color: #fee;
    border-color: #fcc;
}


/*AUDIO PLAYER STYLES*/
.audio-player {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
}

.ap-btn-div {
    position: relative;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.ap-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: #1b612a;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    border: none;
    padding: 0;
}

.ap-btn:hover {
    background-color: #154c20;
    transform: scale(1.05);
}

.ap-btn svg {
    fill: currentColor;
}

.ap-current, .ap-total {
    font-size: 12px;
    color: #7b7e88;
    font-family: monospace;
    min-width: 38px;
}

.ap-bar {
    position: relative;
    flex: 1;
    height: 6px;
    background-color: #e1e3e8;
    border-radius: 3px;
    overflow: visible;
}

.ap-bar-play {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: #1b612a;
    border-radius: 3px;
    width: 0%;
    pointer-events: none;
}

.ap-bar-saved {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background-color: #b0b3bd;
    border-radius: 3px;
    width: 0%;
    pointer-events: none;
}

.ap-range {
    position: absolute;
    left: 0;
    top: -5px;
    width: 100%;
    height: 16px;
    opacity: 0;
    cursor: pointer;
    margin: 0;
    z-index: 2;
}

.ap-loader {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid rgba(27, 97, 42, 0.2);
    border-top-color: #1b612a;
    animation: spinnerSpin 0.8s linear infinite;
}

#channelHeaderTitle{
    padding: 4px;
}
#channelHeaderTitle h1{
    margin: 0;
}

#channelHeaderTitle img{
    width: 50px;
    height: 50px;
    object-fit: cover;
}
.TPBtnLib{
    box-shadow:0 0 0 1px #D5D6D8;
}
.TPBtnLib,
.TPBtnEther{
    height: 50px;
    padding: 0.3rem 1.5rem;
}
.TPBtnEtherWait{
    background-color: #CFDED3;
    svg-icon{color:#21612E}
    .fs16{color: #000}
    .fs14{color: #5F6565}

}

/* Контейнер публикации */
.postMsg {
    background-color: #fff;
    border-radius: 16px;
    border: 1px solid #e7e9ed;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

.postMsg.is-unread {
    box-shadow: -2px 0 8px #c5ddca;
}

/* Медиа в посте */
.postMsgImg {
    width: 100%;
    max-height: 440px;
    overflow: hidden;
    background-color: #f0f1f4;
}

.postMsgImg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.postMsgImg img:hover {
    transform: scale(1.01);
}

/* Текстовая область и внутренние отступы */
.postMsgTxt {
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* Реакции */
.postMsgRcts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.postMsgRcts button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 4px;
    border-radius: 14px;
    background-color: #f0f2f5;
    border: 1px solid transparent;
    font-size: 13px;
    color: #3e424b;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.postMsgRcts button:hover {
    background-color: #e4e7eb;
}

.postMsgRcts button.postMsgRctsActive,
.postMsgRcts button.active-reaction {
    background-color: #2E55C9 !important;
    color: #fff !important;
}

/* Статистика (просмотры, автор, время) */
.postMsgStat {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 14px;
    user-select: none;
}

/* Плашка перехода к комментариям */
.postMsgAction {
    position: relative;
    border-top: 1px solid #f0f1f4;
    padding: .8rem 1.1rem 0 .3rem;
    margin: .4rem -1.36rem 0 -1.36rem;
    align-items: center;
    cursor: pointer;
}

.postMsgActionBtn {
    border: none;
    background: transparent;
    cursor: pointer;
    width: 100%;
    height: 100%;
    margin-left: 1rem;
}

.postMsgActionImgs {
    display: flex;
    align-items: center;
    margin-left: 1rem;
}

.postMsgActionImgs img {
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    margin-left: -8px;
}

.postMsgActionImgs img:first-child {
    margin-left: 0;
}

/* Маленький индикатор: в обсуждении этого поста появились новые ответы. */
.postCommentsUnreadDot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 6px;
    border-radius: 50%;
    background-color: #e04b72;
    box-shadow: 0 0 0 2px #fff, 0 1px 4px rgba(224, 75, 114, 0.45);
    vertical-align: middle;
}

.postMsgActionArrw {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-top: 2px solid #1b612a;
    border-right: 2px solid #1b612a;
    transform: rotate(45deg);
    margin-right: 6px;
}

/* Ссылка-оверлей на страницу поста: занимает всю плашку перехода к комментариям */
.postMsgCommentsLink {
    text-decoration: none;
}

.fghrtn{
    margin-left: 1.1rem;
}

@media screen and (max-width: 720px){
    .mgt567{
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.28s ease;
    }
    #channelViewPanel.mobile-header-buttons-visible .mgt567{
        max-height: 96px;
    }
    .TPBtnLib,
    .TPBtnEther{
        opacity: 0;
        visibility: hidden;
        transform: translateY(-8px);
        pointer-events: none;
        transition: opacity 0.16s ease, transform 0.16s ease, visibility 0s linear 0s;
    }
    #channelViewPanel.mobile-header-buttons-visible .TPBtnLib,
    #channelViewPanel.mobile-header-buttons-visible .TPBtnEther{
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
        transition-delay: 0.28s;
    }
    .search{display: initial}
    #channelHeaderTitle img{display: none;}
    .search svg-icon{
        --icon-width:20px;
        --icon-height:20px;
    }
    .search,
    .searchBtnAct,
    .btnBack {
        width: 40px;
        height: 40px;
        min-width: 40px;
        min-height: 40px;
        padding: 0!important;
    }
    #channelHeaderTitle{background-color: transparent}
    .chatTopStripe,
    #channelHeaderTitle{
        align-items: start;
    }
    .dercq{
        flex-direction: row;
        align-items: end;
        flex: 1;
        justify-content: space-between;
    }
    .TPBtnLib{background-color: #F7F8FA}
    .TPBtnLib, .TPBtnEther {
        height: 40px;
    }
    .searchStr{
        gap: 0.1rem;
        font-size: 12px;
    }
    .mgt567{
        margin: 0 -4rem;
        padding:1px;
    }
    .channelFeedScroll {
        padding: 1.5rem 0.5rem calc(8rem + env(safe-area-inset-bottom, 0px)) 0.5rem;
    }

    /* Поднимаем плавающие кнопки на мобильных устройствах выше системной панели и браузерного бара */
    .channelDownBtn {
        right: 18px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        width: 46px;
        height: 46px;
    }

    .channelScrollBtn {
        right: 74px;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        width: 46px;
        height: 46px;
    }

    .channelScrollBtn.down-btn-hidden {
        right: 18px;
    }
    .chatTopStripe {
        padding: .9rem .6rem 0 .6rem;
    }
    .channelSearchNav {
        position: absolute;
        right: 0.6rem;
        top: 0.9rem;
        height: 40px;
        padding: 0 10px;
        gap: 6px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.12);
        z-index: 10;
    }
    .channelSearchArrow {
        width: 26px;
        height: 26px;
        font-size: 11px;
    }
    .channelSearchInfo {
        font-size: 12px;
        padding: 0 2px;
    }
}
