:root, [data-theme="dark"] {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-hover: #1c2128;
    --border: #30363d;
    --text: #e6edf3;
    --text-dim: #8b949e;
    --text-muted: #6e7681;
    --accent: #f85149;
    --orange: #d29922;
    --red: #f85149;
    --overlay: rgba(0,0,0,0.7);
}
[data-theme="light"] {
    --bg: #f6f8fa;
    --bg-card: #ffffff;
    --bg-hover: #eef1f4;
    --border: #d0d7de;
    --text: #1f2328;
    --text-dim: #656d76;
    --text-muted: #8c959f;
    --accent: #cf222e;
    --orange: #bc4c00;
    --red: #cf222e;
    --overlay: rgba(0,0,0,0.4);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { transition: background 0.3s ease; }
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}
a { color: inherit; text-decoration: none; }

/* 头部 */
.header {
    position: sticky; top: 0; z-index: 100;
    background: var(--bg);
    backdrop-filter: blur(12px);
}
.header-inner {
    max-width: 1600px; margin: 0 auto;
    display: flex; align-items: center; gap: 16px;
    padding: 16px 40px 12px;
}
.logo {
    display: flex; align-items: center; gap: 12px;
    flex-shrink: 0;
}
.logo-icon {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #ff6b35, #f7931e);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
    animation: breathe 2.5s ease-in-out infinite;
}
@keyframes breathe {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 53, 0.5); transform: scale(1); }
    50% { box-shadow: 0 0 0 10px rgba(255, 107, 53, 0); transform: scale(1.05); }
}
.logo-text h1 { font-size: 18px; font-weight: 800; letter-spacing: 1px; }
.logo-text p { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.search-box {
    width: 280px;
    margin-left: auto;
    position: relative;
}
.search-box input {
    width: 100%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 36px 10px 38px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}
.search-box input:focus { border-color: #58a6ff; }
.search-box .fa-search {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box .kbd {
    position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
    background: var(--bg-hover);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    color: var(--text-dim);
}

.header-right {
    display: flex; align-items: center; gap: 10px;
    flex-shrink: 0;
}
.stats {
    display: flex; gap: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 6px 14px;
}
.stats-item { text-align: center; }
.stats-item .num { font-size: 18px; font-weight: 700; color: var(--orange); }
.stats-item .label { font-size: 10px; color: var(--text-dim); }
.icon-btn {
    width: 38px; height: 38px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    transition: all 0.2s;
}
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }
.icon-btn.spinning i { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }

/* 分类标签 */
.category-bar {
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 72px; z-index: 99;
}
.category-inner {
    max-width: 1600px; margin: 0 auto;
    display: flex; gap: 8px; flex-wrap: wrap;
    padding: 12px 40px;
}
.cat-tab {
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.cat-tab:hover { background: var(--bg-card); color: var(--text); }
.cat-tab.active {
    background: #f8514922;
    color: var(--red);
    font-weight: 600;
}
.cat-tab .count {
    background: var(--bg-hover);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 11px;
}
.cat-tab.active .count { background: #f85149; color: #fff; }

/* 主内容 */
.main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 24px 40px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    transition: all 0.3s ease;
}
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-1 { grid-template-columns: 1fr; }
@media (max-width: 1200px) { .grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .grid, .grid.cols-2 { grid-template-columns: 1fr; } .header-inner { flex-wrap: wrap; } .search-box { order: 3; max-width: 100%; } }

/* 页面加载动画 */
.page-loader {
    position: fixed; inset: 0;
    background: var(--bg);
    z-index: 9999;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 20px;
    transition: opacity 0.4s ease;
}
.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}
.loader-fire {
    font-size: 48px;
    background: linear-gradient(135deg, #f85149, #d29922);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: firePulse 1s ease-in-out infinite;
}
@keyframes firePulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}
.loader-text {
    color: var(--text-dim);
    font-size: 14px;
    letter-spacing: 2px;
}
.loader-bar {
    width: 200px; height: 3px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}
.loader-bar::after {
    content: '';
    display: block;
    width: 40%; height: 100%;
    background: linear-gradient(90deg, #f85149, #d29922);
    border-radius: 3px;
    animation: loadingSlide 1.2s ease-in-out infinite;
}
@keyframes loadingSlide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.4s ease backwards;
}
.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 2px;
    background: linear-gradient(90deg, #f85149, #ff6b9d, #f85149);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}
.card:hover {
    transform: translateY(-6px);
}
.card:hover::before {
    transform: scaleX(1);
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px 12px;
}
.card-title {
    display: flex; align-items: center; gap: 10px;
}
.card-icon {
    width: 36px; height: 36px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; color: #fff;
    flex-shrink: 0;
    position: relative;
}
.card-icon img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.card-name h3 { font-size: 15px; font-weight: 600; }
.card-name p { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.view-all {
    font-size: 12px; color: var(--text-dim);
    cursor: pointer;
    transition: color 0.2s;
}
.view-all:hover { color: var(--text); }
.view-all i { font-size: 10px; margin-left: 2px; }

.card-list { padding: 0 18px 16px; }
.list-item {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 10px 8px;
    margin: 0 -8px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s, padding-left 0.2s;
}
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: var(--bg-hover); padding-left: 14px; }
.list-item:hover .item-title { color: #58a6ff; }
.rank {
    width: 20px; text-align: center;
    font-size: 13px; font-weight: 700;
    flex-shrink: 0;
    padding-top: 1px;
}
.rank.r1 { color: #f85149; }
.rank.r2 { color: #db6d28; }
.rank.r3 { color: #d29922; }
.rank.r4, .rank.r5, .rank.r6 { color: var(--text-muted); }
.item-content { flex: 1; min-width: 0; }
.item-title {
    font-size: 13px; line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.2s;
}
.item-hot {
    font-size: 11px; color: var(--orange);
    margin-top: 4px;
    display: flex; align-items: center; gap: 3px;
}
.item-thumb {
    width: 60px; height: 44px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--bg-hover);
}
.item-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}

/* 加载骨架屏 */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 弹窗 */
.modal-overlay {
    position: fixed; inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; animation: fadeIn 0.2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 100%; max-width: 640px;
    max-height: 80vh;
    display: flex; flex-direction: column;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 18px; }
.modal-close {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    color: var(--text-dim);
    background: transparent;
    border: none;
    font-size: 18px;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body {
    overflow-y: auto;
    padding: 8px 16px 16px;
}

/* 底部 */
.footer {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
    font-size: 12px;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}
.footer a { color: var(--text-dim); }
