:root {
    --primary: #00ff88;
    --primary-dark: #00cc6a;
    --secondary: #ff006e;
    --background: #0a0a0f;
    --surface: #1a1a24;
    --surface-light: #2a2a3a;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --text-muted: #707080;
    --border: #2a2a3a;
    --shadow: rgba(0, 255, 136, 0.1);
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.5;
    overflow: hidden;
    height: 100vh;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(135deg, var(--background) 0%, #0f0f1a 100%);
}

/* Header */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo i {
    font-size: 1.5rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.connection-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--surface-light);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ef4444;
    transition: var(--transition);
}

.connection-indicator.connected .status-dot {
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary);
}

.connection-indicator.connecting .status-dot {
    background: #f59e0b;
    animation: pulse 1.5s infinite;
}

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

/* Main Content */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Settings Panel */
.settings-panel {
    width: 380px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

.setting-group {
    margin-bottom: 2rem;
}

.setting-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-field {
    position: relative;
    margin-bottom: 1rem;
}

.input-field i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
}

.input-field input,
.input-field select {
    width: 100%;
    padding: 0.875rem 1rem;
    padding-left: 2.5rem;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
}

.input-field select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.input-field input:focus,
.input-field select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 255, 136, 0.1);
}

.setting-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
}

.setting-row .input-field {
    flex: 1;
}

.range-field {
    flex: 1;
}

.range-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.range-field input[type="range"] {
    width: 100%;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.range-field input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.3);
}

.range-field input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 255, 136, 0.3);
}

.color-field {
    margin-top: 1rem;
}

.color-field label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.color-field input[type="color"] {
    width: 100%;
    height: 3rem;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    padding: 0.25rem;
}

.toggle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(3, auto);
    gap: 1rem 1rem;
    margin-bottom: 0.5rem;
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    padding: 0;
}

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

.toggle-item label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.75rem;
    background: var(--surface-light);
    border-radius: var(--radius);
    transition: var(--transition);
    border: 1px solid transparent;
}

.toggle-item label:hover {
    background: #2a2a3f;
}

.toggle-item input:checked + label {
    background: rgba(0, 255, 136, 0.1);
    border-color: var(--primary);
}

.toggle-slider {
    width: 2.5rem;
    height: 1.25rem;
    background: var(--border);
    border-radius: 1rem;
    position: relative;
    transition: var(--transition);
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    background: var(--text-muted);
    border-radius: 50%;
    top: 0.125rem;
    left: 0.125rem;
    transition: var(--transition);
}

.toggle-item input:checked + label .toggle-slider {
    background: var(--primary);
}

.toggle-item input:checked + label .toggle-slider::after {
    transform: translateX(1.25rem);
    background: white;
}

.toggle-text {
    font-size: 0.875rem;
    font-weight: 500;
}

.fade-time-setting {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.action-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}

.primary-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: var(--radius);
    color: var(--background);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 136, 0.3);
}

.url-section {
    background: var(--surface-light);
    border-radius: var(--radius);
    padding: 1.25rem;
    border: 1px solid var(--border);
}

.url-section label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.url-group {
    display: flex;
    gap: 0.5rem;
}

.url-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.75rem;
    font-family: 'Monaco', 'Menlo', monospace;
}

.icon-btn {
    padding: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: var(--surface-light);
    color: var(--primary);
    transform: translateY(-1px);
}

/* Preview Panel */
.preview-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--background);
}

.preview-controls {
    display: flex;
    gap: 0.5rem;
}

.preview-content {
    flex: 1;
    padding: 1.5rem;
    overflow: hidden;
}

.chat-preview {
    height: 100%;
    background: rgba(26, 26, 36, 0.8);
    border-radius: var(--radius);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.875rem;
    opacity: 0.8;
}

.chat-message {
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.85));
    backdrop-filter: blur(20px);
    border-radius: 8px;
    padding: 12px 16px;
    min-height: 90px; 
    border-left: 3px solid #00ff88;
    animation: slideInUp 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.4),
        0 0 40px rgba(0, 255, 136, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom left;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
    margin-bottom: 4px;
    word-wrap: break-word;
    max-width: 500px;
}

/* Responsive */
@media (max-width: 1024px) {
    .settings-panel {
        width: 320px;
    }
    
    .toggle-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .main-content {
        flex-direction: column;
    }
    
    .settings-panel {
        width: 100%;
        max-height: 60vh;
    }
    
    .preview-panel {
        height: 40vh;
    }
    
    .app-header {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 1.1rem;
    }
}

/* Scrollbar */
.settings-content::-webkit-scrollbar {
    width: 6px;
}
.settings-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}
.settings-content::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 136, 0.3);
    border-radius: 3px;
}
.settings-content::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 136, 0.5);
}