/* posts.css — стили карточки поста (views/post.php)
 * Подключается после layout. Только классы поста, реакций, ленты. */

 .post-card {
    --post-pad-x: 1rem;
    --post-pad-y: 1rem;
    position: relative;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--space-8);
    transition: all var(--transition-base);
}

.post-card:hover {
    border-color: var(--color-border-dark);
    box-shadow: var(--shadow-md);
}

.post-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--post-pad-y) var(--post-pad-x);
    border-bottom: 1px solid var(--color-border-light);
}

.post-author {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

/* Обёртка аватара с точкой «онлайн» — фиксированный размер, как у аватара */
.post-author .user-avatar-wrap {
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
}

.post-author-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--radius-full);
    overflow: hidden;
    flex-shrink: 0;
    display: block;
}

.post-author-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.post-author-info {
    flex: 1;
    min-width: 0;
}

.post-author-name {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    color: var(--color-text-primary);
    text-decoration: none;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.post-author-name:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.post-author-time {
    font-size: var(--font-size-xs);
    letter-spacing: 0.02em;
    color: var(--color-text-tertiary);
    display: block;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.post-author-time:hover {
    color: var(--color-primary);
}

/* Меню поста (три точки) */
.post-actions-dropdown {
    position: relative;
}

.post-menu-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.post-menu-btn:hover {
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.post-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    min-width: 180px;
    display: none;
    z-index: var(--z-dropdown);
    padding: 0.5rem 0;
}

.post-menu.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* .menu-item — общий стиль в components.css */

.menu-divider {
    height: 1px;
    background-color: var(--color-border);
    margin: 0.5rem 0;
}

/* Шаринг */
.share-dropdown-wrap {
    position: relative;
}

.share-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 0.25rem;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    min-width: 200px;
    display: none;
    z-index: var(--z-dropdown);
    padding: 0.5rem 0;
}

.share-dropdown.show {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* .share-dropdown-item — общий стиль в components.css (вместе с .dropdown-item, .menu-item) */

.share-post-recipient {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.6rem 0;
    border: none;
    background: none;
    cursor: pointer;
    text-align: left;
    font-size: inherit;
    color: var(--color-text-primary);
    border-radius: var(--radius-md);
    transition: background var(--transition-fast);
}

.share-post-recipient:hover:not(:disabled) {
    background-color: var(--color-bg-secondary);
}

.share-post-recipient:disabled {
    opacity: 0.6;
    cursor: wait;
}

.share-post-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    object-fit: cover;
}

.share-post-modal .modal-text {
    margin: 0 0 1rem;
    color: var(--color-text-secondary);
}

.share-post-recipients {
    max-height: 240px;
    overflow-y: auto;
}

.share-dropdown-section-title {
    padding: 0.35rem 0.75rem 0.25rem;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.share-dropdown-section + .share-dropdown-section {
    border-top: 1px solid var(--color-border-light);
    margin-top: 0.25rem;
    padding-top: 0.25rem;
}

.post-share-dropdown .share-post-recipient {
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    font-size: var(--font-size-sm);
}

.post-share-dropdown .share-post-avatar {
    width: 28px;
    height: 28px;
}

.post-share-dropdown .share-dropdown-section-title {
    padding: 0.2rem 0.75rem 0.1rem;
}

.post-share-dropdown .share-post-recipients {
    max-height: 220px;
}

.post-share-dropdown .share-dropdown-section + .share-dropdown-section {
    margin-top: 0.15rem;
    padding-top: 0.15rem;
}

.post-share-dropdown .share-dropdown-loading,
.post-share-dropdown .share-dropdown-empty {
    padding: 0.75rem;
    color: var(--color-text-secondary);
    font-size: var(--font-size-sm);
}

.post-share-dropdown .share-dropdown-item {
    display: block;
    box-sizing: border-box;
    width: 100%;
    margin: 0;
    border-top: 1px solid var(--color-border-light);
    padding: 0.4rem 0.75rem;
    border-radius: 0;
}

.post-card:has(.post-share-dropdown.show) {
    overflow: visible;
    z-index: 5;
}

.post-send-wrap .post-share-dropdown {
    left: auto;
    right: 0;
    min-width: 220px;
    max-width: min(280px, calc(100vw - 2rem));
    overflow: hidden;
    padding: 0.35rem 0;
}

.post-share-dropdown .share-dropdown-body {
    overflow-x: hidden;
}

/* Репост: заголовок и блок оригинала */
.post-repost-header {
    padding: 0.35rem var(--post-pad-x) 0;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
}
.post-repost-header .post-repost-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}
.post-repost-header [data-lucide] {
    width: 0.9rem;
    height: 0.9rem;
}
.post-original-block {
    margin: 0.5rem var(--post-pad-x) 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--color-bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--color-border, rgba(0,0,0,0.08));
}
.post-original-author {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: var(--font-weight-medium);
    margin-bottom: 0.35rem;
}
.post-original-avatar {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    object-fit: cover;
}
.post-original-avatar-placeholder {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-bg-tertiary);
    color: var(--color-text-secondary);
}
.post-original-avatar-placeholder [data-lucide] {
    width: 14px;
    height: 14px;
}
.post-original-snippet {
    margin: 0.35rem 0 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    line-height: 1.4;
}
.post-original-block .post-original-content {
    margin-top: 0.5rem;
}
/* Медиа в посте — как в Threads: своя ширина (не на всю колонку), слева, радиус 12px */
.post-card .post-images-wrap[data-media-count] {
    margin-bottom: 0;
    overflow: visible;
    background: transparent;
}
.post-original-block .post-images-wrap[data-media-count] {
    margin-bottom: 0.5rem;
}
.post-card .post-images-wrap[data-media-count="1"] {
    display: block;
}

