/* ==========================================================
   网址导航 - 前台样式
   ========================================================== */

:root {
    --accent: #6366f1;
    --accent-soft: color-mix(in srgb, var(--accent) 14%, transparent);
    --radius: 14px;
    --header-h: 68px;
    --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --transition: .22s cubic-bezier(.4, 0, .2, 1);
}

html[data-theme="dark"] {
    --bg: #080b11;
    --bg-elev: rgba(15, 20, 30, .72);
    --card: rgba(255, 255, 255, .048);
    --card-hover: rgba(255, 255, 255, .082);
    --border: rgba(255, 255, 255, .085);
    --border-strong: rgba(255, 255, 255, .16);
    --text: #e9eef7;
    --text-2: #97a3b6;
    --text-3: #65717f;
    --shadow: 0 10px 34px rgba(0, 0, 0, .45);
    --icon-bg: rgba(255, 255, 255, .07);
    --orb-opacity: .5;
}

html[data-theme="light"] {
    --bg: #f5f7fb;
    --bg-elev: rgba(255, 255, 255, .8);
    --card: #ffffff;
    --card-hover: #ffffff;
    --border: #e5e9f1;
    --border-strong: #d3dae6;
    --text: #131a29;
    --text-2: #5d6779;
    --text-3: #8d97a8;
    --shadow: 0 8px 26px rgba(21, 33, 61, .09);
    --icon-bg: #f2f4f9;
    --orb-opacity: .3;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s, color .3s;
}

a { color: inherit; text-decoration: none; }
svg { display: block; }

.wrap {
    width: 100%;
    max-width: 1220px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ---------- 背景光斑 ---------- */
.bg-deco {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    opacity: var(--orb-opacity);
}
.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(90px);
}
.orb-1 { width: 520px; height: 520px; top: -220px; left: -120px; background: var(--accent); opacity: .28; }
.orb-2 { width: 460px; height: 460px; top: -160px; right: -140px; background: #0ea5e9; opacity: .2; }
.orb-3 { width: 400px; height: 400px; bottom: -220px; left: 40%; background: #8b5cf6; opacity: .14; }

/* ---------- 顶栏 ---------- */
.header {
    position: sticky;
    top: 0;
    z-index: 60;
    background: var(--bg-elev);
    backdrop-filter: saturate(160%) blur(16px);
    -webkit-backdrop-filter: saturate(160%) blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 22px;
}

.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }

.brand-mark {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 11px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #22d3ee));
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 38%, transparent);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.brand-text em { font-style: normal; font-size: 11px; color: var(--text-3); }

/* 搜索框 */
.search {
    position: relative;
    flex: 1;
    max-width: 480px;
    display: flex;
    align-items: center;
    height: 40px;
    padding: 0 12px;
    border-radius: 11px;
    background: var(--card);
    border: 1px solid var(--border);
    transition: var(--transition);
}
.search:focus-within {
    border-color: color-mix(in srgb, var(--accent) 60%, transparent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: var(--card-hover);
}
.search svg { width: 17px; height: 17px; color: var(--text-3); flex-shrink: 0; }
.search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0 9px;
    border: 0;
    background: transparent;
    color: var(--text);
    font-family: inherit;
    font-size: 13.5px;
    outline: none;
}
.search input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search kbd {
    display: inline-grid; place-items: center;
    width: 20px; height: 20px;
    border-radius: 5px;
    border: 1px solid var(--border-strong);
    background: var(--icon-bg);
    color: var(--text-3);
    font-family: inherit;
    font-size: 11px;
    transition: var(--transition);
}
.search:focus-within kbd { opacity: 0; }

.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.icon-btn, .btn-ghost {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text-2);
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
}
.icon-btn { width: 38px; padding: 0; }
.icon-btn:hover, .btn-ghost:hover {
    color: var(--text);
    border-color: var(--border-strong);
    background: var(--card-hover);
}
.icon-btn svg, .btn-ghost svg { width: 17px; height: 17px; }

html[data-theme="dark"] .ico-sun { display: none; }
html[data-theme="light"] .ico-moon { display: none; }

