.zwe-item-thumbnail, .thumb-items {
    position: relative;
    width: 100%;
    height: auto;
    /* 占位高度由--zwe-image-ratio控制 */
    aspect-ratio: var(--zwe-image-ratio, 16 / 9);
    overflow: hidden;
}
.zwe-item-thumbnail img, .thumb-items img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.zwe-image-pending {
    background: #f5f5f5;
}
.zwe-filter-hidden {
    visibility: hidden;
}
.zwe-waterfall {
    position: relative;
    transition: height 0.5s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: height;
}
.zwe-masonry-item img {
    will-change: opacity, transform;
    backface-visibility: hidden;
}
.zwe-image-pending {
    background: #f6f6f6;
}
/* 瀑布流缩略图容器 - 用比例变量自适应高度，彻底解决不同图片高度跳动 */
.item-thumbnail, .thumb-items {
    position: relative;
    width: 100%;
    /* 关键：通过 CSS 变量自动计算高度，加载前就有正确占位 */
    aspect-ratio: var(--zwe-image-ratio, 16 / 9);
    overflow: hidden;
    border-radius: var(--zwe-radius, 8px);
    /* 高度平滑过渡缓冲 */
    transition: height 1.5s ease, aspect-ratio 1.4s ease;
    background: #f5f5f7;
}

.item-thumbnail img, .thumb-items img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 加载中骨架状态 */
.zwe-image-pending {
    background: linear-gradient(90deg, #eee 25%, #e0e0e0 50%, #eee 75%);
    background-size: 200% 100%;
    animation: zweSkeleton 1.2s infinite linear;
}
@keyframes zweSkeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 瀑布流容器强制相对定位，解决卡片飘左上角 */
.zwe-waterfall {
    position: relative !important;
}
.zwe-masonry-item {
    will-change: transform, opacity;
}
.zwe-waterfall {
    position: relative;
    margin-left: 0 !important;
    margin-right: 0 !important;
    transition: height 0.2s ease;
}

.zwe-waterfall > .zwe-masonry-item {
    margin: 0 !important;
    border-radius: var(--zwe-radius, var(--main-radius)) !important;
    transition: transform 0.24s ease, translate 0.2s ease, opacity 0.18s ease, box-shadow 0.2s ease;
    contain: style;
}

.zwe-waterfall .item-thumbnail,
.zwe-waterfall .thumb-items {
    position: relative;
    overflow: hidden;
}

.zwe-waterfall .zwe-image-pending {
    background: var(--muted-bg-color);
}

.zwe-waterfall .zwe-image-pending::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.42) 42%, transparent 64%) var(--muted-bg-color);
    background-size: 220% 100%;
    animation: zwe-skeleton 1.25s ease-in-out infinite;
}

.dark-theme .zwe-waterfall .zwe-image-pending::before {
    background-image: linear-gradient(100deg, transparent 20%, rgba(255,255,255,.09) 42%, transparent 64%);
}

.zwe-waterfall .zwe-image-ready::before {
    display: none;
}

.zwe-waterfall:not(.zwe-ready) > .zwe-masonry-item {
    opacity: 0;
}

.zwe-waterfall.zwe-animate.zwe-ready > .zwe-masonry-item {
    animation: zwe-card-in 0.35s ease both;
}

.zwe-waterfall .item-heading {
    min-height: 0 !important;
    max-height: none !important;
    -webkit-line-clamp: var(--zwe-title-lines, 2) !important;
}

.zwe-waterfall .item-tags {
    min-height: 0 !important;
}

.zwe-waterfall > .ajax-option,
.zwe-waterfall > .ajax-item-header,
.zwe-waterfall > .zwe-reader-tools {
    position: relative;
    z-index: 2;
}

.zwe-reader-tools {
    min-height: 40px;
    padding: 4px 6px;
    gap: 10px;
    border: 1px solid var(--main-border-color);
    border-radius: var(--main-radius);
    background: var(--main-bg-color);
    box-shadow: 0 4px 18px rgba(70, 80, 100, 0.04);
}

.zwe-filter-tabs {
    gap: 3px;
    padding: 3px;
    border-radius: 9px;
    background: var(--muted-bg-color);
}

