/* TESTVI 移动端安装提示：底部悬浮条 + iOS 添加到主屏幕引导 */
#testviInstallBar,
#testviInstallModal {
    --tvi-accent: #ff5b3d;
    --tvi-accent-2: #ff9d5c;
    --tvi-card: #101722;
    --tvi-line: rgba(255, 255, 255, .12);
    --tvi-text: #f2f5fa;
    --tvi-muted: #9aa5bb;
}

#testviInstallBar[hidden],
#testviInstallModal[hidden] {
    display: none !important;
}

html.tvi-install-visible #testviInstallBar {
    display: flex;
}

#testviInstallBar {
    align-items: center;
    background: rgba(12, 18, 27, .97);
    border: 1px solid var(--tvi-line);
    border-radius: 18px;
    bottom: calc(var(--tvi-install-bottom, 12px) + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 12px 34px rgba(0, 0, 0, .42), 0 2px 8px rgba(0, 0, 0, .3);
    box-sizing: border-box;
    color: var(--tvi-text);
    display: none;
    gap: 10px;
    left: 50%;
    width: calc(100vw - 24px);
    max-width: 560px;
    min-height: 66px;
    padding: 10px 12px;
    position: fixed;
    right: auto;
    transform: translateX(-50%);
    z-index: 2147482000;
    -webkit-tap-highlight-color: transparent;
    animation: tviBarIn .26s ease-out both;
}

#testviInstallBar.is-visible {
    display: flex;
}

#testviInstallBar .tvi-install-bar__close {
    align-items: center;
    background: rgba(255, 255, 255, .06);
    border: 0;
    border-radius: 50%;
    color: var(--tvi-muted);
    cursor: pointer;
    display: flex;
    flex: 0 0 20px;
    font: 18px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    height: 20px;
    justify-content: center;
    margin-left: 1px;
    order: 9;
    padding: 0;
    position: static;
    width: 20px;
}

#testviInstallBar .tvi-install-bar__icon {
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
    flex: 0 0 auto;
    height: 48px;
    object-fit: cover;
    width: 48px;
}

#testviInstallBar .tvi-install-bar__main {
    flex: 1 1 auto;
    min-width: 0;
    padding-left: 1px;
}

#testviInstallBar .tvi-install-bar__title {
    color: var(--tvi-text);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#testviInstallBar .tvi-install-bar__sub {
    color: var(--tvi-muted);
    font-size: 11px;
    line-height: 1.35;
    margin: 3px 0 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#testviInstallBar .tvi-install-bar__btn {
    align-items: center;
    background: linear-gradient(135deg, var(--tvi-accent), var(--tvi-accent-2));
    border-radius: 999px;
    box-shadow: 0 6px 16px rgba(255, 91, 61, .28);
    color: #fff !important;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 12.5px;
    font-weight: 700;
    justify-content: center;
    min-width: 84px;
    padding: 9px 14px;
    text-decoration: none;
    white-space: nowrap;
}

#testviInstallBar .tvi-install-bar__btn:active {
    opacity: .9;
}

#testviInstallBar .tvi-install-bar__btn[data-tvi-modal="1"] {
    cursor: pointer;
}

/* 弹层 */
#testviInstallModal {
    align-items: center;
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 22px;
    position: fixed;
    z-index: 2147483000;
}

#testviInstallModal .tvi-install-modal__mask {
    background: rgba(3, 6, 12, .72);
    inset: 0;
    position: absolute;
    -webkit-backdrop-filter: blur(5px);
    backdrop-filter: blur(5px);
}

