﻿:root {
    --bg: #050510;
    --surface: #1e293b;
    --text: #f8fafc;
    --subtext: #94a3b8;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    --font-stack: 'Inter', -apple-system, sans-serif;
}

html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-stack);
    overscroll-behavior: none;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.blob-app-container {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    overflow: hidden;
    position: relative;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background-color: var(--surface);
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    z-index: 10;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.blob-canvas {
    flex-grow: 1;
    position: relative;
    background-color: var(--bg);
    background-image: radial-gradient(circle at 15% 30%, rgba(99, 102, 241, 0.15) 0%, transparent 40%), radial-gradient(circle at 85% 70%, rgba(236, 72, 153, 0.1) 0%, transparent 50%), radial-gradient(circle at 50% 50%, rgba(14, 165, 233, 0.1) 0%, transparent 60%);
    overflow: hidden;
    cursor: crosshair;
}

.space-star {
    position: absolute;
    background-color: white;
    border-radius: 50%;
    opacity: 0.2;
    z-index: 0;
    animation: twinkle 3s infinite alternate ease-in-out;
    pointer-events: none;
}

.space-shape {
    position: absolute;
    font-size: 2rem;
    opacity: 0.15;
    z-index: 0;
    pointer-events: none;
    animation: driftSpace linear infinite;
    filter: blur(1px);
}

.app-footer {
    background-color: var(--surface);
    padding: 1.5rem;
    z-index: 10;
    box-shadow: 0 -4px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.input-row {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}

input[type="text"] {
    background-color: rgba(15, 23, 42, 0.8);
    color: var(--text);
    border: 1px solid #334155;
    border-radius: 0.5rem;
    padding: 0.75rem;
    font-family: var(--font-stack);
    outline: none;
    font-size: 1rem;
    flex-grow: 1;
}

    input[type="text"]:focus {
        border-color: var(--accent);
        box-shadow: 0 0 8px var(--accent-glow);
    }

.picker-btn {
    background-color: rgba(15, 23, 42, 0.8);
    color: var(--text);
    border: 1px solid #334155;
    border-radius: 0.5rem;
    width: 3.5rem;
    font-size: 1.2rem;
    cursor: pointer;
    transition: background 0.1s;
}

.color-btn {
    width: 3.5rem;
    padding: 0.2rem;
    cursor: pointer;
    border: none;
    background: transparent;
    border-radius: 0.5rem;
}

.burst-btn {
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
    border: none;
    padding: 0.75rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px var(--accent-glow);
    transition: transform 0.1s ease;
}

    .btn-primary:active, .btn-haptic:active {
        transform: scale(0.95);
    }

/* Chat Sidebar */
.chat-sidebar {
    position: absolute;
    top: 0;
    left: -100%;
    width: 320px;
    max-width: 85%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    box-shadow: 5px 0 30px rgba(0,0,0,0.6);
    transition: left 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    border-right: 1px solid #334155;
}

    .chat-sidebar.open {
        left: 0;
    }

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #334155;
    font-weight: bold;
    font-size: 1.1rem;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    scroll-behavior: smooth;
}

.chat-msg {
    background: rgba(30, 41, 59, 0.8);
    padding: 0.75rem;
    border-radius: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.4;
    border-left: 3px solid var(--accent);
}

.chat-msg-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--subtext);
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.chat-input-area {
    padding: 1rem;
    border-top: 1px solid #334155;
}

/* Notification Badge */
.chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.6);
}

    .chat-badge.visible {
        opacity: 1;
        transform: scale(1);
    }

/* Floating Panels */
.floating-panel {
    position: absolute;
    bottom: 150px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--surface);
    border: 1px solid #334155;
    border-radius: 1rem;
    padding: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 50;
    width: 90%;
    max-width: 350px;
    transition: opacity 0.2s, transform 0.2s;
}

    .floating-panel.hidden {
        opacity: 0;
        pointer-events: none;
        transform: translateX(-50%) translateY(20px);
    }

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.emoji-item {
    font-size: 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 0.5rem;
    padding: 0.5rem;
}

.shape-editor .slider-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.shape-editor label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--subtext);
    width: 100px;
}

.shape-editor input[type="range"] {
    flex-grow: 1;
    accent-color: var(--accent);
}

