:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --brand: #2563eb;
    --shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
}

html[data-theme="dark"] {
    --bg: #0f172a;
    --panel: #1e293b;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --border: #334155;
    --brand: #60a5fa;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
    transition: background .25s, color .25s;
}

a { color: inherit; text-decoration: none; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

/* 顶部栏 */
.topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 20;
}
.topbar .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--brand); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 700;
}
.brand h1 { margin: 0; font-size: 18px; }
.brand p { margin: 0; font-size: 12px; color: var(--muted); }
.topbar-actions { display: flex; gap: 8px; }
.ghost-btn {
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
    padding: 7px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
}
.ghost-btn:hover { background: var(--bg); }

/* 搜索 */
.search-box { position: relative; margin: 26px 0 18px; }
.search-box input {
    width: 100%;
    padding: 14px 78px 14px 18px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--panel);
    color: var(--text);
    font-size: 15px;
    outline: none;
    box-shadow: var(--shadow);
}
.search-box input:focus { border-color: var(--brand); }
.search-tip {
    position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
    color: var(--muted); font-size: 12px;
    border: 1px solid var(--border); border-radius: 6px; padding: 2px 6px;
}

/* 分类导航 */
.cat-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.chip {
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--panel);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
}
.chip:hover { color: var(--brand); border-color: var(--brand); }

/* 分类区块 */
.cat { margin-bottom: 30px; scroll-margin-top: 84px; }
.cat-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.cat-head h2 { margin: 0; font-size: 17px; }
.cat-head .remark { color: var(--muted); font-size: 12px; }
.cat-head .count { color: var(--muted); font-size: 12px; margin-left: auto; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 14px;
}
.card {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px 30px;
    box-shadow: var(--shadow);
    transition: transform .18s, border-color .18s;
}
.card:hover { transform: translateY(-3px); border-color: var(--brand); }
.card-top { display: flex; align-items: center; gap: 10px; }
.icon {
    width: 34px; height: 34px; border-radius: 8px;
    object-fit: contain; background: var(--bg); flex: none;
}
.icon.letter {
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 16px; font-weight: 700;
}
.card-title { display: flex; flex-direction: column; min-width: 0; }
.card-title strong { font-size: 15px; }
.card-title small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-desc {
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
    min-height: 42px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.clicks {
    position: absolute; right: 14px; bottom: 10px;
    font-size: 12px; color: var(--muted);
}
.hidden { display: none !important; }
.empty {
    text-align: center; padding: 60px 20px; color: var(--muted);
    background: var(--panel); border: 1px dashed var(--border); border-radius: 12px;
}
.footer {
    margin-top: 40px; padding: 24px 0; text-align: center;
    color: var(--muted); font-size: 13px; border-top: 1px solid var(--border);
}
@media (max-width: 640px) {
    .search-tip { display: none; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}
