* {
    scrollbar-width: thin;
    scrollbar-color: rgba(102, 126, 234, 0.5) rgba(255, 255, 255, 0.05);
    pointer-events: auto;
    user-select: text;
}

:root {
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.3);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: text;
    -webkit-user-select: text;
}

.sidebar {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 2px 0 40px rgba(0, 0, 0, 0.25);
    pointer-events: auto;
}

.sidebar-header {
    padding: 16px;
    gap: 12px;
}

.header {
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    padding: 12px 20px;
    box-shadow: var(--shadow-md);
}

.btn {
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
    font-family: inherit;
}

.btn::before {
    background: rgba(255, 255, 255, 0.2);
    transition: width 0.4s ease, height 0.4s ease;
}

.btn:active::before {
    width: 200px;
    height: 200px;
}

.btn.primary {
    box-shadow: var(--shadow-sm);
}

.btn.primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    filter: brightness(1.1);
}

.btn.primary:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.chat-container {
    padding: 24px;
    gap: 20px;
}

.welcome-content {
    max-width: 520px;
    gap: 24px;
}

.welcome-logo {
    width: 64px;
    height: 64px;
}

.welcome-logo-img {
    border-radius: var(--radius-lg);
    opacity: 0.85;
}

.welcome-greeting {
    font-size: 32px;
    font-weight: 600;
    letter-spacing: -0.5px;
}

.welcome-suggestions {
    gap: 10px;
}

.suggestion-chip {
    padding: 14px 18px;
    border-radius: 14px;
    border-color: rgba(255, 255, 255, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.suggestion-chip:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.message {
    margin-bottom: 16px;
    animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message-avatar {
    width: 36px;
    height: 36px;
    font-weight: 600;
    font-size: 14px;
}

.message.user .message-avatar {
    margin-left: 12px;
}

.message.ai .message-avatar {
    margin-right: 12px;
}

.message-content {
    border-radius: var(--radius-lg);
    padding: 14px 18px;
    max-width: 70%;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transition: box-shadow var(--transition-normal);
}

.message-content:hover {
    box-shadow: var(--shadow-lg);
}

.message.user .message-content {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-sm);
}

.message.ai .message-content {
    border-color: rgba(255, 255, 255, 0.08);
}

.input-container {
    padding: 16px 20px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.15);
}

.image-preview-container {
    margin-bottom: 12px;
}

.input-wrapper {
    gap: 8px;
}

#messageInput {
    border-color: rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: 14px 18px;
    font-size: 15px;
    min-height: 48px;
    transition: all var(--transition-normal);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    font-family: inherit;
}

#messageInput:focus {
    border-color: var(--primary-color, #667eea);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

#messageInput::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

#sendButton {
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
}

#sendButton::before {
    background: rgba(255, 255, 255, 0.12);
    transition: left 0.4s ease;
}

#sendButton:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
    filter: brightness(1.1);
}

#sendButton:active:not(:disabled) {
    transform: scale(0.95);
}

#sendButton:disabled {
    opacity: 0.4;
}

.loading-indicator {
    bottom: 140px;
    padding: 12px 24px;
    border-radius: var(--radius-xl);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    gap: 12px;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg);
    animation: loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingPulse {
    0%, 100% { box-shadow: var(--shadow-lg); }
    50% { box-shadow: 0 8px 48px rgba(102, 126, 234, 0.5); }
}

.loading-indicator.show {
    animation: loadingSlideIn 0.25s ease-out, loadingPulse 2s ease-in-out infinite;
}

