/* ==========================================================================
   实时热榜 · 视觉基线参照 tophub.today（已按其线上 app.2025.css 实测值对齐）
   - 页面底 #F7F8FA / 顶栏 #F3F3F3 64px / 卡片 #FFF 圆角 6px
   - 卡片头站名 18px #1A1A1A、子榜 Tab 16px #999（选中 #666 + 2px #98999A 下划线）
   - 列表 16px：排名 25px #999、前三 #f1403c / orange / gold、hover #19F
   - 卡片底与头部分隔线 #EBEBEB，时间 14px #666
   本文件仍覆盖 Bulma 的 .card / .columns / .column 类名，保证既有 24 张卡片 DOM 不改数据结构。
   ========================================================================== */
:root {
    --th-bg: #F7F8FA;
    --th-bar: #F3F3F3;
    --th-card: #FFFFFF;
    --th-line: #EBEBEB;
    --th-text: #1A1A1A;
    --th-title: #4a4a4a;
    --th-muted: #666666;
    --th-light: #999999;
    --th-hover: #19F;
    --th-rank1: #f1403c;
    --th-rank2: orange;
    --th-rank3: gold;
}

/* ===== 基础 ===== */
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: var(--th-bg);
    color: var(--th-text);
    margin: 0;
}
#flow { display: none; }

/* ===== 顶部吸顶分类栏 ===== */
.th-appbar {
    position: sticky;
    top: 0;
    z-index: 1100;
    background: var(--th-bar);
    box-shadow: 0 2px 4px 0 rgba(85, 85, 85, .25);
    transition: background-color .2s;
}
.th-appbar-inner {
    max-width: 1600px;
    height: 64px;
    margin: 0 auto;
    padding: 0 1%;
    display: flex;
    align-items: center;
    gap: 16px;
}
.th-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    color: var(--th-title);
    font-size: 18px;
    font-weight: 800;
    text-decoration: none;
    white-space: nowrap;
}
.th-brand img { width: 32px; height: 32px; object-fit: contain; border-radius: 3px; }
.th-brand:hover { color: var(--th-title); }
.th-tabs {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    overflow-x: auto;
    scrollbar-width: none;
    white-space: nowrap;
}
.th-tabs::-webkit-scrollbar { display: none; }
.th-tab {
    border: 0;
    background: transparent;
    height: 48px;
    line-height: 48px;
    padding: 0 14px;
    color: var(--th-title);
    opacity: .7;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    flex: 0 0 auto;
}
.th-tab:hover { opacity: 1; }
.th-tab.is-active { opacity: 1; font-weight: 700; }
.th-tab.is-active::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: 8px;
    height: 2px;
    background: #98999A;
}
.th-sep {
    width: 1px;
    height: 16px;
    background: #ccc;
    margin: 0 8px;
    flex: 0 0 auto;
}
.th-actions { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.th-clock { color: var(--th-muted); font-size: 13px; white-space: nowrap; }
.th-icon-btn,
.th-more-btn {
    border: 0;
    background: transparent;
    color: var(--th-muted);
    height: 32px;
    min-width: 32px;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
}
.th-icon-btn:hover, .th-more-btn:hover { background: rgba(0, 0, 0, .06); color: var(--th-text); }
.th-icon-btn.is-spinning i { animation: th-spin .8s linear infinite; }
@keyframes th-spin { to { transform: rotate(360deg); } }
.th-more { position: relative; }
.th-more-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 34px;
    min-width: 140px;
    background: #fff;
    border: 1px solid var(--th-line);
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .10);
    padding: 6px 0;
    z-index: 20;
}
.th-more:hover .th-more-menu, .th-more:focus-within .th-more-menu { display: block; }
.th-more-menu a {
    display: block;
    padding: 8px 14px;
    color: var(--th-title);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}
.th-more-menu a:hover { background: var(--th-bg); color: var(--th-hover); }

/* ===== 页面容器与分组标题 ===== */
.th-page { max-width: 1600px; margin: 0 auto; padding: 0 1% 20px; }
/* 不用 overflow:hidden 清浮动：父级一旦成为可滚动祖先，会干扰「热门节点」jumpTo 的 scrollIntoView 定位。
   .th-nodes 本身是 grid，.hot-grid 自带 ::after clearfix，两个 section 的高度都能正常撑开。 */
.th-hot, .th-reco { overflow: visible; }
.th-section-title {
    color: var(--th-muted);
    font-size: 14px;
    padding: 20px 0 10px;
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.th-section-sub { color: var(--th-light); font-size: 12px; font-weight: 400; }
.th-reco-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
}
.th-modes { display: flex; gap: 6px; padding-top: 16px; }
.th-modes button {
    border: 1px solid #f4f4f4;
    background: #fff;
    color: var(--th-title);
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
}
.th-modes button:hover { color: var(--th-hover); }
.th-modes button.is-active { border-color: var(--th-light); color: var(--th-text); font-weight: 700; }

