/* ============================================================
   小搜资源网 · 功能增强层 addon.css
   1) 下载按钮网盘品牌徽章  2) 长文目录(TOC)  3) 排行榜页(布局自含)
   风格贴合原模板：白卡 / 细边框 / 主色 #007bf5
   注：自定义页面不加载 list.css，排行榜布局样式在此自含
   ============================================================ */

/* ---------- 顶部工具条：欢迎语靠最左、链接靠最右 ---------- */
/* 修复原模板 .header-top .tg 的 float:left;width:50% 压过 .right 的特异性问题 */
.header-top .header-important .tj {
    float: left;
    width: auto;
}
.header-top .header-important .tg {
    float: right;
    width: auto;
}

/* ---------- 2) 长文目录 TOC ---------- */
.k-toc {
    background: #fff;
    border: 1px solid #e8eef5;
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
}
.k-toc-h {
    padding: 11px 15px;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    cursor: pointer;
    user-select: none;
}
.k-toc-h i {
    font-style: normal;
    color: #93a0b0;
    margin-left: 4px;
    transition: transform .2s;
    float: right;
}
.k-toc.open .k-toc-h i { transform: rotate(180deg); }
.k-toc-b {
    display: none;
    border-top: 1px solid #f0f3f8;
    padding: 8px 0;
    max-height: 320px;
    overflow-y: auto;
}
.k-toc.open .k-toc-b { display: block; }
.k-toc-b a {
    display: block;
    padding: 6px 15px;
    color: #666;
    font-size: 13px;
    line-height: 1.5;
    border-left: 2px solid transparent;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.k-toc-b a.lv3 { padding-left: 28px; font-size: 12px; color: #8a97a8; }
.k-toc-b a:hover {
    color: #007bf5;
    border-left-color: #007bf5;
    background: #f5faff;
}

/* ---------- 3) 排行榜页（布局自含，比例复刻列表页 .69/.31） ---------- */
.rank-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px 30px;
    box-sizing: border-box;
    overflow: hidden;
}
.rank-main {
    float: left;
    width: calc((100% - 13px) * .69);
    min-height: 500px;
}
.rank-side {
    float: right;
    width: calc((100% - 14px) * .31);
}

.rank-crumb {
    background: #fff;
    padding: 11px 16px;
    font-size: 13px;
    color: #8a97a8;
    border-bottom: 1px solid #f0f3f8;
}
.rank-crumb a { color: #5b6b80; }
.rank-crumb a:hover { color: #007bf5; }

.rank-card {
    background: #fff;
    padding: 18px 20px 10px;
}
.rank-sub-tip {
    font-size: 12px;
    color: #a7b3c2;
    margin: -2px 0 14px;
}

/* 侧栏卡片 */
.rank-box {
    background: #fff;
    padding: 15px 20px 10px;
    margin-bottom: 14px;
}
.rank-box .c-title { margin-top: 0; }
.rank-hot { list-style: none; margin: 0; padding: 0; }
.rank-hot li { padding: 8px 0; border-bottom: 1px dashed #f0f3f8; }
.rank-hot li:last-child { border-bottom: 0; }
.rank-hot li a {
    color: #5b6b80;
    font-size: 13px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rank-hot li a:hover { color: #007bf5; }
.rank-hot li a i {
    font-style: normal;
    display: inline-block;
    width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    background: #eef2f7;
    color: #8a97a8;
    border-radius: 4px;
    font-size: 12px;
    margin-right: 8px;
}
.rank-hot li:nth-child(1) a i { background: #ff5722; color: #fff; }
.rank-hot li:nth-child(2) a i { background: #ff9800; color: #fff; }
.rank-hot li:nth-child(3) a i { background: #ffb800; color: #fff; }

/* tab：分段式 */
.rank-tabs {
    display: inline-flex;
    background: #f2f5f9;
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 10px;
}
.rank-tabs a {
    padding: 8px 22px;
    border-radius: 8px;
    font-size: 14px;
    color: #5b6b80;
    line-height: 1.4;
    transition: all .18s;
}
.rank-tabs a:hover { color: #007bf5; }
.rank-tabs a.on {
    background: #fff;
    color: #007bf5;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(20, 45, 90, .1);
}

/* 榜单列表 */
.rank-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.rank-list li {
    display: flex;
    align-items: center;
    padding: 13px 6px;
    border-bottom: 1px dashed #eef2f7;
    transition: background .15s;
    gap: 12px;
}
.rank-list li:last-child { border-bottom: 0; }
.rank-list li:hover { background: #fafcff; }

.rk-no {
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 6px;
    background: #eef2f7;
    color: #8a97a8;
    font-size: 12px;
    font-weight: 700;
    flex-shrink: 0;
}
.rk-no.top1 { background: linear-gradient(135deg, #ff5c33, #ff5722); color: #fff; }
.rk-no.top2 { background: linear-gradient(135deg, #ff9f43, #ff9800); color: #fff; }
.rk-no.top3 { background: linear-gradient(135deg, #ffc233, #ffb800); color: #fff; }

/* 前三名整行强调 */
.rank-list li.top-row .rk-no {
    width: 28px;
    height: 28px;
    line-height: 28px;
    font-size: 14px;
}
.rank-list li.top-row .rk-tit { font-size: 15px; font-weight: 600; }

.rk-img {
    width: 72px;
    height: 50px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    display: block;
    background: #f2f5f9;
}
.rk-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.rk-main-in {
    flex: 1;
    min-width: 0;
}
.rk-tit {
    display: block;
    color: #253247;
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.rk-tit:hover { color: #007bf5; }
.rk-sub {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
    font-size: 12px;
    color: #a7b3c2;
}
.rk-sort {
    color: #007bf5;
    background: #eaf3ff;
    padding: 1px 8px;
    border-radius: 99px;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rk-views {
    flex-shrink: 0;
    text-align: right;
    font-size: 12px;
    color: #a7b3c2;
    line-height: 1.3;
}
.rk-views b {
    display: block;
    font-size: 16px;
    color: #007bf5;
    font-weight: 700;
    font-family: "DIN Alternate", Arial, sans-serif;
}
.rank-list li.top-row .rk-views b {
    font-size: 18px;
}

.rank-empty {
    text-align: center;
    color: #93a0b0;
    padding: 34px 0;
}

/* ---------- 4) 文章代码块（highlight.js） ---------- */
.article-content pre {
    position: relative;
    display: flex;
    margin: 14px 0;
    padding: 0;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e4e9f0;
    background: #f6f8fa;
}
.article-content pre > code {
    flex: 1;
    display: block;
    margin: 0;
    padding: 12px 14px;
    overflow-x: auto;
    font: 13px/1.65 "JetBrains Mono", Consolas, "Courier New", monospace;
    white-space: pre;
    background: transparent;
}
.article-content pre > code::-webkit-scrollbar { height: 6px; }
.article-content pre > code::-webkit-scrollbar-thumb { background: #c4cdd8; border-radius: 3px; }

/* 行号列 */
.article-content .k-code-ln {
    flex-shrink: 0;
    display: block;
    padding: 12px 8px 12px 12px;
    text-align: right;
    color: #aab4c0;
    background: #eef1f5;
    border-right: 1px solid #e4e9f0;
    font: 13px/1.65 "JetBrains Mono", Consolas, "Courier New", monospace;
    white-space: pre;
    user-select: none;
}

/* 复制按钮 */
.article-content .k-code-copy {
    position: absolute;
    top: 6px;
    right: 6px;
    padding: 3px 10px;
    font-size: 12px;
    line-height: 1.5;
    color: #5b6b80;
    background: #fff;
    border: 1px solid #dbe2ea;
    border-radius: 5px;
    cursor: pointer;
    opacity: 0;
    transition: all .15s;
    z-index: 2;
}
.article-content pre:hover .k-code-copy { opacity: 1; }
.article-content .k-code-copy:hover { color: #007bf5; border-color: #007bf5; }
.article-content .k-code-copy.k-copied { color: #18b566; border-color: #18b566; }

/* 行内 code（非块级）微调 */
.article-content :not(pre) > code {
    padding: 2px 6px;
    margin: 0 2px;
    font-size: .92em;
    background: #f0f3f8;
    border-radius: 4px;
    color: #c7254e;
}

/* 暗夜模式 */
body.night .article-content pre { background: #0d1117; border-color: #30363d; }
body.night .article-content .k-code-ln { background: #161b22; color: #484f58; border-color: #30363d; }
body.night .article-content .k-code-copy { background: #161b22; color: #8b949e; border-color: #30363d; }
body.night .article-content :not(pre) > code { background: #21262d; color: #f0883e; }

/* ---------- 5) 分类页筛选 ---------- */
.k-filter {
    background: #fff;
    padding: 14px 16px 10px;
    margin-bottom: 14px;
    border-radius: 10px;
}
.k-filter .kf-row {
    display: flex;
    align-items: baseline;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 4px 0;
}
.k-filter .kf-row:last-child { margin-bottom: 0; }
.kf-label {
    flex-shrink: 0;
    font-size: 13px;
    color: #8a97a8;
    margin-right: 10px;
    line-height: 26px;
}
.kf-opts { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.kf-opts a {
    padding: 3px 12px;
    margin-right: 6px;
    font-size: 13px;
    color: #5b6b80;
    border-radius: 6px;
    line-height: 1.6;
    transition: all .15s;
}
.kf-opts a:hover { color: #007bf5; }
.kf-opts a.on {
    color: #fff;
    background: #007bf5;
}
.kf-opts a .kf-cnt { font-size: 11px; color: #a7b3c2; margin-left: 3px; }
.kf-opts a.on .kf-cnt { color: rgba(255,255,255,.8); }

/* 已选条件标签（可关闭） */
.kf-active {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 4px;
    padding-top: 8px;
    border-top: 1px dashed #eef2f7;
    font-size: 12px;
    color: #8a97a8;
}
.kf-tag {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    padding: 2px 4px 2px 10px;
    background: #eaf3ff;
    color: #007bf5;
    border-radius: 4px;
}
.kf-tag i {
    font-style: normal;
    margin-left: 6px;
    cursor: pointer;
    font-size: 13px;
    color: #7fa8d9;
}
.kf-tag i:hover { color: #e63b3b; }
/* 暗夜模式：分类筛选 */
body.night .k-filter { background: #1D1F20; }
body.night .kf-label { color: #8a8a8a; }
body.night .kf-opts a { color: #b1b1c1; }
body.night .kf-opts a:hover { color: #4da3ff; }
body.night .kf-opts a.on { color: #fff; background: #007bf5; }
body.night .kf-active { border-top-color: #3c3d3d; color: #8a8a8a; }
body.night .kf-tag { background: #14304f; color: #6cb2ff; }
body.night .kf-tag i { color: #4d7ab0; }

/* 暗夜模式：长文目录 */
body.night .k-toc { background: #1D1F20; border-color: #3c3d3d; }
body.night .k-toc-h { color: #d5d5d5; }
body.night .k-toc-b { border-top-color: #3c3d3d; }
body.night .k-toc-b a { color: #b1b1c1; }
body.night .k-toc-b a:hover { color: #4da3ff; background: #14233c; border-left-color: #007bf5; }

/* 暗夜模式：排行榜页 */
body.night .rank-crumb { background: #1D1F20; border-bottom-color: #3c3d3d; color: #8a8a8a; }
body.night .rank-crumb a { color: #b1b1c1; }
body.night .rank-card,
body.night .rank-box { background: #1D1F20; }
body.night .rank-sub-tip { color: #6d6d6d; }
body.night .rank-tabs { background: #2a2d31; }
body.night .rank-tabs a { color: #b1b1c1; }
body.night .rank-tabs a.on { background: #1D1F20; color: #6cb2ff; box-shadow: none; }
body.night .rank-list li { border-bottom-color: #3c3d3d; }
body.night .rank-list li:hover { background: #232629; }
body.night .rk-no { background: #2a2d31; color: #8a8a8a; }
body.night .rk-tit { color: #e0e0e0; }
body.night .rk-sort { background: #14233c; color: #6cb2ff; }
body.night .rk-date,
body.night .rk-sub,
body.night .rk-views { color: #6d6d6d; }
body.night .rk-views b { color: #6cb2ff; }
body.night .rk-img { background: #2a2d31; }
body.night .rank-empty { color: #6d6d6d; }


/* ---------- 响应式 ---------- */
@media (max-width: 992px) {
    .rank-main, .rank-side { float: none; width: 100%; }
}
@media (max-width: 640px) {
    .rk-img { width: 58px; height: 42px; }
    .rk-sub .rk-date { display: none; }
    .rank-tabs a { padding: 7px 14px; font-size: 13px; }
    .rank-card { padding: 14px 12px 8px; }
    .rank-box { padding: 12px 14px 8px; }
    .article-content pre > code { font-size: 12px; }
    .kf-label { display: none; }
}


/* ========== 全站圆角设计语言（覆盖层）：白卡 10px / 图片 8px / 按钮 6px ========== */
/* 白卡主容器 */
.list-container,
.list-right,
.article-right,
#index-middle,
#index-left,
.index-soft,
.bg-white,
.app-card,
.index-list .list-soft,
.index-list .list-article,
.flink,
.zt-banner {
    border-radius: 10px;
}

/* 白卡内部的通栏元素跟随圆角（避免直角内容顶出圆角边界） */
.list-container,
.index-soft,
.bg-white,
.app-card {
    overflow: hidden;
}

/* 正文与列表图片 */
/* 轮播容器圆角（对整块轮播区裁切，视觉与白卡统一） */
.new-position .layui-carousel,
#index-carousel {
    border-radius: 10px;
    overflow: hidden;
}

.article-content img,
.list-container .list-ul li .list-info .info-img,
.list-container .list-ul li .list-info .info-img img,
.list-container .info-img,
.list-container .info-img img,
.info-img,
.info-img img,
.list-img,
.list-img img,
.new-position #index-carousel div div img {
    border-radius: 8px;
}

/* 按钮 / 输入框（分页为左右半边拼合设计，保持方向性圆角并升级到 6px） */
.list_down a,
.list-btn a,
.textad td a,
.search input,
.search select {
    border-radius: 6px;
}
#middle_1 .page .top { border-radius: 6px 0 0 6px; }
#middle_1 .page .bottom { border-radius: 0 6px 6px 0; }

/* 评论区输入区 */
#respond,
#comment-post,
.comment-list > li {
    border-radius: 8px;
}

/* 暗夜模式不受影响（仅改圆角，未动配色） */


/* ---------- 首页图片弹窗 ---------- */
.k-pop {
    position: fixed;
    inset: 0;
    z-index: 999999;
}
.k-pop-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .58);
}
.k-pop-card {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    animation: kpopIn .25s ease-out;
}
@keyframes kpopIn {
    from { opacity: 0; transform: translate(-50%, -47%) scale(.94); }
    to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.k-pop-card img {
    display: block;
    margin: 0 auto;
    max-width: min(560px, 86vw);
    max-height: 68vh;
    border-radius: 10px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .4);
    cursor: pointer;
}
.k-pop-close-wrap {
    margin-top: 16px;
    text-align: center;
}
.k-pop-close {
    display: inline-block;
    padding: 8px 34px;
    border: 2px solid rgba(255, 255, 255, .9);
    border-radius: 999px;
    color: #fff;
    font-size: 14px;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all .18s;
    user-select: none;
}
.k-pop-close:hover {
    background: rgba(255, 255, 255, .18);
}
