@media (max-aspect-ratio: 1/1) {
    body {
        flex-direction: column;
        align-items: stretch;
    }

    .main-wrapper {
        flex-direction: column;
        width: 100%;
        gap: 10px;
        max-width: none;
    }

    .container {
        max-width: 100%;
    }

    #chatPanelContainer {
        position: fixed;
        top: 10%;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        transform: translateY(100%);
        overflow: hidden;
        transition: transform 0.3s ease;
        border-radius: 15px 15px 0 0;
        z-index: 1000;
        background: white;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
        display: flex;
        flex-direction: column;
    }

    #chatPanelContainer.hidden {
        display: flex !important;
        transform: translateY(100%);
    }

    #chatPanelContainer.open {
        transform: translateY(0);
    }

    #chatToggle {
        display: flex;
        align-items: center;
        justify-content: center;
        height: 44px;
        min-height: 44px;
        background: white;
        border-bottom: 1px solid #e2e8f0;
        border-radius: 15px 15px 0 0;
        cursor: pointer;
        order: -1;
    }

    #chatToggle i {
        transition: transform 0.3s;
    }

    #chatPanelContainer.open #chatToggle i {
        transform: rotate(180deg);
    }

    .chat-panel {
        height: calc(90vh - 44px);
        display: flex;
        flex-direction: column;
        flex: 1;
    }

    .chat-messages {
        flex: 1;
        overflow-y: auto;
        max-height: none;
    }

    /* 移动端音量滑块通过点击显示 */
    .volume-wrapper:hover .user-volume-slider {
        display: none;
    }

    .volume-wrapper.show-slider .user-volume-slider {
        display: flex;
    }

    /* 底部浮动按钮 */
    .mobile-chat-fab {
        position: fixed;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        width: 160px;
        height: 44px;
        border-radius: 22px;
        background: white;
        color: #667eea;
        border: 1px solid #e2e8f0;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
        cursor: pointer;
        z-index: 999;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 20px;
        transition: opacity 0.25s ease, transform 0.25s ease;
        opacity: 1;
    }

    .mobile-chat-fab.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translateX(-50%) translateY(20px);
    }

    .mobile-chat-fab.desktop-hidden {
        display: none;
    }
}

/* 桌面端隐藏移动端特有元素 */
@media not all and (max-aspect-ratio: 1/1) {
    .mobile-chat-fab {
        display: none !important;
    }
}
