/* ==========================================================================
   XP_VIEWER.CSS — окно «Просмотр записи» (ui_posts.js → openLightbox)
   --------------------------------------------------------------------------
   Слева — фото в духе «Просмотра изображений и факсов Windows» (лента
   миниатюр, круглые кнопки внизу) и текст записи; справа — автор,
   «Мне нравится» и обсуждение. Без фото текст лежит «листом» как в
   WordPad. На телефоне всё в одну колонку, поле ввода прилипает к низу.

   Классы свои (xpv-*): старые правила #lightbox/.xp-post-window из
   style.css и мобильное скрытие .xp-title-bar сюда не дотягиваются.
   Подключается после xp_pages.css, до xp_chrome.css.
   ========================================================================== */

/* --- Подложка и блокировка прокрутки страницы --- */
html.xpv-lock,
html.xpv-lock body { overflow: hidden !important; }

#lightbox {
    background: rgba(0, 12, 48, 0.55) !important;
    padding: 16px !important;
}

/* ==========================================================================
   ОКНО
   ========================================================================== */
.xpv-win {
    position: relative;
    display: flex;
    flex-direction: column;
    width: min(1180px, calc(100vw - 32px));
    height: min(880px, calc(100vh - 32px));
    background: #ece9d8;
    border: 3px solid #0831d9;
    border-top: 0;
    border-radius: 8px 8px 0 0 !important;
    box-shadow: 0 0 0 1px rgba(0, 20, 90, 0.4), 4px 8px 28px rgba(0, 0, 0, 0.5);
    font-family: Tahoma, sans-serif;
    font-size: 12px;
    color: #000;
    animation: xpv-in 0.16s ease-out;
    overflow: hidden;
}
@keyframes xpv-in { from { opacity: 0; transform: scale(0.97); } to { opacity: 1; transform: none; } }

.xpv-win.xpv-max {
    position: fixed;
    inset: 0;
    width: auto;
    height: auto;
    border-width: 0;
    border-radius: 0 !important;
}
.xpv-win.xpv-max .xpv-title { border-radius: 0 !important; }

