:root {
    --primary: #1a5cff;
    --primary-dark: #0a4ad0;
    --primary-light: #e9edff;
    --bg-body: #f4f6f9;
    --bg-card: #ffffff;
    --text-dark: #1e1e2a;
    --text-mid: #2d2d3f;
    --text-light: #6b6b80;
    --border-light: #e6eaf0;
    --shadow-sm: 0 1px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.07);
    --radius: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { margin:0; padding:0; box-sizing:border-box; }
body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-dark);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

.container { max-width: 1440px; margin: 0 auto; padding: 0 16px; }

/* ===== 头部 ===== */
.page-header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}
.page-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}
.page-title {
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}
.page-title i { color: var(--primary); font-size: 24px; }
.page-title span { color: var(--primary); }
.page-meta {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.page-meta .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #52c41a; display: inline-block;
    margin-right: 4px;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}
.btn-refresh {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 6px 20px;
    border-radius: 30px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}
.btn-refresh:hover { background: var(--primary-dark); }
.btn-refresh:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-debug {
    background: #6b6b80 !important;
}
.btn-debug:hover {
    background: #4d4d5e !important;
}

/* ===== 统计栏 ===== */
.stats-bar {
    display: flex;
    gap: 24px;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-light);
    flex-wrap: wrap;
}
.stats-bar .stat strong {
    color: var(--text-dark);
    font-weight: 700;
    margin-left: 4px;
}

/* ===== 热榜网格 ===== */
.hot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
    padding-bottom: 40px;
}

/* ===== 卡片 ===== */
.hot-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: box-shadow 0.2s;
}
.hot-card:hover { box-shadow: var(--shadow-md); }

/* IPMC 卡片高亮 */
.hot-card[data-platform="ipmc"] {
    border: 2px solid var(--primary);
}
.hot-card[data-platform="ipmc"] .card-header {
    background: linear-gradient(135deg, #eef3ff, #ffffff);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    flex-shrink: 0;
}
.card-header .name {
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}
.card-header .name i {
    font-size: 14px;
    color: var(--primary);
}
.card-header .count {
    font-size: 12px;
    color: var(--text-light);
    background: var(--bg-body);
    padding: 2px 10px;
    border-radius: 30px;
}

/* ===== 列表滚动区 ===== */
.card-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px 0;
    flex: 1;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: #d0d5dd transparent;
}
.card-list::-webkit-scrollbar { width: 6px; }
.card-list::-webkit-scrollbar-track { background: transparent; }
.card-list::-webkit-scrollbar-thumb {
    background: #d0d5dd;
    border-radius: 3px;
}
.card-list::-webkit-scrollbar-thumb:hover { background: #b0b5bd; }

.card-list li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 16px;
    transition: background 0.15s;
    cursor: pointer;
}
.card-list li:hover { background: #f7f9ff; }

.rank-num {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: #c9cfdb;
    flex-shrink: 0;
    font-family: "SF Mono", Consolas, monospace;
    margin-top: 2px;
}
.card-list li:nth-child(1) .rank-num { background: linear-gradient(135deg, #ff5b5b, #ff2d55); }
.card-list li:nth-child(2) .rank-num { background: linear-gradient(135deg, #ff9f43, #ff7a18); }
.card-list li:nth-child(3) .rank-num { background: linear-gradient(135deg, #ffc94b, #f6a700); }

.item-title {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.5;
    color: var(--text-mid);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}
.card-list li:hover .item-title { color: var(--primary); }

.item-hot {
    font-size: 11px;
    color: var(--text-light);
    flex-shrink: 0;
    white-space: nowrap;
    margin-top: 2px;
}

.footer{margin-top:0;}

/* ===== 骨架屏 ===== */
.skeleton-item {
    height: 14px;
    border-radius: 4px;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.2s infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== 错误/空状态 ===== */
.error-state {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-light);
    font-size: 13px;
    width: 100%;
}
.error-state i {
    font-size: 24px;
    display: block;
    margin-bottom: 8px;
    opacity: 0.4;
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .hot-grid { grid-template-columns: 1fr; gap: 12px; }
    .page-title { font-size: 18px; }
    .page-header { padding: 14px 0; }
    .card-list { max-height: 320px; }
    .card-list li { padding: 7px 14px; }
    .item-title { font-size: 12px; }
    .stats-bar { gap: 16px; font-size: 12px; }
}
@media (max-width: 480px) {
    .container { padding: 0 12px; }
    .page-title { font-size: 16px; }
    .page-title i { font-size: 20px; }
    .btn-refresh { padding: 5px 14px; font-size: 12px; }
    .card-header { padding: 10px 14px; }
    .card-header .name { font-size: 14px; }
    .card-list { max-height: 280px; }
    .card-list li { padding: 6px 12px; gap: 8px; }
    .rank-num { width: 18px; height: 18px; font-size: 10px; }
    .item-title { font-size: 12px; }
    .item-hot { font-size: 10px; }
}