/* --- Бесконечная подгрузка: sentinel, лоадер, конец ленты --- */
.janyzak-social-wrapper #feed-sentinel {
    height: 1px;
    width: 100%;
    pointer-events: none;
}
.janyzak-social-wrapper .feed-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 22px 0 calc(28px + env(safe-area-inset-bottom, 0px));
}
.janyzak-social-wrapper .feed-loader[hidden] { display: none; }
.janyzak-social-wrapper .feed-end {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 16px 20px calc(34px + env(safe-area-inset-bottom, 0px));
}
.janyzak-social-wrapper .feed-end[hidden] { display: none; }

/* --- Вкладки на странице поста (Ответы / От автора / Популярное) --- */
.janyzak-social-wrapper .pp-tabs {
    display: flex;
    /* Одна разделительная линия снизу (верхнюю убрали — её даёт нижний бордер карточки поста) */
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-color);
}
.janyzak-social-wrapper .pp-tab {
    flex: 1 1 0;
    padding: 14px 6px;
    border: none;
    background: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    position: relative;
    transition: color 0.2s;
}
.janyzak-social-wrapper .pp-tab:hover { color: var(--text-primary); }
.janyzak-social-wrapper .pp-tab.active { color: var(--text-primary); }
/* Короткое аккуратное подчёркивание активной вкладки — одинаковое под каждой из трёх */
.janyzak-social-wrapper .pp-tab.active::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    bottom: -1px;
    width: 26px;
    height: 3px;
    border-radius: 3px;
    background: var(--text-primary);
}
.janyzak-social-wrapper .pp-tab-count {
    opacity: 0.6;
    font-weight: 500;
}
.janyzak-social-wrapper .pp-panel[hidden] { display: none; }
.janyzak-social-wrapper .pp-panel .post-extra-list .thread-item:first-child { border-top: none; }


/* --- Скелетон загрузки ленты --- */
.janyzak-social-wrapper .skeleton-item {
    cursor: default;
    pointer-events: none;
}

.janyzak-social-wrapper .skeleton-item:hover {
    background: transparent;
}

.janyzak-social-wrapper .skeleton {
    position: relative;
    overflow: hidden;
    background: var(--input-bg);
    border-radius: 6px;
}

.janyzak-social-wrapper .skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.08),
        transparent
    );
    animation: janyzak-skeleton-shimmer 1.3s infinite;
}

.janyzak-social-wrapper[data-theme="light"] .skeleton::after {
    background: linear-gradient(
        90deg,
        transparent,
        rgba(0, 0, 0, 0.06),
        transparent
    );
}

.janyzak-social-wrapper .skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.janyzak-social-wrapper .skeleton-line {
    height: 15px; /* как текст карточки (.thread-text 15px) */
    margin: 8px 0;
}

.janyzak-social-wrapper .skeleton-line.short {
    width: 55%;
}

.janyzak-social-wrapper .skeleton-name {
    width: 38%;
    height: 15px; /* как .username 15px */
    margin: 4px 0 0;
}

/* Скелетон для комментариев (ответов) */
.janyzak-social-wrapper .reply-item.skeleton-item .skeleton-avatar {
    width: 32px;
    height: 32px;
}

.janyzak-social-wrapper .reply-item.skeleton-item .skeleton-name {
    width: 30%;
    margin: 0 0 8px;
}

/* Скелетон для полного текста поста в попапе/на странице.
   Размер строк как у самого текста (.detail-main-text 16px), 4px между строками. */
.janyzak-social-wrapper .skeleton-text {
    pointer-events: none;
    white-space: normal; /* отменяем pre-wrap от .thread-text, иначе пробелы между строками дают большие зазоры */
    margin-bottom: 12px;
}

.janyzak-social-wrapper .skeleton-text .skeleton-line {
    height: 16px;
    margin: 0 0 4px;
}

.janyzak-social-wrapper .skeleton-text .skeleton-line:last-child {
    margin-bottom: 0;
}

@keyframes janyzak-skeleton-shimmer {
    100% {
        transform: translateX(100%);
    }
}
.janyzak-social-wrapper .profile-header {
    padding-left: 20px;
    padding-right: 10px;
    padding-top: 16px;
    display: flex;
    justify-content: space-between; /* Оставляет элементы по краям (слева и справа) */
    align-items: center; /* <-- ИСПРАВЛЕНО: выравнивает их по вертикальному центру */
    gap: 20px;
}

.janyzak-social-wrapper .profile-header .avatar {
    margin-top: 8px;
    margin-bottom: 8px;
    margin-right: 12px;
}

.janyzak-social-wrapper .profile-info h1 {
    font-size: 26px;
    margin-bottom: 10px;
}

