/* ==========================================================================
   PORTAL COMMENTS — единый слой комментариев и реакций
   --------------------------------------------------------------------------
   Подключается после portal.css / portal_article.css / portal_lib.css /
   portal_skin_v2.css / mobile_styles.css, чтобы оформление комментариев,
   форм ответа и реакций было одинаковым на всех страницах портала:
   новости, библиотека, статьи, лендинг.
   ========================================================================== */

:root {
    --pc-gold-1: #f1d9a4;
    --pc-gold-2: #d8b46a;
    --pc-gold-3: #b8860b;
    --pc-ink: #f3ecdf;
    --pc-ink-2: #d2c7b8;
    --pc-muted: #a99a83;
    --pc-line: rgba(216, 180, 106, 0.22);
    --pc-line-strong: rgba(216, 180, 106, 0.55);
    --pc-panel: linear-gradient(180deg, rgba(54, 38, 23, 0.62), rgba(28, 18, 11, 0.46));
    --pc-panel-soft: rgba(0, 0, 0, 0.16);
    --pc-radius: 18px;
    --pc-radius-sm: 12px;
    --pc-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

/* --------------------------------------------------------------------------
   1. БЛОК КОММЕНТАРИЕВ
   -------------------------------------------------------------------------- */
.comments-block {
    margin-top: 28px;
    padding: 20px;
    border: 1px solid var(--pc-line);
    border-radius: var(--pc-radius);
    background: var(--pc-panel);
    box-shadow: var(--pc-shadow), inset 0 1px 0 rgba(255, 235, 190, 0.05);
}

/* Перебиваем box-shadow старого v2-скина, не трогая адаптивные отступы. */
body.portal-v2 .comments-block {
    box-shadow: var(--pc-shadow), inset 0 1px 0 rgba(255, 235, 190, 0.05);
}

.comments-block > h4 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 18px;
    padding: 0 0 12px;
    border-bottom: 1px solid var(--pc-line);
    color: var(--pc-gold-1);
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.25;
    text-transform: uppercase;
    opacity: 1;
}

.comments-block > h4::before {
    content: "💬";
    font-size: 16px;
    letter-spacing: 0;
    filter: drop-shadow(0 0 6px rgba(255, 215, 0, 0.25));
}

.comments-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 0;
}

.comments-list:not(:first-of-type) {
    margin-top: 4px;
}

.no-comments {
    margin: 0;
    padding: 28px 18px;
    border: 1px dashed var(--pc-line);
    border-radius: var(--pc-radius-sm);
    background: var(--pc-panel-soft);
    color: var(--pc-muted);
    text-align: center;
}

.comments-login {
    margin: 0 0 14px;
    color: var(--pc-muted);
}

.comments-login a {
    color: var(--pc-gold-1);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   2. КАРТОЧКА КОММЕНТАРИЯ
   -------------------------------------------------------------------------- */
.comment-item {
    position: relative;
    margin: 0;
    padding: 14px 16px;
    border: 1px solid rgba(216, 180, 106, 0.16);
    border-radius: var(--pc-radius-sm);
    background: linear-gradient(180deg, rgba(55, 38, 23, 0.55), rgba(27, 17, 10, 0.38));
    box-shadow: inset 0 1px 0 rgba(255, 235, 190, 0.04), 0 10px 26px rgba(0, 0, 0, 0.14);
    scroll-margin-top: 90px;
    transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.comment-item:hover {
    border-color: rgba(216, 180, 106, 0.36);
    background: linear-gradient(180deg, rgba(62, 43, 26, 0.62), rgba(30, 19, 11, 0.42));
}

.comment-item.is-reply {
    padding: 12px 14px;
    border-color: rgba(216, 180, 106, 0.12);
    background: rgba(0, 0, 0, 0.16);
    box-shadow: none;
}

.comment-item.is-reply:hover {
    background: rgba(0, 0, 0, 0.22);
}

.comment-item:target {
    border-color: var(--pc-gold-2);
    box-shadow: 0 0 0 2px rgba(241, 217, 164, 0.22), 0 0 30px rgba(216, 180, 106, 0.12);
}

.comment-item.is-new {
    animation: pc-comment-in 0.36s ease both;
}

.comment-item.editing {
    opacity: 0.82;
}

.comment-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.comment-avatar {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
}

.comment-avatar-link {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    text-decoration: none;
}

.comment-avatar-link:focus-visible {
    outline: 2px solid var(--pc-gold-2);
    outline-offset: 2px;
}

.comment-avatar .portal-avatar {
    width: 100%;
    height: 100%;
}

.comment-item.is-reply .comment-avatar {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
}

.comment-main {
    flex: 1 1 auto;
    min-width: 0;
}

/* --------------------------------------------------------------------------
   3. АВАТАР
   -------------------------------------------------------------------------- */
.portal-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, rgba(216, 180, 106, 0.3), rgba(42, 27, 15, 0.96) 70%);
    color: var(--pc-gold-1);
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
    overflow: visible;
}