.zwe-tools-label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0 7px;
    color: var(--muted-2-color);
    font-size: 12px;
    white-space: nowrap;
}

.zwe-reader-tools .but {
    border: 0;
    background: transparent;
    color: var(--muted-color);
    padding: 4px 10px;
    line-height: 22px;
    border-radius: 7px;
    transition: color .18s ease, background .18s ease, box-shadow .18s ease;
}

.zwe-reader-tools .but:hover,
.zwe-reader-tools .but.active {
    color: var(--focus-color);
    background: var(--focus-color-opacity1);
    box-shadow: 0 1px 4px rgba(70, 80, 100, .06);
}

.zwe-view-actions {
    gap: 2px;
}

.zwe-view-actions .but + .but {
    border-left: 1px solid var(--main-border-color);
    border-radius: 0;
}

.zwe-clear-read span {
    margin-left: 4px;
}

.zwe-filter-hidden {
    display: none !important;
}
.item-body{
    display: none;
}
.zwe-waterfall.zwe-hover-lift > .zwe-masonry-item:hover {
    margin-top: -8px!important;
    /*box-shadow: 0 10px 30px var(--main-shadow);*/
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05), 0 8px 15px rgba(0, 0, 0, 0.1), 0 15px 30px rgba(0, 0, 0, 0.15) !important;
    z-index: 99 !important;
    /*padding: 0px;*/
}
/* 基础卡片过渡，匹配JS里的 all 0.4s ease */
.zwe-waterfall > .zwe-masonry-item {
  transition: top 0.5s ease, opacity 0.8s ease, visibility 0.8s ease, margin 0.2s ease, box-shadow 0.2s ease, z-index 0.2s ease !important;
}
.zwe-waterfall.zwe-hover-zoom > .zwe-masonry-item:hover .item-thumbnail img {
    transform: scale(1.035);
}

.zwe-waterfall.zwe-hover-none > .zwe-masonry-item:hover .item-thumbnail img {
    transform: none;
}

.zwe-waterfall.zwe-shadow-soft > .zwe-masonry-item {
    box-shadow: 0 8px 24px rgba(80, 90, 110, 0.09);
}

