/* ============================================================
 * SteamDB Plugin - Theme CSS
 * 规范 §3.4: 所有颜色必须挂载主题 CSS 变量,严禁写死浅色/白底
 * 默认回退值用于主题无对应变量时仍可阅读;暗色由主题变量自动切换
 * ============================================================ */

/* ---------- 布局 ---------- */
.steamdb-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px;
}

.steamdb-root {
    min-height: 400px;
}

/* ---------- 文字/表面/边框/链接: 一律引用主题变量 ---------- */
.steamdb-card,
.steamdb-panel {
    background: var(--board-bg-color, var(--card-bg, #ffffff));
    color: var(--text-color, var(--text-primary, #1a1a2e));
    border: 1px solid var(--line-color, var(--border-color, #e0e0e0));
    border-radius: 12px;
    padding: 20px;
    transition: box-shadow 0.2s, transform 0.2s;
}
.steamdb-card:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.steamdb-muted,
.steamdb-sec-text {
    color: var(--sec-text-color, var(--text-secondary, #666));
}

.steamdb-link,
.steamdb-text-link {
    color: var(--post-link-color, var(--primary-color, #1b2838));
    text-decoration: none;
    transition: opacity 0.2s;
}
.steamdb-link:hover,
.steamdb-text-link:hover {
    opacity: 0.8;
    text-decoration: underline;
}

/* 次级表面: 引用主题背景色 */
.steamdb-surface {
    background: var(--board-bg-color, var(--bg-secondary, #f8f9fa));
}

/* 透明品牌底: color-mix 基于主题文字色做半透明,适应明暗 */
.steamdb-brand-bg {
    background: color-mix(in srgb, var(--text-color, #1b2838), transparent 92%);
}

/* ---------- 按钮 ---------- */
.steamdb-btn {
    padding: 8px 16px;
    border: 1px solid var(--line-color, #d0d0d0);
    border-radius: 6px;
    background: var(--board-bg-color, #f8f9fa);
    color: var(--text-color, #1a1a2e);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}
.steamdb-btn:hover {
    background: var(--theme-color, var(--primary-color, #1b2838));
    color: var(--text-color-light, #ffffff);
    border-color: var(--theme-color, var(--primary-color, #1b2838));
}
.steamdb-btn-secondary {
    background: var(--board-bg-color, #f8f9fa);
    border-color: var(--line-color, #d0d0d0);
}
.steamdb-btn-sm { padding: 4px 10px; font-size: 0.8rem; }
.steamdb-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.steamdb-select,
.steamdb-input {
    padding: 8px 12px;
    border: 1px solid var(--line-color, #d0d0d0);
    border-radius: 6px;
    background: var(--board-bg-color, #fff);
    color: var(--text-color, #1a1a2e);
    font-size: 0.9rem;
    min-width: 160px;
}
.steamdb-select:focus,
.steamdb-input:focus {
    border-color: var(--theme-color, var(--primary-color, #1b2838));
    outline: none;
}

/* ---------- 标签 ---------- */
.steamdb-custom-tag {
    background: color-mix(in srgb, var(--theme-color, #66c0f4), transparent 85%);
    color: var(--text-color, #1a1a2e);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}
.steamdb-genre-tag {
    background: color-mix(in srgb, var(--theme-color, #66c0f4), transparent 90%);
    color: var(--text-color, #1a1a2e);
}

/* 语义色: 增长/回落 (可固定,但也建议挂变量) */
.steamdb-positive { color: #5ca732; }
.steamdb-negative { color: #c6302e; }
.steamdb-neutral { color: var(--sec-text-color, #666); }

/* ---------- 骨架屏: 使用主题边框/背景做 shimmer ---------- */
.steamdb-skeleton-page { padding: 16px 0; }
.steamdb-skeleton-header {
    height: 48px;
    border-radius: 8px;
    margin-bottom: 24px;
    background: linear-gradient(90deg, var(--line-color, #e8e8e8) 25%, var(--board-bg-color, #f5f5f5) 50%, var(--line-color, #e8e8e8) 75%);
    background-size: 200% 100%;
    animation: steamdb-shimmer 1.5s infinite;
}
.steamdb-skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}
.steamdb-skeleton-card {
    padding: 16px;
    border: 1px solid var(--line-color, #e8e8e8);
    border-radius: 12px;
}
.steamdb-skeleton-image {
    aspect-ratio: 300 / 169;
    border-radius: 8px;
    margin-bottom: 12px;
    background: linear-gradient(90deg, var(--line-color, #e8e8e8) 25%, var(--board-bg-color, #f5f5f5) 50%, var(--line-color, #e8e8e8) 75%);
    background-size: 200% 100%;
    animation: steamdb-shimmer 1.5s infinite;
}
.steamdb-skeleton-text {
    height: 1rem;
    border-radius: 4px;
    margin-bottom: 8px;
    background: linear-gradient(90deg, var(--line-color, #e8e8e8) 25%, var(--board-bg-color, #f5f5f5) 50%, var(--line-color, #e8e8e8) 75%);
    background-size: 200% 100%;
    animation: steamdb-shimmer 1.5s infinite;
}
.steamdb-skeleton-text.short { width: 50%; }

@keyframes steamdb-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ---------- 页头/标题 ---------- */
.steamdb-page-title {
    margin: 0 0 8px;
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-color, #1a1a2e);
}
.steamdb-page-subtitle {
    margin: 0 0 24px;
    color: var(--sec-text-color, #666);
    font-size: 0.95rem;
}

/* ---------- 工具条 ---------- */
.steamdb-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px;
    border: 1px solid var(--line-color, #e0e0e0);
    border-radius: 12px;
    background: var(--board-bg-color, #f8f9fa);
}

/* ---------- 表格 ---------- */
.steamdb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.steamdb-table th,
.steamdb-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--line-color, #eee);
    color: var(--text-color, #1a1a2e);
}
.steamdb-table th {
    background: var(--board-bg-color, #fafafa);
    font-weight: 600;
    color: var(--sec-text-color, #666);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.steamdb-table tbody tr:hover { background: var(--board-bg-color, #f8f9fa); }

/* ---------- 游戏卡片 ---------- */
.steamdb-game-card {
    background: var(--board-bg-color, var(--card-bg, #fff));
    border: 1px solid var(--line-color, var(--border-color, #e0e0e0));
    border-radius: 12px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}
.steamdb-game-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.steamdb-game-cover {
    position: relative;
    display: block;
    aspect-ratio: 300 / 169;
    overflow: hidden;
}
.steamdb-game-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}
.steamdb-game-card:hover .steamdb-game-cover img { transform: scale(1.05); }
.steamdb-ccu-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 500;
}
.steamdb-game-meta { padding: 16px; }
/* 卡内信息层级: .steamdb-muted 原本继承到 16px, 与 .steamdb-game-name 同级;
   题材串最长见过 7 项, 不换行裁剪会把卡片撑到 4 行。 */
.steamdb-game-meta .steamdb-muted { font-size: 0.8rem; line-height: 1.5; }
.steamdb-game-meta .steamdb-custom-tag {
    font-size: 9px;
    line-height: 1.5;
    padding: 2px 8px;
    margin-top: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.steamdb-game-name {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-color, #1a1a2e);
}
.steamdb-game-name a { color: inherit; text-decoration: none; }
.steamdb-game-name a:hover { color: var(--post-link-color, var(--primary-color, #1b2838)); }

/* ---------- 详情页指标 ---------- */
.steamdb-metric-value {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-color, #1b2838);
    font-variant-numeric: tabular-nums;
    margin-top: 2px;
}
.steamdb-metric-list {
    list-style: none;
    padding: 0;
    margin: 12px 0 0;
}
.steamdb-metric-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    border-bottom: 1px solid var(--line-color, #e5e6eb);
}

/* ---------- 趋势图 (SVG, 颜色走主题变量, 暗色模式自动适配) ---------- */
.steamdb-chart-box {
    margin-top: 8px;
}
.sdb-chart-grid {
    stroke: var(--line-color, #e5e6eb);
    stroke-width: 1;
    stroke-dasharray: 3 3;
}
.sdb-chart-label {
    fill: var(--sec-text-color, #86909c);
    font-size: 10px;
}
.sdb-chart-line {
    stroke: var(--theme-color, var(--post-link-color, #1b2838));
    stroke-width: 2;
    stroke-linejoin: round;
}
.sdb-chart-area {
    fill: var(--theme-color, var(--post-link-color, #1b2838));
    opacity: 0.12;
}
/* 数据点圆点: 折线端点 + 单点样本 (趋势图兜底, 2026-09-24) */
.sdb-chart-dot {
    fill: var(--theme-color, var(--post-link-color, #1b2838));
    stroke: #fff;
    stroke-width: 1.5;
}

/* ---------- 空状态 / 错误 ---------- */
.steamdb-empty {
    text-align: center;
    padding: 48px 16px;
    color: var(--sec-text-color, #86909c);
}
.steamdb-empty-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
}
.steamdb-empty-title {
    font-size: 1rem;
    margin-bottom: 12px;
    color: var(--text-color, #1b2838);
}

/* ---------- 题材趋势页 ---------- */
.steamdb-genre-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}
.steamdb-table-wrap {
    margin-top: 12px;
    overflow-x: auto;
}
.steamdb-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.steamdb-data-table th,
.steamdb-data-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line-color, #eee);
    color: var(--text-color, #1a1a2e);
}
.steamdb-data-table th {
    background: var(--board-bg-color, #fafafa);
    font-weight: 600;
    color: var(--sec-text-color, #666);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.steamdb-data-table tbody tr:hover {
    background: var(--board-bg-color, #f8f9fa);
}
/* ---------- 生命周期漏斗榜 (调研报表 / 异动监控) ----------
 * 2026-10-01 实测: 8 列把「游戏」列压到 144px, 而它还要装最多 13 个题材标签,
 * 43/50 行折行、行高 60~150px 抖动。数值列一律不许折行并右对齐等宽, 首列给足宽度。 */
.sdb-lc-table th:not(:first-child),
.sdb-lc-table td:not(:first-child) {
    white-space: nowrap;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.sdb-lc-table td:first-child {
    min-width: 16em;
}
.sdb-lc-genres {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
}
.steamdb-rank {
    width: 3.5em;
    text-align: center;
    font-variant-numeric: tabular-nums;
}
.steamdb-genre-name {
    font-weight: 600;
}
.steamdb-num {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
.steamdb-growth-up { color: #5ca732; }
.steamdb-growth-down { color: #c6302e; }
.sdb-genre-legend-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 12px;
}
.sdb-genre-legend {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-color, #1a1a2e);
}
.sdb-genre-legend i {
    width: 12px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
}
.steamdb-price-table {
    margin-top: 12px;
}
.steamdb-price-table summary:focus { outline: none; }
.steamdb-similar-card .steamdb-game-name {
    font-size: 0.95rem;
}

/* ---------- 生命周期漏斗条 (2026-09-25 报表) ---------- */
.sdb-funnel {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 10px;
    padding: 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    background: var(--bg-secondary, #f8f9fa);
}
.sdb-funnel-node {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sdb-funnel-label {
    flex: 0 0 40px;
    font-size: 0.75rem;
    color: var(--text-color-secondary, #6b7280);
    font-variant-numeric: tabular-nums;
}
.sdb-funnel-bar {
    flex: 1;
    height: 10px;
    border-radius: 5px;
    background: var(--bg-tertiary, #e5e7eb);
    overflow: hidden;
}
.sdb-funnel-bar i {
    display: block;
    height: 100%;
    border-radius: 5px;
    background: var(--primary-color, #1b2838);
    opacity: 0.85;
}
.sdb-funnel-val {
    flex: 0 0 48px;
    text-align: right;
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    color: var(--text-color, #1a1a2e);
}

/* ---------- 报表页筛选行 ---------- */
.sdb-filter-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0 12px;
    font-size: 0.85rem;
    color: var(--text-color-secondary, #6b7280);
}
.sdb-select {
    padding: 6px 10px;
    border: 1px solid var(--border-color, #d9d9d9);
    border-radius: 6px;
    background: var(--bg-color, #fff);
    color: var(--text-color, #1a1a2e);
    font-size: 0.85rem;
}

/* ---------- 竞品对标页 (2026-09-27) ---------- */
.sdb-cmp-mode {
    padding: 6px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    background: var(--bg-secondary, #f8f9fa);
    color: var(--text-color, #1a1a2e);
    font-size: 0.85rem;
    cursor: pointer;
}
.sdb-cmp-mode[aria-pressed="true"] {
    background: var(--primary-color, #1b2838);
    border-color: var(--primary-color, #1b2838);
    color: #fff;
}
.sdb-cmp-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 12px 0;
}
.sdb-cmp-input {
    padding: 6px 10px;
    min-width: 120px;
    border: 1px solid var(--border-color, #d9d9d9);
    border-radius: 6px;
    background: var(--bg-color, #fff);
    color: var(--text-color, #1a1a2e);
    font-size: 0.85rem;
}
.sdb-cmp-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 8px 0 4px;
}
.sdb-cmp-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 999px;
    background: var(--bg-secondary, #f8f9fa);
    font-size: 0.8rem;
    color: var(--text-color, #1a1a2e);
}
.sdb-cmp-chip button {
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted, #8a93a0);
    font-size: 0.9rem;
    line-height: 1;
    padding: 0;
}
.sdb-cmp-chip button:hover { color: #c6302e; }
/* 异动监控页 (2026-09-28) —— 类名此前不存在, 补上, 勿再犯 sdb-dot 那个「JS 用了 CSS 没定义」的错 */
.sdb-ano-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem;
    white-space: nowrap;
    border: 1px solid transparent;
}
.sdb-ano-tag.up {
    color: #1b7f3b;
    background: rgba(27, 127, 59, 0.1);
    border-color: rgba(27, 127, 59, 0.25);
}
.sdb-ano-tag.down {
    color: #c6302e;
    background: rgba(198, 48, 46, 0.1);
    border-color: rgba(198, 48, 46, 0.25);
}
.sdb-ano-sev-1 { color: var(--text-muted, #8a93a0); }
.sdb-ano-sev-2 { color: #b96a00; }
.sdb-ano-sev-3 { color: #c6302e; font-weight: 600; }
.sdb-ano-table td { white-space: nowrap; }
/* 台阶表的倍数列: 数字右对齐 + 等宽, 一眼能比大小 */
.sdb-ano-mult {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    color: #b96a00;
    text-align: right;
}
/* 2026-09-29 台阶表已不再显示 genres 副行, 原 `.sdb-ano-breakout td:nth-child(3)`
   允许游戏名换行的规则随之失去依据, 删掉 —— 台阶表与跃变表的游戏名一律 nowrap。 */
/* 表标题 + 条数徽标 (2026-09-29 布局修复: 统计文字从筛选控件行挪到这里)
   原先「检出 N 款 / M 条」那段长文字与三个 label+下拉抢同一行, 把最后一个下拉挤到第二行 */
.sdb-ano-section {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-top: 26px;
}
.sdb-ano-section-title {
    font-size: 1.15rem;
    margin: 0;
}
.sdb-ano-section-count {
    color: var(--text-muted, #8a93a0);
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}
/* 上升/下降子视图切换条 (2026-09-29): 复用 chip 视觉, 当前项高亮 */
.sdb-ano-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 10px 0 2px;
}
.sdb-ano-tab {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    padding: 5px 14px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 999px;
    background: var(--bg-secondary, #f8f9fa);
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--text-color, #1a1a2e);
}
.sdb-ano-tab:hover { border-color: var(--text-muted, #8a93a0); }
.sdb-ano-tab.sdb-ano-tab-active {
    border-color: transparent;
    font-weight: 700;
}
.sdb-ano-tab.sdb-ano-tab-active.rise {
    background: rgba(27, 127, 59, 0.12);
    color: #1b7f3b;
}
.sdb-ano-tab.sdb-ano-tab-active.drop {
    background: rgba(198, 48, 46, 0.12);
    color: #c6302e;
}
.sdb-ano-tab .sdb-ano-tab-count {
    font-variant-numeric: tabular-nums;
    font-weight: 400;
    font-size: 0.78rem;
    color: var(--text-muted, #8a93a0);
}
/* 幅度列: 归一化超阈倍数, 右对齐等宽; 颜色仍由 sdb-ano-sev-N 按档位给 */
.sdb-ano-mag {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
}
/* 窄屏: 五列表格必然横向溢出, 交给外层滚动而不是裁掉后两列 */
@media (max-width: 640px) {
    .sdb-ano-table { font-size: 0.8rem; }
}
/* 指标名列: 宽表横向滚动时保持可见, 否则滑到第 3 列就不知道这行是什么指标 */
.sdb-cmp-metric {
    position: sticky;
    left: 0;
    z-index: 1;
    background: var(--board-bg-color, #fafafa);
    white-space: nowrap;
}
.sdb-cmp-head {
    vertical-align: bottom;
    min-width: 150px;
}
.sdb-cmp-head img {
    width: 100%;
    max-width: 230px;
    border-radius: 6px;
    display: block;
    margin-bottom: 6px;
}
.sdb-cmp-head-name {
    display: block;
    font-size: 0.9rem;
    text-transform: none;
    letter-spacing: 0;
    color: var(--text-color, #1a1a2e);
}
.sdb-cmp-head-remove {
    margin-top: 4px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    background: none;
    color: var(--text-muted, #8a93a0);
    font-size: 0.72rem;
    cursor: pointer;
    padding: 1px 6px;
}
.sdb-cmp-head-remove:hover { color: #c6302e; border-color: #c6302e; }
/* 本行最优值 (仅热度 / 留存 / 好评率 / 现价四行, 口径见前端 cmpBest) */
.sdb-cmp-best {
    font-weight: 700;
    color: #5ca732;
}
.sdb-cmp-num {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}
.sdb-cmp-note {
    font-size: 0.78rem;
    color: var(--text-muted, #8a93a0);
    margin-top: 2px;
}

/* ---------- 站点导航条 (独立页顶部, 忠实渲染 Halo 主菜单, 令牌驱动明暗自适应) ---------- */
.steamdb-sitebar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--board-bg-color, #ffffff);
    border-bottom: 1px solid var(--line-color, #e0e0e0);
}
.steamdb-sitebar-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 56px;
}
.steamdb-sitebar-brand {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--text-color, #1a1a2e);
    text-decoration: none;
    white-space: nowrap;
    padding: 8px 0;
}
.steamdb-sitebar-brand:hover {
    color: var(--post-link-color, #1b2838);
}
.steamdb-nav-toggle {
    display: none;
}
.steamdb-nav-toggle-btn {
    display: none;
    cursor: pointer;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 10px 8px;
}
.steamdb-nav-toggle-btn span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-color, #1a1a2e);
    border-radius: 2px;
}
.steamdb-sitebar-menu {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
}
.steamdb-sitebar-item {
    position: relative;
}
.steamdb-sitebar-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 18px 12px;
    color: var(--text-color, #1a1a2e);
    text-decoration: none;
    font-size: 0.95rem;
    white-space: nowrap;
}
.steamdb-sitebar-link:hover {
    color: var(--post-link-color, #1b2838);
    background: var(--steamdb-surface, #f8f9fa);
}
.steamdb-sitebar-caret {
    font-size: 0.7em;
    opacity: 0.7;
}
.steamdb-sitebar-sub {
    list-style: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 168px;
    margin: 0;
    padding: 6px 0;
    background: var(--board-bg-color, #ffffff);
    border: 1px solid var(--line-color, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: none;
}
.steamdb-sitebar-item.has-sub:hover > .steamdb-sitebar-sub,
.steamdb-sitebar-item.has-sub:focus-within > .steamdb-sitebar-sub {
    display: block;
}
.steamdb-sitebar-subitem a {
    display: block;
    padding: 9px 16px;
    color: var(--text-color, #1a1a2e);
    text-decoration: none;
    white-space: nowrap;
}
.steamdb-sitebar-subitem a:hover {
    background: var(--steamdb-surface, #f8f9fa);
    color: var(--post-link-color, #1b2838);
}

/* ---------- 站内导航条 ---------- */
.steamdb-sitenav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    font-size: 0.85rem;
    padding: 8px 0 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--steamdb-border, rgba(0, 0, 0, 0.08));
    color: var(--text-muted, #6a6a7a);
}
.steamdb-sitenav-link {
    color: var(--primary-color, #1a73e8);
    text-decoration: none;
    padding: 2px 4px;
    border-radius: 4px;
}
.steamdb-sitenav-link:hover {
    text-decoration: underline;
    background: var(--steamdb-surface, rgba(0, 0, 0, 0.04));
}
.steamdb-sitenav-active {
    color: var(--text-color, #1a1a2e);
    font-weight: 600;
    padding: 2px 4px;
}

/* ---------- 独立兜底页 (无主题壳时自带页面级底色/字体, 明暗自适应) ---------- */
body.steamdb-standalone {
    margin: 0;
    min-height: 100vh;
    background: var(--body-bg-color, var(--background-color, #f5f6f8));
    color: var(--text-color, var(--text-primary, #1a1a2e));
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Roboto, sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}
/* 浅色令牌 (仅作用域于独立页, 显式固化, 不依赖主题; --primary-color/--theme-color
   兼作深色底+白字, 故此处不重定义, 避免破坏按钮/图表底色的对比度)。 */
body.steamdb-standalone {
    --background-color: #f5f6f8;
    --body-bg-color: #f5f6f8;
    --board-bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --bg-secondary: #f0f2f5;
    --steamdb-surface: #f8f9fa;
    --line-color: #e0e0e0;
    --border-color: #e0e0e0;
    --steamdb-border: #e0e0e0;
    --text-color: #1a1a2e;
    --text-primary: #1a1a2e;
    --sec-text-color: #666;
    --text-secondary: #666;
    --text-muted: #8a93a0;
    --post-link-color: #1b2838;
}
@media (prefers-color-scheme: dark) {
    /* 令牌驱动转暗: 深色偏好下重定义中性+链接令牌, 令全站 var(--x, 浅色回退) 一次性转暗,
       修复逐个选择器浅色系回退 (如 .steamdb-page-title #1a1a2e) 深字压深底不可见的问题。 */
    body.steamdb-standalone {
        --background-color: #12141a;
        --body-bg-color: #12141a;
        --board-bg-color: #1c202a;
        --card-bg: #1c202a;
        --bg-secondary: #232833;
        --steamdb-surface: #1c202a;
        --line-color: #2b303b;
        --border-color: #2b303b;
        --steamdb-border: #2b303b;
        --text-color: #e6e8ee;
        --text-primary: #e6e8ee;
        --sec-text-color: #a8afbd;
        --text-secondary: #a8afbd;
        --text-muted: #8b93a3;
        --post-link-color: #66c0f4;
        background: var(--body-bg-color);
        color: var(--text-color);
    }
    body.steamdb-standalone .steamdb-card,
    body.steamdb-standalone .steamdb-panel {
        background: var(--board-bg-color);
        border-color: var(--line-color);
        color: var(--text-color);
    }
    body.steamdb-standalone .steamdb-btn {
        background: var(--board-bg-color);
        color: var(--text-color);
    }
}

/* ---------- 响应式 ---------- */
@media (max-width: 768px) {
    .steamdb-container { padding: 16px 12px; }
    .steamdb-toolbar { flex-direction: column; align-items: stretch; }
    .steamdb-skeleton-grid { grid-template-columns: 1fr; }
    .steamdb-genre-actions { flex-direction: column; align-items: stretch; }
    /* 对标页控件竖排; 指标名列缩窄, 表格靠 .steamdb-table-wrap 横向滚动 (不裁剪) */
    .sdb-cmp-controls { flex-direction: column; align-items: stretch; }
    .sdb-cmp-input { min-width: 0; }
    /* 站点导航: 小屏折叠为汉堡, 菜单竖排; 子菜单内联常显 (无 hover) */
    .steamdb-nav-toggle-btn { display: flex; }
    .steamdb-sitebar-menu { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding-bottom: 8px; }
    .steamdb-nav-toggle:checked ~ .steamdb-sitebar-menu { display: flex; }
    .steamdb-sitebar-link { padding: 12px 4px; }
    .steamdb-sitebar-item.has-sub:hover > .steamdb-sitebar-sub { display: none; }
    .steamdb-sitebar-sub { position: static; display: block; box-shadow: none; border: none; border-left: 2px solid var(--line-color, #e0e0e0); border-radius: 0; margin: 0 0 6px 14px; padding: 0; min-width: 0; }
    .steamdb-sitebar-subitem a { padding: 8px 10px; white-space: normal; }
}