/* ==================== Global Reset ==================== */
* {
    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 ==================== */
.background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: transparent;
    z-index: -2;
}

.background-overlay {
    display: none;
}

/* ==================== Main Container ==================== */
.container {
    position: relative;
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    padding: 20px;
    padding-bottom: 0;
}

/* ==================== Model Loading ==================== */
.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: 2;
    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;
    pointer-events: none;
}

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

.loading-char-float .main-char {
    color: #5865f2;
    text-shadow: none;
    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; }

@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;
    }
}

/* ==================== VRM Display ==================== */
.vrm-panel {
    position: relative;
    width: 200px;
    height: 300px;
    overflow: hidden;
    background: transparent;
    border: none;
    box-shadow: none;
    pointer-events: auto;
    flex-shrink: 0;
    cursor: move;
    user-select: none;
    -webkit-user-select: none;
}

.vrm-panel.dragging,
.chat-container.dragging .vrm-panel {
    cursor: grabbing;
}

#vrm-stage {
    width: 100%;
    height: 100%;
    display: block;
    pointer-events: none;
}

#vrm-stage canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none;
}

.connection-status-top {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    pointer-events: none;
}

body.debug-mode .connection-status-top {
    display: block;
}

.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 Stream ==================== */
.chat-container {
    position: absolute;
    bottom: 150px;
    right: 20px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: auto;
    pointer-events: none;
}

.chat-container.dragging {
    cursor: grabbing;
}

.chat-container.is-initializing .chat-stream {
    display: none !important;
}

.chat-container.is-initializing .chat-ipt:not(.is-visible) {
    display: none !important;
}

.chat-stream {
    --message-content-max-height: 400px;
    position: fixed;
    width: clamp(300px, 42vw, 504px);
    min-width: 280px;
    max-width: calc(100vw - 24px);
    flex: 0 0 auto;
    align-self: flex-start;
    max-height: min(474px, calc(100vh - 24px));
    overflow: hidden;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    margin: 0;
    z-index: 101;
    padding: 14px 18px;
    border: 1px solid rgba(184, 118, 255, 0.62);
    border-radius: 10px;
    box-sizing: border-box;
    color: rgba(241, 248, 255, 0.96);
    background: #000000cc;
    box-shadow:
        0 0 2px rgba(255, 255, 255, 0.65),
        0 0 7px rgba(241, 72, 255, 0.72),
        0 0 14px rgba(168, 82, 255, 0.58),
        0 0 24px rgba(64, 150, 255, 0.4),
        inset 0 0 8px rgba(255, 255, 255, 0.1),
        inset 0 0 16px rgba(0, 0, 0, 0.34);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    isolation: isolate;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.chat-stream.is-empty,
.chat-stream.is-dismissed {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
}

.chat-stream::before {
    content: '';
    position: absolute;
    inset: -1px;
    pointer-events: none;
    z-index: 0;
    padding: 1px;
    border-radius: inherit;
    background: linear-gradient(
        145deg,
        rgba(222, 79, 10, 0.95) 0%,
        rgba(234, 3, 235, 0.98) 18%,
        rgba(234, 6, 172, 0.95) 32%,
        rgba(21, 138, 255, 0.98) 78%,
        rgba(234, 3, 235, 0.98) 100%
    );
    filter:
        drop-shadow(0 0 4px rgba(244, 82, 255, 0.72))
        drop-shadow(0 0 10px rgba(115, 88, 255, 0.58))
        drop-shadow(0 0 15px rgba(57, 145, 255, 0.34));
    -webkit-mask:
        linear-gradient(#000 0 0) content-box,
        linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.chat-stream::after {
    content: '';
    position: absolute;
    inset: 2px;
    z-index: 1;
    border: 1px solid rgba(225, 239, 255, 0.2);
    border-radius: 7px;
    pointer-events: none;
    box-shadow:
        inset 0 1px 5px rgba(255, 255, 255, 0.12),
        inset 0 -1px 8px rgba(90, 166, 255, 0.1);
}

.chat-stream-body {
    position: relative;
    z-index: 2;
    flex: 0 1 auto;
    min-height: 0;
    height: auto;
    max-height: min(var(--message-content-max-height), calc(100vh - 120px));
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 0;
    padding: 0;
    border-radius: 0;
    box-sizing: border-box;
    pointer-events: none;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.chat-ipt {
    width: 100%;
    display: none;
    justify-content: center;
    margin-top: 10px;
    pointer-events: auto;
    position: relative;
    z-index: 102;
}

.chat-ipt.is-visible {
    display: flex !important;
    position: fixed;
    left: 50%;
    bottom: 110px;
    transform: translateX(-50%);
    width: min(420px, calc(100vw - 40px));
    margin-top: 0;
    z-index: 1001;
}

.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;
    pointer-events: auto;
}

.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: messageEnter 0.26s cubic-bezier(0.22, 0.8, 0.36, 1);
    pointer-events: auto;
    width: 100%;
    display: flex;
    transform-origin: 50% 100%;
}

.chat-message.ai,
.chat-message.system {
    justify-content: flex-start;
}

.chat-message.user {
    justify-content: flex-end;
}

.chat-message.ai .message-bubble,
.chat-message.system .message-bubble {
    background: #33333399;
    color: #E1EDFA;
    border-radius: 8px;
    border: none;
    backdrop-filter: none;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.chat-message.user .message-bubble {
    background: linear-gradient(178.04deg, #fa00ffb3 -166.31%, #006dffb3 316.46%);
    color: #FFFFFF;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: none;
}

.message-bubble {
    position: relative;
    padding: 8px 10px;
    font-family: 'PingFang SC', 'PingFangSC-Regular', 'Microsoft YaHei', sans-serif;
    font-weight: 500;
    font-size: 14px;
    line-height: 1.43;
    max-width: min(86%, 360px);
    width: fit-content;
    word-wrap: break-word;
    box-sizing: border-box;
    background-clip: padding-box;
    text-shadow:
        0 1px 2px rgba(0, 0, 0, 0.65),
        0 0 10px rgba(255, 255, 255, 0.16);
    animation: fadeIn 0.3s ease-out;
}

/* Markdown inside chat bubbles */
.message-bubble > :first-child {
    margin-top: 0;
}

.message-bubble > :last-child {
    margin-bottom: 0;
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
    margin: 0.35em 0 0.25em;
    font-weight: 600;
    line-height: 1.3;
}

.message-bubble h1 { font-size: 1.15em; }
.message-bubble h2 { font-size: 1.08em; }
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 { font-size: 1em; }

.message-bubble p {
    margin: 0.35em 0;
}

.message-bubble ul,
.message-bubble ol {
    margin: 0.35em 0;
    padding-left: 1.25em;
}

.message-bubble li {
    margin: 0.15em 0;
}

.message-bubble blockquote {
    margin: 0.35em 0;
    padding: 0.15em 0 0.15em 0.65em;
    border-left: 3px solid rgba(255, 255, 255, 0.35);
    color: rgba(255, 255, 255, 0.85);
}

.message-bubble code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.9em;
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
}

.message-bubble pre {
    margin: 0.4em 0;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.45);
    overflow-x: auto;
    max-width: 100%;
}

.message-bubble pre code {
    padding: 0;
    background: transparent;
    white-space: pre;
}

.message-bubble a {
    color: #9ecbff;
    text-decoration: underline;
}

.message-bubble img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0.4em 0;
    border-radius: 6px;
}

.message-bubble table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    border-collapse: collapse;
    margin: 0.4em 0;
    font-size: 0.9em;
}

