/* ===== 抖音数据监控大屏 — 简洁高端主题 ===== */
:root {
    /* 底色 — 纯白 + 轻柔灰 */
    --bg-body: #f5f6f8;
    --bg-card: #ffffff;
    --bg-card-hover: #f8f9fb;
    --bg-header: #ffffff;
    --bg-input: #f0f1f3;
    --border: #e8eaed;
    --border-hover: #d0d4da;
    --border-active: #1a73e8;

    /* 主色 — 沉稳蓝 */
    --accent: #1a73e8;
    --accent-dim: #5a9cf3;

    /* 辅助色 */
    --patina: #0891b2;

    /* 语义色 */
    --green: #0f973d;
    --red: #d92d2d;

    /* 文本层级 — 清晰灰度 */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --text-faint: #d1d5db;

    --radius: 10px;
    --radius-sm: 6px;

    /* z-index */
    --z-header: 100;
    --z-sticky: 50;
    --z-overlay: 200;
    --z-modal: 300;

    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,.05);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%; height: 100%; overflow: hidden;
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #262f3d; border-radius: 2px; }

/* ===== 顶栏 ===== */
.header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 32px; height: 56px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}
.header-left { display: flex; align-items: center; gap: 12px; }
.header-left h1 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-primary); }
.header-left .sub { font-size: 12px; color: var(--text-muted); }
.header-right {
    display: flex; align-items: center; gap: 16px;
    font-size: 12px; color: var(--text-secondary);
}
.dot {
    display: inline-block; width: 6px; height: 6px; border-radius: 50%;
    background: var(--green); margin-right: 4px;
    box-shadow: 0 0 8px rgba(52,211,153,0.35);
    animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.35} }

/* Impeccable: reduced-motion不可省略 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 容器 ===== */
.container {
    height: calc(100vh - 56px); overflow-y: auto; padding: 0 32px 24px;
}

/* ===== 固定页头 ===== */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
    position: sticky; top: 0; left: 0; right: 0;
    z-index: 100;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 10px 14px;
    box-shadow: var(--shadow-sm);
}
.page-header h2 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; color: var(--text-primary); }
.page-header .hint { font-size: 12px; color: var(--text-muted); }

.back-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 16px; border-radius: var(--radius-sm);
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-secondary); font-size: 12px; cursor: pointer;
    transition: background .2s, border-color .2s, color .2s;
    line-height: 1;
}
.back-btn:hover { background: var(--bg-card-hover); border-color: var(--accent); color: var(--accent); }
.back-btn:active { transform: scale(0.97); }

/* ===== Top 5 ===== */
.sec-hd {
    display: flex; align-items: center; gap: 8px;
    margin: 28px 0 14px;
}
.sec-hd .t { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; color: var(--text-primary); }
.sec-hd .c { font-size: 11px; color: var(--text-muted); margin-left: auto; }

.top5-grid {
    display: grid; grid-template-columns: repeat(5, 1fr);
    gap: 10px; margin-bottom: 24px;
}
.top5-card {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    overflow: hidden;
    cursor: pointer;
    transition: border-color .25s, transform .25s;
}
.top5-card:hover {
    border-color: var(--border-active);
    transform: translateY(-2px);
}

