/* ============================================
   子比主题 - 更新历史弹窗版
   ============================================ */

/* ===== CSS 变量（便于主题定制） ===== */
:root {
    --zib-primary: #667eea;
    --zib-primary-hover: #5a6fd6;
    --zib-primary-light: #eef2ff;
    --zib-danger: #ef4444;
    --zib-success: #22c55e;
    --zib-warning: #f59e0b;
    --zib-border: #e8ecf0;
    --zib-border-dark: #d0d7de;
    --zib-text: #1e293b;
    --zib-text-secondary: #64748b;
    --zib-text-muted: #94a3b8;
    --zib-bg: #ffffff;
    --zib-bg-hover: #f8f9fa;
    --zib-radius: 12px;
    --zib-radius-sm: 8px;
    --zib-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
}

/* ===== 标题容器 ===== */
.zib-update-log-wrapper {
    margin: 25px 0 20px;
}

/* ===== 简单模式标题 ===== */
.zib-update-log-summary {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--zib-bg);
    border: 1px solid var(--zib-border);
    border-radius: var(--zib-radius);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 14px;
    color: var(--zib-text);
}

.zib-update-log-summary:hover {
    background: var(--zib-bg-hover);
    border-color: var(--zib-border-dark);
}

.zib-update-log-content {
    margin-top: 8px;
}

.zib-update-log-content-inner {
    display: none;
    padding: 12px 16px;
    background: var(--zib-bg);
    border: 1px solid var(--zib-border);
    border-radius: var(--zib-radius);
}

.zib-update-log-wrapper.zib-is-open .zib-update-log-content-inner {
    display: block !important;
}

.zib-log-toggle {
    margin-left: auto;
    font-size: 12px;
    color: var(--zib-text-muted);
    transition: transform 0.3s ease;
}

.zib-update-log-wrapper.zib-is-open .zib-log-toggle {
    transform: rotate(180deg);
}

/* ============================================
   触发按钮
   ============================================ */
.zib-update-log-trigger {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.zib-update-log-trigger .but {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    color: var(--zib-primary);
    background: #f0f3ff;
    border: 1px solid #e0e7ff;
    transition: all 0.2s ease;
    text-decoration: none !important;
}

.zib-update-log-trigger .but:hover {
    background: var(--zib-primary);
    color: #fff;
    border-color: var(--zib-primary);
}

.zib-update-log-trigger .but .icon {
    width: 14px;
    height: 14px;
}

.zib-trigger-count {
    font-weight: 600;
    font-size: 12px;
    background: var(--zib-primary);
    color: #fff;
    border-radius: 50%;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    padding: 0 5px;
    font-size: 10px;
}

.zib-update-log-trigger .but:hover .zib-trigger-count {
    background: #fff;
    color: var(--zib-primary);
}

/* ============================================
   弹窗遮罩
   ============================================ */
.zib-update-log-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 99998;
}

.zib-update-log-overlay.zib-active {
    display: block !important;
}

/* ============================================
   弹窗主体
   ============================================ */
.zib-update-log-modal {
    display: none;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 92%;
    max-width: 640px;
    max-height: 80vh;
    background: var(--zib-bg);
    border-radius: 16px;
    box-shadow: var(--zib-shadow);
    z-index: 99999;
    overflow: hidden;
    transition: all 0.25s ease;
    opacity: 0;
    will-change: transform, opacity;
}

.zib-update-log-modal.zib-active {
    display: block !important;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

/* ===== 弹窗头部 ===== */
.zib-update-log-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafbfc;
    position: sticky;
    top: 0;
    z-index: 5;
}

.zib-update-log-modal-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--zib-text);
}

.zib-update-log-modal-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--zib-text-secondary);
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zib-update-log-modal-close:hover {
    background: #e2e8f0;
    color: var(--zib-text);
}

