/* ===== 站点大全 / 实用工具大全 · 改版增强
   被 templates/top.html 与 templates/tool.html 共用，避免同一套样式维护两份
   页面骨架（顶栏 .top-bar / 左侧菜单 .sidebar / 变量）由 assets/css/style.css 提供，
   与首页完全同一套；这里只放内容区样式与框架补充 */

/* ---------- 首页同款框架补充 ---------- */
/* 频道页（top/tool）不支持视角筛选：隐藏吊顶栏里的视角 tabs 与移动端视角选择按钮 */
body.channel-frame .group-tabs,
body.channel-frame .group-picker-btn { display: none; }
/* 偏好下拉里的「显示」组（全网热榜/站点工具开关）只控制首页模块，非首页隐藏 */
body.channel-frame #prefDisplayGroup { display: none; }
/* 吊顶栏左侧的频道页标题（topbar partial 的标题槽，页面通过 body[data-page-title] 注入；
   首页无内容，:empty 隐藏避免多占一个 gap） */
.page-scope-title:empty { display: none; }
.page-scope-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: .3px;
    white-space: nowrap;
    flex-shrink: 0;
}
/* 标题右侧的「返回首页」小入口：默认 hidden，频道页由 pages.js 放开 */
.page-scope-back[hidden] { display: none; }
.page-scope-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 4px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background .15s, color .15s;
}
.page-scope-back i { font-size: 12px; }
.page-scope-back:hover { color: var(--accent); background: var(--accent-light); }
@media (max-width: 640px) {
    .page-scope-title { font-size: 17px; }
    .page-scope-back .back-txt { display: none; }   /* 窄屏只留箭头图标 */
    .page-scope-back { padding: 4px 8px; }
}

/* ---------- 顶部紧凑搜索条（top.html：hero 大卡片移除后仅保留搜索） ---------- */
.visually-hidden {
    position: absolute;
    width: 1px; height: 1px;
    margin: -1px; padding: 0; border: 0;
    clip: rect(0 0 0 0);
    overflow: hidden;
    white-space: nowrap;
}
/* 复用 hero-search 的输入框/清空按钮样式，仅收窄尺寸（双类选择器保证覆盖后面的 .hero-search 规则）。
   紧凑但要有存在感：内嵌放大镜图标、加深边框、白底 + 轻投影 */
.hero-search.page-searchbar {
    max-width: 380px;
    margin: 0 0 18px;
}
.hero-search.page-searchbar input {
    height: 40px;
    padding: 0 36px 0 37px;
    font-size: 13.5px;
    border-radius: 11px;
    /* 内嵌放大镜图标（比 hero 大框的颜色略深，更醒目） */
    background-color: var(--bg-primary);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%235b6b7c' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 13px center;
    /* 边框加深 + 轻投影，避免融入页面背景 */
    border-color: rgba(100, 116, 139, .42);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .07);
}
.hero-search.page-searchbar input:hover { border-color: rgba(100, 116, 139, .65); }
.hero-search.page-searchbar input:focus {
    border-color: var(--accent);
    background-color: var(--bg-primary);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .07);   /* 只变边框色，不加大光晕 */
}
.dark .hero-search.page-searchbar input {
    border-color: rgba(255, 255, 255, .16);
    box-shadow: none;
}
.dark .hero-search.page-searchbar input:hover { border-color: rgba(255, 255, 255, .3); }
.hero-search.page-searchbar .search-clear { right: 6px; width: 26px; height: 26px; font-size: 12px; }

/* ---------- 顶部 Hero ---------- */.page-hero {
    position: relative;
    overflow: hidden;
    padding: 30px 32px 26px;
    border-radius: 18px;
    background:
        radial-gradient(900px 320px at 88% -30%, rgba(122, 105, 238, .16), transparent 60%),
        radial-gradient(700px 300px at 8% 120%, rgba(74, 125, 243, .14), transparent 62%),
        var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}
.page-hero::after {
    content: '';
    position: absolute;
    right: -70px; top: -70px;
    width: 240px; height: 240px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(74, 125, 243, .18), rgba(122, 105, 238, .10));
    filter: blur(6px);
}
.page-hero > * { position: relative; z-index: 1; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 12px; margin-bottom: 12px;
    border-radius: 999px;
    background: var(--accent-light);
    border: 1px solid rgba(74, 125, 243, .18);
    color: var(--accent);
    font-size: 12px; font-weight: 600;
}
.page-hero h1 { font-size: 30px; font-weight: 800; letter-spacing: .5px; margin-bottom: 8px; }
.page-hero p { font-size: 14px; max-width: 620px; }
.page-hero p strong { color: var(--accent); font-size: 16px; }

