.kpwa-install {
    position: fixed;
    z-index: 2147483600;
    left: 12px;
    right: 12px;
    bottom: 12px;
    display: flex;
    justify-content: center;
    pointer-events: none;
}

.kpwa-install-card {
    --kpwa-install-head-bg: #224b0f;
    --kpwa-install-body-bg: #f3f4f6;
    --kpwa-install-border: #215b21;
    --kpwa-install-title: #ffffff;
    --kpwa-install-subtitle: #ffffff;
    --kpwa-install-message: #2f3646;
    --kpwa-install-cta-bg: #7f450f;
    --kpwa-install-cta-text: #ffffff;
    --kpwa-install-close-bg: #e6e8eb;
    --kpwa-install-close-icon: #6b7280;
    --kpwa-store-apple-bg: #000000;
    --kpwa-store-apple-text: #ffffff;
    --kpwa-store-apple-border: #1f1f1f;
    --kpwa-store-google-bg: #ffffff;
    --kpwa-store-google-text: #202124;
    --kpwa-store-google-border: #dadce0;
    pointer-events: auto;
    width: min(520px, 900%);
    border-radius: 22px;
    border: 8px solid var(--kpwa-install-border);
    background: var(--kpwa-install-body-bg);
    overflow: hidden;
    box-shadow: 0 26px 64px rgba(8, 18, 34, .28);
}

.kpwa-style-modal {
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(9, 17, 31, .42);
    padding: 14px;
}

.kpwa-style-modal .kpwa-install-card {
    max-width: 560px;
}

.kpwa-style-toast {
    right: auto;
    left: 14px;
    width: min(420px, calc(100vw - 28px));
}

.kpwa-style-toast .kpwa-install-card {
    border-width: 6px;
    border-radius: 16px;
}

.kpwa-style-floating_card {
    left: auto;
    right: 14px;
    width: min(430px, calc(100vw - 28px));
}

.kpwa-style-floating_card .kpwa-install-card {
    border-width: 7px;
    border-radius: 18px;
}

.kpwa-install-head {
    background: var(--kpwa-install-head-bg);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 14px 12px;
}