/* ===== 弹窗内容 - 滚动性能优化 ===== */
.zib-update-log-modal-body {
    padding: 16px 24px 20px;
    max-height: calc(80vh - 70px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    will-change: scroll-position;
    contain: layout style paint;
}

.zib-update-log-modal-body::-webkit-scrollbar {
    width: 3px;
}
.zib-update-log-modal-body::-webkit-scrollbar-track {
    background: transparent;
}
.zib-update-log-modal-body::-webkit-scrollbar-thumb {
    background: var(--zib-border-dark);
    border-radius: 3px;
}

/* ===== 筛选栏 ===== */
.zib-log-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #f0f0f0;
    position: sticky;
    top: 57px;
    z-index: 4;
}

.zib-filter-btn {
    padding: 6px 16px;
    border-radius: 12px;
    border: 1px solid #e8ecf0;
    background: #fff;
    color: #64748b;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 32px;
}

.zib-filter-btn:hover {
    border-color: var(--zib-primary);
    color: var(--zib-primary);
}

.zib-filter-btn.zib-active {
    border-color: var(--zib-primary);
    background: var(--zib-primary);
    color: #fff;
}

/* ============================================
   日志条目 - 渲染性能优化
   ============================================ */
.zib-log-entry {
    display: flex;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid #f5f6f8;
    will-change: transform, opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
    contain: layout style;
}

.zib-log-entry:last-child {
    border-bottom: none;
}

/* ===== 最新版特殊样式 ===== */
.zib-log-entry-latest-item {
    background: #f8fafc;
    border-radius: var(--zib-radius-sm);
    padding: 12px 14px;
    margin: 0 0 8px 0;
    border-bottom: none;
    will-change: transform;
    transform: translateZ(0);
}

.zib-log-entry-latest-item .zib-log-entry-line {
    margin-top: 2px;
    margin-bottom: 2px;
}

.zib-log-entry-latest-item .zib-log-entry-desc {
    color: var(--zib-text);
}

/* ===== 单条记录内部 ===== */
.zib-log-entry-line {
    flex-shrink: 0;
    width: 2px;
    border-left: 2px solid var(--zib-primary);
    border-radius: 2px;
    margin-top: 4px;
    margin-bottom: 4px;
}

.zib-log-entry-content {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.zib-log-entry-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    margin-bottom: 2px;
}

.zib-log-entry-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.zib-log-entry-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ===== 版本号 ===== */
.zib-log-entry-version {
    font-weight: 700;
    font-size: 14px;
    color: var(--zib-text-muted);
    font-family: 'Monaco', 'Menlo', 'Consolas', monospace;
}

/* ===== 类型标签 ===== */
.zib-log-entry-type {
    font-size: 11px;
    font-weight: 500;
    padding: 0 10px;
    border-radius: 12px;
    line-height: 22px;
}

/* ===== 最新标记 ===== */
.zib-log-entry-latest {
    font-size: 11px;
    font-weight: 500;
    color: var(--zib-text-secondary);
    background: #f1f5f9;
    padding: 0 10px;
    border-radius: 12px;
    line-height: 22px;
}

.zib-log-entry-update {
    font-size: 12px;
    color: var(--zib-text-muted);
}

.zib-log-entry-date {
    font-size: 12px;
    color: #c0c8d0;
    flex-shrink: 0;
}

.zib-log-entry-desc {
    font-size: 13px;
    color: var(--zib-text-secondary);
    line-height: 1.6;
    word-break: break-word;
    padding-left: 2px;
    margin-top: 2px;
}

/* ===== 底部 ===== */
.zib-log-footer {
    font-size: 12px;
    color: #c0c8d0;
    padding-top: 12px;
    margin-top: 6px;
    border-top: 1px solid #f5f6f8;
    text-align: center;
}

.zib-log-footer-info {
    margin-left: 8px;
    color: #94a3b8;
    font-size: 11px;
}

/* ============================================
   筛选隐藏 - 使用 opacity 减少重排
   ============================================ */
.zib-filter-hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden !important;
    transition: none !important;
}

/* ============================================
   加载更多
   ============================================ */
