/* 首页热门社区 + 本周活跃榜。所有规则仅作用于这两个小工具。 */
.knn-widget-wrap:has(> .widget-container > .knn-home-community-widget),
.knn-widget-wrap:has(> .widget-container > .knn-home-active-users-widget) {
    padding-top: var(--pt-pc, 0);
    padding-bottom: var(--pb-pc, 0);
}

.knn-home-community-widget,
.knn-home-active-users-widget {
    position: relative;
    height: 100%;
    overflow: hidden;
    color: var(--main-color, #26344a);
    background: var(--main-bg-color, #fff);
    border: 1px solid rgba(128, 145, 167, .12);
    border-radius: 12px;
    box-shadow: 0 8px 26px rgba(34, 58, 93, .055);
}

.knn-home-community-widget > .box-body.notop,
.knn-home-active-users-widget > .box-body.notop {
    margin: 0;
    padding: 10px 18px 4px;
}

.knn-home-community-widget .title-theme,
.knn-home-active-users-widget .title-theme {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 30px;
    padding: 0;
    border: 0;
    font-family: inherit;
    font-size: 18px;
    font-weight: 800;
    line-height: 30px;
    color: var(--main-color, #182338);
}

.knn-home-community-widget .title-theme::before,
.knn-home-active-users-widget .title-theme::before {
    display: inline-flex;
    width: 30px;
    height: 30px;
    margin-right: 9px;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free", FontAwesome;
    font-size: 27px;
    font-weight: 900;
    line-height: 1;
    vertical-align: top;
    box-shadow: none;
}

.knn-home-community-widget .title-theme::before {
    content: "\f4ad";
    color: #1685ff;
    background: transparent;
}

.knn-home-active-users-widget .title-theme::before {
    content: "\f091";
    color: #ff9919;
    background: transparent;
    transform: translateY(-1px);
}

.knn-home-active-users-widget .title-theme > small {
    display: none;
}

.knn-home-active-users-widget .title-theme::after {
    position: absolute;
    top: 50%;
    left: 148px;
    transform: translateY(-50%);
    content: "社区达人";
    color: #8b98ab;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
}

.knn-home-community-widget .title-theme .pull-right,
.knn-home-active-users-widget .title-theme .pull-right {
    margin-left: auto;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
}

.knn-home-community-widget > .widget-content,
.knn-home-active-users-widget > .widget-content {
    height: calc(100% - 44px);
}

.knn-community,
.knn-active-users {
    height: 100%;
}

.knn-community-tabs {
    position: absolute;
    z-index: 2;
    top: 15px;
    right: 66px;
    left: 151px;
    display: flex;
    gap: 24px;
    padding: 0;
    border-bottom: 0;
}

.knn-community-tabs button {
    position: relative;
    appearance: none;
    min-width: 0;
    padding: 0 0 9px;
    border: 0;
    outline: 0;
    color: #8a97aa;
    background: transparent;
    font: inherit;
    font-size: 14px;
    line-height: 20px;
    cursor: pointer;
    transition: color .2s ease;
}

.knn-community-tabs button::after {
    position: absolute;
    right: 50%;
    bottom: -1px;
    left: 50%;
    height: 3px;
    border-radius: 2px;
    background: #1685ff;
    content: "";
    transition: right .2s ease, left .2s ease;
}

.knn-community-tabs button:hover,
.knn-community-tabs button.is-active {
    color: #1685ff;
    font-weight: 700;
}

.knn-community-tabs button.is-active::after {
    right: 0;
    left: 0;
}

.knn-community-panels {
    padding: 0 18px 5px;
    border-top: 1px solid rgba(128, 145, 167, .15);
}

.knn-community-panel[hidden] {
    display: none !important;
}

.knn-community-item {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr) clamp(100px, 16%, 140px);
    box-sizing: border-box;
    gap: 9px;
    min-height: 62px;
    padding: 4px 0;
    align-items: center;
    border-bottom: 1px solid rgba(128, 145, 167, .12);
}

.knn-community-item:last-child {
    border-bottom: 0;
}

.knn-community-avatar,
.knn-community-avatar img {
    display: block;
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.knn-community-avatar img {
    object-fit: cover;
    box-shadow: 0 2px 9px rgba(37, 57, 88, .13);
}

.knn-community-copy {
    min-width: 0;
}

.knn-community-title-row {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
}

.knn-community-title {
    overflow: hidden;
    color: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 21px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.knn-community-title:hover,
.knn-active-name:hover {
    color: #1685ff;
}

.knn-community-badge {
    flex: 0 0 auto;
    padding: 1px 6px;
    border-radius: 5px;
    color: #1685ff;
    background: #eaf4ff;
    font-size: 10px;
    line-height: 18px;
}

.knn-community-badge.is-hot {
    color: #ff7a35;
    background: #fff0e9;
}

.knn-community-badge.is-essence {
    color: #8a54ef;
    background: #f2ebff;
}

.knn-community-copy p {
    overflow: hidden;
    margin: 2px 0;
    color: #8b98aa;
    font-size: 12px;
    line-height: 18px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.knn-community-meta {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 8px;
    color: #a0aabd;
    font-size: 11px;
    line-height: 18px;
}

.knn-community-meta span:first-child {
    overflow: hidden;
    max-width: 88px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.knn-community-meta b {
    color: #aab4c3;
    font-size: 12px;
    font-weight: 700;
}

.knn-community-cover,
.knn-community-cover img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 7px;
}

.knn-community-cover {
    overflow: hidden;
    background: #eef3f8;
}

.knn-community-cover img {
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform .25s ease;
}

.knn-community-cover:hover img {
    transform: scale(1.04);
}

.knn-community-empty {
    margin: 0;
    padding: 42px 18px;
    color: #98a3b5;
    text-align: center;
}

.knn-active-users-list {
    margin: 0;
    padding: 0 18px 8px;
    list-style: none;
}

.knn-active-users-list li {
    display: grid;
    grid-template-columns: 32px 44px minmax(0, 1fr) auto;
    min-height: 64px;
    align-items: center;
    column-gap: 10px;
    border-bottom: 1px solid rgba(128, 145, 167, .12);
}

.knn-active-users-list li:last-child {
    border-bottom: 0;
}

.knn-active-rank {
    display: inline-flex;
    width: 29px;
    height: 32px;
    align-items: center;
    justify-content: center;
    border-radius: 0;
    clip-path: polygon(50% 0, 94% 23%, 94% 77%, 50% 100%, 6% 77%, 6% 23%);
    color: #fff;
    background: linear-gradient(145deg, #c8d3e2, #96a8c0);
    font-size: 13px;
    font-weight: 800;
}

.knn-active-rank.rank-1 { background: linear-gradient(145deg, #ffd756, #ffae12); }
.knn-active-rank.rank-2 { background: linear-gradient(145deg, #ff9b8f, #ff625b); }
.knn-active-rank.rank-3 { background: linear-gradient(145deg, #aa7cff, #7548eb); }
.knn-active-rank.rank-4 { background: linear-gradient(145deg, #67baff, #2c82ed); }
.knn-active-rank.rank-5 { background: linear-gradient(145deg, #4de29d, #10ba68); }

.knn-active-avatar,
.knn-active-avatar img {
    display: block;
    width: 44px;
    height: 44px;
    border-radius: 50%;
}

.knn-active-avatar img {
    object-fit: cover;
    box-shadow: 0 2px 8px rgba(37, 57, 88, .12);
}

.knn-active-copy {
    display: flex;
    overflow: hidden;
    min-width: 0;
    align-items: center;
    gap: 10px;
}

.knn-active-name {
    display: inline-block;
    overflow: hidden;
    color: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.knn-active-level {
    flex: 0 0 auto;
    padding: 1px 9px;
    border-radius: 999px;
    color: #8b5cf2;
    background: #f2ebff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
}

.knn-active-level.rank-1 { color: #ff5579; background: #fff0f4; }
.knn-active-level.rank-2,
.knn-active-level.rank-4 { color: #3287e9; background: #eaf4ff; }
.knn-active-level.rank-3 { color: #8b5cf2; background: #f2ebff; }
.knn-active-level.rank-5 { color: #19b978; background: #e8fbf3; }

.knn-active-users-list strong {
    display: flex;
    grid-column: 4;
    align-items: baseline;
    gap: 3px;
    color: #75849b;
    font-size: 14px;
    font-weight: 500;
    text-align: right;
    white-space: nowrap;
}

.knn-active-users-list strong small {
    color: inherit;
    font-size: 12px;
    font-weight: inherit;
    line-height: inherit;
}

/* 仅相邻的两个小工具才组成双栏，不改变其它首页模块。 */
.knn-community-widget-pair {
    display: grid !important;
    grid-template-columns: minmax(0, 1.65fr) minmax(290px, .95fr);
    column-gap: 10px !important;
    row-gap: 0 !important;
    align-items: stretch;
}

.knn-community-widget-pair > * {
    grid-column: 1 / -1;
}

.knn-community-widget-pair > .knn-community-pair-left {
    grid-column: 1;
}

.knn-community-widget-pair > .knn-community-pair-right {
    grid-column: 2;
}

.knn-community-widget-pair > .knn-community-pair-left,
.knn-community-widget-pair > .knn-community-pair-right,
.knn-community-widget-pair > .knn-community-pair-left > .widget-container,
.knn-community-widget-pair > .knn-community-pair-right > .widget-container,
.knn-community-widget-pair > .knn-community-pair-left > .widget-container > div,
.knn-community-widget-pair > .knn-community-pair-right > .widget-container > div {
    height: 100%;
}

body.dark-mode .knn-home-community-widget,
body.dark-mode .knn-home-active-users-widget,
.dark-theme .knn-home-community-widget,
.dark-theme .knn-home-active-users-widget {
    color: #dfe7f3;
    background: #202733;
    border-color: rgba(255, 255, 255, .07);
}

body.dark-mode .knn-home-community-widget .title-theme,
body.dark-mode .knn-home-active-users-widget .title-theme,
.dark-theme .knn-home-community-widget .title-theme,
.dark-theme .knn-home-active-users-widget .title-theme {
    color: #f2f6fc;
}

body.dark-mode .knn-community-copy p,
body.dark-mode .knn-community-meta,
body.dark-mode .knn-active-copy > span,
.dark-theme .knn-community-copy p,
.dark-theme .knn-community-meta,
.dark-theme .knn-active-copy > span {
    color: #8693a8;
}

@media (max-width: 767px) {
    .knn-widget-wrap:has(> .widget-container > .knn-home-community-widget),
    .knn-widget-wrap:has(> .widget-container > .knn-home-active-users-widget) {
        padding-top: 0;
        padding-bottom: 0;
        margin-top: var(--pt-m, 0);
        margin-bottom: var(--pb-m, 0);
    }

    .knn-community-widget-pair {
        grid-template-columns: minmax(0, 1fr);
        column-gap: 0 !important;
        row-gap: 0 !important;
    }

    .knn-community-widget-pair > .knn-community-pair-left,
    .knn-community-widget-pair > .knn-community-pair-right {
        grid-column: 1;
    }

    .knn-community-widget-pair > .knn-community-pair-left,
    .knn-community-widget-pair > .knn-community-pair-right,
    .knn-community-widget-pair > .knn-community-pair-left > .widget-container,
    .knn-community-widget-pair > .knn-community-pair-right > .widget-container,
    .knn-community-widget-pair > .knn-community-pair-left > .widget-container > div,
    .knn-community-widget-pair > .knn-community-pair-right > .widget-container > div {
        height: auto;
    }

    .knn-home-community-widget,
    .knn-home-active-users-widget {
        border-radius: 9px;
    }

    .knn-home-community-widget > .box-body.notop,
    .knn-home-active-users-widget > .box-body.notop {
        padding: 12px 12px 8px;
    }

    .knn-home-community-widget .title-theme,
    .knn-home-active-users-widget .title-theme {
        font-size: 16px;
    }

    .knn-home-active-users-widget .title-theme::after {
        left: 134px;
        font-size: 12px;
    }

    .knn-community-tabs {
        top: 17px;
        right: 43px;
        left: 130px;
        gap: 12px;
        padding: 0;
    }

    .knn-community-tabs button {
        padding-bottom: 13px;
        font-size: 12px;
    }

    .knn-community-panels,
    .knn-active-users-list {
        padding-right: 12px;
        padding-left: 12px;
    }

    .knn-community-item {
        grid-template-columns: 36px minmax(0, 1fr) 72px;
        box-sizing: border-box;
        gap: 8px;
        min-height: 54px;
        padding: 4px 0;
    }

    .knn-community-avatar,
    .knn-community-avatar img {
        width: 36px;
        height: 36px;
    }

    .knn-community-cover,
    .knn-community-cover img {
        width: 72px;
        height: 44px;
        aspect-ratio: auto;
    }

    .knn-community-copy p {
        display: none;
    }

    .knn-community-meta {
        gap: 7px;
        margin-top: 4px;
    }

    .knn-community-meta > b:first-of-type,
    .knn-community-meta time,
    .knn-community-meta time + b,
    .knn-community-meta time + b + span {
        display: none;
    }
}

@media (max-width: 380px) {
    .knn-community-cover {
        display: none;
    }

    .knn-community-item {
        grid-template-columns: 36px minmax(0, 1fr);
    }
}
