/* ==================== 全局样式重置 ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    background: #1a1d23;
    /* 设置深色背景，避免白边 */
}

/* 移动端安全区域处理 */
@supports (padding: env(safe-area-inset-bottom)) {
    body {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .control-bar {
        bottom: calc(20px + env(safe-area-inset-bottom));
    }
}

/* ==================== 背景容器 ==================== */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-image: url('../images/2.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.5s ease-in-out;
    z-index: -2;
}

.background-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    z-index: -1;
}

/* ==================== 主容器 ==================== */
.container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    /* 从底部开始排列 */
    padding: 20px;
    padding-bottom: 0;
    /* 移除底部padding，让模型可以延伸到页面底部 */
}

/* ==================== 模型加载区 ==================== */
.model-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300px;
    height: 200px;
    transform: translate(-50%, -50%);
    user-select: none;
}

.model-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 999;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
    background-image: linear-gradient(transparent 50%, rgba(88, 101, 242, 0.05) 50%);
    background-size: 100% 4px;
    animation: scan 1.26s linear infinite;
}

.loading-char-float {
    font-size: 22px;
    letter-spacing: 3px;
    position: relative;
}

.loading-char-float .main-char {
    color: #f0f8ff;
    text-shadow: 0 0 5px #5865f2, 0 0 10px rgba(88, 101, 242, 0.8);
    display: inline-block;
}

.loading-char-float .main-char span {
    animation: char-float 1.26s ease-in-out infinite;
    display: inline-block;
}

.loading-char-float .shadow-char {
    position: absolute;
    top: 3px;
    left: 0;
    color: rgba(88, 101, 242, 0.3);
    pointer-events: none;
    animation: shadow-float 1.26s ease-in-out infinite;
}

.loading-char-float .main-char span:nth-child(1) { animation-delay: 0s; }
.loading-char-float .main-char span:nth-child(2) { animation-delay: 0.11s; }
.loading-char-float .main-char span:nth-child(3) { animation-delay: 0.22s; }
.loading-char-float .main-char span:nth-child(4) { animation-delay: 0.33s; }
.loading-char-float .main-char span:nth-child(5) { animation-delay: 0.44s; }
.loading-char-float .main-char span:nth-child(6) { animation-delay: 0.55s; }

@keyframes scan {
    0% { background-position: 0 0; }
    100% { background-position: 0 100px; }
}

@keyframes char-float {
    0%, 100% { transform: translateY(0); opacity: 1; text-shadow: 0 0 5px #5865f2, 0 0 10px rgba(88, 101, 242, 0.8); }
    50% { transform: translateY(-5px); opacity: 0.9; text-shadow: 0 0 10px #5865f2, 0 0 20px rgba(88, 101, 242, 0.8); }
}

@keyframes shadow-float {
    0%, 100% { transform: translateY(3px); opacity: 0.3; }
    50% { transform: translateY(8px); opacity: 0.15; }
}

/* ==================== Live2D显示区域（居中显示） ==================== */
#live2d-stage {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    pointer-events: auto;
    /* 移除max-width/max-height限制，让PIXI应用完全控制canvas尺寸 */
}

/* 平板端优化 */
@media (max-width: 768px) {
    #live2d-stage {
        /* 不再需要CSS限制，由PIXI应用处理 */
    }
}

/* 手机端优化 */
@media (max-width: 480px) {
    #live2d-stage {
        /* 不再需要CSS限制，由PIXI应用处理 */
    }
}

/* 小屏手机优化 */
@media (max-width: 375px) {
    #live2d-stage {
        /* 不再需要CSS限制，由PIXI应用处理 */
    }

    /* 调整聊天容器，在小屏上更紧凑 */
    .chat-container {
        bottom: 80px;
        right: 5px;
        max-width: 160px;
    }

    .chat-stream {
        width: 160px;
        max-height: 100px;
    }

    .message-bubble {
        max-width: 150px;
        font-size: 11px;
        padding: 6px 10px;
    }

    /* 控制栏更紧凑，考虑安全区域 */
    .control-bar {
        padding: 5px 10px;
        gap: 6px;
        bottom: calc(5px + env(safe-area-inset-bottom, 0px));
    }

    .control-btn {
        width: 42px;
        height: 42px;
    }
}