.zib-load-more-btn {
    padding: 8px 24px;
    border-radius: 20px;
    border: 1px solid var(--zib-primary);
    background: var(--zib-primary);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.zib-load-more-btn:hover {
    background: var(--zib-primary-hover);
    border-color: var(--zib-primary-hover);
}

.zib-load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.zib-load-more-count {
    font-size: 12px;
    opacity: 0.8;
}

.zib-load-more-spinner {
    padding: 8px 0;
}

.zib-load-more-spinner span:first-child {
    display: inline-block;
    animation: zib-spin 0.8s linear infinite;
}

.zib-load-more-spinner span:last-child {
    font-size: 13px;
    color: #94a3b8;
    margin-left: 8px;
}

.zib-load-more-end {
    padding: 8px 0;
    font-size: 13px;
    color: #94a3b8;
}

/* ===== 重试按钮 ===== */
.zib-retry-btn {
    background: var(--zib-primary);
    color: #fff;
    border: none;
    border-radius: 4px;
    padding: 2px 12px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    transition: background 0.2s;
}

.zib-retry-btn:hover {
    background: var(--zib-primary-hover);
}

/* ===== 新条目动画 ===== */
.zib-log-entry-new {
    animation: zib-fade-in 0.3s ease forwards;
    will-change: transform, opacity;
}

@keyframes zib-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px) translateZ(0);
    }
    to {
        opacity: 1;
        transform: translateY(0) translateZ(0);
    }
}

@keyframes zib-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   移动端
   ============================================ */
@media (max-width: 768px) {
    .zib-update-log-header {
        padding: 10px 14px;
    }

    .zib-header-title {
        font-size: 13px;
    }

    .zib-header-count {
        font-size: 11px;
        padding: 0 8px;
        line-height: 20px;
    }

    .zib-header-latest {
        font-size: 11px;
    }

    .zib-update-log-modal {
        width: 95%;
        max-height: 85vh;
    }

    .zib-update-log-modal-header {
        padding: 12px 16px;
    }

    .zib-update-log-modal-title {
        font-size: 15px;
    }

    .zib-update-log-modal-body {
        padding: 12px 16px 16px;
        max-height: calc(85vh - 60px);
        -webkit-overflow-scrolling: touch;
        transform: translateZ(0);
        will-change: scroll-position;
    }

    .zib-log-entry {
        gap: 10px;
        padding: 8px 0;
        transform: translateZ(0);
        will-change: transform;
    }

    .zib-log-entry-latest-item {
        padding: 10px 12px;
    }

    .zib-log-entry-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .zib-log-entry-right {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }

    .zib-log-entry-version {
        font-size: 13px;
    }

    .zib-log-entry-desc {
        font-size: 12px;
    }

    .zib-log-entry-date {
        font-size: 11px;
    }

    .zib-update-log-modal-close {
        width: 32px;
        height: 32px;
        font-size: 16px;
    }

    .zib-load-more-btn {
        padding: 6px 16px;
        font-size: 12px;
    }

    .zib-filter-btn {
        padding: 8px 14px !important;
        min-height: 36px !important;
        font-size: 13px !important;
    }

    .zib-log-filter {
        padding: 8px 16px !important;
        gap: 6px !important;
        overflow-x: auto;
        flex-wrap: nowrap !important;
        -webkit-overflow-scrolling: touch;
    }

    .zib-log-filter .zib-filter-btn {
        flex-shrink: 0;
    }
}

/* ============================================
   暗色模式
   ✅ 同时支持 .dark-theme、[data-theme="dark"]（子比主题）
   以及 .zib-dark-theme、[data-theme="zib-dark"]（插件自身）
   ============================================ */

.dark-theme,
[data-theme="dark"],
.zib-dark-theme,
[data-theme="zib-dark"] {
    --zib-primary: #818cf8;
    --zib-primary-hover: #6366f1;
    --zib-primary-light: #1e293b;
    --zib-border: #334155;
    --zib-border-dark: #475569;
    --zib-text: #e6edf3;
    --zib-text-secondary: #94a3b8;
    --zib-text-muted: #64748b;
    --zib-bg: #1e293b;
    --zib-bg-hover: #253040;
    --zib-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
}