/* --- Заголовок --- */
.xpv-title {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    flex-shrink: 0;
    padding: 0 5px 0 7px;
    background: linear-gradient(180deg, #0997ff 0%, #0053ee 8%, #0050ee 40%, #0066ff 88%, #0066ff 93%, #005bff 95%, #003dd7 96%, #003dd7 100%);
    border-radius: 7px 7px 0 0 / 8px 8px 0 0 !important;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
    color: #fff;
    font: bold 13px "Trebuchet MS", Tahoma, sans-serif;
    text-shadow: 1px 1px 0 #0f1089;
    user-select: none;
    cursor: default;
}
.xpv-title-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h7l3.5 3.5v9.5H2.5z' fill='%23fff' stroke='%237d8ea8'/%3E%3Cpath d='M9.5 1.5V5H13' fill='%23e6edf7' stroke='%237d8ea8' stroke-linejoin='round'/%3E%3Crect x='4' y='7' width='7' height='5' fill='%2359a3ee' stroke='%232d6bc4' stroke-width='.6'/%3E%3Cpath d='M4.3 11.7l2.2-2.4 1.6 1.4 1.2-1 1.4 2z' fill='%235fbb34'/%3E%3C/svg%3E") no-repeat center / 16px 16px;
    filter: drop-shadow(1px 1px 0 rgba(0, 0, 40, 0.35));
}
.xpv-title-text { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.xpv-tb-btn {
    width: 21px;
    height: 21px;
    padding: 0;
    flex-shrink: 0;
    border: 1px solid #fff;
    border-radius: 3px !important;
    cursor: pointer;
    background-repeat: no-repeat;
    box-shadow: inset -1px -1px 1px rgba(0, 0, 60, 0.45), inset 1px 1px 1px rgba(255, 255, 255, 0.55);
}
.xpv-tb-btn:hover { filter: brightness(1.15); }
.xpv-tb-btn:active { filter: brightness(0.9); box-shadow: inset 1px 1px 2px rgba(0, 0, 50, 0.6); }
.xpv-tb-max { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 21 21'%3E%3Cpath d='M5 5h11v11H5z' fill='none' stroke='%23fff' stroke-width='1.4'/%3E%3Crect x='5' y='4.3' width='11' height='2.6' fill='%23fff'/%3E%3C/svg%3E"), linear-gradient(135deg, #6c9cf8 0%, #2f6bea 38%, #1652d8 70%, #1a4ec4 100%); }
.xpv-win.xpv-max .xpv-tb-max { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 21 21'%3E%3Cpath d='M8 4.5h8.5V13' fill='none' stroke='%23fff' stroke-width='1.4'/%3E%3Crect x='8' y='3.8' width='8.5' height='2.2' fill='%23fff'/%3E%3Cpath d='M4.5 8h8.5v8.5H4.5z' fill='none' stroke='%23fff' stroke-width='1.4'/%3E%3Crect x='4.5' y='7.3' width='8.5' height='2.2' fill='%23fff'/%3E%3C/svg%3E"), linear-gradient(135deg, #6c9cf8 0%, #2f6bea 38%, #1652d8 70%, #1a4ec4 100%); }
.xpv-tb-close { margin-left: 2px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 21 21'%3E%3Cpath d='M6 6l9 9M15 6l-9 9' stroke='%23fff' stroke-width='2.2' stroke-linecap='square'/%3E%3C/svg%3E"), linear-gradient(135deg, #f4a184 0%, #e3633b 38%, #d0441b 70%, #b8360f 100%); }

/* --- Адресная строка --- */
.xpv-addr {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 3px 6px;
    border-top: 1px solid #fff;
    border-bottom: 1px solid #c5c2b2;
}
.xpv-addr-label { font-size: 11px; color: #3d3d3d; }
.xpv-addr-box {
    flex: 1;
    display: flex;
    align-items: center;
    height: 22px;
    padding: 0 4px;
    background: #fff;
    border: 1px solid #7f9db9;
    min-width: 0;
}
.xpv-addr-icon {
    width: 16px;
    height: 16px;
    margin-right: 4px;
    flex-shrink: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 1.5h7l3 3v10h-10z' fill='%23fff' stroke='%237d8ea8'/%3E%3Cpath d='M9.5 1.5v3h3' fill='%23e6edf7' stroke='%237d8ea8'/%3E%3Cpath d='M4.5 7h6M4.5 9h6M4.5 11h4' stroke='%239cb3d6'/%3E%3C/svg%3E") no-repeat center / 16px 16px;
}
.xpv-addr-input {
    flex: 1;
    min-width: 0;
    border: 0 !important;
    outline: none;
    background: transparent;
    font: 11px Tahoma, sans-serif;
    color: #000;
}

/* ==========================================================================
   ТЕЛО: слева запись, справа обсуждение
   ========================================================================== */
.xpv-body {
    flex: 1;
    min-height: 0;
    display: flex;
    margin: 0 3px;
    border: 1px solid;
    border-color: #a5a191 #fff #fff #a5a191;
    background: #fff;
}

.xpv-main {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
}

/* --- Фото --- */
.xpv-win:not(.xpv-has-media) .xpv-media { display: none; }

.xpv-media {
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #f7f7f7 0%, #ececec 100%);
    border-bottom: 1px solid #d4d0c8;
}

.xpv-stage {
    position: relative;
    display: flex;
    height: min(64vh, 640px);
    padding: 14px;
    overflow: auto;
    touch-action: pan-y pinch-zoom;
}
.xpv-win.xpv-max .xpv-stage { height: min(74vh, 980px); }

/* Глобальное `img { max-height: 450px !important; height: auto !important }`
   из style.css тут перебиваем: картинка вписывается в сцену. margin: auto
   центрирует маленькое фото и даёт прокрутку большому в режиме 1:1. */
.xpv-stage .xpv-photo {
    margin: auto;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    background: #fff;
    border: 1px solid #b4b4b4;
    box-shadow: 2px 3px 8px rgba(0, 0, 0, 0.22);
    cursor: zoom-in;
    user-select: none;
    -webkit-user-drag: none;
    transition: transform 0.2s ease-out;
}
.xpv-stage .xpv-photo.xpv-actual {
    max-width: none !important;
    max-height: none !important;
    cursor: zoom-out;
}

.xpv-nav {
    position: absolute;
    top: 50%;
    width: 40px;
    height: 40px;
    margin-top: -20px;
    padding: 0;
    border: 1px solid #17620d;
    border-radius: 50% !important;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M15 5.5 8.5 12l6.5 6.5' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat center / 22px 22px,
                radial-gradient(circle at 35% 28%, #d2f7b8 0%, #55c435 50%, #1b7410 100%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 2;
}
.xpv-nav-prev { left: 10px; }
.xpv-nav-next { right: 10px; transform: scaleX(-1); }
.xpv-stage:hover .xpv-nav,
.xpv-nav:focus-visible { opacity: 0.92; }
.xpv-nav:hover { opacity: 1; filter: brightness(1.08); }
@media (hover: none) { .xpv-nav { opacity: 0.85; } }

/* --- Лента миниатюр --- */
.xpv-filmstrip {
    display: flex;
    gap: 6px;
    padding: 0 10px 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
}
.xpv-filmstrip:empty { display: none; }
.xpv-thumb {
    flex: 0 0 auto;
    width: 58px;
    height: 58px;
    padding: 2px;
    border: 1px solid #b4b4b4;
    background: #fff;
    cursor: pointer;
    opacity: 0.75;
}
.xpv-thumb:hover { opacity: 1; border-color: #7f9db9; }
.xpv-thumb.active {
    opacity: 1;
    border-color: #316ac5;
    box-shadow: 0 0 0 2px #316ac5;
}
.xpv-thumb img {
    width: 52px !important;
    height: 52px !important;
    max-height: none !important;
    object-fit: cover !important;
}

/* --- Панель кнопок (как у «Просмотра изображений и факсов») --- */
.xpv-toolbar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-height: 42px;
    padding: 4px 10px;
    background: linear-gradient(180deg, #fbfbfd 0%, #e6ebf5 100%);
    border-top: 1px solid #c9d2e3;
}
.xpv-tool {
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50% !important;
    background-color: transparent;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 22px 22px;
    cursor: pointer;
}
.xpv-tool:hover { border-color: #8ea9d6; background-color: #fff; box-shadow: 0 1px 2px rgba(0, 30, 90, 0.2); }
.xpv-tool:active { background-color: #dbe5f6; box-shadow: inset 0 1px 2px rgba(0, 30, 90, 0.3); }
.xpv-tool:disabled { opacity: 0.35; cursor: default; border-color: transparent; background-color: transparent; box-shadow: none; }
.xpv-tool.active { border-color: #316ac5; background-color: #dbe5f6; }
.xpv-tool-sep { width: 1px; height: 22px; margin: 0 4px; background: #c5cde0; box-shadow: 1px 0 0 #fff; }

.xpv-tool-prev { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3CradialGradient id='g' cx='35%25' cy='28%25' r='80%25'%3E%3Cstop offset='0' stop-color='%23c9f7b4'/%3E%3Cstop offset='.42' stop-color='%2355c435'/%3E%3Cstop offset='1' stop-color='%231b7410'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='12' cy='12' r='10.3' fill='url(%23g)' stroke='%2317620d'/%3E%3Cpath d='M5.6 12 12.4 5.8v3.9h5.8v4.6h-5.8v3.9z' fill='%23fff' stroke='%231c6b12' stroke-width='.7' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.xpv-tool-next { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3CradialGradient id='g' cx='35%25' cy='28%25' r='80%25'%3E%3Cstop offset='0' stop-color='%23c9f7b4'/%3E%3Cstop offset='.42' stop-color='%2355c435'/%3E%3Cstop offset='1' stop-color='%231b7410'/%3E%3C/radialGradient%3E%3C/defs%3E%3Ccircle cx='12' cy='12' r='10.3' fill='url(%23g)' stroke='%2317620d'/%3E%3Cpath d='M18.4 12 11.6 5.8v3.9H5.8v4.6h5.8v3.9z' fill='%23fff' stroke='%231c6b12' stroke-width='.7' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.xpv-tool-fit { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3.5' y='4.5' width='17' height='15' fill='%23fff' stroke='%234a5f8a'/%3E%3Ctext x='12' y='15.6' text-anchor='middle' font-family='Tahoma,Arial' font-weight='bold' font-size='8' fill='%232f5fcf'%3E1:1%3C/text%3E%3C/svg%3E"); }
.xpv-tool-full { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3.5' y='5.5' width='17' height='13' fill='%23cfe2ff' stroke='%234a5f8a'/%3E%3Cpath d='M5.5 10V7.5H8M16 7.5h2.5V10M18.5 14v2.5H16M8 16.5H5.5V14' fill='none' stroke='%232f5fcf' stroke-width='1.6'/%3E%3C/svg%3E"); }
.xpv-tool-rotl { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7.5 9.5a6 6 0 1 1-.8 6' fill='none' stroke='%232f5fcf' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M3.6 5.6l.6 5.4 5.2-1.6z' fill='%232f5fcf'/%3E%3C/svg%3E"); }
.xpv-tool-rotr { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M16.5 9.5a6 6 0 1 0 .8 6' fill='none' stroke='%232f5fcf' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M20.4 5.6l-.6 5.4-5.2-1.6z' fill='%232f5fcf'/%3E%3C/svg%3E"); }
.xpv-tool-open { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='3.5' y='6.5' width='13' height='13' fill='%23fff' stroke='%234a5f8a'/%3E%3Cpath d='M11 13l9-9M14 4h6v6' fill='none' stroke='%232f5fcf' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }

.xpv-counter {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 11px;
    color: #4a5466;
}

/* --- Во весь экран (щелчок по фото) --- */
.xpv-win.xpv-zoom .xpv-media {
    position: fixed;
    inset: 0;
    z-index: 3;
    background: #0d0f14;
    border: 0;
}
.xpv-win.xpv-zoom .xpv-stage { flex: 1; height: auto; padding: 8px; }
.xpv-win.xpv-zoom .xpv-photo { border: 0; box-shadow: none; background: transparent; cursor: zoom-out; }
.xpv-win.xpv-zoom .xpv-toolbar { background: rgba(20, 24, 34, 0.92); border-top-color: #2a3142; }
.xpv-win.xpv-zoom .xpv-tool:hover { background-color: rgba(255, 255, 255, 0.12); border-color: #4b5873; }
.xpv-win.xpv-zoom .xpv-counter { color: #c9d1e3; }
.xpv-win.xpv-zoom .xpv-tool-sep { background: #3a4357; box-shadow: none; }
.xpv-win.xpv-zoom .xpv-filmstrip { background: transparent; }
.xpv-win.xpv-zoom .xpv-tool-full { background-color: rgba(255, 255, 255, 0.15); border-color: #6b7da6; }

/* --- Текст записи --- */
.xpv-doc {
    padding: 14px 18px 20px;
    font-size: 13px;
    line-height: 1.6;
    color: #111;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.xpv-text:empty { display: none; }
.xpv-text img { max-width: 100% !important; }
.xpv-text .xp-read-more-link { font-size: 12px; }

/* Без фото — «лист» как в WordPad */
.xpv-win.xpv-text-only .xpv-main {
    background: #ece9d8;
    padding: 18px 16px;
}
.xpv-win.xpv-text-only .xpv-doc {
    max-width: 760px;
    min-height: 58%;
    margin: 0 auto;
    padding: 26px 30px 30px;
    background: #fff;
    font-size: 14px;
    line-height: 1.65;
    box-shadow: 0 0 0 1px #a7a28c, 3px 3px 0 #b9b4a2, 4px 5px 14px rgba(0, 0, 0, 0.12);
}

.xpv-loading,
.xpv-empty {
    padding: 22px 12px;
    text-align: center;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.5;
}
.xpv-empty .xpi { display: block; margin: 0 auto 8px; opacity: 0.8; }
.xpv-empty.xpv-err { color: #b3170f; }

.xpv-linkprev:empty { display: none; }
.xpv-linkprev .link-preview { margin-top: 10px; }

.xpv-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 14px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #dfe5f2;
    font: bold 12px Tahoma, sans-serif;
    color: #215dc6;
}

.xpv-audio-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 6px;
    border-bottom: 1px solid #eef0f5;
}
.xpv-audio-row:hover { background: #f3f7ff; }
.xpv-audio-row .xpv-audio-btn {
    width: 28px;
    height: 28px;
    min-width: 28px;
    padding: 0;
    border: 1px solid #1a3d8f;
    border-radius: 50% !important;
    background: radial-gradient(circle at 35% 28%, #d9e8ff 0%, #6d9cf2 42%, #2556cc 78%, #1a3d8f 100%);
    color: #fff;
    font-family: "Segoe UI Symbol", "DejaVu Sans", Tahoma, sans-serif;
    font-size: 11px;
    font-variant-emoji: text;
    text-shadow: 0 1px 1px rgba(0, 0, 50, 0.5);
    box-shadow: 0 1px 2px rgba(0, 20, 80, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
    cursor: pointer;
    line-height: 1;
}
.xpv-audio-meta { min-width: 0; line-height: 1.3; }
.xpv-audio-title { font-weight: bold; color: #0e44b8; font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.xpv-audio-artist { color: #444; font-size: 11px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.xpv-poll { margin-top: 12px !important; }

.xpv-repost-note {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 10px;
    background: #eef3fd;
    border: 1px solid #c3d3f2;
    font-size: 12px;
    color: #2a3e66;
}
.xpv-repost-note.xpv-warn { background: #fff6e6; border-color: #e7c88a; color: #6b4a00; }

.xpv-btn {
    min-height: 23px;
    padding: 2px 12px;
    border: 1px solid #003c74;
    border-radius: 3px !important;
    background: linear-gradient(180deg, #ffffff 0%, #f3f2ec 40%, #e6e3d6 85%, #d6d0c0 100%);
    font: 11px Tahoma, sans-serif;
    color: #000;
    cursor: pointer;
}
.xpv-btn:hover { box-shadow: inset 0 0 0 2px #f8b636, inset 0 -2px 0 #e5a01a; }

/* ==========================================================================
   ПРАВАЯ ПАНЕЛЬ: автор, «Мне нравится», обсуждение
   ========================================================================== */
.xpv-side {
    width: 380px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #fff;
    border-left: 1px solid #9db1d6;
}
.xpv-win.xpv-image-only .xpv-side,
.xpv-win.xpv-image-only .xpv-doc,
.xpv-win.xpv-image-only .xpv-addr { display: none; }

.xpv-author {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: linear-gradient(90deg, #ffffff 0%, #dbe5f9 100%);
    border-bottom: 1px solid #c3d3f2;
}
.xpv-author-ava {
    display: inline-flex;
    flex-shrink: 0;
    text-decoration: none !important;
}
.xpv-author-ava img {
    width: 44px !important;
    height: 44px !important;
    max-height: none !important;
    object-fit: cover !important;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px #9db1d6, 0 2px 5px rgba(0, 20, 80, 0.3);
    background: #fff;
}
#xp-post-avatar { display: none !important; }   /* старый id — только для совместимости */
.xpv-ava-frame { display: inline-flex; }
.xpv-ava-frame img { border: 0; box-shadow: none; }
.xpv-author-info { min-width: 0; }
.xpv-author-name {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    max-width: 100%;
    font: bold 14px "Trebuchet MS", Tahoma, sans-serif;
    color: #0e44b8 !important;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.xpv-author-name:hover { text-decoration: underline; }
.xpv-date { margin-top: 2px; font-size: 11px; color: #5b6475; }
.xpv-online {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    background: #2fa832;
    box-shadow: 0 0 0 1px #fff, 0 0 3px rgba(47, 168, 50, 0.8);
}

.xpv-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-bottom: 1px solid #e3e7f0;
    background: #fbfcfe;
}
.xpv-like-zone { display: flex; }
.xpv-like-zone:empty { display: none; }

.xpv-like,
.xpv-act {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 3px 12px;
    border: 1px solid #003c74;
    border-radius: 3px !important;
    background: linear-gradient(180deg, #ffffff 0%, #f3f2ec 40%, #e6e3d6 85%, #d6d0c0 100%);
    font: 11px Tahoma, sans-serif;
    color: #000;
    cursor: pointer;
    white-space: nowrap;
}
.xpv-like:hover,
.xpv-act:hover { box-shadow: inset 0 0 0 2px #f8b636, inset 0 -2px 0 #e5a01a; }
.xpv-like:active,
.xpv-act:active { background: linear-gradient(180deg, #d6d0c0 0%, #e6e3d6 30%, #f3f2ec 100%); }
.xpv-act-icon { padding: 3px 8px; margin-left: auto; }
.xpv-heart { font-size: 14px; line-height: 1; color: #9aa1ad; transition: transform 0.15s; }
.xpv-like.liked {
    background: linear-gradient(180deg, #fff6f6 0%, #ffe3e3 100%);
    border-color: #a31515;
    color: #8f1010;
    font-weight: bold;
    box-shadow: inset 1px 1px 2px rgba(120, 0, 0, 0.15);
}
.xpv-like.liked .xpv-heart { color: #e02424; transform: scale(1.12); }
.xpv-like-n { font-weight: bold; }

.xpv-disc-head {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 7px 12px;
    background: linear-gradient(90deg, #ffffff 0%, #c6d3f7 100%);
    border-bottom: 1px solid #b9c9ee;
    font: bold 12px Tahoma, sans-serif;
    color: #215dc6;
}
.xpv-disc-head .xpi { width: 18px; height: 18px; }
#xpv-ccount { font-weight: normal; color: #3a5592; }

.xpv-comments {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
}

/* --- Комментарий --- */
.xpv-c {
    display: flex;
    gap: 9px;
    padding: 8px 12px 7px calc(12px + var(--xpv-depth, 0) * 22px);
    border-bottom: 1px solid #eef0f5;
}
.xpv-c:hover { background: #f5f8ff; }
.xpv-c-ava {
    display: inline-flex;
    flex-shrink: 0;
    align-self: flex-start;
    text-decoration: none !important;
}
.xpv-c-ava img {
    width: 32px !important;
    height: 32px !important;
    max-height: none !important;
    object-fit: cover !important;
    border: 1px solid #fff;
    box-shadow: 0 0 0 1px #b9c3d6;
    background: #fff;
}
.xpv-c-reply .xpv-c-ava img { width: 26px !important; height: 26px !important; }
.xpv-c-ava[class*="store-"] img { border: 0; box-shadow: none; }
.xpv-c-main { flex: 1; min-width: 0; }
.xpv-c-head {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}
.xpv-c-name {
    font-weight: bold;
    font-size: 12px;
    color: #0e44b8 !important;
    text-decoration: none;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.xpv-c-name:hover { text-decoration: underline; }
.xpv-c-time { margin-left: auto; padding-left: 6px; font-size: 10px; color: #8a909c; white-space: nowrap; flex-shrink: 0; }
.xpv-c-text {
    margin-top: 2px;
    font-size: 12.5px;
    line-height: 1.45;
    color: #15181f;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}
.xpv-c-tools {
    display: flex;
    align-items: center;
    gap: 2px;
    margin-top: 4px;
    margin-left: -6px;
}
.xpv-c-like,
.xpv-c-link {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    min-height: 22px;
    padding: 1px 6px;
    border: 1px solid transparent;
    border-radius: 3px !important;
    background: transparent;
    font: 11px Tahoma, sans-serif;
    color: #6b7280;
    cursor: pointer;
}
.xpv-c-link { color: #215dc6; }
.xpv-c-like:hover,
.xpv-c-link:hover { background: #eef3fd; border-color: #c3d3f2; }
.xpv-c-like.liked { color: #d21f1f; font-weight: bold; background: #fff0f0; border-color: #f3c4c4; }
.xpv-c-icon { color: #6b7280; padding: 1px 4px; opacity: 0.7; }
.xpv-c-icon:hover { opacity: 1; }
.xpv-c-icon .xpi { width: 14px; height: 14px; }

/* --- Полоса «Ответ для …» и поле ввода --- */
.xpv-reply {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    padding: 5px 8px 5px 12px;
    background: #ffffe1;
    border-top: 1px solid #e3d78c;
    font-size: 11px;
    color: #4a4220;
}
.xpv-reply[hidden] { display: none; }
.xpv-reply span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.xpv-reply-x {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: #6b5d1e;
    cursor: pointer;
}
.xpv-reply-x:hover { border-color: #c9b75a; background: #fff8c4; }

.xpv-compose {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
    padding: 8px;
    background: #ece9d8;
    border-top: 1px solid #c5c2b2;
    box-shadow: inset 0 1px 0 #fff;
}
.xpv-input {
    flex: 1;
    min-width: 0;
    height: 30px;
    padding: 0 8px;
    border: 1px solid #7f9db9;
    background: #fff;
    font: 12px Tahoma, sans-serif;
    color: #000;
    outline: none;
}
.xpv-input:focus { border-color: #316ac5; box-shadow: 0 0 0 1px rgba(49, 106, 197, 0.25); }
.xpv-send {
    height: 30px;
    padding: 0 14px;
    border: 1px solid #1d5e14;
    border-radius: 3px !important;
    background: linear-gradient(180deg, #7fd06f 0%, #4fa646 12%, #3f9a36 50%, #34882c 85%, #2c7a25 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
    font: bold 11px Tahoma, sans-serif;
    color: #fff;
    text-shadow: 1px 1px 0 rgba(0, 40, 0, 0.55);
    cursor: pointer;
}
.xpv-send:hover { filter: brightness(1.08); }
.xpv-send:active { box-shadow: inset 1px 2px 3px rgba(0, 0, 0, 0.35); }
.xpv-send:disabled { filter: grayscale(0.6) opacity(0.7); cursor: default; }

/* --- Строка состояния --- */
.xpv-status {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
    padding: 2px 3px 3px;
    font-size: 11px;
}
.xpv-status > span {
    padding: 1px 6px;
    border: 1px solid;
    border-color: #a5a191 #fff #fff #a5a191;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.xpv-status > span:first-child { flex: 1; }
.xpv-status > span:last-child:empty { display: none; }

/* ==========================================================================
   ЛЕНТА: вход в окно записи
   ========================================================================== */
.post-open-tool {
    cursor: pointer;
    opacity: 0.65;
    line-height: 1;
}
.post-open-tool:hover { opacity: 1; }
a.post-date-link {
    color: var(--xp-text-muted, #555) !important;
    text-decoration: none;
    cursor: pointer;
}
a.post-date-link:hover { color: #215dc6 !important; text-decoration: underline; }

/* ==========================================================================
   ЛЕНТА: обсуждение под записью (кнопка «Комментарии»)
   --------------------------------------------------------------------------
   Ветка раскрывается прямо под постом: те же карточки, что в окне, только
   компактнее. Длинное обсуждение свёрнуто до последних веток, «Открыть
   в окне» показывает запись целиком.
   ========================================================================== */
.post-comments-section.xpc {
    margin-top: 8px;
    padding: 0 !important;
    background: #fff !important;
    border: 1px solid #b9c9ee !important;
    box-shadow: none !important;
    animation: xpc-in 0.14s ease-out;
}
@keyframes xpc-in { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.xpc-head {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 2px 4px 2px 10px;
    background: linear-gradient(90deg, #ffffff 0%, #c6d3f7 100%);
    border-bottom: 1px solid #b9c9ee;
}
.xpc-title {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font: bold 11px Tahoma, sans-serif;
    color: #215dc6;
}
.xpc-title .xpi { width: 16px; height: 16px; }
.xpc-count { font-weight: normal; color: #3a5592; }

.xpc-open {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    min-height: 22px;
    padding: 1px 8px;
    border: 1px solid transparent;
    border-radius: 3px !important;
    background: transparent;
    font: 11px Tahoma, sans-serif;
    color: #0e44b8;
    cursor: pointer;
    white-space: nowrap;
}
.xpc-open .xpi { width: 16px; height: 16px; }
.xpc-open:hover { background: #fff; border-color: #8ea9d6; box-shadow: 0 1px 2px rgba(0, 30, 90, 0.2); }
.xpc-open:active { background: #dbe5f6; box-shadow: inset 0 1px 2px rgba(0, 30, 90, 0.3); }

.xpc-list .xpv-c { padding: 6px 10px 5px calc(10px + var(--xpv-depth, 0) * 20px); }
.xpc-list .xpv-c:last-child { border-bottom: 0; }
.xpc-list .xpv-c-ava img { width: 28px !important; height: 28px !important; }
.xpc-list .xpv-c-reply .xpv-c-ava img { width: 24px !important; height: 24px !important; }
.xpc-list .xpv-c-text { font-size: 12px; }
.xpc-list .xpv-c-tools { margin-top: 2px; }
.xpc-list .xpv-loading,
.xpc-list .xpv-empty { padding: 12px; }

.xpc-empty {
    padding: 12px 10px;
    font-size: 11px;
    color: #6b7280;
}

.xpc-more {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 10px;
    border: 0;
    border-bottom: 1px solid #e3e7f0;
    background: #f5f8ff;
    font: 11px Tahoma, sans-serif;
    color: #215dc6;
    text-align: left;
    cursor: pointer;
}
.xpc-more .xpi { width: 16px; height: 16px; }
.xpc-more:hover { background: #e8effd; text-decoration: underline; }

.xpc-reply {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    background: #ffffe1;
    border-top: 1px solid #e3d78c;
    font-size: 11px;
    color: #4a4220;
}
.xpc-reply[hidden] { display: none; }
.xpc-reply .xpi { width: 16px; height: 16px; }
.xpc-reply span { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.xpc-reply-x {
    width: 20px;
    height: 20px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: #6b5d1e;
    cursor: pointer;
}
.xpc-reply-x:hover { border-color: #c9b75a; background: #fff8c4; }

.comment-input-row.xpc-compose {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px;
    background: #f4f3ee;
    border-top: 1px solid #e3e7f0;
}
.xpc-me {
    width: 26px !important;
    height: 26px !important;
    max-height: none !important;
    object-fit: cover !important;
    flex-shrink: 0;
    border: 1px solid #fff;
    box-shadow: 0 0 0 1px #b9c3d6;
}
.xpc-input.input-field {
    flex: 1;
    min-width: 0;
    height: 28px;
    margin: 0;
    padding: 0 7px;
    border: 1px solid #7f9db9 !important;
    font: 12px Tahoma, sans-serif;
}
.xpc-input.input-field:focus { border-color: #316ac5 !important; box-shadow: 0 0 0 1px rgba(49, 106, 197, 0.2); }
.xpc-send {
    height: 28px;
    flex-shrink: 0;
    padding: 0 12px;
    border: 1px solid #1d5e14;
    border-radius: 3px !important;
    background: linear-gradient(180deg, #7fd06f 0%, #4fa646 12%, #3f9a36 50%, #34882c 85%, #2c7a25 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
    font: bold 11px Tahoma, sans-serif;
    color: #fff;
    text-shadow: 1px 1px 0 rgba(0, 40, 0, 0.55);
    cursor: pointer;
}
.xpc-send:hover { filter: brightness(1.08); }
.xpc-send:active { box-shadow: inset 1px 2px 3px rgba(0, 0, 0, 0.35); }
.xpc-send:disabled { filter: grayscale(0.6) opacity(0.7); cursor: default; }

/* Кнопка «Комментарии» в подвале поста, пока ветка раскрыта — «нажата» */
.like-btn-style.is-open {
    background: linear-gradient(180deg, #e3e0d3 0%, #f1efe7 100%) !important;
    box-shadow: inset 1px 1px 3px rgba(0, 0, 0, 0.18) !important;
}

@media screen and (max-width: 768px) {
    .xpc-head { min-height: 36px; padding: 2px 4px 2px 10px; }
    .xpc-title { font-size: 12px; }
    .xpc-open { min-height: 32px; padding: 2px 10px; font-size: 12px; border-color: #c3d3f2; background: rgba(255, 255, 255, 0.6); }
    .xpc-list .xpv-c { padding: 8px 10px 6px calc(10px + var(--xpv-depth, 0) * 14px); }
    .xpc-list .xpv-c-text { font-size: 14px; }
    .xpc-more { padding: 10px; font-size: 13px; }
    .xpc-empty { font-size: 13px; }
    .xpc-reply { font-size: 12px; padding: 6px 6px 6px 10px; }
    .xpc-reply-x { width: 30px; height: 30px; }
    .xpc-me { display: none; }
    .xpc-input.input-field { height: 38px; font-size: 16px; }   /* < 16px — iOS зумит форму */
    .xpc-send { height: 38px; padding: 0 14px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .post-comments-section.xpc { animation: none; }
}

/* ==========================================================================
   СРЕДНИЕ ЭКРАНЫ
   ========================================================================== */
@media screen and (min-width: 769px) and (max-width: 1040px) {
    .xpv-side { width: 320px; }
    .xpv-stage { height: min(56vh, 520px); }
}

/* ==========================================================================
   ТЕЛЕФОН: одна колонка — фото, автор, текст, обсуждение; поле ввода внизу
   ========================================================================== */
@media screen and (max-width: 768px) {
    #lightbox { padding: 0 !important; }

    .xpv-win,
    .xpv-win.xpv-max {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        border: 0;
        border-radius: 0 !important;
        box-shadow: none;
        animation: none;
    }
    .xpv-title { height: 40px; border-radius: 0 !important; font-size: 14px; }
    .xpv-tb-btn { width: 32px; height: 32px; background-size: 100% 100%; }
    .xpv-tb-max,
    .xpv-addr,
    .xpv-status { display: none !important; }

    /* Тело — одна прокручиваемая колонка. Колонки-обёртки «растворяются»
       (display: contents), а порядок задаёт order. */
    .xpv-body {
        flex-direction: column;
        margin: 0;
        border: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
        background: #fff;
    }
    .xpv-main,
    .xpv-side { display: contents; }

    .xpv-media       { order: 1; flex-shrink: 0; }
    .xpv-author      { order: 2; flex-shrink: 0; }
    .xpv-actions     { order: 3; flex-shrink: 0; }
    .xpv-doc         { order: 4; flex-shrink: 0; }
    .xpv-disc-head   { order: 5; flex-shrink: 0; }
    .xpv-comments    { order: 6; flex: 1 0 auto; overflow: visible; min-height: 90px; }
    .xpv-reply       { order: 7; position: sticky; bottom: 58px; z-index: 2; }
    .xpv-compose {
        order: 8;
        position: sticky;
        bottom: 0;
        z-index: 2;
        margin-top: auto;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
    }

    /* Сцена по высоте фото (не выше 62% экрана) — без серых полей вокруг
       горизонтального снимка. Листают свайпом и кнопками внизу, поэтому
       круглые стрелки поверх фото на телефоне не нужны. */
    .xpv-stage { height: auto; min-height: 160px; max-height: 62vh; padding: 8px; }
    .xpv-stage .xpv-photo { max-height: calc(62vh - 18px) !important; }
    .xpv-nav { display: none; }
    .xpv-win.xpv-zoom .xpv-stage { max-height: none; }
    .xpv-win.xpv-zoom .xpv-stage .xpv-photo { max-height: 100% !important; }
    .xpv-tool { width: 38px; height: 38px; background-size: 24px 24px; }
    .xpv-tool-fit,
    .xpv-tool-open,
    .xpv-tool-sep { display: none; }
    .xpv-counter { right: 10px; font-size: 12px; }

    .xpv-thumb { width: 52px; height: 52px; }
    .xpv-thumb img { width: 46px !important; height: 46px !important; }

    .xpv-doc { padding: 12px 14px 16px; font-size: 14px; }
    .xpv-win.xpv-text-only .xpv-main { padding: 0; }
    .xpv-win.xpv-text-only .xpv-doc {
        margin: 10px;
        padding: 18px 16px;
        min-height: 0;
        font-size: 15px;
    }
    /* «Лист» на сером поле: подложка под текстом-only записью */
    .xpv-win.xpv-text-only .xpv-body { background: #ece9d8; }
    .xpv-win.xpv-text-only .xpv-comments { background: #fff; }

    .xpv-author { padding: 10px 12px; }
    .xpv-actions { flex-wrap: wrap; padding: 8px 10px; }
    .xpv-like,
    .xpv-act { min-height: 36px; padding: 4px 14px; font-size: 13px; }
    .xpv-heart { font-size: 17px; }

    .xpv-disc-head { padding: 9px 12px; font-size: 13px; }
    .xpv-c { padding: 10px 12px 8px calc(12px + var(--xpv-depth, 0) * 16px); }
    .xpv-c-text { font-size: 14px; }
    .xpv-c-name { font-size: 13px; }
    .xpv-c-time { font-size: 11px; }
    .xpv-c-like,
    .xpv-c-link { min-height: 30px; padding: 2px 9px; font-size: 12px; }
    .xpv-c-icon .xpi { width: 16px; height: 16px; }

    .xpv-input { height: 40px; font-size: 16px; }   /* < 16px — iOS зумит форму */
    .xpv-send { height: 40px; padding: 0 16px; font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .xpv-win { animation: none !important; }
    .xpv-stage .xpv-photo,
    .xpv-heart { transition: none !important; }
}