.portal-avatar-initials {
    position: relative;
    z-index: 0;
}

.portal-avatar img {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(216, 180, 106, 0.5);
    border-radius: 50%;
    box-sizing: border-box;
    background: #1c120a;
    box-shadow: none;
    object-fit: cover;
    transform: none;
    transition: none;
}

/* Библиотечная типографика стилизует все .lib-content img — гасим её
   для аватара, иначе картинка съезжает с круга и получает чужую рамку. */
.portal-avatar img:hover {
    border-radius: 50%;
    box-shadow: none;
    transform: none;
}

.portal-avatar img.is-broken {
    display: none;
}

.portal-avatar-presence {
    position: absolute;
    right: -1px;
    bottom: -1px;
    z-index: 2;
    width: 12px;
    height: 12px;
    border: 2px solid #21150c;
    border-radius: 50%;
    background: #8a8072;
}

.portal-avatar-presence.is-online {
    background: #5fbf8a;
    box-shadow: 0 0 6px rgba(95, 191, 138, 0.8);
}

/* Уникальные образы: пульсирующее золотое свечение вокруг аватара. */
.portal-avatar.is-unique {
    isolation: isolate;
    animation: pc-unique-shadow 2.8s ease-in-out infinite;
}

.portal-avatar.is-unique::before {
    content: "";
    position: absolute;
    inset: -5px;
    z-index: -1;
    border-radius: 50%;
    background: conic-gradient(
        from 0deg,
        rgba(255, 215, 0, 0.05),
        rgba(255, 215, 0, 0.85),
        rgba(196, 101, 255, 0.7),
        rgba(76, 201, 240, 0.7),
        rgba(255, 215, 0, 0.05)
    );
    filter: blur(4px);
    opacity: 0.85;
    pointer-events: none;
    animation: pc-unique-spin 7s linear infinite;
}

.portal-avatar.is-unique::after {
    content: "";
    position: absolute;
    inset: -3px;
    border: 1px solid rgba(255, 240, 190, 0.75);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.6), 0 0 24px rgba(255, 140, 0, 0.3);
    pointer-events: none;
    animation: pc-unique-ring 2.8s ease-in-out infinite;
}

.portal-avatar-rarity {
    position: absolute;
    top: -5px;
    right: -5px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffe89a, #c98b18);
    color: #3a2408;
    font-size: 9px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 0 8px rgba(255, 215, 0, 0.8);
    pointer-events: none;
    animation: pc-unique-star 2.8s ease-in-out infinite;
}

/* --------------------------------------------------------------------------
   4. ШАПКА КОММЕНТАРИЯ
   -------------------------------------------------------------------------- */
.comment-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 4px;
}

.comment-author {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.comment-author .user-info-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comment-author .user-profile-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--pc-gold-1);
    font-size: 14.5px;
    font-weight: 700;
    line-height: 1.3;
    text-decoration: none;
}

.comment-author .user-profile-link:hover {
    color: #fff3cf;
    text-decoration: none;
}

/* Онлайн-статус уже показывает точка на аватаре. */
.comment-author .online-indicator {
    display: none;
}

.comment-author .user-game-link {
    font-size: 12px;
    opacity: 0.5;
}

.comment-author .user-game-link:hover {
    opacity: 1;
}

.comment-author .message-user-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid rgba(216, 180, 106, 0.18);
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.14);
    color: #d8c7a8;
    font-size: 11px;
    line-height: 1;
    text-decoration: none;
    opacity: 0.65;
    transition: opacity 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.comment-author .message-user-btn:hover {
    border-color: rgba(216, 180, 106, 0.4);
    background: rgba(216, 180, 106, 0.1);
    opacity: 1;
}