/* 标题 */
.dark-theme .zib-update-log-header,
[data-theme="dark"] .zib-update-log-header,
.zib-dark-theme .zib-update-log-header,
[data-theme="zib-dark"] .zib-update-log-header {
    background: var(--zib-bg);
    border-color: var(--zib-border);
}

.dark-theme .zib-update-log-header:hover,
[data-theme="dark"] .zib-update-log-header:hover,
.zib-dark-theme .zib-update-log-header:hover,
[data-theme="zib-dark"] .zib-update-log-header:hover {
    background: var(--zib-bg-hover);
    border-color: var(--zib-border-dark);
}

.dark-theme .zib-header-title,
[data-theme="dark"] .zib-header-title,
.zib-dark-theme .zib-header-title,
[data-theme="zib-dark"] .zib-header-title {
    color: var(--zib-text);
}

.dark-theme .zib-header-count,
[data-theme="dark"] .zib-header-count,
.zib-dark-theme .zib-header-count,
[data-theme="zib-dark"] .zib-header-count {
    background: var(--zib-border);
    color: var(--zib-text-muted);
}

.dark-theme .zib-header-latest,
[data-theme="dark"] .zib-header-latest,
.zib-dark-theme .zib-header-latest,
[data-theme="zib-dark"] .zib-header-latest {
    color: var(--zib-text-muted);
}

/* 简单模式标题 */
.dark-theme .zib-update-log-summary,
[data-theme="dark"] .zib-update-log-summary,
.zib-dark-theme .zib-update-log-summary,
[data-theme="zib-dark"] .zib-update-log-summary {
    background: var(--zib-bg);
    border-color: var(--zib-border);
    color: var(--zib-text);
}

.dark-theme .zib-update-log-summary:hover,
[data-theme="dark"] .zib-update-log-summary:hover,
.zib-dark-theme .zib-update-log-summary:hover,
[data-theme="zib-dark"] .zib-update-log-summary:hover {
    background: var(--zib-bg-hover);
    border-color: var(--zib-border-dark);
}

.dark-theme .zib-update-log-content-inner,
[data-theme="dark"] .zib-update-log-content-inner,
.zib-dark-theme .zib-update-log-content-inner,
[data-theme="zib-dark"] .zib-update-log-content-inner {
    background: var(--zib-bg);
    border-color: var(--zib-border);
}

.dark-theme .zib-log-toggle,
[data-theme="dark"] .zib-log-toggle,
.zib-dark-theme .zib-log-toggle,
[data-theme="zib-dark"] .zib-log-toggle {
    color: var(--zib-text-muted);
}

/* 弹窗 */
.dark-theme .zib-update-log-modal,
[data-theme="dark"] .zib-update-log-modal,
.zib-dark-theme .zib-update-log-modal,
[data-theme="zib-dark"] .zib-update-log-modal {
    background: var(--zib-bg);
}

.dark-theme .zib-update-log-modal-header,
[data-theme="dark"] .zib-update-log-modal-header,
.zib-dark-theme .zib-update-log-modal-header,
[data-theme="zib-dark"] .zib-update-log-modal-header {
    background: var(--zib-bg-hover);
    border-bottom-color: var(--zib-border);
}

.dark-theme .zib-update-log-modal-title,
[data-theme="dark"] .zib-update-log-modal-title,
.zib-dark-theme .zib-update-log-modal-title,
[data-theme="zib-dark"] .zib-update-log-modal-title {
    color: var(--zib-text);
}

.dark-theme .zib-update-log-modal-close,
[data-theme="dark"] .zib-update-log-modal-close,
.zib-dark-theme .zib-update-log-modal-close,
[data-theme="zib-dark"] .zib-update-log-modal-close {
    background: var(--zib-border);
    color: var(--zib-text-muted);
}

