.cs-widget,
.cs-widget * {
    box-sizing: border-box;
}

.cs-widget {
    --cs-navy: #182035;
    --cs-blue: #5873f2;
    --cs-soft: #f3f5fb;
    --cs-line: #e6e9f1;
    --cs-text: #192033;
    position: fixed;
    z-index: 1045;
    top: 60%;
    right: max(8px, env(safe-area-inset-right));
    width: 218px;
    color: var(--cs-text);
    font-family: inherit;
    transform: translateY(-50%);
    filter: drop-shadow(0 18px 35px rgb(24 32 53 / 16%));
}

.cs-widget__toggle {
    position: absolute;
    overflow: hidden;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.cs-widget__summary {
    display: none;
    min-height: 52px;
    align-items: center;
    gap: 10px;
    padding: 0 18px;
    border-radius: 18px 18px 0 0;
    background: var(--cs-navy);
    color: #fff;
    cursor: default;
    font-size: 16px;
    font-weight: 700;
    user-select: none;
}

.cs-widget__toggle:focus-visible + .cs-widget__summary {
    outline: 3px solid rgb(88 115 242 / 38%);
    outline-offset: 3px;
}

.cs-widget__summary-icon {
    position: relative;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border: 2px solid #fff;
    border-radius: 50%;
}

.cs-widget__summary-icon::before,
.cs-widget__summary-icon::after {
    position: absolute;
    top: 8px;
    width: 3px;
    height: 7px;
    border-radius: 4px;
    background: #fff;
    content: '';
}

.cs-widget__summary-icon::before {
    left: -4px;
}

.cs-widget__summary-icon::after {
    right: -4px;
}

.cs-widget__panel {
    display: block !important;
    padding: 18px;
    border: 1px solid rgb(230 233 241 / 92%);
    border-radius: 18px;
    background: rgb(255 255 255 / 96%);
    backdrop-filter: blur(14px);
}

.cs-widget__head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cs-widget__head small {
    display: block;
    margin-bottom: 2px;
    color: #9299aa;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .13em;
    line-height: 1;
}

.cs-widget__head h2 {
    margin: 0;
    color: var(--cs-text);
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
}

.cs-widget__status {
    position: relative;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 11px;
    background: #eef1ff;
}

.cs-widget__status::before {
    position: absolute;
    inset: 9px;
    border: 2px solid var(--cs-blue);
    border-radius: 50%;
    content: '';
}

.cs-widget__status::after {
    position: absolute;
    right: 7px;
    bottom: 7px;
    width: 8px;
    height: 8px;
    border: 2px solid #eef1ff;
    border-radius: 50%;
    background: #3fc47c;
    content: '';
}

.cs-widget__qr-link,
.cs-widget__qr-placeholder {
    display: flex;
    width: 100%;
    aspect-ratio: 1;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--cs-line);
    border-radius: 14px;
    background: #fff;
}

.cs-widget__head + .cs-widget__qr-link,
.cs-widget__head + .cs-widget__qr-placeholder {
    margin-top: 16px;
}

.cs-widget__qr-link {
    padding: 7px;
}

.cs-widget__qr {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 9px;
    object-fit: contain;
}

.cs-widget__qr-placeholder {
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    background-color: #fafbfe;
    background-image: linear-gradient(45deg, #f1f3f8 25%, transparent 25%),
        linear-gradient(-45deg, #f1f3f8 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f1f3f8 75%),
        linear-gradient(-45deg, transparent 75%, #f1f3f8 75%);
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
    background-size: 16px 16px;
    color: #8b92a3;
    text-align: center;
}

.cs-widget__qr-placeholder-icon {
    width: 42px;
    height: 42px;
    border: 6px dotted #8d9bf1;
    border-radius: 8px;
    background: rgb(255 255 255 / 85%);
}

.cs-widget__qr-placeholder small {
    padding: 5px 7px;
    border-radius: 6px;
    background: rgb(255 255 255 / 90%);
    font-size: 11px;
    line-height: 1.35;
}

.cs-widget__tip {
    margin: 11px 0 0;
    color: #7b8294;
    font-size: 12px;
    line-height: 1.55;
    text-align: center;
}

.cs-widget__wechat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 11px;
    padding: 9px 10px;
    border-radius: 10px;
    background: var(--cs-soft);
    font-size: 11px;
}

.cs-widget__wechat span {
    flex: 0 0 auto;
    color: #8a91a2;
}

.cs-widget__wechat strong {
    overflow: hidden;
    color: #343b4e;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cs-widget__action {
    display: flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    margin-top: 11px;
    border-radius: 10px;
    background: var(--cs-blue);
    color: #fff !important;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none !important;
    transition: background-color .18s ease, transform .18s ease;
}

.cs-widget__action:hover {
    background: #4863de;
    transform: translateY(-1px);
}

@media (max-width: 1680px) and (min-width: 1201px) {
    .cs-widget {
        right: max(8px, env(safe-area-inset-right));
        width: 190px;
    }

    .cs-widget__panel {
        padding: 15px;
    }
}

@media (max-width: 1200px) {
    .cs-widget {
        top: auto;
        right: max(14px, env(safe-area-inset-right));
        bottom: max(18px, env(safe-area-inset-bottom));
        width: auto;
        transform: none;
        filter: drop-shadow(0 12px 26px rgb(24 32 53 / 22%));
    }

    .cs-widget__summary {
        display: flex;
        position: relative;
        z-index: 2;
        min-height: 50px;
        justify-content: center;
        padding: 0 17px;
        border-radius: 999px;
        cursor: pointer;
        font-size: 14px;
    }

    .cs-widget__panel {
        position: absolute;
        right: 0;
        bottom: 62px;
        display: none !important;
        width: min(286px, calc(100vw - 28px));
        max-height: calc(100vh - 100px);
        overflow: auto;
        border-top: 1px solid var(--cs-line);
        border-radius: 18px;
    }

    .cs-widget__toggle:checked ~ .cs-widget__panel {
        display: block !important;
    }

    .cs-widget__toggle:checked + .cs-widget__summary {
        background: #303a55;
    }

    .cs-widget__qr-link,
    .cs-widget__qr-placeholder {
        width: 178px;
        margin-inline: auto;
    }
}

@media (max-width: 480px) {
    .cs-widget__summary {
        width: 52px;
        height: 52px;
        padding: 0;
    }

    .cs-widget__summary > span:last-child {
        position: absolute;
        overflow: hidden;
        width: 1px;
        height: 1px;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cs-widget__action {
        transition: none;
    }
}