.comment-author .admin-badge {
    margin: 0;
    padding: 2px 6px;
    border: 1px solid rgba(255, 196, 90, 0.4);
    border-radius: 999px;
    background: rgba(255, 170, 0, 0.12);
    color: #ffcf70;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1.3;
    text-transform: uppercase;
}

.comment-author-deleted {
    color: var(--pc-muted);
    font-style: italic;
    font-weight: 600;
}

.comment-date {
    flex: 0 0 auto;
    padding-top: 2px;
    color: var(--pc-muted);
    font-size: 11.5px;
    line-height: 1.4;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   5. ССЫЛКА «ОТВЕТ НА КОММЕНТАРИЙ»
   -------------------------------------------------------------------------- */
.comment-reply-to {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 6px 0 8px;
    padding: 7px 10px;
    border-left: 2px solid rgba(216, 180, 106, 0.45);
    border-radius: 0 10px 10px 0;
    background: rgba(216, 180, 106, 0.055);
    color: var(--pc-muted);
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease;
}

.comment-reply-to:hover {
    border-left-color: var(--pc-gold-2);
    background: rgba(216, 180, 106, 0.1);
    text-decoration: none;
}

.comment-reply-to-icon {
    color: var(--pc-gold-2);
    font-size: 15px;
    line-height: 1.2;
}

.comment-reply-to-content {
    display: block;
    min-width: 0;
}

.comment-reply-to-label {
    display: block;
    font-size: 11.5px;
    line-height: 1.4;
}

.comment-reply-to-author {
    color: var(--pc-gold-1);
    font-weight: 700;
}

.comment-reply-to-author.is-deleted {
    color: var(--pc-muted);
    font-style: italic;
}

.comment-reply-to-excerpt {
    display: block;
    max-width: 100%;
    margin-top: 2px;
    overflow: hidden;
    color: #8f816e;
    font-size: 11.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   6. ТЕКСТ, ПОДПИСЬ, ДЕЙСТВИЯ
   -------------------------------------------------------------------------- */
.comment-body {
    margin: 2px 0 0;
    color: var(--pc-ink);
    font-size: 15px;
    line-height: 1.65;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.comment-item.is-reply .comment-body {
    font-size: 14.5px;
}

.comment-text > :first-child {
    margin-top: 0;
}

.comment-text > :last-child {
    margin-bottom: 0;
}

.comment-text p {
    margin: 0 0 0.55em;
}

.comment-text a {
    color: var(--pc-gold-1);
}

.comment-text img,
.comment-text video {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.comment-text blockquote {
    margin: 0.8em 0;
    padding: 8px 12px;
    border-left: 2px solid var(--pc-line-strong);
    border-radius: 0 8px 8px 0;
    background: rgba(216, 180, 106, 0.05);
    color: var(--pc-ink-2);
    font-style: italic;
}

.comment-text code {
    padding: 1px 5px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.28);
    color: #e7d3aa;
    font-size: 0.92em;
}

.comment-signature {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px dashed rgba(216, 180, 106, 0.14);
    color: #9d998c;
    font-size: 12.5px;
    font-style: italic;
}

.edited-mark {
    display: inline-block;
    margin-top: 5px;
    color: #8f816e;
    font-size: 11px;
}

.comment-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 10px;
}

.comment-actions button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--pc-muted);
    font: inherit;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.comment-actions button:hover {
    border-color: rgba(216, 180, 106, 0.22);
    background: rgba(216, 180, 106, 0.08);
    color: var(--pc-gold-1);
}

.comment-actions .reply-btn {
    border-color: rgba(216, 180, 106, 0.16);
    background: rgba(216, 180, 106, 0.06);
    color: var(--pc-gold-2);
}

.comment-actions .delete-comment-btn:hover {
    border-color: rgba(198, 84, 84, 0.3);
    background: rgba(198, 84, 84, 0.12);
    color: #ff9c9c;
}

.comment-actions .report-comment-btn:hover {
    border-color: rgba(201, 106, 58, 0.32);
    background: rgba(201, 106, 58, 0.12);
    color: #ffb37a;
}

.comment-actions .share-btn {
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: var(--pc-muted);
    font-size: 12px;
    text-transform: none;
}

.comment-actions .share-btn:hover {
    border-color: rgba(216, 180, 106, 0.22);
    background: rgba(216, 180, 106, 0.08);
    color: var(--pc-gold-1);
}

/* --------------------------------------------------------------------------
   7. ВЕТКА ОТВЕТОВ
   -------------------------------------------------------------------------- */
.comment-children {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 10px 0 0;
    padding: 0 0 0 22px;
    border-left: 1px solid rgba(216, 180, 106, 0.14);
}

.comment-children .comment-children {
    padding-left: 18px;
}

.comment-children .comment-children .comment-children {
    padding-left: 14px;
}

.comment-children .comment-children .comment-children .comment-children {
    padding-left: 10px;
}

/* --------------------------------------------------------------------------
   8. ФОРМА НОВОГО КОММЕНТАРИЯ
   -------------------------------------------------------------------------- */
.comment-composer {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin: 0 0 22px;
    padding: 14px;
    border: 1px solid var(--pc-line);
    border-radius: var(--pc-radius);
    background: linear-gradient(180deg, rgba(216, 180, 106, 0.06), rgba(0, 0, 0, 0.12));
    box-shadow: inset 0 1px 0 rgba(255, 235, 190, 0.05);
}

.comment-composer .comment-composer-avatar {
    flex: 0 0 42px;
    width: 42px;
    height: 42px;
}

.comment-composer-main {
    flex: 1 1 auto;
    min-width: 0;
}

.comment-composer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 2px 0 8px;
}