/* 竖屏模式优化 */
@media (max-height: 700px) and (orientation: portrait) {
    /* canvas尺寸由PIXI应用控制，不需要CSS限制 */
}

.status-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    padding: 8px 16px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 10;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.status-disconnected {
    background-color: #f44336;
}

.status-connecting {
    background-color: #ff9800;
}

.status-connected {
    background-color: #4caf50;
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ==================== 聊天消息流（弹幕样式） ==================== */
.chat-container {
    position: absolute;
    bottom: 150px;
    right: 20px;
    z-index: 100;
}

.chat-stream {
    width: 300px;
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
    margin-bottom: 10px;
}

.chat-ipt {
    width: 100%;
    display: none;
    justify-content: center;
    margin-top: 10px;
}

.chat-ipt input {
    width: 100%;
    padding: 12px 16px;
    border: none;
    border-radius: 24px;
    background: rgba(35, 39, 42, 0.85);
    backdrop-filter: blur(10px);
    color: white;
    font-size: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.chat-ipt input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.chat-ipt input:focus {
    outline: none;
    border-color: rgba(88, 101, 242, 0.6);
    box-shadow: 0 4px 16px rgba(88, 101, 242, 0.3);
    background: rgba(45, 49, 52, 0.9);
}

.chat-message {
    animation: slideInRight 0.3s ease-out;
    pointer-events: auto;
}

.chat-message.ai .message-bubble {
    background: transparent;
    color: white;
    align-self: flex-end;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.chat-message.user .message-bubble {
    background: rgba(88, 101, 242, 0.7);
    color: white;
    align-self: flex-start;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.chat-message.system .message-bubble {
    background: transparent;
    color: #b9bbbe;
    align-self: center;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.message-bubble {
    padding: 8px 12px;
    border-radius: 18px;
    font-size: 14px;
    max-width: 250px;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
    }
}

/* ==================== 底部控制栏 ==================== */
.control-bar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 16px;
    background: rgba(35, 39, 42, 0.9);
    backdrop-filter: blur(20px);
    padding: 12px 24px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    /* 确保控制栏在最上层 */
}

.control-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border: none;
    border-radius: 50%;
    background: rgba(79, 84, 92, 0.8);
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.control-btn:hover {
    background: rgba(114, 137, 218, 0.8);
    transform: translateY(-2px);
}

.control-btn:active {
    transform: translateY(0);
}

.control-btn:disabled {
    background: rgba(79, 84, 92, 0.4);
    color: rgba(255, 255, 255, 0.4);
    cursor: not-allowed;
    transform: none;
}

.control-btn:disabled:hover {
    background: rgba(79, 84, 92, 0.4);
    transform: none;
}

.btn-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 4px;
}

.btn-text {
    font-size: 12px;
    font-weight: 500;
}

/* 拨号按钮特殊样式 */
.dial-btn.dial-active {
    background: rgba(237, 66, 69, 0.9);
}

.dial-btn.dial-active:hover {
    background: rgba(237, 66, 69, 1);
}

/* 录音按钮特殊样式 */
.control-btn.recording {
    background: rgba(237, 66, 69, 0.9);
    animation: pulse 1.5s infinite;
}

.control-btn.recording:hover {
    background: rgba(237, 66, 69, 1);
}

/* 录音按钮脉冲动画 */
@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(237, 66, 69, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(237, 66, 69, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(237, 66, 69, 0);
    }
}

/* ==================== 弹窗样式 ==================== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #36393f;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalSlideIn 0.3s ease-out;
}

.settings-modal {
    max-width: 700px;
    max-height: 85vh;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #40444b;
    background: #2f3136;
}

.modal-header h2 {
    color: white;
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    color: #b9bbbe;
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background: #40444b;
    color: white;
}

.modal-body {
    padding: 24px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

/* ==================== 输入组样式 ==================== */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #b9bbbe;
    font-size: 14px;
    font-weight: 500;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #40444b;
    border-radius: 6px;
    background: #40444b;
    color: white;
    font-size: 14px;
    transition: border-color 0.2s;
}

.input-group input:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #5865f2;
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

/* ==================== 按钮样式 ==================== */
.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* ==================== 文件协议警告样式 ==================== */
#fileProtocolWarning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 95%;
    max-width: 800px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.95), rgba(56, 142, 60, 0.95));
    border: 3px solid #4caf50;
    border-radius: 16px;
    padding: 32px;
    z-index: 10000;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(15px);
    color: white;
    font-family: inherit;
    animation: fadeInUp 0.5s ease-out;
}

