/* =========================================================
   小喻子网址导航 — 前台样式
   设计令牌:深色主题 · 彩色波浪动画 · 参考 api.gdjiancairen.com
   ========================================================= */

:root {
    /* 深色背景系 */
    --bg-deep:    #050510;
    --bg-surface: #0a0a1e;
    --bg-card:    rgba(255,255,255,0.03);
    --bg-card-hover: rgba(255,255,255,0.06);
    --bg-input:   rgba(255,255,255,0.06);

    /* 强调色 — 匹配波浪动画调色板 */
    --accent-blue:   #5882FF;
    --accent-purple: #8258FF;
    --accent-pink:   #FF58A0;
    --accent-cyan:   #58DCC8;
    --accent-orange: #FFB450;

    /* 文字 */
    --text-primary:   rgba(255,255,255,0.88);
    --text-secondary: rgba(255,255,255,0.55);
    --text-tertiary:  rgba(255,255,255,0.30);

    /* 边框 */
    --border-subtle:  rgba(255,255,255,0.06);
    --border-medium:  rgba(255,255,255,0.10);
    --border-strong:  rgba(255,255,255,0.16);

    /* 圆角 */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 16px;
    --r-xl: 24px;
    --r-pill: 999px;

    /* 阴影 */
    --sh-sm: 0 1px 2px rgba(0,0,0,0.3);
    --sh-md: 0 4px 16px rgba(0,0,0,0.4);
    --sh-lg: 0 8px 32px rgba(0,0,0,0.5);

    /* 字体 */
    --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Consolas', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-sans);
    color: var(--text-primary);
    background: var(--bg-deep);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input { font-family: inherit; }

/* ===================== 顶部导航 ===================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(5,5,16,0.85);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border-subtle);
}
.topbar__inner {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.brand {
    display: flex; align-items: center; gap: 12px;
    text-decoration: none;
    transition: opacity 0.2s ease;
}
.brand:hover { opacity: 0.85; }
.brand__logo {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: var(--r-md);
    overflow: hidden;
}
.brand__logo img { width: 100%; height: 100%; object-fit: cover; }
.brand__mark {
    width: 100%; height: 100%;
    display: grid; place-items: center;
    color: #fff;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    border-radius: var(--r-md);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.2; }
.brand__text strong { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.brand__text small { font-size: 12px; color: var(--text-secondary); }

.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 14px;
    border-radius: var(--r-pill);
    color: var(--text-secondary);
    font-size: 14px; font-weight: 500;
    transition: all 0.18s ease;
}
.topnav a svg { opacity: 0.7; }
.topnav a:hover { background: var(--bg-card); color: var(--text-primary); }
.topnav a:hover svg { opacity: 1; }
.topnav__admin { color: var(--accent-blue); background: rgba(88,130,255,0.12); }
.topnav__admin:hover { background: rgba(88,130,255,0.2); }

/* ===================== Hero ===================== */
.hero {
    position: relative;
    background: var(--bg-deep);
    color: #fff;
    overflow: hidden;
    isolation: isolate;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Canvas 波浪层 — 覆盖整个 Hero */
#hero-canvas {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    z-index: 1;
    pointer-events: none;
}

.hero__inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 72px 24px 88px;
    text-align: center;
    position: relative;
    z-index: 3;
    animation: fadeIn 1.2s ease both;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hero__title {
    font-size: clamp(28px, 4vw, 44px);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 12px;
}
.hero__sub {
    font-size: clamp(15px, 2vw, 17px);
    color: var(--text-secondary);
    margin-bottom: 36px;
}

/* ===================== 搜索框 ===================== */
.search { max-width: 720px; margin: 0 auto; }
.search__engines {
    display: inline-flex;
    padding: 4px;
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border-medium);
    border-radius: var(--r-pill);
    margin-bottom: 16px;
    gap: 2px;
}
.engine {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 16px;
    border-radius: var(--r-pill);
    color: var(--text-secondary);
    font-size: 13px; font-weight: 500;
    transition: all 0.18s ease;
}
.engine:hover { color: #fff; background: rgba(255,255,255,0.08); }
.engine.is-active { background: rgba(255,255,255,0.15); color: #fff; font-weight: 600; }

.search__box {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border-medium);
    border-radius: var(--r-pill);
    padding: 6px 6px 6px 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3);
    transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}
.search__box:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(88,130,255,0.15), 0 20px 40px rgba(0,0,0,0.4);
    transform: translateY(-1px);
}
.search__icon { color: var(--text-tertiary); flex-shrink: 0; }
.search__box input {
    flex: 1;
    border: none; outline: none;
    background: transparent;
    font-size: 15px;
    color: #fff;
    padding: 12px 0;
}
.search__box input::placeholder { color: var(--text-tertiary); }
.search__btn {
    padding: 12px 28px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #fff;
    border-radius: var(--r-pill);
    font-size: 14px; font-weight: 600;
    transition: all 0.2s ease;
    flex-shrink: 0;
    animation: btnPulse 4s ease-in-out infinite;
}
@keyframes btnPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(88,130,255,0.3); }
    50%      { box-shadow: 0 0 0 10px rgba(88,130,255,0); }
}
.search__btn:hover {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    transform: translateY(-2px);
    animation: none;
}

