/* AI Theme CSS Variables */
:root {
    --background: 0 0% 100%;
    --foreground: 224 71.4% 4.1%;
    --card: 0 0% 100%;
    --card-foreground: 224 71.4% 4.1%;
    --popover: 0 0% 100%;
    --popover-foreground: 224 71.4% 4.1%;
    --primary: 262.1 83.3% 57.8%;
    --primary-foreground: 210 20% 98%;
    --secondary: 220 14.3% 95.9%;
    --secondary-foreground: 220.9 39.3% 11%;
    --muted: 220 14.3% 95.9%;
    --muted-foreground: 220 8.9% 46.1%;
    --accent: 220 14.3% 95.9%;
    --accent-foreground: 220.9 39.3% 11%;
    --border: 220 13% 91%;
    --input: 220 13% 91%;
    --ring: 262.1 83.3% 57.8%;
    
    /* AI Theme Colors */
    --ai-primary: 262.1 83.3% 57.8%;
    --ai-secondary: 252.5 94.7% 85.1%;
    --ai-accent: 270 91% 65%;
    --ai-muted: 270 20% 94%;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, hsl(262.1 83.3% 57.8%), hsl(270 91% 65%));
    --gradient-secondary: linear-gradient(135deg, hsl(220 14.3% 95.9%), hsl(270 20% 94%));
    --gradient-hero: linear-gradient(135deg, hsl(262.1 83.3% 57.8%) 0%, hsl(270 91% 65%) 50%, hsl(280 100% 70%) 100%);
    
    /* Shadows */
    --shadow-ai: 0 10px 40px -10px hsl(262.1 83.3% 57.8% / 0.3);
    --shadow-glow: 0 0 40px hsl(270 91% 65% / 0.4);
    --shadow-card: 0 4px 20px -2px hsl(220 13% 91% / 0.3);
    --shadow-success: 0 4px 20px -2px hsl(142 76% 36% / 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    height: 100vh;
    overflow: hidden;
}

/* Main Layout */
.app-container {
    display: flex;
    height: 100vh;
    background: hsl(var(--background));
}

.chat-panel {
    width: 50%;
    display: flex;
    flex-direction: column;
    border-right: 1px solid hsl(var(--border));
    background: var(--gradient-secondary);
}

.preview-panel {
    width: 50%;
    display: flex;
    flex-direction: column;
    background: hsl(var(--background));
}

/* Chat Header */
.chat-header {
    padding: 24px;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    box-shadow: var(--shadow-card);
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.header-icon {
    padding: 8px;
    border-radius: 8px;
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
}

.title-content h2 {
    font-size: 20px;
    font-weight: 600;
    color: hsl(var(--card-foreground));
    margin: 0 0 4px 0;
}

.title-content p {
    font-size: 14px;
    color: hsl(var(--muted-foreground));
    margin: 0;
}

/* Model Selector */
.model-selector {
    position: relative;
}

.model-title {
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--card-foreground));
    margin-bottom: 16px;
}

.model-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.model-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-card);
}

.model-checkbox:hover {
    box-shadow: var(--shadow-ai);
    transform: translateY(-1px);
}

