.topic-index-page {
    --topic-header-offset: 56px;
    --topic-filter-z: 35;
}

.topic-filter-shell {
    position: sticky;
    top: var(--topic-header-offset);
    z-index: var(--topic-filter-z);
}

.topic-filter-button {
    min-height: 40px;
}

.topic-filter-menu {
    display: none;
}

.topic-filter-menu.open {
    display: block;
}

.topic-publish-btn {
    background: #3b82f6;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.22);
}

.topic-publish-btn:hover {
    background: #2563eb;
}

.topic-sidebar-sticky {
    position: sticky;
    top: calc(var(--topic-header-offset) + 88px);
}

.topic-sidebar-card {
    border-color: #e5e7eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.topic-sidebar-section {
    padding: 0;
}

.topic-sidebar-section + .topic-sidebar-section {
    margin-top: 2px;
}

.topic-sidebar-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.9rem;
    border-radius: 9999px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.18s ease;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-sidebar-chip:hover {
    background: #e5e7eb;
    color: #111827;
}

.topic-sidebar-chip-active {
    background: #eff6ff;
    color: #2563eb !important;
    border-color: transparent;
}

.topic-tag-chip {
    background: #f8fafc;
    color: #475569;
    border: 0;
    border-radius: 9999px;
    padding: 0.32rem 0.62rem;
    line-height: 1;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topic-tag-chip:hover {
    background: #eff6ff;
    color: #2563eb;
}

.topic-tag-chip-active {
    background: #2563eb;
    color: #fff;
}

.topic-tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 6px;
    align-items: flex-start;
    align-content: flex-start;
}

.topic-feed-card {
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.topic-feed-card:hover {
    background: #f5f7fa;
    border-color: #e5e7eb;
    box-shadow: none;
    transform: none;
}

.topic-event-badge {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);
    color: #92400e;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    border: 0;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    transition: all 0.2s ease;
}

.topic-event-badge span {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.topic-event-badge:hover {
    filter: brightness(0.96);
}

.topic-card-source-row .topic-event-badge {
    background: linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%) !important;
    color: #92400e !important;
    border: 0 !important;
    padding: 4px 8px !important;
    border-radius: 12px !important;
    font-size: 10px !important;
}

.topic-card-media-grid {
    gap: 10px;
    align-items: stretch;
    max-width: 390px;
    width: 100%;
}

.topic-card-media-item {
    flex: 0 0 clamp(92px, 9.8vw, 120px);
    width: clamp(92px, 9.8vw, 120px);
    height: clamp(92px, 9.8vw, 120px);
    min-width: 0;
    aspect-ratio: 1 / 1;
}

.topic-card-stats a,
.topic-card-stats div {
    transition: color 0.2s ease;
}

.topic-card-stats a:hover,
.topic-card-stats div:hover {
    color: #2563eb;
}

/* 通用排版基线：统一内容卡片内部节奏 */
.topic-card-content-block {
    margin-top: 2px;
}

.topic-card-title {
    margin-bottom: 5px;
}

.topic-card-summary {
    margin-bottom: 8px;
}

.topic-card-media-link {
    margin-bottom: 6px;
}

.topic-card-status-row {
    margin-bottom: 10px;
}

.topic-card-chip {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 8px;
    border-radius: 9999px;
    font-size: 11px;
    line-height: 1;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: 0;
}

.topic-card-chip-record {
    background: #eaf3ff;
    color: #1e40af;
}

.topic-card-chip-status {
    background: #e8f8ef;
    color: #065f46;
}

.topic-card-chip-next {
    background: #f4ecff;
    color: #6d28d9;
}

.topic-card-source-row {
    margin-bottom: 9px;
}

.topic-card-group {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 0.18rem 0.5rem;
    font-size: 0.71rem;
    line-height: 1.2;
    color: #334155;
    background: #eef2f7;
    border: 0;
    border-radius: 8px;
    white-space: normal;
    word-break: break-word;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.topic-card-group:hover {
    color: #1e3a8a;
    background: #e2e8f0;
}

.topic-card-author-block {
    margin-bottom: 8px;
}

.topic-card-author-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.topic-card-status-inline {
    margin-bottom: 0;
    justify-content: flex-end;
    margin-left: auto;
    flex: 0 0 auto;
    gap: 6px;
}

.topic-card-meta-tags {
    margin-bottom: 8px;
}

.topic-card-stats {
    gap: 14px;
    padding-top: 2px;
}

.topic-card-footer {
    position: relative;
    gap: 10px;
}

.topic-card-manage-entry {
    margin-left: auto;
    flex: 0 0 auto;
}

.topic-card-manage-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.topic-card-manage-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid transparent;
    background: #f8fafc;
    color: #6b7280;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topic-card-manage-btn i {
    font-size: 14px;
}

.topic-card-manage-btn:hover,
.topic-card-manage-wrap.menu-open .topic-card-manage-btn,
.topic-card-manage-wrap:hover .topic-card-manage-btn {
    background: #fff;
    color: #111827;
    border-color: #e5e7eb;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.topic-card-manage-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    min-width: 156px;
    padding: 8px 0;
    border-radius: 12px;
    border: 1px solid #ececec;
    background: #fff;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 8;
}

.topic-card-manage-wrap:hover .topic-card-manage-menu,
.topic-card-manage-wrap.menu-open .topic-card-manage-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.topic-manage-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    font-size: 13px;
    line-height: 1;
    color: #1f2937;
    text-decoration: none;
    white-space: nowrap;
}

