.comment-thread {
    margin-top: 1.5rem;
}

.comment-thread__header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.comment-thread__title {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text, #eaf1fb);
}

.comment-thread__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--red, #ff3b5c);
    background: rgba(255, 59, 92, 0.15);
    border: 1px solid rgba(255, 59, 92, 0.35);
}

.comment-thread__card {
    padding: 1.5rem;
    border-radius: var(--r, 16px);
    background: var(--surf, #161a21);
    border: 1px solid var(--line, #2a2f3a);
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.comment-thread__login {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-radius: 14px;
    background: rgba(22, 26, 33, 0.65);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    color: var(--muted, #a7aebb);
    font-size: 0.95rem;
}

.comment-thread__login a {
    color: var(--red, #ff3b5c);
    font-weight: 600;
    text-decoration: none;
}

.comment-thread__login a:hover {
    text-decoration: underline;
}

.comment-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment-form__label {
    font-weight: 600;
    color: var(--text, #eaf1fb);
}

.comment-form__input {
    width: 100%;
    min-height: 120px;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid var(--line, #2a2f3a);
    background: var(--surf2, #1d2330);
    color: var(--text, #eaf1fb);
    resize: vertical;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.comment-form__input:focus {
    outline: none;
    border-color: rgba(255, 59, 92, 0.65);
    box-shadow: 0 0 0 3px rgba(255, 59, 92, 0.15);
}

.comment-form__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.comment-form__counter {
    font-size: 0.85rem;
    color: var(--muted, #a7aebb);
}

.comment-form__submit {
    padding: 0.5rem 1.4rem;
    border-radius: 999px;
    font-weight: 600;
}

.comment-thread__alert {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    font-size: 0.95rem;
    border: 1px solid transparent;
    line-height: 1.45;
}

.comment-thread__alert[data-state="error"] {
    background: rgba(255, 59, 92, 0.12);
    border-color: rgba(255, 59, 92, 0.35);
    color: #ff9bad;
}

.comment-thread__alert[data-state="success"] {
    background: rgba(50, 205, 120, 0.12);
    border-color: rgba(50, 205, 120, 0.35);
    color: #9ff5c2;
}

.comment-thread__empty {
    padding: 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed rgba(255, 255, 255, 0.12);
    text-align: center;
    color: var(--muted, #a7aebb);
    font-size: 0.95rem;
}

.comment-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comment-replies {
    list-style: none;
    margin: 1rem 0 0;
    padding: 0 0 0 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: relative;
}

.comment-item {
    position: relative;
}

.comment-item--reply {
    margin-left: clamp(1.5rem, 4vw, 2.5rem);
    padding-left: clamp(0.9rem, 3vw, 1.35rem);
}

.comment-item--reply::before {
    content: "";
    position: absolute;
    top: 1.1rem;
    left: clamp(0.35rem, 2vw, 0.5rem);
    width: clamp(0.75rem, 2vw, 1rem);
    height: calc(100% - 0.75rem);
    border-left: 2px solid rgba(255, 255, 255, 0.08);
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 0 0 0 14px;
    pointer-events: none;
}

.comment-item--reply:last-child::before {
    height: 1.35rem;
}

.comment {
    padding: 1.1rem 1.25rem;
    border-radius: 14px;
    background: var(--surf2, #1d2330);
    border: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comment__header {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
}

.comment__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.comment__avatar-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.comment__avatar-status {
    position: absolute;
    inset: auto -2px -2px auto;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(13, 17, 26, 0.85);
    background: #4b5563;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.35);
    z-index: 1;
    pointer-events: none;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.comment__avatar-status--offline {
    background: #4b5563;
    box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.35);
}

.comment__avatar-status--online {
    background: #22c55e;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}

.comment__avatar--online {
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.75), 0 0 0 5px rgba(34, 197, 94, 0.2);
}

.comment__meta {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.comment__avatar-link {
    display: inline-flex;
    border-radius: 50%;
}

.comment__avatar-link:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.24);
    outline-offset: 2px;
}

.comment__author {
    font-weight: 600;
    color: var(--text, #eaf1fb);
    text-decoration: none;
    transition: color 0.15s ease;
}

.comment__author:hover,
.comment__author:focus-visible {
    color: var(--red, #ff3b5c);
    text-decoration: underline;
}

.comment__author-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.comment__author-badge-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.comment__author-badge {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    padding: 2px;
    object-fit: contain;
    box-shadow: 0 10px 18px rgba(0, 0, 0, 0.35);
    cursor: help;
}

.comment__author-badge.is-hidden {
    display: none;
}

.comment__author-badge-label {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted, #a7aebb);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: uppercase;
}

.comment__meta-top {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.comment__date {
    font-size: 0.82rem;
    color: var(--muted, #a7aebb);
    margin: 0;
}

.comment__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 0.25rem;
    width: fit-content;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted, #a7aebb);
}

.comment__badge--owner {
    background: rgba(90, 129, 255, 0.18);
    color: #b7c7ff;
    border: 1px solid rgba(90, 129, 255, 0.4);
}

.comment__role-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.18rem 0.65rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    border: 1px solid transparent;
}

.comment__role-badge--admin {
    background: rgba(255, 59, 92, 0.18);
    border-color: rgba(255, 59, 92, 0.35);
    color: #ff9bad;
}

.comment__role-badge--super {
    background: linear-gradient(135deg, rgba(255, 186, 59, 0.22), rgba(255, 59, 92, 0.22));
    border-color: rgba(255, 186, 59, 0.4);
    color: #ffd9a3;
}

.comment-item--reply .comment {
    background: rgba(29, 35, 48, 0.9);
    border-color: rgba(255, 255, 255, 0.08);
}

.comment__body {
    margin: 0;
    font-size: 0.98rem;
    line-height: 1.6;
    color: var(--text, #eaf1fb);
    white-space: pre-wrap;
}

.comment__body .comment-mention {
    display: inline-flex;
    align-items: center;
    color: #7bc0ff;
    background-color: rgba(123, 192, 255, 0.12);
    border-radius: 6px;
    padding: 0.05rem 0.35rem;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.comment__body .comment-mention:hover {
    color: #a5d5ff;
    background-color: rgba(123, 192, 255, 0.22);
    text-decoration: underline;
}

.comment__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.comment__votes {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.comment__vote {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: transparent;
    color: var(--muted, #a7aebb);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.comment__vote i {
    font-size: 0.85rem;
}

.comment__vote-count {
    font-size: 0.85rem;
    font-weight: 600;
}

.comment__vote:hover,
.comment__vote:focus-visible {
    border-color: rgba(255, 59, 92, 0.6);
    color: var(--text, #eaf1fb);
    outline: none;
}

.comment__vote[data-comment-vote="helpful"]:hover,
.comment__vote[data-comment-vote="helpful"]:focus-visible {
    border-color: rgba(46, 204, 113, 0.6);
}

.comment__vote:disabled {
    cursor: default;
}

.comment__vote:disabled:not(.comment__vote--selected) {
    opacity: 0.6;
}

.comment__vote--selected {
    background: rgba(255, 59, 92, 0.18);
    border-color: rgba(255, 59, 92, 0.6);
    color: #ff9bad;
}

.comment__vote[data-comment-vote="helpful"].comment__vote--selected {
    background: rgba(46, 204, 113, 0.18);
    border-color: rgba(46, 204, 113, 0.6);
    color: #9be7c1;
}

.comment__votes--locked .comment__vote {
    cursor: default;
}

.comment__votes--locked .comment__vote:not(.comment__vote--selected) {
    opacity: 0.6;
}

.comment__actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.comment__reply {
    border: none;
    background: transparent;
    color: var(--red, #ff3b5c);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0;
    cursor: pointer;
}

.comment__reply:hover,
.comment__reply:focus {
    text-decoration: underline;
}

.comment__report {
    border: none;
    background: transparent;
    color: var(--muted, #a7aebb);
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0;
    cursor: pointer;
    transition: color 0.2s ease;
}

.comment__report:hover,
.comment__report:focus-visible {
    color: var(--red, #ff3b5c);
    text-decoration: underline;
    outline: none;
}

.comment-reply-form {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.comment-form__footer--inline {
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
}

.comment-reply-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-reply-cancel {
    color: var(--muted, #a7aebb);
    text-decoration: none;
}

.comment-thread__load-more {
    align-self: center;
    padding: 0.5rem 1.5rem;
    border-radius: 999px;
    font-weight: 600;
    color: var(--text, #eaf1fb);
    border-color: rgba(255, 255, 255, 0.18);
}

.comment-thread__load-more:hover {
    border-color: rgba(255, 255, 255, 0.36);
}

@media (max-width: 576px) {
    .comment-thread__card {
        padding: 1.1rem;
    }

    .comment-form__footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .comment-thread__load-more {
        width: 100%;
    }
}