.comment-composer-title {
    color: var(--pc-gold-1);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.comment-composer-hint {
    color: var(--pc-muted);
    font-size: 11px;
}

.comment-composer .textarea-wrapper,
.reply-form .textarea-wrapper {
    position: relative;
}

.comment-composer .textarea-wrapper textarea,
.comment-textarea {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 92px;
    margin: 0;
    padding: 12px 96px 14px 14px;
    box-sizing: border-box;
    border: 1px solid rgba(216, 180, 106, 0.22);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--pc-ink);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.55;
    resize: vertical;
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.comment-composer .textarea-wrapper textarea:focus,
.reply-form .textarea-wrapper textarea:focus,
.comment-textarea:focus {
    border-color: rgba(216, 180, 106, 0.55);
    outline: none;
    background: rgba(0, 0, 0, 0.26);
    box-shadow: 0 0 0 3px rgba(216, 180, 106, 0.08);
}

.comment-composer .editor-toolbar,
.reply-form .editor-toolbar {
    right: 10px;
    top: 10px;
}

.comment-composer-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.comment-composer-count {
    color: var(--pc-muted);
    font-size: 11px;
    font-variant-numeric: tabular-nums;
}

.comment-composer-count.is-near-limit {
    color: #e7b36a;
}

.comment-composer-count.is-limit {
    color: #ff8b8b;
}

.comment-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid rgba(241, 217, 164, 0.55);
    border-radius: 999px;
    background: linear-gradient(145deg, #e0b96f, #b8860b);
    color: #2a1a0c;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(184, 134, 11, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.35);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
}

.comment-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 10px 24px rgba(184, 134, 11, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.comment-submit:active {
    transform: translateY(0);
}

.comment-submit:focus-visible {
    outline: 2px solid var(--pc-gold-2);
    outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   9. ФОРМА ОТВЕТА
   -------------------------------------------------------------------------- */
.reply-form {
    display: none;
    margin: 12px 0 0;
}

.reply-form.is-open {
    display: block;
    animation: pc-reply-open 0.18s ease both;
}

.reply-form-inner {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(216, 180, 106, 0.18);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.16);
}

.reply-form .reply-form-avatar {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    font-size: 13px;
}

.reply-form-main {
    flex: 1 1 auto;
    min-width: 0;
}

.reply-form-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 1px 0 8px;
}

.reply-form-title {
    color: var(--pc-muted);
    font-size: 11.5px;
    line-height: 1.4;
    min-width: 0;
}

.reply-form-title b {
    color: var(--pc-gold-1);
}

.reply-form-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--pc-muted);
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.reply-form-close:hover {
    border-color: rgba(216, 180, 106, 0.2);
    background: rgba(216, 180, 106, 0.1);
    color: var(--pc-gold-1);
}

.reply-form textarea,
.reply-form .reply-text {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    min-height: 74px;
    padding: 10px 92px 12px 12px;
    border-radius: 12px;
    font-size: 14px;
    box-sizing: border-box;
}