.janyzak-social-wrapper .profile-bio {
    color: var(--text-secondary);
    line-height: 1.5;
}

.janyzak-social-wrapper .profile-divider {
    height: 1px;
    background: var(--border-color);
}

/* --- Avatar --- */
.janyzak-social-wrapper .avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--avatar-bg);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    text-transform: uppercase;
    flex-shrink: 0;
}

.janyzak-social-wrapper .avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.janyzak-social-wrapper .avatar-lg {
    width: 80px;
    height: 80px;
    font-size: 32px;
}

.janyzak-social-wrapper .avatar-xl,
.janyzak-social-wrapper .profile-header .avatar,
.janyzak-social-wrapper .profile-header .avatar-lg {
    width: 50px !important;
    height: 50px !important;
    font-size: 20px !important;
}

@media (max-width: 640px) {
    .janyzak-social-wrapper .avatar-xl,
    .janyzak-social-wrapper .profile-header .avatar,
    .janyzak-social-wrapper .profile-header .avatar-lg {
        width: 40px !important;
        height: 40px !important;
        font-size: 16px !important;
    }
}

/* --- Modals --- */
.janyzak-social-wrapper .modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
    z-index: 200;
}

.janyzak-social-wrapper #modal-login {
    z-index: 10000 !important;
}

@media (max-width: 640px) {
    .janyzak-social-wrapper #modal-login .modal-window {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        max-height: 100% !important;
        border-radius: 0 !important;
        border: none !important;
    }
    
    .janyzak-social-wrapper #modal-login {
        align-items: flex-end;
    }
}

.janyzak-social-wrapper .modal-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.janyzak-social-wrapper .modal-window {
    width: 100%;
    max-width: 560px;
    background: var(--modal-bg);
    border-radius: 24px 24px 0 0;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transform: translateY(24px);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.16,1,0.3,1), opacity 0.3s;
    position: relative;
    overflow: hidden;
}

.janyzak-social-wrapper .modal-backdrop.active .modal-window {
    transform: translateY(0);
    opacity: 1;
}

@media (min-width: 640px) {
    .janyzak-social-wrapper .modal-window {
        border-radius: 24px;
        max-height: 80vh;
    }
}

@media (max-width: 640px) {
    .janyzak-social-wrapper .modal-window {
        border-radius: 0;
        border: none;
        height: 100%;
        max-height: 100%;
    }
}

.janyzak-social-wrapper .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    position: sticky;
    top: 0;
    background: var(--modal-bg);
    z-index: 2;
}

.janyzak-social-wrapper .modal-body {
    padding: 20px;
    overflow-y: auto;
}

.janyzak-social-wrapper #detail-view {
    padding: 0;
}

.janyzak-social-wrapper #detail-view > div {
    border-top: none;
}

.janyzak-social-wrapper .modal-footer {
    border-top: none;
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--modal-bg);
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
}

.janyzak-social-wrapper .modal-sheet {
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.janyzak-social-wrapper .modal-sheet .modal-body {
    flex: 1;
}

.janyzak-social-wrapper .name-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.janyzak-social-wrapper .name-form-body {
    padding: 20px;
}

.janyzak-social-wrapper .name-form #login-name,
.janyzak-social-wrapper .name-form .clean-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-primary);
    font-size: 16px;
    outline: none;
    font-family: inherit;
    text-align: center;
    font-weight: 600;
    transition: border-color 0.2s, background 0.2s;
}

.janyzak-social-wrapper .name-form #login-name:focus,
.janyzak-social-wrapper .name-form .clean-input:focus {
    border-color: var(--text-secondary);
    background: var(--bg-color);
}