#fileProtocolWarning h2 {
    color: #e8f5e8;
    margin-bottom: 20px;
    font-size: 28px;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

#fileProtocolWarning p {
    margin-bottom: 16px;
    line-height: 1.6;
    font-size: 16px;
    color: #e8f5e8;
}

#fileProtocolWarning ol {
    margin: 16px 0;
    padding-left: 24px;
    font-size: 16px;
}

#fileProtocolWarning pre {
    background: rgba(255, 255, 255, 0.15);
    padding: 12px 16px;
    border-radius: 8px;
    margin: 12px 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

#fileProtocolWarning strong {
    color: #c8e6c9;
    font-weight: 600;
}

/* 背景模糊遮罩 */
.file-protocol-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

/* 动画效果 */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* ==================== 连接信息样式 ==================== */
.connection-info {
    margin-top: 20px;
    padding: 16px;
    background: rgba(88, 101, 242, 0.1);
    border: 1px solid rgba(88, 101, 242, 0.3);
    border-radius: 8px;
    text-align: center;
}

.connection-info p {
    color: #b9bbbe;
    font-size: 14px;
    line-height: 1.4;
    margin: 0;
}

.btn-primary {
    background: #5865f2;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background: #4752c4;
}

.btn-secondary {
    background: #4f545c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-secondary:hover {
    background: #5d6269;
}

/* ==================== 设置标签页样式 ==================== */
.settings-tabs {
    display: flex;
    border-bottom: 1px solid #40444b;
    margin-bottom: 20px;
}

.tab-btn {
    background: none;
    border: none;
    color: #b9bbbe;
    padding: 12px 24px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.tab-btn.active {
    color: white;
    border-bottom-color: #5865f2;
}

.tab-btn:hover:not(.active) {
    color: white;
    background: #40444b;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ==================== 配置面板样式 ==================== */
.config-panel {
    background: #2f3136;
    border-radius: 8px;
    padding: 20px;
}

.config-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.config-item {
    flex: 1;
}

.config-item label {
    display: block;
    margin-bottom: 6px;
    color: #b9bbbe;
    font-size: 12px;
    font-weight: 500;
}

.config-item input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #40444b;
    border-radius: 4px;
    background: #40444b;
    color: white;
    font-size: 14px;
}

.config-item input:focus {
    outline: none;
    border-color: #7289da;
}

.config-item select {
    width: 100%;
    padding: 8px 30px 8px 12px;
    border: 1px solid #40444b;
    border-radius: 4px;
    background: #40444b;
    color: white;
    font-size: 14px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23b9bbbe' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.config-item select:hover {
    border-color: #7289da;
}

.config-item select:focus {
    outline: none;
    border-color: #7289da;
    box-shadow: 0 0 0 2px rgba(114, 137, 218, 0.2);
}

.config-item select option {
    background: #40444b;
    color: white;
    padding: 8px;
}

.config-item select option:hover {
    background: #4f545c;
}

.config-item select option:checked {
    background: #7289da;
    color: white;
}

.config-item select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.config-item button.btn-small {
    width: 100%;
    padding: 8px 16px;
    font-size: 14px;
    background: #4f545c;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.config-item button.btn-small:hover {
    background: #7289da;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(114, 137, 218, 0.3);
}

.config-item button.btn-small:active {
    background: #5b6eae;
    transform: translateY(0);
    box-shadow: none;
}

.config-item button.btn-small:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ==================== 连接模式面板样式 ==================== */
    width: 100%;
    padding: 8px 16px;
    font-size: 14px;
    background: #4f545c;
    border: none;
    border-radius: 4px;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.config-item button.btn-small:hover {
    background: #7289da;
    transform: translateY(-1px);
}

.config-item button.btn-small:active {
    background: #5b6eae;
    transform: translateY(0);
}

/* ==================== 连接模式面板样式 ==================== */
.connection-mode-panel {
    background: #2f3136;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.mode-label {
    color: #b9bbbe;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 0;
    white-space: nowrap;
}

.mode-switch {
    display: flex;
    gap: 8px;
    background: #40444b;
    padding: 4px;
    border-radius: 8px;
}

.mode-option {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.mode-option input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}

.mode-option span {
    color: #b9bbbe;
    font-size: 14px;
    user-select: none;
}

.mode-option:hover {
    background: rgba(88, 101, 242, 0.1);
}

.mode-option input[type="radio"]:checked + span {
    color: white;
    font-weight: 500;
}

.mode-option:has(input[type="radio"]:checked) {
    background: rgba(88, 101, 242, 0.2);
}

/* ==================== 连接控制面板样式 ==================== */
.connection-controls {
    background: #2f3136;
    border-radius: 8px;
    padding: 20px;
}

/* ==================== MCP工具样式 ==================== */
.mcp-tools-container {
    background: #2f3136;
    border-radius: 8px;
    padding: 0;
    overflow: hidden;
}

.mcp-tools-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #36393f;
    border-bottom: 1px solid #40444b;
}

