
        :root {
            --primary-color: #6366f1;
            --primary-hover: #5b5ff1;
            --secondary-color: #f8fafc;
            --accent-color: #10b981;
            --warning-color: #f59e0b;
            --danger-color: #ef4444;
            --text-primary: #1f2937;
            --text-secondary: #6b7280;
            --text-muted: #9ca3af;
            --border-color: #e5e7eb;
            --background-primary: #ffffff;
            --background-secondary: #f9fafb;
            --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
            --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
            --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
            --radius-sm: 0.375rem;
            --radius-md: 0.5rem;
            --radius-lg: 0.75rem;
        }

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

        body {
            font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            color: var(--text-primary);
            line-height: 1.6;
            transition: background 0.5s ease; /* Smooth color transitions */
        }

        /* Top Navigation */
        .top-nav {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
            border-bottom: 1px solid var(--border-color);
            padding: 1rem 0;
            position: sticky;
            top: 0;
            z-index: 1000;
        }

        .nav-container {
            max-width: 1200px;
            margin: 0 auto;
            padding: 0 1.5rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .nav-links {
            display: flex;
            gap: 2rem;
        }

        .nav-links a {
            text-decoration: none;
            color: var(--text-primary);
            font-weight: 500;
            transition: color 0.2s ease;
        }

        .nav-links a:hover {
            color: var(--primary-color);
        }

        .login-btn {
            background: var(--primary-color);
            color: white;
            border: none;
            padding: 0.5rem 1.5rem;
            border-radius: var(--radius-md);
            font-weight: 500;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .login-btn:hover {
            background: var(--primary-hover);
            transform: translateY(-1px);
        }

        /* Main Container */
        .main-container {
            max-width: 1200px;
            margin: 2rem auto;
            padding: 0 1.5rem;
            display: grid;
            grid-template-columns: 1fr 320px;
            gap: 2rem;
        }

        /* Content Area */
        .content-area {
            background: var(--background-primary);
            border-radius: var(--radius-lg);
            box-shadow: var(--shadow-lg);
            overflow: hidden;
        }

        .header-section {
            background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
            color: white;
            padding: 2rem;
            text-align: center;
            position: relative;
            overflow: hidden;
        }

        .header-section::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="white" opacity="0.1"/><circle cx="75" cy="75" r="1" fill="white" opacity="0.1"/><circle cx="50" cy="10" r="0.5" fill="white" opacity="0.05"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
            opacity: 0.3;
        }

        .header-section h1 {
            font-size: 2.5rem;
            font-weight: 700;
            margin-bottom: 0.5rem;
            position: relative;
        }

        .header-section p {
            font-size: 1.1rem;
            opacity: 0.9;
            position: relative;
        }

        /* Chat Interface */
        .chat-section {
            padding: 2rem;
        }

        .chat-input-container {
            margin-bottom: 2rem;
        }

        .input-group {
            margin-bottom: 1.5rem;
        }

        .input-label {
            display: block;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 0.5rem;
        }

        .chat-textarea {
            width: 100%;
            min-height: 120px;
            padding: 1rem;
            border: 2px solid var(--border-color);
            border-radius: var(--radius-md);
            font-family: inherit;
            font-size: 0.9rem;
            resize: vertical;
            transition: border-color 0.2s ease;
        }

        .chat-textarea:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        }

        .char-counter {
            text-align: right;
            font-size: 0.8rem;
            color: var(--text-muted);
            margin-top: 0.25rem;
        }

        .button-group {
            display: flex;
            gap: 1rem;
            margin-bottom: 2rem;
        }

        .btn {
            padding: 0.75rem 1.5rem;
            border: none;
            border-radius: var(--radius-md);
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            text-decoration: none;
        }

        .btn-primary {
            background: var(--primary-color);
            color: white;
        }

        .btn-primary:hover:not(:disabled) {
            background: var(--primary-hover);
            transform: translateY(-1px);
        }

        .btn-secondary {
            background: var(--background-secondary);
            color: var(--text-primary);
            border: 1px solid var(--border-color);
        }

        .btn-secondary:hover:not(:disabled) {
            background: #f3f4f6;
        }

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

        .btn.loading::after {
            content: '';
            width: 16px;
            height: 16px;
            border: 2px solid transparent;
            border-top: 2px solid currentColor;
            border-radius: 50%;
            animation: spin 1s linear infinite;
            margin-left: 0.5rem;
        }

        @keyframes spin {
            to { transform: rotate(360deg); }
        }

        /* Conversation Display */
        .conversation-container {
            max-height: 600px;
            overflow-y: auto;
            border: 1px solid var(--border-color);
            border-radius: var(--radius-md);
            padding: 1rem;
            background: var(--background-secondary);
        }

        .message {
            margin-bottom: 1rem;
            padding: 1rem;
            border-radius: var(--radius-md);
            animation: slideIn 0.3s ease;
        }

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

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

        .message strong {
            color: var(--primary-color);
        }

        .ai-message {
            background: linear-gradient(135deg, #e0f2fe, #f0f9ff);
            border-left: 4px solid var(--primary-color);
        }

        .charles-message {
            background: linear-gradient(135deg, #f3f4f6, #f9fafb);
            border-left: 4px solid #6b7280;
            font-family: 'Monaco', 'Menlo', monospace;
        }

        .thinker-message {
            background: linear-gradient(135deg, #fef3c7, #fef7cd);
            border-left: 4px solid var(--warning-color);
            font-style: italic;
        }

        .system-message {
            background: linear-gradient(135deg, #dcfce7, #f0fdf4);
            border-left: 4px solid var(--accent-color);
            font-style: italic;
        }

        .error-message {
            background: linear-gradient(135deg, #fee2e2, #fef2f2);
            border-left: 4px solid var(--danger-color);
        }

        /* Wiki Section */
        .wiki-section {
            border-top: 1px solid var(--border-color);
            padding: 2rem;
            background: var(--background-secondary);
        }

        .section-title {
            font-size: 1.5rem;
            font-weight: 700;
            color: var(--text-primary);
            margin-bottom: 1.5rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .input-field {
            width: 100%;
            padding: 0.75rem;
            border: 2px solid var(--border-color);
            border-radius: var(--radius-md);
            font-family: inherit;
            transition: border-color 0.2s ease;
        }

        .input-field:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        }

        /* Sidebar */
        .sidebar {
            display: flex;
            flex-direction: column;
            gap: 1.5rem;
        }

        .sidebar-card {
            background: var(--background-primary);
            border-radius: var(--radius-lg);
            padding: 1.5rem;
            box-shadow: var(--shadow-md);
        }

        .sidebar-title {
            font-weight: 700;
            margin-bottom: 1rem;
            color: var(--text-primary);
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        /* Collapsible Info Section */
        .info-section {
            background: var(--background-primary);
            border-radius: var(--radius-lg);
            padding: 1.5rem;
            box-shadow: var(--shadow-md);
        }

        .info-toggle {
            background: none;
            border: none;
            width: 100%;
            text-align: left;
            font-weight: 700;
            color: var(--text-primary);
            padding: 0;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            font-size: 1rem;
        }

        .info-toggle i.fa-chevron-down {
            transition: transform 0.3s ease;
        }

        .info-toggle.collapsed i.fa-chevron-down {
            transform: rotate(-90deg);
        }

        .info-content {
            margin-top: 1rem;
            font-size: 0.9rem;
            line-height: 1.6;
            color: var(--text-secondary);
        }

        .info-content.hidden {
            display: none;
        }

        .info-content strong {
            color: var(--text-primary);
        }

        .info-content ul {
            margin: 0.5rem 0;
            padding-left: 1.5rem;
        }

        .info-content li {
            margin-bottom: 0.25rem;
        }

        /* Color Control (Collapsible) */
        .color-section {
            background: var(--background-primary);
            border-radius: var(--radius-lg);
            padding: 1.5rem;
            box-shadow: var(--shadow-md);
        }

        .color-toggle {
            background: none;
            border: none;
            width: 100%;
            padding: 0;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 0.5rem;
            font-size: 1rem;
        }

        .color-toggle i.fa-chevron-down {
            transition: transform 0.3s ease;
        }

        .color-toggle.collapsed i.fa-chevron-down {
            transform: rotate(-90deg);
        }

        .color-content {
            margin-top: 1rem;
            font-size: 0.85rem;
            line-height: 1.5;
        }

        .color-content.hidden {
            display: none;
        }

        .slider-container {
            margin-top: 1rem;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        #colorIntensitySlider {
            flex: 1;
        }

        /* Color Control Section */
        .color-control {
            background: var(--background-primary);
            border-radius: var(--radius-lg);
            padding: 1.5rem;
            box-shadow: var(--shadow-md);
        }

        .color-indicator {
            display: inline-block;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            margin-right: 0.5rem;
            border: 2px solid var(--border-color);
        }

        /* Checkboxes */
        .checkbox-group {
            display: flex;
            flex-direction: column;
            gap: 0.75rem;
        }

        .checkbox-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .checkbox-item input[type="checkbox"] {
            width: 18px;
            height: 18px;
            accent-color: var(--primary-color);
        }

        .checkbox-item label {
            font-size: 0.9rem;
            color: var(--text-secondary);
        }

        /* Heartbeat Indicator */
        .heartbeat-indicator {
            position: fixed;
            bottom: 20px;
            left: 20px;
            z-index: 10000;
            font-size: 2rem;
            cursor: pointer;
            user-select: none;
            transition: all 0.3s ease;
        }

        .heartbeat-indicator.pulsing {
            animation: pulse 1s infinite;
        }

        .heartbeat-indicator.stopped {
            animation: none !important;
            opacity: 0.5;
            filter: grayscale(100%);
        }

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

        /* Emoji Container */
        .emoji-container {
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            pointer-events: none;
            z-index: 1;
        }

        .floating-emoji {
            position: absolute;
            /* FIXED: Removed spinning animation, kept only gentle floating */
            animation: gentleFloat 6s ease-in-out infinite;
            pointer-events: none;
        }

        @keyframes gentleFloat {
            0%, 100% { transform: translateY(0px); opacity: 1; }
            25% { transform: translateY(-10px); opacity: 0.8; }
            50% { transform: translateY(-5px); opacity: 0.6; }
            75% { transform: translateY(-15px); opacity: 0.7; }
        }

        /* Social Links */
        .social-links {
            display: flex;
            gap: 1rem;
            justify-content: center;
            padding: 1rem 0;
        }

        .social-links a {
            display: inline-flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 1rem;
            background: var(--background-primary);
            border-radius: var(--radius-md);
            text-decoration: none;
            color: var(--text-secondary);
            transition: all 0.2s ease;
            box-shadow: var(--shadow-sm);
        }

        .social-links a:hover {
            color: var(--primary-color);
            transform: translateY(-2px);
            box-shadow: var(--shadow-md);
        }

        /* Status Messages */
        .status-message {
            padding: 0.75rem;
            border-radius: var(--radius-md);
            margin: 1rem 0;
            font-weight: 500;
        }

        .status-success {
            background: #dcfce7;
            color: #166534;
            border: 1px solid #bbf7d0;
        }

        .status-error {
            background: #fee2e2;
            color: #991b1b;
            border: 1px solid #fecaca;
        }

        /* Responsive Design */
        @media (max-width: 1024px) {
            .main-container {
                grid-template-columns: 1fr;
                max-width: 800px;
            }
            
            .nav-container {
                flex-direction: column;
                gap: 1rem;
            }
            
            .nav-links {
                order: 2;
            }
        }

        @media (max-width: 640px) {
            .main-container {
                padding: 0 1rem;
                margin: 1rem auto;
            }
            
            .header-section h1 {
                font-size: 2rem;
            }
            
            .button-group {
                flex-direction: column;
            }
            
            .social-links {
                flex-direction: column;
                align-items: center;
            }
        }

        /* Scrollbar Styling */
        .conversation-container::-webkit-scrollbar {
            width: 6px;
        }

        .conversation-container::-webkit-scrollbar-track {
            background: var(--background-secondary);
        }

        .conversation-container::-webkit-scrollbar-thumb {
            background: var(--border-color);
            border-radius: 3px;
        }

        .conversation-container::-webkit-scrollbar-thumb:hover {
            background: var(--text-muted);
        }