/* Галерея как в Threads: горизонтальный скролл, без превью снизу */
.post-media-gallery {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
    max-width: 100%;
}

.post-media-track {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    /* snap только через JS — иначе при отпускании мыши CSS mandatory даёт рывок */
    scroll-snap-type: none;
    scroll-behavior: auto;
    scroll-padding-inline: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    cursor: grab;
    /* pan-y нужен, иначе на мобиле жест по галерее не скроллит страницу */
    touch-action: pan-x pan-y;
}

.post-media-track.is-dragging {
    cursor: grabbing;
    user-select: none;
}

.post-media-track img,
.post-media-track video {
    -webkit-user-drag: none;
    user-select: none;
}

.post-media-track::-webkit-scrollbar {
    display: none;
}

.post-media-slide {
    display: block;
    flex: 0 0 auto;
    width: fit-content;
    max-width: min(100%, 22.5rem);
}

.post-media-gallery .post-media-slide .post-image,
.post-media-gallery .post-media-slide .post-video {
    margin: 0;
    width: fit-content;
    max-width: min(100%, 22.5rem);
    height: min(70vh, 520px);
    aspect-ratio: auto !important;
    background-color: var(--color-bg-tertiary);
    border-radius: 8px;
    overflow: hidden;
}

.post-media-gallery .post-media-slide .post-image:not(.post-image--loaded):not([data-w]),
.post-media-gallery .post-media-slide .post-video:not(.post-video--loaded):not([data-w]) {
    width: min(100%, 16rem);
    height: min(70vh, 520px);
    aspect-ratio: auto;
    min-height: 0;
}

.post-media-gallery .post-media-slide .post-image.post-image--loaded,
.post-media-gallery .post-media-slide .post-video.post-video--loaded {
    min-height: 0;
}

.post-media-gallery .post-media-slide .post-image img,
.post-media-gallery .post-media-slide .post-video video {
    display: block;
    width: auto;
    height: min(70vh, 520px);
    max-width: min(100vw, 22.5rem);
    max-height: min(70vh, 520px);
    object-fit: cover;
    object-position: center;
}