.kpwa-install-logo-wrap {
    width: 102px;
    min-width: 102px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.kpwa-install-logo {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.kpwa-install-logo-fallback {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, .25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .96rem;
    font-weight: 800;
    letter-spacing: .06em;
    background: rgba(255, 255, 255, .08);
}

.kpwa-install-copy {
    flex: 1;
    min-width: 0;
}

.kpwa-install-title {
    font-weight: 600;
    color: var(--kpwa-install-title);
    margin: 0 0 2px;
    font-size: clamp(.93rem, 1.75vw, 1.3rem);
    line-height: 1.0;
}

.kpwa-install-subtitle {
    color: var(--kpwa-install-subtitle);
    margin: 0;
    font-size: clamp(.8rem, 1.06vw, 1rem);
    line-height: 1.24;
}

.kpwa-install-close {
    border: 0;
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--kpwa-install-close-bg);
    color: var(--kpwa-install-close-icon);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

.kpwa-install-close:hover {
    background: #f3f5f8;
    color: #2f3a4e;
    transform: scale(1.03);
}

.kpwa-install-body {
    padding: 14px 14px 14px;
}

.kpwa-install-msg {
    color: var(--kpwa-install-message);
    font-size: .95rem;
    margin: 0 0 12px;
    line-height: 1.42;
}

.kpwa-install-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.kpwa-install-actions.kpwa-actions-1 {
    grid-template-columns: minmax(0, 1fr);
}

.kpwa-install-actions.kpwa-actions-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kpwa-install-actions.kpwa-actions-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kpwa-store-btn {
    min-height: 36px;
    border-radius: 11px;
    border: 1px solid #cfd6df;
    background: #10131a;
    color: #fff;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 5px 7px;
}

.kpwa-store-btn:hover {
    color: inherit;
    text-decoration: none;
    filter: brightness(1.02);
}

.kpwa-store-apple {
    background: var(--kpwa-store-apple-bg);
    color: var(--kpwa-store-apple-text);
    border-color: var(--kpwa-store-apple-border);
}

.kpwa-store-google {
    background: var(--kpwa-store-google-bg);
    color: var(--kpwa-store-google-text);
    border-color: var(--kpwa-store-google-border);
}

.kpwa-store-image {
    display: block;
    width: 100%;
    max-height: 42px;
    object-fit: contain;
}

.kpwa-store-glyph {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .1);
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .04em;
}

.kpwa-store-apple .kpwa-store-glyph {
    background: rgba(255, 255, 255, .1);
    color: var(--kpwa-store-apple-text);
}

.kpwa-store-google .kpwa-store-glyph {
    background: linear-gradient(135deg, #34a853 0%, #4285f4 48%, #ea4335 100%);
    color: #fff;
}

.kpwa-store-lines {
    display: flex;
    flex-direction: column;
    line-height: 1.06;
}

.kpwa-store-kicker {
    font-size: .58rem;
    font-weight: 600;
    opacity: .88;
}

.kpwa-store-main {
    font-size: .86rem;
    font-weight: 700;
}

.kpwa-btn {
    border: 0;
    border-radius: 12px;
    min-height: 46px;
    padding: 7px 11px;
    font-weight: 800;
    cursor: pointer;
}

.kpwa-btn-primary {
    background: var(--kpwa-install-cta-bg);
    color: var(--kpwa-install-cta-text);
    font-size: .95rem;
}

.kpwa-btn-primary:hover {
    filter: brightness(1.04);
}

@keyframes kpwa-install-pop {
    0% {
        transform: translateY(0);
        box-shadow: 0 8px 16px rgba(14, 28, 56, 0.2);
    }

    100% {
        transform: translateY(-1px);
        box-shadow: 0 12px 24px rgba(14, 28, 56, 0.3);
    }
}

.kpwa-btn-light {
    background: #edf1f8;
    color: #23324a;
}

.kpwa-toast {
    position: fixed;
    right: 12px;
    bottom: 84px;
    min-width: 230px;
    max-width: 420px;
    background: #1f2d44;
    color: #fff;
    border-radius: 12px;
    padding: 10px 12px;
    font-size: .88rem;
    z-index: 2147483599;
    opacity: 0;
    transform: translateY(10px);
    transition: all .2s ease;
    box-shadow: 0 16px 32px rgba(8, 17, 34, .28);
}

.kpwa-toast.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.kpwa-toast.kpwa-warn {
    background: #8f3d11;
}

.kpwa-toast.kpwa-info {
    background: #1f2d44;
}

/* ── iOS Visual Install Assistant ── */
.kpwa-ios-assistant {
    position: fixed;
    z-index: 2147483601;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: kpwa-ios-fadein .25s ease;
}

@keyframes kpwa-ios-fadein {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

.kpwa-ios-card {
    position: relative;
    width: 100%;
    max-width: 460px;
    border-radius: 22px 22px 0 0;
    background: linear-gradient(180deg, #ffffff 0%, #f6f8fc 100%);
    padding: 18px 20px 24px;
    box-shadow: 0 -12px 48px rgba(0, 0, 0, .22);
    animation: kpwa-ios-slideup .3s cubic-bezier(.22, 1, .36, 1);
    overflow: hidden;
}

@keyframes kpwa-ios-slideup {
    from {
        transform: translateY(100%)
    }

    to {
        transform: translateY(0)
    }
}

.kpwa-ios-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 0;
    background: rgba(0, 0, 0, .06);
    color: #8e8e93;
    font-size: 1.3rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s, color .15s;
    z-index: 2;
}

.kpwa-ios-close:hover {
    background: rgba(0, 0, 0, .1);
    color: #3a3a3c;
}

/* ── Slide system ── */
.kpwa-ios-slider {
    position: relative;
    min-height: 180px;
}

.kpwa-ios-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 4px 0;
    animation: kpwa-ios-slidefade .28s ease;
}

.kpwa-ios-slide.is-active {
    display: flex;
}

@keyframes kpwa-ios-slidefade {
    from {
        opacity: 0;
        transform: translateX(18px)
    }

    to {
        opacity: 1;
        transform: translateX(0)
    }
}

.kpwa-ios-slide-icon {
    margin-bottom: 14px;
}

.kpwa-ios-icon {
    width: 64px;
    height: 64px;
}

.kpwa-ios-icon-lg {
    width: 72px;
    height: 72px;
}

.kpwa-ios-slide-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #1c1c1e;
    margin-bottom: 6px;
    letter-spacing: -.01em;
}

.kpwa-ios-slide-desc {
    font-size: .92rem;
    color: #48484a;
    line-height: 1.45;
    margin-bottom: 4px;
    max-width: 320px;
}

.kpwa-ios-slide-desc b {
    color: #007AFF;
    font-weight: 700;
}

.kpwa-ios-slide-hint {
    font-size: .82rem;
    color: #8e8e93;
    margin-top: 2px;
    max-width: 280px;
}

/* ── Bouncing arrow (pointing to Safari share button) ── */
.kpwa-ios-arrow-wrap {
    margin-top: 12px;
    display: flex;
    justify-content: center;
}

.kpwa-ios-arrow-bounce {
    animation: kpwa-ios-bounce 1.1s ease-in-out infinite;
}

.kpwa-ios-arrow-bounce svg {
    width: 28px;
    height: 44px;
}

@keyframes kpwa-ios-bounce {

    0%,
    100% {
        transform: translateY(0)
    }

    50% {
        transform: translateY(10px)
    }
}

/* ── Step dots ── */
.kpwa-ios-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 16px 0 14px;
}