.janyzak-social-wrapper .name-form .btn-primary {
    background: var(--text-primary);
    color: var(--bg-color);
    border: none;
    padding: 12px 24px;
    border-radius: 999px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

.janyzak-social-wrapper .name-form .btn-primary:hover {
    opacity: 0.9;
}

.janyzak-social-wrapper .name-form .btn-primary:active {
    opacity: 0.8;
}

.janyzak-social-wrapper .modal-note {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.janyzak-social-wrapper .btn-post {
    background: var(--text-primary);
    color: var(--bg-color);
    border: none;
    padding: 8px 16px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
}

.janyzak-social-wrapper .cancel-btn,
.janyzak-social-wrapper .close-btn {
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 15px;
}

.janyzak-social-wrapper .create-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* --- Счетчик символов --- */
.janyzak-social-wrapper .char-counter {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 0 4px;
    transition: color 0.2s;
}

.janyzak-social-wrapper .char-counter-warning {
    color: #f59e0b;
}

.janyzak-social-wrapper .char-counter-error {
    color: #ef4444;
}

.janyzak-social-wrapper .comment-char-counter {
    margin-top: 4px;
    margin-bottom: 8px;
    font-size: 11px;
}

.janyzak-social-wrapper .post-input,
.janyzak-social-wrapper .reply-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 16px;
    resize: none;
    outline: none;
    font-family: inherit;
}

.janyzak-social-wrapper .reply-input {
    flex: 1;
    padding: 4px 0;
    line-height: 1.4;
    min-height: 20px;
    max-height: 120px;
    overflow-y: auto;
    height: auto;
    font-size: 15px;
}

.janyzak-social-wrapper .reply-input-container {
    display: flex;
    width: 100%;
    align-items: flex-end;
    background: var(--input-bg);
    border-radius: 22px;
    padding: 8px 14px;
    gap: 8px;
}

.janyzak-social-wrapper .reply-send-btn {
    border: none;
    background: none;
    color: var(--accent-color);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.janyzak-social-wrapper .reply-send-btn.active {
    opacity: 1;
}

.janyzak-social-wrapper .loader {
    position: absolute;
    inset: 0;
    background: var(--modal-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3;
}

.janyzak-social-wrapper .spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--text-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* --- Toast --- */
.janyzak-social-wrapper .toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translate(-50%, -150%);
    background: var(--text-primary);
    color: var(--bg-color);
    padding: 12px 20px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    font-size: 14px;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    z-index: 10000;
    max-width: calc(100% - 40px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
}

.janyzak-social-wrapper .toast i {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
}

.janyzak-social-wrapper .toast span {
    flex: 1;
    min-width: 0;
}

/* Типы уведомлений */
.janyzak-social-wrapper .toast.toast-success {
    background: #10b981;
    color: #ffffff;
}

.janyzak-social-wrapper .toast.toast-error {
    background: #ef4444;
    color: #ffffff;
}

.janyzak-social-wrapper .toast.toast-warning {
    background: #f59e0b;
    color: #ffffff;
}

.janyzak-social-wrapper .toast.toast-info {
    background: #3b82f6;
    color: #ffffff;
}

.janyzak-social-wrapper .toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
}

@media (max-width: 640px) {
    .janyzak-social-wrapper .toast {
        left: 16px;
        right: 16px;
        width: auto;
        max-width: none;
        transform: translate(0, -150%);
        font-size: 13px;
        padding: 14px 18px;
        top: 16px;
        border-radius: 10px;
    }
    
    .janyzak-social-wrapper .toast.show {
        transform: translate(0, 0);
    }
    
    .janyzak-social-wrapper .toast i {
        width: 16px;
        height: 16px;
    }
}

/* --- Helpers --- */
.janyzak-social-wrapper .hidden {
    display: none !important;
}

.janyzak-social-wrapper .detail-stats {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 12px;
}

.janyzak-social-wrapper .reply-item {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.janyzak-social-wrapper .error-text {
    color: var(--like-color);
    font-size: 14px;
    text-align: center;
    padding: 16px;
}

/* Стили для страницы поста (отдельная страница вместо модалки) */
.janyzak-social-wrapper .post-page-container {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 120px);
    background: var(--bg-color);
}

.janyzak-social-wrapper .post-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-color);
    z-index: 10;
}

.janyzak-social-wrapper .post-page-header .back-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: background 0.2s;
}

.janyzak-social-wrapper .post-page-header .back-btn:hover {
    background: var(--bg-input);
}

.janyzak-social-wrapper .post-page-header .post-page-title {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

.janyzak-social-wrapper .post-page-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
}

.janyzak-social-wrapper .main-view .post-page-content {
    padding: 0;
}

/* Композер ответа — теперь в потоке страницы (сразу после комментариев) */
.janyzak-social-wrapper .reply-compose {
    padding: 14px 16px 6px;
}

/* Единый блок-композер (как в чате): поле + низ в одной карточке */
.janyzak-social-wrapper .reply-compose .reply-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 18px;
    padding: 12px 14px;
}

/* Верхняя строка: поле «Ответить» слева, лимит символов справа сверху */
.janyzak-social-wrapper .reply-compose .reply-top {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.janyzak-social-wrapper .reply-compose .reply-top .reply-input {
    flex: 1;
}

.janyzak-social-wrapper .reply-compose .reply-top .char-counter {
    margin: 0;
    padding: 2px 0 0;
    flex-shrink: 0;
    white-space: nowrap;
    align-self: flex-start;
}

/* Нижняя строка: аватар слева, заметная кнопка «Отправить» справа */
.janyzak-social-wrapper .reply-compose .reply-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.janyzak-social-wrapper .reply-compose #comment-avatar-preview-page {
    flex-shrink: 0;
}

/* Заметная кнопка отправки */
.janyzak-social-wrapper .reply-compose .reply-send-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: var(--accent-color);
    color: var(--bg-color);
    cursor: pointer;
    opacity: 1;
    padding: 9px 14px;
    border-radius: 22px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    transition: opacity 0.2s, transform 0.1s;
}

