/* ==========================================================================
   前台默认模板样式（变量化，便于整站换肤）
   ========================================================================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #f59e0b;
    --bg: #f3f5f9;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --muted: #9ca3af;
    --border: #e5e7eb;
    --radius: 10px;
    --shadow-sm: 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-md: 0 6px 16px rgba(16, 24, 40, .10);
    --header-h: 60px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: var(--primary); transition: color .15s; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* ==========================================================================
   头部
   ========================================================================== */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}
.header-inner { display: flex; align-items: center; height: var(--header-h); gap: 24px; }
.site-logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
    flex-shrink: 0;
    letter-spacing: .5px;
}
.site-logo:hover { color: var(--primary-dark); }
.site-nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
    color: var(--text-secondary);
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: background .15s, color .15s;
}
.site-nav a:hover { color: var(--primary); background: #eff4fd; }
.site-nav a.nav-cta { color: var(--primary); font-weight: 600; }

/* 头部搜索框（中等屏以下隐藏，Hero 区有大搜索） */
.header-search { display: flex; flex-shrink: 0; }
.header-search input {
    width: 180px;
    padding: 7px 12px;
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 6px 0 0 6px;
    font-size: 13px;
    outline: none;
    transition: border-color .15s, width .2s;
}
.header-search input:focus { border-color: var(--primary); width: 220px; }
.header-search button {
    padding: 7px 14px;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-size: 13px;
}
.header-search button:hover { background: var(--primary-dark); }

/* ==========================================================================
   Hero 区（首页）
   ========================================================================== */
.hero {
    background: linear-gradient(135deg, #172554 0%, #1e40af 45%, #2563eb 100%);
    color: #fff;
    padding: 56px 0 64px;
    position: relative;
    overflow: hidden;
}
/* 装饰性光斑 */
.hero::before, .hero::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, .06);
}
.hero::before { width: 420px; height: 420px; top: -180px; right: -80px; }
.hero::after { width: 300px; height: 300px; bottom: -160px; left: -60px; }
.hero .container { position: relative; z-index: 1; text-align: center; }
.hero-title { font-size: 34px; font-weight: 700; letter-spacing: 1px; }
.hero-desc { margin: 12px auto 0; max-width: 560px; color: rgba(255, 255, 255, .82); font-size: 15px; }

.hero-search {
    display: flex;
    max-width: 560px;
    margin: 28px auto 0;
    background: #fff;
    border-radius: 999px;
    padding: 5px;
    box-shadow: 0 8px 24px rgba(2, 6, 23, .25);
}
.hero-search input {
    flex: 1;
    border: none;
    outline: none;
    padding: 10px 20px;
    font-size: 15px;
    border-radius: 999px 0 0 999px;
    background: transparent;
    color: var(--text);
}
.hero-search button {
    border: none;
    background: var(--primary);
    color: #fff;
    font-size: 15px;
    padding: 10px 28px;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s;
}
.hero-search button:hover { background: var(--primary-dark); }

.hero-stats {
    margin-top: 22px;
    display: flex;
    justify-content: center;
    gap: 28px;
    color: rgba(255, 255, 255, .75);
    font-size: 13px;
}
.hero-stats b { color: #fff; font-size: 17px; margin-right: 4px; font-weight: 700; }

/* ==========================================================================
   主体布局
   ========================================================================== */
.site-main { padding: 24px 0 40px; min-height: calc(100vh - 320px); }

/* 首页：主内容 + 侧边栏 */
.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }

/* ==========================================================================
   区块
   ========================================================================== */
.section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
}
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f2f5;
}
.section-title { font-size: 17px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 8px; }
/* 标题前装饰条 */
.section-title::before {
    content: "";
    width: 4px;
    height: 16px;
    border-radius: 2px;
    background: var(--primary);
}
.section-title.is-top::before { background: var(--accent); }
.section-more { font-size: 13px; color: var(--muted); }
.section-more:hover { color: var(--primary); }

/* ==========================================================================
   网址卡片
   ========================================================================== */
