/* dark_modern —— 深色现代导航风（参考 2026 主流资源导航站设计语言）
   特性：深/浅双主题、固定顶栏、大搜索框、卡片栅格、5/3/2 列响应式 */

/* ============ 设计令牌 ============ */
:root {
    --page-bg: #17171a;
    --surface: #17171a;
    --border-soft: #2e2e30;
    --border: #484849;
    --text: rgba(255, 255, 255, .9);
    --muted: rgba(255, 255, 255, .7);
    --muted-2: rgba(255, 255, 255, .45);
    --primary: #3c7eff;
    --primary-hover: #5c93ff;
    --primary-soft: rgba(60, 126, 255, .2);
    --primary-soft-2: rgba(60, 126, 255, .32);
    --footer-bg: rgba(255, 255, 255, .08);
    --shadow-1: 0 2px 8px rgba(0, 0, 0, .06);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, .16);
    --radius: 8px;
    color-scheme: dark;
}
html[data-theme="light"] {
    --page-bg: #f7f8fa;
    --surface: #ffffff;
    --border-soft: #e5e6eb;
    --border: #d9dce1;
    --text: rgba(0, 0, 0, .88);
    --muted: rgba(0, 0, 0, .65);
    --muted-2: rgba(0, 0, 0, .4);
    --primary: #165dff;
    --primary-hover: #0e42d2;
    --primary-soft: rgba(22, 93, 255, .12);
    --primary-soft-2: rgba(22, 93, 255, .2);
    --footer-bg: rgba(0, 0, 0, .04);
    --shadow-1: 0 2px 8px rgba(0, 0, 0, .04);
    --shadow-2: 0 4px 12px rgba(0, 0, 0, .08);
    color-scheme: light;
}

/* ============ 基础 ============ */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--page-bg);
    color: var(--text);
    font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