.dark-theme .zwe-waterfall.zwe-shadow-soft > .zwe-masonry-item {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.zwe-waterfall.zwe-shadow-none > .zwe-masonry-item {
    box-shadow: none;
}

.zwe-waterfall.zwe-density-compact > .zwe-masonry-item {
    padding: 7px;
}

.zwe-waterfall.zwe-density-compact > .zwe-masonry-item .item-body {
    margin-top: 7px;
}

.zwe-waterfall.zwe-hide-tags .item-tags,
.zwe-waterfall.zwe-hide-author .meta-author,
.zwe-waterfall.zwe-hide-meta .item-meta,
.zwe-waterfall.zwe-hide-comments .meta-comm,
.zwe-waterfall.zwe-hide-views .meta-view,
.zwe-waterfall.zwe-hide-likes .meta-like {
    display: none !important;
}

.zwe-waterfall > .zwe-masonry-item.zwe-read {
    opacity: 0.72 !important;
    filter: saturate(.72);
    box-shadow: inset 0 0 0 1px var(--main-border-color);
}

.zwe-waterfall > .zwe-masonry-item.zwe-read::after {
    content: "已读";
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 3;
    padding: 3px 8px;
    border: 1px solid rgba(255,255,255,.55);
    border-radius: 20px;
    background: rgba(45,52,64,.82);
    color: #fff;
    font-size: 11px;
    line-height: 16px;
    backdrop-filter: blur(5px);
}

.zwe-waterfall > .zwe-masonry-item.zwe-read:hover {
    opacity: .9 !important;
}

/* 分类、标签、搜索、专题、作者页可能输出横向列表，插件仅在已启用页面中将其还原为竖向原生卡片。 */
.zwe-waterfall > .posts-item.list.zwe-from-list {
    display: block !important;
    padding: 10px !important;
    overflow: hidden;
    background: var(--main-bg-color);
    border-radius: var(--zwe-radius, var(--main-radius));
}

.zwe-waterfall > .posts-item.list.zwe-from-list .post-graphic {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
}

.zwe-waterfall > .posts-item.list.zwe-from-list .item-thumbnail {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    border-radius: calc(var(--zwe-radius, var(--main-radius)) - 3px);
}

.zwe-waterfall > .posts-item.list.zwe-from-list .item-body {
    display: block !important;
    width: 100% !important;
    margin: 10px 0 0 !important;
    padding: 0 !important;
}

.zwe-waterfall > .posts-item.list.zwe-from-list > .flex {
    display: block !important;
}

.zwe-waterfall > .posts-item.list.zwe-from-list .thumb-items {
    margin: 8px 0 0 !important;
}

.zwe-style-image > .zwe-masonry-item .item-thumbnail {
    height: auto !important;
    min-height: 90px;
    padding-bottom: 0 !important;
    background: var(--muted-bg-color);
}

.zwe-style-image > .zwe-masonry-item .item-thumbnail.zwe-image-pending {
    aspect-ratio: var(--zwe-image-ratio, 16 / 10);
}

.zwe-style-image > .zwe-masonry-item .item-thumbnail.zwe-image-ready {
    min-height: 0;
    aspect-ratio: auto;
}

.zwe-style-image > .zwe-masonry-item .item-thumbnail img,
.zwe-style-image > .zwe-masonry-item .item-thumbnail .lazyloaded {
    position: relative !important;
    display: block;
    width: 100%;
    height: auto !important;
    object-fit: cover;
}

.zwe-style-image > .zwe-masonry-item:hover .item-thumbnail img {
    transform: scale(1.025);
}

.zwe-style-minimal > .zwe-masonry-item {
    padding: 0 !important;
}

.zwe-style-minimal > .zwe-masonry-item .item-thumbnail,
.zwe-style-minimal > .zwe-masonry-item .item-thumbnail img {
    border-radius: var(--zwe-radius, var(--main-radius)) var(--zwe-radius, var(--main-radius)) 0 0 !important;
}

.zwe-style-minimal > .zwe-masonry-item .item-body {
    margin: 0 !important;
    padding: 12px !important;
}

.zwe-style-minimal > .zwe-masonry-item .item-tags a:nth-child(n+4) {
    display: none;
}

@keyframes zwe-card-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes zwe-skeleton {
    from { background-position: 120% 0; }
    to { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .zwe-waterfall,
    .zwe-waterfall > .zwe-masonry-item,
    .zwe-waterfall .zwe-image-pending::before {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 767px) {
    .zwe-waterfall.zwe-mobile-hide-meta .item-meta {
        display: none !important;
    }

    .zwe-waterfall:not(.zwe-mobile-hide-meta):not(.zwe-hide-meta) .item-meta {
        min-width: 0;
        flex-wrap: nowrap;
    }

    .zwe-waterfall:not(.zwe-mobile-hide-meta):not(.zwe-hide-meta) .meta-right {
        display: inline-flex !important;
        align-items: center;
        flex-wrap: nowrap;
        min-width: 0;
        gap: 6px;
        white-space: nowrap;
    }

    .zwe-waterfall:not(.zwe-mobile-hide-meta):not(.zwe-hide-meta):not(.zwe-hide-comments) .posts-item .meta-right .meta-comm,
    .zwe-waterfall:not(.zwe-mobile-hide-meta):not(.zwe-hide-meta):not(.zwe-hide-views) .posts-item .meta-right .meta-view,
    .zwe-waterfall:not(.zwe-mobile-hide-meta):not(.zwe-hide-meta):not(.zwe-hide-likes) .posts-item .meta-right .meta-like {
        display: inline-flex !important;
        align-items: center;
        margin-right: 0;
        font-size: 11px;
        line-height: 1.2;
    }

    .zwe-reader-tools {
        padding: 4px;
        gap: 4px;
    }

    .zwe-reader-tools .but {
        padding: 4px 7px;
        font-size: 12px;
    }

    .zwe-tools-label,
    .zwe-clear-read span {
        display: none;
    }
}