.web-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.web-card {
    display: flex;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
    transition: transform .18s, box-shadow .18s, border-color .18s;
    color: var(--text);
    position: relative;
}
/* 置顶角标 */
.top-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: #fff;
    font-size: 11px;
    line-height: 1;
    padding: 3px 8px;
    border-radius: 999px;
}
.web-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    border-color: #bfdbfe;
}
.web-favicon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    flex-shrink: 0;
    background: #f1f5f9;
    overflow: hidden;
    border: 1px solid #eef2f7;
    position: relative;
}
/* 无图标时显示首字母（被图片覆盖） */
.web-favicon::after {
    content: attr(data-letter);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 600;
    color: #94a3b8;
}
.web-favicon img {
    position: absolute;
    inset: 0;
    z-index: 1;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #fff;
}
.web-info { flex: 1; min-width: 0; }
.web-name {
    font-weight: 600;
    font-size: 15px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.web-desc {
    font-size: 12.5px;
    color: var(--text-secondary);
    margin-top: 4px;
    /* 两行截断 */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    min-height: 2.4em;
    word-break: break-all;
}
.web-meta { display: flex; align-items: center; gap: 8px; margin-top: 6px; }

/* 星级评分 */
.stars { color: var(--accent); font-size: 13px; letter-spacing: 1px; }
.stars i { color: #d8dee9; font-style: normal; }
.web-views { font-size: 12px; color: var(--muted); }

/* ==========================================================================
   侧边栏
   ========================================================================== */
.side-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
    margin-bottom: 24px;
}
.side-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f2f5;
    display: flex;
    align-items: center;
    gap: 8px;
}
.side-title::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--primary); }

