#wcs-widget,
#wcs-widget * {
    box-sizing: border-box;
}

.wcs-widget {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #1f2329;
}

.wcs-launcher {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 0;
    padding: 0;
    cursor: pointer;
    background: linear-gradient(135deg, #07c160, #05a34e);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(7, 193, 96, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.wcs-launcher:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 28px rgba(7, 193, 96, 0.45);
}

.wcs-launcher:focus-visible {
    outline: 3px solid rgba(7, 193, 96, 0.35);
    outline-offset: 3px;
}

.wcs-panel {
    position: absolute;
    right: 0;
    bottom: 70px;
    width: 360px;
    height: 520px;
    max-height: calc(100vh - 110px);
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(15, 23, 42, 0.18), 0 2px 8px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform-origin: bottom right;
    animation: wcs-pop 0.18s ease-out;
}

.wcs-panel[hidden] {
    display: none;
}

@keyframes wcs-pop {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(6px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.wcs-header {
    background: linear-gradient(135deg, #07c160, #05a34e);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex: 0 0 auto;
}

.wcs-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wcs-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 15px;
}

.wcs-header-title {
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
}

.wcs-header-status {
    font-size: 12px;
    opacity: 0.82;
    margin-top: 2px;
}

.wcs-close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
    opacity: 0.85;
}

.wcs-close:hover {
    opacity: 1;
}

.wcs-messages {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 16px 14px;
    background: #f6f7f8;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wcs-msg {
    display: flex;
}

.wcs-msg-bot {
    justify-content: flex-start;
}

.wcs-msg-user {
    justify-content: flex-end;
}

.wcs-bubble {
    max-width: 84%;
    padding: 9px 12px;
    border-radius: 12px;
    background: #fff;
    color: #1f2329;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.06);
    white-space: pre-wrap;
    word-break: break-word;
}

.wcs-msg-bot .wcs-bubble {
    border-top-left-radius: 4px;
}

.wcs-msg-user .wcs-bubble {
    background: #07c160;
    color: #fff;
    border-top-right-radius: 4px;
}

.wcs-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 13px 14px;
}

.wcs-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #9aa3ad;
    animation: wcs-bounce 1.2s infinite ease-in-out;
}

.wcs-typing span:nth-child(2) {
    animation-delay: 0.15s;
}

.wcs-typing span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes wcs-bounce {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    40% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

.wcs-result-head {
    font-weight: 600;
    margin-bottom: 2px;
}

.wcs-result-meta {
    color: #6b7280;
    font-size: 12px;
    margin-bottom: 8px;
}

.wcs-item {
    border-top: 1px dashed #e5e7eb;
    padding-top: 8px;
    margin-top: 8px;
}

.wcs-item:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.wcs-item-title {
    font-weight: 600;
    margin-bottom: 6px;
}

.wcs-link-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
}

.wcs-download {
    display: inline-block;
    background: #e8f8ef;
    color: #067a3d;
    text-decoration: none;
    padding: 4px 9px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.4;
}

.wcs-download:hover {
    background: #d5f2e2;
    color: #05602f;
}

.wcs-code {
    font-size: 12px;
    color: #4b5563;
}

.wcs-code code {
    background: #eef1f4;
    border-radius: 4px;
    padding: 1px 5px;
    font-size: 12px;
    color: #111827;
}

.wcs-copy {
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    border-radius: 6px;
    padding: 2px 7px;
    font-size: 12px;
    cursor: pointer;
    line-height: 1.5;
}

.wcs-copy:hover {
    border-color: #07c160;
    color: #067a3d;
}

.wcs-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-width: 92%;
    align-self: flex-start;
    margin-top: 2px;
}

.wcs-quick-reply {
    border: 1px solid #07c160;
    background: #fff;
    color: #067a3d;
    border-radius: 14px;
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    font-family: inherit;
}

.wcs-quick-reply:hover {
    background: #e8f8ef;
}

.wcs-bubble a {
    color: #067a3d;
    text-decoration: underline;
    word-break: break-all;
}

.wcs-muted {
    color: #9aa3ad;
    font-size: 13px;
}

.wcs-html {
    font-size: 13px;
}

.wcs-html a {
    color: #067a3d;
}

.wcs-form {
    flex: 0 0 auto;
    display: flex;
    gap: 8px;
    padding: 10px 12px 6px;
    border-top: 1px solid #eef0f2;
    background: #fff;
}

.wcs-form textarea {
    flex: 1 1 auto;
    resize: none;
    border: 1px solid #dfe3e8;
    border-radius: 10px;
    padding: 9px 11px;
    font-size: 14px;
    line-height: 1.4;
    max-height: 88px;
    outline: none;
    font-family: inherit;
}

.wcs-form textarea:focus {
    border-color: #07c160;
    box-shadow: 0 0 0 3px rgba(7, 193, 96, 0.12);
}

.wcs-form button {
    flex: 0 0 auto;
    border: 0;
    background: #07c160;
    color: #fff;
    border-radius: 10px;
    padding: 0 16px;
    font-size: 14px;
    cursor: pointer;
}

.wcs-form button:hover {
    background: #06ad56;
}

.wcs-form button.wcs-disabled,
.wcs-form button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.wcs-hint {
    flex: 0 0 auto;
    padding: 0 12px 10px;
    font-size: 11px;
    color: #9aa3ad;
    text-align: center;
    background: #fff;
}

@media (max-width: 480px) {
    .wcs-widget {
        right: 12px;
        bottom: 12px;
    }

    .wcs-panel {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 76px;
        width: auto;
        height: calc(100vh - 100px);
        max-height: 720px;
        display: none;
    }

    .wcs-panel.wcs-panel-open {
        display: flex;
    }

    .wcs-bubble {
        max-width: 88%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .wcs-panel,
    .wcs-launcher,
    .wcs-typing span {
        animation: none;
        transition: none;
    }
}
