@keyframes shake {
    0% { transform: translateY(0); }
    25% { transform: translateY(-1px); }
    50% { transform: translateY(1px); }
    75% { transform: translateY(-1px); }
    100% { transform: translateY(0); }
}

@keyframes rainbow {
    0% { color: red; }
    14% { color: orange; }
    28% { color: yellow; }
    42% { color: green; }
    57% { color: blue; }
    71% { color: indigo; }
    85% { color: violet; }
    100% { color: red; }
}

a {
    display: inline-block;
    text-decoration: none;
    color: inherit;
}

.shake-text span {
    display: inline-block;
    animation: shake 0.5s ease-in-out infinite;
}

.shake-text span:nth-child(1) { animation-delay: 0s; }
.shake-text span:nth-child(2) { animation-delay: 0.1s; }
.shake-text span:nth-child(3) { animation-delay: 0.2s; }
.shake-text span:nth-child(4) { animation-delay: 0.3s; }
.shake-text span:nth-child(5) { animation-delay: 0.4s; }
.shake-text span:nth-child(6) { animation-delay: 0.5s; }
.shake-text span:nth-child(7) { animation-delay: 0.6s; }
.shake-text span:nth-child(8) { animation-delay: 0.7s; }
.shake-text span:nth-child(9) { animation-delay: 0.8s; }

.rainbow-text span {
    animation: shake 0.5s ease-in-out infinite, rainbow 3s linear infinite;
}

.resource-top {
    display: flex;
    flex-wrap: nowrap;
    gap: 8px;
    justify-content: flex-start;
    width: 100%;
    max-width: 100%;
    margin: 0;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}

.resource-top .res-col {
    flex: 0 0 auto;
    min-width: 160px;
    max-width: 240px;
}

.res-menu {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 10px;
    border: 1px solid #e6ecff;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
    min-height: 38px;
    text-align: center;
    transition: all 0.2s;
    white-space: nowrap;
}

.res-menu:hover { font-weight: bold; }

.res-menu span {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    font-size: 14px;
    font-weight: normal;
    width: 100%;
    transition: font-weight 0.2s;
}

.res-menu:hover span { font-weight: bold; }
.res-menu i { margin-right: 6px; color: inherit; }

.res-menu span i:last-child {
    margin-left: 6px;
    margin-right: 0;
    color: #999;
    transition: transform 0.2s, color 0.2s;
}

.res-menu.active {
    border-color: #2a8cff;
    background: #f7fbff;
}

.res-menu.active span i:last-child {
    color: #2a8cff;
    transform: rotate(180deg);
}

.res-sub {
    display: none;
    margin-top: 3px;
    padding: 4px;
    border: none !important;
    border-radius: 8px;
    background: #fff;
    min-height: 50px;
}

.res-sub.open { display: block; }

.res-sub a {
    display: block;
    padding: 6px 10px;
    margin: 1px 0;
    background: #f5f5f5;
    border-radius: 4px;
    text-decoration: none;
    color: #333;
    font-size: 13px;
    border-left: 3px solid #2a8cff;
    text-align: center;
    transition: all 0.2s;
}

.res-sub a:hover {
    background: #e0e0e0;
    color: #2a8cff;
    border-left-color: #ff6b35;
    font-weight: bold;
}

@media (max-width: 992px) {
    .resource-top {
        flex-wrap: wrap;
        justify-content: center;
    }
    .resource-top .res-col {
        flex: 1 1 calc(33.33% - 12px);
        min-width: 150px;
    }
}

@media (max-width: 767px) {
    .resource-top {
        flex-wrap: wrap;
        gap: 6px;
        padding: 0 4px 2px;
        overflow-x: hidden;
    }

    #置顶站点 > .top-grid:not(.top-grid-fav) {
        padding: 3px 4px 1px;
    }

    #置顶站点 > .top-grid:not(.top-grid-fav) .item {
        padding: 4px 3px 2px;
    }

    #置顶站点 > .top-grid:not(.top-grid-fav) .item .name {
        margin-top: 3px;
    }

    .card:has(.resource-top) > .card-body {
        padding: 3px 4px 4px;
    }

    .resource-top .res-col {
        flex: 1 1 calc(50% - 8px);
        min-width: 0;
    }
    .res-menu { padding: 6px 8px; min-height: 36px; }
    .res-menu span { font-size: 13px; }
    .res-menu i { font-size: 12px; }
}

body { padding-top: 70px; }

.page-hero {
    text-align: center;
    margin: 18px auto 6px;
    color: #fff;
    max-width: 720px;
    padding: 0 12px;
}

.page-hero-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 6px;
    letter-spacing: 0.5px;
}

.page-hero-subtitle {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.88);
}