.model-checkbox input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 16px;
    height: 16px;
    border: 2px solid hsl(var(--border));
    border-radius: 4px;
    background: hsl(var(--background));
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.model-checkbox input[type="checkbox"]:checked + .checkbox-custom {
    background: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.model-checkbox input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.model-icon {
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.model-icon.blue {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.model-icon.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.model-info {
    flex: 1;
    text-align: left;
}

.model-name {
    font-size: 14px;
    font-weight: 600;
    color: hsl(var(--card-foreground));
    line-height: 1.2;
}

.model-desc {
    font-size: 12px;
    color: hsl(var(--muted-foreground));
    line-height: 1.2;
}

/* Messages */
.messages-container {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.message {
    display: flex;
    gap: 12px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-avatar.assistant {
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
}

.message-avatar.user {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.message-author {
    font-size: 14px;
    font-weight: 500;
    color: hsl(var(--card-foreground));
}

.message-time {
    font-size: 12px;
    color: hsl(var(--muted-foreground));
    margin-left: auto;
}

.model-badge-chat {
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-badge-chat.blue {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.model-badge-chat.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.message-text {
    padding: 16px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.6;
    white-space: normal;
}

.assistant-message .message-text {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    box-shadow: var(--shadow-card);
    color: hsl(var(--card-foreground));
}

.user-message .message-text {
    background: hsl(var(--ai-muted));
    border: 1px solid hsl(var(--border));
    color: hsl(var(--card-foreground));
    white-space: pre-wrap;
}

/* Markdown Styles for Messages */
.message-text h1,
.message-text h2,
.message-text h3 {
    color: hsl(var(--card-foreground));
    margin: 16px 0 8px 0;
    line-height: 1.3;
}

.message-text h1 {
    font-size: 20px;
    font-weight: 700;
}

.message-text h2 {
    font-size: 18px;
    font-weight: 600;
}

.message-text h3 {
    font-size: 16px;
    font-weight: 600;
}

.message-text p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

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

.message-text strong {
    font-weight: 600;
    color: hsl(var(--card-foreground));
}

.message-text em {
    font-style: italic;
    color: hsl(var(--card-foreground));
}

.message-text code.inline-code {
    background: hsl(var(--muted));
    color: hsl(var(--foreground));
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-size: 13px;
    border: 1px solid hsl(var(--border));
}

.message-text .code-block {
    background: hsl(var(--muted));
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    margin: 12px 0;
    overflow-x: auto;
}

.message-text .code-block code {
    display: block;
    padding: 12px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
    font-size: 13px;
    line-height: 1.4;
    color: hsl(var(--foreground));
    background: transparent;
    white-space: pre;
}

.message-text ul {
    margin: 12px 0;
    padding-left: 20px;
}

.message-text li {
    margin: 4px 0;
    line-height: 1.5;
}

.message-text a {
    color: hsl(var(--primary));
    text-decoration: none;
    border-bottom: 1px solid hsl(var(--primary));
    transition: all 0.2s ease;
}

.message-text a:hover {
    color: hsl(var(--primary));
    border-bottom-color: transparent;
    background: hsl(var(--ai-muted));
    padding: 2px 4px;
    border-radius: 4px;
    margin: -2px -4px;
}

/* Loading Message */
.loading-message {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    box-shadow: var(--shadow-card);
}

.loading-dots {
    display: flex;
    gap: 4px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: hsl(var(--primary));
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out both infinite;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    } 40% {
        transform: scale(1);
    }
}

.loading-text {
    font-size: 14px;
    color: hsl(var(--muted-foreground));
}

/* Selected Models Display */
.selected-models {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 0;
}

.models-label {
    font-size: 12px;
    color: hsl(var(--muted-foreground));
    font-weight: 500;
}

.model-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.model-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-badge.blue {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
}

.model-badge.orange {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

/* Input Area */
.input-area {
    padding: 24px;
    border-top: 1px solid hsl(var(--border));
    background: hsl(var(--card));
}

.input-container {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-container textarea {
    flex: 1;
    min-height: 60px;
    max-height: 120px;
    padding: 16px;
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    font-size: 14px;
    font-family: inherit;
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    resize: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input-container textarea:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--ring) / 0.1);
}

.input-container textarea::placeholder {
    color: hsl(var(--muted-foreground));
}

.send-button {
    width: 48px;
    height: 48px;
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    border: none;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

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

.input-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 12px;
    font-size: 12px;
    color: hsl(var(--muted-foreground));
}

/* Preview Header */
.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    box-shadow: var(--shadow-card);
}

.preview-title {
    display: flex;
    align-items: center;
    gap: 8px;
}

.preview-icon {
    padding: 6px;
    border-radius: 6px;
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
}

.preview-title h3 {
    font-size: 16px;
    font-weight: 600;
    color: hsl(var(--card-foreground));
    margin: 0;
}

.preview-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.device-selector {
    display: flex;
    gap: 2px;
    padding: 4px;
    background: hsl(var(--muted));
    border-radius: 8px;
}

.device-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--muted-foreground));
    transition: all 0.2s ease;
}

.device-btn.active,
.device-btn:hover {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    color: hsl(var(--foreground));
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: hsl(var(--muted));
}

/* Tabs */
.preview-tabs {
    display: flex;
    background: hsl(var(--muted));
    padding: 4px 20px;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    transition: all 0.2s ease;
}

.tab-btn.active {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
}

.tab-btn:hover:not(.active) {
    background: hsl(var(--ai-muted));
    color: hsl(var(--foreground));
}

.model-tabs {
    display: flex;
    background: hsl(var(--muted));
    padding: 0 20px;
    border-bottom: 1px solid hsl(var(--border));
    gap: 4px;
}

.model-tab-btn {
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    transition: all 0.2s ease;
}

.model-tab-btn.active {
    background: hsl(var(--card));
    color: hsl(var(--card-foreground));
}

.model-tab-btn:hover:not(.active) {
    background: hsl(var(--ai-muted));
    color: hsl(var(--foreground));
}

/* Content Area */
.preview-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    min-height: 0; /* Important for flex child overflow */
}

.ready-state {
    text-align: center;
    max-width: 400px;
}

.ready-icon {
    width: 96px;
    height: 96px;
    margin: 0 auto 24px;
    border-radius: 24px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--primary-foreground));
    box-shadow: var(--shadow-glow);
}

.ready-state h4 {
    font-size: 24px;
    font-weight: 600;
    color: hsl(var(--card-foreground));
    margin-bottom: 12px;
}

.ready-state p {
    font-size: 15px;
    line-height: 1.6;
    color: hsl(var(--muted-foreground));
    margin-bottom: 32px;
}

.start-btn {
    background: var(--gradient-primary);
    color: hsl(var(--primary-foreground));
    border: none;
    padding: 12px 32px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.start-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow);
}

