* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px; /* 기본 폰트 크기 고정 */
    background: 
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 119, 198, 0.3), transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(120, 219, 255, 0.3), transparent 50%),
        linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    height: 100dvh; /* 동적 뷰포트 높이 (모바일 주소창 고려) */
    overflow: hidden;
    position: relative;
    /* 모바일 터치 최적화 */
    -webkit-overflow-scrolling: touch;
    -webkit-tap-highlight-color: transparent;
}

/* VRM 뷰어 컨테이너 */
#vrm-container {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
}

/* 상단 서비스 참여 박스 - 리퀴드 글래스 */
.service-box {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 100;
    width: 300px;
    transition: all 0.3s ease;
}

.service-box:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.service-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    color: #333;
    font-weight: 600;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ff4444;
    transition: background-color 0.3s ease;
}

.status-indicator.connected {
    background: #44ff44;
}

.service-button {
    width: 100%;
    padding: 14px 24px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: #333;
    font-weight: 700;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.service-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.service-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.service-settings {
    margin-bottom: 15px;
}

.service-setting {
    margin-bottom: 10px;
}

.service-setting label {
    display: block;
    color: #333;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 4px;
}

.service-setting input[type="text"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: #333;
    font-size: 12px;
}

.service-setting select {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: #333;
    font-size: 12px;
}

/* Idle 모드 토글 스위치 스타일 */
.toggle-container {
    display: flex;
    align-items: center;
    margin-top: 4px;
}

.toggle-input {
    display: none;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    margin-right: 8px;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-input:checked + .toggle-label .toggle-slider {
    background: #4CAF50;
    border-color: #45a049;
}

.toggle-input:checked + .toggle-label .toggle-slider::before {
    transform: translateX(26px);
}

.toggle-text {
    font-size: 12px;
    font-weight: 600;
    color: #333;
    transition: color 0.3s ease;
}

.toggle-input:checked + .toggle-label .toggle-text {
    color: #4CAF50;
}

.apply-settings-button {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 12px;
    background: rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(10px);
    color: #333;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.apply-settings-button:hover {
    background: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.apply-settings-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 오디오 파일 테스트 박스 - 리퀴드 글래스 */
.audio-test-box {
    position: absolute;
    top: 450px;
    right: 20px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 100;
    width: 300px;
    transition: all 0.3s ease;
}

.audio-test-box:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.audio-test-header {
    color: #333;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
}

.audio-file-selection {
    margin-bottom: 12px;
}

.audio-file-selection label {
    display: block;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
}

.audio-file-selection input[type="file"] {
    width: 100%;
    padding: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: #333;
    font-size: 14px;
}



.audio-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.audio-button {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: #333;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.audio-button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.audio-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.audio-result {
    font-size: 12px;
    color: #333;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    min-height: 20px;
}

/* 툰쉐이더 테스트 박스 - 리퀴드 글래스 */
.toon-shader-box {
    position: absolute;
    top: 650px; /* 오디오 박스와 적절한 간격 유지 (590px → 650px) */
    right: 20px;
    background: rgba(255, 182, 193, 0.15); /* 연한 핑크 톤 */
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 192, 203, 0.3);
    border-radius: 24px;
    padding: 20px;
    box-shadow: 
        0 8px 32px rgba(255, 105, 180, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 100;
    width: 300px;
    transition: all 0.3s ease;
}

.toon-shader-box:hover {
    background: rgba(255, 182, 193, 0.2);
    transform: translateY(-2px);
}

.toon-shader-header {
    color: #333;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
}

.toon-shader-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.toon-shader-button {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(255, 105, 180, 0.4);
    border-radius: 14px;
    background: rgba(255, 192, 203, 0.2);
    backdrop-filter: blur(10px);
    color: #333;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 16px rgba(255, 105, 180, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.toon-shader-button:hover {
    background: rgba(255, 192, 203, 0.3);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 20px rgba(255, 105, 180, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.toon-shader-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.toon-shader-button.active {
    background: rgba(255, 105, 180, 0.3);
    border-color: rgba(255, 105, 180, 0.6);
    color: #d63384;
    font-weight: 700;
}

.toon-shader-settings {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.setting-row label {
    flex: 1;
    color: #333;
    font-size: 12px;
    font-weight: 600;
}

.setting-row input[type="range"] {
    flex: 2;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
}

.setting-row span {
    flex: 0 0 40px;
    text-align: right;
    color: #333;
    font-size: 12px;
    font-weight: 600;
}

.toon-shader-result {
    font-size: 12px;
    color: #333;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    min-height: 20px;
}

/* 대화창 - 리퀴드 글래스 */
.chat-container {
    position: absolute;
    top: 20px;
    left: 20px;
    width: 420px;
    height: calc(100vh - 450px); /* 로그창(280px) + 입력창(70px) + 여백(100px) */
    min-height: 350px; /* 최소 높이 보장 */
    max-height: calc(100vh - 450px); /* 최대 높이 제한 */
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-container:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.chat-header {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #333;
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chat-header:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 20px;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.message.user {
    align-self: flex-end;
    background: rgba(102, 126, 234, 0.4);
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.4);
    font-weight: 500;
}

.message.assistant {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.3);
    color: #333;
    border: 1px solid rgba(255, 255, 255, 0.35);
    font-weight: 500;
}

.message.system {
    align-self: center;
    background: rgba(255, 255, 255, 0.25);
    color: #555;
    font-size: 0.9em;
    font-style: italic;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-weight: 500;
}

.message .timestamp {
    font-size: 12px;
    opacity: 0.7;
    margin-bottom: 5px;
    color: #666;
}

.message .text {
    font-size: 14px; /* 고정 */
    line-height: 20px; /* em 대신 고정 픽셀 */
    margin-bottom: 8px;
}

.message .audio-controls {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.message .play-button {
    background: #28a745;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.message .play-button:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.message .play-button:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.message .audio-info {
    font-size: 11px;
    color: #666;
    font-style: italic;
}

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

/* 하단 입력 영역 - 리퀴드 글래스 */
.input-container {
    position: fixed; /* absolute → fixed로 변경 */
    bottom: 30px;
    bottom: max(30px, env(safe-area-inset-bottom, 20px)); /* iOS safe-area 적용 */
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 28px;
    padding: 18px 28px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    z-index: 1003; /* 최상위 z-index (사이드바보다 위) */
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 520px;
    transition: all 0.3s ease;
}

.input-container:hover {
    background: rgba(255, 255, 255, 0.18);
    transform: translateX(-50%) translateY(-2px);
}

.text-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 16px;
    outline: none;
    padding: 12px;
    color: #333;
    font-weight: 500;
}

.text-input::placeholder {
    color: #666;
}

.text-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
}

.text-input:disabled::placeholder {
    color: #999;
}

.input-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: rgba(255, 255, 255, 0.05);
}

.input-button {
    width: 52px;
    height: 52px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 16px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.input-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05) translateY(-1px);
    box-shadow: 
        0 6px 20px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.input-button.recording {
    background: linear-gradient(45deg, #ff4444, #ff6666);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 68, 68, 0); }
}

.send-button {
    background: linear-gradient(45deg, #44ff44, #66ff66);
}

/* 터치 오버레이 */
.touch-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
    background: transparent;
    cursor: pointer;
    display: none;
}

.touch-overlay.active {
    display: block;
}

/* 로딩 인디케이터 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 반응형 디자인 - 고정 픽셀 기준 */
@media (max-width: 1024px) {
    .chat-container {
        width: 380px; /* vw 대신 고정 픽셀 */
        height: calc(100vh - 400px); /* 로그창(250px) + 입력창(70px) + 여백(80px) */
        min-height: 300px; /* 최소 높이 보장 */
        max-height: calc(100vh - 400px); /* 최대 높이 제한 */
        left: 20px;
    }

    .log-container {
        position: fixed; /* fixed로 변경 */
        bottom: 80px; /* 입력창 위에 배치 */
        width: 380px; /* vw 대신 고정 픽셀 */
        height: 250px; /* vh 대신 고정 픽셀 */
        left: 20px;
    }
    
    .input-container {
        width: 480px; /* vw 대신 고정 픽셀 */
        min-width: unset;
        bottom: 20px;
    }
    
    /* 태블릿에서 사이드바 너비 조정 */
    .sliding-sidebar {
        width: 350px; /* vw 대신 고정 픽셀 */
        right: -350px;
    }
    
    .sliding-sidebar.open {
        right: 0;
    }

    /* 태블릿에서 사이드바 열림 시 */
    .chat-container.sidebar-open,
    .log-container.sidebar-open {
        width: 380px; /* 고정 크기 유지 */
    }

    .chat-actions {
        flex-direction: column;
        gap: 8px;
    }

    .chat-action-button {
        min-width: unset;
    }
}

/* 모바일 전용 (1024px 이하) */
@media (max-width: 1024px) {
    /* 모바일에서 사이드바 토글 버튼 크기 증가 */
    .sidebar-toggle {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }
    
    /* 모바일/태블릿에서 대화창 완전히 숨김 */
    .chat-container {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
        height: 0 !important;
        width: 0 !important;
        overflow: hidden !important;
    }

    .log-container {
        display: none !important; /* 모바일에서 시스템 로그 숨김 */
    }
    
    .input-container {
        position: fixed; /* 확실히 고정 */
        width: calc(100vw - 40px);
        min-width: unset;
        bottom: 20px;
        bottom: max(20px, env(safe-area-inset-bottom, 10px)); /* iOS safe-area */
        left: 50%;
        transform: translateX(-50%);
        z-index: 1003; /* 최상위 */
        padding: 12px 20px; /* 모바일에서 패딩 축소 */
    }
    
    /* 모바일에서 입력 버튼 크기 조정 */
    .input-button {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    /* 모바일에서 텍스트 입력 크기 조정 */
    .text-input {
        font-size: 16px; /* iOS 자동 줌 방지 (16px 이상) */
        padding: 10px;
    }
    
    /* 모바일에서 사이드바는 전체 너비 */
    .sliding-sidebar {
        width: calc(100vw - 40px);
        right: calc(-100vw + 40px); /* 완전히 숨기기 위해 수정 */
        left: auto; /* left 제거하여 right만 사용 */
    }
    
    .sliding-sidebar.open {
        right: 20px;
    }

    /* 모바일에서 사이드바 열림 시 채팅 투명 처리 */
    .chat-container.sidebar-open,
    .log-container.sidebar-open {
        opacity: 0.7;
        pointer-events: none;
    }
}

/* 큐 상태 표시 */
.queue-indicator {
    position: absolute;
    bottom: 100px;
    right: 20px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 15px;
    border-radius: 10px;
    font-size: 0.9em;
    z-index: 100;
    display: none;
}

.queue-indicator.show {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

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

/* 채팅 버튼 영역 - 리퀴드 글래스 */
.chat-actions {
    padding: 16px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.chat-action-button {
    flex: 1;
    min-width: 140px;
    padding: 12px 18px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: #333;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.chat-action-button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 16px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.chat-action-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.clear-button:hover {
    border-color: rgba(255, 107, 107, 0.4);
}

.test-button:hover {
    border-color: rgba(78, 205, 196, 0.4);
}

/* 중단 버튼 스타일 */
.chat-action-button.stop-button {
    background: linear-gradient(135deg, #f56565 0%, #c53030 100%);
    border-color: rgba(245, 101, 101, 0.3);
    animation: pulse 1.5s infinite;
}

.chat-action-button.stop-button:hover {
    background: linear-gradient(135deg, #c53030 0%, #f56565 100%);
    border-color: rgba(245, 101, 101, 0.5);
    animation: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(245, 101, 101, 0.4);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(245, 101, 101, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(245, 101, 101, 0);
    }
}

/* 로그창 - 리퀴드 글래스 */
.log-container {
    position: fixed; /* fixed로 변경하여 확실히 하단 고정 */
    bottom: 100px; /* 입력창 위에 배치 */
    left: 20px;
    width: 420px;
    height: 280px; /* 고정 높이 유지 */
    background: rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.log-container:hover {
    background: rgba(0, 0, 0, 0.18);
    transform: translateY(-1px);
}

.log-header {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    color: #333;
    padding: 12px 20px;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.log-header:hover {
    background: rgba(255, 255, 255, 0.12);
}

.log-header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.log-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 11px; /* 고정 */
    line-height: 16px; /* em 대신 고정 픽셀 */
}

.log-entry {
    margin-bottom: 4px;
    padding: 3px 0;
    color: #666;
    word-wrap: break-word;
    font-weight: 500;
}

.log-entry.info {
    color: #2196F3;
}

.log-entry.success {
    color: #4CAF50;
}

.log-entry.warning {
    color: #FF9800;
}

.log-entry.error {
    color: #F44336;
}

.log-clear-button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #333;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.log-clear-button:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #333;
    transform: translateY(-1px);
}

/* 스크롤바 스타일링 */
.log-messages::-webkit-scrollbar {
    width: 6px;
}

.log-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.log-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.log-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* 사이드바 토글 버튼 */
.sidebar-toggle {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    left: auto !important;
    z-index: 1002; /* 사이드바보다 위에 표시 */
    width: 56px;
    height: 56px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 
        0 12px 40px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

/* 연결 상태 아이콘 스타일 */
.connection-status {
    position: absolute;
    top: -5px;
    right: -5px;
    font-size: 12px;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    padding: 2px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

/* 연결 상태별 스타일 */
.connection-status.connected {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.sidebar-toggle.active {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.5);
    color: #667eea;
}

/* 슬라이딩 사이드바 */
.sliding-sidebar {
    position: fixed;
    top: 0;
    right: -400px; /* 초기엔 숨겨짐 */
    width: 400px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(25px);
    border-left: 1px solid rgba(255, 255, 255, 0.2);
    transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    overflow-y: auto;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.15);
}

.sliding-sidebar.open {
    right: 0;
}

/* 사이드바 헤더 */
.sidebar-header {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 사이드바 헤더 스타일 */
.sidebar-title {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.sidebar-status {
    display: flex;
    align-items: center;
    font-size: 12px;
    margin-top: 5px;
    color: #666;
}

.status-dot {
    margin-right: 5px;
    font-size: 10px;
}

.status-text {
    font-weight: 500;
}

.sidebar-header h3 {
    margin: 0;
    color: #333;
    font-size: 18px;
    font-weight: 700;
}

.close-sidebar {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    color: #333;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s ease;
}

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

/* 아코디언 컨테이너 */
.accordion-container {
    padding: 0;
}

/* 아코디언 아이템 */
.accordion-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.accordion-header {
    padding: 18px 24px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    color: #333;
    font-weight: 600;
    font-size: 15px;
}

.accordion-header:hover {
    background: rgba(255, 255, 255, 0.12);
}

.accordion-icon {
    transition: transform 0.3s ease;
    font-size: 14px;
    color: #667eea;
}

.accordion-icon.rotated {
    transform: rotate(90deg);
}

.accordion-content {
    max-height: 800px;
    overflow-y: auto;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 24px 20px;
    background: rgba(255, 255, 255, 0.02);
}

.accordion-content.collapsed {
    max-height: 0;
    padding: 0 24px;
    overflow: hidden;
}

/* 사이드바 내부 스타일 조정 */
.sliding-sidebar .service-status,
.sliding-sidebar .service-settings,
.sliding-sidebar .service-button,
.sliding-sidebar .audio-test-header,
.sliding-sidebar .audio-file-selection,
.sliding-sidebar .audio-controls,
.sliding-sidebar .audio-result,
.sliding-sidebar .toon-shader-header,
.sliding-sidebar .toon-shader-controls,
.sliding-sidebar .toon-shader-settings,
.sliding-sidebar .toon-shader-result {
    margin-top: 15px;
}

/* 채팅 컨테이너 크기 고정 (아바타 뷰어 영역 보호) */
.chat-container.sidebar-open {
    width: 420px; /* 고정 크기 유지 */
}

.log-container.sidebar-open {
    width: 420px; /* 고정 크기 유지 */
}

/* 사이드바 스크롤바 */
.sliding-sidebar::-webkit-scrollbar {
    width: 6px;
}

.sliding-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sliding-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sliding-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* 아코디언 내용 스크롤바 */
.accordion-content::-webkit-scrollbar {
    width: 6px;
}

.accordion-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.accordion-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.accordion-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

/* 접기/펼치기 아이콘 */
.collapse-icon {
    transition: transform 0.3s ease;
    font-size: 14px;
    color: #667eea;
    cursor: pointer;
    user-select: none;
}

.collapse-icon.rotated {
    transform: rotate(180deg);
}

/* 접힌 상태 스타일 */
.chat-container.collapsed {
    height: auto;
    min-height: 60px;
}

.chat-container.collapsed .chat-messages,
.chat-container.collapsed .chat-actions {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 20px;
}

.chat-container:not(.collapsed) .chat-messages,
.chat-container:not(.collapsed) .chat-actions {
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.log-container.collapsed {
    height: auto;
    min-height: 50px;
}

.log-container.collapsed .log-messages {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 16px;
}

.log-container:not(.collapsed) .log-messages {
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* VAD RMS 설정 스타일 */
.vad-settings-header {
    color: #333;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
}

.vad-settings-controls {
    margin-bottom: 15px;
    padding: 15px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
}

.vad-settings-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.vad-settings-button {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 14px;
    background: rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(10px);
    color: #333;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 
        0 4px 16px rgba(102, 126, 234, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.vad-settings-button:hover {
    background: rgba(102, 126, 234, 0.3);
    transform: translateY(-1px);
    box-shadow: 
        0 6px 20px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.vad-settings-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.vad-settings-button.active {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.6);
    color: #667eea;
    font-weight: 700;
}

.vad-settings-result {
    font-size: 12px;
    color: #333;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    min-height: 20px;
}

/* Face Driver 테스트 버튼 */
.face-test-button {
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    color: #333;
    font-weight: 500;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 
        0 2px 8px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    text-align: center;
}

.face-test-button:hover {
    background: rgba(102, 126, 234, 0.3);
    border-color: rgba(102, 126, 234, 0.5);
    transform: translateY(-1px);
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.face-test-button:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}