.kpwa-ios-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #d1d1d6;
    transition: all .25s ease;
}

.kpwa-ios-dot.is-active {
    width: 22px;
    background: #007AFF;
}

/* ── Nav buttons ── */
.kpwa-ios-nav {
    display: flex;
    gap: 10px;
}

.kpwa-ios-btn {
    flex: 1;
    border: 0;
    border-radius: 14px;
    min-height: 48px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: filter .15s, transform .1s;
}

.kpwa-ios-btn:active {
    transform: scale(.97);
}

.kpwa-ios-btn-back {
    background: #f2f2f7;
    color: #3a3a3c;
}

.kpwa-ios-btn-next {
    background: #007AFF;
    color: #fff;
    box-shadow: 0 4px 14px rgba(0, 122, 255, .3);
}

.kpwa-ios-btn-next:hover {
    filter: brightness(1.06);
}

/* ── Non-Safari redirect screen ── */
.kpwa-ios-nonsafari {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 4px 0 0;
}

.kpwa-ios-ns-icon {
    margin-bottom: 10px;
}

.kpwa-ios-ns-title {
    font-size: 1.18rem;
    font-weight: 700;
    color: #1c1c1e;
    margin-bottom: 4px;
    letter-spacing: -.01em;
}

.kpwa-ios-ns-desc {
    font-size: .88rem;
    color: #48484a;
    line-height: 1.45;
    margin-bottom: 14px;
}

.kpwa-ios-ns-desc b {
    color: #007AFF;
}

.kpwa-ios-ns-steps {
    width: 100%;
    margin-bottom: 6px;
}

.kpwa-ios-ns-step {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
}

.kpwa-ios-ns-num {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: #007AFF;
    color: #fff;
    font-size: .82rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpwa-ios-ns-step-text {
    font-size: .9rem;
    color: #1c1c1e;
    font-weight: 600;
}

.kpwa-ios-ns-step-text b {
    color: #007AFF;
}

.kpwa-ios-ns-url-row {
    display: flex;
    gap: 6px;
    width: 100%;
    margin-bottom: 14px;
}

.kpwa-ios-ns-url {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1.5px solid #d1d5db;
    border-radius: 12px;
    font-size: .8rem;
    background: #f9fafb;
    color: #374151;
    outline: none;
    transition: border-color .15s;
}

.kpwa-ios-ns-url:focus {
    border-color: #007AFF;
}

.kpwa-ios-ns-copy {
    padding: 10px 18px;
    border: 0;
    border-radius: 12px;
    background: #007AFF;
    color: #fff;
    font-weight: 700;
    font-size: .88rem;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, transform .1s;
    min-width: 72px;
}

.kpwa-ios-ns-copy:active {
    transform: scale(.96);
}

.kpwa-ios-ns-copy.is-copied {
    background: #34C759;
}

.kpwa-ios-ns-hint {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    text-align: left;
    font-size: .8rem;
    color: #6b7280;
    line-height: 1.4;
    padding: 10px 12px;
    background: rgba(0, 122, 255, .06);
    border-radius: 10px;
    margin-top: 2px;
    width: 100%;
}

.kpwa-ios-ns-hint b {
    color: #007AFF;
    font-weight: 700;
}


.kpwa-bottom-nav {
    position: fixed;
    z-index: 99995;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0;
    border-top: 1px solid rgba(43, 61, 90, .2);
    background: #fff;
    box-shadow: 0 -7px 20px rgba(12, 27, 52, .12);
    padding-bottom: max(env(safe-area-inset-bottom), 0);
}

.kpwa-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 58px;
    text-decoration: none;
    color: #4a5a77;
    font-size: .74rem;
    gap: 2px;
}