.mcp-tools-header h3 {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
}

.mcp-tools-panel {
    padding: 20px;
    transition: max-height 0.3s ease;
    overflow: hidden;
}

.mcp-tools-panel.expanded {
    max-height: 500px;
}

.mcp-tools-panel:not(.expanded) {
    max-height: 0;
    padding: 0 20px;
}

.mcp-tools-list {
    min-height: 200px;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 16px;
}

/* MCP工具卡片样式 */
.mcp-tool-card {
    background: #36393f;
    border: 1px solid #40444b;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    transition: background-color 0.2s;
}

.mcp-tool-card:hover {
    background: #40444b;
}

.mcp-tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mcp-tool-name {
    font-weight: 600;
    color: white;
    font-size: 14px;
}

.mcp-tool-actions {
    display: flex;
    gap: 8px;
}

.mcp-edit-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    background-color: #2196f3;
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.mcp-edit-btn:hover {
    background-color: #1976d2;
}

.mcp-delete-btn {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    background-color: #f44336;
    color: white;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
}

.mcp-delete-btn:hover {
    background-color: #d32f2f;
}

.mcp-tool-description {
    color: #b9bbbe;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 12px;
}

.mcp-tool-info {
    background: #2f3136;
    border-radius: 4px;
    padding: 8px;
}

.mcp-tool-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.mcp-tool-info-label {
    color: #b9bbbe;
    font-size: 12px;
}

.mcp-tool-info-value {
    color: white;
    font-size: 12px;
    font-weight: 500;
}

.mcp-actions {
    text-align: center;
}

.properties-container {
    background: #2f3136;
    border: 1px solid #40444b;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 12px;
}

.property-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.property-item input {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid #40444b;
    border-radius: 4px;
    background: #40444b;
    color: white;
    font-size: 12px;
}

.remove-property {
    background: #ed4245;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.remove-property:hover {
    background: #c03537;
}

