/**
 * APP 下载页样式（复刻 360 壁纸官网「下载中心」风格）：
 * 浅灰底 + 白色线条爱心装饰、笔刷下划线大标题、四色渐变方形卡片；
 * 桌面平台右上角圆形下载徽标（hover 时 logo 淡出、中心浮现下载圆标），
 * 移动平台右上角二维码角标，点击弹出扫码弹窗。
 * 作用域统一收敛在 .wpdl-app-page 下，避免与主题样式互相污染。
 */

.wpdl-app-page {
    --wpdl-ink: #1f1f1f;
    --wpdl-brand: #0868ff;
    position: relative;
    overflow: hidden;
    max-width: 1200px;
    margin: 0 auto;
    padding: 72px 24px 88px;
    background-color: #f7f7fb;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 560 560'%3E%3Cg fill='none' stroke='%23ffffff' stroke-width='5'%3E%3Cpath d='M280 462L168 356C104 296 92 216 144 164 196 112 280 144 280 208 280 144 364 112 416 164 468 216 456 296 392 356Z'/%3E%3Ccircle cx='88' cy='88' r='42'/%3E%3Ccircle cx='486' cy='470' r='56'/%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right -70px top -60px;
    background-size: 620px auto;
    color: var(--wpdl-ink);
    font-size: 14px;
}

/* ---------------- 标题区 ---------------- */

.wpdl-app-hero {
    position: relative;
    text-align: center;
    margin-bottom: 56px;
}

.wpdl-app-hero__title {
    position: relative;
    z-index: 0;
    display: inline-block;
    margin: 0;
    padding: 0 10px 20px;
    font-size: 40px;
    line-height: 53px;
    font-weight: 700;
    color: var(--wpdl-ink);
}

/* 薄荷绿笔刷下划线：压在文字底部 */
.wpdl-app-hero__title::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 16px;
    height: 18px;
    border-radius: 9px;
    background: linear-gradient(90deg, #7bf1c4 0%, #d3f8a3 100%);
    z-index: -1;
}

.wpdl-app-hero__subtitle {
    margin: 0;
    font-size: 16px;
    line-height: 21px;
    text-align: center;
}

.wpdl-app-hero__hint {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 20px auto 0;
    padding: 6px 16px;
    border-radius: 999px;
    background: rgba(8, 104, 255, 0.08);
    font-size: 13px;
    color: var(--wpdl-brand);
}

/* ---------------- 平台卡片 ---------------- */

.wpdl-app-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 282px));
    justify-content: center;
    gap: 24px;
}

.wpdl-app-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 282px;
    aspect-ratio: 1 / 1;
    padding: 46px 16px 0;
    border-radius: 20px;
    color: #fff;
    text-align: center;
    text-decoration: none !important;
    cursor: pointer;
    box-shadow: 0 20px 30px #f4f4f4;
    transition: box-shadow 0.3s ease-in-out;
    -webkit-font-smoothing: antialiased;
}

.wpdl-app-card:hover {
    color: #fff;
    text-decoration: none !important;
    box-shadow: 0 20px 30px rgba(96, 96, 96, 0.3);
}

.wpdl-app-card.is-disabled {
    cursor: default;
}

.wpdl-app-card.is-disabled:hover {
    box-shadow: 0 20px 30px #f4f4f4;
}