@media (max-width: 768px) {
    .applications-grid {
        gap: 6px;
        padding: 10px !important;
    }
    .app-tag {
        padding: 6px 12px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .app-tag {
        padding: 5px 10px;
        font-size: 11px;
    }
}

.content-width-match { position: relative; }

.content-width-wrapper {
    display: flex;
    gap: 8px;
    margin: 0 8px;
    align-items: stretch;
}

.content-width-left {
    flex: 1;
    min-width: 0;
}

.content-width-right {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

.content-width-right .card { height: 100%; }

.article-featured-grid {
    display: grid;
    gap: 8px;
    align-items: stretch;
}

.article-featured-grid .forum-home-block {
    min-width: 0;
    max-width: 100%;
}

/* 论坛 6 行：固定 140px 高度，缩小字号与行距 */
.featured-articles-card > .card-body {
    padding: 3px 6px;
    min-width: 0;
}

.forum-home-block {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: 140px;
    max-height: 140px;
    min-height: 140px;
    --forum-home-font-size: 14px;
    --forum-home-line-height: 1.15;
    --forum-home-row-count: 6;
    display: flex;
    flex-direction: column;
    justify-content: stretch;
    gap: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    border: none;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    box-sizing: border-box;
}

.forum-home-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 6.8em 11ch 4.55em;
    column-gap: 10px;
    align-items: center;
    flex: 1 1 0;
    min-height: 0;
    max-height: calc(140px / var(--forum-home-row-count, 6));
    padding: 0 1px;
    border: none;
    font-size: var(--forum-home-font-size, 14px);
    line-height: var(--forum-home-line-height, 1.15);
    font-weight: 400;
    color: #666;
    text-decoration: none;
    box-sizing: border-box;
    transition: background 0.2s ease, color 0.2s ease;
}

.forum-home-row:not(.is-placeholder):hover {
    background: #f8faff;
    border-radius: 4px;
}

.forum-home-row:not(.is-placeholder):hover .forum-home-col-title {
    color: #ff7f00;
}

.forum-home-row.is-placeholder {
    color: #bbb;
    cursor: default;
    pointer-events: none;
}

.forum-home-row.is-board-invite {
    color: #666;
    cursor: pointer;
}

.forum-home-row.is-board-invite .forum-home-col-title {
    color: #111;
}

.forum-home-row.is-board-invite:hover {
    background: #f8faff;
    border-radius: 4px;
}

.forum-home-row.is-board-invite:hover .forum-home-col-title {
    color: #ff7f00;
}

.forum-home-row.is-board-invite .forum-home-col-board {
    color: #888;
}

.forum-home-row.is-placeholder .forum-home-col-title,
.forum-home-row.is-placeholder .forum-home-col-board,
.forum-home-row.is-placeholder .forum-home-col-time,
.forum-home-row.is-placeholder .forum-home-col-reply {
    color: #ccc;
}

.forum-home-col {
    font-size: var(--forum-home-font-size, 14px);
    font-weight: 400;
}

.forum-home-col-title {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #111;
    font-weight: 400;
}

/* 未读：深色；已读：浅灰（:visited 兜底 + JS .is-read） */
a.forum-home-row:visited .forum-home-col-title,
.forum-home-row.is-read .forum-home-col-title {
    color: #b0b0b0 !important;
    font-weight: 400;
}

.forum-home-row.is-unread .forum-home-col-title {
    color: #111 !important;
    font-weight: 400;
}

.forum-home-row.is-read:hover .forum-home-col-title {
    color: #999 !important;
}

.forum-home-row.is-unread:not(.is-placeholder):hover .forum-home-col-title {
    color: #ff7f00 !important;
}

.forum-home-col-board,
.forum-home-col-time,
.forum-home-col-reply {
    flex-shrink: 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.forum-home-col-board {
    text-align: left;
    color: #888;
}

.forum-home-col-time {
    text-align: left;
    color: #999;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
}

.forum-home-col-reply {
    text-align: left;
    color: #888;
}

.forum-home-row:not(.is-placeholder) .forum-home-col-reply {
    color: #5a8fbd;
}

.forum-home-row.forum-home-wiping-out {
    animation: forumHomeWipeOut 0.3s ease-in-out forwards;
}

.forum-home-row.forum-home-wiping-in {
    animation: forumHomeWipeIn 0.6s ease-in-out forwards;
}

@keyframes forumHomeWipeOut {
    0% { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-4px); }
}

@keyframes forumHomeWipeIn {
    0% { opacity: 0; transform: translateY(4px); }
    100% { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1200px) {
    .article-featured-grid .featured-media-player,
    .article-featured-grid .featured-media-player-slot { grid-column: 1 / -1; }
    .forum-home-row {
        grid-template-columns: minmax(0, 1fr) 6.2em 10ch 4.16em;
        column-gap: 8px;
    }
    .forum-home-col {
        font-size: var(--forum-home-font-size, 14px);
    }
}

@media (max-width: 600px) {
    .forum-home-block {
        height: 150px;
        max-height: 150px;
        min-height: 150px;
    }
    .forum-home-row {
        grid-template-columns: minmax(0, 1fr) 5.6em 9.5ch 3.9em;
        column-gap: 6px;
        padding: 0 1px;
        max-height: calc(150px / var(--forum-home-row-count, 6));
    }
    .forum-home-col {
        font-size: var(--forum-home-font-size, 14px);
    }
}

@media (max-width: 991px) {
    .content-width-wrapper { flex-direction: column; }
    .content-width-right { display: none; }
    .content-width-left { width: 100%; }
}

.content-width-left .card { margin: 0 0 5px 0; }

/* 置顶推荐（tui=1）紧凑间距，不影响下方收藏栏 */
#置顶站点.card {
    overflow: visible;
}

#置顶站点 > .top-grid:not(.top-grid-fav) {
    padding: 4px 6px 1px;
}

