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

        body {
            font-family: -apple-system, BlinkMacSystemFont, sans-serif;
            background: #000;
            color: #fff;
            height: 100vh;
            overflow: hidden;
            font-weight: 200;
        }

        /* --- New History Sidebar --- */
        #history-sidebar {
            position: fixed;
            top: 0;
            left: 0;
            width: 260px;
            height: 100vh;
            background: #111; /* Lighter than main bg */
            border-right: 1px solid #222;
            padding: 60px 0 20px;
            display: flex;
            flex-direction: column;
            transform: translateX(-100%);
            transition: transform 0.3s ease;
            z-index: 1500;
        }

        #history-sidebar.show {
            transform: translateX(0);
        }

        .history-title {
            font-size: 14px;
            font-weight: 200;
            color: #666;
            padding: 0 20px 15px;
            text-transform: uppercase;
            letter-spacing: 1px;
            border-bottom: 1px solid #222;
        }

        .history-list {
            flex: 1;
            overflow-y: auto;
            padding: 10px 0;
        }

        .history-item {
            padding: 12px 20px;
            font-size: 14px;
            color: #ccc;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            cursor: pointer;
            transition: background 0.2s ease;
        }

        .history-item:hover {
            background: #222;
        }
        
        .history-item.active {
            background: #2a2a2a;
            color: #fff;
        }

        .sidebar-action-btn {
            background: transparent;
            border: 1px solid #333;
            color: #666;
            padding: 10px;
            font-size: 13px;
            font-weight: 200;
            cursor: pointer;
            border-radius: 4px;
            transition: all 0.3s ease;
            margin: 15px 20px 0;
        }
        
       .sidebar-action-btn:hover {
       border-color: #555;
            color: #999;
        }

        /* --- Main Content Wrapper --- */
        #main-container {
            height: 100vh;
            margin-left: 0;
            transition: margin-left 0.3s ease;
            /* This container will hold the welcome/chat screens */
        }
        
        #main-container.sidebar-open {
            margin-left: 260px;
        }
        
        /* --- Icon Buttons --- */
        .icon-btn {
            position: fixed;
            top: 30px;
            width: 24px;
            height: 24px;
            cursor: pointer;
            opacity: 0.4;
            transition: opacity 0.3s ease;
            z-index: 1000;
        }
        
        .icon-btn:hover {
            opacity: 1;
        }
        
        .icon-btn svg {
            width: 100%;
            height: 100%;
            stroke: #fff;
            fill: none;
            stroke-width: 1.5;
        }

        #history-toggle {
            left: 30px;
            z-index: 1600; /* Above sidebar */
        }
        
        #brushIcon {
            right: 70px;
        }

        #crownIcon {
            right: 30px;
        }


        /* Premium Popup */
        .premium-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(10px);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 2000;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .premium-overlay.show {
            display: flex;
            opacity: 1;
        }

        .premium-popup {
            background: #000;
            border: 1px solid #333;
            border-radius: 8px;
            padding: 60px 50px;
            text-align: center;
            min-width: 400px;
            max-width: 90vw;
            position: relative;
        }

        .premium-title {
            font-size: 18px;
            font-weight: 200;
            margin-bottom: 40px;
            color: #fff;
        }

        .premium-input {
            width: 100%;
            background: transparent;
            border: none;
            border-bottom: 1px solid #333;
            padding: 20px 0;
            font-size: 16px;
            font-weight: 200;
            color: #fff;
            text-align: center;
            outline: none;
            margin-bottom: 40px;
            transition: border-color 0.3s ease;
        }

        .premium-input:focus {
            border-bottom-color: #fff;
        }

        .premium-input::placeholder {
            color: #444;
        }

        .premium-submit {
            background: transparent;
            border: 1px solid #333;
            color: #fff;
            padding: 12px 30px;
            font-size: 14px;
            font-weight: 200;
            cursor: pointer;
            border-radius: 4px;
            transition: all 0.3s ease;
            margin-bottom: 20px;
        }

        .premium-submit:hover {
            border-color: #fff;
            background: #fff;
            color: #000;
        }

        .premium-error {
            color: #666;
            font-size: 12px;
            font-weight: 200;
            opacity: 0;
            transition: opacity 0.3s ease;
        }

        .premium-error.show {
            opacity: 1;
        }

        .premium-close {
            position: absolute;
            top: 20px;
            right: 20px;
            background: none;
            border: none;
            color: #666;
            font-size: 18px;
            cursor: pointer;
            padding: 0;
            width: 20px;
            height: 20px;
            transition: color 0.3s ease;
        }

        .premium-close:hover {
            color: #fff;
        }

        /* Welcome Screen */
        .welcome-screen {
            height: 100vh;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            text-align: center;
            transition: opacity 0.5s ease;
        }

        .welcome-title {
            font-size: 48px;
            font-weight: 100;
            margin-bottom: 20px;
            letter-spacing: -1px;
        }

        .welcome-subtitle {
            font-size: 16px;
            font-weight: 200;
            color: #666;
            margin-bottom: 60px;
        }

        .welcome-input {
            width: 400px;
            max-width: 80vw;
            background: transparent;
            border: none;
            border-bottom: 1px solid #333;
            padding: 20px 0;
            font-size: 18px;
            font-weight: 200;
            color: #fff;
            text-align: center;
            outline: none;
            transition: border-color 0.3s ease;
            resize: none;
        }

        .welcome-input:focus {
            border-bottom-color: #fff;
        }

        .welcome-input::placeholder {
            color: #444;
        }

        /* Chat Interface */
        .chat-interface {
            display: none;
            height: 100vh;
            max-width: 700px;
            margin: 0 auto;
            padding: 60px 40px 40px;
            flex-direction: column;
        }

        .messages {
            flex: 1;
            overflow-y: auto;
            margin-bottom: 40px;
            padding-right: 10px;
        }

        .message {
            margin-bottom: 50px;
            animation: fadeUp 0.4s ease;
        }

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

        .message-label {
            font-size: 12px;
            font-weight: 200;
            color: #444;
            margin-bottom: 8px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .message-content {
            font-size: 16px;
            font-weight: 200;
            line-height: 1.7;
            white-space: pre-wrap;
        }

        .message.user .message-content {
            color: #fff;
        }

        .message.assistant .message-content {
            color: #ccc;
        }

        /* Rich Text Formatting Styles */
        .message-content strong {
            font-weight: 400;
            color: #fff;
        }

        .message-content em {
            font-style: italic;
            color: #f0f0f0;
        }

        .message-content code {
            background: #111;
            border: 1px solid #222;
            border-radius: 3px;
            padding: 2px 6px;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 14px;
            color: #e6e6e6;
        }

        .message-content pre {
            background: #111;
            border: 1px solid #222;
            border-radius: 6px;
            padding: 16px;
            margin: 12px 0;
            overflow-x: auto;
            font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
            font-size: 14px;
            line-height: 1.4;
        }

        .message-content pre code {
            background: none;
            border: none;
            padding: 0;
        }

        .message-content ul,
        .message-content ol {
            margin: 12px 0;
            padding-left: 24px;
        }

        .message-content li {
            margin: 6px 0;
            line-height: 1.6;
        }

        .message-content ul li {
            list-style-type: disc;
        }

        .message-content ol li {
            list-style-type: decimal;
        }

        .message-content h1,
        .message-content h2,
        .message-content h3 {
            color: #fff;
            font-weight: 300;
            margin: 20px 0 12px 0;
        }

        .message-content h1 {
            font-size: 24px;
        }

        .message-content h2 {
            font-size: 20px;
        }

        .message-content h3 {
            font-size: 18px;
        }

        .message-content blockquote {
            border-left: 3px solid #333;
            margin: 12px 0;
            padding-left: 16px;
            color: #999;
            font-style: italic;
        }

        .message-content p {
            margin: 8px 0;
        }

        .input-container {
            border-top: 1px solid #111;
            padding-top: 40px;
        }

        .input-box {
            position: relative;
        }

        .chat-input {
            width: 100%;
            background: transparent;
            border: none;
            border-bottom: 1px solid #222;
            padding: 20px 80px 20px 40px;
            font-size: 16px;
            font-weight: 200;
            color: #fff;
            outline: none;
            transition: border-color 0.3s ease;
            resize: none;
            min-height: 24px;
            max-height: 120px;
        }

        .chat-input:focus {
            border-bottom-color: #444;
        }

        .chat-input::placeholder {
            color: #333;
        }

        .input-controls {
            position: absolute;
            right: 0;
            bottom: 20px;
            display: flex;
            align-items: center;
        }

        .send-btn {
            background: none;
            border: none;
            color: #666;
            cursor: pointer;
            padding: 0;
            font-size: 14px;
            font-weight: 200;
            transition: color 0.3s ease;
        }

        .send-btn:hover:not(:disabled) {
            color: #fff;
        }

        .send-btn:disabled {
            color: #222;
            cursor: not-allowed;
        }

        .typing {
            color: #444;
            font-style: italic;
            animation: pulse 1.5s infinite;
        }

        @keyframes pulse {
            0%, 100% { opacity: 0.5; }
            50% { opacity: 1; }
        }

        .error {
            color: #666;
            font-size: 14px;
            margin-top: 10px;
        }

        /* Scrollbar */
        .messages::-webkit-scrollbar,
        .history-list::-webkit-scrollbar {
            width: 4px;
        }

        .messages::-webkit-scrollbar-track,
        .history-list::-webkit-scrollbar-track {
            background: transparent;
        }

        .messages::-webkit-scrollbar-thumb,
        .history-list::-webkit-scrollbar-thumb {
            background: #222;
            border-radius: 2px;
        }
        
        .history-list::-webkit-scrollbar-thumb {
            background: #333;
        }

        /* Mobile */
        @media (max-width: 600px) {
            #history-sidebar {
                padding-top: 80px; /* More space for icons */
            }
        
            #main-container.sidebar-open {
                margin-left: 0; /* Don't push content on mobile */
            }
        
            .chat-interface {
                padding: 60px 20px 20px;
            }
            .welcome-title {
                font-size: 36px;
            }
            .welcome-input {
                width: 300px;
                font-size: 16px;
            }
            
            #history-toggle {
                top: 20px;
                left: 20px;
                width: 20px;
                height: 20px;
            }
                        
            #brushIcon {
                top: 20px;
                right: 60px;
                width: 20px;
                height: 20px;
            }
            
            #crownIcon {
                top: 20px;
                right: 20px;
                width: 20px;
                height: 20px;
            }
            
            .premium-popup {
                padding: 40px 30px;
                min-width: 300px;
            }
        }