/* ==================== 音频可视化器样式 ==================== */
.audio-visualizer {
    position: fixed;
    bottom: 100px;
    left: 20px;
    width: 200px;
    height: 60px;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 999;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .live2d-section {
        height: 60vh;
        margin-bottom: 10px;
    }

    .live2d-canvas {
        max-width: 300px;
        max-height: 450px;
    }

    .control-bar {
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        padding: 8px 16px;
        gap: 12px;
    }

    .control-btn {
        width: 50px;
        height: 50px;
    }

    .btn-icon {
        width: 20px;
        height: 20px;
    }

    .btn-text {
        font-size: 10px;
    }

    .chat-container {
        width: 230px;
        right: 10px;
        bottom: 105px;
    }

    .message-bubble {
        max-width: 200px;
        font-size: 12px;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .config-row {
        flex-direction: column;
        gap: 12px;
    }

    .audio-visualizer {
        width: 150px;
        height: 50px;
        left: 10px;
        bottom: 80px;
    }
}

@media (max-width: 480px) {
    .live2d-section {
        height: 50vh;
    }

    .live2d-canvas {
        max-width: 250px;
        max-height: 350px;
    }

    /* 调整聊天容器位置，避免遮挡Live2D */
    .chat-container {
        bottom: 85px;
        right: 5px;
        width: auto;
        max-width: 180px;
    }

    .chat-stream {
        width: 180px;
        max-height: 120px;
    }

    .control-bar {
        gap: 8px;
        padding: 6px 12px;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    .control-btn {
        width: 45px;
        height: 45px;
    }

    .btn-text {
        display: none;
    }

    .chat-stream {
        width: 200px;
        max-height: 150px;
    }

    .audio-visualizer {
        width: 120px;
        height: 40px;
        left: 5px;
        bottom: 70px;
    }
}

/* 竖屏优化 */
@media (max-height: 700px) {
    .live2d-section {
        height: 55vh;
    }

    .live2d-canvas {
        max-height: 400px;
    }

    .chat-stream {
        bottom: 70px;
        max-height: 150px;
    }

    .audio-visualizer {
        bottom: 70px;
    }
}

/* 横屏优化 */
@media (min-width: 1024px) and (min-height: 600px) {
    .live2d-section {
        height: 75vh;
    }

    .live2d-canvas {
        max-width: 500px;
        max-height: 650px;
    }

    .chat-stream {
        width: 350px;
        max-height: 250px;
    }

    .audio-visualizer {
        width: 250px;
        height: 80px;
    }
}

/* 滚动条样式 */
.chat-stream::-webkit-scrollbar,
.modal-body::-webkit-scrollbar,
.mcp-tools-list::-webkit-scrollbar {
    width: 6px;
}

.chat-stream::-webkit-scrollbar-track,
.modal-body::-webkit-scrollbar-track,
.mcp-tools-list::-webkit-scrollbar-track {
    background: #2f3136;
    border-radius: 3px;
}

.chat-stream::-webkit-scrollbar-thumb,
.modal-body::-webkit-scrollbar-thumb,
.mcp-tools-list::-webkit-scrollbar-thumb {
    background: #40444b;
    border-radius: 3px;
}

.chat-stream::-webkit-scrollbar-thumb:hover,
.modal-body::-webkit-scrollbar-thumb:hover,
.mcp-tools-list::-webkit-scrollbar-thumb:hover {
    background: #4f545c;
}

/* ==========================================
   摄像头预览窗口样式
   ========================================== */

.camera-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.camera-preview-container {
    background: #2f3136;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

.camera-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: #202225;
    border-bottom: 1px solid #40444b;
}

.camera-preview-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.camera-close-btn {
    background: none;
    border: none;
    color: #b9bbbe;
    font-size: 28px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.camera-close-btn:hover {
    background: #40444b;
    color: #ffffff;
}

.camera-preview-video {
    position: relative;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    min-width: 400px;
}

.camera-preview-video video {
    width: 100%;
    height: auto;
    max-height: 60vh;
    object-fit: contain;
}

.camera-preview-footer {
    padding: 16px 20px;
    background: #202225;
    border-top: 1px solid #40444b;
}

.camera-preview-status {
    margin: 0;
    text-align: center;
    font-size: 14px;
    color: #b9bbbe;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .camera-preview-container {
        max-width: 95vw;
    }

    .camera-preview-video {
        min-height: 200px;
        min-width: 280px;
    }

    .camera-preview-header h3 {
        font-size: 16px;
    }
}

/* 手机端相机预览优化 */
@media (max-width: 480px) {
    .camera-preview-container {
        max-width: 100vw;
        max-height: 85vh;
        margin: 0;
        border-radius: 0;
    }

    .camera-preview-video {
        min-height: 180px;
        min-width: auto;
        width: 100%;
    }

    .camera-preview-video video {
        max-height: 50vh;
    }

    .camera-preview-header {
        padding: 12px 16px;
    }

    .camera-preview-header h3 {
        font-size: 14px;
    }

    .camera-preview-footer {
        padding: 12px 16px;
    }

    .camera-preview-status {
        font-size: 12px;
    }
}

/* ==========================================
   页面级摄像头预览样式（可拖动悬浮窗口）
   ========================================== */

.camera-page-preview {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 240px;
    background: rgba(35, 39, 42, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    z-index: 200;
    cursor: move;
    animation: slideInTopRight 0.3s ease-out;
    transition: box-shadow 0.2s ease;
}

.camera-page-preview:hover {
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.25);
}

@keyframes slideInTopRight {
    from {
        transform: translate(100%, -100%);
        opacity: 0;
    }
    to {
        transform: translate(0, 0);
        opacity: 1;
    }
}

.camera-close-mini {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    z-index: 10;
}

.camera-close-mini:hover {
    background: rgba(233, 49, 49, 0.8);
    transform: scale(1.1);
}

.camera-switch-btn {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: none;
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 10;
}

.camera-switch-btn:hover {
    background: rgba(88, 101, 242, 0.8);
    transform: scale(1.1);
}

.camera-switch-btn:active {
    transform: scale(0.95);
}

.camera-page-preview video {
    width: 100%;
    height: auto;
    display: block;
    background: #000;
    border-radius: 12px;
}

/* 手机端悬浮相机预览优化 */
@media (max-width: 768px) {
    .camera-page-preview {
        width: 180px;
        top: 70px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .camera-page-preview {
        width: 140px;
        top: 60px;
        right: 8px;
    }

    .camera-close-mini {
        width: 24px;
        height: 24px;
        font-size: 14px;
        top: 6px;
        right: 6px;
    }

    .camera-switch-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
        top: 6px;
        left: 6px;
    }
}

/* ==================== 启动覆盖层样式（语音唤醒） ==================== */
.startup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.95) 0%, rgba(156, 39, 176, 0.95) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    cursor: pointer;
    transition: opacity 0.3s ease;
}