.post-media-dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    min-height: 8px;
    padding: 0.15rem 0 0;
}

.post-media-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-border, #3f3f46);
    opacity: 0.7;
}

.post-media-dot.is-active {
    background: var(--color-text-secondary, #a1a1aa);
    opacity: 1;
}


.post-card .post-images-wrap[data-media-count="1"] > .post-audio {
    width: 100%;
}

.post-card .post-media-gallery .post-image,
.post-card .post-media-gallery .post-video {
    margin: 0;
    width: fit-content;
    max-width: 100%;
    border-radius: 8px;
    overflow: hidden;
    min-height: 0;
    background: var(--color-bg-tertiary);
}

.post-card .post-images-wrap[data-media-count] .post-image,
.post-card .post-images-wrap[data-media-count] .post-video {
    margin: 0;
    width: fit-content;
    max-width: min(100%, 22.5rem);
    border-radius: 8px;
    overflow: hidden;
    min-height: 0;
    justify-self: start;
    background: var(--color-bg-tertiary);
}

.post-card .post-images-wrap[data-media-count] .post-video {
    aspect-ratio: auto;
    max-width: 100%;
    position: relative;
}
.post-card .post-images-wrap[data-media-count="1"] .post-video {
    max-width: 100%;
}
.post-card .post-images-wrap[data-media-count] .post-image img,
.post-card .post-images-wrap[data-media-count] .post-video video {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, 22.5rem);
    max-height: min(70vh, 520px);
    object-fit: contain;
}

/* Плейсхолдер до загрузки (размер неизвестен) */
.post-card .post-images-wrap[data-media-count="1"] > .post-image:not(.post-image--loaded):not([data-w]),
.post-card .post-images-wrap[data-media-count="1"] > .post-video:not(.post-video--loaded):not([data-w]) {
    width: min(100%, 20rem);
    aspect-ratio: 4 / 5;
    min-height: 120px;
}

.post-card .post-images-wrap[data-media-count="1"] > .post-image,
.post-card .post-images-wrap[data-media-count="1"] > .post-video {
    background-color: var(--color-bg-tertiary);
}

.post-card .post-images-wrap[data-media-count="1"] > .post-image.post-image--loaded,
.post-card .post-images-wrap[data-media-count="1"] > .post-video.post-video--loaded {
    min-height: 0;
}

.post-card .post-images-wrap[data-media-count="1"] > .post-image img,
.post-card .post-images-wrap[data-media-count="1"] > .post-video video {
    width: auto;
    height: auto;
    max-width: min(100%, 22.5rem);
    max-height: min(70vh, 520px);
    object-fit: contain;
}
.post-card .post-images-wrap[data-media-count] .post-video video {
    display: block;
    width: auto;
    height: auto;
    max-width: min(100%, 22.5rem);
    max-height: min(70vh, 520px);
    object-fit: contain;
}

/* Карусель 2+: фиксированная высота ряда, peek следующего фото */
.post-card .post-media-gallery[data-media-count] .post-media-slide .post-image,
.post-card .post-media-gallery[data-media-count] .post-media-slide .post-video {
    height: min(70vh, 520px);
    max-width: min(100%, 22.5rem);
    aspect-ratio: auto !important;
}
.post-card .post-media-gallery[data-media-count] .post-media-slide .post-image img,
.post-card .post-media-gallery[data-media-count] .post-media-slide .post-video video {
    width: auto;
    height: min(70vh, 520px);
    max-width: min(100vw, 22.5rem);
    max-height: min(70vh, 520px);
    object-fit: cover;
}
.post-card .post-images-wrap[data-media-count] .post-audio,
.post-card .post-media-gallery .post-audio {
    width: 100%;
    aspect-ratio: auto;
    min-height: 0;
}
.post-card .post-images-wrap--audio,
.post-card .post-images-wrap--audio[data-media-count] {
    overflow: visible;
}
/* Блок «+N» при более чем 10 медиа (пост и репост) */
.post-images-more,
.post-original-block .post-images-wrap .post-original-more,
.post-original-more {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    color: var(--color-text-secondary);
    padding: 0.5rem;
    background: var(--color-bg-tertiary);
}