@keyframes loadingSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.typing-indicator {
    gap: 5px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    animation: typing 1.2s infinite ease-in-out;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 768px) {
    .sidebar {
        background: rgba(15, 15, 25, 0.98);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

/* ===== FUTURISTIC UI ENHANCEMENTS ===== */

/* Animated gradient border effect for primary buttons */
.btn.primary {
    position: relative;
    overflow: hidden;
    border: none;
}

.btn.primary::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: linear-gradient(45deg, var(--primary-color), var(--primary-dark), var(--primary-color));
    background-size: 200% 200%;
    border-radius: inherit;
    z-index: -1;
    animation: gradientRotate 3s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn.primary:hover::after {
    opacity: 1;
}

@keyframes gradientRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Futuristic glow effects */
.btn.primary {
    box-shadow:
        0 4px 15px rgba(var(--primary-color-rgb, 102, 126, 234), 0.3),
        0 0 30px rgba(var(--primary-color-rgb, 102, 126, 234), 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.btn.primary:hover:not(:disabled) {
    box-shadow:
        0 6px 25px rgba(var(--primary-color-rgb, 102, 126, 234), 0.5),
        0 0 50px rgba(var(--primary-color-rgb, 102, 126, 234), 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Message bubbles with futuristic glow */
.message.user .message-content {
    background: linear-gradient(135deg,
        rgba(var(--primary-color-rgb, 102, 126, 234), 0.9) 0%,
        rgba(var(--primary-dark-rgb, 118, 75, 162), 0.9) 100%);
    box-shadow:
        0 4px 20px rgba(var(--primary-color-rgb, 102, 126, 234), 0.3),
        0 0 40px rgba(var(--primary-color-rgb, 102, 126, 234), 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.message.ai .message-content {
    background: rgba(255, 255, 255, 0.05);
    box-shadow:
        0 4px 20px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Input field futuristic styling */
#messageInput {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 1px 0 rgba(255, 255, 255, 0.05);
}

#messageInput:focus {
    border-color: var(--primary-color);
    box-shadow:
        0 0 0 3px rgba(var(--primary-color-rgb, 102, 126, 234), 0.15),
        0 0 30px rgba(var(--primary-color-rgb, 102, 126, 234), 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Sidebar futuristic styling */
.sidebar {
    background: linear-gradient(180deg,
        rgba(20, 20, 35, 0.95) 0%,
        rgba(15, 15, 30, 0.98) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow:
        2px 0 40px rgba(0, 0, 0, 0.3),
        inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

/* Header glass effect */
.header {
    background: rgba(20, 20, 35, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow:
        0 4px 30px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* Suggestion chips with hover glow */
.suggestion-chip {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.suggestion-chip:hover {
    background: rgba(var(--primary-color-rgb, 102, 126, 234), 0.1);
    border-color: rgba(var(--primary-color-rgb, 102, 126, 234), 0.4);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.2),
        0 0 30px rgba(var(--primary-color-rgb, 102, 126, 234), 0.15);
    transform: translateY(-3px) scale(1.02);
}

/* Loading indicator with pulse glow */
.loading-indicator {
    background: rgba(20, 20, 35, 0.9);
    border: 1px solid rgba(var(--primary-color-rgb, 102, 126, 234), 0.2);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(var(--primary-color-rgb, 102, 126, 234), 0.1);
}

/* Scrollbar futuristic styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg,
        rgba(var(--primary-color-rgb, 102, 126, 234), 0.6) 0%,
        rgba(var(--primary-dark-rgb, 118, 75, 162), 0.6) 100%);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg,
        rgba(var(--primary-color-rgb, 102, 126, 234), 0.8) 0%,
        rgba(var(--primary-dark-rgb, 118, 75, 162), 0.8) 100%);
}

/* Smooth animations for all interactive elements */
button, .btn, .suggestion-chip, .chat-item, .action-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Welcome screen enhancements */
.welcome-content {
    text-align: center;
}

.welcome-logo {
    filter: drop-shadow(0 0 30px rgba(var(--primary-color-rgb, 102, 126, 234), 0.4));
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.welcome-greeting {
    background: linear-gradient(135deg, #fff 0%, rgba(255, 255, 255, 0.7) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 2px 20px rgba(var(--primary-color-rgb, 102, 126, 234), 0.2);
}

/* New chat button futuristic styling */
#newChatBtn {
    background: linear-gradient(135deg,
        rgba(var(--primary-color-rgb, 102, 126, 234), 0.9) 0%,
        rgba(var(--primary-dark-rgb, 118, 75, 162), 0.9) 100%);
    border: none;
    box-shadow:
        0 4px 15px rgba(var(--primary-color-rgb, 102, 126, 234), 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#newChatBtn:hover {
    box-shadow:
        0 6px 25px rgba(var(--primary-color-rgb, 102, 126, 234), 0.5),
        0 0 40px rgba(var(--primary-color-rgb, 102, 126, 234), 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Send button futuristic */
#sendButton {
    background: linear-gradient(135deg,
        var(--primary-color) 0%,
        var(--primary-dark) 100%);
    border: none;
    box-shadow:
        0 4px 15px rgba(var(--primary-color-rgb, 102, 126, 234), 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

#sendButton:hover:not(:disabled) {
    box-shadow:
        0 6px 25px rgba(var(--primary-color-rgb, 102, 126, 234), 0.6),
        0 0 50px rgba(var(--primary-color-rgb, 102, 126, 234), 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   COSMIC UNIVERSE THEME  â€“  Deep Space UI Enhancements
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€ Body: deep-space base â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
body {
    background: radial-gradient(ellipse at 30% 20%, #0d0620 0%, #020010 45%, #000008 100%) !important;
}

/* Make .app visible immediately â€” Clerk JS still handles auth redirects */
.app {
    visibility: visible !important;
    opacity: 1 !important;
    background: transparent !important;
    animation: none !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Space canvas sits inside .app as first child, behind all UI */
#spaceCanvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* Ensure main content area is transparent so the canvas shows through */
.main-content {
    background: transparent !important;
}

/* â”€â”€ Sidebar: nebula glass â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.sidebar {
    background: linear-gradient(180deg,
        rgba(12, 8, 32, 0.92) 0%,
        rgba(8, 4, 24, 0.96) 100%) !important;
    border-right: 1px solid rgba(120, 80, 220, 0.18) !important;
    box-shadow:
        2px 0 60px rgba(80, 30, 160, 0.25),
        inset -1px 0 0 rgba(140, 100, 255, 0.06) !important;
}

/* â”€â”€ Header: deep cosmos glass â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.header {
    background: rgba(8, 4, 28, 0.82) !important;
    border-bottom: 1px solid rgba(100, 60, 200, 0.2) !important;
    box-shadow:
        0 4px 40px rgba(60, 20, 120, 0.3),
        inset 0 1px 0 rgba(160, 120, 255, 0.08) !important;
}

/* â”€â”€ Input container: space-station dock â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.input-container {
    background: rgba(8, 4, 28, 0.85) !important;
    border-top: 1px solid rgba(100, 60, 200, 0.18) !important;
    box-shadow: 0 -8px 60px rgba(40, 10, 100, 0.4) !important;
}

/* â”€â”€ Welcome screen: galaxy center â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.welcome-logo {
    position: relative;
    display: inline-block;
    filter: drop-shadow(0 0 40px rgba(var(--primary-color-rgb, 102, 126, 234), 0.7))
            drop-shadow(0 0 80px rgba(var(--primary-color-rgb, 102, 126, 234), 0.3)) !important;
    animation: cosmicFloat 4s ease-in-out infinite !important;
}

@keyframes cosmicFloat {
    0%, 100% { transform: translateY(0) scale(1);    filter: drop-shadow(0 0 40px rgba(var(--primary-color-rgb,102,126,234),0.7)) drop-shadow(0 0 80px rgba(var(--primary-color-rgb,102,126,234),0.3)); }
    50%       { transform: translateY(-10px) scale(1.03); filter: drop-shadow(0 0 60px rgba(var(--primary-color-rgb,102,126,234),0.9)) drop-shadow(0 0 120px rgba(var(--primary-color-rgb,102,126,234),0.4)); }
}

/* Orbital ring around logo */
.welcome-logo::before {
    content: '';
    position: absolute;
    inset: -22px;
    border-radius: 50%;
    border: 1.5px solid rgba(var(--primary-color-rgb, 102, 126, 234), 0.4);
    animation: orbitRing1 6s linear infinite;
    box-shadow: 0 0 12px rgba(var(--primary-color-rgb, 102, 126, 234), 0.3),
                inset 0 0 12px rgba(var(--primary-color-rgb, 102, 126, 234), 0.1);
}

.welcome-logo::after {
    content: '';
    position: absolute;
    inset: -38px;
    border-radius: 50%;
    border: 1px solid rgba(var(--primary-color-rgb, 102, 126, 234), 0.2);
    border-top-color: rgba(var(--primary-color-rgb, 102, 126, 234), 0.7);
    animation: orbitRing2 10s linear infinite;
}

@keyframes orbitRing1 {
    from { transform: rotate(0deg) scaleX(1) scaleY(0.6); }
    to   { transform: rotate(360deg) scaleX(1) scaleY(0.6); }
}

@keyframes orbitRing2 {
    from { transform: rotate(0deg) scaleX(0.7) scaleY(1); }
    to   { transform: rotate(-360deg) scaleX(0.7) scaleY(1); }
}

/* Orbiting dot on ring 1 */
.welcome-logo-img::before {
    content: '';
    position: absolute;
    width: 8px;
    height: 8px;
    background: rgba(var(--primary-color-rgb, 102, 126, 234), 1);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(var(--primary-color-rgb, 102, 126, 234), 1);
    top: -26px;
    left: 50%;
    transform: translateX(-50%);
    animation: orbitDot 6s linear infinite;
}

@keyframes orbitDot {
    from { transform: translateX(-50%) rotate(0deg) translateY(-4px); }
    to   { transform: translateX(-50%) rotate(360deg) translateY(-4px); }
}

/* â”€â”€ Welcome greeting: cosmic text â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.welcome-greeting {
    background: linear-gradient(135deg,
        #ffffff 0%,
        rgba(var(--primary-color-rgb, 102, 126, 234), 0.9) 50%,
        #ffffff 100%) !important;
    background-size: 200% 200% !important;
    -webkit-background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    background-clip: text !important;
    animation: shimmerText 5s ease-in-out infinite !important;
}

@keyframes shimmerText {
    0%, 100% { background-position: 0% 50%; }
    50%       { background-position: 100% 50%; }
}

/* â”€â”€ Suggestion chips: cosmic panel â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.suggestion-chip {
    background: rgba(30, 15, 70, 0.45) !important;
    border: 1px solid rgba(120, 80, 220, 0.2) !important;
    backdrop-filter: blur(12px) !important;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative;
    overflow: hidden;
}

.suggestion-chip::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg,
        rgba(var(--primary-color-rgb, 102, 126, 234), 0) 0%,
        rgba(var(--primary-color-rgb, 102, 126, 234), 0.12) 100%);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.suggestion-chip:hover::before {
    opacity: 1;
}

.suggestion-chip:hover {
    background: rgba(50, 25, 110, 0.65) !important;
    border-color: rgba(var(--primary-color-rgb, 102, 126, 234), 0.55) !important;
    box-shadow:
        0 8px 32px rgba(var(--primary-color-rgb, 102, 126, 234), 0.25),
        0 0 50px rgba(var(--primary-color-rgb, 102, 126, 234), 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-4px) scale(1.02) !important;
}

/* â”€â”€ Message bubbles: cosmic containers â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.message.user .message-content {
    background: linear-gradient(135deg,
        rgba(var(--primary-color-rgb, 102, 126, 234), 0.85) 0%,
        rgba(var(--primary-dark-rgb, 118, 75, 162), 0.85) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    box-shadow:
        0 4px 25px rgba(var(--primary-color-rgb, 102, 126, 234), 0.35),
        0 0 60px rgba(var(--primary-color-rgb, 102, 126, 234), 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
}

.message.ai .message-content {
    background: rgba(20, 10, 50, 0.55) !important;
    border: 1px solid rgba(120, 80, 220, 0.15) !important;
    box-shadow:
        0 4px 25px rgba(0, 0, 0, 0.35),
        inset 0 1px 0 rgba(140, 100, 255, 0.08) !important;
}

.message.ai .message-content:hover {
    border-color: rgba(var(--primary-color-rgb, 102, 126, 234), 0.3) !important;
    box-shadow:
        0 6px 35px rgba(var(--primary-color-rgb, 102, 126, 234), 0.15),
        inset 0 1px 0 rgba(140, 100, 255, 0.12) !important;
}

/* â”€â”€ Message animation: drift in from space â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
        filter: blur(4px);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

.message {
    animation: messageSlideIn 0.45s cubic-bezier(0.34, 1.2, 0.64, 1) !important;
}

/* â”€â”€ Input field: space terminal â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#messageInput {
    background: rgba(10, 5, 30, 0.55) !important;
    border: 1px solid rgba(100, 60, 200, 0.25) !important;
    color: rgba(220, 210, 255, 1) !important;
}

#messageInput::placeholder {
    color: rgba(160, 130, 220, 0.45) !important;
}

#messageInput:focus {
    border-color: rgba(var(--primary-color-rgb, 102, 126, 234), 0.7) !important;
    box-shadow:
        0 0 0 3px rgba(var(--primary-color-rgb, 102, 126, 234), 0.18),
        0 0 40px rgba(var(--primary-color-rgb, 102, 126, 234), 0.25),
        inset 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}

/* â”€â”€ Buttons: cosmic glow â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
#newChatBtn, #sendButton {
    box-shadow:
        0 4px 20px rgba(var(--primary-color-rgb, 102, 126, 234), 0.4),
        0 0 40px rgba(var(--primary-color-rgb, 102, 126, 234), 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#newChatBtn:hover, #sendButton:hover:not(:disabled) {
    box-shadow:
        0 6px 30px rgba(var(--primary-color-rgb, 102, 126, 234), 0.65),
        0 0 80px rgba(var(--primary-color-rgb, 102, 126, 234), 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
    transform: translateY(-2px) scale(1.03) !important;
}

/* â”€â”€ Loading indicator: warp bubble â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.loading-indicator {
    background: rgba(12, 6, 35, 0.92) !important;
    border: 1px solid rgba(var(--primary-color-rgb, 102, 126, 234), 0.35) !important;
    box-shadow:
        0 8px 40px rgba(var(--primary-color-rgb, 102, 126, 234), 0.2),
        0 0 80px rgba(var(--primary-color-rgb, 102, 126, 234), 0.1) !important;
    animation: warpPulse 2s ease-in-out infinite !important;
}

@keyframes warpPulse {
    0%, 100% {
        box-shadow: 0 8px 40px rgba(var(--primary-color-rgb,102,126,234),0.2), 0 0 80px rgba(var(--primary-color-rgb,102,126,234),0.1);
    }
    50% {
        box-shadow: 0 8px 60px rgba(var(--primary-color-rgb,102,126,234),0.45), 0 0 120px rgba(var(--primary-color-rgb,102,126,234),0.22);
    }
}

/* â”€â”€ Typing dots: plasma pulse â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.typing-indicator span {
    background: radial-gradient(circle, rgba(var(--primary-color-rgb,102,126,234),1) 0%, rgba(var(--primary-dark-rgb,118,75,162),0.8) 100%) !important;
    box-shadow: 0 0 8px rgba(var(--primary-color-rgb,102,126,234),0.8) !important;
}

/* â”€â”€ Scrollbar: nebula stream â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
::-webkit-scrollbar-track {
    background: rgba(10, 5, 25, 0.6) !important;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg,
        rgba(var(--primary-color-rgb, 102, 126, 234), 0.7) 0%,
        rgba(var(--primary-dark-rgb, 118, 75, 162), 0.7) 100%) !important;
    border-color: rgba(10, 5, 25, 0.8) !important;
    box-shadow: 0 0 8px rgba(var(--primary-color-rgb,102,126,234),0.5);
}

/* â”€â”€ Loading screen: approaching warp â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.loading-screen {
    background: radial-gradient(ellipse at center,
        #0d0620 0%,
        #040012 50%,
        #000008 100%) !important;
}

/* Warp speed lines behind loading ring */
.loading-screen::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        repeating-conic-gradient(
            rgba(102, 126, 234, 0.03) 0deg,
            transparent 1deg,
            transparent 10deg
        );
    animation: warpRotate 20s linear infinite;
}

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

.loading-ring {
    border-color: rgba(80, 50, 180, 0.15) !important;
    border-top-color: var(--primary-color) !important;
    box-shadow:
        0 0 30px rgba(var(--primary-color-rgb, 102, 126, 234), 0.5),
        inset 0 0 30px rgba(var(--primary-color-rgb, 102, 126, 234), 0.1) !important;
}

/* â”€â”€ Chat items: mission log â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.chat-item {
    border: 1px solid transparent !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

.chat-item:hover {
    background: rgba(60, 30, 130, 0.35) !important;
    border-color: rgba(var(--primary-color-rgb, 102, 126, 234), 0.25) !important;
    box-shadow: 0 0 20px rgba(var(--primary-color-rgb, 102, 126, 234), 0.1) !important;
}

/* â”€â”€ Modals / panels: star-station windows â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.settings-panel, #settingsPanel,
.memory-panel, #memoryPanel,
#personaCreatorModal {
    background: rgba(8, 4, 28, 0.96) !important;
    border: 1px solid rgba(120, 80, 220, 0.2) !important;
    backdrop-filter: blur(30px) !important;
    -webkit-backdrop-filter: blur(30px) !important;
    box-shadow: 0 20px 80px rgba(40, 10, 100, 0.7) !important;
}

/* â”€â”€ Cursor cosmic comet trail (CSS-only) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
/* We use JS for real cursor effects; CSS adds the subtle aura */
* { cursor: default; }
button, a, [role="button"], .chat-item, .suggestion-chip,
.theme-option, .ai-mode-option {
    cursor: pointer !important;
}

/* â”€â”€ Particles container â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.particles {
    display: block;
}

/* â”€â”€ Orbit rings (DOM elements inside .welcome-logo) â”€â”€â”€â”€ */
.welcome-logo {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
}

.orbit-ring {
    position: absolute;
    border-radius: 50%;
    border: 1.5px solid transparent;
    pointer-events: none;
}

.orbit-ring-1 {
    inset: -22px;
    border-color: rgba(var(--primary-color-rgb, 102, 126, 234), 0.4);
    box-shadow: 0 0 14px rgba(var(--primary-color-rgb, 102, 126, 234), 0.25);
    transform: scaleY(0.55);
    animation: orbitSpin1 6s linear infinite;
}

.orbit-ring-2 {
    inset: -36px;
    border-top-color: rgba(var(--primary-color-rgb, 102, 126, 234), 0.6);
    border-color: rgba(var(--primary-color-rgb, 102, 126, 234), 0.15);
    transform: scaleX(0.6);
    animation: orbitSpin2 11s linear infinite;
}

@keyframes orbitSpin1 {
    from { transform: scaleY(0.55) rotate(0deg); }
    to   { transform: scaleY(0.55) rotate(360deg); }
}

@keyframes orbitSpin2 {
    from { transform: scaleX(0.6) rotate(0deg); }
    to   { transform: scaleX(0.6) rotate(-360deg); }
}

.orbit-dot {
    position: absolute;
    width: 7px;
    height: 7px;
    background: rgba(var(--primary-color-rgb, 102, 126, 234), 1);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(var(--primary-color-rgb, 102, 126, 234), 1),
                0 0 20px rgba(var(--primary-color-rgb, 102, 126, 234), 0.5);
    top: -3.5px;
    left: 50%;
    transform: translateX(-50%);
}

/* â”€â”€ Welcome subtitle â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.welcome-subtitle {
    font-size: 14px;
    color: rgba(160, 130, 220, 0.65);
    letter-spacing: 0.06em;
    margin-top: -8px;
    animation: shimmerText 7s ease-in-out infinite;
}

/* â”€â”€ Override: remove CSS pseudo-element rings (now DOM) â”€ */
.welcome-logo::before,
.welcome-logo::after {
    display: none !important;
}

.cosmos-hint {
    position: fixed;
    bottom: 20px;
    right: 24px;
    font-size: 11px;
    color: rgba(140, 110, 220, 0.5);
    pointer-events: none;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    z-index: 2;
    animation: hintFade 8s ease-in-out forwards;
}

@keyframes hintFade {
    0%   { opacity: 0; transform: translateY(6px); }
    15%  { opacity: 1; transform: translateY(0); }
    75%  { opacity: 1; }
    100% { opacity: 0; }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   AI PERSONALITY PANEL â€” Cosmic Space Theme
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* Trigger button in header */
.ai-mode-display {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 6px 13px;
    border-radius: 20px;
    background: rgba(80, 40, 160, 0.18);
    border: 1px solid rgba(130, 80, 240, 0.35);
    color: rgba(180, 150, 255, 0.9);
    cursor: pointer;
    transition: all 0.25s ease;
    user-select: none;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    box-shadow: 0 0 12px rgba(120, 60, 220, 0.15), inset 0 1px 0 rgba(255,255,255,0.06);
}

.ai-mode-display:hover,
.ai-mode-display.dropdown-open {
    background: rgba(100, 50, 200, 0.32);
    border-color: rgba(150, 100, 255, 0.65);
    color: #c4a8ff;
    box-shadow: 0 0 20px rgba(120, 60, 220, 0.35), inset 0 1px 0 rgba(255,255,255,0.1);
}

.ai-mode-display i:first-child {
    font-size: 0.85rem;
    color: #a78bfa;
}

.ai-mode-chevron {
    font-size: 0.55rem;
    margin-left: 1px;
    opacity: 0.6;
    transition: transform 0.25s ease, opacity 0.2s;
}

.ai-mode-display.dropdown-open .ai-mode-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* Dropdown panel */
.ai-mode-dropdown-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 295px;
    background: linear-gradient(160deg, rgba(14, 8, 38, 0.97) 0%, rgba(8, 4, 28, 0.98) 100%);
    border: 1px solid rgba(120, 70, 240, 0.35);
    border-radius: 18px;
    box-shadow:
        0 0 0 1px rgba(80, 40, 180, 0.12),
        0 16px 60px rgba(10, 5, 40, 0.85),
        0 0 40px rgba(90, 40, 180, 0.2),
        inset 0 1px 0 rgba(160, 120, 255, 0.08);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) scale(0.96);
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s;
    z-index: 9999;
}

.ai-mode-dropdown-panel.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Header */
.ai-mode-dropdown-header {
    padding: 14px 16px 11px;
    font-weight: 700;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(160, 120, 255, 0.65);
    border-bottom: 1px solid rgba(100, 60, 200, 0.2);
    background: linear-gradient(90deg, rgba(100,50,200,0.1) 0%, transparent 100%);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-mode-dropdown-header::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: radial-gradient(circle, #a78bfa 0%, #7c3aed 100%);
    box-shadow: 0 0 8px rgba(167, 139, 250, 0.8);
    flex-shrink: 0;
}

/* Scrollable list */
.ai-mode-dropdown-list {
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
    scrollbar-width: thin;
    scrollbar-color: rgba(120, 70, 220, 0.3) transparent;
}

.ai-mode-dropdown-list::-webkit-scrollbar {
    width: 3px;
}

.ai-mode-dropdown-list::-webkit-scrollbar-thumb {
    background: rgba(120, 70, 220, 0.35);
    border-radius: 3px;
}

/* Each option â€” JS renders class: ai-mode-dropdown-item */
.ai-mode-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.18s ease, box-shadow 0.18s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 2px;
}

.ai-mode-dropdown-item::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(120, 70, 240, 0.06) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.ai-mode-dropdown-item:hover {
    background: rgba(100, 55, 200, 0.18);
    box-shadow: inset 0 0 0 1px rgba(130, 80, 240, 0.2);
}

.ai-mode-dropdown-item:hover::before {
    opacity: 1;
}

.ai-mode-dropdown-item.active {
    background: linear-gradient(90deg, rgba(110, 55, 210, 0.38) 0%, rgba(80, 35, 170, 0.22) 100%);
    box-shadow:
        inset 0 0 0 1px rgba(150, 100, 255, 0.35),
        0 0 16px rgba(110, 55, 210, 0.2);
}

.ai-mode-dropdown-item.active::before {
    opacity: 1;
}

/* Icon circle */
.ai-mode-dropdown-item i {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 14px;
    flex-shrink: 0;
    background: rgba(80, 40, 160, 0.3);
    color: #a78bfa;
    border: 1px solid rgba(120, 70, 220, 0.3);
    transition: all 0.2s ease;
    box-shadow: 0 0 10px rgba(100, 50, 200, 0.15);
}

.ai-mode-dropdown-item.active i {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.7) 0%, rgba(99, 38, 197, 0.7) 100%);
    color: #e4d4ff;
    border-color: rgba(167, 139, 250, 0.5);
    box-shadow: 0 0 14px rgba(124, 58, 237, 0.5);
}

.ai-mode-dropdown-item:hover i {
    background: rgba(100, 55, 200, 0.4);
    box-shadow: 0 0 14px rgba(120, 60, 220, 0.3);
}

/* Info text block */
.ai-mode-dropdown-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.ai-mode-dropdown-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: rgba(220, 210, 255, 0.92);
    line-height: 1.2;
}

.ai-mode-dropdown-desc {
    font-size: 0.72rem;
    color: rgba(140, 110, 200, 0.65);
    line-height: 1.2;
}

/* Active star indicator */
.ai-mode-dropdown-item.active .ai-mode-dropdown-name::after {
    content: ' âœ¦';
    color: #a78bfa;
    font-size: 0.6rem;
}

/* Per-mode icon tints via data-mode attribute */
.ai-mode-dropdown-item[data-mode="creative"] i   { color: #60d9f8; background: rgba(20, 150, 200, 0.25); border-color: rgba(60, 180, 230, 0.3); }
.ai-mode-dropdown-item[data-mode="creative"].active i { background: linear-gradient(135deg, rgba(20,120,200,0.7), rgba(10,80,180,0.7)); color: #a8ecff; border-color: rgba(80,200,240,0.5); box-shadow: 0 0 14px rgba(20,150,220,0.5); }

.ai-mode-dropdown-item[data-mode="professional"] i { color: #4ade80; background: rgba(20, 120, 70, 0.25); border-color: rgba(60, 180, 110, 0.3); }
.ai-mode-dropdown-item[data-mode="professional"].active i { background: linear-gradient(135deg, rgba(20,120,70,0.7), rgba(10,90,50,0.7)); color: #bbf7d0; border-color: rgba(80,200,120,0.5); box-shadow: 0 0 14px rgba(20,160,80,0.5); }

.ai-mode-dropdown-item[data-mode="roast"] i  { color: #fb923c; background: rgba(180, 60, 20, 0.25); border-color: rgba(240, 100, 50, 0.3); }
.ai-mode-dropdown-item[data-mode="roast"].active i { background: linear-gradient(135deg, rgba(200,60,20,0.7), rgba(180,40,10,0.7)); color: #fed7aa; border-color: rgba(250,120,60,0.5); box-shadow: 0 0 14px rgba(220,80,30,0.5); }

/* Divider for custom personalities */
.ai-mode-dropdown-divider {
    padding: 6px 12px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: rgba(130, 100, 200, 0.5);
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-mode-dropdown-divider::before,
.ai-mode-dropdown-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(100, 60, 200, 0.2);
}

/* Delete button for custom personas */
.ai-mode-delete-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: rgba(200, 80, 80, 0.4);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 11px;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
}

.ai-mode-delete-btn:hover {
    color: #f87171;
    background: rgba(200, 60, 60, 0.15);
}

/* Footer */
.ai-mode-dropdown-footer {
    padding: 8px;
    border-top: 1px solid rgba(100, 60, 200, 0.18);
    background: rgba(10, 5, 30, 0.4);
}

/* Create Personality button */
.ai-mode-create-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1.5px dashed rgba(120, 70, 220, 0.4);
    border-radius: 12px;
    background: rgba(80, 40, 160, 0.08);
    color: rgba(160, 120, 255, 0.7);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    transition: all 0.25s ease;
    font-family: inherit;
}

.ai-mode-create-btn:hover {
    border-color: rgba(167, 139, 250, 0.75);
    color: #c4a8ff;
    background: rgba(100, 55, 200, 0.2);
    box-shadow: 0 0 18px rgba(120, 60, 220, 0.25), inset 0 0 12px rgba(120, 60, 220, 0.1);
}

.ai-mode-create-btn i {
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.ai-mode-create-btn:hover i {
    transform: rotate(90deg);
}

/* Light mode overrides */
body.light-mode .ai-mode-display {
    background: rgba(124, 58, 237, 0.08);
    border-color: rgba(124, 58, 237, 0.3);
    color: #6d28d9;
}

body.light-mode .ai-mode-dropdown-panel {
    background: linear-gradient(160deg, rgba(245, 243, 255, 0.98) 0%, rgba(238, 235, 255, 0.99) 100%);
    border-color: rgba(124, 58, 237, 0.2);
    box-shadow: 0 12px 50px rgba(80, 40, 160, 0.15), inset 0 1px 0 rgba(255,255,255,0.5);
}

body.light-mode .ai-mode-dropdown-header {
    color: rgba(109, 40, 217, 0.7);
    border-bottom-color: rgba(124, 58, 237, 0.12);
    background: rgba(124, 58, 237, 0.04);
}

body.light-mode .ai-mode-dropdown-item:hover {
    background: rgba(124, 58, 237, 0.07);
}

body.light-mode .ai-mode-dropdown-item.active {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.12) 0%, rgba(109, 40, 217, 0.06) 100%);
}

body.light-mode .ai-mode-dropdown-name {
    color: #1e1040;
}

body.light-mode .ai-mode-dropdown-desc {
    color: rgba(100, 60, 160, 0.65);
}

body.light-mode .ai-mode-dropdown-footer {
    background: rgba(238, 235, 255, 0.5);
    border-top-color: rgba(124, 58, 237, 0.1);
}

body.light-mode .ai-mode-create-btn {
    border-color: rgba(124, 58, 237, 0.3);
    color: rgba(109, 40, 217, 0.7);
    background: transparent;
}

body.light-mode .ai-mode-create-btn:hover {
    border-color: #7c3aed;
    color: #6d28d9;
    background: rgba(124, 58, 237, 0.06);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.15);
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   ENHANCED AI MODE BUTTON
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

@keyframes modePulse {
    0%, 100% { box-shadow: 0 0 10px rgba(120, 60, 220, 0.2), inset 0 1px 0 rgba(255,255,255,0.07); }
    50%       { box-shadow: 0 0 22px rgba(140, 80, 255, 0.42), inset 0 1px 0 rgba(255,255,255,0.1); }
}

.ai-mode-display {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 14px;
    border-radius: 22px;
    background: linear-gradient(135deg, rgba(88, 44, 180, 0.28) 0%, rgba(60, 28, 140, 0.22) 100%);
    border: 1px solid rgba(140, 90, 255, 0.42);
    color: rgba(195, 165, 255, 0.95);
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    user-select: none;
    transition: all 0.25s ease;
    animation: modePulse 4s ease-in-out infinite;
}

.ai-mode-display:hover,
.ai-mode-display.dropdown-open {
    background: linear-gradient(135deg, rgba(110, 55, 210, 0.45) 0%, rgba(80, 35, 175, 0.38) 100%);
    border-color: rgba(180, 130, 255, 0.7);
    color: #ddc8ff;
    animation: none;
    box-shadow: 0 0 26px rgba(130, 70, 240, 0.45), inset 0 1px 0 rgba(255,255,255,0.13);
    transform: translateY(-1px);
}

.ai-mode-display i:first-child {
    font-size: 0.9rem;
    color: #c4a0ff;
    filter: drop-shadow(0 0 5px rgba(180, 120, 255, 0.6));
}

.ai-mode-display #aiModeLabel {
    background: linear-gradient(90deg, #ddd0ff 0%, #c4a8ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

.ai-mode-chevron {
    font-size: 0.55rem;
    opacity: 0.65;
    transition: transform 0.25s ease, opacity 0.2s;
    color: #b89aee;
}

.ai-mode-display.dropdown-open .ai-mode-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   LIGHT MODE â€” Comprehensive Redesign
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* Background â€” soft cosmic lavender gradient */
body.light-mode {
    background: linear-gradient(145deg, #eef2ff 0%, #f5f0ff 40%, #faf5ff 100%) !important;
}

body.light-mode .app {
    background: transparent !important;
}

/* Main chat area */
body.light-mode .main-content {
    background: transparent;
}

body.light-mode .chat-container {
    background: rgba(255, 255, 255, 0.65) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 16px;
    box-shadow: 0 4px 30px rgba(100, 60, 200, 0.07), 0 1px 0 rgba(255,255,255,0.8) inset;
}

/* Header â€” frosted lavender glass */
body.light-mode .header {
    background: rgba(245, 242, 255, 0.88) !important;
    border-bottom: 1px solid rgba(140, 90, 220, 0.14) !important;
    box-shadow: 0 2px 20px rgba(100, 60, 180, 0.08) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
}

/* Sidebar â€” soft purple frosted glass */
body.light-mode .sidebar {
    background: rgba(240, 235, 255, 0.92) !important;
    border-right: 1px solid rgba(140, 90, 220, 0.14) !important;
    box-shadow: 3px 0 30px rgba(100, 60, 180, 0.08) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
}

body.light-mode .sidebar-header {
    background: linear-gradient(180deg, rgba(225, 215, 255, 0.6) 0%, transparent 100%);
    border-bottom: 1px solid rgba(140, 90, 220, 0.1);
}

/* New Chat button */
body.light-mode #newChatBtn,
body.light-mode .new-chat-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%) !important;
    color: #fff !important;
    border: none !important;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3) !important;
}

body.light-mode #newChatBtn:hover,
body.light-mode .new-chat-btn:hover {
    background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%) !important;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4) !important;
    transform: translateY(-1px);
}

/* Sidebar chat items */
body.light-mode .chat-item {
    color: #2d1b6e !important;
    border-radius: 10px;
}

body.light-mode .chat-item:hover {
    background: rgba(124, 58, 237, 0.1) !important;
    color: #5b21b6 !important;
}

body.light-mode .chat-item.active {
    background: linear-gradient(90deg, rgba(124, 58, 237, 0.18) 0%, rgba(109, 40, 217, 0.08) 100%) !important;
    color: #5b21b6 !important;
    border-left: 3px solid #7c3aed !important;
    box-shadow: inset 0 0 0 1px rgba(124, 58, 237, 0.15);
}

/* AI message bubbles */
body.light-mode .message.ai .message-content {
    background: rgba(255, 255, 255, 0.92) !important;
    color: #1e1040 !important;
    border: 1px solid rgba(140, 90, 220, 0.16) !important;
    box-shadow: 0 2px 12px rgba(100, 60, 180, 0.06) !important;
    backdrop-filter: blur(8px);
}

/* User message bubbles */
body.light-mode .message.user .message-content {
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 50%, #5b21b6 100%) !important;
    color: #fff !important;
    box-shadow: 0 4px 18px rgba(109, 40, 217, 0.32) !important;
}

/* Input container */
body.light-mode .input-container {
    background: rgba(245, 242, 255, 0.92) !important;
    border-top: 1px solid rgba(140, 90, 220, 0.14) !important;
    box-shadow: 0 -4px 24px rgba(100, 60, 180, 0.07) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
}

body.light-mode #messageInput {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1.5px solid rgba(140, 90, 220, 0.2) !important;
    color: #1e1040 !important;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(100, 60, 180, 0.06);
}

body.light-mode #messageInput:focus {
    border-color: rgba(124, 58, 237, 0.55) !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1), 0 2px 8px rgba(100, 60, 180, 0.08) !important;
}

body.light-mode #messageInput::placeholder {
    color: rgba(100, 60, 180, 0.4) !important;
}

/* Send button */
body.light-mode #sendButton,
body.light-mode .send-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%) !important;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.3) !important;
}

/* Suggestion chips */
body.light-mode .suggestion-chip {
    background: rgba(255, 255, 255, 0.88) !important;
    border: 1px solid rgba(140, 90, 220, 0.2) !important;
    color: #3b1d8e !important;
    box-shadow: 0 2px 8px rgba(100, 60, 180, 0.07);
}

body.light-mode .suggestion-chip:hover {
    background: rgba(124, 58, 237, 0.1) !important;
    border-color: rgba(124, 58, 237, 0.4) !important;
    color: #5b21b6 !important;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.15);
}

/* Header buttons (settings, etc.) */
body.light-mode .btn:not(.primary):not(.danger) {
    background: rgba(255, 255, 255, 0.85) !important;
    border: 1px solid rgba(140, 90, 220, 0.18) !important;
    color: #2d1b6e !important;
}

body.light-mode .btn:not(.primary):not(.danger):hover {
    background: rgba(240, 235, 255, 0.95) !important;
    border-color: rgba(124, 58, 237, 0.35) !important;
    color: #5b21b6 !important;
}

/* Action buttons on messages */
body.light-mode .action-btn {
    background: rgba(245, 242, 255, 0.9) !important;
    border: 1px solid rgba(140, 90, 220, 0.18) !important;
    color: rgba(80, 40, 160, 0.7) !important;
}

body.light-mode .action-btn:hover {
    background: rgba(124, 58, 237, 0.1) !important;
    border-color: rgba(124, 58, 237, 0.35) !important;
    color: #6d28d9 !important;
}

/* AI mode button in light mode â€” keep it vivid */
body.light-mode .ai-mode-display {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.14) 0%, rgba(109, 40, 217, 0.08) 100%) !important;
    border-color: rgba(124, 58, 237, 0.42) !important;
    color: #5b21b6 !important;
    animation: none;
    box-shadow: 0 2px 12px rgba(124, 58, 237, 0.14);
}

body.light-mode .ai-mode-display:hover,
body.light-mode .ai-mode-display.dropdown-open {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.22) 0%, rgba(109, 40, 217, 0.15) 100%) !important;
    border-color: rgba(124, 58, 237, 0.65) !important;
    box-shadow: 0 4px 18px rgba(124, 58, 237, 0.22) !important;
}

body.light-mode .ai-mode-display i:first-child {
    color: #7c3aed !important;
    filter: none;
}

body.light-mode .ai-mode-display #aiModeLabel {
    background: linear-gradient(90deg, #5b21b6 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Welcome screen in light mode */
body.light-mode .welcome-greeting {
    color: #2d1b6e;
}

body.light-mode .welcome-subtitle {
    color: rgba(80, 40, 160, 0.65);
}

/* Code blocks in light mode */
body.light-mode .code-block-wrapper,
body.light-mode pre {
    background: rgba(240, 235, 255, 0.8) !important;
    border: 1px solid rgba(140, 90, 220, 0.2) !important;
}

body.light-mode code {
    background: rgba(220, 210, 255, 0.5) !important;
    color: #3b1d8e !important;
}

/* Scrollbar in light mode */
body.light-mode * {
    scrollbar-color: rgba(124, 58, 237, 0.3) rgba(200, 185, 255, 0.2);
}

body.light-mode ::-webkit-scrollbar-thumb {
    background: rgba(124, 58, 237, 0.3) !important;
}

body.light-mode ::-webkit-scrollbar-track {
    background: rgba(200, 185, 255, 0.1) !important;
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   CREATE AI MODE â€” Futuristic Space Redesign
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* ── Persona Creator — Space Theme Overrides ──────── */

.persona-stars-canvas {
    position: absolute !important;
    inset: 0 !important;
    z-index: 0 !important;
    pointer-events: none !important;
}

.persona-creator-modal {
    background: radial-gradient(ellipse at 20% 40%, rgba(20, 8, 50, 0.94) 0%, rgba(2, 2, 10, 0.97) 60%) !important;
    backdrop-filter: blur(40px) !important;
    -webkit-backdrop-filter: blur(40px) !important;
    animation: pcmOverlayIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.persona-creator-content {
    background: linear-gradient(160deg, rgba(10, 6, 28, 0.98) 0%, rgba(4, 2, 16, 0.99) 100%) !important;
    border: 1px solid rgba(130, 80, 240, 0.25) !important;
    border-radius: 24px !important;
    box-shadow:
        0 0 0 1px rgba(100, 60, 200, 0.08),
        0 50px 140px rgba(4, 0, 20, 0.9),
        0 0 80px rgba(100, 60, 220, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
    animation: pcmCardIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow: hidden !important;
    position: relative !important;
}

.persona-creator-content::before {
    content: '' !important;
    position: absolute !important;
    top: 0 !important; left: 0 !important; right: 0 !important;
    height: 1px !important;
    background: linear-gradient(90deg, transparent, rgba(140, 100, 255, 0.5), rgba(80, 200, 255, 0.35), rgba(200, 130, 255, 0.3), transparent) !important;
    z-index: 2 !important;
    animation: shimmerLine 4s ease-in-out infinite !important;
}

@keyframes shimmerLine {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.persona-creator-content::after {
    content: '' !important;
    position: absolute !important;
    inset: 0 !important;
    background:
        radial-gradient(circle at 15% 85%, rgba(100, 60, 220, 0.04) 0%, transparent 50%),
        radial-gradient(circle at 85% 15%, rgba(60, 140, 255, 0.03) 0%, transparent 50%) !important;
    pointer-events: none !important;
    z-index: 0 !important;
}

.persona-creator-header {
    border-bottom: 1px solid rgba(120, 80, 220, 0.15) !important;
    background: linear-gradient(180deg, rgba(120, 80, 240, 0.06) 0%, transparent 100%) !important;
    position: relative !important;
    z-index: 1 !important;
}

.persona-header-icon {
    width: 48px !important; height: 48px !important;
    border-radius: 14px !important;
    background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 50%, #2563eb 100%) !important;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.45), inset 0 1px 0 rgba(255,255,255,0.15) !important;
    font-size: 20px !important;
    position: relative !important;
    overflow: visible !important;
    animation: personaIconFloat 4s ease-in-out infinite !important;
}

.persona-header-icon i {
    filter: drop-shadow(0 0 8px rgba(200, 160, 255, 0.8)) !important;
}

.persona-icon-orbit {
    position: absolute !important;
    inset: -7px !important;
    border-radius: 50% !important;
    border: 1px dashed rgba(140, 100, 255, 0.3) !important;
    animation: orbitSpin1 6s linear infinite !important;
    pointer-events: none !important;
}

.persona-creator-header h2 {
    font-size: 1.1rem !important; font-weight: 700 !important;
    background: linear-gradient(90deg, #e0d4ff 0%, #a5b4fc 50%, #67e8f9 100%) !important;
    -webkit-background-clip: text !important; -webkit-text-fill-color: transparent !important; background-clip: text !important;
}

.persona-header-sub { color: rgba(160, 140, 220, 0.5) !important; font-size: 0.75rem !important; }

.persona-creator-body { position: relative !important; z-index: 1 !important; }

.persona-step-label { color: rgba(180, 160, 240, 0.6) !important; letter-spacing: 0.1em !important; font-size: 0.68rem !important; }

.step-num {
    background: linear-gradient(135deg, #4c1d95, #7c3aed) !important;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.4) !important;
    border-radius: 8px !important; font-size: 10px !important;
}

.persona-name-input, #personaNameInput {
    background: rgba(100, 60, 200, 0.08) !important;
    border: 1.5px solid rgba(130, 80, 240, 0.2) !important;
    border-radius: 14px !important;
    color: rgba(220, 200, 255, 0.95) !important;
    padding: 14px 18px !important;
    font-size: 0.9rem !important;
    font-weight: 500 !important;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important;
    width: 100% !important; font-family: inherit !important;
}
.persona-name-input:focus, #personaNameInput:focus {
    border-color: rgba(167, 139, 250, 0.55) !important;
    background: rgba(120, 70, 220, 0.12) !important;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.12), 0 0 30px rgba(120, 80, 220, 0.08) !important;
    outline: none !important;
}
.persona-name-input::placeholder, #personaNameInput::placeholder { color: rgba(140, 110, 220, 0.35) !important; }

/* Traits grid scrollable */
.persona-traits-grid {
    max-height: 320px !important;
    overflow-y: auto !important;
    padding-right: 4px !important;
}

.persona-trait-chip {
    background: rgba(60, 30, 120, 0.12) !important;
    border: 1px solid rgba(110, 70, 210, 0.18) !important;
    border-radius: 12px !important;
    color: rgba(180, 160, 255, 0.75) !important;
    font-size: 0.75rem !important; gap: 7px !important; padding: 10px 11px !important;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important;
    position: relative !important; overflow: hidden !important;
}
.persona-trait-chip::before {
    content: '' !important; position: absolute !important; inset: 0 !important;
    background: radial-gradient(circle at 20% 50%, currentColor, transparent 70%) !important;
    opacity: 0 !important; transition: opacity 0.3s !important; pointer-events: none !important;
    mix-blend-mode: soft-light !important;
}
.persona-trait-chip:hover {
    background: rgba(90, 50, 180, 0.22) !important;
    border-color: rgba(160, 110, 255, 0.4) !important;
    color: #e0d4ff !important;
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 8px 24px rgba(100, 60, 220, 0.2), inset 0 0 12px rgba(160, 110, 255, 0.05) !important;
}
.persona-trait-chip:hover::before { opacity: 0.15 !important; }
.persona-trait-chip i { color: #a78bfa !important; font-size: 14px !important; filter: drop-shadow(0 0 4px rgba(167, 139, 250, 0.4)) !important; transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important; }
.persona-trait-chip:hover i { color: #c4b5fd !important; filter: drop-shadow(0 0 8px rgba(196, 181, 253, 0.6)) !important; }
.persona-trait-chip.active {
    background: linear-gradient(135deg, rgba(110, 60, 210, 0.3) 0%, rgba(80, 40, 170, 0.2) 100%) !important;
    border-color: rgba(167, 139, 250, 0.55) !important; color: #e0d4ff !important;
    box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.2), 0 0 24px rgba(120, 70, 240, 0.15) !important;
    animation: traitPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
.persona-trait-chip.active i { color: #ddd0ff !important; filter: drop-shadow(0 0 10px rgba(220, 180, 255, 0.7)) !important; }
.persona-trait-chip.active::after {
    content: '\f00c' !important; font-family: 'Font Awesome 5 Free' !important; font-weight: 900 !important;
    position: absolute !important; top: 4px !important; right: 4px !important; font-size: 7px !important;
    width: 15px !important; height: 15px !important;
    border-radius: 50% !important; background: linear-gradient(135deg, #7c3aed, #4c1d95) !important; color: #fff !important;
    display: flex !important; align-items: center !important; justify-content: center !important;
    box-shadow: 0 0 10px rgba(124, 58, 237, 0.5) !important;
    animation: pcmCheckIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
.persona-trait-chip.active::before { opacity: 0.1 !important; }
.persona-trait-chip.dragging { opacity: 0.3 !important; transform: scale(0.9) !important; filter: blur(1px) !important; }

.persona-bubble { width: 200px !important; height: 200px !important; }
.bubble-ring { border-radius: 50% !important; border: 1px solid transparent !important; position: absolute !important; pointer-events: none !important; }
.bubble-ring-1 { inset: 0 !important; border-color: rgba(140, 100, 255, 0.22) !important; animation: bubbleOrbit1 6s linear infinite !important; }
.bubble-ring-2 { inset: -10px !important; border-color: rgba(80, 200, 255, 0.12) !important; border-style: dashed !important; animation: bubbleOrbit2 10s linear infinite reverse !important; }
.bubble-ring-3 { inset: -20px !important; border-color: rgba(140, 100, 255, 0.07) !important; animation: bubbleOrbit1 18s linear infinite !important; }
.bubble-ring-4 { inset: -32px !important; border-color: rgba(80, 200, 255, 0.04) !important; border-style: dotted !important; animation: bubbleOrbit2 26s linear infinite reverse !important; }

.bubble-core {
    width: 155px !important; height: 155px !important;
    background: radial-gradient(circle at 35% 30%, rgba(130, 80, 240, 0.18), transparent 55%), radial-gradient(circle at 70% 70%, rgba(40, 140, 255, 0.1), transparent 50%), rgba(6, 4, 20, 0.95) !important;
    border: 2px solid rgba(130, 80, 240, 0.25) !important;
    box-shadow: inset 0 0 50px rgba(100, 60, 220, 0.08), 0 0 40px rgba(100, 60, 220, 0.06) !important;
    transition: all 0.5s cubic-bezier(0.22, 1, 0.36, 1) !important;
}

.persona-bubble:hover .bubble-core, .persona-bubble.drag-over .bubble-core {
    border-color: rgba(180, 140, 255, 0.6) !important;
    box-shadow: inset 0 0 60px rgba(130, 80, 255, 0.15), 0 0 50px rgba(130, 80, 255, 0.25) !important;
    background: radial-gradient(circle at 35% 30%, rgba(160, 100, 255, 0.25), transparent 55%), radial-gradient(circle at 70% 70%, rgba(60, 160, 255, 0.15), transparent 50%), rgba(10, 6, 28, 0.97) !important;
}

.bubble-placeholder { color: rgba(160, 130, 240, 0.35) !important; font-size: 0.72rem !important; letter-spacing: 0.05em !important; gap: 8px !important; }
.bubble-placeholder i { font-size: 20px !important; color: rgba(160, 120, 255, 0.45) !important; filter: drop-shadow(0 0 8px rgba(160, 120, 255, 0.3)) !important; }
.bubble-trait-count { font-size: 0.72rem !important; color: rgba(160, 130, 240, 0.4) !important; letter-spacing: 0.06em !important; }
.bubble-trait-count span { color: #a78bfa !important; font-weight: 700 !important; filter: drop-shadow(0 0 4px rgba(167, 139, 250, 0.4)) !important; }

.bubble-trait-orb {
    background: linear-gradient(135deg, #4c1d95, #7c3aed) !important;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.35), 0 0 12px rgba(100, 60, 220, 0.2) !important;
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.35s ease !important;
}
.bubble-trait-orb:hover {
    box-shadow: 0 6px 28px rgba(124, 58, 237, 0.5), 0 0 20px rgba(140, 100, 255, 0.25) !important;
}

.persona-selected-bar { gap: 7px !important; }
.selected-trait-tag {
    display: inline-flex !important; align-items: center !important; gap: 6px !important; padding: 6px 14px !important;
    border-radius: 100px !important; background: linear-gradient(135deg, rgba(120, 80, 220, 0.18) 0%, rgba(60, 40, 140, 0.12) 100%) !important;
    border: 1px solid rgba(167, 139, 250, 0.3) !important; color: #c4b5fd !important; font-size: 0.75rem !important; font-weight: 600 !important;
    box-shadow: 0 0 14px rgba(120, 70, 220, 0.12) !important; animation: pcmTagIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
}
.selected-trait-tag i { font-size: 11px !important; color: rgba(196, 181, 253, 0.6) !important; }
.selected-trait-tag i:hover { color: #f87171 !important; transform: scale(1.2) !important; }

.persona-creator-actions { border-top: 1px solid rgba(120, 80, 220, 0.1) !important; padding-top: 16px !important; margin-top: 4px !important; }

.persona-btn-cancel {
    padding: 11px 22px !important; border-radius: 12px !important;
    border: 1px solid rgba(130, 80, 240, 0.18) !important;
    background: rgba(100, 60, 200, 0.06) !important;
    color: rgba(180, 160, 240, 0.55) !important; font-weight: 600 !important; font-size: 0.82rem !important;
    transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1) !important; cursor: pointer !important;
    display: flex !important; align-items: center !important; gap: 6px !important;
}
.persona-btn-cancel:hover { background: rgba(120, 70, 220, 0.14) !important; border-color: rgba(160, 120, 255, 0.35) !important; color: #c4b5fd !important; }

.persona-btn-create {
    padding: 11px 28px !important; border-radius: 12px !important;
    background: linear-gradient(135deg, #4c1d95 0%, #7c3aed 50%, #6366f1 100%) !important;
    border: none !important; color: #fff !important; font-weight: 700 !important; font-size: 0.85rem !important;
    letter-spacing: 0.03em !important;
    transition: all 0.35s cubic-bezier(0.22, 1, 0.36, 1) !important; cursor: pointer !important;
    position: relative !important; overflow: hidden !important;
    box-shadow: 0 4px 28px rgba(124, 58, 237, 0.35), 0 0 14px rgba(100, 60, 220, 0.15) !important;
}
.persona-btn-create::before {
    content: '' !important; position: absolute !important; top: -50% !important; left: -70% !important;
    width: 40% !important; height: 200% !important;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent) !important;
    transform: skewX(-20deg) !important; transition: left 0.6s ease !important; pointer-events: none !important;
}
.persona-btn-create:hover:not(:disabled)::before { left: 140% !important; }
.persona-btn-create:hover:not(:disabled) {
    transform: translateY(-2px) !important; filter: brightness(1.12) !important;
    box-shadow: 0 8px 40px rgba(140, 90, 255, 0.5), 0 0 0 2px rgba(167, 139, 250, 0.25) !important;
}
.persona-btn-create:disabled { opacity: 0.25 !important; cursor: not-allowed !important; box-shadow: none !important; }

/* ── Light mode overrides ───────────────────────────── */
body.light-mode .persona-creator-modal { background: radial-gradient(ellipse at 20% 40%, rgba(220, 210, 255, 0.88) 0%, rgba(240, 245, 255, 0.94) 60%) !important; }
body.light-mode .persona-creator-content { background: linear-gradient(160deg, rgba(250, 248, 255, 0.99) 0%, rgba(240, 238, 255, 0.99) 100%) !important; border-color: rgba(124, 58, 237, 0.22) !important; box-shadow: 0 50px 140px rgba(80, 40, 180, 0.12), 0 0 80px rgba(124, 58, 237, 0.06) !important; }
body.light-mode .persona-creator-content::before { background: linear-gradient(90deg, transparent, rgba(124, 58, 237, 0.35), rgba(80, 200, 255, 0.2), transparent) !important; }
body.light-mode .persona-creator-content::after { display: none !important; }
body.light-mode .persona-creator-header { border-bottom-color: rgba(124, 58, 237, 0.1) !important; background: linear-gradient(180deg, rgba(124, 58, 237, 0.04) 0%, transparent 100%) !important; }
body.light-mode .persona-creator-header h2 { background: linear-gradient(90deg, #4c1d95 0%, #6366f1 100%) !important; -webkit-background-clip: text !important; -webkit-text-fill-color: transparent !important; background-clip: text !important; }
body.light-mode .persona-header-sub { color: rgba(109, 40, 217, 0.45) !important; }
body.light-mode .persona-step-label { color: rgba(100, 60, 180, 0.5) !important; }
body.light-mode .persona-name-input, body.light-mode #personaNameInput { background: rgba(255, 255, 255, 0.85) !important; border-color: rgba(124, 58, 237, 0.22) !important; color: #1e1040 !important; }
body.light-mode .persona-name-input:focus, body.light-mode #personaNameInput:focus { background: #fff !important; border-color: rgba(124, 58, 237, 0.5) !important; box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08) !important; }
body.light-mode .persona-trait-chip { background: rgba(255, 255, 255, 0.82) !important; border-color: rgba(124, 58, 237, 0.14) !important; color: #3b1d8e !important; }
body.light-mode .persona-trait-chip i { color: #7c3aed !important; filter: none !important; }
body.light-mode .persona-trait-chip:hover { background: rgba(240, 235, 255, 0.95) !important; border-color: rgba(124, 58, 237, 0.35) !important; color: #4c1d95 !important; }
body.light-mode .persona-trait-chip.active { background: linear-gradient(135deg, rgba(124, 58, 237, 0.1) 0%, rgba(109, 40, 217, 0.06) 100%) !important; border-color: rgba(124, 58, 237, 0.5) !important; color: #4c1d95 !important; }
body.light-mode .bubble-core { background: radial-gradient(circle at 35% 30%, rgba(124, 58, 237, 0.08), transparent 55%), rgba(252, 250, 255, 0.96) !important; border-color: rgba(124, 58, 237, 0.22) !important; }
body.light-mode .bubble-ring-1 { border-color: rgba(124, 58, 237, 0.15) !important; }
body.light-mode .bubble-ring-2 { border-color: rgba(80, 200, 255, 0.1) !important; }
body.light-mode .bubble-ring-3 { border-color: rgba(124, 58, 237, 0.06) !important; }
body.light-mode .bubble-placeholder { color: rgba(100, 60, 180, 0.35) !important; }
body.light-mode .bubble-placeholder i { color: rgba(124, 58, 237, 0.4) !important; filter: none !important; }
body.light-mode .bubble-trait-count { color: rgba(100, 60, 180, 0.4) !important; }
body.light-mode .bubble-trait-count span { color: #6d28d9 !important; filter: none !important; }
body.light-mode .persona-btn-cancel { background: rgba(255, 255, 255, 0.8) !important; border-color: rgba(124, 58, 237, 0.18) !important; color: rgba(100, 60, 180, 0.6) !important; }
body.light-mode .persona-btn-cancel:hover { background: rgba(240, 235, 255, 0.95) !important; border-color: rgba(124, 58, 237, 0.35) !important; color: #5b21b6 !important; }
/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   MOBILE â€” Full Responsive Overhaul
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* â”€â”€ Sidebar overlay backdrop â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
.sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(4, 2, 18, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: none;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* â”€â”€ Tablet (â‰¤ 1024px) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 1024px) {
    .sidebar { width: 260px !important; min-width: 260px !important; }
    .chat-container { padding: 20px 18px !important; }
}

/* â”€â”€ Mobile (â‰¤ 768px) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 768px) {

    /* Sidebar â€” fixed off-canvas drawer */
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100dvh !important;
        width: min(300px, 85vw) !important;
        min-width: unset !important;
        z-index: 1000 !important;
        transform: translateX(-100%) !important;
        transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1) !important;
        border-right: 1px solid rgba(130, 70, 240, 0.25) !important;
        box-shadow: 4px 0 40px rgba(4, 0, 24, 0.7) !important;
    }
    .sidebar.open {
        transform: translateX(0) !important;
    }
    .sidebar.collapsed {
        transform: translateX(-100%) !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Main content always full width */
    .main-content {
        width: 100% !important;
        margin-left: 0 !important;
    }

    /* Header â€” compact with no overflow */
    .header {
        padding: 10px 12px !important;
        gap: 8px !important;
        flex-wrap: nowrap !important;
        overflow: hidden !important;
    }

    .header-left {
        gap: 8px !important;
        flex-shrink: 0;
        min-width: 0;
    }

    /* Always show hamburger on mobile */
    .sidebar-toggle-btn {
        display: flex !important;
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        padding: 0 !important;
        border-radius: 10px !important;
        flex-shrink: 0;
    }

    /* App logo in header */
    .header-left .logo-text,
    .header-left h1 {
        font-size: 1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 120px;
    }

    /* Header right controls â€” shrink & no overflow */
    .header-controls {
        gap: 5px !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        overflow: hidden !important;
        flex-shrink: 1;
        min-width: 0;
    }

    /* Hide chat title on mobile */
    .current-chat-title { display: none !important; }

    /* AI mode button â€” icon + short label */
    .ai-mode-display {
        padding: 6px 10px !important;
        gap: 5px !important;
        font-size: 0.75rem !important;
    }

    #aiModeLabel { display: none; }

    .ai-mode-chevron { display: none !important; }

    /* AI mode dropdown â€” fixed overlay fullscreen-friendly */
    .ai-mode-dropdown-panel {
        position: fixed !important;
        top: 56px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        max-height: 70vh !important;
        z-index: 9999 !important;
    }

    /* Icon-only header buttons */
    .header-controls .btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        padding: 0 !important;
        border-radius: 10px !important;
        font-size: 13px !important;
        justify-content: center !important;
        flex-shrink: 0;
    }

    /* Hide text in header buttons â€” keep only icon */
    .header-controls .btn span,
    .header-controls .btn-text,
    #clearChatBtn .btn-text {
        display: none !important;
    }

    /* Clerk user button â€” compact */
    #clerk-user-button {
        margin-left: 2px !important;
    }

    /* Chat area â€” full height, reduced padding */
    .chat-container {
        padding: 14px 10px !important;
        gap: 14px !important;
    }

    /* Message bubbles â€” wider on mobile */
    .message-content {
        max-width: 88% !important;
        padding: 12px 14px !important;
        font-size: 0.9rem !important;
        line-height: 1.55 !important;
    }

    /* Avatar â€” smaller */
    .message-avatar {
        width: 30px !important;
        height: 30px !important;
        font-size: 12px !important;
        flex-shrink: 0;
    }

    /* Input container â€” safe area */
    .input-container {
        padding: 10px 10px !important;
        padding-bottom: max(10px, env(safe-area-inset-bottom)) !important;
    }

    /* Message input â€” prevent iOS zoom (font-size must be â‰¥ 16px) */
    #messageInput {
        font-size: 16px !important;
        padding: 11px 14px !important;
        min-height: 44px !important;
        border-radius: 14px !important;
        line-height: 1.4 !important;
    }

    /* Send button */
    #sendButton {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        flex-shrink: 0;
    }

    /* Input row buttons (attach, image, etc.) */
    .input-wrapper .btn:not(#sendButton) {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        padding: 0 !important;
        border-radius: 10px !important;
        flex-shrink: 0;
    }

    /* Hide the input footer text */
    .input-footer { display: none !important; }

    /* Welcome screen â€” centered, compact */
    .welcome-content {
        padding: 20px 16px !important;
        gap: 16px !important;
        text-align: center;
    }

    .welcome-logo { width: 56px !important; height: 56px !important; }

    .welcome-greeting {
        font-size: 1.3rem !important;
        line-height: 1.3;
    }

    .welcome-subtitle {
        font-size: 0.85rem !important;
    }

    /* Suggestion chips â€” 1 column on mobile */
    .welcome-suggestions,
    .suggestions-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .suggestion-chip {
        padding: 12px 14px !important;
        font-size: 0.82rem !important;
        text-align: left;
        min-height: 44px !important;
        border-radius: 12px !important;
    }

    /* Settings & Memory panels â€” full screen drawers */
    .settings-panel,
    .memory-panel,
    #settingsPanel,
    #memoryPanel {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
        height: 100dvh !important;
        top: 0 !important;
        right: 0 !important;
    }

    .settings-panel-content,
    .memory-panel-content {
        width: 100% !important;
        max-width: 100% !important;
        height: 100dvh !important;
        border-radius: 0 !important;
    }

    /* Persona creator â€” full screen */
    .persona-creator-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 100dvh !important;
        border-radius: 0 !important;
        height: 100dvh !important;
        overflow-y: auto !important;
    }

    .persona-creator-modal {
        align-items: flex-end !important;
        padding: 0 !important;
    }

    /* Trait grid â€” 3 cols on mobile */
    .persona-traits-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }

    .persona-trait-chip {
        flex-direction: column !important;
        padding: 9px 4px !important;
        gap: 4px !important;
        font-size: 0.68rem !important;
        text-align: center !important;
    }

    .persona-trait-chip i { font-size: 16px !important; }

    /* Bubble + grid layout â€” stack vertically */
    .persona-builder-row {
        flex-direction: column !important;
        align-items: center !important;
        gap: 16px !important;
    }

    .persona-bubble {
        width: 160px !important;
        height: 160px !important;
    }

    .bubble-core {
        width: 125px !important;
        height: 125px !important;
    }

    .persona-creator-body { padding: 18px 16px 20px !important; }
    .persona-creator-header { padding: 18px 16px 14px !important; }

    /* Context panel â€” full screen */
    #contextPanel {
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 0 !important;
    }

    /* Code blocks â€” horizontal scroll */
    .code-block-wrapper,
    pre {
        max-width: 100% !important;
        overflow-x: auto !important;
        font-size: 0.78rem !important;
    }

    /* Action buttons below messages */
    .message-actions {
        flex-wrap: wrap !important;
        gap: 4px !important;
    }

    .action-btn {
        min-width: 36px !important;
        height: 32px !important;
        font-size: 12px !important;
        padding: 0 8px !important;
    }
}

/* â”€â”€ Small phones (â‰¤ 480px) â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-width: 480px) {

    .sidebar {
        width: 100% !important;
        max-width: 100vw !important;
        border-right: none !important;
    }

    .header { padding: 8px 10px !important; gap: 6px !important; }

    .header-left .logo-text,
    .header-left h1 { max-width: 80px !important; font-size: 0.9rem !important; }

    .header-controls .btn {
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
    }

    .ai-mode-display { padding: 5px 8px !important; }

    .chat-container { padding: 10px 8px !important; gap: 12px !important; }

    .message-content {
        max-width: 93% !important;
        padding: 10px 12px !important;
        font-size: 0.875rem !important;
    }

    #messageInput {
        font-size: 16px !important;
        padding: 10px 12px !important;
        min-height: 42px !important;
    }

    #sendButton {
        width: 40px !important;
        height: 40px !important;
        min-width: 40px !important;
    }

    .welcome-greeting { font-size: 1.15rem !important; }
    .welcome-subtitle { font-size: 0.8rem !important; }

    .persona-traits-grid { grid-template-columns: repeat(3, 1fr) !important; }

    /* Hide less critical buttons on very small screens */
    .auto-read-btn,
    .generate-image-btn { display: none !important; }
}

/* â”€â”€ Touch devices â€” generous tap targets â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (hover: none) and (pointer: coarse) {

    .btn,
    .action-btn,
    .chat-item {
        min-height: 44px;
    }

    .suggestion-chip {
        min-height: 48px;
    }

    /* Remove hover transforms â€” they feel glitchy on touch */
    .persona-trait-chip:hover {
        transform: none !important;
    }

    .ai-mode-dropdown-item:hover {
        background: transparent !important;
        box-shadow: none !important;
    }

    .ai-mode-dropdown-item:active {
        background: rgba(100, 55, 200, 0.22) !important;
    }

    /* Prevent 300ms click delay */
    * { touch-action: manipulation; }
}

/* â”€â”€ Landscape phones â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@media (max-height: 500px) and (orientation: landscape) {

    .welcome-logo,
    .orbit-ring { display: none !important; }

    .welcome-content { gap: 8px !important; padding: 12px !important; }

    .welcome-greeting { font-size: 1.1rem !important; }

    .chat-container { padding: 8px !important; }

    .input-container { padding: 6px 10px !important; }

    #messageInput { min-height: 38px !important; padding: 8px 12px !important; }

    .ai-mode-dropdown-panel {
        max-height: 50vh !important;
        top: 50px !important;
    }
}

/* â”€â”€ Notch / Safe area insets â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€â”€ */
@supports (padding: env(safe-area-inset-bottom)) {
    .input-container {
        padding-bottom: calc(10px + env(safe-area-inset-bottom)) !important;
    }
    .sidebar {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-bottom);
    }
}