/* ===================== 主容器 ===================== */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 40px 24px 64px;
}

/* 区段标题 */
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px;
}
.section-head h2 {
    font-size: 18px; font-weight: 700; color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
.section-head h2 .dot {
    width: 4px; height: 18px;
    background: linear-gradient(var(--accent-cyan), var(--accent-blue), var(--accent-cyan));
    background-size: 100% 200%;
    border-radius: 2px;
    animation: dotPulse 3s ease-in-out infinite;
}
@keyframes dotPulse {
    0%, 100% { background-position: 0% 0%; }
    50%      { background-position: 0% 100%; }
}
.section-head .more {
    font-size: 13px; color: var(--text-secondary);
    display: inline-flex; align-items: center; gap: 4px;
}
.section-head .more:hover { color: var(--accent-blue); }

/* ===================== 分类网格 ===================== */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}
.cat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    padding: 20px;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease, background 0.25s ease;
    animation: fadeUp 0.5s ease both;
    position: relative;
    overflow: hidden;
}
.cat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-cyan), var(--accent-purple), var(--accent-cyan), var(--accent-blue));
    background-size: 200% 100%;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.cat-card:hover {
    transform: translateY(-6px);
    background: var(--bg-card-hover);
    border-color: var(--border-medium);
    box-shadow: 0 8px 32px rgba(88,130,255,0.08);
}
.cat-card:hover::before { opacity: 1; }
/* staggered 加载动画 */
.cat-card:nth-child(1) { animation-delay: 0.02s; }
.cat-card:nth-child(2) { animation-delay: 0.06s; }
.cat-card:nth-child(3) { animation-delay: 0.10s; }
.cat-card:nth-child(4) { animation-delay: 0.14s; }
.cat-card:nth-child(5) { animation-delay: 0.18s; }
.cat-card:nth-child(6) { animation-delay: 0.22s; }
.cat-card:nth-child(7) { animation-delay: 0.26s; }
.cat-card:nth-child(8) { animation-delay: 0.30s; }

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}

.cat-card__head {
    display: flex; align-items: center; gap: 12px;
    padding-bottom: 14px;
    margin-bottom: 12px;
    border-bottom: 1px dashed var(--border-subtle);
}
.cat-card__icon {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: var(--r-md);
    background: rgba(88,130,255,0.12);
    color: var(--accent-blue);
    flex-shrink: 0;
    transition: transform 0.25s ease, background 0.25s ease;
}
.cat-card:hover .cat-card__icon {
    transform: scale(1.1) rotate(-5deg);
    background: rgba(88,130,255,0.2);
}
.cat-card__title {
    flex: 1;
    font-size: 16px; font-weight: 700; color: var(--text-primary);
    line-height: 1.3;
}
.cat-card__count {
    font-size: 12px; color: var(--text-secondary);
    background: var(--bg-card);
    padding: 2px 8px;
    border-radius: var(--r-pill);
    font-family: var(--font-mono);
}

.cat-card__list { display: flex; flex-direction: column; gap: 2px; }