.dark-theme .zib-update-log-modal-close:hover,
[data-theme="dark"] .zib-update-log-modal-close:hover,
.zib-dark-theme .zib-update-log-modal-close:hover,
[data-theme="zib-dark"] .zib-update-log-modal-close:hover {
    background: var(--zib-border-dark);
    color: var(--zib-text);
}

/* 日志条目 */
.dark-theme .zib-log-entry,
[data-theme="dark"] .zib-log-entry,
.zib-dark-theme .zib-log-entry,
[data-theme="zib-dark"] .zib-log-entry {
    border-bottom-color: #2a364a;
}

.dark-theme .zib-log-entry-latest-item,
[data-theme="dark"] .zib-log-entry-latest-item,
.zib-dark-theme .zib-log-entry-latest-item,
[data-theme="zib-dark"] .zib-log-entry-latest-item {
    background: var(--zib-bg-hover);
}

.dark-theme .zib-log-entry-version,
[data-theme="dark"] .zib-log-entry-version,
.zib-dark-theme .zib-log-entry-version,
[data-theme="zib-dark"] .zib-log-entry-version {
    color: var(--zib-text-muted);
}

.dark-theme .zib-log-entry-latest-item .zib-log-entry-version,
[data-theme="dark"] .zib-log-entry-latest-item .zib-log-entry-version,
.zib-dark-theme .zib-log-entry-latest-item .zib-log-entry-version,
[data-theme="zib-dark"] .zib-log-entry-latest-item .zib-log-entry-version {
    color: var(--zib-text);
}

.dark-theme .zib-log-entry-desc,
[data-theme="dark"] .zib-log-entry-desc,
.zib-dark-theme .zib-log-entry-desc,
[data-theme="zib-dark"] .zib-log-entry-desc {
    color: var(--zib-text-secondary);
}

.dark-theme .zib-log-entry-latest-item .zib-log-entry-desc,
[data-theme="dark"] .zib-log-entry-latest-item .zib-log-entry-desc,
.zib-dark-theme .zib-log-entry-latest-item .zib-log-entry-desc,
[data-theme="zib-dark"] .zib-log-entry-latest-item .zib-log-entry-desc {
    color: #cbd5e1;
}

.dark-theme .zib-log-entry-date,
[data-theme="dark"] .zib-log-entry-date,
.zib-dark-theme .zib-log-entry-date,
[data-theme="zib-dark"] .zib-log-entry-date {
    color: var(--zib-text-muted);
}

.dark-theme .zib-log-entry-update,
[data-theme="dark"] .zib-log-entry-update,
.zib-dark-theme .zib-log-entry-update,
[data-theme="zib-dark"] .zib-log-entry-update {
    color: var(--zib-text-muted);
}

.dark-theme .zib-log-entry-type,
[data-theme="dark"] .zib-log-entry-type,
.zib-dark-theme .zib-log-entry-type,
[data-theme="zib-dark"] .zib-log-entry-type {
    background: rgba(255,255,255,0.06) !important;
}

.dark-theme .zib-log-entry-latest,
[data-theme="dark"] .zib-log-entry-latest,
.zib-dark-theme .zib-log-entry-latest,
[data-theme="zib-dark"] .zib-log-entry-latest {
    background: var(--zib-border);
    color: var(--zib-text-muted);
}

/* 遮罩 */
.dark-theme .zib-update-log-overlay,
[data-theme="dark"] .zib-update-log-overlay,
.zib-dark-theme .zib-update-log-overlay,
[data-theme="zib-dark"] .zib-update-log-overlay {
    background: rgba(0, 0, 0, 0.6);
}

/* 滚动条 */
.dark-theme .zib-update-log-modal-body,
[data-theme="dark"] .zib-update-log-modal-body,
.zib-dark-theme .zib-update-log-modal-body,
[data-theme="zib-dark"] .zib-update-log-modal-body {
    scrollbar-width: thin;
    scrollbar-color: var(--zib-border-dark) transparent;
}