.message-bubble th,
.message-bubble td {
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 4px 6px;
    white-space: nowrap;
}

.message-bubble hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0.5em 0;
}

.message-bubble del {
    opacity: 0.75;
}

@keyframes messageEnter {
    from {
        transform: translateY(10px) scale(0.98);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        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: none;
    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;
    /* 确保控制栏在最上层 */
}

body.debug-mode .control-bar {
    display: flex;
}

.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);
}

/* 摄像头按钮特殊样式 */
#cameraBtn.camera-active {
    background: rgba(237, 66, 69, 0.9);
}

#cameraBtn.camera-active: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 textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #40444b;
    border-radius: 6px;
    background: #40444b;
    color: white;
    min-height: 100px;
    resize: vertical;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 14px;
}

.config-item-range input[type="range"] {
    width: 100%;
    margin-top: 8px;
    accent-color: #5865f2;
}

.config-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #888;
}

.model-select {
    width: 100%;
    padding: 10px 40px 10px 14px;
    border: 1px solid #40444b;
    border-radius: 8px;
    background: #40444b;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
}

.model-select:hover {
    border-color: #5865f2;
}

.model-select:focus {
    outline: none;
    border-color: #5865f2;
}

.model-select option {
    background: #2f3136;
    color: #ffffff;
    padding: 12px;
    font-size: 14px;
}

.background-btn {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #40444b;
    border-radius: 8px;
    background: #40444b;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.background-btn:hover {
    background: #4f545c;
}

.background-btn:active {
    background: #40444b;
}

.background-btn .btn-icon {
    width: 20px;
    height: 20px;
    fill: #ffffff;
}