/* ===== 热门站点入口（tophub「热门」节点网格） ===== */
.th-nodes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 16px 12px;
    padding: 4px 0 16px;
}
.th-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    min-width: 0;
}
.th-node-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    overflow: hidden;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
    transition: transform .16s ease, box-shadow .16s ease;
}
.th-node:hover .th-node-icon { transform: translateY(-3px); box-shadow: 0 6px 16px rgba(0, 0, 0, .10); }
.th-node-icon img { width: 46px; height: 46px; object-fit: contain; }
.th-node-name {
    margin-top: 8px;
    width: 100%;
    color: var(--th-muted);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.th-node-sub {
    width: 100%;
    color: var(--th-light);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 卡片栅格（4 / 3 / 2 列，窄屏自动降级） ===== */
.section { padding: 0; }
.section > .container, .th-page > .container { max-width: none; padding: 0; }
.hot-grid.row.columns {
    display: block;
    margin: 0;
    padding: 0 0 20px;
    overflow: visible;
}
/* 清除浮动但不用 overflow:hidden，避免容器成为可滚动祖先影响 scrollIntoView 定位 */
.hot-grid.row.columns::after { content: ""; display: block; clear: both; }
/* 宽度 + 右侧间距正好凑满一行（4×25% / 3×33.3% / 2×50%），
   因此不依赖 nth-child 去 margin-right：分类筛选隐藏卡片后仍不会错位。 */
.hot-grid > .column.is-one-third {
    display: block;
    float: left;
    box-sizing: border-box;
    padding: 0 !important;
    margin: 0 1% 1% 0;
    width: 24%;
    scroll-margin-top: 80px;
}
.hot-grid.cols-4 > .column.is-one-third { width: 24%; }
.hot-grid.cols-3 > .column.is-one-third { width: 32.3%; }
.hot-grid.cols-2 > .column.is-one-third { width: 49%; }
.hot-grid > .column.is-hidden { display: none !important; }

/* ===== 榜单卡片 ===== */
.card.large {
    background: var(--th-card);
    border: 0;
    border-radius: 6px;
    box-shadow: none;
    padding: 0 5px 0 15px;
    height: 100%;
    overflow: hidden;
    transition: box-shadow .18s ease;
}
.card.large:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, .07); }
.card.large.is-focus { box-shadow: 0 0 0 2px #98999A, 0 4px 16px rgba(0, 0, 0, .08); }

/* 卡片头：站名 + 子榜 Tab */
.card-header {
    background: transparent;
    box-shadow: none;
    border-bottom: 1px solid var(--th-line);
    padding: 10px 0;
    margin-right: 10px;
    min-height: 0;
    align-items: flex-end;
}
.card-header-title {
    flex: 1;
    min-width: 0;
    padding: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--th-text);
    align-items: center;
}
.card-header-title .icon { margin-right: 4px; height: 20px; width: 20px; }
.card-header-title .icon img { width: 20px; height: 20px; border-radius: 6px; vertical-align: text-top; }
.card-header-title a {
    color: var(--th-text) !important;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-header-title a:hover { color: var(--th-hover) !important; }

.custom-card-toggle {
    position: relative;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: flex-end;
    margin-left: 20px;
    padding: 0;
    font-size: 16px;
    font-weight: 400;
    color: var(--th-light) !important;
    cursor: pointer;
    background: transparent !important;
    border-radius: 0;
    white-space: nowrap;
}
.custom-card-toggle:hover { color: var(--th-hover) !important; }
.custom-card-toggle.is-active { color: var(--th-muted) !important; font-weight: 700; }
.custom-card-toggle.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -11px;
    border-bottom: 2px solid #98999A;
}

