.toggle-interaction-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-interaction-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

.toggle-interaction-btn img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.interaction-area {
    position: fixed !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90% !important;
    max-width: 600px !important;
    margin: 0 !important;
    display: none !important;
    flex-direction: column !important;
    justify-content: flex-start !important;
    gap: 2px !important;
    z-index: 20000 !important;
    pointer-events: none !important;
    transition: padding-bottom 0.3s ease, width 0.3s ease, left 0.3s ease, transform 0.3s ease !important;
}

/* 隐藏状态：夹在菜单之间（压缩） */
body:not(.interaction-visible) .interaction-area {
    top: var(--home-interaction-top, 130px) !important;
    bottom: var(--home-interaction-bottom, 100px) !important;
    height: auto !important;
    min-height: 0 !important;
}

/* 唤起状态：解除顶部约束，覆盖菜单，保证完整高度 */
body.interaction-visible .interaction-area {
    display: flex !important;
    pointer-events: auto !important;
    top: auto !important;
    bottom: 56px !important; /* 下移至底部导航上方 */
    height: auto !important;
    min-height: 480px !important;
    max-height: calc(100vh - 150px) !important;
    z-index: 20003 !important;
    overflow: visible !important;
}

body.interaction-visible .chat-container {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 !important;
    overflow-y: auto !important;
    min-height: 120px !important;
}

body.interaction-visible .voice-controls-wrapper {
    display: flex !important;
    flex-direction: column !important;
    flex: 0 0 auto !important;
    height: auto !important;
}