.startup-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.startup-overlay-content {
    text-align: center;
    color: white;
    animation: slideUp 0.5s ease-out;
}

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

.startup-icon {
    font-size: 80px;
    margin-bottom: 20px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-20px);
    }
    60% {
        transform: translateY(-10px);
    }
}

.startup-overlay-content h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 16px;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.startup-overlay-content > p {
    font-size: 18px;
    margin-bottom: 8px;
    opacity: 0.95;
}

.startup-hint {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 20px;
}

.startup-note {
    font-size: 12px;
    opacity: 0.6;
    margin-top: 8px;
    max-width: 280px;
    line-height: 1.4;
}

.startup-loading {
    font-size: 14px;
    opacity: 0.8;
    margin-top: 16px;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 0.4;
    }
}

/* ==================== 唤醒监听状态指示器 ==================== */
.wakeup-status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 20px;
    padding: 6px 12px;
    background: rgba(76, 175, 80, 0.2);
    border-radius: 16px;
    font-size: 12px;
    color: white;
    backdrop-filter: blur(10px);
    animation: fadeInScale 0.3s ease-out;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    font-size: 12px;
    color: white;
    backdrop-filter: blur(10px);
}

.connection-status-top {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: auto;
}

/* ==================== 移动端状态导航条 ==================== */
.mobile-status-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: rgba(22, 24, 28, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    align-items: center;
    justify-content: space-around;
    padding: 0 12px;
}

.mobile-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 16px;
    transition: all 0.3s ease;
    min-width: 75px;
    justify-content: center;
}

.mobile-status-item:active {
    transform: scale(0.95);
}

.mobile-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mobile-status-dot.status-disconnected {
    background: #E74C3C;
    box-shadow: 0 0 6px rgba(231, 76, 60, 0.6);
}

.mobile-status-dot.status-connected {
    background: #2ECC71;
    box-shadow: 0 0 6px rgba(46, 204, 113, 0.6);
}

.mobile-status-dot.monitoring-active {
    background: #4CAF50;
    box-shadow: 0 0 6px rgba(76, 175, 80, 0.6);
    animation: pulse 2s infinite;
}

.mobile-status-text {
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
    white-space: nowrap;
}

.connection-status-mobile {
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.connection-status-mobile.connected {
    border-color: rgba(46, 204, 113, 0.3);
    background: rgba(46, 204, 113, 0.1);
}

.wakeup-status-mobile {
    border: 1px solid rgba(76, 175, 80, 0.3);
    background: rgba(76, 175, 80, 0.1);
}

/* 响应式：移动端显示导航条 */
@media (max-width: 768px) {
    .mobile-status-bar {
        display: flex;
    }

    .connection-status-top {
        display: none;
    }

    /* 为移动端导航条调整布局 */
    .container {
        padding-top: 40px;
    }

    /* 模型容器上移 */
    .model-container {
        top: 50px;
    }

    /* Live2D Canvas 保持居中，不再覆盖top: 50% */
}

/* 覆盖 .status-indicator 的 absolute 定位 */
.connection-status-top .status-indicator {
    position: static;
    transform: none;
    left: auto;
}

.monitoring-indicator {
    display: none; /* 旧的样式，不再使用 */
}

.monitoring-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.monitoring-indicator span {
    font-weight: 500;
}

.monitoring-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4CAF50;
    animation: pulse 2s infinite;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
}