#置顶站点 > .top-grid:not(.top-grid-fav) .item {
    padding: 5px 5px 3px;
}

#置顶站点 > .top-grid:not(.top-grid-fav) .item .name {
    margin-top: 4px;
}

/* 资源导航（在线工具等）容器内边距 */
.card:has(.resource-top) > .card-body {
    padding: 4px 6px 5px;
}

.news-stock-layout {
    position: relative;
    display: block;
    padding-right: 308px;
}

.news-stock-layout .content-width-left,
.news-stock-layout .content-width-right {
    width: auto;
    flex: none;
}

.news-stock-layout .content-width-left { min-width: 0; }

.news-stock-layout .content-width-right {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 320px;
}

@media (min-width: 1201px) {
    .news-stock-layout .content-width-right.desktop-stock-wrapper {
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        overflow: hidden;
        z-index: 40;
        isolation: isolate;
    }

    .news-stock-layout .desktop-stock-wrapper > .stock-market-card {
        flex: 1 1 auto;
        min-height: 0;
        height: 100%;
        overflow: hidden;
    }
}

@media (max-width: 1200px) {
    .news-stock-layout { padding-right: 0; }
    .news-stock-layout .content-width-right {
        position: static;
        width: 100%;
        right: 0;
        top: 0;
    }
    .news-stock-layout {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.subsort-filter-index:hover {
    border-color: #2a8cff;
    box-shadow: 0 0 0 2px rgba(42, 140, 255, 0.1);
}

.subsort-filter-index:focus {
    outline: none;
    border-color: #2a8cff;
    box-shadow: 0 0 0 3px rgba(42, 140, 255, 0.15);
}

.item-hidden { display: none !important; }

.item {
    position: relative;
    overflow: hidden;
}

.card-body { position: relative; }

.item.wiping-out {
    position: relative;
    z-index: 1;
    animation: wipeOut 1.2s ease-in-out forwards;
}

@keyframes wipeOut {
    0% { clip-path: inset(0 0 0 0); }
    100% { clip-path: inset(0 0 0 100%); }
}

.item.wiping-in {
    animation: wipeIn 1.2s ease-in-out forwards;
}

@keyframes wipeIn {
    0% { clip-path: inset(0 100% 0 0); }
    100% { clip-path: inset(0 0 0 0); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.article-empty-hint {
    text-align: center;
    padding: 20px;
    color: #999;
}

/* 首页文章信息：AI 自动发文单行紧凑列表（财联社/股市时事/国际时事/AI最新资讯） */
#article-content .article-category-auto {
    display: block;
}

#article-content .post.post-auto-publish {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100% !important;
    max-width: 100%;
    padding: 4px 6px;
    margin: 0;
    border-bottom: 1px solid #f0f0f0;
    border-radius: 0;
    box-sizing: border-box;
    line-height: 1.35;
}

#article-content .post.post-auto-publish:last-child {
    border-bottom: none;
}

#article-content .post.post-auto-publish:hover {
    background: #f7f9fc;
}

#article-content .post.post-auto-publish .title {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    line-height: 1.35;
    height: auto;
    max-height: none;
    margin: 0;
    padding: 0;
    color: #111;
    font-weight: 400;
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
}

a.post.post-auto-publish:visited .title,
#article-content .post.post-auto-publish.is-read .title {
    color: #b0b0b0 !important;
    font-weight: 400;
}

#article-content .post.post-auto-publish.is-unread .title {
    color: #111 !important;
    font-weight: 400;
}

#article-content .post.post-auto-publish .info {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    color: #999;
    font-size: 11px;
    line-height: 1.2;
}

#article-content .post.post-auto-publish .info .meta-view,
#article-content .post.post-auto-publish .info .meta-time {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

#article-content .post.post-auto-publish.is-unread:hover .title {
    color: #2a8cff !important;
}

#article-content .post.post-auto-publish.is-read:hover .title {
    color: #999 !important;
}

@media (max-width: 767px) {
    #article-content .post.post-auto-publish {
        gap: 8px;
        padding: 3px 4px;
    }

    #article-content .post.post-auto-publish .title {
        font-size: 13px;
    }

    #article-content .post.post-auto-publish .info {
        font-size: 10px;
        gap: 6px;
    }
}

@media (max-width: 480px) {
    #article-content .post.post-auto-publish {
        gap: 6px;
        padding: 3px 2px;
    }

    #article-content .post.post-auto-publish .title {
        font-size: 12px;
    }

    #article-content .post.post-auto-publish .info {
        font-size: 9px;
        gap: 4px;
    }

    #article-content .post.post-auto-publish .info .fa {
        font-size: 10px;
    }
}