.janyzak-social-wrapper .reply-compose .reply-send-btn:hover {
    opacity: 0.9;
}

.janyzak-social-wrapper .reply-compose .reply-send-btn:active {
    transform: scale(0.97);
}

.janyzak-social-wrapper .replies-container {
    margin-top: 16px;
}

.janyzak-social-wrapper .replies-label {
    padding-left: 20px;
    padding-top: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.janyzak-social-wrapper #detail-view .replies-label {
    padding-left: 20px;
    padding-top: 10px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
}

.janyzak-social-wrapper .main-view .replies-label {
    padding-right: 20px;
    padding-left: 20px;
    padding-top: 10px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 15px;
}

/* --- Post Page Styles --- */
.janyzak-social-wrapper .main-view .post-page-content {
    padding: 0;
}

.janyzak-social-wrapper .main-view .post-page-container {
    padding-bottom: 0;
}

.janyzak-social-wrapper .main-view .post-page-header {
    padding-top: 0;
}

.janyzak-social-wrapper .main-view .post-page-header span {
    padding-right: 11px;
}

.janyzak-social-wrapper .main-view .post-page-container {
    padding-bottom: 0;
    transform: translate(0, 0);
}

.janyzak-social-wrapper .main-view .post-page-header {
    padding-top: 0;
    margin-top: 0;
}

.janyzak-social-wrapper .main-view .post-page-header span {
    padding-right: 11px;
}

.janyzak-social-wrapper #comment-avatar-preview {
    width: 41px;
}

.janyzak-social-wrapper #comment-avatar-preview div {
    height: 41px !important;
    width: 41px !important;
}

/* Размер аватара в форме комментария задаётся в JS (htmlAvatar(..., 36)).
   Не переопределяем его здесь !important, иначе он перестаёт меняться из JS. */

/* --- Modal Post Detail --- */
.janyzak-social-wrapper #modal-post-detail {
    align-items: center;
}

@media (max-width: 640px) {
    .janyzak-social-wrapper #modal-post-detail .modal-window {
        width: 100% !important;
        max-width: 100%;
        max-height: 100%;
    }
    
    .janyzak-social-wrapper #modal-create-post .modal-window {
        width: 100% !important;
        height: 100% !important;
        max-width: 100%;
        max-height: 100%;
    }
}

@media (max-width: 600px) {
    .janyzak-social-wrapper #modal-post-detail .modal-window {
        height: 100%;
    }
}

/* Модалка анкеты знакомства — те же размеры/поведение, что у создания поста */
.janyzak-social-wrapper #modal-create-dating {
    align-items: center;
}

@media (max-width: 640px) {
    .janyzak-social-wrapper #modal-create-dating .modal-window {
        width: 100% !important;
        height: 100% !important;
        max-width: 100%;
        max-height: 100%;
    }

    /* На мобиле прячем заголовок «Анкета знакомства» в шапке модалки */
    .janyzak-social-wrapper #modal-create-dating .modal-header span {
        display: none;
    }
}

@media (max-width: 600px) {
    .janyzak-social-wrapper #modal-create-dating .modal-window {
        height: 100%;
    }
}

/* --- Global Styles (были специфичные для page-id-956) --- */
.janyzak-social-wrapper #modal-create-post {
    align-items: center;
}

.janyzak-social-wrapper #modal-create-post .create-body .user-preview-row,
.janyzak-social-wrapper #modal-create-dating .create-body .user-preview-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.janyzak-social-wrapper #modal-create-post .modal-header span {
    display: none;
}

.janyzak-social-wrapper .main-view > div {
    padding-top: 1px;
    border-top: none;
}

.janyzak-social-wrapper .main-view > div > div {
    margin-top: 0;
    margin-bottom: 0;
}

.janyzak-social-wrapper .main-view div .thread-item {
    margin-top: 0;
}

@media (max-width: 640px) {
    .janyzak-social-wrapper #janyzak-social-wrapper #modal-post-detail .modal-window {
        width: 100% !important;
    }
    
    .janyzak-social-wrapper #janyzak-social-wrapper #modal-create-post .modal-window {
        width: 100% !important;
        height: 100% !important;
    }
}

.janyzak-social-wrapper .main-view > div:nth-child(1) > div:nth-child(1) div:nth-child(2) {
    padding-bottom: 25px;
}

@media (max-width: 600px) {
    /* Не переопределяем размер текста первой карточки — он должен быть глобальным (16px). */
    .janyzak-social-wrapper .main-view > div:nth-child(1) > div:nth-child(1) div:nth-child(2) {
        padding-bottom: 25px;
    }
}