.dark-theme .zib-update-log-modal-body::-webkit-scrollbar-track,
[data-theme="dark"] .zib-update-log-modal-body::-webkit-scrollbar-track,
.zib-dark-theme .zib-update-log-modal-body::-webkit-scrollbar-track,
[data-theme="zib-dark"] .zib-update-log-modal-body::-webkit-scrollbar-track {
    background: var(--zib-bg);
}

.dark-theme .zib-update-log-modal-body::-webkit-scrollbar-thumb,
[data-theme="dark"] .zib-update-log-modal-body::-webkit-scrollbar-thumb,
.zib-dark-theme .zib-update-log-modal-body::-webkit-scrollbar-thumb,
[data-theme="zib-dark"] .zib-update-log-modal-body::-webkit-scrollbar-thumb {
    background: var(--zib-border-dark);
}

/* 底部 */
.dark-theme .zib-log-footer,
[data-theme="dark"] .zib-log-footer,
.zib-dark-theme .zib-log-footer,
[data-theme="zib-dark"] .zib-log-footer {
    border-top-color: #2a364a;
    color: var(--zib-text-muted);
}

/* 加载更多 */
.dark-theme .zib-load-more-btn,
[data-theme="dark"] .zib-load-more-btn,
.zib-dark-theme .zib-load-more-btn,
[data-theme="zib-dark"] .zib-load-more-btn {
    background: var(--zib-border);
    border-color: var(--zib-border-dark);
    color: var(--zib-text);
}

.dark-theme .zib-load-more-btn:hover,
[data-theme="dark"] .zib-load-more-btn:hover,
.zib-dark-theme .zib-load-more-btn:hover,
[data-theme="zib-dark"] .zib-load-more-btn:hover {
    background: var(--zib-border-dark);
    border-color: var(--zib-primary);
}

/* 重试按钮 */
.dark-theme .zib-retry-btn,
[data-theme="dark"] .zib-retry-btn,
.zib-dark-theme .zib-retry-btn,
[data-theme="zib-dark"] .zib-retry-btn {
    background: var(--zib-primary);
    color: #fff;
}

.dark-theme .zib-retry-btn:hover,
[data-theme="dark"] .zib-retry-btn:hover,
.zib-dark-theme .zib-retry-btn:hover,
[data-theme="zib-dark"] .zib-retry-btn:hover {
    background: var(--zib-primary-hover);
}

/* 触发按钮 */
.dark-theme .zib-update-log-trigger .but,
[data-theme="dark"] .zib-update-log-trigger .but,
.zib-dark-theme .zib-update-log-trigger .but,
[data-theme="zib-dark"] .zib-update-log-trigger .but {
    background: var(--zib-bg);
    border-color: var(--zib-border);
    color: var(--zib-primary);
}

.dark-theme .zib-update-log-trigger .but:hover,
[data-theme="dark"] .zib-update-log-trigger .but:hover,
.zib-dark-theme .zib-update-log-trigger .but:hover,
[data-theme="zib-dark"] .zib-update-log-trigger .but:hover {
    background: var(--zib-primary);
    color: #fff;
    border-color: var(--zib-primary);
}

.dark-theme .zib-update-log-trigger .but:hover .zib-trigger-count,
[data-theme="dark"] .zib-update-log-trigger .but:hover .zib-trigger-count,
.zib-dark-theme .zib-update-log-trigger .but:hover .zib-trigger-count,
[data-theme="zib-dark"] .zib-update-log-trigger .but:hover .zib-trigger-count {
    background: var(--zib-bg);
    color: var(--zib-primary);
}

/* 筛选按钮 */
.dark-theme .zib-filter-btn,
[data-theme="dark"] .zib-filter-btn,
.zib-dark-theme .zib-filter-btn,
[data-theme="zib-dark"] .zib-filter-btn {
    background: var(--zib-bg);
    border-color: var(--zib-border);
    color: var(--zib-text-muted);
}

