/**
 * 文章侧栏：下载热度榜
 *
 * 暗色规则同文件维护（body.dark-open）。未选中胶囊比卡片底深一档，
 * 品牌橙 #f58907 不当浅底文字色（对比度不够），前三名次用压深的 #a85e05。
 */

.xy-dheat-tabs {
    display: flex;
    gap: 6px;
    margin: 0 0 12px;
}

.xy-dheat-tab {
    flex: 1 1 0;
    min-width: 0;
    height: 28px;
    padding: 0 4px;
    border: 0;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
    background-color: #e4e9ec;
    color: #34495e;
    font-size: 12px;
    font-weight: 600;
    line-height: 28px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}

.xy-dheat-tab:hover {
    background-color: #d7dee2;
    color: #2c3e50;
}

.xy-dheat-tab.active {
    background: var(--xy-primary-gradient, linear-gradient(135deg, #f58907 0%, #e67d00 100%));
    color: #fff;
}

.xy-dheat-tab:focus {
    outline: none;
}

.xy-dheat-tab:focus-visible {
    box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--xy-primary, #f58907);
}

.xy-dheat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* 压过 app.css 的 `.widget ul li { padding: 5px 0 }`，间距交给 .xy-dheat-link */
.widget-area .xy-dheat-list > li {
    padding: 0;
}

.xy-dheat-item + .xy-dheat-item {
    border-top: 1px solid #f0f0f0;
}

.widget-area .xy-dheat-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 4px;
    margin: 0 -4px;
    border-radius: 6px;
    text-decoration: none;
    color: #34495e;
}

.widget-area .xy-dheat-link:hover {
    background-color: #f7f8fa;
    text-decoration: none;
}

.xy-dheat-item.is-current .xy-dheat-link {
    background-color: #fff6ea;
}

/* 必须压过 app.css 的 `.widget ul li span { color:#ccc }`，否则名次和标题全是浅灰 */
.widget-area .xy-dheat-rank {
    flex: 0 0 1.35em;
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 13px;
    line-height: 1;
    text-align: center;
    color: #8a9aab;
}

.widget-area .xy-dheat-rank.is-top {
    color: #a85e05;
}

.xy-dheat-cover {
    flex: 0 0 64px;
    width: 64px;
    height: 36px;
    border-radius: 4px;
    overflow: hidden;
    background: #f0f0f0;
}

.xy-dheat-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.widget-area .xy-dheat-title {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.35;
    color: #34495e;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.widget-area .xy-dheat-link:hover .xy-dheat-title {
    color: #a85e05;
}

.xy-dheat-empty {
    padding: 18px 8px;
    text-align: center;
    font-size: 13px;
    color: #6e787e;
}

.xy-dheat-more {
    display: block;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #f0f0f0;
    text-align: center;
    font-size: 12px;
    color: #6e787e;
}

.xy-dheat-more:hover {
    color: #a85e05;
    text-decoration: none;
}

.xy-dheat.is-loading .xy-dheat-list {
    opacity: .45;
    pointer-events: none;
}

/* ========== 暗色 ========== */

body.dark-open .xy-dheat-tab {
    background-color: #323b52;
    color: #c6cfd8;
}

body.dark-open .xy-dheat-tab:hover {
    background-color: #3a445c;
    color: #e9ecef;
}

body.dark-open .xy-dheat-tab.active {
    color: #fff;
}

body.dark-open .xy-dheat-tab:focus-visible {
    box-shadow: 0 0 0 2px #293042, 0 0 0 4px var(--xy-primary, #f58907);
}

body.dark-open .xy-dheat-item + .xy-dheat-item {
    border-top-color: #20242f;
}

body.dark-open .xy-dheat-link:hover {
    background-color: rgba(255, 255, 255, .04);
}

body.dark-open .xy-dheat-item.is-current .xy-dheat-link {
    background-color: rgba(245, 137, 7, .12);
}

body.dark-open .widget-area .xy-dheat-rank {
    color: #9aa3b2;
}

body.dark-open .widget-area .xy-dheat-rank.is-top {
    color: #f58907;
}

body.dark-open .xy-dheat-cover {
    background: #20242f;
}

body.dark-open .widget-area .xy-dheat-title {
    color: #c6cfd8;
}

body.dark-open .widget-area .xy-dheat-link:hover .xy-dheat-title {
    color: #f58907;
}

body.dark-open .xy-dheat-empty {
    color: #8b95a3;
}

body.dark-open .xy-dheat-more {
    border-top-color: #20242f;
    color: #8b95a3;
}

body.dark-open .xy-dheat-more:hover {
    color: #f58907;
}

@media (prefers-reduced-motion: reduce) {
    .xy-dheat-tab,
    .xy-dheat.is-loading .xy-dheat-list {
        transition: none;
    }
}