.site-item {
    display: flex; align-items: center; gap: 12px;
    padding: 9px 10px;
    border-radius: var(--r-sm);
    transition: background 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
    position: relative;
}
.site-item::before {
    content: '';
    position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 0;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(var(--accent-blue), var(--accent-purple));
    transition: height 0.2s ease;
}
.site-item:hover {
    background: var(--bg-card-hover);
    transform: translateX(4px);
}
.site-item:hover::before { height: 60%; }
.site-ico {
    width: 28px; height: 28px;
    border-radius: var(--r-sm);
    flex-shrink: 0;
    display: grid; place-items: center;
    object-fit: cover;
    background: var(--bg-card);
}
.site-ico--letter {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #fff;
    font-size: 13px; font-weight: 700;
    font-family: var(--font-mono);
}
.site-item__main { flex: 1; min-width: 0; }
.site-item__title {
    font-size: 14px; font-weight: 500; color: var(--text-primary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: color 0.16s ease;
}
.site-item:hover .site-item__title { color: var(--accent-blue); }
.site-item__desc {
    font-size: 12px; color: var(--text-tertiary);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.site-item__arrow {
    color: var(--accent-blue);
    opacity: 0; transform: translateX(-4px);
    transition: all 0.16s ease;
    flex-shrink: 0;
}
.site-item:hover .site-item__arrow { opacity: 1; transform: translateX(0); }

.cat-card__empty {
    padding: 14px 10px;
    font-size: 13px; color: var(--text-tertiary);
    text-align: center;
}

/* ===================== 热门站点 ===================== */
.popular {
    margin-top: 48px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-lg);
    padding: 24px;
}
.popular__list {
    display: flex; gap: 12px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.popular__list::-webkit-scrollbar { height: 6px; }
.popular__list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
.popular-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px 10px 12px;
    background: var(--bg-card-hover);
    border-radius: var(--r-pill);
    flex-shrink: 0;
    transition: all 0.18s ease;
    border: 1px solid var(--border-subtle);
}
.popular-item:hover {
    background: rgba(88,130,255,0.1);
    border-color: rgba(88,130,255,0.25);
    transform: translateY(-2px);
}
.popular-item__rank {
    width: 22px; height: 22px;
    display: grid; place-items: center;
    border-radius: 6px;
    font-size: 12px; font-weight: 700;
    font-family: var(--font-mono);
    background: var(--bg-card); color: var(--text-secondary);
}
.popular-item:nth-child(1) .popular-item__rank { background: linear-gradient(135deg,#F59E0B,#D97706); color: #fff; }
.popular-item:nth-child(2) .popular-item__rank { background: linear-gradient(135deg,#94A3B8,#64748B); color: #fff; }
.popular-item:nth-child(3) .popular-item__rank { background: linear-gradient(135deg,#D97706,#B45309); color: #fff; }
.popular-item__title { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; }

/* ===================== 页脚 ===================== */
.footer {
    background: var(--bg-surface);
    color: var(--text-secondary);
    border-top: 1px solid var(--border-subtle);
    padding: 32px 24px;
}
.footer__inner {
    max-width: 1280px;
    margin: 0 auto;
    display: flex; flex-direction: column; align-items: center;
    gap: 16px;
}
.footer__brand { display: flex; align-items: center; gap: 12px; }
.footer__logo {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    border-radius: var(--r-md);
}
.footer__brand strong { color: var(--text-primary); font-size: 15px; display: block; }
.footer__brand p { font-size: 12px; opacity: 0.7; }
.footer__meta {
    display: flex; align-items: center; justify-content: center; gap: 18px;
    font-size: 13px;
    flex-wrap: wrap;
}
.footer__meta a { display: inline-flex; align-items: center; gap: 4px; transition: color 0.16s ease; }
.footer__meta a:hover { color: var(--text-primary); }

/* ===================== 搜索结果页 ===================== */
.search-page { max-width: 800px; margin: 0 auto; }
.search-page__bar {
    display: flex; gap: 10px; margin-bottom: 24px;
}
.search-page__bar input {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid var(--border-medium);
    border-radius: var(--r-pill);
    font-size: 14px;
    outline: none;
    background: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.search-page__bar input::placeholder { color: var(--text-tertiary); }
.search-page__bar input:focus { border-color: var(--accent-blue); box-shadow: 0 0 0 4px rgba(88,130,255,0.1); }
.search-page__bar button {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: #fff;
    border-radius: var(--r-pill);
    font-size: 14px; font-weight: 600;
    transition: opacity 0.16s ease;
}
.search-page__bar button:hover { opacity: 0.9; }
.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--r-md);
    padding: 16px 18px;
    margin-bottom: 12px;
    display: flex; gap: 14px; align-items: center;
    transition: all 0.18s ease;
}
.result-card:hover { border-color: var(--border-medium); box-shadow: var(--sh-md); transform: translateX(2px); }
.result-card__cat {
    font-size: 11px; color: var(--accent-blue);
    background: rgba(88,130,255,0.12);
    padding: 2px 8px; border-radius: var(--r-pill);
    margin-top: 4px; display: inline-block;
}
.empty-state {
    text-align: center; padding: 60px 20px; color: var(--text-secondary);
}
.empty-state svg { color: var(--text-tertiary); margin: 0 auto 12px; }

/* ===================== 友情链接 ===================== */
.friend-links {
    padding: 20px 0 12px;
    background: var(--bg-deep);
    border-top: 1px solid var(--border-subtle);
}
.friend-links__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}
.friend-links__title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    letter-spacing: 0.5px;
}
.friend-links__list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}
.friend-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 10px;
    border-radius: var(--r-md);
    transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
    text-decoration: none;
}
.friend-link:hover {
    color: var(--accent-blue);
    background: var(--bg-card);
    transform: translateY(-2px);
}
.friend-link img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}
.friend-link span { white-space: nowrap; flex-shrink: 0; font-size: 12px; }

/* ===================== 响应式 ===================== */
@media (max-width: 1199px) {
    .cat-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .topbar__inner { padding: 0 16px; }
    .brand__text small { display: none; }
    .topnav a span { display: none; }
    .topnav a { padding: 8px 10px; }
    .hero { min-height: 260px; }
    .hero__inner { padding: 48px 16px 56px; }
    .search__box { padding: 5px 5px 5px 16px; }
    .search__btn { padding: 10px 18px; }
    .container { padding: 28px 16px 48px; }
    .cat-grid { grid-template-columns: 1fr; gap: 14px; }
    .footer__inner { flex-direction: column; text-align: center; align-items: center; }
    .footer__meta { text-align: center; justify-content: center; }
}