.post-original-block .post-audio {
    margin: 0.5rem auto;
    width: min(100%, 400px);
    border-radius: var(--radius-xl);
}
.post-original-block .post-link-preview {
    margin-top: 0.5rem;
}
.post-original-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--color-primary);
    text-decoration: none;
}
.post-original-link:hover {
    color: var(--color-primary-hover);
    text-decoration: none;
}

/* Контент поста: один padding снаружи + gap между блоками (без margin-наложений) */
.post-content {
    padding: var(--post-pad-y) var(--post-pad-x);
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.post-content > .post-images-wrap,
.post-card .post-content > .post-images-wrap[data-media-count],
.post-content > .post-text,
.post-content > .post-link-preview,
.post-content > .post-audio,
.post-content > .post-audio--ios,
.post-content > .post-content-meta,
.post-content > .post-poll {
    margin-top: 0;
    margin-bottom: 0;
}

.post-content > .post-text + .post-content-meta,
.post-content > .post-content-meta + .post-text {
    margin-top: 0;
}

/* Контейнер комментариев: без padding, пока пустой (лента/профиль) */
.post-comment {
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
    padding: 0;
}

.post-comment:has(.comments-section),
.post-comment:has(.comment-form),
.post-comment:has(.post-comments-disabled) {
    padding: 0.75rem var(--post-pad-x) var(--post-pad-y);
    border-top: 1px solid var(--color-border-light);
}

.post-category {
    background-color: var(--color-bg-secondary);
    color: var(--color-text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
}

.post-image,
.post-video {
    overflow: hidden;
    margin-bottom: 1rem;
    background-color: var(--color-bg-secondary);
}

/* GIF / animation — без controls */
.post-video--gif video {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
    cursor: default;
    pointer-events: none;
}

/* Обычное видео в ленте — autoplay + нативные controls */
.post-video--autoplay video,
.post-card .post-video--autoplay video[data-autoplay="1"] {
    display: block;
    max-width: 100%;
    width: auto;
    height: auto;
}


.post-image--gif img {
    cursor: default;
}


/* Аудиоплеер в посте — по центру, со скруглением */
.post-audio--ios {
    margin-bottom: 0.625rem;
}

.post-content > .post-audio--ios,
.post-card .post-images-wrap .post-audio--ios,
.post-card .post-media-gallery .post-audio--ios {
    margin-left: auto;
    margin-right: auto;
    width: min(100%, 400px);
    border-radius: var(--radius-md);
}

.post-card .post-images-wrap--audio {
    display: flex;
    justify-content: center;
    padding: 0.25rem 0;
}

.post-card .post-images-wrap .post-audio--ios {
    margin-bottom: 0;
}

.post-video video {
    display: block;
    max-width: 100%;
    max-height: min(85vh, 920px);
    width: auto;
    height: auto;
    vertical-align: middle;
}

/* Полноэкранный режим — нативный через controls браузера */
.post-video:fullscreen,
.post-video:-webkit-full-screen {
    width: 100%;
    height: 100%;
    background: #000;
    margin: 0;
}
.post-video:fullscreen video,
.post-video:-webkit-full-screen video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}

.post-image,
.post-image img,
.post-image-view {
    cursor: pointer;
}

.post-image img,
.post-image-view {
    display: block;
    max-width: 100%;
    max-height: min(85vh, 920px);
    width: auto;
    height: auto;
    transition: transform var(--transition-slow);
}

.post-image img:hover,
.post-image-view:hover {
    transform: scale(1.02);
}

.post-images-wrap {
    margin-bottom: 0;
}

.post-text {
    font-size: var(--font-size-reading);
    line-height: var(--line-height-relaxed);
    color: var(--color-text-primary);
    margin: 0;
    padding: 0;
    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: break-word;
    text-indent: 0;
    min-width: 0;
    max-width: 100%;
}

.post-text .post-text-link {
    color: var(--link-color);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.18em;
    text-decoration-color: color-mix(in srgb, var(--link-color) 55%, transparent);
    word-break: break-all;
    overflow-wrap: anywhere;
}

.post-text .post-text-link:hover {
    color: var(--link-color-hover);
    text-decoration-color: var(--link-color-hover);
}

.post-text .post-text-hashtag {
    color: var(--link-color);
    text-decoration: none;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.post-text .post-text-mention {
    font-weight: inherit;
    text-decoration: none;
}

.post-text .post-text-hashtag:hover,
.post-text .post-text-mention:hover {
    color: var(--link-color-hover);
    text-decoration: none;
}

/* Форматирование как в Telegram */
.post-text .post-text-bold { font-weight: 500; }
.post-text .post-text-italic { font-style: italic; }
.post-text .post-text-underline { text-decoration: underline; }
.post-text .post-text-strikethrough { text-decoration: line-through; }
.post-text .post-text-code {
    font-family: var(--font-family-mono);
    font-size: 0.9em;
    background: var(--color-bg-secondary);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
}
.post-text .post-text-spoiler {
    background: var(--color-text-secondary);
    color: var(--color-text-secondary);
    border-radius: 3px;
    padding: 0 3px;
    cursor: pointer;
    user-select: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.post-text .post-text-spoiler:hover,
.post-text .post-text-spoiler.spoiler-revealed {
    background: transparent;
    color: inherit;
}

/* Та же разметка в сообщениях и комментариях */
.message-body .post-text-bold,
.comment-content .post-text-bold { font-weight: 500; }
.message-body .post-text-italic,
.comment-content .post-text-italic { font-style: italic; }
.message-body .post-text-underline,
.comment-content .post-text-underline { text-decoration: underline; }
.message-body .post-text-strikethrough,
.comment-content .post-text-strikethrough { text-decoration: line-through; }
.message-body .post-text-code,
.comment-content .post-text-code {
    font-family: var(--font-family-mono);
    font-size: 0.9em;
    background: var(--color-bg-secondary);
    padding: 0.15em 0.4em;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border-light);
}
.message-mine .message-body .post-text-code {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}
.message-body .post-text-spoiler,
.comment-content .post-text-spoiler {
    background: var(--color-text-secondary);
    color: var(--color-text-secondary);
    border-radius: 3px;
    padding: 0 3px;
    cursor: pointer;
    user-select: none;
}
.message-mine .message-body .post-text-spoiler {
    background: rgba(255, 255, 255, 0.45);
    color: rgba(255, 255, 255, 0.45);
}
.message-body .post-text-spoiler:hover,
.message-body .post-text-spoiler.spoiler-revealed,
.comment-content .post-text-spoiler:hover,
.comment-content .post-text-spoiler.spoiler-revealed {
    background: transparent;
    color: inherit;
}

/* Сокращённый длинный текст + «Читать далее» */
.post-text--with-expand {
    margin: 0 0 1rem;
    /* иначе переносы/отступы в HTML между preview и кнопкой рисуются как пустые строки */
    white-space: normal;
}
.post-text--with-expand .post-text-preview,
.post-text--with-expand .post-text-full {
    margin: 0;
    white-space: pre-wrap;
}
.post-text--with-expand .post-text-full {
    display: none;
}
.post-text--with-expand.is-expanded .post-text-preview,
.post-text--with-expand.is-expanded .post-text-expand-btn {
    display: none !important;
}
.post-text--with-expand.is-expanded .post-text-full {
    display: block;
}
.post-text-expand-btn {
    display: inline-block;
    margin: 0.25rem 0 0;
    padding: 0;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--color-primary);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    width: 100%;
    text-align: right;
}
.post-text-expand-btn:hover {
    color: var(--color-primary-hover);
    text-decoration: none;
}

/* Панель действий — два sibling-блока:
 *   .post-action-buttons — просмотры / комменты / репост / …
 *   .post-reactions-wrap — ряд эмодзи
 */
.post-actions {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0 var(--post-pad-x) 0.65rem;
    user-select: none;
    -webkit-user-select: none;
}

.post-action-buttons,
.post-actions-inner {
    display: block;
    width: 100%;
    min-width: 0;
    border-top: 1px solid var(--color-border-light);
    padding: 0.5rem 0;
}

.post-action-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    width: 100%;
    padding: 0;
}

