/* ============ NavHub 前端样式 ============ */
:root {
    --bg: #0b0f1a;
    --bg-soft: #111726;
    --card: rgba(255, 255, 255, .045);
    --card-hover: rgba(255, 255, 255, .085);
    --border: rgba(255, 255, 255, .09);
    --border-strong: rgba(255, 255, 255, .16);
    --text: #e8ecf6;
    --text-dim: #98a2bd;
    --text-mute: #6b7690;
    --brand: #6d8cff;
    --brand2: #b06dff;
    --brand3: #34d3aa;
    --accent: #ffb457;
    --shadow: 0 8px 30px rgba(0, 0, 0, .35);
    --radius: 18px;
    --radius-sm: 12px;
    --max: 1280px;
}

html[data-theme="light"] {
    --bg: #f4f6fb;
    --bg-soft: #ffffff;
    --card: rgba(255, 255, 255, .82);
    --card-hover: #ffffff;
    --border: rgba(15, 23, 42, .08);
    --border-strong: rgba(15, 23, 42, .16);
    --text: #131a2a;
    --text-dim: #5a6480;
    --text-mute: #8a93ab;
    --shadow: 0 8px 28px rgba(20, 30, 60, .10);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background .3s ease, color .3s ease;
    overflow-x: hidden;
}

/* 背景光效 */
.bg-fx {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}
.bg-fx i {
    position: absolute;
    display: block;
    border-radius: 50%;
    filter: blur(90px);
    opacity: .5;
    animation: float 18s ease-in-out infinite;
}
.bg-fx i:nth-child(1) { width: 520px; height: 520px; background: #4b6cff; top: -180px; left: -120px; }
.bg-fx i:nth-child(2) { width: 460px; height: 460px; background: #a855f7; top: 20%; right: -160px; animation-delay: -6s; }
.bg-fx i:nth-child(3) { width: 420px; height: 420px; background: #14b8a6; bottom: -180px; left: 32%; animation-delay: -11s; }
html[data-theme="light"] .bg-fx i { opacity: .28; filter: blur(100px); }

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33%      { transform: translate(40px, -30px) scale(1.08); }
    66%      { transform: translate(-30px, 25px) scale(.95); }
}

.bg-grid {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
    background-size: 46px 46px;
    mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 30%, transparent 100%);
}
html[data-theme="light"] .bg-grid { background-image: linear-gradient(rgba(15,23,42,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(15,23,42,.045) 1px, transparent 1px); }

.wrap { position: relative; z-index: 1; max-width: var(--max); margin: 0 auto; padding: 0 20px 80px; }

/* ---------- 顶部 ---------- */
header.top {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(160%) blur(16px);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    border-bottom: 1px solid var(--border);
}
.top-inner {
    max-width: var(--max);
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .3px; white-space: nowrap; }
.logo .emo { font-size: 24px; filter: drop-shadow(0 2px 8px rgba(109, 140, 255, .5)); }
.logo span { background: linear-gradient(92deg, var(--brand), var(--brand2) 55%, var(--brand3)); -webkit-background-clip: text; background-clip: text; color: transparent; }

.search {
    flex: 1;
    position: relative;
    max-width: 520px;
    margin-left: auto;
}
.search input {
    width: 100%;
    padding: 11px 44px 11px 42px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--card);
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: all .25s ease;
}
.search input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(109, 140, 255, .15); background: var(--card-hover); }
.search input::placeholder { color: var(--text-mute); }
.search .ico { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-mute); font-size: 15px; }
.search .clear { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--text-mute); cursor: pointer; font-size: 16px; display: none; padding: 4px; }
.search .clear:hover { color: var(--text); }
.search.has-value .clear { display: block; }

.top-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
    width: 38px; height: 38px;
    display: grid; place-items: center;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-dim);
    cursor: pointer;
    font-size: 16px;
    transition: all .2s ease;
    text-decoration: none;
}
.icon-btn:hover { color: var(--text); border-color: var(--brand); transform: translateY(-1px); background: var(--card-hover); }

/* ---------- Hero ---------- */
.hero { padding: 54px 0 26px; text-align: center; }
.hero h1 {
    margin: 0 0 12px;
    font-size: clamp(28px, 5vw, 46px);
    font-weight: 800;
    letter-spacing: -.5px;
    background: linear-gradient(96deg, var(--text) 10%, var(--brand) 45%, var(--brand2) 70%, var(--brand3));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p { margin: 0; color: var(--text-dim); font-size: clamp(14px, 2vw, 17px); }

.stats { display: flex; justify-content: center; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.stat {
    padding: 10px 20px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
    font-size: 13px;
    color: var(--text-dim);
    backdrop-filter: blur(10px);
}
.stat b { color: var(--text); font-size: 16px; margin-right: 5px; font-variant-numeric: tabular-nums; }

/* ---------- 分类导航 ---------- */
.cats-bar { position: sticky; top: 62px; z-index: 40; padding: 14px 0 6px; background: linear-gradient(var(--bg) 65%, transparent); }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cat-chip {
    flex: 0 0 auto;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-dim);
    font-size: 13.5px;
    cursor: pointer;
    transition: all .2s ease;
    white-space: nowrap;
}
.cat-chip:hover { color: var(--text); border-color: var(--border-strong); }
.cat-chip.active {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(93deg, var(--brand), var(--brand2));
    box-shadow: 0 6px 18px rgba(109, 140, 255, .32);
}
html[data-theme="light"] .cat-chip.active { box-shadow: 0 6px 16px rgba(109, 140, 255, .28); }

/* ---------- 区块 ---------- */
.section { margin-top: 26px; scroll-margin-top: 120px; }
.section-head { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; padding-left: 2px; }
.section-head h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: .3px; }
.section-head .emo { font-size: 19px; }
.section-head .count { font-size: 12px; color: var(--text-mute); border: 1px solid var(--border); padding: 1px 9px; border-radius: 999px; }
.section-head .line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
    gap: 14px;
}