.t5-cover {
    position: relative; width: 100%;
    aspect-ratio: 1/1;
    background: var(--bg-card);
    overflow: hidden;
}
.t5-cover img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .35s ease;
}
.top5-card:hover .t5-cover img { transform: scale(1.05); }
.t5-rank {
    position: absolute; top: 6px; left: 6px;
    width: 22px; height: 22px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 800;
    box-shadow: 0 2px 6px rgba(0,0,0,.4);
}
.r1 { background: #f59e0b; color: #fff; }
.r2 { background: #94a3b8; color: #fff; }
.r3 { background: #b45309; color: #fff; }
.rx { background: var(--text-muted); color: #fff; }

.t5-body { padding: 8px 10px; }
.t5-body .a { font-size: 10px; color: var(--accent); font-weight: 600; }
.t5-body .t {
    font-size: 11px; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin: 3px 0 4px;
}
.t5-stats { display: flex; gap: 8px; }
.t5-stats span { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.t5-stats .lk { color: var(--accent); font-weight: 600; }

/* ===== 详情头部 ===== */
.detail-hd {
    display: flex; align-items: center; gap: 18px;
    padding: 18px 20px; border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}
.detail-hd .av {
    width: 48px; height: 48px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; color: #fff;
    flex-shrink: 0;
}
.av0 { background: linear-gradient(135deg,#1a73e8,#4a9cf3); }
.av1 { background: linear-gradient(135deg,#0891b2,#06b6d4); }
.av2 { background: linear-gradient(135deg,#7c3aed,#a78bfa); }

.detail-hd .di { flex: 1; }
.detail-hd .di .nm { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.detail-hd .di .ds { display: flex; gap: 20px; flex-wrap: wrap; }
.detail-hd .di .ds .d { text-align: center; }
.detail-hd .di .ds .d .v { font-size: 15px; font-weight: 600; color: var(--text-primary); }
.detail-hd .di .ds .d .l { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.detail-hd .di .ds .d .g { font-size: 11px; font-weight: 500; }
.detail-hd .di .ds .d .g.up { color: var(--green); }
.detail-hd .di .ds .d .g.dn { color: var(--red); }

.detail-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.fluc-hint { font-size: 11px; margin-left: 12px; color: var(--text-muted); }
.fluc-dot { font-weight: 600; }
.fluc-dot.up { color: var(--green); }
.fluc-dot.dn { color: var(--red); }

/* ===== 视频网格 ===== */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}
.video-card {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-card);
    overflow: hidden;
    transition: box-shadow .25s, transform .25s;
    box-shadow: var(--shadow-sm);
}
.video-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.vc-cover {
    position: relative; width: 100%;
    aspect-ratio: 4/5;
    background: var(--bg-input);
    overflow: hidden;
    cursor: pointer;
}
.vc-cover img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform .3s ease;
}
.video-card:hover .vc-cover img { transform: scale(1.04); }

.vc-cover .play-hint {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
    width: 28px; height: 28px; border-radius: 50%;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; opacity: 0; transition: opacity .25s;
}
.video-card:hover .play-hint { opacity: 1; }

.vc-cover .likes-bdg {
    position: absolute; bottom: 6px; right: 6px;
    background: rgba(0,0,0,.6);
    color: #fcd34d; padding: 2px 7px; border-radius: 4px;
    font-size: 10px; font-weight: 600; z-index: 1;
    backdrop-filter: blur(3px);
}
.vc-cover .pin-bdg {
    position: absolute; top: 5px; left: 5px;
    background: var(--red); color: #fff;
    font-size: 8px; font-weight: 700; padding: 1px 5px;
    border-radius: 3px; z-index: 1;
}

.placeholder-img {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--text-faint);
    background: var(--bg-input);
}

/* ===== 视频信息行 ===== */
.vc-body { padding: 6px 8px; }
.vc-body .vc-title {
    font-size: 11px; color: var(--text-secondary);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    margin-bottom: 4px;
}
.vc-body .vc-row {
    display: flex; align-items: center; gap: 6px;
}
.vc-body .vc-row .m {
    font-size: 10px; color: var(--text-muted);
    white-space: nowrap;
}
.vc-body .vc-row .m.mlk { color: var(--accent); font-weight: 600; }

/* ===== 剪辑人展示 ===== */
.vc-body .vc-row .edt-name {
    margin-left: auto;
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== 封面获赞波动角标 ===== */
.vc-cover .fluc-bdg {
    position: absolute; top: 6px; right: 6px;
    font-size: 9px; font-weight: 700;
    padding: 2px 6px; border-radius: 4px;
    z-index: 2;
    backdrop-filter: blur(2px);
    pointer-events: none;
}
.vc-cover .fluc-bdg.up {
    background: rgba(63,185,80,.18);
    color: var(--green);
    border: 1px solid rgba(63,185,80,.3);
}
.vc-cover .fluc-bdg.dn {
    background: rgba(248,81,73,.18);
    color: var(--red);
    border: 1px solid rgba(248,81,73,.3);
}

/* ===== 加载状态 ===== */
.loading-state {
    display: flex; align-items: center; justify-content: center;
    height: 200px; color: var(--text-muted); font-size: 13px;
    flex-direction: column; gap: 10px;
}
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== 空状态 & 错误 ===== */
.empty-state {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 140px; color: var(--text-muted); gap: 6px;
}
.empty-state .ic { font-size: 24px; opacity: .3; }
.empty-state .t { font-size: 13px; }

.error-screen {
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; height: 100vh; background: var(--bg-body);
}
.error-screen .ic { font-size: 36px; margin-bottom: 8px; opacity: .4; }
.error-screen .msg { font-size: 15px; color: var(--red); }
.error-screen .dt { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.error-screen .retry {
    margin-top: 14px; padding: 8px 22px;
    background: var(--bg-card); border: 1px solid var(--border);
    color: var(--text-primary); border-radius: var(--radius-sm);
    font-size: 13px; cursor: pointer;
    transition: border-color .2s;
}
.error-screen .retry:hover { border-color: var(--border-active); }
.error-screen .retry:active { transform: scale(0.97); }

/* ===== 响应式 ===== */
@media (max-width: 1100px) {
    .top5-grid { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 700px) {
    .top5-grid { grid-template-columns: 1fr; }
    .video-grid { grid-template-columns: repeat(2,1fr); }
    .container { padding: 14px; }
}

/* ===== 刷新按钮 ===== */
.refresh-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 6px 16px; border-radius: 20px;
    background: var(--accent); border: none;
    color: #fff; font-size: 12px; font-weight: 500;
    cursor: pointer; transition: opacity .2s, transform .15s;
    line-height: 1;
}
.refresh-btn:hover:not(:disabled) {
    opacity: .85;
}
.refresh-btn:active:not(:disabled) { transform: scale(0.97); }
.refresh-btn:disabled { opacity: .5; cursor: not-allowed; }
.refresh-btn.running { background: var(--patina); }
.btn-icon { display: inline-block; }
.refresh-btn.running .btn-icon { animation: spin .8s linear infinite; }
.sep { color: var(--text-faint); }

/* ===== 更新提示 Toast ===== */
.update-toast {
    position: fixed; top: 62px; left: 50%; transform: translateX(-50%);
    padding: 8px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; z-index: 1000;
    background: rgba(17,20,24,.92);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    display: flex; align-items: center; gap: 10px;
    animation: toast-in .3s ease;
    color: var(--text-primary);
}
.update-toast.success { border-color: var(--green); }
.update-toast.error { border-color: var(--red); color: var(--red); }
.toast-close {
    background: none; border: none; color: var(--text-muted);
    font-size: 16px; cursor: pointer; padding: 0 2px; line-height: 1;
}
.toast-close:hover { color: var(--text-primary); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* ===== Live 点脉冲 ===== */
.dot.live { animation: pulse 2s infinite; }
.dot.pulse { animation: pulse .6s infinite; box-shadow: 0 0 12px rgba(212,167,44,0.5); }

/* ===== 视频获赞波动角标 ===== */
.glast { font-size: 10px; opacity: .8; }
.glast::before { content: '·'; margin: 0 3px; opacity: .5; }

/* ===== 更新时间 ===== */
.update-time { color: var(--text-muted); }

/* ===== 头像回退 ===== */
.av-fallback-s {
    display: inline-flex; width: 32px; height: 32px;
    border-radius: 50%; align-items: center; justify-content: center;
    background: var(--border); font-size: 14px; font-weight: 700;
    color: var(--text-secondary); margin-right: 2px;
}

/* ===== 对比表格 ===== */
.table-wrap {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}
.cmp-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.cmp-table thead th {
    padding: 12px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    background: #fafbfc;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    user-select: none;
}
.cmp-table thead th.sortable {
    cursor: pointer;
    transition: color .15s;
}
.cmp-table thead th.sortable:hover { color: var(--accent); }
.cmp-table thead th .sort-asc::after { content: ' ▲'; font-size: 8px; color: var(--accent); }
.cmp-table thead th .sort-desc::after { content: ' ▼'; font-size: 8px; color: var(--accent); }

.cmp-table tbody tr {
    cursor: pointer;
    transition: background .12s;
}
.cmp-table tbody tr:hover { background: var(--bg-card-hover); }
.cmp-table tbody tr:not(:last-child) td { border-bottom: 1px solid #f0f1f3; }
.cmp-table tbody td {
    padding: 12px 14px;
    vertical-align: middle;
}

/* 列宽 */
.col-rank { width: 40px; text-align: center; }
.col-name { min-width: 160px; }
.col-num { min-width: 110px; }

/* 排名 */
.rank-bdg { font-size: 15px; }

/* 账号列 */
.tbl-acc { display: flex; align-items: center; gap: 8px; }
.tbl-av { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.tbl-nick { font-weight: 500; color: var(--text-primary); }

/* 数字列 */
.tv { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.tg { font-size: 10px; font-weight: 600; margin-top: 1px; }
.tg.up { color: var(--green); }
.tg.dn { color: var(--red); }

/* 表格底部 */
.table-footer {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex; gap: 8px;
}
.table-footer .sep { color: var(--border); }