.post-action-main .post-action-views,
.post-action-main .post-action-btn,
.post-action-main .post-bookmark-btn,
.post-action-main .post-action-repost-count,
.post-action-main .post-action-forwards-count,
.post-action-main .post-send-wrap {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    white-space: nowrap;
}

.post-reactions-wrap.post-reactions-readonly .post-reaction-btn {
    cursor: default;
}

/* ─── Настройки реакций (время, анимации) ─────────────────────────────────────
 * Ниже перечислено, за что отвечает каждый параметр.
 *
 * Бар и кнопки:
 *   .post-reaction-btn transition 0.25s / 0.35s — плавность фона и масштаба при наведении/активном состоянии.
 *   .post-reaction-more transition 0.2s / 0.25s — плавность кнопки «+» (больше реакций).
 *
 * Пикер (всплывающая панель с эмодзи):
 *   .reaction-picker-popover animation reaction-picker-in 0.35s — длительность появления пикера при открытии.
 *   .reaction-picker-item transition 0.25s / 0.2s — плавность наведения и фона у пунктов пикера.
 *
 * Взрыв частиц (burst) при постановке реакции:
 *   Canvas (#reaction-burst-root.reaction-burst-container) — физика в posts-reactions.js (rAF).
 * ─────────────────────────────────────────────────────────────────────────── */