/* ---------- 卡片 ---------- */
.card {
    position: relative;
    display: flex;
    gap: 13px;
    padding: 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card);
    backdrop-filter: blur(12px);
    cursor: pointer;
    overflow: hidden;
    transition: transform .22s cubic-bezier(.2,.8,.3,1), border-color .22s, background .22s, box-shadow .22s;
    animation: rise .4s cubic-bezier(.2,.8,.3,1) both;
}
.card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0;
    background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), rgba(109, 140, 255, .16), transparent 60%);
    transition: opacity .3s;
    pointer-events: none;
}
.card:hover { transform: translateY(-4px); border-color: var(--border-strong); background: var(--card-hover); box-shadow: var(--shadow); }
.card:hover::after { opacity: 1; }
.card:active { transform: translateY(-1px) scale(.995); }

.card .ic {
    flex: 0 0 auto;
    width: 46px; height: 46px;
    border-radius: 13px;
    display: grid; place-items: center;
    font-size: 23px;
    background: linear-gradient(140deg, rgba(109, 140, 255, .22), rgba(176, 109, 255, .18));
    border: 1px solid var(--border);
    overflow: hidden;
}
.card .ic img { width: 100%; height: 100%; object-fit: cover; }
.card .ic .letter { font-weight: 800; font-size: 19px; color: #fff; text-transform: uppercase; }
.card .body { min-width: 0; flex: 1; }
.card .t {
    font-weight: 650;
    font-size: 15px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}
.card .t .top-badge { font-size: 10px; color: var(--accent); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; line-height: 15px; }
.card .d {
    margin-top: 4px;
    font-size: 12.5px;
    color: var(--text-dim);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 20px;
}
.card .meta { margin-top: 8px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tag {
    font-size: 11px;
    color: var(--text-mute);
    background: rgba(125, 140, 180, .13);
    border-radius: 6px;
    padding: 1px 7px;
}
.card .visits { margin-left: auto; font-size: 11px; color: var(--text-mute); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card .go {
    position: absolute;
    right: 12px; top: 12px;
    font-size: 12px;
    color: var(--text-mute);
    opacity: 0;
    transform: translateX(-4px);
    transition: all .22s;
}
.card:hover .go { opacity: 1; transform: none; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* 空状态 */
.empty {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-mute);
}
.empty .em { font-size: 46px; display: block; margin-bottom: 12px; opacity: .8; }

/* ---------- 预览弹层 ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: none;
    background: rgba(4, 7, 14, .72);
    backdrop-filter: blur(6px);
    padding: 24px;
}
.modal.show { display: flex; align-items: center; justify-content: center; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.modal-box {
    width: min(1200px, 100%);
    height: min(86vh, 900px);
    background: var(--bg-soft);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
    animation: pop .26s cubic-bezier(.2,.9,.3,1);
}
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98) } to { opacity: 1; transform: none } }
.modal-head {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg-soft) 80%, #000);
}
.modal-head .t { font-weight: 650; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-head .sp { flex: 1 }
.modal-head button, .modal-head a {
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-dim);
    border-radius: 9px;
    padding: 5px 12px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all .2s;
}
.modal-head button:hover, .modal-head a:hover { color: var(--text); border-color: var(--brand); }
.modal-body { flex: 1; background: #fff; }
.modal-body iframe { width: 100%; height: 100%; border: 0; display: block; }

/* ---------- 页脚 ---------- */
footer.foot { text-align: center; padding: 40px 20px 20px; color: var(--text-mute); font-size: 13px; }
footer.foot a { color: var(--text-dim); text-decoration: none; }
footer.foot a:hover { color: var(--brand); }

/* 回到顶部 */
#toTop {
    position: fixed;
    right: 22px; bottom: 26px;
    width: 42px; height: 42px;
    border-radius: 14px;
    display: grid; place-items: center;
    border: 1px solid var(--border-strong);
    background: var(--card);
    backdrop-filter: blur(10px);
    color: var(--text-dim);
    cursor: pointer;
    z-index: 60;
    opacity: 0; pointer-events: none;
    transition: all .25s;
}
#toTop.show { opacity: 1; pointer-events: auto; }
#toTop:hover { color: var(--text); transform: translateY(-3px); }

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
    .top-inner { flex-wrap: wrap; gap: 10px; padding: 10px 14px; }
    .search { order: 3; flex-basis: 100%; max-width: none; margin-left: 0; }
    .logo { font-size: 16px; }
    .cats-bar { top: 104px; }
    .hero { padding: 34px 0 16px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
    .card { padding: 13px; gap: 10px; border-radius: 15px; }
    .card .ic { width: 40px; height: 40px; font-size: 20px; border-radius: 11px; }
    .card .d { -webkit-line-clamp: 2; font-size: 12px; }
    .wrap { padding: 0 14px 60px; }
    .section { scroll-margin-top: 160px; }
    .modal { padding: 0; }
    .modal-box { height: 100vh; width: 100vw; border-radius: 0; border: 0; }
    #toTop { bottom: 16px; right: 14px; }
}

@media (max-width: 400px) {
    .grid { grid-template-columns: 1fr 1fr; }
    .card .d { display: none; }
}