.reply-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
}

.reply-form-hint {
    color: var(--pc-muted);
    font-size: 10.5px;
}

.reply-form-buttons {
    display: flex;
    gap: 6px;
}

.submit-reply {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border: 1px solid rgba(241, 217, 164, 0.5);
    border-radius: 999px;
    background: linear-gradient(145deg, #e0b96f, #b8860b);
    color: #2a1a0c;
    font: inherit;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.32);
    transition: transform 0.16s ease, filter 0.16s ease;
}

.submit-reply:hover {
    transform: translateY(-1px);
    filter: brightness(1.06);
}

.cancel-reply {
    padding: 8px 14px;
    border: 1px solid rgba(216, 180, 106, 0.22);
    border-radius: 999px;
    background: transparent;
    color: var(--pc-muted);
    font: inherit;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.cancel-reply:hover {
    border-color: rgba(216, 180, 106, 0.4);
    background: rgba(216, 180, 106, 0.08);
    color: var(--pc-gold-1);
}

/* --------------------------------------------------------------------------
   10. РЕАКЦИИ
   -------------------------------------------------------------------------- */
.reactions-block {
    margin: 0;
    padding: 0;
}

.reactions-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 10px;
}

.reactions-title,
.reactions-block h4,
.rewards-block h4 {
    margin: 0;
    color: var(--pc-gold-1);
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.12em;
    line-height: 1.3;
    text-transform: uppercase;
    opacity: 1;
}

.reactions-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.reaction-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 7px 12px;
    border: 1px solid rgba(216, 180, 106, 0.28);
    border-radius: 999px;
    background: rgba(34, 23, 13, 0.45);
    color: var(--pc-ink);
    font: inherit;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 235, 190, 0.04);
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.reaction-btn .reaction-emoji {
    font-size: 17px;
    line-height: 1;
    filter: saturate(0.9);
    transition: transform 0.16s ease;
}

.reaction-btn .count {
    min-width: 1.5em;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.28);
    color: #d8c7a8;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.3;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.reaction-btn:hover {
    transform: translateY(-2px);
    border-color: rgba(241, 217, 164, 0.65);
    background: rgba(216, 180, 106, 0.12);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 235, 190, 0.08);
}

.reaction-btn:disabled {
    opacity: 0.6;
    cursor: wait;
    transform: none;
}

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

.reaction-btn.active {
    border-color: rgba(241, 217, 164, 0.8);
    background: linear-gradient(145deg, rgba(216, 180, 106, 0.28), rgba(184, 134, 11, 0.18));
    color: #fff6df;
    box-shadow: 0 0 0 1px rgba(241, 217, 164, 0.22), 0 8px 22px rgba(0, 0, 0, 0.24), 0 0 18px rgba(255, 215, 0, 0.12);
}

.reaction-btn.active .count {
    background: var(--pc-gold-1);
    color: #2a1a0c;
}

.reaction-btn.active .reaction-emoji {
    transform: scale(1.06);
}

.reaction-btn.is-popping .reaction-emoji {
    animation: pc-pop 0.38s ease;
}

.reaction-btn:focus-visible,
.comment-actions button:focus-visible,
.reply-form-close:focus-visible {
    outline: 2px solid var(--pc-gold-2);
    outline-offset: 2px;
}