.post-reactions-wrap {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0.65rem 0 0.35rem;
    border-top: 1px solid var(--color-border-light);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.post-reactions-wrap img {
    -webkit-touch-callout: none;
    pointer-events: none;
}

.post-action-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--color-text-secondary);
    font-size: var(--font-size-xs);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.post-action-btn:hover {
    background-color: var(--color-bg-secondary);
    color: var(--color-text-primary);
}

.post-action-btn.active,
.post-action-btn.like-btn.active {
    color: var(--color-primary);
}

.post-action-btn.active i,
.post-action-btn.like-btn.active i {
    color: var(--color-primary);
}

.post-action-btn i {
    transition: color var(--transition-fast);
}

.post-action-btn.comment-link {
    text-decoration: none;
}

.post-action-btn.comment-link:hover {
    text-decoration: none;
}

.post-action-views {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--color-text-secondary);
    font-size: var(--font-size-xs);
}


.post-reactions-bar {
    display: inline-flex;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.post-reaction-btn {
    display: inline-flex;
    flex-direction: row;
    flex-shrink: 0;
    align-items: center;
    gap: 0.3rem;
    min-height: 1.85rem;
    padding: 0.28rem 0.65rem;
    border-radius: 999px;
    border: none;
    background: var(--color-bg-secondary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition:
        background 0.2s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
        box-shadow 0.2s ease;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

.post-reaction-btn:hover {
    transform: scale(1.02);
}

.post-reaction-btn.active {
    background: color-mix(in srgb, var(--color-primary) 12%, var(--color-bg-tertiary));
}

/* Фиксированный размер контейнера эмодзи — один и тот же до и после подстановки img */
.post-reaction-btn .post-reaction-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.15rem;
    height: 1.15rem;
    flex-shrink: 0;
    font-size: 1.15rem;
    line-height: 1;
    transform-origin: center;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.post-reaction-btn .post-reaction-emoji picture,
.reaction-picker-item picture {
    display: inline-flex;
    line-height: 0;
}

.post-reaction-btn .post-reaction-emoji .emoji-tgs-wrap,
.post-reaction-btn .post-reaction-emoji .emoji-tgs-player,
.reaction-picker-item .emoji-tgs-wrap,
.reaction-picker-item .emoji-tgs-player {
    width: 1.15rem;
    height: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 1.05rem;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
}

.reaction-picker-item .emoji-tgs-wrap,
.reaction-picker-item .emoji-tgs-player {
    width: 1.55rem;
    height: 1.55rem;
    font-size: 1.4rem;
}

.emoji-tgs-player {
    contain: strict;
    pointer-events: none;
}

.emoji-tgs-player svg,
.emoji-tgs-player canvas {
    width: 100% !important;
    height: 100% !important;
    display: block;
}

.post-reaction-btn .post-reaction-emoji .emoji-reaction-img,
.post-reaction-btn .post-reaction-emoji picture .emoji-reaction-img {
    width: 1.15rem;
    height: 1.15rem;
    object-fit: contain;
    display: block;
    vertical-align: middle;
    pointer-events: none;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}

.reaction-picker-item .emoji-picker-emoji,
.reaction-picker-item picture .emoji-picker-emoji,
.reaction-picker-item .emoji-reaction-img,
.reaction-picker-item picture .emoji-reaction-img {
    width: 1.55rem;
    height: 1.55rem;
    object-fit: contain;
    display: block;
    pointer-events: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
    user-select: none;
    -webkit-user-select: none;
}

.post-reaction-btn:hover .post-reaction-emoji,
.post-reaction-btn.active .post-reaction-emoji {
    transform: scale(1.08);
}

/* Кнопка «больше реакций» — вровень с pill */
.post-reaction-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.85rem;
    height: 1.85rem;
    min-width: 1.85rem;
    min-height: 1.85rem;
    padding: 0;
    background: var(--color-bg-secondary);
    border: none;
    border-radius: 999px;
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.post-reaction-more:hover {
    background: var(--color-bg-tertiary);
    color: var(--color-text-primary);
    transform: scale(1.02);
}

/* При открытом пикере — не кликать ссылки/медиа в посте под пикером */
.post-card.reaction-picker-open::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 90;
    background: transparent;
    pointer-events: auto;
}
.post-card.reaction-picker-open .post-reactions-wrap {
    position: relative;
    z-index: 100;
}
.post-actions.reaction-picker-open .post-action-main {
    pointer-events: none;
}

/* Расширенный пикер реакций (при удержании / клике на +) */
.reaction-picker-popover {
    position: absolute;
    bottom: 75%;
    left: 50%;
    transform: translateX(-50%) translateY(-0.5rem);
    z-index: 101;
    padding: 1px 3px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    margin-bottom: -10x;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.reaction-picker-popover:not([hidden]) {
    display: block;
    /* 0.35s — длительность появления пикера реакций */
    animation: reaction-picker-in 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
@keyframes reaction-picker-in {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(0.5rem) scale(0.7);
    }
    70% {
        opacity: 1;
        transform: translateX(-50%) translateY(-0.6rem) scale(1.05);
    }
    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(-0.5rem) scale(1);
    }
}
.reaction-picker-grid {
    display: grid;
    grid-template-columns: repeat(5, 2.5rem);
    grid-auto-rows: 2.5rem;
    grid-auto-flow: row;
    gap: 0.25rem;
    width: calc(5 * 2.5rem + 4 * 0.25rem);
    max-width: 100%;
    overflow: visible;
    padding-bottom: 0;
    justify-content: center;
}
.reaction-picker-item {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    min-width: 2.5rem;
    height: 2.5rem;
    font-size: 1.55rem;
    background: none;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.2s ease,
                filter 0.2s ease;
    filter: drop-shadow(0 0 0 transparent);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
.reaction-picker-item:hover {
    background: var(--color-bg-secondary);
    transform: scale(1.2);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.15));
}
.reaction-picker-item.active {
    background: var(--color-bg-tertiary);
    background: color-mix(in srgb, var(--color-primary) 12%, var(--color-bg-tertiary));
}

/* Canvas-слой разлёта реакций (физика в posts-reactions.js) */
.reaction-burst-container {
    position: fixed;
    pointer-events: none;
    z-index: 9999;
    display: block;
}

.post-reaction-count {
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--color-text-secondary);
}