.side-list { list-style: none; }
.side-list li { display: flex; align-items: center; gap: 10px; padding: 7px 0; }
.side-list li + li { border-top: 1px dashed #f0f2f5; }
.side-rank {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    border-radius: 5px;
    background: #eef2f7;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* 前三名高亮 */
.side-list li:nth-child(1) .side-rank { background: #fee2e2; color: #dc2626; }
.side-list li:nth-child(2) .side-rank { background: #ffedd5; color: #ea580c; }
.side-list li:nth-child(3) .side-rank { background: #fef9c3; color: #ca8a04; }
.side-link {
    flex: 1;
    min-width: 0;
    color: var(--text);
    font-size: 13.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.side-link:hover { color: var(--primary); }
.side-count { font-size: 12px; color: var(--muted); flex-shrink: 0; }
/* 无排名列表的小圆点 */
.side-dot { width: 6px; height: 6px; border-radius: 50%; background: #c7d2fe; flex-shrink: 0; }

/* ==========================================================================
   标签云（彩色 pill，按数量分大小）
   ========================================================================== */
.tag-cloud { display: flex; flex-wrap: wrap; gap: 10px; }
.tag-cloud a {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 999px;
    font-size: 13px;
    transition: transform .15s, box-shadow .15s;
}
.tag-cloud a:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tag-cloud a .num { font-size: 11px; opacity: .65; }
/* 6 色轮换 */
.tag-cloud a:nth-child(6n+1) { background: #eff6ff; color: #2563eb; }
.tag-cloud a:nth-child(6n+2) { background: #f0fdf4; color: #16a34a; }
.tag-cloud a:nth-child(6n+3) { background: #fff7ed; color: #ea580c; }
.tag-cloud a:nth-child(6n+4) { background: #fdf2f8; color: #db2777; }
.tag-cloud a:nth-child(6n+5) { background: #f5f3ff; color: #7c3aed; }
.tag-cloud a:nth-child(6n+6) { background: #ecfeff; color: #0891b2; }
/* 按数量分级 */
.tag-cloud a.md { font-size: 14px; padding: 6px 16px; font-weight: 600; }
.tag-cloud a.lg { font-size: 15px; padding: 7px 18px; font-weight: 600; }

/* 详情页标签 */
.tag-link {
    display: inline-block;
    padding: 4px 12px;
    margin: 0 8px 8px 0;
    background: #eff4fd;
    color: var(--primary);
    border-radius: 999px;
    font-size: 13px;
}
.tag-link:hover { background: var(--primary); color: #fff; }

/* ==========================================================================
   分类页
   ========================================================================== */
.category-header {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 24px;
}
.category-header h1 { font-size: 22px; margin-bottom: 6px; }
.category-desc { color: var(--text-secondary); }
.child-cats { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.child-cats a {
    padding: 5px 14px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: 999px;
    font-size: 13px;
    box-shadow: var(--shadow-sm);
}
.child-cats a:hover { color: var(--primary); border-color: var(--primary); }

/* ==========================================================================
   面包屑
   ========================================================================== */
.breadcrumb {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 16px;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: #d1d5db; }
.breadcrumb .current { color: var(--text); }

/* ==========================================================================
   详情页
   ========================================================================== */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.detail-main, .detail-side-info {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
}
.detail-main { min-width: 0; }

.screenshot-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 24px;
    background: #f8fafc;
}
.screenshot-wrap img { width: 100%; display: block; }

.detail-section { margin-bottom: 22px; }
.detail-section:last-child { margin-bottom: 0; }
.detail-section h3 {
    font-size: 16px;
    margin-bottom: 10px;
    padding-left: 10px;
    border-left: 3px solid var(--primary);
}
.detail-section p { color: #4b5563; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }

/* 右侧信息栏 */
.side-site-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.side-site-head .web-favicon { width: 56px; height: 56px; border-radius: 12px; }
.side-site-name { font-size: 18px; font-weight: 700; word-break: break-all; }
.side-site-url {
    font-size: 12.5px;
    color: var(--muted);
    word-break: break-all;
    margin-top: 2px;
}
.side-meta { list-style: none; margin: 16px 0; border-top: 1px solid #f0f2f5; }
.side-meta li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 0;
    font-size: 13px;
    border-bottom: 1px solid #f0f2f5;
}
.side-meta .k { color: var(--muted); flex-shrink: 0; }
.side-meta .v { color: var(--text); text-align: right; word-break: break-all; }
.side-meta .v a { color: var(--primary); }

.visit-btn {
    display: block;
    text-align: center;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    transition: background .15s, transform .15s;
}
.visit-btn:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); }
.side-tags { margin-top: 16px; }
.side-tags .t { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

/* ==========================================================================
   分页
   ========================================================================== */
.pagination { display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; margin: 8px 0 24px; }
.pagination a, .pagination span {
    min-width: 34px;
    text-align: center;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    background: #fff;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ==========================================================================
   页脚
   ========================================================================== */
.site-footer { background: #111827; color: #9ca3af; margin-top: 24px; }
.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 32px;
    padding: 40px 16px 32px;
}
.footer-about .f-logo { font-size: 18px; font-weight: 700; color: #fff; }
.footer-about p { margin-top: 10px; font-size: 13px; line-height: 1.8; max-width: 380px; }
.footer-title { color: #e5e7eb; font-size: 14px; font-weight: 600; margin-bottom: 14px; }
.footer-links { list-style: none; }
.footer-links li { margin-bottom: 8px; }
.footer-links a { color: #9ca3af; font-size: 13px; }
.footer-links a:hover { color: #fff; }
.footer-bar {
    border-top: 1px solid #1f2937;
    padding: 16px;
    text-align: center;
    font-size: 12.5px;
    color: #6b7280;
}
.footer-bar a { color: #6b7280; }
.footer-bar a:hover { color: #d1d5db; }
.footer-bar .sep { margin: 0 8px; color: #374151; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 992px) {
    .home-layout, .detail-layout { grid-template-columns: 1fr; }
    .home-side, .detail-side { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
    .home-side .side-card, .detail-side .detail-side-info { margin-bottom: 0; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    .header-search { display: none; }
    .hero { padding: 40px 0 48px; }
    .hero-title { font-size: 26px; }
    .hero-stats { gap: 18px; flex-wrap: wrap; }
    .web-grid { grid-template-columns: repeat(2, 1fr); }
    .section { padding: 16px; }
}

@media (max-width: 480px) {
    .web-grid { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr; gap: 24px; }
    .hero-search button { padding: 10px 18px; }
}
