/* ═══════════════════════════════════════
   共享 · PC 端设备预览模拟器
   素材：device-frames-media
   手机 iPhone 17 Pro Silver / 平板 iPad Pro 11 M4 Portrait Silver
   https://github.com/jonnyjackson26/device-frames-media
   ═══════════════════════════════════════ */

.download-phone {
    /* 手机默认参数 · image/phone-frame.png */
    --frame-w: 1406;
    --frame-h: 2822;
    --screen-x: 100;
    --screen-y: 100;
    --screen-w: 1206;
    --screen-h: 2622;
    --screen-radius: 11.5% / 5.6%;
    --device-width: 18rem;

    position: relative;
    width: min(100%, var(--device-width));
    margin-inline: auto;
}

.download-phone__frame {
    position: relative;
    width: 100%;
    aspect-ratio: var(--frame-w) / var(--frame-h);
}

.download-phone__screen {
    position: absolute;
    z-index: 1;
    top: calc(var(--screen-y) / var(--frame-h) * 100%);
    left: calc(var(--screen-x) / var(--frame-w) * 100%);
    width: calc(var(--screen-w) / var(--frame-w) * 100%);
    height: calc(var(--screen-h) / var(--frame-h) * 100%);
    border-radius: var(--screen-radius);
    overflow: hidden;
    background: #000;
    touch-action: none;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.download-phone__screen.is-dragging {
    cursor: grabbing;
}

.download-phone__shell {
    position: absolute;
    z-index: 2;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: block;
}

.download-phone__shell--tablet {
    display: none;
}

.download-phone__track {
    display: flex;
    height: 100%;
    will-change: transform;
    position: relative;
    z-index: 1;
    backface-visibility: hidden;
}

.download-phone__slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.download-phone__slide img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    user-select: none;
    -webkit-user-drag: none;
}

/* 轮播页 · 状态栏 + 底栏（填补 letterbox 黑边） */
.download-phone.has-app-chrome {
    --phone-chrome-top-fill: 9.5%;
    --phone-chrome-status-top: 0.65rem;
    --phone-chrome-tabbar: 11.5%;
    --phone-chrome-brand: #19c4ad;
    --phone-chrome-muted: #8a9399;
}

.download-phone.has-app-chrome .download-phone__screen {
    background: #fff;
}

.download-phone.has-app-chrome .download-phone__slide {
    background: #fff;
    flex-shrink: 0;
    box-sizing: border-box;
}

.download-phone.has-app-chrome .download-phone__track {
    height: 100%;
}

.download-phone.has-statusbar-only {
    /* 仅容纳状态栏，避免 overlay 压住 iframe 内 banner */
    --phone-embed-statusbar-pad: 2rem;
    --phone-chrome-status-top: 0.58rem;
    --phone-chrome-statusbar-bg: #fff;
}

.page-provider-verify .download-phone.has-statusbar-only {
    --phone-chrome-statusbar-bg: #f8f8f8;
}

.download-phone.has-statusbar-only .download-phone__chrome--status-only {
    inset: auto;
    top: 0;
    left: 0;
    right: 0;
    height: var(--phone-embed-statusbar-pad);
    z-index: 2;
}

.download-phone.has-statusbar-only .download-phone__chrome--status-only::before {
    height: 100%;
    background: var(--phone-chrome-statusbar-bg);
}

.download-phone__chrome {
    position: absolute;
    z-index: 2;
    inset: 0;
    pointer-events: none;
}

.download-phone__chrome::before {
    content: '';
    position: absolute;
    z-index: 0;
    top: 0;
    left: 0;
    right: 0;
    height: var(--phone-chrome-top-fill);
    background: #fff;
}

.download-phone__statusbar {
    position: absolute;
    z-index: 1;
    top: var(--phone-chrome-status-top);
    left: 0;
    right: 0;
    height: 0.78rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 5.5% 0 6%;
    background: transparent;
    color: #111;
    font-size: 0.58rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.download-phone__status-icons {
    display: flex;
    align-items: center;
    gap: 0.28rem;
}

.download-phone__status-icons svg {
    display: block;
    height: 0.56rem;
    width: auto;
}

.download-phone__tabbar {
    position: absolute;
    z-index: 1;
    bottom: 0;
    left: 0;
    right: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    align-items: end;
    min-height: var(--phone-chrome-tabbar);
    padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom, 0));
    background: #f7f8fa;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.download-phone__tabbar--4 {
    grid-template-columns: repeat(4, 1fr);
}

.download-phone__tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.12rem;
    color: var(--phone-chrome-muted);
    font-size: 0.52rem;
    line-height: 1.1;
    white-space: nowrap;
}

.download-phone__tab svg {
    display: block;
    width: 1.05rem;
    height: 1.05rem;
}

.download-phone__tab.is-active {
    color: var(--phone-chrome-brand);
}

.download-phone__tab--action {
    align-self: center;
    justify-self: center;
    width: 2rem;
    height: 2rem;
    margin-bottom: 0.15rem;
    border-radius: 0.55rem;
    background: linear-gradient(145deg, #22d4bc, #14b89f);
    color: #fff;
    box-shadow: 0 0.18rem 0.55rem rgba(20, 184, 159, 0.35);
}

.download-phone__tab--action svg {
    width: 1.15rem;
    height: 1.15rem;
}

.download-phone__screen--embed {
    cursor: default;
    touch-action: auto;
    user-select: auto;
    -webkit-user-select: auto;
    box-sizing: border-box;
    overflow: hidden;
}

.download-phone__screen--embed .download-phone__embed {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    border: 0;
    background: #fff;
}

/* 平板预览 */
.download-phone.is-device-tablet {
    --frame-w: 1868;
    --frame-h: 2620;
    --screen-x: 99;
    --screen-y: 100;
    --screen-w: 1668;
    --screen-h: 2420;
    --screen-radius: 2.4% / 1.65%;
    --device-width: 34rem;
}

.download-phone.is-device-tablet .download-phone__shell--phone {
    display: none;
}

.download-phone.is-device-tablet .download-phone__shell--tablet {
    display: block;
}

@media (max-width: 991px) {
    .download-phone:not(.is-device-tablet) {
        --device-width: 16.5rem;
    }

    .download-phone.is-device-tablet {
        --device-width: 28rem;
    }
}

@media (max-width: 767px) {
    .download-phone:not(.is-device-tablet) {
        --device-width: 15rem;
    }

    .download-phone.is-device-tablet {
        --device-width: 24rem;
    }
}