/* 平台配色：竖向渐变 + 右上角徽标深色 */
.wpdl-app-card--windows {
    background: linear-gradient(180deg, #6da6ff 0%, #428bff 100%);
    --wpdl-deep: #2c6aeb;
}

.wpdl-app-card--android {
    background: linear-gradient(180deg, #aba7ff 0%, #8782ff 100%);
    --wpdl-deep: #6f6af0;
}

.wpdl-app-card--macos {
    background: linear-gradient(180deg, #ffbacc 0%, #ff83a3 100%);
    --wpdl-deep: #ff6f94;
}

.wpdl-app-card--ios {
    background: linear-gradient(180deg, #ffc170 0%, #ffa020 100%);
    --wpdl-deep: #f89108;
}

/* 后台自定义主题色时按卡片内联变量覆盖渐变 */
.wpdl-app-card[style*="--wpdl-accent"] {
    background: linear-gradient(180deg,
            color-mix(in srgb, var(--wpdl-accent) 62%, #ffffff) 0%,
            var(--wpdl-accent) 100%);
}

/* 左上角角标 */
.wpdl-app-card__badge {
    position: absolute;
    top: 14px;
    left: 14px;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.24);
    font-size: 12px;
    line-height: 1.6;
}

/* 右上角徽标：桌面 = 圆形下载箭头，移动 = 二维码角标 */
.wpdl-app-card__corner {
    position: absolute;
    top: 10px;
    right: 10px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--wpdl-deep, rgba(255, 255, 255, 0.24));
    color: #fff;
    transition: all 0.3s ease-in-out;
}

.wpdl-app-card__corner svg {
    width: 18px;
    height: 18px;
}

.wpdl-app-card:hover .wpdl-app-card__corner {
    opacity: 0;
    transform: scale(0.55);
}

.wpdl-app-card__corner--qr {
    top: 0;
    right: 0;
    width: 62px;
    height: 58px;
    border-radius: 0 20px 0 16px;
    background: rgba(255, 255, 255, 0.18);
    cursor: pointer;
}

.wpdl-app-card__corner--qr svg {
    width: 30px;
    height: 30px;
}

.wpdl-app-card__corner--qr:hover {
    opacity: 1;
    transform: none;
    background: rgba(255, 255, 255, 0.32);
}

/* 中心图标区：默认显示平台 logo，hover 时切换 */
.wpdl-app-card__icon {
    position: relative;
    width: 100px;
    height: 100px;
    margin-bottom: 23px;
}

.wpdl-app-card__logo,
.wpdl-app-card__hover-icon {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    transition: all 0.3s ease-in-out;
}

.wpdl-app-card__logo svg {
    width: 82px;
    height: 82px;
}

.wpdl-app-card__hover-icon {
    border-radius: 50%;
    background: var(--wpdl-deep, #fff);
    color: #fff;
    opacity: 0;
    transform: scale(1.44);
}

.wpdl-app-card__hover-icon svg {
    width: 46px;
    height: 46px;
}

.wpdl-app-card:hover .wpdl-app-card__logo {
    opacity: 0;
    transform: scale(0.55);
}

.wpdl-app-card:hover .wpdl-app-card__hover-icon {
    opacity: 1;
    transform: scale(1);
}

/* 移动平台：hover 中心显示大二维码图标（无圆底） */
.wpdl-app-card--mobile .wpdl-app-card__hover-icon {
    background: transparent;
    border-radius: 0;
    color: #fff;
}

.wpdl-app-card--mobile .wpdl-app-card__hover-icon svg {
    width: 78px;
    height: 78px;
}

/* 移动平台：hover 直接展示真实二维码图片（未上传二维码时回退为上方图标）。
   白底 + 内边距保证二维码可扫，投影与渐变卡片区分层级 */
.wpdl-app-card--mobile .wpdl-app-card__hover-qr {
    width: 100px;
    height: 100px;
    padding: 8px;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.22);
    object-fit: contain;
}

.wpdl-app-card__tit {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 26px;
    font-weight: 700;
}

.wpdl-app-card__version {
    margin: 0;
    font-size: 12px;
    line-height: 16px;
    letter-spacing: 0.04em;
}

.wpdl-app-card__meta {
    margin: 8px 0 0;
    max-width: 220px;
    font-size: 12px;
    line-height: 1.5;
    opacity: 0.8;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* 检测到的当前平台：轻微强调 */
.wpdl-app-card.is-current {
    box-shadow: 0 20px 34px rgba(31, 31, 31, 0.16);
}

/* ---------------- 扫码弹窗 ---------------- */

.wpdl-app-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    padding: 24px;
}

.wpdl-app-modal[hidden] {
    display: none;
}

.wpdl-app-modal__mask {
    position: absolute;
    inset: 0;
    background: rgba(31, 31, 31, 0.62);
    backdrop-filter: blur(3px);
}

.wpdl-app-modal__dialog {
    position: relative;
    width: min(340px, calc(100vw - 48px));
    padding: 28px 24px 24px;
    border-radius: 20px;
    background: #fff;
    text-align: center;
    box-shadow: 0 30px 70px -20px rgba(31, 31, 31, 0.55);
    animation: wpdl-app-modal-in 0.22s ease;
}

@keyframes wpdl-app-modal-in {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

.wpdl-app-modal__close {
    position: absolute;
    top: 12px;
    right: 12px;
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 50%;
    background: #f2f2f2;
    color: #707070;
    cursor: pointer;
}

.wpdl-app-modal__close:hover {
    background: #e6e6e6;
}

.wpdl-app-modal__qr {
    width: 220px;
    height: 220px;
    max-width: 100%;
    margin: 0 auto;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.wpdl-app-modal__qr img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.wpdl-app-modal__title {
    margin: 16px 0 4px;
    font-size: 17px;
    font-weight: 700;
    color: var(--wpdl-ink);
}

.wpdl-app-modal__note {
    margin: 0;
    font-size: 13px;
    color: #707070;
}

.wpdl-app-modal__actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 16px;
}

.wpdl-app-modal__backup {
    display: inline-block;
    margin-top: 14px;
    font-size: 13px;
    color: var(--wpdl-brand);
    text-decoration: none;
}

.wpdl-app-modal__backup:hover {
    text-decoration: underline;
}

.wpdl-app-modal__backup[hidden] {
    display: none;
}

/* ---------------- 按钮（弹窗用） ---------------- */

.wpdl-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 18px;
    border: 0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-decoration: none !important;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
}

.wpdl-btn:active {
    transform: scale(0.98);
}

.wpdl-btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
}

.wpdl-btn--primary {
    color: #fff;
    background: var(--wpdl-brand);
}

.wpdl-btn--primary:hover {
    color: #fff;
    background: linear-gradient(0deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.12)), var(--wpdl-brand);
}

.wpdl-btn--ghost {
    color: var(--wpdl-ink);
    background: #f2f2f2;
}

.wpdl-btn--ghost:hover {
    background: #e6e6e6;
    color: var(--wpdl-ink);
}

/* ---------------- 响应式 ---------------- */

@media (max-width: 1180px) {
    .wpdl-app-grid {
        grid-template-columns: repeat(2, minmax(0, 282px));
    }
}

@media (max-width: 640px) {
    .wpdl-app-page {
        padding: 48px 16px 56px;
    }

    .wpdl-app-hero {
        margin-bottom: 40px;
    }

    .wpdl-app-hero__title {
        font-size: 32px;
        line-height: 42px;
    }

    .wpdl-app-hero__subtitle {
        font-size: 14px;
    }

    .wpdl-app-grid {
        grid-template-columns: minmax(0, 320px);
        gap: 20px;
    }

    .wpdl-app-card.is-current {
        box-shadow: 0 20px 30px rgba(96, 96, 96, 0.3);
    }
}

@media (prefers-reduced-motion: reduce) {

    .wpdl-app-card,
    .wpdl-app-card__corner,
    .wpdl-app-card__logo,
    .wpdl-app-card__hover-icon {
        transition: none;
    }
}
