/* 全站下载中心沿用中博站点的蓝色强调、深色正文和浅色卡片。 */
.zbt-download-center {
    position: fixed;
    /* 无配置时仍为原来的 60px / 24px；设置比例后才启用响应式上下限。 */
    --zbt-download-size: clamp(44px, var(--zbt-download-desktop-size, 60px), 88px);
    --zbt-download-right: clamp(16px, var(--zbt-download-desktop-right, 24px), 40vw);
    --zbt-download-bottom: clamp(16px, var(--zbt-download-desktop-bottom, 24px), 40vh);
    right: calc(var(--zbt-download-right) + var(--zbt-download-avoid-right, 0px) + env(safe-area-inset-right, 0px));
    bottom: calc(var(--zbt-download-bottom) + env(safe-area-inset-bottom, 0px));
    z-index: 10020;
    width: var(--zbt-download-size);
    height: var(--zbt-download-size);
    font-family: "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

.zbt-download-center [hidden] {
    display: none !important;
}

/* 原图具有透明通道；按钮自身不绘制圆形背景或外框。 */
.zbt-download-center__launcher {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    appearance: none;
    cursor: pointer;
    transition: transform .18s ease;
}

.zbt-download-center__launcher:hover,
.zbt-download-center__launcher[aria-expanded="true"] {
    transform: translateY(-3px);
}

.zbt-download-center__launcher:focus-visible {
    outline: 2px solid #1547c9;
    outline-offset: 4px;
}

.zbt-download-center__launcher img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.zbt-download-center__panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 14px);
    display: flex;
    flex-direction: column;
    /* 定位提高或向左移时，面板同步缩小可用范围，避免超出视口左侧/顶部。 */
    box-sizing: border-box;
    width: min(420px, calc(100vw - var(--zbt-download-right) - var(--zbt-download-avoid-right, 0px) - env(safe-area-inset-right, 0px) - 16px));
    max-height: min(70dvh, calc(100dvh - var(--zbt-download-bottom) - var(--zbt-download-size) - 30px - env(safe-area-inset-bottom, 0px)));
    min-height: 0;
    overflow: hidden;
    color: #172033;
    background: #fff;
    border: 1px solid #d9e4f5;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(2, 20, 64, .25);
}

.zbt-download-center__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 20px 17px;
    color: #fff;
    background: linear-gradient(125deg, #0b2e80, #1547c9 65%, #387be8);
}

.zbt-download-center__header h2 {
    margin: 0;
    color: inherit;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
}

.zbt-download-center__close {
    display: grid;
    place-items: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: #fff;
    background: rgba(255, 255, 255, .16);
    font-size: 23px;
    line-height: 1;
    cursor: pointer;
}

.zbt-download-center__close:hover {
    background: rgba(255, 255, 255, .3);
}

.zbt-download-center__search-label {
    padding: 14px 20px 4px;
    color: #496181;
    font-size: 12px;
    font-weight: 600;
}

.zbt-download-center__search {
    flex: 0 0 auto;
    min-height: 38px;
    margin: 0 20px 10px;
    padding: 7px 12px;
    border: 1px solid #c8d8f0;
    border-radius: 8px;
    outline-offset: 2px;
    color: #172033;
    background: #f8fbff;
    font: inherit;
    font-size: 13px;
}

.zbt-download-center__selection {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 10px;
    flex: 0 0 auto;
    padding: 10px 20px;
    border-bottom: 1px solid #edf1f7;
    background: #f8fbff;
}

.zbt-download-center__select-all {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #405778;
    font-size: 12px;
    white-space: nowrap;
    cursor: pointer;
}

.zbt-download-center__selected-count {
    margin-right: auto;
    color: #66758b;
    font-size: 11px;
    white-space: nowrap;
}

.zbt-download-center__batch {
    padding: 7px 10px;
    border: 0;
    border-radius: 7px;
    color: #fff;
    background: #1547c9;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.zbt-download-center__batch:disabled,
.zbt-download-center__clear:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.zbt-download-center__clear {
    padding: 7px 0;
    border: 0;
    color: #496181;
    background: transparent;
    font-size: 11px;
    cursor: pointer;
}

.zbt-download-center__select-all input,
.zbt-download-center__choose input {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #1547c9;
    cursor: pointer;
}

.zbt-download-center__choose {
    display: grid;
    place-items: center;
    flex: 0 0 18px;
}

.zbt-download-center__scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-color: #a5bce5 #f2f6ff;
    scrollbar-width: thin;
}

.zbt-download-center__list {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 4px 12px 8px;
    list-style: none;
}

.zbt-download-center__item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 12px 8px;
    border-bottom: 1px solid #edf1f7;
}

.zbt-download-center__item:last-child {
    border-bottom: 0;
}

.zbt-download-center__type {
    display: grid;
    place-items: center;
    flex: 0 0 48px;
    min-height: 38px;
    border-radius: 8px;
    color: #1547c9;
    background: #eaf1ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
}

.zbt-download-center__details {
    display: grid;
    gap: 3px;
    flex: 1;
    min-width: 0;
}

.zbt-download-center__name {
    overflow-wrap: anywhere;
    color: #172033;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.45;
}

.zbt-download-center__meta {
    overflow-wrap: anywhere;
    color: #66758b;
    font-size: 11px;
    line-height: 1.4;
}

.zbt-download-center__link {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border: 1px solid #d7e4fb;
    border-radius: 8px;
    color: #1547c9;
    background: #fff;
    transition: background .18s ease, color .18s ease;
}

.zbt-download-center__link:hover {
    color: #fff;
    background: #1547c9;
}

.zbt-download-center__link svg {
    width: 18px;
    height: 18px;
}

.zbt-download-center__empty {
    margin: 14px 20px 20px;
    color: #66758b;
    font-size: 13px;
}

.zbt-download-center__hint {
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 20px;
    border-top: 1px solid #edf1f7;
    color: #78889d;
    background: #fafcff;
    font-size: 11px;
    line-height: 1.4;
}

@media (max-width: 600px) {
    .zbt-download-center {
        --zbt-download-size: clamp(44px, var(--zbt-download-mobile-size, 60px), 64px);
        --zbt-download-right: clamp(12px, var(--zbt-download-mobile-right, 16px), 40vw);
        --zbt-download-bottom: clamp(12px, var(--zbt-download-mobile-bottom, 16px), 40vh);
    }

    .zbt-download-center__panel {
        max-height: calc(100dvh - var(--zbt-download-bottom) - var(--zbt-download-size) - 30px - env(safe-area-inset-bottom, 0px));
    }
}

@media (prefers-reduced-motion: reduce) {
    .zbt-download-center__launcher,
    .zbt-download-center__link {
        transition: none;
    }
}
