/* WebLib 专属 CSS 变量 */
:root {
    --card-hover-bg: rgba(255, 255, 255, 0.6);
    --pill-bg: rgba(255, 255, 255, 0.3);
    --pill-active: rgba(255, 255, 255, 0.8);
}

/* 兼容 theme.js 的双重暗黑选择器 */
html.dark-mode, [data-theme="dark"] {
    --card-hover-bg: rgba(45, 48, 60, 0.6);
    --pill-bg: rgba(0, 0, 0, 0.3);
    --pill-active: rgba(255, 255, 255, 0.15);
}

/* 响应式导航栏 */
header {
    position: fixed; top: 0; width: 100%; z-index: 50;
    background: var(--glass-bg);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 15px 5%;
    display: flex; flex-direction: column; gap: 15px;
    box-shadow: var(--glass-shadow);
}

.header-top { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 20px; font-weight: 900; letter-spacing: 1px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.logo-icon { width: 34px; height: 34px; background: linear-gradient(135deg, #6366f1, #a855f7); border-radius: 10px; display: flex; justify-content: center; align-items: center; }

.toolbar-right { display: flex; align-items: center; gap: 12px; }

/* 高颜值时钟胶囊 */
#clock {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 14px; font-weight: 600;
    padding: 6px 14px; border-radius: 20px;
    background: var(--pill-bg); border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

/* 纯净主题按钮 */
.theme-btn {
    background: var(--pill-bg); border: 1px solid var(--glass-border);
    width: 36px; height: 36px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center;
    cursor: pointer; color: inherit; transition: 0.3s;
}
.theme-btn:hover { transform: scale(1.05); background: var(--pill-active); }

/* 搜索与分类胶囊 */
.header-bottom { display: flex; gap: 15px; align-items: center; }
.search-box {
    padding: 8px 16px; border-radius: 20px; border: 1px solid var(--glass-border);
    background: var(--pill-bg); outline: none; transition: 0.3s; color: inherit;
    width: 200px; flex-shrink: 0; font-size: 14px;
}
.search-box:focus { background: var(--pill-active); box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.3); }

/* 水平滑动分类胶囊 */
.category-pills {
    display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none;
    padding-bottom: 2px;
}
.category-pills::-webkit-scrollbar { display: none; }
.pill {
    padding: 6px 18px; border-radius: 20px; font-size: 13px; font-weight: 500;
    background: var(--pill-bg); border: 1px solid var(--glass-border);
    white-space: nowrap; cursor: pointer; transition: 0.3s; color: inherit;
}
.pill:hover { background: var(--card-hover-bg); }
.pill.active {
    background: #6366f1; color: #fff; border-color: #6366f1;
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

/* 卡片网格主体 */
main { padding: 140px 5% 60px; min-height: calc(100vh - 80px); }
.grid-container {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border); border-radius: 18px;
    padding: 20px; display: flex; flex-direction: column; gap: 12px;
    box-shadow: var(--glass-shadow); transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-decoration: none; color: inherit; position: relative;
    animation: cardEntrance 0.5s ease-out both;
}
.glass-card:hover { transform: translateY(-5px); background: var(--card-hover-bg); box-shadow: 0 15px 35px rgba(0,0,0,0.1); }

@keyframes cardEntrance { from { opacity: 0; transform: translateY(15px); } to { opacity: 1; transform: translateY(0); } }

.card-tag {
    position: absolute; top: 15px; right: 15px; font-size: 11px; font-weight: bold;
    padding: 3px 10px; border-radius: 20px; background: rgba(99, 102, 241, 0.15); color: #6366f1;
}
html.dark-mode .card-tag,
[data-theme="dark"] .card-tag { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

.card-header { display: flex; align-items: center; gap: 12px; }
.card-icon {
    width: 42px; height: 42px; border-radius: 12px; object-fit: cover;
    background: var(--pill-bg); padding: 2px; border: 1px solid var(--glass-border);
}
.card-title { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 130px;}
.card-desc { font-size: 13px; color: var(--text-muted); line-height: 1.5; flex-grow: 1; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* 底部信息 */
footer { text-align: center; padding: 20px; font-size: 12px; color: var(--text-muted); border-top: 1px solid var(--glass-border); background: var(--glass-bg); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }

/* 移动端终极适配 */
@media (max-width: 768px) {
    header { padding: 10px 5%; gap: 10px; }
    #clock { display: none; }
    .header-bottom { flex-direction: column; align-items: stretch; gap: 10px; }
    .search-box { width: 100%; }
    .category-pills { width: 100%; padding-bottom: 5px; }
    main { padding-top: 150px; }
}