/* Context Menu */
.blob-context-menu {
    position: absolute;
    background: var(--surface);
    border: 1px solid #334155;
    border-radius: 0.75rem;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    z-index: 200;
    box-shadow: 0 5px 20px rgba(0,0,0,0.6);
    transform: translate(-50%, -120%);
    transition: opacity 0.1s;
}

    .blob-context-menu.hidden {
        opacity: 0;
        pointer-events: none;
    }

    .blob-context-menu button {
        background: none;
        border: none;
        color: var(--text);
        padding: 0.5rem 1rem;
        text-align: left;
        font-weight: 600;
        font-size: 0.9rem;
        cursor: pointer;
        border-radius: 0.5rem;
        white-space: nowrap;
    }

/* Player Tray */
.player-tray {
    font-size: 0.85rem;
    color: var(--subtext);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    overflow: hidden;
}

.live-indicator {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
    animation: pulse 2s infinite;
}

/* Blob Layouts */
.blob-entity {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    will-change: left, top;
    z-index: 10;
}

.blob-center {
    width: 65px;
    height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 1;
}

.blob-throbber {
    animation: throbAnim var(--throb-sec, 1s) infinite alternate ease-in-out;
    transform-origin: center;
    z-index: 1;
}

.blob-scaler {
    transform: scale(var(--scale-x, 1), var(--scale-y, 1));
    transform-origin: center;
    transition: transform 0.3s ease;
    z-index: 1;
}

.blob-shape {
    width: 65px;
    height: 65px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    box-shadow: inset -5px -5px 15px rgba(0,0,0,0.3), 0 10px 20px rgba(0,0,0,0.4);
    animation: wobbleAnim var(--waviness-sec, 4s) infinite alternate ease-in-out;
    pointer-events: none;
    z-index: 1;
}

.blob-poked {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both !important;
}

/* Identifying Text */
.blob-name {
    margin-top: 45px;
    background: rgba(0,0,0,0.6);
    padding: 0.2rem 0.6rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
    pointer-events: none;
    z-index: 20;
    white-space: nowrap;
}

.blob-entity.is-me .blob-name {
    border: 1px solid var(--accent);
    color: var(--accent);
    background: var(--surface);
    box-shadow: 0 0 10px var(--accent-glow);
}

/* The Thought Bubble Chat Display */
.blob-thought {
    position: absolute;
    bottom: calc(100% + 55px);
    background: var(--text);
    color: var(--bg);
    padding: 0.6rem 1rem;
    border-radius: 1.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    max-width: 220px;
    white-space: normal;
    word-wrap: break-word;
    text-align: center;
    opacity: 0;
    transform: translateY(20px) scale(0.8);
    transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    z-index: 30;
    box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

    .blob-thought.visible {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    .blob-thought.drifting {
        opacity: 0;
        transform: translateY(-30px) scale(1.05);
    }

    /* Thought Bubble Tails */
    .blob-thought::before {
        content: '';
        position: absolute;
        bottom: -8px;
        left: 50%;
        transform: translateX(-50%);
        width: 12px;
        height: 12px;
        background: var(--text);
        border-radius: 50%;
    }

    .blob-thought::after {
        content: '';
        position: absolute;
        bottom: -18px;
        left: calc(50% - 6px);
        width: 6px;
        height: 6px;
        background: var(--text);
        border-radius: 50%;
    }

.particle, .projectile {
    position: absolute;
    font-size: 1.5rem;
    pointer-events: none;
    z-index: 150;
    transform: translate(-50%, -50%);
}

@keyframes twinkle {
    0% {
        opacity: 0.1;
    }

    100% {
        opacity: 0.8;
        box-shadow: 0 0 5px white;
    }
}

@keyframes driftSpace {
    0% {
        transform: translateY(0) rotate(0deg);
    }

    100% {
        transform: translateY(-200px) rotate(360deg);
    }
}

@keyframes pulse {
    0% {
        opacity: 0.5;
    }

    50% {
        opacity: 1;
    }

    100% {
        opacity: 0.5;
    }
}

@keyframes wobbleAnim {
    0% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }

    100% {
        border-radius: 30% 70% 70% 30% / 30% 70% 30% 70%;
    }
}

@keyframes throbAnim {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(var(--throb, 1.1));
    }
}

@keyframes shake {
    10%, 90% {
        transform: translate3d(-2px, 0, 0);
    }

    20%, 80% {
        transform: translate3d(4px, 0, 0);
    }

    30%, 50%, 70% {
        transform: translate3d(-6px, 0, 0);
    }

    40%, 60% {
        transform: translate3d(6px, 0, 0);
    }
}