/* ==================== 系统消息样式 ==================== */
.chat-message.system-message {
    justify-content: center;
}

.chat-message.system-message .message-bubble {
    background: rgba(88, 101, 242, 0.2);
    border: 1px solid rgba(88, 101, 242, 0.4);
    color: #b9bbbe;
    font-size: 13px;
    padding: 8px 14px;
    max-width: none;
}

/* ==================== Live2D 角色切换面板样式 ==================== */
.live2d-section {
    padding: 10px 0;
}

.live2d-section h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.live2d-section p.config-hint {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: #b9bbbe;
}

.live2d-model-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    min-height: 100px;
}

.live2d-loading {
    text-align: center;
    padding: 30px;
    color: #b9bbbe;
    font-size: 14px;
}

.live2d-model-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: rgba(79, 84, 92, 0.5);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.live2d-model-item:hover {
    background: rgba(79, 84, 92, 0.7);
    border-color: rgba(88, 101, 242, 0.5);
}

.live2d-model-item.active {
    background: rgba(88, 101, 242, 0.2);
    border-color: #5865f2;
}

.live2d-model-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-right: 16px;
    flex-shrink: 0;
}

.live2d-model-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.live2d-model-name {
    color: #dcddde;
    font-size: 15px;
    font-weight: 500;
}

.live2d-model-status {
    font-size: 12px;
    color: #4CAF50;
    margin-top: 2px;
}

.live2d-model-item:not(.active) .live2d-model-status {
    color: #b9bbbe;
}

.live2d-model-empty {
    text-align: center;
    padding: 30px;
    color: #b9bbbe;
    font-size: 14px;
}

.live2d-info {
    margin-top: 20px;
    padding: 16px;
    background: rgba(79, 84, 92, 0.3);
    border-radius: 8px;
}

.live2d-info h4 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.live2d-info p {
    margin: 5px 0;
    font-size: 13px;
    color: #b9bbbe;
}

.live2d-info code {
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    color: #e91e63;
}

/* ==================== 唤醒词引导弹窗样式 ==================== */
.wakeup-guide-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(15px);
    animation: fadeIn 0.3s ease;
}

.wakeup-guide-modal.fade-out {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.wakeup-guide-content {
    background: rgba(47, 49, 54, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 32px;
    text-align: center;
    color: white;
    min-width: 320px;
    max-width: 400px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.wakeup-guide-icon {
    font-size: 48px;
    margin-bottom: 16px;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.wakeup-guide-content h2 {
    margin: 0 0 8px 0;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
}

.wakeup-guide-text {
    margin: 0 0 24px 0;
    font-size: 14px;
    opacity: 0.8;
    color: #b9bbbe;
}

.wakeup-guide-words {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 24px;
}

.wakeup-guide-word {
    background: rgba(88, 101, 242, 0.3);
    border: 1px solid rgba(88, 101, 242, 0.5);
    padding: 8px 16px;
    border-radius: 16px;
    font-size: 14px;
    font-weight: 500;
    backdrop-filter: blur(5px);
    color: #ffffff;
}

.wakeup-guide-countdown {
    display: flex;
    justify-content: center;
}

.countdown-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(88, 101, 242, 0.3);
    border: 2px solid rgba(88, 101, 242, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    color: #ffffff;
    animation: pulse-countdown 1s ease-in-out infinite;
}

@keyframes pulse-countdown {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 10px rgba(88, 101, 242, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(88, 101, 242, 0.5);
    }
}

/* ==================== 语音配置面板样式 ==================== */
.voice-config-section {
    margin-bottom: 20px;
}

.voice-config-section h3 {
    margin: 0 0 10px 0;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

.config-hint {
    margin: 0 0 20px 0;
    font-size: 13px;
    color: #b9bbbe;
}

.config-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.info-list {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #b9bbbe;
    line-height: 1.6;
}

.info-list li {
    margin-bottom: 8px;
}

/* ==================== 唤醒按钮样式 ==================== */
.wakeup-btn {
    transition: all 0.3s ease;
}

.wakeup-btn.wakeup-active {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
}

.wakeup-btn.wakeup-active .btn-icon {
    animation: sound-wave 1.5s infinite;
}

@keyframes sound-wave {
    0%, 100% {
        transform: scaleY(1);
    }
    50% {
        transform: scaleY(1.2);
    }
}