.dark-theme .zib-filter-btn.zib-active,
[data-theme="dark"] .zib-filter-btn.zib-active,
.zib-dark-theme .zib-filter-btn.zib-active,
[data-theme="zib-dark"] .zib-filter-btn.zib-active {
    background: var(--zib-primary);
    border-color: var(--zib-primary);
    color: #fff;
}

/* 筛选栏 */
.dark-theme .zib-log-filter,
[data-theme="dark"] .zib-log-filter,
.zib-dark-theme .zib-log-filter,
[data-theme="zib-dark"] .zib-log-filter {
    background: var(--zib-bg-hover);
    border-bottom-color: var(--zib-border);
}

/* ============================================
   移动端 - 更新日志按钮移到文章内容顶部
   ============================================ */

@media (max-width: 768px) {
    /* 1. 让文章内容容器变成 flex 列布局 */
    .entry-content,
    .post-content,
    .article-content {
        display: flex !important;
        flex-direction: column !important;
    }

    /* 2. 把触发按钮移到最前面（order: -1） */
    .zib-update-log-trigger {
        order: -1 !important;
        /* 移到最前面 */
        margin: 4px 0 8px 0 !important;
        display: block !important;
        width: 100% !important;
        position: relative !important;
        /* 取消可能存在的绝对定位 */
        position: static !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
        top: auto !important;
        z-index: auto !important;
    }

    /* 3. 按钮样式优化 */
    .zib-update-log-trigger .but {
        display: inline-flex !important;
        align-items: center !important;
        gap: 4px !important;
        padding: 3px 12px !important;
        border-radius: 16px !important;
        font-size: 12px !important;
        background: var(--zib-primary, #667eea) !important;
        color: #fff !important;
        border-color: var(--zib-primary, #667eea) !important;
        box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25) !important;
        min-height: 28px !important;
        border: 1px solid var(--zib-primary, #667eea) !important;
        text-decoration: none !important;
    }

    /* 4. 按钮文字颜色 */
    .zib-update-log-trigger .but span {
        color: #fff !important;
        font-size: 12px !important;
    }

    /* 5. 图标颜色 */
    .zib-update-log-trigger .but .icon {
        width: 14px !important;
        height: 14px !important;
        color: #fff !important;
        fill: #fff !important;
    }

    /* 6. 数量徽章 */
    .zib-trigger-count {
        background: rgba(255, 255, 255, 0.25) !important;
        color: #fff !important;
        min-width: 16px !important;
        height: 16px !important;
        line-height: 16px !important;
        font-size: 10px !important;
        padding: 0 5px !important;
        border-radius: 50% !important;
        margin-left: 0 !important;
    }

    /* 7. 版本号颜色 */
    .zib-update-log-trigger .but .zib-version-text,
    .zib-update-log-trigger .but span[style*="font-weight:600"] {
        color: #fff !important;
        font-weight: 600 !important;
        font-size: 12px !important;
    }

    /* 8. 隐藏"更新历史"文字（可选），如果太挤可以取消注释 */
    /*
    .zib-update-log-trigger .but .zib-log-label,
    .zib-update-log-trigger .but span:first-of-type {
        display: none !important;
    }
    */
}

/* 极端小屏 */
@media (max-width: 400px) {
    .zib-update-log-trigger .but {
        padding: 2px 10px !important;
        font-size: 11px !important;
        min-height: 24px !important;
    }

    .zib-update-log-trigger .but .icon {
        width: 12px !important;
        height: 12px !important;
    }

    .zib-update-log-trigger .but span {
        font-size: 11px !important;
    }

    .zib-trigger-count {
        min-width: 14px !important;
        height: 14px !important;
        line-height: 14px !important;
        font-size: 9px !important;
        padding: 0 4px !important;
    }

    .zib-update-log-trigger .but .zib-version-text,
    .zib-update-log-trigger .but span[style*="font-weight:600"] {
        font-size: 11px !important;
    }
}