.chat-container {
    width: 100%;
    height: auto;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 40px;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px;
    position: relative;
    z-index: 10003;
    flex: 1 !important;
    min-width: 0;
    min-height: 120px;
    margin: 0;
    background: #ffffff !important;
    backdrop-filter: none !important;
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.system {
    align-self: flex-start;
}

.chat-message .message-content {
    padding: 2px 16px;
    border-radius: 18px;
    font-size: 0.85rem;
    line-height: 1.5;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    word-wrap: break-word;
}

.chat-message.user .message-content {
    background: linear-gradient(135deg, var(--primary-color) 0%, #6366f1 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.system .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    border: 1px solid #eee;
}

.keywords-wrapper {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    min-height: 30px;
}

.keyword-tag {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.voice-controls-wrapper {
    position: relative;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    padding: 8px; /* 缩小至原来的75% */
    background: #ffffff !important;
    backdrop-filter: none !important;
    border-radius: 24px;
    border: 1px solid rgba(0, 0, 0, 0.06) !important;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08) !important;
    z-index: 10004;
    max-width: none;
    width: 100%;
    flex: 0 0 auto;
    min-height: 0;
    height: auto;
}

.voice-controls-wrapper.text-mode {
    padding: 0 16px !important;
    justify-content: center !important;
    display: flex !important;
    flex-direction: column !important;
}

.controls-container {
    margin: 0;
    text-align: center;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 15px;
    width: 100%;
    pointer-events: auto;
    padding: 10px 0;
}

.mic-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}

.voice-controls-wrapper .status-text {
    font-size: 0.9rem;
    font-weight: 500;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mic-button {
    margin: 0 10px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(145deg, #ffffff 0%, #e8ecf3 100%);
    border: none;
    box-shadow: 
        8px 8px 20px rgba(166, 180, 200, 0.4),
        -6px -6px 16px rgba(255, 255, 255, 0.9),
        inset 0 2px 0 rgba(255, 255, 255, 0.9),
        inset 0 -2px 4px rgba(166, 180, 200, 0.15);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

.mic-button:hover {
    transform: translateY(-3px);
    box-shadow: 
        10px 10px 25px rgba(166, 180, 200, 0.45),
        -8px -8px 20px rgba(255, 255, 255, 0.95),
        inset 0 2px 0 rgba(255, 255, 255, 1),
        inset 0 -2px 4px rgba(166, 180, 200, 0.1);
}

.mic-button:hover ~ .status-text {
    transform: translateY(-3px);
}

.mic-button:active {
    transform: translateY(2px);
    box-shadow: 
        4px 4px 10px rgba(166, 180, 200, 0.35),
        -2px -2px 8px rgba(255, 255, 255, 0.8),
        inset 4px 4px 10px rgba(166, 180, 200, 0.2),
        inset -2px -2px 6px rgba(255, 255, 255, 0.6);
}

.mic-button:active ~ .status-text {
    transform: translateY(2px);
}

.mic-button.listening {
    background: linear-gradient(145deg, #ff7b7b 0%, #e85555 100%);
    animation: pulse 1.5s infinite;
    box-shadow: 
        0 8px 25px rgba(255, 107, 107, 0.5),
        0 4px 12px rgba(232, 85, 85, 0.4),
        inset 0 2px 0 rgba(255, 255, 255, 0.3),
        inset 0 -2px 6px rgba(180, 50, 50, 0.2);
}

.mic-button.listening:hover {
    box-shadow: 
        0 10px 30px rgba(255, 107, 107, 0.55),
        0 5px 15px rgba(232, 85, 85, 0.45),
        inset 0 2px 0 rgba(255, 255, 255, 0.35);
}

.mic-icon {
    width: 30px;
    height: 30px;
    fill: #555;
    transition: fill 0.3s;
}

.mic-button.listening .mic-icon {
    fill: white;
}

.mic-button.push-active {
    background: linear-gradient(145deg, #4CAF50 0%, #45a049 100%);
    transform: scale(1.1);
    box-shadow: 
        0 8px 25px rgba(76, 175, 80, 0.5),
        0 4px 12px rgba(69, 160, 73, 0.4);
}

.mic-button.push-active .mic-icon {
    fill: white;
}

.voice-mode-toggle {
    order: 1;
    margin: 0 10px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    font-size: 0.85rem;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.voice-mode-toggle:hover {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.voice-controls-wrapper .status-text {
    font-size: 0.9rem;
    font-weight: 500;
}

.voice-controls-wrapper .voice-mode-toggle {
    font-size: 0.9rem;
    padding: 8px 16px;
}

.voice-controls-wrapper .toggle-mode {
    font-size: 0.85rem;
}

.toggle-mode {
    order: 3;
    margin: 0 10px;
    font-size: 0.8rem;
    color: #666;
    text-decoration: underline;
    cursor: pointer;
    opacity: 0.6;
}

.input-group {
    display: none;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 320px;
}

.input-group.active {
    display: flex;
}

.text-input {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 0.95rem;
    color: #333;
    outline: none;
    transition: all 0.2s ease;
}

.text-input:focus {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 1);
}

.send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(110, 142, 251, 0.3);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(110, 142, 251, 0.4);
}

.send-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(110, 142, 251, 0.3);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 480px) {
    .interaction-area {
        width: 100% !important;
        max-width: none !important;
        left: 0 !important;
        transform: none !important;
        border-radius: 20px 20px 0 0 !important;
        bottom: var(--interaction-bottom, 80px) !important;
        z-index: 20000 !important;
        background: rgba(255, 255, 255, 0.98) !important;
        box-shadow: 0 -10px 40px rgba(0,0,0,0.2) !important;
    }

    .chat-container {
        flex: 1;
        min-height: 0;
        width: 100%;
        overflow-y: auto;
        pointer-events: auto;
        max-height: none;
    }

    .voice-controls-wrapper {
        position: relative;
        flex: 0 0 auto;
        width: 100%;
        min-width: 0;
        max-width: 100%;
        z-index: 20001;
        padding: 2px 8px !important; /* 移动端进一步缩小 */
        box-sizing: border-box;
    }

    .voice-controls-wrapper .mic-icon {
        width: 24px;
        height: 24px;
    }

    .voice-controls-wrapper .avatar-container {
        width: 1px;
        height: 1px;
    }

    .voice-controls-wrapper .avatar-core {
        width: 0.5px;
        height: 0.5px;
    }

    .controls-container {
        margin-top: auto !important;
        margin-bottom: auto !important;
    }

    .mic-group {
        gap: 0 !important;
    }

    .mic-button {
        order: 0 !important;
        width: 36px !important; /* 缩小至75% */
        height: 36px !important;
    }

    .voice-controls-wrapper .status-text {
        order: 1 !important;
        font-size: 12px !important;
    }

    .mic-group {
        flex-direction: column !important;
        gap: 0 !important; /* 进一步缩小间距 */
    }

    .voice-mode-toggle {
        margin: 0 2px !important;
        padding: 2px 6px !important; /* 缩小内边距 */
        font-size: 11px !important;
    }

    .toggle-mode {
        margin: 0 3px !important;
        font-size: 11px !important;
    }
}
