.tianxiaozhi-launcher {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 1000;
    width: 56px;
    height: 56px;
    border: 3px solid #fff;
    border-radius: 50%;
    padding: 0;
    overflow: hidden;
    background: #dcfce7;
    box-shadow: 0 10px 24px rgba(21, 128, 61, 0.3);
    cursor: pointer;
    touch-action: none;
    user-select: none;
    transition: transform 0.2s ease, background 0.2s ease;
}

.tianxiaozhi-launcher:hover {
    background: #166534;
    transform: translateY(-2px);
}

.tianxiaozhi-avatar {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.tianxiaozhi-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
    animation: tianxiaozhi-fade-in 0.2s ease-out;
}

.tianxiaozhi-backdrop[hidden] {
    display: none;
}

.tianxiaozhi-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    width: min(420px, calc(100vw - 32px));
    height: min(640px, calc(100vh - 64px));
    overflow: hidden;
    border: 1px solid #bbf7d0;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.35);
    transform-origin: center;
    animation: tianxiaozhi-in 0.22s ease-out;
}

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

.tianxiaozhi-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    color: #166534;
    background: linear-gradient(110deg, #ecfdf5, #f7fee7);
    border-bottom: 1px solid #dcfce7;
}

.tianxiaozhi-title {
    font-size: 16px;
    font-weight: 700;
}

.tianxiaozhi-subtitle {
    margin-top: 3px;
    color: #65a30d;
    font-size: 12px;
    font-weight: 400;
}

.tianxiaozhi-close {
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    color: #166534;
    background: transparent;
    cursor: pointer;
    font-size: 20px;
}

.tianxiaozhi-close:hover {
    background: rgba(22, 101, 52, 0.1);
}

.tianxiaozhi-messages {
    flex: 1;
    min-height: 0;
    padding: 16px;
    overflow-y: auto;
    background: #fcfffb;
}

.tianxiaozhi-message {
    max-width: 86%;
    margin-bottom: 10px;
    padding: 9px 11px;
    border-radius: 11px;
    color: #334155;
    background: #f0fdf4;
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.tianxiaozhi-message.user {
    margin-left: auto;
    color: #fff;
    background: #15803d;
}

.tianxiaozhi-form {
    display: flex;
    gap: 8px;
    padding: 11px;
    border-top: 1px solid #ecfdf5;
    background: #fff;
}

.tianxiaozhi-input {
    min-width: 0;
    min-height: 38px;
    flex: 1;
    resize: none;
    border: 1px solid #bbf7d0;
    border-radius: 9px;
    padding: 9px 10px;
    outline: none;
    color: #334155;
    font: 13px/1.4 "Microsoft Yahei", "PingFang SC", sans-serif;
}

.tianxiaozhi-input:focus {
    border-color: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}

.tianxiaozhi-send {
    align-self: flex-end;
    min-width: 52px;
    height: 38px;
    border: 0;
    border-radius: 9px;
    color: #fff;
    background: #15803d;
    cursor: pointer;
    font-size: 13px;
}

.tianxiaozhi-send:disabled {
    cursor: wait;
    opacity: 0.55;
}

@keyframes tianxiaozhi-in {
    from { opacity: 0; transform: translate(-50%, -50%) scale(0.94); }
    to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes tianxiaozhi-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 600px) {
    .tianxiaozhi-launcher {
        right: 12px;
        bottom: 12px;
    }

    .tianxiaozhi-panel {
        top: 0;
        left: 0;
        transform: none;
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    @keyframes tianxiaozhi-in {
        from { opacity: 0; transform: scale(0.98); }
        to { opacity: 1; transform: scale(1); }
    }
}