/* ---------- 搜索框 ---------- */
.hero-search { position: relative; margin-top: 16px; max-width: 460px; }
.hero-search input {
    width: 100%; height: 44px;
    padding: 0 42px 0 40px;
    border-radius: 14px;
    border: 1px solid var(--border-color);
    background: var(--bg-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%237b8794' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.6-3.6'/%3E%3C/svg%3E") no-repeat 14px center;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color .18s, box-shadow .18s, background-color .18s;
}
.hero-search input::placeholder { color: var(--text-secondary); }
.hero-search input:focus {
    border-color: var(--accent);
    background-color: var(--bg-secondary);
    box-shadow: 0 0 0 4px rgba(74, 125, 243, .14);
}
.hero-search input::-webkit-search-cancel-button { display: none; }
.hero-search .search-clear {
    position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
    width: 28px; height: 28px; border-radius: 8px;
    border: none; background: transparent; color: var(--text-secondary);
    cursor: pointer; font-size: 14px; display: none;
}
.hero-search .search-clear:hover { background: var(--accent-light); color: var(--accent); }
.hero-search.has-value .search-clear { display: flex; align-items: center; justify-content: center; }

/* ---------- 统计胶囊 ---------- */
.hero-stats { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.stat-pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 5px 13px;
    border-radius: 999px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    font-size: 12.5px; color: var(--text-secondary);
}
.stat-pill strong { color: var(--accent); font-size: 14px; }

/* ---------- 分类锚点条 ---------- */
.tl-nav {
    position: sticky;
    top: calc(var(--header-height) + 10px);
    /* 低于顶栏（.top-bar z-index:50）：吸顶时被吊顶栏盖住是正常的，
       但不能盖住顶栏里展开的用户/偏好下拉菜单 */
    z-index: 40;
    margin: 16px 0 14px;
}
.tl-nav-inner {
    display: flex; gap: 8px;
    overflow-x: auto;
    padding: 7px;
    border-radius: 15px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);            /* 不支持 color-mix 的浏览器用它 */
    background: color-mix(in srgb, var(--bg-secondary) 86%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: var(--card-shadow);
    scrollbar-width: none;
}
.tl-nav-inner::-webkit-scrollbar { display: none; }
.tl-chip {
    flex: none;
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 13px;
    border-radius: 11px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px; text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: all .16s;
}
.tl-chip:hover { color: var(--accent); background: var(--accent-light); }
.tl-chip.active {
    color: #fff; background: var(--accent);
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(74, 125, 243, .28);
}

.tl-empty-tip {
    text-align: center; padding: 48px 20px;
    color: var(--text-secondary); font-size: 14px;
    background: var(--bg-secondary);
    border: 1px dashed var(--border-color);
    border-radius: 16px;
}

/* ---------- 分类区块 ---------- */
.tl-section {
    padding: 18px 20px;
    border-radius: 16px;
    margin-bottom: 16px;
    scroll-margin-top: calc(var(--header-height) + 68px);
}
.tl-section-title { gap: 10px; margin-bottom: 14px; padding-bottom: 12px; }
.tl-section-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px;
    border-radius: 11px;
    background: var(--accent-light);
    font-size: 17px;
    color: inherit;   /* 与标题文字同色 */
}
.float-nav-chip .chip-icon { font-size: 16px; flex-shrink: 0; line-height: 1; }
.tl-section-icon i, .chip-icon i { line-height: 1; }
.tl-section-count {
    margin-left: auto;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}
.apply-link { margin-left: 8px; border-radius: 999px; }

/* ---------- 站点卡片 ---------- */
.tl-grid {
    grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
    gap: 10px;
}
.tl-item {
    position: relative;
    display: flex; flex-wrap: wrap; align-items: center;
    row-gap: 1px; column-gap: 0;
    padding: 11px 34px 11px 13px;
    border-radius: 13px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
    overflow: hidden;
}
.tl-item:hover {
    transform: translateY(-3px);
    border-color: rgba(74, 125, 243, .38);
    box-shadow: 0 10px 24px rgba(16, 24, 40, .12);
    background: var(--accent-light);
    color: var(--accent);
}
.tl-item-icon {
    width: 28px; height: 28px;
    margin-right: 10px;
    border-radius: 9px;
    object-fit: contain;
    background: var(--bg-primary);
    box-shadow: 0 1px 3px rgba(16, 24, 40, .10);
}
.tl-item-icon-text {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; margin-right: 10px;
    border-radius: 9px; background: var(--accent-light);
}
.tl-item-name {
    flex: 1 1 auto; min-width: 0;
    font-size: 14px; font-weight: 600;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-item-desc {
    flex: 1 1 100%;
    margin-left: 38px;
    font-size: 11.5px;
    text-align: left;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tl-item::after {
    content: '↗';
    position: absolute; right: 13px; top: 13px;
    font-size: 13px; color: var(--accent);
    opacity: 0; transform: translate(-2px, 2px);
    transition: all .16s;
}
.tl-item:hover::after { opacity: 1; transform: none; }
.tl-item.hide { display: none; }
.tl-section.hide { display: none; }

/* ---------- 移动端 ---------- */
@media (max-width: 768px) {
    .page-hero { padding: 22px 18px 20px; border-radius: 16px; }
    .page-hero h1 { font-size: 22px; }
    .tl-nav { top: calc(var(--header-height) + 6px); }
    .tl-section { padding: 15px 14px; border-radius: 14px; }
    .tl-grid { grid-template-columns: 1fr; gap: 8px; }
    .tl-item { padding: 10px 32px 10px 12px; }
}