#testviInstallModal .tvi-install-modal__card {
    animation: tviCardIn .24s ease-out both;
    background: linear-gradient(160deg, #172132 0%, #0d131d 100%);
    border: 1px solid rgba(255, 255, 255, .13);
    border-radius: 22px;
    box-shadow: 0 26px 70px rgba(0, 0, 0, .55);
    box-sizing: border-box;
    color: var(--tvi-text);
    max-height: calc(100dvh - 44px);
    max-width: 420px;
    overflow-y: auto;
    padding: 22px 20px 18px;
    position: relative;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

#testviInstallModal .tvi-install-modal__close {
    background: rgba(255, 255, 255, .08);
    border: 0;
    border-radius: 50%;
    color: var(--tvi-muted);
    cursor: pointer;
    font: 20px/1 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    height: 30px;
    position: absolute;
    right: 12px;
    top: 12px;
    width: 30px;
}

#testviInstallModal .tvi-install-modal__icon {
    border-radius: 16px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
    display: block;
    height: 64px;
    margin: 2px 0 14px;
    object-fit: cover;
    width: 64px;
}

#testviInstallModal .tvi-install-modal__title {
    color: var(--tvi-text);
    font-size: 20px;
    font-weight: 800;
    letter-spacing: .2px;
    line-height: 1.35;
    margin: 0;
}

#testviInstallModal .tvi-install-modal__desc {
    color: var(--tvi-muted);
    font-size: 12.5px;
    line-height: 1.55;
    margin: 7px 0 16px;
}

#testviInstallModal .tvi-install-modal__steps {
    list-style: none;
    margin: 0;
    padding: 0;
}

#testviInstallModal .tvi-install-modal__steps li {
    align-items: flex-start;
    color: #dfe6f2;
    display: flex;
    font-size: 13px;
    gap: 10px;
    line-height: 1.55;
    padding: 0 0 12px;
}

#testviInstallModal .tvi-install-modal__steps li:last-child {
    padding-bottom: 0;
}

#testviInstallModal .tvi-install-modal__num {
    align-items: center;
    background: rgba(255, 91, 61, .14);
    border: 1px solid rgba(255, 91, 61, .35);
    border-radius: 50%;
    color: #ff9c7d;
    display: inline-flex;
    flex: 0 0 22px;
    font-size: 11px;
    font-weight: 800;
    height: 22px;
    justify-content: center;
    margin-top: 1px;
    width: 22px;
}

#testviInstallModal .tvi-install-modal__steps strong {
    color: #fff;
    font-weight: 700;
}

#testviInstallModal .tvi-share-ico {
    align-items: center;
    color: #8fb7ff;
    display: inline-flex;
    vertical-align: -4px;
    margin: 0 1px;
}

#testviInstallModal .tvi-install-modal__hint {
    background: rgba(255, 255, 255, .05);
    border-radius: 12px;
    color: var(--tvi-muted);
    font-size: 11.5px;
    line-height: 1.55;
    margin: 15px 0 0;
    padding: 10px 12px;
}

#testviInstallModal .tvi-install-modal__done {
    background: linear-gradient(135deg, var(--tvi-accent), var(--tvi-accent-2));
    border: 0;
    border-radius: 14px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
    height: 46px;
    margin-top: 16px;
    width: 100%;
}

body.tvi-install-modal-open {
    overflow: hidden !important;
}

@keyframes tviBarIn {
    from { opacity: 0; transform: translateX(-50%) translateY(18px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes tviCardIn {
    from { opacity: 0; transform: translateY(12px) scale(.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 821px) {
    #testviInstallBar,
    #testviInstallModal {
        display: none !important;
    }
}

@media (max-width: 360px) {
    #testviInstallBar {
        width: calc(100vw - 16px);
        padding: 9px 10px;
    }
    #testviInstallBar .tvi-install-bar__icon {
        height: 44px;
        width: 44px;
    }
    #testviInstallBar .tvi-install-bar__btn {
        min-width: 76px;
        padding: 9px 11px;
    }
}

@media (prefers-reduced-motion: reduce) {
    #testviInstallBar,
    #testviInstallModal .tvi-install-modal__card {
        animation: none !important;
    }
}

@media print {
    #testviInstallBar,
    #testviInstallModal {
        display: none !important;
    }
}
