/* TBF Phone Mask */
.tbf-phone {
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-variant-numeric: tabular-nums;
}
.tbf-phone-masked {
    color: #999 !important;
    letter-spacing: 0.05em;
    cursor: pointer;
    position: relative;
    border-bottom: 1px dashed #cbd5e0;
    padding-bottom: 1px;
    transition: color 0.15s;
}
.tbf-phone-masked:hover { color: #4a5568 !important; border-bottom-color: #4a5568; }
.tbf-phone-masked::after { content: "🔒 登录后可见"; position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); background: #1a202c; color: #fff; font-size: 12px; padding: 4px 10px; border-radius: 4px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity 0.15s; z-index: 999; font-weight: normal; letter-spacing: 0; }
.tbf-phone-masked:hover::after { opacity: 1; }
.tbf-phone-hint { display: inline-block; margin-left: 6px; font-size: 12px; color: #3182ce; }
.tbf-phone-hint a { color: #3182ce; text-decoration: none; border-bottom: 1px solid currentColor; }
.tbf-phone-hint a:hover { color: #2c5282; }
.tbf-phone-member { color: inherit; font-weight: 600; }

/* ============================================================
   View Count Toast + Top Widget — Mobile + Desktop 适配
   ============================================================ */

/* 共同样式 (mobile + desktop) */
.tbf-view-count,
.tbf-top-viewed-float {
    position: fixed !important;
    z-index: 9999;
    background: rgba(26, 32, 44, 0.92) !important;
    color: #fff !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.tbf-view-count {
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 13px;
    bottom: 24px;
    right: 24px;
    letter-spacing: 0.5px;
}
.tbf-top-viewed-float {
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    bottom: 24px;
    left: 24px;
    right: auto;
    max-width: 280px;
    width: 280px;
    max-height: 320px;
    overflow-y: auto;
}
.tbf-top-viewed-float .tbf-top-viewed h3 {
    margin: 0 0 8px 0 !important;
    font-size: 14px;
    font-weight: 600;
}
.tbf-top-viewed-float .tbf-top-viewed ol {
    margin: 0;
    padding-left: 20px;
}
.tbf-top-viewed-float .tbf-top-viewed ol li {
    margin: 6px 0;
    line-height: 1.5;
    font-size: 13px;
}
.tbf-top-viewed-float .tbf-top-viewed ol li a {
    color: inherit;
    text-decoration: none;
    transition: color 0.15s;
}
.tbf-top-viewed-float .tbf-top-viewed ol li a:hover { color: #63b3ed; }
.tbf-top-viewed-float .tbf-top-viewed ol li .views {
    color: #94a3b8;
    font-size: 11px;
    margin-left: 6px;
}

/* ===== 移动端 (max-width: 768px) ===== */
@media (max-width: 768px) {
    /* Toast: 紧凑 + 移到顶部 */
    .tbf-view-count {
        bottom: auto !important;
        top: 70px !important;
        right: 12px !important;
        padding: 6px 12px !important;
        font-size: 12px !important;
        border-radius: 16px !important;
        z-index: 9999;
    }
    /* Widget: 全宽底部 + 紧凑两列 */
    .tbf-top-viewed-float {
        bottom: 12px !important;
        left: 12px !important;
        right: 12px !important;
        max-width: none !important;
        width: auto !important;
        padding: 10px 14px !important;
        font-size: 13px !important;
        border-radius: 10px !important;
        max-height: 200px !important;
    }
    .tbf-top-viewed-float .tbf-top-viewed h3 {
        font-size: 13px !important;
        margin: 0 0 6px 0 !important;
    }
    .tbf-top-viewed-float .tbf-top-viewed ol {
        padding-left: 18px !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 4px 12px !important;
    }
    .tbf-top-viewed-float .tbf-top-viewed ol li {
        margin: 0 !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    .tbf-top-viewed-float .tbf-top-viewed ol li .views {
        display: block !important;
        font-size: 10px !important;
        margin-left: 0 !important;
    }
}

/* ===== 极小屏 (max-width: 380px) — widget 自动收起 ===== */
@media (max-width: 380px) {
    .tbf-top-viewed-float {
        top: 56px !important;
        bottom: auto !important;
        max-height: 44px !important;
        overflow: hidden !important;
        padding: 8px 12px !important;
        transition: max-height 0.3s ease;
    }
    .tbf-top-viewed-float.expanded {
        max-height: 240px !important;
        overflow-y: auto !important;
    }
    .tbf-top-viewed-float.expanded .tbf-top-viewed ol {
        grid-template-columns: 1fr !important;
    }
    .tbf-top-viewed-toggle {
        display: inline-block !important;
        float: right;
        cursor: pointer !important;
        color: #94a3b8 !important;
        font-size: 11px !important;
        text-decoration: underline !important;
        margin-left: 8px !important;
        user-select: none;
    }
}

/* ===== 桌面 (min-width: 769px) 恢复原样式 ===== */
@media (min-width: 769px) {
    .tbf-view-count {
        bottom: 24px !important;
        top: auto !important;
        right: 24px !important;
        padding: 8px 16px !important;
        font-size: 13px !important;
    }
    .tbf-top-viewed-float {
        bottom: 24px !important;
        top: auto !important;
        left: 24px !important;
        right: auto !important;
        max-width: 280px !important;
        width: 280px !important;
        padding: 14px 16px !important;
        max-height: 320px !important;
    }
    .tbf-top-viewed-float .tbf-top-viewed ol {
        display: block !important;
        grid-template-columns: none !important;
    }
    .tbf-top-viewed-toggle { display: none !important; }
}

/* ===== 暗色 / 浅色 自适应 — 浅色背景上文字变暗 ===== */
@media (prefers-color-scheme: light) {
    .tbf-view-count,
    .tbf-top-viewed-float {
        background: rgba(255, 255, 255, 0.94) !important;
        color: #2d3748 !important;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    }
    .tbf-top-viewed-float .tbf-top-viewed ol li a { color: #2d3748; }
    .tbf-top-viewed-float .tbf-top-viewed ol li .views { color: #a0aec0; }
}

/* ===== 超大屏 (min-width: 1400px) — 不拥挤 ===== */
@media (min-width: 1400px) {
    .tbf-top-viewed-float {
        max-width: 320px !important;
        width: 320px !important;
    }
}
