/* Mewna浮动助手 - 常驻在输入框右边 */
.mewna-floating-container {
    position: fixed;
    bottom: -150px;
    right: -40px;
    z-index: 9999;
    cursor: move;
    width: 520px;
    height: 550px;
    pointer-events: none;
}

.mewna-floating-container > * {
    pointer-events: auto;
}

.mewna-floating-container.dragging {
    cursor: grabbing;
}

.mewna-floating-container.dragging .mewna-character {
    animation: none;
}

.mewna-character {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 675px;
    height: 700px;
    cursor: grab;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
    object-fit: contain;
    animation: gentle-float 4s ease-in-out infinite;
    z-index: 1;
    background-color: transparent;
    
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
}

.mewna-character:active {
    cursor: grabbing;
}

/* 主视频默认显示 */
.mewna-video-primary {
    display: block;
}

/* 副视频默认隐藏 */
.mewna-video-secondary {
    display: none;
}


@keyframes gentle-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(0); }
}

.mewna-character:hover {
    transform: scale(1.05) translateY(-5px);
}

.mewna-character.talking {
    animation: bounce 0.8s ease infinite;
}

.mewna-character.thinking {
    animation: sway 1.5s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(0); }
}

@keyframes sway {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

/* 气泡对话框 - 显示在右上方 */
.mewna-speech-bubble {
    position: absolute;
    bottom: 420px;
    right: 480px;
    background: white;
    padding: 15px 20px;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    max-width: 350px;
    min-width: 250px;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 10000;
}

/* ========== Dark Mode 主题支持 (蓝色主题) ========== */
html.dark-mode .mewna-speech-bubble {
    background: rgba(15, 26, 48, 0.98);
    color: #e8e8e8;
    border: 2px solid #89CFF0;
    box-shadow: 0 8px 30px rgba(137, 207, 240, 0.3);
}

.mewna-speech-bubble.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.mewna-speech-bubble::after {
    content: '';
    position: absolute;
    bottom: -10px;
    right: 60px;
    width: 0;
    height: 0;
    border-left: 15px solid transparent;
    border-right: 15px solid transparent;
    border-top: 15px solid white;
}

html.dark-mode .mewna-speech-bubble::after {
    border-top-color: rgba(15, 26, 48, 0.98);
}

.mewna-speech-text {
    font-size: 14px;
    line-height: 1.6;
    white-space: pre-line;
}

/* 聊天对话框 - 点击打开 */
.mewna-chat-dialog {
    position: fixed;
    bottom: 20px;
    right: calc(25% + 10px);
    width: 400px;
    height: 500px;
    background: var(--container-bg, white);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    display: none;
    flex-direction: column;
    z-index: 10001;
    animation: slideUp 0.3s ease;
}

html.dark-mode .mewna-chat-dialog {
    background: rgba(15, 26, 48, 0.98);
    border: 2px solid #89CFF0;
    box-shadow: 0 20px 60px rgba(137, 207, 240, 0.4);
}

html.dark-mode .mewna-chat-header {
    background: linear-gradient(135deg, #89CFF0 0%, #4A90E2 100%);
}

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

.mewna-chat-dialog.active {
    display: flex;
}

.mewna-chat-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mewna-chat-header h3 {
    font-size: 18px;
    margin: 0;
}

.mewna-close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.mewna-close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

/* 快捷按钮区域 */
.mewna-quick-buttons {
    padding: 15px 20px 10px 20px;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    border-bottom: 1px solid var(--border-color, #e1e5e9);
}

.mewna-quick-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mewna-quick-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.mewna-quick-btn-placeholder {
    visibility: hidden;
}

.mewna-next-page-btn {
    background: rgba(102, 126, 234, 0.15) !important;
    color: #667eea !important;
    border: 1px solid rgba(102, 126, 234, 0.35) !important;
    font-size: 16px !important;
}

.mewna-next-page-btn:hover {
    background: rgba(102, 126, 234, 0.3) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.25) !important;
}

html.dark-mode .mewna-next-page-btn {
    background: rgba(137, 207, 240, 0.12) !important;
    color: #89CFF0 !important;
    border: 1px solid rgba(137, 207, 240, 0.3) !important;
}

html.dark-mode .mewna-next-page-btn:hover {
    background: rgba(137, 207, 240, 0.25) !important;
}

html.dark-mode .mewna-quick-buttons {
    border-bottom-color: #4A90E2;
}

html.dark-mode .mewna-quick-btn {
    background: linear-gradient(135deg, #89CFF0 0%, #4A90E2 100%);
}

.mewna-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--file-item-bg, #f8f9fa);
}

html.dark-mode .mewna-chat-messages {
    background: #151A30;
}

html.dark-mode .mewna-message.user .mewna-message-bubble {
    background: linear-gradient(135deg, #89CFF0 0%, #4A90E2 100%);
    color: white;
}

.mewna-message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

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

.mewna-message.user {
    text-align: right;
}

.mewna-message-bubble {
    display: inline-block;
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    word-wrap: break-word;
    font-size: 14px;
}

.mewna-message.user .mewna-message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.mewna-message.ai .mewna-message-bubble {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

html.dark-mode .mewna-message.ai .mewna-message-bubble {
    background: rgba(26, 26, 46, 0.8);
    color: #e8e8e8;
    border: 2px solid #89CFF0;
}

.mewna-chat-input-area {
    padding: 15px 20px;
    border-top: 2px solid var(--border-color, #e0e0e0);
    display: flex;
    gap: 10px;
}

html.dark-mode .mewna-chat-input-area {
    border-color: #4A90E2;
}

.mewna-chat-input-area input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 25px;
    background: var(--input-bg, white);
    color: var(--text-primary, #333);
    font-size: 14px;
}

html.dark-mode .mewna-chat-input-area input {
    background: rgba(26, 26, 46, 0.8);
    color: #e8e8e8;
    border: 2px solid #89CFF0;
}

html.dark-mode .mewna-chat-input-area input:focus {
    border-color: #89CFF0;
    box-shadow: 0 0 0 3px rgba(137, 207, 240, 0.1);
}

html.dark-mode .mewna-send-btn {
    background: linear-gradient(135deg, #89CFF0 0%, #4A90E2 100%);
}

.mewna-chat-input-area input:focus {
    outline: none;
    border-color: #667eea;
}

.mewna-send-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
}

.mewna-send-btn:hover {
    transform: scale(1.05);
}

.mewna-send-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.mewna-quick-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

html.dark-mode .mewna-quick-btns {
    border-color: #4A90E2;
}

html.dark-mode .mewna-quick-btn {
    background: rgba(26, 26, 46, 0.8);
    border: 2px solid #89CFF0;
    color: #89CFF0;
}

html.dark-mode .mewna-quick-btn:hover {
    background: #89CFF0;
    color: #151A30;
}

.mewna-quick-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid #667eea;
    color: #667eea;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.mewna-quick-btn:hover {
    background: #667eea;
    color: white;
}

/* 快速输入框 - 常驻在Mewna左边 - 可爱风格（黑+粉蓝） */
.mewna-quick-input-wrapper {
    position: absolute;
    right: calc(100% - 20px);
    bottom: 200px;
    z-index: 10;
}

.mewna-quick-input-box {
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: 2px solid #89CFF0;
    border-radius: 30px;
    padding: 8px 12px 8px 18px;
    box-shadow: 0 10px 40px rgba(137, 207, 240, 0.3);
    min-width: 300px;
    transition: all 0.3s ease;
}

.mewna-quick-input-box:hover {
    box-shadow: 0 12px 50px rgba(137, 207, 240, 0.5);
    border-color: #B5E8FF;
}

html.dark-mode .mewna-quick-input-box {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

.mewna-quick-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    color: #e8e8e8;
    font-size: 14px;
    padding: 8px;
}

html.dark-mode .mewna-quick-input {
    color: #e8e8e8;
}

.mewna-quick-input::placeholder {
    color: #89CFF0;
    opacity: 0.7;
}

.mewna-quick-send-btn {
    background: linear-gradient(135deg, #89CFF0 0%, #B5E8FF 100%);
    color: #1a1a2e;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    font-size: 20px;
    box-shadow: 0 4px 15px rgba(137, 207, 240, 0.4);
}

.mewna-quick-send-btn:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 6px 25px rgba(137, 207, 240, 0.6);
    background: linear-gradient(135deg, #B5E8FF 0%, #89CFF0 100%);
}

.mewna-quick-send-btn:active {
    transform: scale(0.95);
}

/* ========== Light Mode 主题支持 (粉色主题) ========== */
html.light-mode .mewna-speech-bubble {
    background: rgba(255, 255, 255, 0.98);
    color: #2a2a2a;
    border: 2px solid #FF69B4;
    box-shadow: 0 8px 30px rgba(255, 105, 180, 0.3);
}

html.light-mode .mewna-speech-bubble::after {
    border-top-color: rgba(255, 255, 255, 0.98);
}

html.light-mode .mewna-chat-dialog {
    background: rgba(255, 255, 255, 0.98);
    border: 2px solid #FF69B4;
    box-shadow: 0 20px 60px rgba(255, 105, 180, 0.4);
}

html.light-mode .mewna-chat-header {
    background: linear-gradient(135deg, #FF69B4 0%, #FFB6D9 100%);
}

html.light-mode .mewna-quick-buttons {
    border-bottom-color: #FFB6D9;
}

html.light-mode .mewna-quick-btn {
    background: linear-gradient(135deg, #FF69B4 0%, #FFB6D9 100%);
}

html.light-mode .mewna-chat-messages {
    background: #FBFBFB;
}

html.light-mode .mewna-message.user .mewna-message-bubble {
    background: linear-gradient(135deg, #FF69B4 0%, #FFB6D9 100%);
    color: white;
}

html.light-mode .mewna-message.ai .mewna-message-bubble {
    background: white;
    color: #2a2a2a;
    border: 2px solid #FF69B4;
}

html.light-mode .mewna-chat-input-area {
    border-color: #FFB6D9;
}

html.light-mode .mewna-chat-input-area input {
    background: white;
    color: #2a2a2a;
    border: 2px solid #FF69B4;
}

html.light-mode .mewna-chat-input-area input:focus {
    border-color: #FF69B4;
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

html.light-mode .mewna-send-btn {
    background: linear-gradient(135deg, #FF69B4 0%, #FFB6D9 100%);
}

html.light-mode .mewna-quick-btns {
    border-color: #FFB6D9;
}

html.light-mode .mewna-quick-btn {
    background: white;
    border: 2px solid #FF69B4;
    color: #FF69B4;
}

html.light-mode .mewna-quick-btn:hover {
    background: #FF69B4;
    color: white;
}

html.light-mode .mewna-quick-input-box {
    background: linear-gradient(135deg, #FFE4F0 0%, #FFF0F7 100%);
    border: 2px solid #FF69B4;
    box-shadow: 0 10px 40px rgba(255, 105, 180, 0.3);
}

html.light-mode .mewna-quick-input-box:hover {
    box-shadow: 0 12px 50px rgba(255, 105, 180, 0.5);
    border-color: #FFB6D9;
}

html.light-mode .mewna-quick-input {
    color: #2a2a2a;
}

html.light-mode .mewna-quick-input::placeholder {
    color: #FF69B4;
    opacity: 0.7;
}

html.light-mode .mewna-quick-send-btn {
    background: linear-gradient(135deg, #FF69B4 0%, #FFB6D9 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 105, 180, 0.4);
}

html.light-mode .mewna-quick-send-btn:hover {
    background: linear-gradient(135deg, #FFB6D9 0%, #FF69B4 100%);
    box-shadow: 0 6px 25px rgba(255, 105, 180, 0.6);
}

@media (max-width: 768px) {
    /* 手机端完全隐藏 Mewna 及相关对话框（避免透明度问题） */
    .mewna-floating-container {
        display: none !important;
    }
    
    .mewna-chat-dialog {
        display: none !important;
    }
    
    .mewna-speech-bubble {
        display: none !important;
    }
    
    .mewna-quick-input-wrapper {
        display: none !important;
    }
}
