        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #1a2a6c, #2a4b8c, #3a6ccc);
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 10px;
        }

        .container {
            display: flex;
            flex-direction: column;
            width: 100%;
            max-width: 1200px;
            height: 95vh;
            background: rgba(255, 255, 255, 0.95);
            border-radius: 16px;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
            overflow: hidden;
            position: relative;
            min-height: 0;
        }

        /* Mobile-first sidebar (hidden by default) */
        .sidebar {
            position: absolute;
            top: 0;
            left: -280px;
            width: 280px;
            height: 100%;
            background: linear-gradient(180deg, #3494E6, #2a4b8c);
            color: white;
            padding: 20px;
            display: flex;
            flex-direction: column;
            overflow-y: auto;
            transition: left 0.3s ease;
            z-index: 1000;
            max-height: 100vh;
            box-sizing: border-box;
        }

        .sidebar.show {
            left: 0;
        }

        .sidebar-header {
            padding-bottom: 15px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.3);
            margin-bottom: 15px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .sidebar-header h2 {
            font-size: 1.5rem;
        }

        .close-sidebar {
            background: none;
            border: none;
            color: white;
            font-size: 1.5rem;
            cursor: pointer;
        }

        .new-chat-btn {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            color: white;
            padding: 12px;
            border-radius: 10px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            margin-bottom: 20px;
            transition: background 0.3s;
        }

        .new-chat-btn:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        .history-list {
            flex: 1;
            overflow-y: auto;
        }

        .history-item {
            padding: 12px;
            margin-bottom: 8px;
            background: rgba(255, 255, 255, 0.1);
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.3s;
        }

        .history-item:hover {
            background: rgba(255, 255, 255, 0.2);
        }

        .history-item.active {
            background: rgba(255, 255, 255, 0.3);
            border-left: 4px solid white;
        }

        .chat-container {
            flex: 1;
            display: flex;
            flex-direction: column;
            height: 100%;
            min-height: 0;
        }

        .chat-header {
            background: white;
            color: #3494E6;
            padding: 16px;
            position: relative;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .chat-header h1 {
            font-size: 1.4rem;
            margin-bottom: 4px;
        }

        .chat-header p {
            font-size: 0.9rem;
            color: #666;
        }

        .toggle-sidebar {
            background: none;
            border: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: #3494E6;
        }

        .chat-messages {
            flex: 1;
            padding: 16px;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 12px;
            background: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-极.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.极6 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%233494E6' fill-opacity='0.05' fill-rule='evenodd'/%3E%3C/svg%3E");
            min-height: 0;
            overflow-wrap: break-word;
        }

        .message {
            max-width: 85%;
            padding: 12px 16px;
            border-radius: 18px;
            line-height: 1.5;
            position: relative;
            animation: fadeIn 0.3s ease;
            word-wrap: break-word;
        }

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

        .user-message {
            background: #3494E6;
            color: white;
            border-bottom-right-radius: 5px;
            align-self: flex-end;
        }

        .bot-message {
            background: #f0f0f0;
            color: #333;
            border-bottom-left-radius: 5px;
            align-self: flex-start;
            box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
        }

        .message-actions {
            position: absolute;
            top: 8px;
            right: 8px;
            opacity: 0;
            transition: opacity 0.3s;
            pointer-events: none;
        }

        .message:hover .message-actions,
        .message.show-actions .message-actions {
            opacity: 1;
            pointer-events: auto;
        }

        .copy-btn {
            background: rgba(0, 0, 0, 0.1);
            border: none;
            border-radius: 50%;
            width: 28px;
            height: 28px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            color: inherit;
            font-size: 0.9rem;
            transition: background 0.3s;
        }

        .user-message .copy-btn {
            color: white;
        }

        .copy-btn:hover {
            background: rgba(0, 0, 0, 0.2);
        }

        .chat-input-container {
            padding: 16px;
            background: white;
            border-top: 1px solid #e0e0e0;
            display: flex;
            gap: 10px;
            flex-shrink: 0;
        }

        .chat-input {
            flex: 1;
            padding: 12px 16px;
            border: 2px solid #e0e0e0;
            border-radius: 24px;
            font-size: 1rem;
            outline: none;
            transition: border-color 0.3s;
            resize: none;
            min-height: 44px;
            max-height: 120px;
            overflow-y: auto;
            line-height: 1.4;
            font-family: inherit;
        }

        .chat-input:focus {
            border-color: #3494E6;
        }

        .send-button {
            background: linear-gradient(90deg, #3494E6, #2a4b8c);
            color: white;
            border: none;
            border-radius: 24px;
            padding: 0 20px;
            font-size: 1rem;
            font-weight: 600;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .send-button:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
        }

        .send-button:active {
            transform: translateY(0);
        }

        .typing-indicator {
            display: none;
            background: #f0f0f0;
            color: #333;
            border-bottom-left-radius: 5px;
            align-self: flex-start;
            padding: 12px 16px;
            border-radius: 18px;
            margin-bottom: 10px;
            position: relative;
            overflow: hidden;
        }

        .typing-indicator::before {
            content: '';
            position: absolute;
            top: 0;
            left: -100%;
            width: 100%;
            height: 100%;
            background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
            animation: shimmer 2s infinite;
        }

        .typing-indicator span {
            height: 8px;
            width: 8px;
            float: left;
            margin: 0 1px;
            background-color: #9E9EA1;
            display: block;
            border-radius: 50%;
            opacity: 0.4;
            position: relative;
            z-index: 1;
        }

        .typing-indicator span:nth-of-type(1) {
            animation: typing 1s infinite;
        }

        .typing-indicator span:nth-of-type(2) {
            animation: typing 1s 0.33s infinite;
        }

        .typing-indicator span:nth-of-type(3) {
            animation: typing 1s 0.66s infinite;
        }

        @keyframes typing {
            0%, 100% {
                transform: translateY(0);
                opacity: 0.4;
            }
            50% {
                transform: translateY(-5px);
                opacity: 1;
            }
        }

        @keyframes shimmer {
            0% {
                left: -100%;
            }
            100% {
                left: 100%;
            }
        }

        /* Streaming message styles */
        .message.streaming {
            background: #f8f9fa;
            border: 1px solid #e9ecef;
            opacity: 0.9;
        }

        .message.streaming .message-content {
            min-height: 20px;
        }

        .message.streaming::after {
            content: '';
            position: absolute;
            bottom: 4px;
            right: 8px;
            width: 8px;
            height: 8px;
            background: #3494E6;
            border-radius: 50%;
            animation: pulse 1.5s infinite;
        }

        @keyframes pulse {
            0%, 100% {
                opacity: 1;
                transform: scale(1);
            }
            50% {
                opacity: 0.5;
                transform: scale(1.2);
            }
        }

        .code-block {
            background: #2d2d2d;
            color: #f8f8f2;
            border-radius: 8px;
            padding: 12px;
            margin: 10px 0;
            overflow-x: auto;
            position: relative;
        }

        .code-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            color: #f8f8f2;
            font-family: 'Consolas', monospace;
            font-size: 0.9rem;
        }

        .code-copy-btn {
            background: rgba(255, 255, 255, 0.2);
            border: none;
            border-radius: 4px;
            padding: 4px 8px;
            cursor: pointer;
            color: #f8f8f2;
            font-size: 0.8rem;
            transition: background 0.3s;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .code-copy-btn:hover {
            background: rgba(255, 255, 255, 0.3);
        }

        pre {
            margin: 0;
            overflow-x: auto;
        }

        code {
            font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
            font-size: 0.85rem;
        }

        .empty-history {
            text-align: center;
            padding: 20px;
            color: rgba(255, 255, 255, 0.7);
        }

        .history-title {
            font-size: 1.1rem;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .notification {
            position: fixed;
            top: 20px;
            right: 20px;
            background: #4CAF50;
            color: white;
            padding: 12px 16px;
            border-radius: 8px;
            box-shadow: 极 5px 15px rgba(0, 0, 0, 0.2);
            transform: translateX(100%);
            transition: transform 0.3s ease;
            z-index: 1000;
        }

        .notification.show {
            transform: translateX(0);
        }

        .overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            z-index: 999;
        }

        .overlay.show {
            display: block;
        }

        .settings-panel {
            background: rgba(255, 255, 255, 0.1);
            padding: 15px;
            border-radius: 10px;
            margin-top: 20px;
        }

        .settings-title {
            font-size: 1rem;
            margin-bottom: 10px;
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .api-select {
            width: 100%;
            padding: 8px;
            border-radius: 5px;
            border: none;
            background: rgba(255, 255, 255, 0.2);
            color: white;
        }

        .api-select option {
            background: #3494E6;
        }

        .token-input-container {
            margin-top: 10px;
        }

        .token-input {
            width: 100%;
            padding: 8px;
            border-radius: 5px;
            border: none;
            background: rgba(255, 255, 255, 0.2);
            color: white;
            margin-top: 5px;
        }

        .token-input::placeholder {
            color: rgba(255, 255, 255, 0.7);
        }

        .save-token-btn {
            background: rgba(255, 255, 255, 0.3);
            border: none;
            color: white;
            padding: 6px 12px;
            border-radius: 4px;
            cursor: pointer;
            margin-top: 8px;
            font-size: 0.9rem;
        }

        .save-token-btn:hover {
            background: rgba(255, 255, 255, 0.4);
        }

        /* Tablet and Desktop Styles */
        @media (min-width: 768px) {
            .container {
                flex-direction: row;
                height: 90vh;
                min-height: 0;
            }
            
            .sidebar {
                position: relative;
                left: 0;
                width: 280px;
                height: 100%;
                overflow-y: auto;
                flex-shrink: 0;
            }
            
            .chat-container {
                flex: 1;
                min-height: 0;
            }
            
            .toggle-sidebar {
                display: none;
            }
            
            .close-sidebar {
                display: none;
            }
            
            .overlay {
                display: none !important;
            }
            
            .chat-header {
                padding: 20px;
            }
            
            .chat-header h1 {
                font-size: 1.8rem;
            }
            
            .chat-messages {
                padding: 20px;
                min-height: 0;
            }
            
            .message {
                max-width: 80%;
            }
            
            .chat-input-container {
                padding: 20px;
            }
        }

        /* Small mobile devices */
        @media (max-width: 360px) {
            .chat-header h1 {
                font-size: 1.2rem;
            }
            
            .chat-header p {
                font-size: 0.8rem;
            }
            
            .message {
                max-width: 90%;
                padding: 10px 14px;
                font-size: 0.9rem;
            }
            
            .send-button {
                padding: 0 16px;
            }
        }