img { border: 0; max-width: 100%; }
::selection { background: var(--primary-soft-2); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 3px solid var(--page-bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }

.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.col { max-width: 832px; margin: 0 auto; }
.main { padding: 80px 16px 16px; }

/* ============ 顶栏 ============ */
.topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    height: 48px;
    background: var(--page-bg);
    border-bottom: 1px solid var(--border-soft);
}
.topbar-inner {
    max-width: 1280px; margin: 0 auto; padding: 0 16px; height: 48px;
    display: flex; align-items: center; gap: 28px;
}
.logo { display: flex; align-items: baseline; gap: 8px; flex: none; }
.logo .logo-name { font-size: 24px; font-weight: 700; letter-spacing: -.015em; color: var(--text); line-height: 1; }
.logo .logo-caption { font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: .01em; line-height: 1; }
.nav { display: flex; align-items: center; gap: 4px; flex: 1; }
.nav > a, .nav .nav-item > a, .nav .nav-item > span {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 6px 10px; border-radius: 6px;
    color: var(--muted); font-size: 14px; cursor: pointer; transition: color .2s, background .2s;
}
.nav > a:hover, .nav .nav-item > a:hover, .nav .nav-item > span:hover,
.nav a.on { color: var(--primary); background: var(--primary-soft); }
.nav .caret { width: 12px; height: 12px; }
.nav-item { position: relative; }
.nav-panel {
    display: none; position: absolute; top: calc(100% + 6px); left: 0;
    min-width: 260px; max-width: 520px;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
    box-shadow: var(--shadow-2); padding: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px;
}
.nav-panel.open, .nav-item:hover .nav-panel { display: grid; }
.nav-panel a {
    padding: 6px 10px; border-radius: 6px; color: var(--muted); font-size: 13px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.nav-panel a:hover { color: var(--primary); background: var(--primary-soft); }
.top-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
    width: 32px; height: 32px; border: 0; border-radius: 50%;
    background: transparent; color: var(--muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color .2s, background .2s;
}
.icon-btn:hover { color: var(--primary); background: var(--primary-soft); }
.icon-btn svg { width: 17px; height: 17px; }
.user-link { color: var(--muted); font-size: 13px; padding: 4px 8px; border-radius: 6px; }
.user-link:hover { color: var(--primary); background: var(--primary-soft); }
.nav-toggle { display: none; }

/* ============ 搜索框内天气标 ============ */
/* 作为底部工具行的最后一项，右侧留出提交按钮宽度；空间不足时省略号截断 */
.weather-chip {
    margin-left: auto; margin-right: 40px; min-width: 0;
    color: var(--muted-2); font-size: 12px; line-height: 32px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    pointer-events: none;
}
.weather-chip b { color: var(--primary); font-weight: 600; }

/* ============ 大搜索框 ============ */
.search-area { max-width: 832px; margin: 0 auto 32px; }
.search-surface {
    position: relative; background: var(--surface);
    border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-1); height: 130px;
}
.search-surface textarea {
    width: 100%; height: 128px; border: 0; outline: none; resize: none;
    background: transparent; color: var(--text);
    font: inherit; font-size: 15px; line-height: 1.55;
    padding: 16px 64px 48px 24px;
}
.search-surface textarea::placeholder { color: var(--muted-2); }
.search-tools {
    position: absolute; left: 16px; right: 16px; bottom: 10px;
    display: flex; gap: 8px; min-width: 0;
}
.search-mode {
    width: 32px; height: 32px; border: 0; border-radius: 50%;
    background: transparent; color: var(--muted); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    transition: color .2s, background .2s; position: relative;
}
.search-mode:hover { color: var(--primary); background: var(--primary-soft); }
.search-mode.active { color: var(--primary); background: var(--primary-soft); }
.search-mode svg { width: 16px; height: 16px; }
.search-mode .tip {
    position: absolute; bottom: 38px; left: 50%; transform: translateX(-50%);
    background: var(--surface); border: 1px solid var(--border-soft); color: var(--muted);
    font-size: 12px; padding: 2px 8px; border-radius: 6px; white-space: nowrap;
    opacity: 0; pointer-events: none; transition: opacity .2s; box-shadow: var(--shadow-1);
}
.search-mode:hover .tip { opacity: 1; }
.search-go {
    position: absolute; right: 16px; bottom: 14px;
    width: 28px; height: 28px; border: 0; border-radius: 50%; cursor: pointer;
    background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    transition: background .2s, color .2s;
}
.search-go:hover { background: var(--primary); color: #fff; }
.search-go svg { width: 15px; height: 15px; }

/* ============ 卡片列表 ============ */
.stack { display: flex; flex-direction: column; gap: 20px; width: 100%; }
.card {
    position: relative; background: var(--surface);
    border: 1px solid var(--border-soft); border-radius: var(--radius);
    padding: 16px; box-shadow: var(--shadow-1);
    transition: border-color .2s, box-shadow .2s, transform .2s;
}
.card:hover { border-color: var(--primary-soft-2); transform: translateY(-1px); box-shadow: var(--shadow-2); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.card-title-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-icon {
    width: 24px; height: 24px; flex: none; border-radius: 6px;
    background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700;
}
.card-title { margin: 0; font-size: 16px; font-weight: 600; line-height: 24px; color: var(--text); }
.card-title a { color: inherit; }
.card-title a:hover { color: var(--primary); }
.more-link {
    height: 24px; padding: 0 9px; border-radius: 999px;
    background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; flex: none; transition: background .2s, color .2s;
}
.more-link:hover { background: var(--primary-soft-2); color: var(--primary-hover); }

.grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
/* 分栏目：每行 5 个 × 最多 5 行（25 个，多余由各断点隐藏） */
.grid > a:nth-child(n+26) { display: none; }
/* 置顶推荐：每行 5 个 × 最多 3 行（15 个） */
.grid-pin > a:nth-child(n+16) { display: none; }
.item {
    display: flex; align-items: center; gap: 8px; min-width: 0;
    padding: 6px 10px; border-radius: var(--radius);
    color: var(--text); font-size: 14px; line-height: 1.55;
    transition: color .2s, background .2s, transform .2s;
}
.item:hover { color: var(--primary); background: var(--primary-soft); transform: translateY(-1px); }
.item .tile {
    width: 20px; height: 20px; flex: none; border-radius: 6px;
    background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; text-transform: uppercase; overflow: hidden;
}
.item .tile img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.item .name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .star { color: var(--primary); font-size: 11px; flex: none; }

/* 列表页行（带简介） */
.rows { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.row {
    display: flex; align-items: flex-start; gap: 10px; min-width: 0;
    padding: 8px 10px; border-radius: var(--radius);
    transition: background .2s, transform .2s;
}
.row:hover { background: var(--primary-soft); transform: translateY(-1px); }
.row .tile {
    width: 32px; height: 32px; flex: none; border-radius: 8px;
    background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; overflow: hidden;
}
.row .tile img { width: 100%; height: 100%; object-fit: contain; display: block; background: #fff; }
.row .body { min-width: 0; flex: 1; }
.row .t { color: var(--text); font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row:hover .t { color: var(--primary); }
.row .d { color: var(--muted-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .u { color: var(--muted-2); font-size: 12px; }
.row .hits { color: var(--muted-2); font-size: 12px; flex: none; }

/* 排行 */
.rank-no {
    width: 24px; height: 24px; flex: none; border-radius: 6px;
    background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700;
}
.rank-no.top { background: var(--primary); color: #fff; }

/* ============ 页头小工具 ============ */
.page-head { margin: 0 0 20px; }
.page-head h1 { margin: 0; font-size: 24px; font-weight: 700; color: var(--text); }
.breadcrumb { color: var(--muted-2); font-size: 13px; margin-bottom: 14px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--primary); }
.crumb-sep { margin: 0 6px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tab-pill {
    height: 30px; padding: 0 14px; border-radius: 999px;
    display: inline-flex; align-items: center; font-size: 13px;
    background: transparent; border: 1px solid var(--border-soft); color: var(--muted);
    transition: all .2s;
}
.tab-pill:hover { color: var(--primary); border-color: var(--primary-soft-2); background: var(--primary-soft); }
.tab-pill.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }

/* 分页 */
.pages { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px 0 8px; color: var(--muted-2); font-size: 13px; }
.pages a {
    height: 30px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center;
    background: var(--primary-soft); color: var(--primary); transition: background .2s;
}
.pages a:hover { background: var(--primary-soft-2); }

/* ============ 表单 ============ */
.form-card { max-width: 560px; margin: 0 auto; }
.form-card h2 { margin: 0 0 18px; font-size: 18px; font-weight: 600; color: var(--text); }
.f-row { margin-bottom: 14px; }
.f-row label { display: block; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.f-input, .f-textarea, .f-select {
    width: 100%; background: transparent; color: var(--text);
    border: 1px solid var(--border); border-radius: var(--radius);
    padding: 9px 12px; font: inherit; font-size: 14px; outline: none;
    transition: border-color .2s, box-shadow .2s;
}
.f-textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.f-input:focus, .f-textarea:focus, .f-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.f-select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.f-select option { background: var(--surface); color: var(--text); }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 36px; padding: 0 20px; border: 0; border-radius: var(--radius);
    background: var(--primary); color: #fff; font: inherit; font-size: 14px; cursor: pointer;
    transition: background .2s;
}
.btn:hover { background: var(--primary-hover); color: #fff; }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.btn-ghost:hover { background: var(--primary-soft-2); color: var(--primary-hover); }
.alert { border-radius: var(--radius); padding: 10px 14px; font-size: 13px; margin-bottom: 14px; }
.alert-err { background: rgba(245, 63, 63, .16); color: #ff7b7b; }
.alert-ok { background: rgba(0, 180, 42, .16); color: #4ed17a; }
html[data-theme="light"] .alert-err { background: rgba(245, 63, 63, .1); color: #cf1322; }
html[data-theme="light"] .alert-ok { background: rgba(0, 180, 42, .1); color: #16803c; }
.form-tip { color: var(--muted-2); font-size: 12px; margin-top: 6px; }
.muted { color: var(--muted-2); }
.center { text-align: center; }

/* ============ 留言 ============ */
.gb-item { border-bottom: 1px solid var(--border-soft); padding: 12px 0; }
.gb-item:last-child { border-bottom: 0; }
.gb-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.gb-name { color: var(--text); font-weight: 600; font-size: 14px; }
.gb-date { color: var(--muted-2); font-size: 12px; }
.gb-body { color: var(--muted); font-size: 14px; white-space: pre-wrap; }
.gb-reply { margin-top: 8px; background: var(--primary-soft); border-radius: var(--radius); padding: 8px 12px; font-size: 13px; color: var(--text); }
.gb-reply b { color: var(--primary); }

/* ============ 首页两栏布局（左侧内容 + 右侧边栏，仅深色现代） ============ */
.home-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.home-wrap.no-side { grid-template-columns: minmax(0, 1fr); }
.home-main { min-width: 0; }
/* 主栏内：搜索框/内容列铺满，取消原来的居中限宽 */
.home-main .search-area { max-width: none; margin-bottom: 20px; }
.home-main .stack.col { max-width: none; margin: 0; }

.home-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 64px; }
.side-card { padding: 14px; }
.side-head { margin-bottom: 10px; }
.side-title { margin: 0; font-size: 15px; font-weight: 600; color: var(--text); }

/* 图片轮播 */
.carousel { padding: 0; overflow: hidden; }
.carousel-track { position: relative; }
.carousel-slide { display: none; position: relative; }
.carousel-slide.on { display: block; }
.carousel-slide img { width: 100%; height: 160px; object-fit: cover; display: block; }
.carousel-cap {
    position: absolute; left: 0; right: 0; bottom: 0;
    padding: 20px 10px 8px; font-size: 12px; color: #fff;
    background: linear-gradient(transparent, rgba(0, 0, 0, .68));
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.carousel-dots { display: flex; justify-content: center; gap: 6px; padding: 8px 0; }
.carousel-dots .dot {
    width: 6px; height: 6px; padding: 0; border: 0; border-radius: 50%;
    background: var(--border); cursor: pointer; transition: background .2s, width .2s;
}
.carousel-dots .dot.on { background: var(--primary); width: 16px; border-radius: 3px; }

/* 最新收录 */
.side-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.side-list a {
    display: flex; align-items: center; gap: 8px; min-width: 0;
    padding: 5px 6px; border-radius: 6px; color: var(--text); font-size: 13px;
    transition: color .2s, background .2s;
}
.side-list a:hover { color: var(--primary); background: var(--primary-soft); }
.side-list .tile.tiny {
    width: 18px; height: 18px; flex: none; border-radius: 5px;
    background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.side-list .nm { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 赞助二维码 */
.side-sponsor { text-align: center; }
.side-sponsor .qr {
    width: 150px; height: 150px; object-fit: contain; border-radius: 8px;
    background: #fff; padding: 6px; display: inline-block;
}
.side-sponsor .qr-tip { margin: 8px 0 0; color: var(--muted-2); font-size: 12px; }

/* 每日一句 */
.side-daily .daily-text {
    margin: 0; color: var(--muted); font-size: 13px; line-height: 1.75;
    border-left: 3px solid var(--primary-soft-2); padding-left: 10px;
}

/* 热度指数 */
.hot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.hot-cell {
    background: var(--primary-soft); border-radius: 8px; padding: 8px 6px; text-align: center;
}
.hot-cell b { display: block; font-size: 18px; font-weight: 700; color: var(--primary); line-height: 1.3; }
.hot-cell span { display: block; font-size: 11px; color: var(--muted); }
.hot-cell em { display: block; font-style: normal; font-size: 10px; color: var(--muted-2); }
.hot-top { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ============ 广告 ============ */
.ad-card { text-align: center; }
.ad-card a { color: var(--muted); }
.ad-card a:hover { color: var(--primary); }
.ad-card img { max-width: 100%; border-radius: 6px; vertical-align: middle; }
.ad-tag { font-size: 11px; color: var(--muted-2); border: 1px solid var(--border-soft); border-radius: 4px; padding: 0 4px; margin-right: 6px; }
/* 文字广告：每行 4 个、最多 3 行；每条前置 AD 小标 */
.ad-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 20px; text-align: left; }
.ad-item {
    display: flex; align-items: center; gap: 8px; min-width: 0;
    padding: 7px 10px; border-radius: 6px; font-size: 13px; line-height: 1.5;
    color: var(--muted); transition: background .2s, color .2s;
}
.ad-item:hover { background: var(--primary-soft); color: var(--primary); }
.ad-item .ad-badge {
    flex: none; font-size: 9px; font-weight: 700; letter-spacing: .04em;
    color: var(--primary); background: var(--primary-soft);
    border-radius: 4px; padding: 1px 5px; line-height: 13px; opacity: .9;
}
.ad-item:hover .ad-badge { opacity: 1; background: var(--primary-soft-2); }
.ad-item .ad-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-img { margin-top: 12px; }
.ad-img img { max-width: 100%; border-radius: 6px; }

/* 栏目图标中的 SVG */
.card-icon svg { width: 16px; height: 16px; display: block; }
.item .tile svg, .row .tile svg, .ad-item svg { width: 14px; height: 14px; display: block; }

/* 关于页 */
.about-text { color: var(--muted); font-size: 14px; line-height: 1.9; word-break: break-word; }
.about-text a { color: var(--primary); }
.logo-img { height: 26px; vertical-align: middle; display: block; }

/* ============ 工具页（总览卡片 → 单工具详情） ============ */
.tool-overview, .tool-detail-head, .tool-chips { max-width: 1280px; margin: 0 auto; }
.tool-section { margin-bottom: 22px; }
.tool-section-title {
    font-size: 13px; color: var(--muted-2); letter-spacing: .08em;
    margin: 0 0 10px; padding-left: 2px;
}
.tool-section-title .tools-count { letter-spacing: 0; }
.tool-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tool-card {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--radius);
    padding: 12px; color: var(--text); box-shadow: var(--shadow-1);
    transition: border-color .2s, transform .2s, box-shadow .2s;
}
.tool-card:hover { border-color: var(--primary-soft-2); transform: translateY(-2px); box-shadow: var(--shadow-2); color: var(--text); }
.tool-card-icon {
    flex: none; width: 34px; height: 34px; border-radius: 8px;
    background: var(--primary-soft); color: var(--primary);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; overflow: hidden;
}
.tool-card-icon svg { width: 18px; height: 18px; }
.tool-card-body { min-width: 0; display: block; }
.tool-card-name { display: block; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-card-desc { display: block; font-size: 12px; color: var(--muted-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-card.ext .tool-card-icon { background: transparent; border: 1px dashed var(--border-soft); }
.tool-detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.tool-back {
    flex: none; height: 30px; padding: 0 14px; border-radius: 999px;
    display: inline-flex; align-items: center; font-size: 13px;
    background: var(--primary-soft); color: var(--primary);
}
.tool-back:hover { background: var(--primary-soft-2); color: var(--primary-hover); }
.tool-detail-title { font-size: 18px; font-weight: 700; color: var(--text); }
.tool-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.tool-chip {
    display: inline-flex; align-items: center; height: 26px; padding: 0 10px;
    border-radius: 999px; font-size: 12px; color: var(--muted);
    border: 1px solid var(--border-soft); transition: all .2s;
}
.tool-chip:hover { color: var(--primary); border-color: var(--primary-soft-2); background: var(--primary-soft); }
.tool-chip.on { background: var(--primary-soft); border-color: transparent; color: var(--primary); font-weight: 600; }
.tools-body { max-width: 832px; margin: 0 auto; min-width: 0; }
.tool-panel { display: none; }
.tool-panel.active { display: block; }
.tool-out {
    margin-top: 10px; padding: 10px 12px; border: 1px dashed var(--border-soft); border-radius: var(--radius);
    color: var(--text); font-size: 13px; word-break: break-all; min-height: 18px; white-space: pre-wrap;
    font-family: Consolas, Menlo, monospace;
}
.card .f-textarea { min-height: 90px; }
@media (max-width: 1100px) {
    .tool-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .tool-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .tool-card { padding: 9px; gap: 8px; }
    .tool-card-icon { width: 28px; height: 28px; font-size: 11px; }
    .tool-card-name { font-size: 13px; }
    .tool-detail-head { flex-wrap: wrap; gap: 8px; }
}

/* ============ 页脚 ============ */
.footer { background: var(--footer-bg); margin-top: 12px; }
.footer-inner { max-width: 1280px; margin: 0 auto; padding: 24px 24px 12px; }
.footer-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; }
.footer-title { margin: 0 0 16px; font-size: 16px; font-weight: 600; line-height: 22px; color: var(--text); }
.footer-text { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.footer-links { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.footer-links a, .footer-links li { color: var(--muted); font-size: 14px; line-height: 1.7; }
.footer-links a:hover { color: var(--primary); }
.footer-bottom {
    border-top: 1px solid var(--border-soft); margin-top: 20px; padding: 14px 0;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    color: var(--muted-2); font-size: 13px;
}
.footer-bottom a { color: var(--muted-2); }
.footer-bottom a:hover { color: var(--primary); }

/* 返回顶部 */
.to-top {
    position: fixed; right: 24px; bottom: 28px; z-index: 40;
    width: 40px; height: 40px; border: 1px solid var(--border-soft); border-radius: 50%;
    background: var(--surface); color: var(--muted); cursor: pointer;
    display: none; align-items: center; justify-content: center;
    box-shadow: var(--shadow-1); transition: color .2s, border-color .2s;
}
.to-top.show { display: inline-flex; }
.to-top:hover { color: var(--primary); border-color: var(--primary); }
.to-top svg { width: 16px; height: 16px; }

/* ============ 响应式 ============ */
@media (max-width: 1100px) {
    /* 平板：每行 4 个 */
    .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .grid > a:nth-child(n+21) { display: none; }     /* 分栏目 4×5 = 20 */
    .grid-pin > a:nth-child(n+13) { display: none; } /* 置顶 4×3 = 12 */
    .ad-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 16px; }
}
@media (max-width: 1200px) {
    .home-wrap { grid-template-columns: minmax(0, 1fr) 290px; }
}
@media (max-width: 1000px) {
    /* 平板：保留侧栏，仅收窄 */
    .home-wrap { grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
}
@media (max-width: 700px) {
    /* 手机/小平板：侧栏移到内容下方，两列平铺（避免全部竖排、页面过长） */
    .home-wrap { grid-template-columns: minmax(0, 1fr); gap: 16px; }
    .home-side { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: start; }
    /* 轮播横幅、热度指数占满整行 */
    .carousel, .side-hot { grid-column: 1 / -1; }
    /* 最新收录占满整行，自身列表再分两列，长度减半 */
    .side-latest { grid-column: 1 / -1; }
    .side-latest .side-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 10px; }
    /* 赞助二维码 + 每日一句 并排 */
    .side-sponsor, .side-daily { grid-column: auto; }
    .carousel-slide img { height: 190px; }
}
@media (max-width: 900px) {
    .nav { display: none; }
    .nav.mobile-open { display: flex; position: absolute; top: 48px; left: 0; right: 0; flex-direction: column; align-items: stretch; background: var(--surface); border-bottom: 1px solid var(--border-soft); padding: 8px; gap: 2px; box-shadow: var(--shadow-2); }
    .nav.mobile-open .nav-item > a, .nav.mobile-open .nav-item > span { width: 100%; }
    .nav.mobile-open .nav-panel { position: static; display: grid; border: 0; box-shadow: none; padding: 0 0 6px 14px; }
    .nav-toggle { display: inline-flex; }
    .top-actions { margin-left: auto; }
    .rows { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 16px; }
}
@media (max-width: 640px) {
    .main { padding: 72px 12px 8px; }
    /* 侧栏保持两列网格（关键：此处不再改回 flex 竖排，否则侧栏会全部堆成一长条） */
    .home-side { gap: 10px; }
    .side-card { padding: 12px; }
    .carousel-slide img { height: 170px; }
    .hot-cell b { font-size: 16px; }
    .search-area { margin-bottom: 24px; }
    .search-surface { height: 118px; }
    .search-surface textarea { height: 116px; padding: 14px 54px 44px 16px; font-size: 14px; }
    .search-go { right: 10px; bottom: 12px; }
    .card { padding: 12px; }
    .card-title { font-size: 14px; }
    /* 手机：每行 3 个 */
    .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
    .grid > a:nth-child(n+13) { display: none; }     /* 分栏目 3×4 = 12 */
    .grid-pin > a:nth-child(n+10) { display: none; } /* 置顶 3×3 = 9 */
    .ad-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
    .ad-item { padding: 6px 8px; font-size: 12px; }
    .item { padding: 6px 8px; font-size: 12px; }
    .stack { gap: 16px; }
    .footer-inner { padding: 24px 16px 12px; }
    .footer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 14px; }
    .footer-text, .footer-links a, .footer-links li { font-size: 12px; }
    .footer-title { font-size: 14px; margin-bottom: 10px; }
    .to-top { right: 14px; bottom: 18px; }
}