/* Loading State */
.loading-state {
    text-align: center;
    max-width: 400px;
}

.loading-spinner {
    width: 64px;
    height: 64px;
    margin: 0 auto 24px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: hsl(var(--primary-foreground));
    animation: pulse 2s ease-in-out infinite;
}

.loading-spinner svg {
    animation: spin 1s linear infinite;
}

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

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

.loading-content h4 {
    font-size: 18px;
    font-weight: 600;
    color: hsl(var(--card-foreground));
    margin-bottom: 8px;
}

.loading-content p {
    font-size: 14px;
    color: hsl(var(--muted-foreground));
    margin-bottom: 16px;
}

.loading-models {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.loading-models .model-badge {
    animation: fadeInOut 2s ease-in-out infinite;
}

.loading-models .model-badge:nth-child(2) {
    animation-delay: 0.3s;
}

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

/* Preview Frame */
.preview-frame {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    padding: 0;
}

.preview-frame.desktop {
    width: 100%;
    height: 100%;
}

.preview-frame.tablet {
    width: 768px;
    height: 1024px;
    max-width: 100%;
    max-height: 100%;
}

.preview-frame.mobile {
    width: 375px;
    height: 667px;
    max-width: 100%;
    max-height: 100%;
}

.preview-frame iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Code Content - ИСПРАВЛЕННЫЕ СТИЛИ */
.code-content {
    width: 100%;
    height: 100%;
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--muted));
    flex-shrink: 0;
}

.code-info {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: hsl(var(--muted-foreground));
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.copy-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-ai);
}

.copy-btn.copied {
    background: #22c55e;
    transform: scale(0.95);
}

/* Code with right colors and scrolling */
.code-content pre {
    margin: 0;
    padding: 0;
    flex: 1;
    min-height: 0;
    overflow: auto; /* Turn on scrolling */
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: #f8f9fa; /* Светлый фон */
    border: none;
    
    /* Стилизация скроллбара */
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f1f5f9;
}

/* Webkit scrollbar стили */
.code-content pre::-webkit-scrollbar {
    width: 14px;
    height: 14px;
}

.code-content pre::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.code-content pre::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 7px;
    border: 2px solid #f1f5f9;
}

.code-content pre::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.code-content pre::-webkit-scrollbar-corner {
    background: #f1f5f9;
}

/* Dark theme for code */
.code-content code {
    font-family: inherit;
    font-size: inherit;
    color: #1e293b; /* Dark color for code */
    background: transparent;
    display: block;
    padding: 24px;
    white-space: pre;
    overflow-wrap: normal;
    word-break: normal;
    min-height: calc(100% - 48px);
    line-height: inherit;
}

/* Fullscreen Overlay */
.fullscreen-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: hsl(var(--background));
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.fullscreen-overlay.active {
    opacity: 1;
    visibility: visible;
}

.fullscreen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    box-shadow: var(--shadow-card);
    flex-shrink: 0;
}

.fullscreen-title h3 {
    font-size: 18px;
    font-weight: 600;
    color: hsl(var(--card-foreground));
    margin: 0 0 4px 0;
}

.fullscreen-url {
    font-size: 12px;
    color: hsl(var(--muted-foreground));
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
}

.close-fullscreen {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid hsl(var(--border));
    border-radius: 8px;
    cursor: pointer;
    color: hsl(var(--foreground));
    transition: all 0.2s ease;
}

.close-fullscreen:hover {
    background: hsl(var(--muted));
    border-color: hsl(var(--muted-foreground));
}

.fullscreen-content {
    flex: 1;
    padding: 0;
    overflow: hidden;
}

.fullscreen-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
}

/* Copy Notification */
.copy-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #22c55e;
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: var(--shadow-success);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.copy-notification.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Tab Panels */
.tab-panel {
    display: none;
    width: 100%;
    height: 100%;
}

.tab-panel.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive */
@media (max-width: 1024px) {
    .app-container {
        flex-direction: column;
        height: 100vh;
    }
    
    .chat-panel {
        width: 100%;
        height: 50%;
        border-right: none;
        border-bottom: 1px solid hsl(var(--border));
    }
    
    .preview-panel {
        width: 100%;
        height: 50%;
    }
    
    .preview-content {
        padding: 20px;
    }
    
    .model-checkboxes {
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
    }
    
    .model-checkbox {
        min-width: 200px;
    }
}

@media (max-width: 640px) {
    .chat-header {
        padding: 16px;
    }
    
    .messages-container {
        padding: 16px;
    }
    
    .input-area {
        padding: 16px;
    }
    
    .preview-header {
        padding: 12px 16px;
    }
    
    .preview-content {
        padding: 16px;
    }
    
    .ready-state p {
        font-size: 14px;
    }
    
    .ready-icon {
        width: 80px;
        height: 80px;
    }
    
    .model-checkboxes {
        flex-direction: column;
    }
    
    .model-checkbox {
        min-width: auto;
    }
    
    .preview-controls {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .device-selector {
        order: 1;
        width: 100%;
        justify-content: center;
    }
}