.kpwa-nav-item i {
    font-size: 1.04rem;
}

.kpwa-nav-item.is-active {
    color: #2f6cf6;
    font-weight: 700;
}

body.kpwa-has-bottom-nav {
    padding-bottom: calc(env(safe-area-inset-bottom) + 62px);
}

@media (max-width: 640px) {
    .kpwa-install {
        left: 8px;
        right: 8px;
        bottom: max(8px, env(safe-area-inset-bottom));
    }

    .kpwa-install-card {
        border-width: 7px;
        border-radius: 15px;
    }

    .kpwa-install-head {
        gap: 10px;
        padding: 9px 9px 8px;
    }

    .kpwa-install-logo-wrap {
        width: 50px;
        min-width: 50px;
        height: 28px;
    }

    .kpwa-install-title {
        font-size: .92rem;
    }

    .kpwa-install-subtitle {
        font-size: .74rem;
    }

    .kpwa-install-close {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 1rem;
    }

    .kpwa-install-body {
        padding: 8px 8px 8px;
    }

    .kpwa-install-msg {
        font-size: .84rem;
        margin-bottom: 6px;
    }

    .kpwa-install-actions {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
    }

    .kpwa-store-btn,
    .kpwa-btn {
        min-height: 34px;
    }

    .kpwa-store-main {
        font-size: .84rem;
    }

    .kpwa-install-actions [data-kpwa-install] {
        min-height: 42px;
        font-size: .95rem;
        font-weight: 900;
        opacity: 1;
        letter-spacing: .01em;
        box-shadow: 0 10px 20px rgba(14, 28, 56, 0.3);
        animation: kpwa-install-pop 1.5s ease-in-out infinite alternate;
    }

    .kpwa-install-actions .kpwa-store-btn,
    .kpwa-install-actions .kpwa-btn-light {
        min-height: 27px;
        font-size: .72rem;
    }

    .kpwa-install-actions .kpwa-store-kicker {
        font-size: .42rem;
    }

    .kpwa-install-actions .kpwa-store-main {
        font-size: .68rem;
    }

    .kpwa-style-toast,
    .kpwa-style-floating_card {
        right: 8px;
        left: 8px;
        width: auto;
    }

    .kpwa-toast {
        left: 8px;
        right: 8px;
        max-width: none;
        min-width: 0;
    }
}

@media (max-width: 340px) {
    .kpwa-install {
        left: 6px;
        right: 6px;
        bottom: max(6px, env(safe-area-inset-bottom));
    }

    .kpwa-install-card {
        border-width: 5px;
    }

    .kpwa-install-head {
        padding: 8px 8px 8px;
    }

    .kpwa-install-title {
        font-size: .84rem;
    }

    .kpwa-install-subtitle {
        font-size: .68rem;
    }

    .kpwa-install-close {
        width: 26px;
        height: 26px;
        min-width: 26px;
        font-size: .9rem;
    }

    .kpwa-install-body {
        padding: 8px;
    }

    .kpwa-install-msg {
        font-size: .78rem;
    }

    .kpwa-store-btn,
    .kpwa-btn {
        min-height: 31px;
        padding: 6px 7px;
        border-radius: 10px;
    }

    .kpwa-store-kicker {
        font-size: .58rem;
    }

    .kpwa-store-main {
        font-size: .84rem;
    }

    .kpwa-btn-primary {
        font-size: .88rem;
    }

    .kpwa-install-actions [data-kpwa-install] {
        min-height: 39px;
        font-size: .86rem;
    }

    .kpwa-install-actions .kpwa-store-btn,
    .kpwa-install-actions .kpwa-btn-light {
        min-height: 24px;
        font-size: .64rem;
    }

    .kpwa-install-actions .kpwa-store-kicker {
        font-size: .4rem;
    }

    .kpwa-install-actions .kpwa-store-main {
        font-size: .62rem;
    }
}