.topic-manage-item:hover {
    background: #f6f7f9;
}

.topic-manage-item i {
    font-size: 14px;
    color: #6b7280;
}

.topic-manage-item.danger {
    color: #b91c1c;
}

.topic-manage-item.danger i {
    color: #dc2626;
}

.topic-fade-in {
    animation: topicFadeInUp 0.35s ease-out forwards;
}

@media (min-width: 768px) {
    /* 桌面端：保持信息流顺序，强化间距节奏 */
    .topic-feed-card > .flex.flex-col.h-full {
        display: flex;
        flex-direction: column;
    }

    .topic-card-avatar {
        width: 28px;
        height: 28px;
        flex: 0 0 28px;
    }

    .topic-card-author-text {
        min-height: 28px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 1px;
    }

    .topic-card-username {
        font-size: 0.84rem;
        line-height: 1.2;
        max-width: 220px;
    }

    .topic-card-time {
        font-size: 0.72rem;
        line-height: 1.2;
        color: #9ca3af;
    }

    .topic-card-title {
        margin-bottom: 5px;
    }

    .topic-card-status-row {
        margin-bottom: 10px;
    }

    .topic-card-media-link {
        margin-bottom: 8px;
    }

    .topic-card-source-row {
        margin-bottom: 9px;
    }
}

@media (min-width: 1024px) {
    .topic-two-col-layout {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 296px;
        gap: 24px;
        align-items: start;
    }

    .topic-two-col-layout > main {
        grid-column: 1 / 2;
    }

    .topic-two-col-layout > aside {
        display: block !important;
        grid-column: 2 / 3;
    }
}

@keyframes topicFadeInUp {
    from {
        opacity: 0;
        transform: translateY(14px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1023px) {
    .topic-filter-shell {
        top: var(--topic-header-offset);
    }

    .topic-filter-button {
        min-height: 44px;
    }

    .topic-card-media-grid {
        max-width: 100%;
    }

    .topic-card-media-item {
        flex: 0 0 clamp(88px, 26vw, 104px);
        width: clamp(88px, 26vw, 104px);
        height: clamp(88px, 26vw, 104px);
        aspect-ratio: 1 / 1;
    }
}

@media (max-width: 767px) {
    .topic-feed-list {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0 1px;
    }

    /* 移动端改为信息流：弱化“卡片线框感”，突出内容本身 */
    .topic-feed-card {
        margin: 0;
        padding: 13px 0 11px;
        border: 0;
        border-radius: 0;
        background: transparent;
        box-shadow: none;
        position: relative;
    }

    .topic-feed-card::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: 0;
        height: 1px;
        background: #e5e7eb;
        pointer-events: none;
    }

    .topic-feed-card:last-child::after {
        display: none;
    }

    .topic-feed-card:hover {
        transform: none;
        box-shadow: none;
        border-color: transparent;
    }

    .topic-card-avatar {
        width: 34px;
        height: 34px;
        flex: 0 0 34px;
    }

    .topic-card-author-block {
        margin-bottom: 9px;
    }

    .topic-card-author-row {
        align-items: flex-start;
        gap: 8px;
    }

    .topic-card-author-link {
        min-width: 0;
        align-items: center;
        text-decoration: none;
    }

    .topic-card-author-text {
        min-width: 0;
        min-height: 34px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
    }

    .topic-card-username {
        font-size: 0.84rem;
        font-weight: 600;
        color: #1f2937;
        line-height: 1.2;
        max-width: 180px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .topic-card-time {
        font-size: 0.72rem;
        line-height: 1.2;
        color: #9ca3af;
    }

    .topic-card-meta-tags {
        margin-top: 0;
        margin-bottom: 9px;
        gap: 6px;
    }

    .topic-card-group {
        display: inline-flex;
        align-items: center;
        max-width: 100%;
        padding: 0.16rem 0.42rem;
        font-size: 0.68rem;
        line-height: 1.2;
        color: #334155;
        background: #eef2f7;
        border: 0;
        border-radius: 7px;
        white-space: normal;
        word-break: break-word;
    }

    .topic-event-badge span {
        white-space: nowrap;
    }

    .topic-card-title {
        margin-bottom: 5px;
        font-size: 1.05rem;
        line-height: 1.4;
        font-weight: 700;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .topic-card-summary {
        margin-bottom: 12px;
        font-size: 0.845rem;
        line-height: 1.5;
        color: #6b7280;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .topic-card-media-grid {
        margin-bottom: 10px;
        gap: 8px;
    }

    .topic-card-status-row {
        margin-bottom: 8px;
        gap: 6px;
    }

    .topic-card-chip {
        height: 20px;
        padding: 0 7px;
        font-size: 11px;
    }

    .topic-card-status-inline {
        margin-left: 0;
        justify-content: flex-end;
    }

    .topic-card-source-row {
        margin-bottom: 8px;
    }

    .topic-card-stats {
        padding-top: 2px;
        gap: 14px;
        font-size: 0.73rem;
        color: #9ca3af;
    }

    .topic-card-manage-btn {
        width: 30px;
        height: 30px;
    }

    .topic-card-manage-menu {
        min-width: 148px;
    }

    .topic-stat-item {
        min-height: 22px;
    }

    .topic-filter-title {
        font-size: 1.25rem;
    }

    .topic-filter-description {
        font-size: 0.8125rem;
    }
}