/* ==================== 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;
}

.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;
}

.properties-container #addMcpPropertyBtn {
    display: block;
    margin: 0 auto;
}

.properties-container #addMcpPropertyBtn:hover {
    background: #4752c4;
}

.mcp-checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    color: #b9bbbe;
    font-size: 13px;
    cursor: pointer;
    justify-content: flex-start;
}

.mcp-checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.mcp-property-name {
    color: white;
    font-size: 14px;
    font-weight: 500;
}

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

.mcp-properties-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 60px;
    padding: 8px;
}

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

.input-group-header label {
    margin-bottom: 0;
}

.input-group-header .properties-btn-primary {
    margin: 0;
}

.mcp-empty-state {
    text-align: center;
    padding: 20px;
    color: #999;
    font-size: 14px;
    width: 100%;
    display: none;
}

.properties-btn-primary {
    background: #2196f3;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: background-color 0.2s;
    display: block;
    margin: 0 auto;
}

.properties-btn-primary:hover {
    background: #2196f3;
}

.mcp-property-card {
    background: #36393f;
    border: 1px solid #40444b;
    border-radius: 8px;
    padding: 12px;
    width: 100%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mcp-property-card:hover {
    background: #40444b;
    border-color: #5865f2;
}

.mcp-property-card:active {
    transform: none;
}

.mcp-property-row-label {
    display: flex;
    align-items: flex-start;
    margin-bottom: 6px;
    gap: 8px;
}

.mcp-property-label {
    color: #b9bbbe;
    font-size: 13px;
    width: 60px;
    flex-shrink: 0;
    text-align: left;
}

.mcp-property-value {
    color: white;
    font-size: 13px;
    flex: 1;
    word-break: break-all;
}

.mcp-property-required-badge {
    color: #f44336;
    font-size: 12px;
}

.mcp-property-row-action {
    display: flex;
    justify-content: flex-end;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid #40444b;
}

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

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

.mcp-property-card-optional {
    background: #4f545c;
    color: #b9bbbe;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
}

.property-modal {
    max-width: 450px;
}

/* ==================== 音频可视化器样式 ==================== */
.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;
}

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

.chat-stream-body::-webkit-scrollbar {
    width: 0;
    height: 0;
}

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

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

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

/* ==================== 摄像头显示区域样式 ==================== */
.camera-container {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 180px;
    height: 240px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    display: none;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    cursor: move;
}

.camera-container.active {
    display: block;
}

.camera-container.dragging {
    cursor: grabbing;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    border-color: rgba(88, 101, 242, 0.5);
}

@keyframes flipWithPosition {
    0% {
        transform: var(--original-transform) rotateY(0deg);
    }

    100% {
        transform: var(--original-transform) rotateY(180deg);
    }
}


.camera-container.flip {
    animation: flipWithPosition 0.5s ease-in-out 1 forwards;
}

#cameraVideo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #1a1a1a;
    pointer-events: none;
    transform: scaleX(-1);
}

.camera-switch-mask {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
}

.camera-switch-container {
    position: absolute;
    bottom: 10px;
    right: 10px;
}

.camera-switch {
    display: none;
    height: 20px;
    color: #fff;
}

.camera-switch .btn-icon {
    margin-bottom: 0;
}

.camera-switch.active {
    display: block;
}

/* ==================== 响应式设计 ==================== */
@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: 10px;
        padding: 8px 16px;
        gap: 12px;
    }

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

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

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

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

    .chat-stream {
        --message-frame-width: min(452px, calc(100vw - 24px));
        --message-content-max-height: 320px;
        min-width: 0;
    }

    .message-bubble {
        max-width: 100%;
        font-size: 17px;
        line-height: 1.5;
    }

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

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

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

    .chat-ipt input {
        font-size: 12px;
    }

    .camera-container {
        width: 130px;
        height: 180px;
    }

    .status-indicator {
        font-size: 12px;
    }
}

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

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

    .control-bar {
        gap: 8px;
        padding: 6px 12px;
    }

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

    .btn-text {
        display: none;
    }

    .chat-stream {
        width: calc(100vw - 24px);
        --message-content-max-height: 260px;
        min-width: 0;
    }

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

/* Portrait optimization */
@media (max-height: 700px) {
    .live2d-section {
        height: 55vh;
    }

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

    .chat-stream {
        --message-content-max-height: 260px;
    }

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

/* Landscape optimization */
@media (min-width: 1024px) and (min-height: 600px) {
    .live2d-section {
        height: 75vh;
    }

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

    .chat-stream {
        --message-frame-width: 452px;
    --message-content-width: 440px;
        --message-content-max-height: 400px;
    }

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