/* Компактные реакции под комментарием и в ленте статей */
.comment-reactions,
.feed-reactions {
    margin-top: 10px;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

.comment-reactions .reactions-list {
    gap: 5px;
}

.comment-reactions .reaction-btn {
    min-height: 28px;
    padding: 3px 7px;
    border-color: rgba(216, 180, 106, 0.16);
    background: rgba(0, 0, 0, 0.14);
}

.comment-reactions .reaction-btn .reaction-emoji {
    font-size: 14px;
}

.comment-reactions .reaction-btn .count {
    padding: 1px 5px;
    font-size: 10.5px;
}

.comment-reactions .reaction-btn:hover {
    transform: translateY(-1px);
}

.comment-reactions .reaction-btn.is-zero .count,
.feed-reactions .reaction-btn.is-zero .count {
    display: none;
}

.comment-reactions .reaction-btn.is-zero:hover .count,
.comment-reactions .reaction-btn.is-zero.active .count,
.feed-reactions .reaction-btn.is-zero:hover .count,
.feed-reactions .reaction-btn.is-zero.active .count {
    display: inline-block;
}

.feed-author-avatar {
    width: 40px;
    height: 40px;
}

.feed-reactions {
    padding-top: 12px;
    border-top: 1px dashed rgba(216, 180, 106, 0.18);
    margin-top: 14px;
}

.feed-reactions .reactions-list {
    gap: 7px;
}

.feed-reactions .reaction-btn {
    min-height: 32px;
    padding: 5px 10px;
    font-size: 13px;
}

.feed-reactions .reaction-btn .reaction-emoji {
    font-size: 15px;
}

/* --------------------------------------------------------------------------
   11. РЯД «РЕАКЦИИ + НАГРАДЫ»
   -------------------------------------------------------------------------- */
.reactions-rewards-row,
.lib-page .reactions-rewards-row {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    margin: 22px 0;
    padding: 16px 18px;
    border: 1px solid var(--pc-line);
    border-radius: var(--pc-radius);
    background: var(--pc-panel-soft);
    box-shadow: inset 0 1px 0 rgba(255, 235, 190, 0.05);
}

.reactions-rewards-row > .reactions-block,
.lib-page .reactions-rewards-row .reactions-block {
    flex: 1 1 420px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

.reactions-rewards-row > .rewards-block,
.lib-page .reactions-rewards-row .rewards-block {
    flex: 0 1 280px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

.rewards-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
}

/* --------------------------------------------------------------------------
   12. РЕДАКТИРОВАНИЕ КОММЕНТАРИЯ
   -------------------------------------------------------------------------- */
.edit-comment-form {
    width: 100%;
}

.edit-textarea {
    width: 100%;
    min-height: 96px;
    padding: 12px 14px;
    border: 1px solid rgba(216, 180, 106, 0.22);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.2);
    color: var(--pc-ink);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.55;
    resize: vertical;
    margin-bottom: 8px;
}

.edit-textarea:focus {
    border-color: rgba(216, 180, 106, 0.55);
    outline: none;
    box-shadow: 0 0 0 3px rgba(216, 180, 106, 0.08);
}

.edit-actions {
    display: flex;
    justify-content: flex-start;
    gap: 8px;
}

/* --------------------------------------------------------------------------
   13. АДАПТИВНОСТЬ
   -------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .reactions-rewards-row,
    .lib-page .reactions-rewards-row {
        flex-direction: column;
        align-items: stretch;
    }

    .reactions-rewards-row > .reactions-block,
    .reactions-rewards-row > .rewards-block,
    .lib-page .reactions-rewards-row .reactions-block,
    .lib-page .reactions-rewards-row .rewards-block {
        flex: 0 0 auto;
    }
}

@media (max-width: 768px) {
    .comments-block {
        padding: 16px;
    }

    .comment-composer-hint,
    .reply-form-hint {
        display: none;
    }

    .comment-header {
        flex-wrap: wrap;
    }

    .comment-date {
        width: 100%;
        padding-top: 0;
        order: 3;
    }

    .comment-actions button,
    .comment-actions .share-btn {
        min-height: 32px;
        padding: 7px 10px;
        font-size: 12px;
    }

    .comment-children {
        padding-left: 14px;
    }

    .comment-children .comment-children {
        padding-left: 12px;
    }

    .comment-children .comment-children .comment-children {
        padding-left: 10px;
    }

    .comment-children .comment-children .comment-children .comment-children {
        padding-left: 8px;
    }
}

@media (max-width: 590px) {
    .comments-block {
        margin-top: 20px;
        padding: 14px;
        border-radius: 16px;
    }

    .comments-block > h4 {
        margin-bottom: 14px;
        font-size: 13px;
    }

    .comment-item {
        padding: 12px;
    }

    .comment-item.is-reply {
        padding: 10px 12px;
    }

    .comment-avatar {
        flex-basis: 38px;
        width: 38px;
        height: 38px;
    }

    .comment-item.is-reply .comment-avatar {
        flex-basis: 32px;
        width: 32px;
        height: 32px;
    }

    .comment-row {
        gap: 10px;
    }

    .comment-body {
        font-size: 14.5px;
    }

    .comment-author .user-profile-link {
        font-size: 14px;
    }

    .comment-reply-to-excerpt {
        display: none;
    }

    .comment-composer {
        gap: 10px;
        padding: 12px;
    }

    .comment-composer .comment-composer-avatar {
        flex-basis: 36px;
        width: 36px;
        height: 36px;
    }

    .comment-composer .textarea-wrapper textarea,
    .comment-textarea {
        min-height: 84px;
        padding-right: 76px;
        font-size: 16px;
    }

    .comment-composer .editor-toolbar,
    .reply-form .editor-toolbar {
        top: 8px;
        right: 8px;
        gap: 2px;
    }

    .comment-composer .editor-toolbar .emoji-picker-container,
    .comment-composer .editor-toolbar .smiles-picker-container,
    .reply-form .editor-toolbar .emoji-picker-container,
    .reply-form .editor-toolbar .smiles-picker-container {
        width: 32px;
        height: 32px;
    }

    .reply-form textarea,
    .reply-form .reply-text {
        padding-right: 72px;
    }

    .comment-composer-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .comment-composer-count {
        text-align: right;
    }

    .comment-submit {
        width: 100%;
    }

    .reply-form-inner {
        gap: 8px;
        padding: 10px;
    }

    .reply-form-close {
        width: 32px;
        height: 32px;
    }

    .reply-form-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .reply-form-buttons {
        justify-content: flex-end;
    }

    .reactions-list {
        gap: 6px;
    }

    .reaction-btn {
        min-height: 34px;
        padding: 6px 10px;
        font-size: 13px;
    }

    .reaction-btn .reaction-emoji {
        font-size: 15px;
    }

    .reaction-btn .count {
        padding: 1px 5px;
        font-size: 10.5px;
    }

    .reactions-rewards-row .reactions-list {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 5px;
    }

    .reactions-rewards-row .reaction-btn {
        width: 100%;
        gap: 3px;
        min-height: 32px;
        padding: 5px 3px;
        font-size: 12px;
    }

    .comment-reactions .reaction-btn {
        min-height: 32px;
        padding: 4px 8px;
    }

    .reactions-rewards-row .reaction-btn .count {
        min-width: 0;
        padding: 1px 4px;
        font-size: 10px;
    }

    .reactions-rewards-row,
    .lib-page .reactions-rewards-row {
        margin: 18px 0;
        padding: 14px;
        border-radius: 16px;
    }

    .rewards-list {
        gap: 10px;
    }
}

@media (max-width: 400px) {
    .comments-block {
        padding: 12px;
    }

    .comment-avatar {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
    }

    .comment-author .message-user-btn {
        width: 22px;
        height: 22px;
    }

    .comment-actions button span[aria-hidden="true"] {
        display: none;
    }

    .comment-actions button {
        padding: 6px 8px;
    }
}

/* --------------------------------------------------------------------------
   14. АНИМАЦИИ
   -------------------------------------------------------------------------- */
@keyframes pc-comment-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.995);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes pc-reply-open {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pc-pop {
    0%,
    100% {
        transform: scale(1);
    }
    45% {
        transform: scale(1.3);
    }
}

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

@keyframes pc-unique-shadow {
    0%,
    100% {
        box-shadow:
            0 0 0 2px rgba(255, 235, 170, 0.7),
            0 0 12px rgba(255, 200, 60, 0.5),
            0 0 24px rgba(255, 120, 0, 0.22);
    }
    50% {
        box-shadow:
            0 0 0 3px rgba(255, 245, 200, 0.95),
            0 0 20px rgba(255, 210, 80, 0.8),
            0 0 40px rgba(255, 120, 0, 0.38);
    }
}

@keyframes pc-unique-ring {
    0%,
    100% {
        opacity: 0.55;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.06);
    }
}

@keyframes pc-unique-star {
    0%,
    100% {
        filter: brightness(1);
        transform: scale(1);
    }
    50% {
        filter: brightness(1.25);
        transform: scale(1.18);
    }
}

@media (prefers-reduced-motion: reduce) {
    .comment-item,
    .comment-item.is-new,
    .reply-form.is-open,
    .reaction-btn,
    .reaction-btn .reaction-emoji,
    .comment-submit,
    .submit-reply,
    .cancel-reply,
    .portal-avatar.is-unique,
    .portal-avatar.is-unique::before,
    .portal-avatar.is-unique::after,
    .portal-avatar-rarity {
        animation: none !important;
        transition: none !important;
    }
}
