    :root {
      --bg: #f8fafc;
      --panel: #ffffff;
      --text: #1e293b;
      --muted: #64748b;
      --primary: #1e293b;
      --line: #e2e8f0;
      --gold: #f59e0b;
      --silver: #94a3b8;
      --bronze: #b45309;
    }
    body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }
    
    .rank-container { width: min(1000px, calc(100% - 32px)); margin: 24px auto; }
    
    .rank-header { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 20px; }
    .rank-header-text { text-align: left; }
    .rank-header h1 { font-size: 24px; font-weight: 900; margin: 0 0 4px 0; background: linear-gradient(135deg, #1e293b, #3b82f6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
    .rank-header p { color: var(--muted); font-size: 13px; margin: 0; }

    /* Tab 导航优化：合并到 Header 同行或紧凑排列 */
    .rank-nav-group { display: flex; flex-direction: column; gap: 16px; margin-bottom: 24px; }
    .rank-tabs { display: flex; gap: 8px; flex-wrap: wrap; background: rgba(148, 163, 184, 0.05); padding: 6px; border-radius: 16px; width: fit-content; }
    .rank-tab { padding: 8px 20px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 800; font-size: 13px; transition: all 0.2s; border: none; }
    .rank-tab:hover { color: var(--primary); background: var(--primary-a12); }
    .rank-tab.active { background: color-mix(in srgb, var(--primary) 85%, #0f172a); color: #fff; box-shadow: 0 4px 12px var(--primary-a2); }
    /* 取消了图片的强制反色滤镜，以支持带底色的彩色 SVG 原样显示 */

    /* 子 Tab 优化：更精致小巧 */
    .rank-subtabs { display: flex; gap: 6px; }
    .rank-subtab { padding: 4px 14px; border-radius: 8px; background: transparent; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 700; transition: all 0.2s; border: 1px solid var(--line); }
    .rank-subtab:hover { border-color: var(--primary); color: var(--primary); }
    .rank-subtab.active { background: var(--primary); color: #fff; border-color: var(--primary); }

    /* 列表卡片 */
    .rank-card { background: var(--panel); border-radius: 24px; border: 1px solid var(--line); overflow: hidden; box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05); }
    .rank-table { width: 100%; border-collapse: collapse; }
    .rank-table th { text-align: left; padding: 20px 24px; font-size: 13px; font-weight: 700; color: var(--muted); border-bottom: 1px solid var(--line); background: rgba(148, 163, 184, 0.02); white-space: nowrap; }
    .rank-table td { padding: 16px 24px; border-bottom: 1px solid var(--line); vertical-align: middle; }
    .rank-table tr:last-child td { border-bottom: none; }

    /* 悬浮按钮组样式 */
    .floating-actions {
        position: fixed;
        bottom: max(24px, env(safe-area-inset-bottom));
        right: max(24px, calc(50% - 620px)); /* 继续向右移，留出足够的呼吸感 */
        display: flex;
        flex-direction: column;
        background: var(--panel);
        border-radius: 12px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
        border: 1px solid var(--line);
        overflow: hidden;
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transform: translateY(20px);
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        backdrop-filter: blur(8px);
    }
    .floating-actions.is-visible {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    .float-btn {
        width: 44px;
        height: 44px;
        background: transparent;
        border: none;
        color: var(--muted);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }
    .float-btn:hover {
        color: var(--primary);
        background: rgba(148, 163, 184, 0.1);
    }
    .float-btn:first-child {
        border-bottom: 1px solid var(--line);
    }
    html[data-theme="dark"] .floating-actions {
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }
    @media (max-width: 768px) {
        .floating-actions {
            bottom: max(20px, env(safe-area-inset-bottom));
            right: max(20px, env(safe-area-inset-right));
        }
    }
    .rank-table tr:hover { background: rgba(30, 41, 59, 0.02); }

    /* 名次样式 */
    .num-box { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 14px; color: var(--muted); background: #f1f5f9; }
    /* 前三名改用勋章图标 */
    .rank-medal { width: 42px; height: 42px; display: block; object-fit: contain; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.25)); }

    /* 用户信息 */
    .user-info { display: flex; align-items: center; gap: 12px; }
    .user-avatar { width: 40px; height: 40px; border-radius: 12px; object-fit: cover; border: 1px solid var(--line); }
    .user-name { font-weight: 700; color: var(--text); text-decoration: none; transition: color 0.2s; }
    .user-name:hover { color: var(--primary); }
    
    /* 数值样式 */
    .rank-val { font-weight: 900; color: var(--primary); font-size: 16px; }
    .rank-val-small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 4px; }

    /* 等级/经验值切换（手机端）：等级列内嵌切换按钮 */
    .rank-col-toggle {
        display: none;
        width: 24px; height: 24px;
        border: 1px solid var(--line);
        border-radius: 7px;
        background: transparent;
        color: var(--muted);
        font-size: 13px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        margin-left: 6px;
        padding: 0;
        vertical-align: middle;
        transition: all 0.2s;
    }
    .rank-col-toggle:hover { color: var(--primary); border-color: var(--primary); }
    .rank-col-level-cell .rank-col-exp,
    .rank-col-level-head .rank-col-exp { display: none; }

    /* 签到榜 经验/星星 合并列切换（所有端生效，减少列数防止溢出） */
    .rank-checkin-col-cell .rank-checkin-col-zcoin,
    .rank-checkin-col-head .rank-checkin-col-zcoin { display: none; }
    .rank-checkin-col-head .rank-col-toggle { display: inline-flex; }
    .rank-checkin-col-head { white-space: nowrap; }
    body.rank-checkin-mode-zcoin .rank-checkin-col-cell .rank-checkin-col-exp,
    body.rank-checkin-mode-zcoin .rank-checkin-col-head .rank-checkin-col-exp { display: none; }
    body.rank-checkin-mode-zcoin .rank-checkin-col-cell .rank-checkin-col-zcoin,
    body.rank-checkin-mode-zcoin .rank-checkin-col-head .rank-checkin-col-zcoin { display: inline; }

    /* 手机端适配：紧凑显示全部列，不再隐藏第三列 */
    @media (max-width: 600px) {
        .rank-container { margin: 16px auto; }
        .rank-header { margin-bottom: 10px; padding-bottom: 12px; gap: 10px; flex-wrap: wrap; }
        .rank-header h1 { font-size: 20px; }
        .rank-header p { font-size: 12px; }
        /* 主 Tab 单行横向滚动，减少高度占用 */
        .rank-nav-group { gap: 8px; margin-bottom: 12px; }
        .rank-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; padding: 4px; border-radius: 12px; gap: 4px; width: 100%; }
        .rank-tabs::-webkit-scrollbar { display: none; }
        .rank-tab { padding: 5px 12px; border-radius: 10px; font-size: 12px; flex-shrink: 0; }
        .rank-tab img { width: 15px !important; height: 15px !important; }
        .rank-tab span[style*="font-size:18px"] { font-size: 14px !important; }
        /* 右侧渐变 + 箭头：提示还有更多榜单可滑动 */
        .rank-nav-group { position: relative; }
        .rank-nav-group::after {
            content: '»';
            position: absolute;
            right: 0;
            top: 4px;
            bottom: 4px;
            width: 36px;
            display: flex;
            align-items: center;
            justify-content: flex-end;
            padding-right: 8px;
            font-size: 15px;
            font-weight: 900;
            color: var(--muted);
            background: linear-gradient(to left, var(--bg) 45%, transparent);
            pointer-events: none;
            border-radius: 0 12px 12px 0;
            z-index: 2;
        }
        /* 子 Tab 更紧凑 */
        .rank-subtabs { gap: 4px; }
        .rank-subtab { padding: 3px 10px; border-radius: 8px; font-size: 11px; }
        .rank-table th { padding: 12px 8px; font-size: 12px; }
        .rank-table td { padding: 10px 8px; }
        .user-info { gap: 8px; min-width: 0; }
        .user-avatar { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; }
        .user-name { font-size: 13px; max-width: 8em; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
        .num-box { width: 26px; height: 26px; border-radius: 8px; font-size: 12px; }
        .rank-medal { width: 34px; height: 34px; }
        .rank-val { font-size: 14px; white-space: nowrap; }
        .rank-val-small { font-size: 11px; }
        /* 手机端：隐藏独立经验值列，等级列内通过 ⇄ 切换显示 等级/经验值 */
        .rank-col-exp-head, .rank-col-exp-cell { display: none; }
        .rank-col-toggle { display: inline-flex; }
        body.rank-mode-exp .rank-col-level-cell .rank-col-level,
        body.rank-mode-exp .rank-col-level-head .rank-col-level { display: none; }
        body.rank-mode-exp .rank-col-level-cell .rank-col-exp,
        body.rank-mode-exp .rank-col-level-head .rank-col-exp { display: inline; }
    }

    body[data-theme="dark"] { --bg: #0f172a; --panel: #1e293b; --text: #f1f5f9; --muted: #94a3b8; --line: #334155; }
    body[data-theme="dark"] .num-box { background: #0f172a; }
    body[data-theme="dark"] .rank-tab.active {
        background: linear-gradient(135deg, #779985 0%, #059669 100%);
        color: #fff;
        box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
    }
    body[data-theme="dark"] .rank-tab:hover:not(.active) {
        color: #8cae9a;
        background: rgba(119, 153, 133, 0.14);
    }
    body[data-theme="dark"] .rank-subtab.active {
        background: linear-gradient(135deg, #779985 0%, #059669 100%);
        color: #fff;
        border-color: transparent;
    }
    body[data-theme="dark"] .rank-subtab:hover:not(.active) {
        border-color: #8cae9a;
        color: #8cae9a;
        background: rgba(119, 153, 133, 0.12);
    }
    body[data-theme="dark"] .rank-table tr:hover { background: rgba(255,255,255,0.02); }