.post-reaction-btn.active .post-reaction-count {
    color: var(--color-text-primary);
}

.post-bookmark-btn {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.post-bookmark-btn:hover {
    color: var(--color-primary);
}

.post-bookmark-btn.active {
    color: var(--color-primary);
}

/* Lucide bookmark: заполненная иконка при активной закладке */
.post-bookmark-btn.active svg {
    fill: currentColor;
    stroke: currentColor;
}

.post-action-btn:disabled,
.post-bookmark-btn:disabled,
.post-reaction-btn:disabled {
    cursor: wait;
    opacity: 0.8;
}

/* Иконки в посте — единый размер */
.post-actions [data-lucide] svg,
.post-actions .lucide {
    font-size: 0.95rem;
}

.post-action-btn i,
.post-bookmark-btn i {
    font-size: 0.95rem;
}

/* Реакции на ПК: те же pill-пропорции, чуть крупнее */
@media (min-width: 769px) {
    .post-reaction-btn {
        min-height: 2rem;
        padding: 0.3rem 0.75rem;
        gap: 0.35rem;
        font-size: 1.05rem;
    }
    .post-reaction-btn .post-reaction-emoji {
        width: 1.3rem;
        height: 1.3rem;
        font-size: 1.3rem;
    }
    .post-reaction-btn .post-reaction-emoji .emoji-tgs-wrap,
    .post-reaction-btn .post-reaction-emoji .emoji-tgs-player {
        width: 1.3rem;
        height: 1.3rem;
        font-size: 1.2rem;
    }
    .post-reaction-btn .post-reaction-emoji .emoji-reaction-img,
    .post-reaction-btn .post-reaction-emoji picture .emoji-reaction-img {
        width: 1.3rem;
        height: 1.3rem;
    }
    .reaction-picker-item .emoji-picker-emoji,
    .reaction-picker-item picture .emoji-picker-emoji,
    .reaction-picker-item .emoji-reaction-img,
    .reaction-picker-item picture .emoji-reaction-img {
        width: 1.65rem;
        height: 1.65rem;
    }
    .reaction-picker-item .emoji-tgs-wrap,
    .reaction-picker-item .emoji-tgs-player {
        width: 1.65rem;
        height: 1.65rem;
        font-size: 1.5rem;
    }
    .post-reaction-more {
        width: 1.9rem;
        height: 1.9rem;
        min-width: 1.9rem;
        min-height: 1.9rem;
        font-size: 1rem;
    }
    .reaction-picker-grid {
        grid-template-columns: repeat(5, 2.65rem);
        grid-auto-rows: 2.65rem;
        width: calc(5 * 2.65rem + 4 * 0.25rem);
    }
    .reaction-picker-item {
        width: 2.65rem;
        min-width: 2.65rem;
        height: 2.65rem;
        font-size: 1.65rem;
    }
    .post-reaction-count {
        font-size: 0.8125rem;
    }
}

.feed-phase-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0 0.75rem;
    padding: 0 0.25rem;
    color: var(--text-muted, #888);
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.feed-phase-divider::before,
.feed-phase-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color, rgba(128, 128, 128, 0.25));
}

.feed-phase-divider span {
    flex-shrink: 0;
}
