﻿body, html {
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: #000;
}

.ethereal-space {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(circle at 0% 0%, #000000, #000000);
    z-index: 0;
}

.nebula {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background: radial-gradient(circle at 40% 70%, rgba(138, 43, 226, 0.15) 0%, transparent 40%), radial-gradient(circle at 70% 30%, rgba(59, 130, 246, 0.15) 0%, transparent 40%);
    animation: driftNebula 90s infinite alternate ease-in-out;
    pointer-events: none;
    z-index: 2;
}

@keyframes driftNebula {
    0% {
        transform: scale(1.5) rotate(0deg);
    }

    100% {
        transform: scale(3.5) rotate(360deg);
    }
}

.stars {
    z-index: 1;
}

.stars, .deep-space, #effects-layer {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.celestial-body {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.6;
    box-shadow: inset -10px -10px 30px rgba(0,0,0,1.8), 0 0 20px rgba(255,255,255,0.25);
}

#entities-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.blob-entity {
    position: absolute;
    transform-origin: center center;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.3), 0 0 20px rgba(255,255,255,0.2);
    transition: width 0.3s, height 0.3s, background-color 0.3s;
    cursor: pointer;
    user-select: none;
    will-change: transform, left, top;
    z-index: 50;
}

.blob-label {
    position: absolute;
    bottom: -25px;
    font-size: 0.75rem;
    color: rgba(255,255,255,0.7);
    white-space: nowrap;
    text-shadow: 0 2px 4px rgba(0,0,0,0.8);
    pointer-events: none;
}

.blob-menu {
    position: absolute;
    top: -40px;
    display: flex;
    gap: 8px;
    opacity: 0;
    transform: translateY(10px) scale(0.8);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

    .blob-menu.active {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: all;
    }

.blob-menu-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

    .blob-menu-btn:hover {
        background: var(--bg-surface-hover);
        transform: scale(1.1);
    }

.chat-bubble {
    position: absolute;
    top: -60px;
    background: rgba(255, 255, 255, 0.9);
    color: #000;
    padding: 8px 14px;
    border-radius: 16px;
    font-size: 0.85rem;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    animation: bubblePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, bubbleFade 0.5s ease-in 4s forwards;
    pointer-events: none;
    z-index: 100;
}

    .chat-bubble::after {
        content: '';
        position: absolute;
        bottom: -6px;
        left: 50%;
        transform: translateX(-50%);
        border-width: 6px 6px 0;
        border-style: solid;
        border-color: rgba(255, 255, 255, 0.9) transparent transparent transparent;
    }

@keyframes bubblePop {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.8);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes bubbleFade {
    0% {
        opacity: 1;
    }

    100% {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Fun Effects */
.transient-particle {
    position: absolute;
    font-size: 1.5rem;
    pointer-events: none;
    animation: floatUp 1.5s ease-out forwards;
    z-index: 101;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-50px) scale(1.5);
    }
}

.trail-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.5;
    animation: fadeTrail 1s linear forwards;
}

@keyframes fadeTrail {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }

    100% {
        transform: scale(0.1);
        opacity: 0;
    }
}

.click-ripple {
    position: absolute;
    border: 2px solid rgba(255,255,255,0.8);
    border-radius: 50%;
    pointer-events: none;
    transform: translate(-50%, -50%);
    animation: rippleAnim 0.6s ease-out forwards;
}

@keyframes rippleAnim {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }

    100% {
        width: 100px;
        height: 100px;
        opacity: 0;
    }
}

/* Sidebar UI */
.chat-sidebar {
    position: fixed;
    left: -350px;
    top: 0;
    width: 350px;
    height: 100vh;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: left 0.3s ease;
    z-index: 150;
    box-shadow: 4px 0 20px rgba(0,0,0,0.5);
}

    .chat-sidebar.open {
        left: 0;
    }

.chat-header {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
    font-weight: bold;
}

    .chat-header button {
        background: none;
        border: none;
        color: var(--text-muted);
        font-size: 1.5rem;
        cursor: pointer;
    }

.chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-main);
    background: rgba(0,0,0,0.2);
    padding: 8px 12px;
    border-radius: 8px;
}

    .chat-msg span.user {
        font-weight: bold;
        color: var(--accent);
        margin-right: 5px;
    }

.chat-input-area {
    padding: 15px;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 10px;
    background: rgba(0,0,0,0.1);
}

    .chat-input-area input {
        flex: 1;
        padding: 10px 15px;
        border-radius: 20px;
        border: 1px solid var(--border-color);
        background: var(--bg-base);
        color: var(--text-main);
        outline: none;
    }

    .chat-input-area button {
        background: var(--accent);
        color: white;
        border: none;
        border-radius: 20px;
        padding: 0 15px;
        font-weight: bold;
        cursor: pointer;
        transition: transform 0.1s;
    }

        .chat-input-area button:active {
            transform: scale(0.95);
        }

.fab-chat {
    position: fixed;
    left: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent);
    border: none;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    cursor: pointer;
    z-index: 140;
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s;
}

    .fab-chat:hover {
        transform: scale(1.1);
    }

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 2px solid var(--bg-surface);
    transition: transform 0.2s;
}

    .badge.hidden {
        display: none;
    }

    .badge.pop {
        animation: badgePop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

@keyframes badgePop {
    0% {
        transform: scale(0.5);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

/* Settings Emoji Picker */
.blob-settings-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
    color: var(--text-main);
}

    .setting-group input[type=color], .setting-group input[type=range], .setting-group select {
        background: var(--bg-base);
        color: var(--text-main);
        border: 1px solid var(--border-color);
        padding: 8px;
        border-radius: 4px;
        outline: none;
        width: 100%;
        box-sizing: border-box;
    }

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
    padding: 10px;
    background: var(--bg-base);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.emoji-btn {
    background: none;
    border: 2px solid transparent;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 8px;
    transition: transform 0.1s, background 0.1s;
    padding: 4px;
}

    .emoji-btn:hover {
        background: rgba(255,255,255,0.1);
        transform: scale(1.1);
    }

    .emoji-btn.selected {
        border-color: var(--accent);
        background: rgba(59, 130, 246, 0.2);
    }