/* 卡片内容 + 滚动区 */
.card-content { background: transparent; padding: 0; }
.scroll-box {
    height: 360px;
    max-height: 360px;
    overflow-y: auto !important;
    margin-right: 10px;
    word-wrap: break-word;
    word-break: break-word;
    scrollbar-width: thin;
}
.scroll-box::-webkit-scrollbar { width: 5px; background: transparent; }
.scroll-box::-webkit-scrollbar-track { background: transparent; }
.scroll-box::-webkit-scrollbar-thumb { background: #ddd; border-radius: 3px; }
.scroll-box:hover::-webkit-scrollbar-thumb { background: #bbb; }

/* ===== 列表行 ===== */
.card-content ol { list-style: none; margin: 0; padding: 0; }
.card-content ol li {
    display: flex;
    align-items: center;
    padding: 0 0 8px 0;
    border: 0;
    font-size: 16px;
    line-height: 1.5;
    transition: background .15s ease;
}
.card-content ol li:hover { background: #FAFAFA; }
.card-content ol p { padding: 16px; text-align: center; color: var(--th-light); font-size: 13px; }

/* 排名：前三配色取自 tophub .s.h 规则 */
.rank {
    flex: 0 0 25px;
    width: 25px;
    text-align: left;
    color: var(--th-light);
    font-size: 16px;
    font-weight: 400;
    font-style: normal;
    margin: 0;
    padding-top: 0;
}
.rank.rank-top1 { color: var(--th-rank1); }
.rank.rank-top2 { color: var(--th-rank2); }
.rank.rank-top3 { color: var(--th-rank3); }

.hot-title {
    flex: 1;
    min-width: 0;
    color: var(--th-text);
    font-size: 16px;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color .15s ease;
}
.hot-title:visited { color: #999; }
.hot-title:hover,
.hot-title:visited:hover { color: var(--th-hover); }
.hot-heat {
    flex: 0 0 auto;
    max-width: 100px;
    margin-left: 8px;
    color: rgba(0, 0, 0, .54);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.card-content ol li:hover .hot-heat { color: var(--th-hover); }
.hot-empty, .hot-loading { padding: 24px 0; text-align: center; color: var(--th-light); font-size: 13px; }

/* 卡片底：更新时间 */
.custom-card-footer {
    background: transparent;
    border-top: 1px solid var(--th-line);
    margin-right: 10px;
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}
.custom-card-footer p {
    flex: 1;
    color: var(--th-muted) !important;
    font-size: 14px;
    margin: 0;
    cursor: pointer;
}
.custom-card-footer p:hover { color: var(--th-hover) !important; }

/* 页脚 */
.th-footer { text-align: center; color: var(--th-light); font-size: 13px; padding: 24px 0 32px; }

/* ===== 深色模式（沿用 bgcolor('darkblue') 的 body.bg-darkblue） ===== */
body.bg-darkblue { background: #041221; } /* 与 bgcolor('darkblue') 的内联值一致 */
body.bg-darkblue .th-appbar { background: #191A1B; box-shadow: 0 2px 4px rgba(0, 0, 0, .5); }
body.bg-darkblue .th-brand,
body.bg-darkblue .th-tab,
body.bg-darkblue .th-clock,
body.bg-darkblue .th-icon-btn,
body.bg-darkblue .th-more-btn { color: #ddd; }
body.bg-darkblue .th-more-menu { background: #191A1B; border-color: #2D2E2F; }
body.bg-darkblue .th-more-menu a { color: #ddd; }
body.bg-darkblue .th-more-menu a:hover { background: #252729; }
body.bg-darkblue .th-section-title,
body.bg-darkblue .th-modes button { color: #b9b9b9; }
body.bg-darkblue .th-modes button { background: #191A1B; border-color: #2D2E2F; }
body.bg-darkblue .th-node-icon { background: #191A1B; }
body.bg-darkblue .th-node-name { color: #ddd; }
body.bg-darkblue .card.large { background: #191A1B; }
body.bg-darkblue .card-header,
body.bg-darkblue .custom-card-footer { border-color: #2D2E2F; }
body.bg-darkblue .card-header-title,
body.bg-darkblue .card-header-title a { color: #ddd !important; }
body.bg-darkblue .custom-card-toggle.is-active { color: #ddd !important; }
body.bg-darkblue .hot-title { color: #ddd; }
body.bg-darkblue .hot-heat { color: #888; }
body.bg-darkblue .custom-card-footer p { color: #aaa !important; }
body.bg-darkblue .card-content ol li:hover { background: #222426; }
body.bg-darkblue .scroll-box::-webkit-scrollbar-thumb { background: #3a3c3e; }

/* ===== 响应式：与 tophub 的 1200 / 768 / 480 断点对齐 ===== */
@media (max-width: 1200px) {
    .hot-grid.cols-4 > .column.is-one-third { width: 32.3%; }
    .th-clock { display: none; }
}
@media (max-width: 768px) {
    .th-appbar-inner { height: 57px; gap: 8px; }
    .th-brand span { display: none; }
    .th-tab { padding: 0 10px; }
    .hot-grid > .column.is-one-third,
    .hot-grid.cols-4 > .column.is-one-third,
    .hot-grid.cols-3 > .column.is-one-third { width: 49%; }
    .scroll-box { height: 320px; max-height: 320px; }
    .th-modes { padding-top: 12px; }
}
@media (max-width: 480px) {
    .hot-grid > .column.is-one-third,
    .hot-grid.cols-2 > .column.is-one-third,
    .hot-grid.cols-3 > .column.is-one-third,
    .hot-grid.cols-4 > .column.is-one-third { width: 100%; margin-right: 0; float: none; }
    .th-nodes { grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 12px 6px; }
    .th-node-icon { width: 56px; height: 56px; border-radius: 16px; }
    .th-node-icon img { width: 40px; height: 40px; }
    .th-section-title { padding-top: 14px; }
}