/* ---------- 分类导航 ---------- */
.tabs {
    position: sticky;
    top: var(--header-h);
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 82%, transparent);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.tabs-inner {
    display: flex;
    gap: 6px;
    padding-top: 9px;
    padding-bottom: 9px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs-inner::-webkit-scrollbar { display: none; }

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    height: 33px;
    padding: 0 12px;
    border-radius: 9px;
    color: var(--text-2);
    font-size: 13px;
    white-space: nowrap;
    transition: var(--transition);
}
.tab i { font-style: normal; font-size: 13px; }
.tab b {
    font-weight: 500;
    font-size: 11px;
    color: var(--text-3);
    background: var(--icon-bg);
    border-radius: 20px;
    padding: 0 6px;
    line-height: 16px;
    transition: var(--transition);
}
.tab:hover { color: var(--text); background: var(--card); }
.tab.active {
    color: #fff;
    background: var(--accent);
    box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 35%, transparent);
}
.tab.active b { color: #fff; background: rgba(255, 255, 255, .22); }

/* ---------- 主体 ---------- */
.main { position: relative; z-index: 1; padding-top: 30px; padding-bottom: 64px; }

.cat-section { margin-bottom: 38px; scroll-margin-top: calc(var(--header-h) + 58px); }

.cat-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 15px; flex-wrap: wrap; }
.cat-head h2 {
    display: flex; align-items: center; gap: 8px;
    margin: 0;
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: .2px;
}
.cat-icon { font-size: 16px; }
.cat-num {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-3);
    background: var(--icon-bg);
    border-radius: 20px;
    padding: 1px 7px;
}
.cat-desc { margin: 0; font-size: 12.5px; color: var(--text-3); }

/* 卡片网格 */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
    gap: 12px;
}

.card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: transform var(--transition), background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.card::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 55%);
    opacity: 0;
    transition: opacity var(--transition);
    pointer-events: none;
}
.card:hover {
    transform: translateY(-2px);
    background: var(--card-hover);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    box-shadow: var(--shadow);
}
.card:hover::after { opacity: 1; }

.card-icon {
    position: relative;
    width: 42px; height: 42px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--icon-bg);
    border: 1px solid var(--border);
    overflow: hidden;
}
.card-icon img {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 24px; height: 24px;
    object-fit: contain;
    opacity: 0;
    transition: opacity .25s;
}
.card-icon.has-img img { opacity: 1; }
.card-icon.has-img .icon-fallback { opacity: 0; }

.icon-fallback {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    width: 100%; height: 100%;
    display: grid; place-items: center;
    background: var(--c, var(--accent));
    transition: opacity .2s;
}

.card-body { display: flex; flex-direction: column; min-width: 0; flex: 1; gap: 1px; }

.card-title {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pin { width: 12px; height: 12px; color: #f59e0b; flex-shrink: 0; }

.card-desc {
    font-size: 12px;
    color: var(--text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 2px;
}
.host {
    font-size: 11px;
    color: var(--text-3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: .1px;
}
.hits { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: var(--text-3); flex-shrink: 0; }
.hits svg { width: 11px; height: 11px; }

.card.is-top { border-color: color-mix(in srgb, #f59e0b 30%, var(--border)); }

/* ---------- 空状态 ---------- */
.empty-state, .no-result {
    text-align: center;
    padding: 70px 20px;
    color: var(--text-2);
}
.empty-emoji { font-size: 42px; margin-bottom: 10px; }
.empty-state h2, .no-result h3 { margin: 0 0 6px; font-size: 17px; color: var(--text); }
.empty-state p, .no-result p { margin: 0 0 18px; font-size: 13px; }
.no-result a { color: var(--accent); text-decoration: underline; }

.btn-primary {
    display: inline-flex; align-items: center;
    height: 38px; padding: 0 18px;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 20px color-mix(in srgb, var(--accent) 40%, transparent); }

/* ---------- 页脚 ---------- */
.footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    padding: 22px 0 28px;
    font-size: 12.5px;
    color: var(--text-3);
}
.footer-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.footer-meta { margin-left: auto; }
.footer a:hover { color: var(--accent); }

/* ---------- 回到顶部 ---------- */
.to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--bg-elev);
    backdrop-filter: blur(10px);
    color: var(--text-2);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: var(--transition);
    z-index: 55;
}
.to-top.show { opacity: 1; visibility: visible; transform: none; }
.to-top:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.to-top svg { width: 18px; height: 18px; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .header-inner { height: auto; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; gap: 10px 14px; }
    .search { order: 3; flex-basis: 100%; max-width: none; }
    .tabs { top: 0; position: relative; }
    .cat-section { scroll-margin-top: 12px; }
    .brand-text em { display: none; }
}

@media (max-width: 560px) {
    .wrap { padding: 0 15px; }
    .grid { grid-template-columns: 1fr; gap: 10px; }
    .main { padding-top: 20px; }
    .cat-head { margin-bottom: 11px; }
    .cat-desc { display: none; }
    .btn-ghost span { display: none; }
    .btn-ghost { width: 38px; padding: 0; }
    .footer-inner { flex-direction: column; align-items: flex-start; gap: 6px; }
    .footer-meta { margin-left: 0; }
    .to-top { right: 15px; bottom: 15px; }
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
