    /* Fonts */
    /* Fonts imported in index.html for performance */

    :root {
        /* Core Palette - Cyberpunk / Neon Glass */
        --font-main: 'Outfit', sans-serif;
        --font-mono: 'JetBrains Mono', monospace;

        /* Backgrounds */
        --bg-dark: #050505;
        --bg-glass: rgba(20, 20, 20, 0.6);
        --bg-glass-heavy: rgba(10, 10, 10, 0.85);

        /* Accents */
        --color-primary: #00ffff;
        /* Cyber Cyan */
        --color-secondary: #ff00ff;
        /* Neon Magenta */
        --color-accent: #7000ff;
        /* Deep Violet */

        /* Text */
        --text-primary: #ffffff;
        --text-secondary: rgba(255, 255, 255, 0.7);
        --text-muted: rgba(255, 255, 255, 0.4);

        /* Borders & Utilities */
        --border-glass: rgba(255, 255, 255, 0.08);
        --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
        --radius-lg: 24px;
        --radius-md: 16px;
        --radius-sm: 8px;

        /* Animation Speeds */
        --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    }

    /* Light Mode Overrides (if toggled) */
    [data-theme="light"] {
        --bg-dark: #f0f2f5;
        --bg-glass: rgba(255, 255, 255, 0.65);
        --bg-glass-heavy: rgba(255, 255, 255, 0.9);
        --text-primary: #1a1a1a;
        --text-secondary: rgba(0, 0, 0, 0.7);
        --text-muted: rgba(0, 0, 0, 0.4);
        --border-glass: rgba(0, 0, 0, 0.08);
        --color-primary: #0088cc;
        --color-secondary: #cc00cc;
    }

    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        -webkit-tap-highlight-color: transparent;
    }

    body {
        font-family: var(--font-main);
        background-color: var(--bg-dark);
        color: var(--text-primary);
        min-height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        overflow-x: hidden;
        /* Subtler background gradient */
        background: radial-gradient(circle at top left, #1a1a2e, #000000);
    }

    /* Ambient Background Elements */
    .ambient-glow {
        position: fixed;
        border-radius: 50%;
        filter: blur(100px);
        z-index: -1;
        pointer-events: none;
        opacity: 0.4;
        transition: all 5s ease;
    }

    .glow-1 {
        top: -10%;
        left: -10%;
        width: 600px;
        height: 600px;
        background: var(--color-accent);
        animation: pulseGlow 10s infinite alternate;
    }

    .glow-2 {
        bottom: -10%;
        right: -10%;
        width: 500px;
        height: 500px;
        background: var(--color-primary);
        animation: pulseGlow 8s infinite alternate-reverse;
    }

    @keyframes pulseGlow {
        0% {
            transform: scale(1);
            opacity: 0.3;
        }

        100% {
            transform: scale(1.2);
            opacity: 0.5;
        }
    }

    @keyframes weather-blink {

        0%,
        100% {
            opacity: 1;
            text-shadow: 0 0 10px currentColor;
        }

        50% {
            opacity: 0.3;
            text-shadow: none;
        }
    }

    .temp-low-blink {
        animation: weather-blink 1s ease-in-out infinite;
    }

    .hidden {
        display: none !important;
    }

    /* Snow Effect */
    .snow-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 9999;
        background-image:
            radial-gradient(4px 4px at 10% 10%, rgba(255, 255, 255, 0.9) 50%, transparent),
            radial-gradient(6px 6px at 20% 30%, rgba(255, 255, 255, 0.7) 50%, transparent),
            radial-gradient(3px 3px at 40% 70%, rgba(255, 255, 255, 0.8) 50%, transparent),
            radial-gradient(4px 4px at 60% 40%, rgba(255, 255, 255, 0.6) 50%, transparent),
            radial-gradient(5px 5px at 80% 10%, rgba(255, 255, 255, 0.8) 50%, transparent),
            radial-gradient(3px 3px at 90% 80%, rgba(255, 255, 255, 0.7) 50%, transparent);
        background-size: 400px 400px;
        animation: snow 10s linear infinite;
        opacity: 0.6;
    }

    @keyframes snow {
        0% {
            background-position:
                0 0,
                0 0,
                0 0,
                0 0,
                0 0,
                0 0;
        }

        100% {
            background-position:
                400px 400px,
                -200px 400px,
                200px 400px,
                -400px 400px,
                100px 400px,
                -100px 400px;

        }
    }

    /* Heat Effect */
    .heat-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        pointer-events: none;
        z-index: 9999;
        /* Warm orange/red glow with some blur */
        background: radial-gradient(circle at center, rgba(255, 100, 0, 0.15) 0%, rgba(255, 50, 0, 0.05) 60%, transparent 100%);
        backdrop-filter: blur(1px) sepia(30%);
        mix-blend-mode: screen;
        opacity: 0;
        transition: opacity 2s ease;
    }

    .heat-overlay.active {
        opacity: 1;
        animation: heat-pulse 5s ease-in-out infinite alternate;
    }

    @keyframes heat-pulse {
        0% {
            transform: scale(1);
            backdrop-filter: blur(0.5px) sepia(20%);
        }

        100% {
            transform: scale(1.05);
            backdrop-filter: blur(2px) sepia(40%);
        }
    }

    /* Main Layout */
    .app-container {
        width: 100%;
        max-width: 900px;
        /* Slightly wider */
        height: 85vh;
        display: flex;
        flex-direction: column;
        padding: 20px;
        gap: 20px;

        /* Glassmorphism Card */
        background: var(--bg-glass);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border: 1px solid var(--border-glass);
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-glass), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;

        position: relative;
        overflow: hidden;
        transition: height 0.3s ease;
    }

    /* Header */
    .app-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-bottom: 12px;
        border-bottom: 1px solid var(--border-glass);
    }

    .brand {
        display: flex;
        flex-direction: column;
    }

    .brand h1 {
        font-size: 1.5rem;
        font-weight: 700;
        background: linear-gradient(135deg, var(--color-primary), var(--color-secondary), var(--color-primary));
        background-size: 200% auto;
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        letter-spacing: -0.5px;
        animation: shine 5s linear infinite;
    }

    @keyframes shine {
        to {
            background-position: 200% center;
        }
    }

    .brand small {
        font-size: 0.75rem;
        color: var(--text-secondary);
        font-family: var(--font-mono);
    }

    .header-actions {
        display: flex;
        gap: 10px;
    }

    .btn-icon {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: 1px solid var(--border-glass);
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .btn-icon:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
        border-color: var(--color-primary);
        box-shadow: 0 0 12px rgba(0, 255, 255, 0.2);
    }

    /* Header Dropdown (Kebab Menu) */
    .header-dropdown-container {
        position: relative;
        display: inline-block;
    }

    .header-dropdown-menu {
        position: absolute;
        top: 100%;
        right: 0;
        margin-top: 8px;
        background: var(--bg-glass-heavy);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--border-glass);
        border-radius: var(--radius-md);
        padding: 8px;
        min-width: 200px;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        z-index: 1000;
        display: flex;
        flex-direction: column;
        gap: 4px;
        transform-origin: top right;
        animation: scaleIn 0.2s var(--ease-out-expo);
    }

    .header-dropdown-menu.hidden {
        display: none;
    }

    @keyframes scaleIn {
        from {
            opacity: 0;
            transform: scale(0.95);
        }

        to {
            opacity: 1;
            transform: scale(1);
        }
    }

    .dropdown-item {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
        padding: 10px 12px;
        background: transparent;
        border: none;
        border-radius: 8px;
        color: var(--text-primary);
        font-size: 0.95rem;
        font-family: var(--font-main);
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: left;
    }

    .dropdown-item:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .dropdown-item svg {
        color: var(--text-secondary);
        transition: color 0.2s;
    }

    .dropdown-item:hover svg {
        color: var(--color-primary);
    }

    /* Specific button styles override for dropdown context */
    /* #themeToggle ruleset removed */

    /* Gallery Strip */
    .gallery-strip {
        display: flex;
        gap: 24px;
        padding: 12px 0 24px;
        justify-content: center;
        align-items: center;
        /* Vertically center items */
        overflow-x: visible;
        mask-image: none;
        position: relative;
        z-index: 10;
        /* Ensure it stays above chat area */
    }

    .gallery-strip::-webkit-scrollbar {
        display: none;
    }

    .user-frame {
        position: relative;
        width: 100px;
        height: 100px;
        border-radius: 24px;
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-glass);
        flex-shrink: 0;
        overflow: visible;
        transition: all 0.3s var(--ease-out-expo);
        cursor: pointer;
        margin: 0 50px;
        /* Create gap for centered button */
    }

    #frame-Fahmy {
        margin-left: 0;
    }

    #frame-Hoda {
        margin-right: 0;
    }

    .user-frame:hover {
        transform: translateY(-4px) scale(1.05);
        border-color: var(--color-primary);
        box-shadow: 0 8px 16px rgba(0, 0, 0, 0.3);
    }

    .user-frame img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 24px;
    }

    /* ... existing styles ... */

    .last-seen {
        position: absolute;
        bottom: -25px;
        /* Moved down slightly */
        left: 50%;
        transform: translateX(-50%);
        width: 200%;
        /* Wider to prevent wrapping */
        text-align: center;
        font-size: 0.75rem;
        /* Slightly larger */
        color: var(--text-secondary);
        white-space: nowrap;
        opacity: 0.9;
        pointer-events: none;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
        /* Stronger shadow */
        z-index: 20;
    }

    .user-status-dot {
        position: absolute;
        bottom: 6px;
        right: 6px;
        width: 5px;
        height: 5px;
        background: #00ff88;
        border: 2px solid var(--bg-dark);
        border-radius: 50%;
        box-shadow: 0 0 8px #00ff88;
    }

    /* Chat Area */
    .chat-area {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        /* Necessary for nested flex scrolling */
        gap: 16px;
    }

    .messages-container {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        /* Prevent horizontal scroll */
        display: flex;
        flex-direction: column;
        gap: 30px;
        /* Increased gap */
        padding: 10px 25px 40px;
        /* Add side padding for buttons, extra bottom for scroll clearance */
        /* scroll-behavior: smooth; <- Removed to prevent conflicts with JS scroll management */
        overflow-anchor: auto;
        /* Allow browser to maintain scroll position on layout changes */
        overscroll-behavior-y: contain;
        /* Prevent Pull-to-Refresh which reloads app stuck on welcome screen */
    }

    /* Scrollbar styling */
    .messages-container::-webkit-scrollbar {
        width: 6px;
    }

    .messages-container::-webkit-scrollbar-track {
        background: transparent;
    }

    .messages-container::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 10px;
    }

    .messages-container::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.2);
    }

    /* Message Bubbles */
    .msg-group {
        display: flex;
        flex-direction: column;
        gap: 2px;
        margin-bottom: 10px;
        /* Extra safety buffer */
        max-width: 100%;
        animation: slideInUp 0.3s var(--ease-out-expo);
        position: relative;
        /* Anchor for reactions */
    }

    /* ... existing styles ... */
    .msg-system {
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 12px;
        margin: 16px 0;
        padding: 0 10px;
        animation: fadeIn 0.5s ease;
    }

    .msg-system span {
        background: rgba(255, 255, 255, 0.03);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        padding: 6px 16px;
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.05);
        color: var(--text-muted);
        font-size: 0.85rem;
        letter-spacing: 0.3px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    }

    .msg-system .sys-time {
        font-family: var(--font-mono);
        font-size: 0.7rem;
        opacity: 0.5;
        background: transparent;
        border: none;
        padding: 0;
        margin-left: -4px;
    }

    /* System Status Modifiers */
    .msg-system.sys-online span {
        border-color: rgba(0, 255, 136, 0.4);
        color: #00ff88;
        background: rgba(0, 255, 136, 0.1);
        box-shadow: 0 0 10px rgba(0, 255, 136, 0.2);
    }

    .msg-system.sys-offline span {
        border-color: rgba(255, 50, 50, 0.4);
        color: #ff4444;
        background: rgba(255, 50, 50, 0.1);
        box-shadow: 0 0 10px rgba(255, 50, 50, 0.2);
    }

    .msg-system.sys-call span {
        border-color: rgba(0, 200, 255, 0.4);
        color: #00ccff;
        background: rgba(0, 200, 255, 0.1);
        box-shadow: 0 0 10px rgba(0, 200, 255, 0.2);
    }

    .msg-system svg {
        vertical-align: middle;
        margin-right: 6px;
        margin-top: -2px;
    }

    .msg-reactions {
        position: absolute;
        top: auto !important;
        bottom: -25px !important;
        display: flex;
        gap: 4px;
        z-index: 20;
        /* Above bubble */
        pointer-events: auto;
    }

    /* Me: Bottom Right (Separated from Reply Arrow on Left) */
    .msg-group.me .msg-reactions {
        left: auto !important;
        right: 0 !important;
    }

    /* Other: Bottom Right */
    .msg-group.other .msg-reactions {
        left: auto !important;
        right: 0 !important;
    }

    /* Reaction Button (Plus) */
    .reaction-btn {
        position: absolute;
        top: -10px;
        /* Move to top */
        right: -10px;
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: var(--bg-glass-heavy);
        border: 1px solid var(--border-glass);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        opacity: 0;
        transform: scale(0.8);
        transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 25;
        z-index: 25;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    }

    /* Reaction Picker (Popup) */
    .reaction-picker {
        background: var(--bg-glass-heavy);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        border: 1px solid var(--border-glass);
        border-radius: 50px;
        padding: 8px 12px;
        display: flex;
        gap: 8px;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
        z-index: 9999;
        animation: popIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        pointer-events: auto;
    }

    .reaction-picker span {
        font-size: 1.5rem;
        cursor: pointer;
        transition: transform 0.2s;
        user-select: none;
    }

    .reaction-picker span:hover {
        transform: scale(1.3);
    }

    .msg-bubble:hover .reaction-btn,
    .reaction-btn:hover {
        opacity: 1;
        transform: scale(1);
        top: -15px;
        /* Pop up further on hover */
    }

    .reaction-btn:hover {
        background: var(--color-primary);
        color: #000;
        box-shadow: 0 0 10px var(--color-primary);
    }

    .msg-group.me {
        align-self: flex-end;
        align-items: flex-end;
    }

    .msg-group.other {
        align-self: flex-start;
        align-items: flex-start;
    }

    .msg-bubble {
        padding: 12px 18px;
        border-radius: 18px;
        font-size: 1.1rem;
        line-height: 1.5;
        position: relative;
        word-break: break-word;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(4px);
        pointer-events: auto;
        /* Ensure clickable */

        display: inline-flex;
        flex-direction: column;
        width: auto;
        max-width: 80%;
        min-width: 50px;
    }

    .msg-text {
        white-space: pre-wrap;
        word-break: break-word;
    }

    /* My Messages */
    .msg-group.me .msg-bubble {
        background: linear-gradient(135deg, rgba(0, 150, 200, 0.8), rgba(0, 100, 150, 0.9));
        color: white;
        border-radius: 18px 18px 0 18px !important;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    /* Other Messages (Default) */
    .msg-group.other .msg-bubble {
        background: rgba(255, 255, 255, 0.08);
        color: var(--text-primary);
        border-radius: 18px 18px 18px 4px;
        border: 1px solid var(--border-glass);
    }

    /* Fahmy Messages (Cyan Theme) */
    .msg-group.fahmy .msg-bubble {
        background: linear-gradient(135deg, rgba(0, 100, 110, 0.8), rgba(0, 60, 70, 0.9)) !important;
        color: #e0ffff;
        border-radius: 18px 18px 18px 4px;
        border: 1px solid rgba(0, 255, 255, 0.3) !important;
        box-shadow: 0 4px 12px rgba(0, 255, 255, 0.1);
    }

    .msg-group.fahmy .msg-meta {
        color: #00ffff;
        text-shadow: 0 0 5px rgba(0, 255, 255, 0.3);
    }

    /* Hoda Messages (Pink Theme) */
    .msg-group.hoda .msg-bubble {
        background: linear-gradient(135deg, rgba(120, 0, 80, 0.8), rgba(80, 0, 50, 0.9)) !important;
        color: #ffe0f0;
        border-radius: 18px 18px 18px 4px;
        border: 1px solid rgba(255, 0, 255, 0.3) !important;
        box-shadow: 0 4px 12px rgba(255, 0, 255, 0.1);
    }

    .msg-group.hoda .msg-meta {
        color: #ff80ff;
        /* Brighter Pink for readability */
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
    }

    .msg-meta {
        font-size: 0.7rem;
        color: rgba(255, 255, 255, 0.9);
        /* More visible white by default */
        margin: 4px 4px 0;
        /* Add top margin */
        font-family: var(--font-mono);
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
        /* Improve contrast */
        display: flex;
        /* Align ticks */
        align-items: center;
        justify-content: flex-end;
        gap: 4px;

        /* Ensure it sits at the bottom right in the flex column */
        align-self: flex-end;
        margin-top: 2px;
    }

    .msg-ticks {
        display: inline-flex;
        align-items: center;
        gap: -4px;
        margin-left: 6px;
        vertical-align: middle;
        height: 14px;
        /* Fix height alignment */
    }

    /* Default: Sent (1 tick, Grey) */
    .msg-ticks svg {
        width: 19px;
        height: 19px;
        fill: none;
        stroke: var(--text-muted);
        /* Grey */
        stroke-width: 2;
        stroke-linecap: round;
        stroke-linejoin: round;
        transition: all 0.3s ease;
    }

    /* Hide the second tick by default (Sent state) */
    .msg-ticks svg:nth-child(2) {
        display: none;
        margin-left: -10px;
        /* Overlap logic handled here if visible */
    }

    /* Delivered: 2 ticks, Grey */
    .msg-ticks.delivered svg:nth-child(2) {
        display: block;
    }

    .msg-ticks.delivered svg {
        stroke: var(--text-muted);
        /* Keep Grey for delivered */
    }

    /* Read: 2 ticks, Green */
    .msg-ticks.read svg:nth-child(2) {
        display: block;
    }

    .msg-ticks.read svg {
        stroke: #00ff00;
        /* Bright Green */
    }

    /* Image in chat */
    .chat-image {
        max-width: min(300px, 100%);
        max-height: 400px;
        object-fit: contain;
        border-radius: 12px;
        margin-top: 8px;
        border: 1px solid var(--border-glass);
        /* Custom Magnifier Cursor */
        cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' style='filter: drop-shadow(1px 1px 2px black);'><circle cx='11' cy='11' r='8'></circle><line x1='21' y1='21' x2='16.65' y2='16.65'></line></svg>") 16 16, zoom-in;
        transition: transform 0.2s;
        animation: popIn 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
        transform-origin: center center;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
        display: block;
        width: auto;
    }

    .msg-media {
        margin: 4px 0;
        border-radius: 12px;
        overflow: hidden;
        position: relative;
        max-width: 100%;
        width: fit-content;
    }

    .msg-media video {
        max-width: min(400px, 100%);
        max-height: 400px;
        border-radius: 12px;
        display: block;
        width: auto;
    }

    @keyframes popIn {
        0% {
            opacity: 0;
            transform: scale(0.5) translateY(20px) rotate(-10deg);
        }

        50% {
            opacity: 1;
            transform: scale(1.05) translateY(-5px) rotate(3deg);
        }

        100% {
            opacity: 1;
            transform: scale(1) translateY(0) rotate(0);
        }
    }

    @keyframes wiggle {
        0% {
            transform: scale(1.02) rotate(0deg);
        }

        25% {
            transform: scale(1.02) rotate(-2deg);
        }

        50% {
            transform: scale(1.02) rotate(2deg);
        }

        75% {
            transform: scale(1.02) rotate(-1deg);
        }

        100% {
            transform: scale(1.02) rotate(0deg);
        }
    }

    .msg-bubble:hover .chat-image {
        animation: wiggle 0.5s ease-in-out infinite;
        cursor: pointer;
    }

    /* Puzzle Effect */
    /* True Puzzle Effect */
    .puzzle-overlay {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        z-index: 1005;
        pointer-events: none;
        overflow: visible;
    }

    .puzzle-piece {
        position: absolute;
        background-repeat: no-repeat;
        transition: all 3s cubic-bezier(0.25, 1, 0.5, 1);
        box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
        border: 0.5px solid rgba(255, 255, 255, 0.2);
        /* Start scattered implicitly via JS transform */
    }

    /* Input Area */
    .input-area {
        display: flex;
        gap: 12px;
        align-items: flex-end;
        /* Align bottom for multiline textareas */
        padding-top: 10px;
        position: relative;
    }

    /* Modern Input Capsule */
    .input-capsule {
        flex: 1;
        display: flex;
        align-items: center;
        background: rgba(20, 20, 20, 0.6);
        border: 1px solid var(--border-glass);
        border-radius: 28px;
        padding: 6px 6px 6px 16px;
        transition: all 0.2s ease;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) inset;
        position: relative;
        /* For recording overlay */
        overflow: hidden;
    }

    .input-capsule:focus-within {
        border-color: var(--color-primary);
        background: rgba(25, 25, 25, 0.8);
        box-shadow: 0 0 0 1px var(--color-primary), 0 4px 12px rgba(0, 0, 0, 0.2) inset;
    }

    .char-count {
        position: absolute;
        bottom: 2px;
        right: 12px;
        font-size: 0.65rem;
        color: var(--text-muted);
        font-family: var(--font-mono);
        pointer-events: none;
        opacity: 0.8;
        transition: color 0.2s;
    }

    .input-capsule:focus-within .char-count {
        color: var(--text-secondary);
    }


    /* Typing Indicator */
    .typing-indicator {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-left: 20px;
        margin-bottom: 8px;
        opacity: 0;
        transform: translateY(10px);
        transition: all 0.3s var(--ease-out-expo);
        pointer-events: none;
    }

    .typing-indicator.active {
        opacity: 1;
        transform: translateY(0);
    }

    .typing-bubble {
        display: flex;
        align-items: center;
        gap: 4px;
        padding: 12px 16px;
        background: var(--bg-glass);
        border: 1px solid var(--border-glass);
        border-radius: 18px 18px 18px 4px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        backdrop-filter: blur(8px);
    }

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

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

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

    @keyframes bounce {

        0%,
        80%,
        100% {
            transform: scale(0);
            opacity: 0.5;
        }

        40% {
            transform: scale(1);
            opacity: 1;
        }
    }

    .typing-indicator span {
        font-size: 0.75rem;
        color: var(--text-secondary);
        font-family: var(--font-mono);
        animation: fadeIn 0.5s ease;
    }

    .input-field {
        flex: 1;
        background: transparent;
        border: none;
        color: var(--text-primary);
        font-size: 1rem;
        font-family: var(--font-main);
        outline: none;
        padding: 8px 0;
        min-height: 24px;
        /* Matches previous input height */
        max-height: 150px;
        /* Limit height */
        resize: none;
        /* Disable manual resize */
        overflow-y: hidden;
        /* Hide scrollbar initially */
        line-height: 1.5;
    }

    .btn-upload {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
        transition: all 0.2s;
    }

    .btn-upload:hover {
        color: var(--color-primary);
        background: rgba(0, 255, 255, 0.1);
    }

    .btn-emoji {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
        transition: all 0.2s;
    }

    .btn-emoji:hover {
        color: #ffcc00;
        /* Yellow for emoji */
        background: rgba(255, 204, 0, 0.1);
    }


    .emoji-picker-container {
        position: absolute;
        bottom: 70px;
        /* Above the input bar */
        right: 20px;
        z-index: 1500;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        border-radius: 20px;
        overflow: hidden;
        animation: slideInUp 0.2s var(--ease-out-expo);
    }

    .sticker-picker-container {
        position: absolute;
        bottom: 70px;
        /* Above the input bar */
        right: 60px;
        /* Offset slightly from emoji picker */
        z-index: 1500;
        width: 320px;
        height: 450px;
        /* Increased height for search bar */
        background: var(--bg-glass-heavy);
        backdrop-filter: blur(20px);
        border: 1px solid var(--border-glass);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
        border-radius: 20px;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        animation: slideInUp 0.2s var(--ease-out-expo);
    }

    .sticker-search-bar {
        padding: 12px;
        border-bottom: 1px solid var(--border-glass);
        position: relative;
        display: flex;
        align-items: center;
    }

    .sticker-search-bar input {
        width: 100%;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-glass);
        border-radius: 12px;
        padding: 8px 12px 8px 36px;
        color: var(--text-primary);
        font-family: var(--font-main);
        font-size: 0.9rem;
        outline: none;
        transition: all 0.2s;
    }

    .sticker-search-bar input:focus {
        background: rgba(255, 255, 255, 0.1);
        border-color: var(--color-primary);
    }

    .sticker-search-bar .search-icon {
        position: absolute;
        left: 22px;
        color: var(--text-muted);
        pointer-events: none;
    }


    .sticker-grid {
        flex: 1;
        overflow-y: auto;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        padding: 12px;
    }

    .sticker-grid::-webkit-scrollbar {
        width: 4px;
    }

    .sticker-grid::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: 4px;
    }

    .sticker-item {
        width: 100%;
        aspect-ratio: 1;
        border-radius: 8px;
        cursor: pointer;
        overflow: hidden;
        transition: transform 0.2s;
        background: rgba(255, 255, 255, 0.05);
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sticker-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .sticker-item:hover {
        transform: scale(1.05);
        background: rgba(255, 255, 255, 0.1);
    }

    emoji-picker {
        --background: #1a1a1a;
        --border-color: var(--border-glass);
        --indicator-color: var(--color-primary);
        --button-hover-background: rgba(255, 255, 255, 0.1);
        width: 320px;
        height: 400px;
    }

    .btn-sticker {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
        transition: all 0.2s;
    }

    .btn-sticker:hover {
        color: var(--color-secondary);
        background: rgba(255, 0, 255, 0.1);
    }



    /* Send Button */
    .btn-send {
        width: 48px;
        height: 48px;
        min-width: 48px;
        /* Prevent shrink */
        border-radius: 50%;
        border: none;
        background: linear-gradient(135deg, var(--color-primary), #00dddd);
        color: #000;
        font-weight: 700;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 255, 255, 0.4);
        transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
        /* Bouncy */
    }

    .btn-send:hover {
        transform: scale(1.1) rotate(-10deg);
        box-shadow: 0 8px 20px rgba(0, 255, 255, 0.6);
    }

    /* ... existing styles ... */

    /* New Input Bar Actions */
    .btn-icon-input {
        width: 36px;
        height: 36px;
        min-width: 36px;
        border-radius: 50%;
        border: none;
        background: transparent;
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s;
        margin: 0 2px;
        flex-shrink: 0;
    }

    .btn-icon-input:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
    }

    #recordBtn:hover {
        color: #ff4444;
        /* Red hint for record */
        background: rgba(255, 68, 68, 0.1);
    }

    #actionMenuBtn {
        margin-right: 4px;
        /* Separator */
    }

    /* Reaction Buttons (Anger, Heart) */
    .btn-reaction {
        font-size: 1.2rem;
        transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
        filter: grayscale(100%);
        opacity: 0.7;
    }

    .btn-reaction:hover {
        filter: grayscale(0%);
        opacity: 1;
        transform: scale(1.2);
    }

    .btn-reaction.active {
        filter: grayscale(0%);
        opacity: 1;
        transform: scale(1.1);
    }



    #actionMenuBtn:hover {
        background: rgba(255, 255, 255, 0.15);
        color: var(--color-primary);
        transform: rotate(90deg);
    }



    /* Actions Menu (Floating) */
    .actions-menu {
        position: absolute;
        bottom: 60px;
        /* Above capsule */
        left: 0;
        width: 180px;
        background: var(--bg-glass-heavy);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid var(--border-glass);
        border-radius: 16px;
        z-index: 1000;
        padding: 8px;
        display: flex;
        flex-direction: column;
        gap: 4px;
        z-index: 2000;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
        transform-origin: bottom left;
        animation: menuPop 0.2s var(--ease-out-expo);
    }

    @keyframes menuPop {
        0% {
            opacity: 0;
            transform: scale(0.8) translateY(10px);
        }

        100% {
            opacity: 1;
            transform: scale(1) translateY(0);
        }
    }

    .menu-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 10px 12px;
        width: 100%;
        border: none;
        background: transparent;
        color: var(--text-primary);
        font-family: var(--font-main);
        font-size: 0.95rem;
        cursor: pointer;
        border-radius: 12px;
        transition: all 0.2s;
        text-align: left;
    }

    .menu-item:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateX(4px);
    }

    .menu-icon {
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-secondary);
    }

    .menu-item:hover .menu-icon {
        background: var(--color-primary);
        color: #000;
    }

    /* Specific Menu Item Colors on Hover */
    #uploadBtn:hover .menu-icon {
        background: #00ccff;
        /* Blue */
    }

    #stickerBtn:hover .menu-icon {
        background: #ff00ff;
        /* Pink */
    }

    #nudgeBtn:hover .menu-icon {
        background: #ffcc00;
        /* Yellow */
    }

    /* Hide original classes if they conflict or are no longer needed */
    /* We can remove .btn-upload, .btn-sticker, .btn-nudge styles if we want to cleanup, but for now we just override/ignore them since we changed classes in HTML */

    /* Modals */
    .modal-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(8px);
        display: flex;
        justify-content: center;
        align-items: center;
        z-index: 3000;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }

    .modal-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .modal-card {
        background: var(--bg-glass-heavy);
        padding: 30px;
        border-radius: 24px;
        border: 1px solid var(--border-glass);
        width: 90%;
        max-width: 400px;
        text-align: center;
        transform: scale(0.9);
        transition: transform 0.3s var(--ease-out-expo);
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    }

    .modal-overlay.active .modal-card {
        transform: scale(1);
    }

    .user-frame img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .modal-preview {
        width: 100%;
        height: 250px;
        object-fit: cover;
        border-radius: 12px;
        margin: 16px 0;
        border: 1px dashed var(--border-glass);
    }

    .modal-actions {
        display: flex;
        gap: 12px;
        justify-content: flex-end;
        margin-top: 20px;
    }

    .btn-secondary {
        padding: 10px 20px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-glass);
        color: var(--text-primary);
        border-radius: 12px;
        cursor: pointer;
        font-weight: 500;
        transition: all 0.2s;
    }

    .btn-primary {
        padding: 10px 24px;
        background: var(--color-primary);
        color: #000;
        border: none;
        border-radius: 12px;
        cursor: pointer;
        font-weight: 600;
        box-shadow: 0 4px 12px rgba(0, 255, 255, 0.3);
        transition: all 0.2s;
    }

    .btn-primary:hover {
        box-shadow: 0 6px 16px rgba(0, 255, 255, 0.5);
        transform: translateY(-2px);
    }

    /* Animations */
    @keyframes slideInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Fullscreen Media */
    .fullscreen-img {
        max-width: 95%;
        max-height: 95%;
        object-fit: contain;
        border-radius: 8px;
        box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
    }

    /* --- Reaction System --- */
    .reaction-picker {
        display: flex;
        gap: 6px;
        background: var(--bg-glass-heavy);
        padding: 6px 10px;
        border-radius: 24px;
        border: 1px solid var(--border-glass);
        position: fixed;
        /* Changed from absolute to fixed */
        /* top/left set by JS */
        min-width: max-content;
        flex-wrap: nowrap;
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
        z-index: 2147483647;
        /* Highest possible */
        /* Highest possible */
        /* Animation handled by JS class 'active' or inline */
        opacity: 0;
        transform: scale(0.9);
        transition: opacity 0.2s, transform 0.2s var(--ease-out-expo);
        backdrop-filter: blur(12px);
        pointer-events: none;
        /* Prevent clicks while hidden */
    }

    .reaction-picker.active {
        opacity: 1;
        transform: scale(1);
        pointer-events: auto;
    }

    .reaction-opt {
        font-size: 1.2rem;
        cursor: pointer;
        transition: transform 0.2s;
        user-select: none;
        padding: 2px;
    }

    .reaction-opt:hover {
        transform: scale(1.3);
    }

    /* Connection Bar (Above Avatar) */
    .connection-bar {
        position: absolute;
        top: -16px;
        /* Moved up slightly */
        left: 0;
        right: 0;
        margin: 0 auto;
        transform: none;
        width: 40px;
        height: 6px;
        border-radius: 4px;
        transition: all 0.3s ease;
        opacity: 0;
        /* Hidden by default (for inactive) */
        z-index: 100;
    }

    .connection-bar.active {
        opacity: 1;
        /* Visible for active user */
    }

    .connection-bar.status-connected {
        background: #00ff88;
        box-shadow: 0 0 8px #00ff88, 0 0 16px #00ff88;
    }

    .connection-bar.status-disconnected {
        background: #ff3333;
        box-shadow: 0 0 8px #ff3333, 0 0 16px #ff3333;
    }

    @keyframes pulseRed {
        from {
            opacity: 0.6;
        }

        to {
            opacity: 1;
        }
    }



    /* Adjust for 'other' messages if needed, but generic right seems okay for 'stuck to bubble' */
    /* But wait, if message is from other, it aligns left. Bubble structure is same. */
    /* If we want it top-right of the bubble, this works. */

    /* Trigger Button */
    .btn-react-trigger {
        position: absolute;
        top: -12px;
        right: -12px;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        border: 2px solid var(--bg-dark);
        /* Border to separate from bubble */
        background: #007bff;
        color: white;
        cursor: pointer;
        opacity: 0;
        transform: scale(0.8);
        transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
        z-index: 30;
        /* Highest priority */
        font-size: 1.2rem;
        line-height: 1;
        padding-bottom: 2px;
    }

    /* Show on hover */
    .msg-bubble:hover .btn-react-trigger,
    .btn-react-trigger:hover,
    .btn-react-trigger:focus {
        opacity: 1;
        transform: scale(1);
    }

    /* Reaction Pills */
    .reaction-pill {
        font-size: 0.8rem;
        /* Smaller for compactness */
        background: var(--bg-glass-heavy);
        color: var(--text-primary);
        border-radius: 10px;
        /* Slightly tighter radius */
        padding: 1px 6px;
        border: 1px solid var(--border-glass);
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 3px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
        line-height: normal;
        min-height: 22px;
        white-space: nowrap;
        backdrop-filter: blur(8px);
        transition: transform 0.2s;
    }

    .reaction-pill:hover {
        transform: scale(1.1);
        z-index: 25;
    }

    @keyframes scaleIn {
        from {
            transform: scale(0);
            opacity: 0;
        }

        to {
            transform: scale(1);
            opacity: 1;
        }
    }

    /* Responsive */
    @media (max-width: 600px) {
        .app-container {
            width: 100%;
            height: 100vh;
            max-width: none;
            border-radius: 0;
            border: none;
            padding: 12px;
        }

        .msg-group {
            max-width: 100%;
        }

        .input-capsule {
            padding-left: 12px;
        }
    }

    /* --- Welcome Screen --- */
    #welcome-screen {
        position: fixed;
        inset: 0;
        z-index: 9999;
        background: var(--bg-dark);
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 1;
        visibility: visible;
        transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
    }

    #welcome-screen.fade-out {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }

    .welcome-content {
        text-align: center;
        animation: scaleIn 0.8s cubic-bezier(0.19, 1, 0.22, 1);
    }

    .welcome-title {
        font-size: 3rem;
        font-weight: 800;
        margin-bottom: 0.5rem;
        background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        letter-spacing: -1px;
    }

    .welcome-subtitle {
        font-size: 1.5rem;
        color: var(--text-secondary);
        font-family: var(--font-mono);
        margin-bottom: 2rem;
    }

    .loading-spinner {
        width: 40px;
        height: 40px;
        margin: 0 auto;
        border: 3px solid rgba(255, 255, 255, 0.1);
        border-radius: 50%;
        border-top-color: var(--color-primary);
        animation: spin 1s infinite linear;
    }

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

    /* --- Funny Animation --- */
    .funny-box {
        font-size: 2.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 10px;
        animation: dance 1s infinite alternate cubic-bezier(0.36, 0.45, 0.63, 0.53);
        filter: drop-shadow(0 0 10px rgba(255, 0, 0, 0.5));
    }

    @keyframes dance {
        0% {
            transform: translateY(0) rotate(-10deg) scale(1);
        }

        100% {
            transform: translateY(-10px) rotate(10deg) scale(1.1);
        }
    }

    /* Recording UI */
    .btn-upload,
    .btn-record {
        background: none;
        border: none;
        color: var(--text-secondary);
        padding: 8px 12px;
        cursor: pointer;
        transition: color 0.2s;
        display: flex;
        align-items: center;
        position: relative;
        z-index: 20;
        /* Always above potential overlays if active */
    }

    .btn-upload:hover,
    .btn-record:hover {
        color: var(--color-primary);
    }

    .btn-record.recording {
        color: #ff3333;
        animation: pulseRed 1.5s infinite;
        position: relative;
        /* Ensure z-index works */
        z-index: 20;
        /* Above overlay (z-index 10) */
    }

    /* Recording Overlay inside capsule */
    .recording-overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: var(--bg-surface);
        display: flex;
        align-items: center;
        justify-content: center;
        /* Center content */
        padding: 0 15px;
        gap: 10px;
        z-index: 10;
        color: #ff3333;
        font-weight: 500;
        backdrop-filter: blur(10px);
    }

    .recording-overlay.hidden {
        display: none;
    }

    .recording-dot {
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background: #ff3333;
        animation: flash 1s infinite;
    }

    .recording-time {
        margin-left: auto;
        color: var(--text-primary);
        font-size: 0.9rem;
        font-variant-numeric: tabular-nums;
    }

    /* Refined Voice Review UI */
    .review-player-controls {
        display: flex;
        align-items: center;
        gap: 12px;
        background: rgba(255, 255, 255, 0.1);
        padding: 6px 16px;
        border-radius: 20px;
        margin: 0 10px;
        flex-grow: 1;
        justify-content: center;
    }

    .btn-icon-small {
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-primary);
        padding: 6px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }

    .btn-icon-small:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .review-time {
        font-size: 0.9rem;
        color: var(--text-primary);
        font-variant-numeric: tabular-nums;
        font-weight: 500;
    }

    @keyframes pulseRed {
        0% {
            transform: scale(1);
        }

        50% {
            transform: scale(1.2);
        }

        100% {
            transform: scale(1);
        }
    }

    @keyframes flash {

        0%,
        100% {
            opacity: 1;
        }

        50% {
            opacity: 0.3;
        }
    }

    audio {
        max-width: 100%;
        height: 32px;
        margin-top: 5px;
        border-radius: 16px;
    }

    /* --- Download Button Styles --- */
    .btn-download {
        position: absolute;
        bottom: 8px;
        right: 8px;
        /* background: rgba(0, 0, 0, 0.6); */
        background: #00ff88;
        /* color: white; */
        color: #000;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        backdrop-filter: blur(4px);
        transition: all 0.2s ease;
        opacity: 1;
        /* Always visible */
        z-index: 10;
        text-decoration: none;
        box-shadow: 0 2px 8px rgba(0, 255, 136, 0.4);
    }

    .msg-bubble:hover .btn-download,
    .msg-bubble>div:hover .btn-download {
        opacity: 1;
    }

    .btn-download:hover {
        background: #00ffaa;
        transform: scale(1.1);
        color: #000;
        box-shadow: 0 4px 12px rgba(0, 255, 136, 0.6);
    }

    .btn-download-icon {
        background: transparent;
        color: var(--text-secondary);
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: all 0.2s ease;
        opacity: 0.7;
        text-decoration: none;
    }

    .btn-download-icon:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
        opacity: 1;
    }

    /* Ensure container handles positioning */
    .msg-bubble>div[style*="position: relative"] {
        display: inline-block;
    }

    /* --- Link Preview Card --- */
    .link-preview-card {
        display: flex;
        flex-direction: column;
        margin-top: 8px;
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 12px;
        overflow: hidden;
        text-decoration: none;
        color: inherit;
        transition: background 0.2s, transform 0.2s;
        max-width: 100%;
    }

    .link-preview-card:hover {
        background: rgba(0, 0, 0, 0.3);
        transform: translateY(-1px);
    }

    .link-preview-image {
        width: 100%;
        height: 150px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-color: rgba(255, 255, 255, 0.05);
    }

    .link-preview-content {
        padding: 10px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .link-preview-title {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text-primary);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .link-preview-desc {
        font-size: 0.85rem;
        color: var(--text-secondary);
        display: -webkit-box;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.4;
    }

    .link-preview-domain {
        font-size: 0.75rem;
        color: var(--color-primary);
        opacity: 0.8;
        margin-top: 4px;
        text-transform: lowercase;
    }

    .link-preview-loading {
        padding: 12px;
        font-size: 0.85rem;
        color: var(--text-secondary);
        font-style: italic;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .link-preview-loading::before {
        content: "";
        width: 12px;
        height: 12px;
        border: 2px solid var(--text-secondary);
        border-top-color: transparent;
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

    /* --- Media Gallery Link Card --- */
    .media-link-card {
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
        display: flex;
        flex-direction: column;
        text-decoration: none;
        background: rgba(0, 0, 0, 0.4);
        /* border-radius: 8px; */
        /* Inherited from parent */
        /* overflow: hidden; */
        /* Inherited from parent */
        /* border: 1px solid ... */
        /* Parent has border */
        transition: transform 0.2s, background 0.2s;
    }

    .media-link-card:hover {
        background: rgba(0, 0, 0, 0.6);
        /* Transform scaling is handled by parent .media-item:hover, but if we want internal scale... */
        /* Actually .media-item handles hover scale. We just need background change on internal card or parent. */
    }

    .media-link-bg {
        flex-grow: 1;
        background-size: cover;
        background-position: center;
        background-color: rgba(255, 255, 255, 0.05);
        /* Fallback */
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Domain Overlay on Image */
    .media-link-domain {
        position: absolute;
        top: 4px;
        right: 4px;
        background: rgba(0, 0, 0, 0.7);
        color: white;
        font-size: 0.65rem;
        padding: 2px 6px;
        border-radius: 4px;
        backdrop-filter: blur(4px);
        max-width: 90%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* Title bar at bottom */
    .media-link-info {
        padding: 6px 8px;
        background: rgba(0, 0, 0, 0.8);
        backdrop-filter: blur(10px);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .media-link-title {
        font-size: 0.75rem;
        color: var(--text-primary);
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        line-height: 1.25;
    }

    /* Fallback Icon if no image */
    .media-link-icon-fallback {
        color: var(--text-secondary);
        opacity: 0.5;
    }


    @keyframes shake {
        0% {
            transform: translate(1px, 1px) rotate(0deg);
        }

        10% {
            transform: translate(-1px, -2px) rotate(-1deg);
        }

        20% {
            transform: translate(-3px, 0px) rotate(1deg);
        }

        30% {
            transform: translate(3px, 2px) rotate(0deg);
        }

        40% {
            transform: translate(1px, -1px) rotate(1deg);
        }

        50% {
            transform: translate(-1px, 2px) rotate(-1deg);
        }

        60% {
            transform: translate(-3px, 1px) rotate(0deg);
        }

        70% {
            transform: translate(3px, 1px) rotate(-1deg);
        }

        80% {
            transform: translate(-1px, -1px) rotate(1deg);
        }

        90% {
            transform: translate(1px, 2px) rotate(0deg);
        }

        100% {
            transform: translate(1px, -2px) rotate(-1deg);
        }
    }

    .shaking {
        animation: shake 0.5s;
        animation-iteration-count: 1;
    }

    .btn-nudge {
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-secondary);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 8px;
        transition: all 0.2s;
    }

    .btn-nudge:hover {
        color: #ffeb3b;
        /* Yellow for attention */
        background: rgba(255, 235, 59, 0.1);
        animation: wiggle 0.5s ease-in-out infinite;
    }

    /* Weather Info */
    .weather-info {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        padding: 8px 12px;
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid var(--border-glass);
        border-radius: 16px;
        color: var(--text-primary);
        backdrop-filter: blur(4px);
        transition: all 0.3s ease;
        min-width: 80px;
        text-align: center;
        align-self: center;
        margin: 0 -10px;
        z-index: 5;
    }

    .weather-info:hover {
        background: rgba(255, 255, 255, 0.1);
        transform: translateY(-2px);
        border-color: var(--color-primary);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    }

    /* Weather Online State */
    .weather-info.online {
        border-color: #00ff88 !important;
        /* Neon Green */
        box-shadow: 0 0 15px rgba(0, 255, 136, 0.4);
        animation: glowOnline 2s infinite alternate;
    }

    .weather-info.online .weather-temp {
        color: #00ff88 !important;
    }

    /* Weather Offline State */
    .weather-info.offline {
        border-color: #ff4444 !important;
        /* Neon Red */
        box-shadow: 0 0 15px rgba(255, 68, 68, 0.4);
        animation: glowOffline 2s infinite alternate;
    }

    .weather-info.offline .weather-temp {
        color: #ff4444 !important;
    }

    @keyframes glowOnline {
        from {
            box-shadow: 0 0 10px rgba(0, 255, 136, 0.3);
        }

        to {
            box-shadow: 0 0 20px rgba(0, 255, 136, 0.6);
        }
    }

    @keyframes glowOffline {
        from {
            box-shadow: 0 0 10px rgba(255, 68, 68, 0.3);
        }

        to {
            box-shadow: 0 0 20px rgba(255, 68, 68, 0.6);
        }
    }

    /* Border Snake Animation */
    @keyframes snake-ccw {
        0% {
            top: -5px;
            left: calc(100% - 5px);
            transform: none;
        }

        25% {
            top: -5px;
            left: -5px;
            transform: none;
        }

        50% {
            top: calc(100% - 5px);
            left: -5px;
            transform: none;
        }

        75% {
            top: calc(100% - 5px);
            left: calc(100% - 5px);
            transform: none;
        }

        100% {
            top: -5px;
            left: calc(100% - 5px);
            transform: none;
        }
    }

    @keyframes snake-cw {
        0% {
            top: -5px;
            left: -5px;
            transform: none;
        }

        25% {
            top: -5px;
            left: calc(100% - 5px);
            transform: none;
        }

        50% {
            top: calc(100% - 5px);
            left: calc(100% - 5px);
            transform: none;
        }

        75% {
            top: calc(100% - 5px);
            left: -5px;
            transform: none;
        }

        100% {
            top: -5px;
            left: -5px;
            transform: none;
        }
    }

    /* Base Snake Style */
    .weather-info {
        position: relative;
        overflow: visible !important;
    }

    /* We need to override the previous ::after styles */
    .weather-info::after {
        content: '';
        position: absolute;
        width: 10px;
        /* Length of the snake head */
        height: 10px;
        border-radius: 50%;
        background: currentColor;
        box-shadow: 0 0 10px currentColor, 0 0 20px currentColor;
        filter: blur(2px);
        opacity: 0;
        /* Hidden by default */
        pointer-events: none;
        z-index: 10;
    }

    /* Online (Green) */
    .weather-info.online::after {
        opacity: 1;
        color: #00ff88;
        background: #00ff88;
    }

    /* Offline (Red) */
    .weather-info.offline::after {
        opacity: 1;
        color: #ff4444;
        background: #ff4444;
    }

    /* Fahmy: Counter-Clockwise */
    #weather-Fahmy.online::after,
    #weather-Fahmy.offline::after {
        animation: snake-ccw 4s linear infinite;
    }

    /* Hoda: Clockwise */
    #weather-Hoda.online::after,
    #weather-Hoda.offline::after {
        animation: snake-cw 4s linear infinite;
    }

    .weather-temp {
        font-size: 1.1rem;
        font-weight: 700;
        font-family: var(--font-mono);
        color: var(--color-primary);
        text-shadow: 0 0 10px rgba(0, 255, 255, 0.3);
    }

    .weather-loc {
        font-size: 2rem;
        color: var(--text-secondary);
        margin-top: 2px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .weather-left {
        border-right: none;
        border-top-right-radius: 4px;
        border-bottom-right-radius: 4px;
        margin-right: -15px;
        padding-right: 20px;
    }

    .weather-right {
        border-left: none;
        border-top-left-radius: 4px;
        border-bottom-left-radius: 4px;
        margin-left: -15px;
        padding-left: 20px;
    }

    /* Recording Overlay (Fix) */
    .recording-overlay {
        position: absolute;
        inset: 0;
        /* Covers entire capsule */
        background: var(--bg-surface);
        /* Or specific color */
        border-radius: 9999px;
        /* Match capsule */
        display: flex;
        align-items: center;
        justify-content: space-between;
        /* Spread content */
        padding: 0 16px;
        z-index: 20;
        /* Above input */
    }

    .recording-overlay.hidden {
        display: none;
    }

    .recording-dot {
        width: 10px;
        height: 10px;
        background: #ff4444;
        border-radius: 50%;
        margin-right: 8px;
        animation: pulse 1.5s infinite;
    }

    .recording-time {
        color: var(--text-primary);
        font-family: var(--font-mono);
        font-weight: 700;
        margin-left: auto;
        /* Push to right */
        margin-right: 0;
    }

    @keyframes pulse {
        0% {
            opacity: 1;
        }

        50% {
            opacity: 0.5;
        }

        100% {
            opacity: 1;
        }
    }

    /* Link Preview Card */
    .link-preview-container {
        margin-top: 8px;
        max-width: 300px;
        width: 100%;
    }

    .link-preview-card {
        display: flex;
        flex-direction: column;
        background: rgba(0, 0, 0, 0.2);
        border: 1px solid var(--border-glass);
        border-radius: 12px;
        overflow: hidden;
        text-decoration: none;
        transition: all 0.2s ease;
        cursor: pointer;
    }

    .link-preview-card:hover {
        background: rgba(255, 255, 255, 0.05);
        border-color: var(--color-primary);
    }

    .link-preview-image {
        width: 100%;
        height: 140px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        background-color: #000;
    }

    .link-preview-content {
        padding: 10px;
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .link-preview-title {
        font-size: 0.95rem;
        font-weight: 600;
        color: var(--text-primary);
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.3;
    }

    .link-preview-desc {
        font-size: 0.8rem;
        color: var(--text-secondary);
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        line-height: 1.4;
    }

    .link-preview-site {
        font-size: 0.7rem;
        color: var(--text-muted);
        margin-top: 4px;
        text-transform: uppercase;
        font-weight: 500;
    }

    /* --- Reply Context Banner --- */
    .reply-preview {
        display: flex;
        align-items: center;
        background: rgba(30, 30, 30, 0.95);
        /* Slightly lighter than input */
        border-left: 3px solid var(--color-primary);
        border-radius: 16px 16px 0 0;
        padding: 10px 16px;
        margin-bottom: 0;
        /* Align flush with input */
        gap: 12px;
        width: 100%;
        animation: slideInUp 0.2s var(--ease-out-expo);
        position: relative;
        z-index: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .input-stack.has-reply .input-capsule {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-top: none;
    }

    .reply-preview.hidden {
        display: none !important;
    }

    .reply-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: visible;
        /* Allow content to dictate height */
        min-width: 0;
        /* Flexbox text wrap fix */
    }

    .reply-to-name {
        font-size: 0.8rem;
        color: var(--text-primary);
        font-weight: 600;
        margin-bottom: 2px;
    }

    .reply-to-text {
        font-size: 0.8rem;
        color: var(--text-secondary);
        white-space: pre-wrap;
        overflow-y: auto;
        overflow-x: hidden;
        text-overflow: clip;
        display: block;
        word-break: break-all;
        overflow-wrap: break-word;
        max-height: 120px;
        width: 100%;
    }

    .msg-reply-context {
        display: flex;
        align-items: center;
        gap: 10px;
        background: rgba(0, 0, 0, 0.2);
        border-left: 3px solid var(--color-primary);
        border-radius: 4px;
        padding: 8px 10px;
        margin-bottom: 6px;
        font-size: 0.85rem;
        cursor: pointer;
        transition: all 0.2s;
        position: relative;
        overflow: hidden;
    }

    .reply-thumbnail {
        width: 36px;
        height: 36px;
        border-radius: 4px;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
        flex-shrink: 0;
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .reply-info {
        display: flex;
        flex-direction: column;
        /* Ensure vertical stacking */
        min-width: 0;
        flex: 1;
        justify-content: center;
        /* Center vertically if single line, otherwise stack */
    }

    .msg-reply-context:hover {
        background: rgba(0, 0, 0, 0.3);
    }

    .reply-sender {
        color: var(--text-primary);
        font-weight: 600;
        font-size: 0.75rem;
        margin-bottom: 2px;
        display: block;
        /* Force own line */
        width: 100%;
    }

    .reply-text {
        color: rgba(255, 255, 255, 0.8);
        white-space: pre-wrap !important;
        /* Preserve newlines */
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.8rem;
        display: -webkit-box !important;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        -webkit-box-orient: vertical !important;
        word-break: break-word !important;
        /* Handle long words */
        max-height: 4.5em;
        /* Fallback height limit */
    }

    /* Adjust bubble padding if it has a reply */
    .msg-bubble:has(.msg-reply-context) {
        padding-top: 10px;
    }

    /* Reply Themes */
    .msg-reply-context.hoda {
        border-left-color: var(--color-secondary);
        background: rgba(255, 0, 255, 0.1);
    }

    .msg-reply-context.fahmy {
        border-left-color: var(--color-primary);
        background: rgba(0, 255, 255, 0.1);
    }



    /* Ensure text wraps and newlines are respected */
    .msg-bubble {
        white-space: pre-wrap;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    /* Swipe indication or button (Hidden by default, shown on hover/interactions) */
    .btn-reply-action {
        opacity: 1;
        /* Always visible */
        position: absolute;
        right: -65px;
        /* Increased to clear bubble padding + gap */
        top: 50%;
        transform: translateY(-50%);
        background: none;
        border: none;
        color: var(--text-primary);
        cursor: pointer;
        padding: 6px;
        transition: all 0.2s;
    }

    .btn-reply-action svg {
        width: 20px;
        height: 20px;
        stroke-width: 2.5;
        filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));

    }

    .btn-reply-action:hover {
        color: var(--color-primary);
        background: rgba(255, 255, 255, 0.05);
        border-radius: 50%;
    }



    .msg-group.me .btn-reply-action {
        right: auto;
        left: -40px;
        /* Adjusted for better visibility */
        top: 50%;
        transform: translateY(-50%) scaleX(-1);
        /* Removed scaleX(-1) if it was causing issues, or keep it if arrow direction matters. Arrow points left by default? No, arrow points left "Reply". Flipping it makes it point right? */
        /* Original SVG points left-ish (9 17 4 12 9 7 -> 4,12 is the tip). So it points LEFT. */
        /* If on the right side (Me), pointing Left (back to message) makes sense? Or pointing away? */
        /* Usually reply arrow points "back". */
        /* Let's keep transform but ensure Z-index and visibility. */
        z-index: 100;
        opacity: 1;
        /* Force visible */
    }

    /* Mobile: Always visible if needed or manage via swipe gestures later */
    /* Mobile adjustments for reply action if needed */
    @media (max-width: 768px) {
        /* .btn-reply-action { opacity: 1; } */
    }

    /* Message Highlight Animation */
    @keyframes highlight-pulse-modern {
        0% {
            box-shadow: 0 0 0 0 rgba(0, 255, 255, 0.4);
            background: rgba(0, 255, 255, 0.1);
            transform: scale(1);
        }

        50% {
            box-shadow: 0 0 20px 5px rgba(0, 255, 255, 0.1);
            background: rgba(0, 255, 255, 0.2);
            transform: scale(1.02);
        }

        100% {
            box-shadow: 0 0 0 0 rgba(0, 255, 255, 0);
            background: transparent;
            transform: scale(1);
        }
    }

    .message-highlight {
        animation: highlight-pulse-modern 1.5s ease-out;
        position: relative;
        z-index: 5;
        border-radius: inherit;
    }

    .weather-time {
        font-size: 0.75rem;
        color: var(--text-secondary);
        font-family: var(--font-mono);
        margin: 2px 0 4px 0;
        opacity: 0.8;
    }

    @media (max-width: 768px) {

        /* Gallery Strip - Tighten spacing */
        .gallery-strip {
            gap: 8px;
            /* Reduce gap significantly */
            padding: 12px 0;
        }

        /* Weather Info - Reduce padding and font sizes */
        .weather-info {
            padding: 4px 6px;
            min-width: 50px;
            /* Allow it to be narrower */
            margin: 0 -5px;
            /* Pull closer to the image */
        }

        .weather-temp {
            font-size: 0.9rem;
            /* Smaller temp */
        }

        .weather-time {
            font-size: 0.65rem;
            /* Smaller time */
            margin: 2px 0;
        }

        .weather-loc {
            font-size: 1.2rem;
            /* Significantly smaller flag */
        }

        /* Adjust margins for left/right specific classes to tighter fits */
        .weather-left {
            margin-right: -10px;
            padding-right: 15px;
        }

        .weather-right {
            margin-left: -10px;
            padding-left: 15px;
        }

        /* Optionally reduce User Frame size if still too crowded */
        .user-frame {
            width: 80px;
            height: 80px;
        }
    }

    /* Active Call Full Screen Overlay */
    .floating-call-ui {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0, 0, 0, 0.9);
        backdrop-filter: blur(16px);
        z-index: 3000;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        border: none;
        border-radius: 0;
        animation: fadeIn 0.3s ease;
        box-shadow: none;
        padding: 0;
    }

    .call-interface-mini {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 24px;
        width: 100%;
    }

    .user-frame-mini {
        width: 160px;
        height: 160px;
        border-radius: 50%;
        overflow: hidden;
        flex-shrink: 0;
        border: 4px solid var(--border-glass);
        /* Ensure visible border */
        box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
        background: var(--bg-glass);
    }

    .user-frame-mini img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .call-info {
        text-align: center;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }

    .call-info h3 {
        font-size: 2rem;
        font-weight: 700;
        color: var(--text-primary);
        margin: 0;
    }

    .call-timer {
        font-size: 1.5rem;
        color: var(--color-primary);
        font-family: var(--font-mono);
        font-weight: 500;
    }

    .call-controls-mini {
        display: flex;
        gap: 32px;
        margin-top: 20px;
    }

    .btn-icon-small {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        /* Round buttons */
        border: 2px solid rgba(255, 255, 255, 0.1);
        background: rgba(255, 255, 255, 0.05);
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
    }

    .btn-icon-small svg {
        width: 28px;
        height: 28px;
    }

    .btn-icon-small:hover {
        background: rgba(255, 255, 255, 0.15);
        color: var(--text-primary);
        transform: scale(1.1);
    }

    .btn-icon-small.hangup {
        color: #ff4444;
        background: rgba(255, 68, 68, 0.15);
        border-color: rgba(255, 68, 68, 0.4);
    }

    .btn-icon-small.hangup:hover {
        background: #ff4444;
        color: white;
    }

    .btn-icon-small.answer {
        color: #00ff88;
        background: rgba(0, 255, 136, 0.15);
        border-color: rgba(0, 255, 136, 0.4);
    }

    .btn-icon-small.answer:hover {
        background: #00ff88;
        color: #000;
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
    }

    /* Animations */
    @keyframes slideInRight {
        from {
            opacity: 0;
            transform: translateY(20px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* Modern Incoming Call UI */
    .glass-call-card {
        background: rgba(20, 20, 20, 0.4);
        backdrop-filter: blur(24px);
        -webkit-backdrop-filter: blur(24px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
        padding: 40px;
        border-radius: 32px;
        width: 320px;
        display: flex;
        flex-direction: column;
        align-items: center;
        position: relative;
        overflow: hidden;
        animation: zoomIn 0.4s cubic-bezier(0.19, 1, 0.22, 1);
    }

    .glow-ring {
        position: absolute;
        top: -50%;
        left: -50%;
        width: 200%;
        height: 200%;
        background: radial-gradient(circle, rgba(0, 255, 255, 0.1) 0%, transparent 60%);
        animation: spin 10s linear infinite;
        pointer-events: none;
    }

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

        to {
            transform: rotate(360deg);
        }
    }

    @keyframes zoomIn {
        from {
            transform: scale(0.9);
            opacity: 0;
        }

        to {
            transform: scale(1);
            opacity: 1;
        }
    }

    .call-title {
        font-size: 1.1rem;
        color: var(--text-secondary);
        text-transform: uppercase;
        letter-spacing: 2px;
        margin-bottom: 24px;
        z-index: 2;
        font-weight: 500;
    }

    .user-frame-call {
        width: 120px;
        height: 120px;
        border-radius: 50%;
        padding: 4px;
        /* Space for border */
        background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
        box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
        margin-bottom: 20px;
        z-index: 2;
        animation: pulseAvatar 2s infinite ease-in-out;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        /* Ensure image stays inside border radius */
    }

    .user-frame-call img {
        width: 100%;
        height: 100%;
        border-radius: 50%;
        border: 4px solid var(--bg-dark);
        /* Inner border */
        object-fit: cover;
    }

    @keyframes pulseAvatar {

        0%,
        100% {
            box-shadow: 0 0 20px rgba(0, 255, 255, 0.3);
            transform: scale(1);
        }

        50% {
            box-shadow: 0 0 40px rgba(0, 255, 255, 0.6);
            transform: scale(1.05);
        }
    }

    .call-username {
        font-size: 1.75rem;
        font-weight: 700;
        color: var(--text-primary);
        margin-bottom: 32px;
        z-index: 2;
        text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    }

    .modal-actions {
        display: flex;
        gap: 32px;
        z-index: 2;
    }

    .btn-call-action {
        width: 64px;
        height: 64px;
        border-radius: 50%;
        border: none;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
    }

    .btn-call-action svg {
        width: 28px;
        height: 28px;
        fill: white;
        stroke: white;
    }

    /* Accept Button */
    .btn-call-action.accept {
        background: #00ff88;
        background: linear-gradient(135deg, #00ff88, #00cc66);
        box-shadow: 0 0 20px rgba(0, 255, 136, 0.4);
    }

    .btn-call-action.accept:hover {
        transform: translateY(-5px) scale(1.1);
        box-shadow: 0 0 40px rgba(0, 255, 136, 0.6);
    }

    /* Reject Button */
    .btn-call-action.reject {
        background: #ff4444;
        background: linear-gradient(135deg, #ff4444, #cc0000);
        box-shadow: 0 0 20px rgba(255, 68, 68, 0.4);
    }

    .btn-call-action.reject:hover {
        transform: translateY(-5px) scale(1.1);
        box-shadow: 0 0 40px rgba(255, 68, 68, 0.6);
    }

    /* Centered Call Button */
    #startCallBtn {
        width: 80px;
        height: 80px;
        background: rgba(255, 255, 255, 0.1);
        border: 2px solid var(--border-glass);
        box-shadow: 0 0 20px rgba(0, 0, 0, 0.3);
        color: #4caf50;
        /* Green tint */
        /* Green tint */
        /* Absolute Center Strategy */
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        z-index: 50;
        /* Above peers */

        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }

    #startCallBtn:hover {
        transform: translate(-50%, -50%) scale(1.1) rotate(90deg);
        background: rgba(76, 175, 80, 0.2);
        border-color: #4caf50;
        box-shadow: 0 0 30px rgba(76, 175, 80, 0.4);
        color: #fff;
    }

    #startCallBtn svg {
        width: 40px;
        height: 40px;
        /* User set 60 in HTML, but CSS overrides often cleaner. 
       However, if user inline style wins, we might need !important or just let it be.
       But standard btn-icon doesn't target svg size, just the button size.
       So the SVG will be 60px inside 80px button. That's fine.
    */
    }

    /* Mobile Optimizations for Weather & Layout */
    @media (max-width: 480px) {
        .app-header {
            padding: 8px 0;
        }

        .gallery-strip {
            gap: 4px;
            /* Minimal gap between elements */
            padding: 8px 0 16px;
            justify-content: space-around;
            /* Distribute space evenly */
            width: 100%;
        }

        /* Reduce User Frame Size */
        .user-frame {
            width: 65px;
            height: 65px;
            margin: 0 32px;
            /* Reduce gap for call button */
            border-radius: 20px;
        }

        /* Resize Call Button */
        #startCallBtn {
            width: 50px;
            height: 50px;
        }

        #startCallBtn svg {
            width: 24px;
            height: 24px;
        }

        /* Compact Weather Info */
        .weather-info {
            padding: 4px;
            min-width: 45px;
            margin: 0 !important;
            /* Remove negative margins that cause overlap */
            background: transparent;
            /* Cleaner look on tight screens */
            border: none;
            backdrop-filter: none;
        }

        .weather-left {
            order: -1;
            /* Ensure it stays left */
        }

        .weather-right {
            order: 10;
            /* Ensure it stays right */
        }

        .weather-temp {
            font-size: 0.85rem;
            line-height: 1.1;
        }

        .weather-time {
            font-size: 0.65rem;
            margin: 2px 0;
            white-space: nowrap;
        }

        .weather-loc {
            font-size: 1rem;
            /* Smaller flag */
        }

        /* Connection Bar Adjustment */
        .connection-bar {
            width: 25px;
            height: 4px;
            top: -10px;
        }
    }

    /* Chat Links */
    .chat-link {
        color: var(--color-primary);
        text-decoration: underline;
        text-decoration-thickness: 1px;
        text-underline-offset: 2px;
        word-break: break-all;
    }

    .chat-link:hover {
        color: var(--color-secondary);
        text-decoration: none;
        cursor: pointer;
    }

    /* Warning Banner */
    .alert-warning {
        background: rgba(255, 68, 68, 0.15);
        border: 1px solid #ff4444;
        color: #ffcccc;
        padding: 10px 16px;
        border-radius: var(--radius-sm);
        font-size: 0.9rem;
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 12px;
        animation: slideInDown 0.3s var(--ease-out-expo);
    }

    .alert-warning a {
        color: white;
        text-decoration: underline;
        font-weight: 500;
    }

    .alert-warning svg {
        flex-shrink: 0;
        color: #ff4444;
    }

    /* --- Media Gallery Sidebar --- */
    .media-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 320px;
        height: 100vh;
        background: var(--bg-glass-heavy);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-left: 1px solid var(--border-glass);
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
        z-index: 2000;
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1);
        display: flex;
        flex-direction: column;
    }

    .media-sidebar.active {
        transform: translateX(0);
    }

    .sidebar-header {
        padding: 20px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid var(--border-glass);
    }

    .sidebar-header h3 {
        margin: 0;
        font-size: 1.2rem;
        font-weight: 600;
        color: var(--text-primary);
    }

    .sidebar-content {
        flex: 1;
        overflow-y: auto;
        padding: 16px;
    }

    .media-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        /* 2 columns */
        gap: 12px;
    }

    .media-item {
        position: relative;
        width: 100%;
        padding-bottom: 100%;
        /* Square Aspect Ratio */
        border-radius: 12px;
        overflow: hidden;
        cursor: pointer;
        border: 1px solid var(--border-glass);
        transition: all 0.2s;
    }

    .media-item:hover {
        transform: scale(1.02);
        border-color: var(--color-primary);
    }

    .media-item img,
    .media-item video {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .media-type-icon {
        position: absolute;
        top: 6px;
        right: 6px;
        background: rgba(0, 0, 0, 0.6);
        border-radius: 50%;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: white;
        font-size: 12px;
    }

    .no-media {
        text-align: center;
        color: var(--text-muted);
        margin-top: 40px;
        font-style: italic;
    }

    /* --- Avatar & Sender Name Fixes --- */
    .msg-avatar {
        width: 42px;
        /* Slightly larger for better visibility */
        height: 42px;
        border-radius: 50%;
        overflow: hidden;
        flex-shrink: 0;
        margin-right: 10px;
        border: 2px solid var(--border-glass);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
        background: var(--bg-glass);
    }

    /* --- System Log Sidebar Styles --- */
    .system-log-list {
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    .system-msg-item {
        background: rgba(255, 255, 255, 0.03);
        border: 1px solid var(--border-glass);
        border-radius: 8px;
        padding: 10px 12px;
        font-size: 0.85rem;
        color: var(--text-secondary);
        display: flex;
        align-items: center;
        gap: 10px;
        transition: all 0.2s ease;
    }

    .system-msg-item:hover {
        background: rgba(255, 255, 255, 0.06);
        border-color: rgba(255, 255, 255, 0.1);
    }

    .system-msg-item .sys-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 28px;
        height: 28px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.05);
        flex-shrink: 0;
    }

    .system-msg-item.sys-online .sys-icon {
        color: #00ff88;
        background: rgba(0, 255, 136, 0.1);
    }

    .system-msg-item.sys-offline .sys-icon {
        color: #ff4444;
        background: rgba(255, 68, 68, 0.1);
    }

    .system-msg-item.sys-call .sys-icon {
        color: #00ccff;
        background: rgba(0, 204, 255, 0.1);
    }

    .system-msg-content {
        flex: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;
    }

    .system-msg-text {
        color: var(--text-primary);
        font-size: 0.9rem;
    }

    .system-msg-time {
        font-size: 0.7rem;
        color: var(--text-muted);
        font-family: var(--font-mono);
    }


    .msg-avatar img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .msg-sender-name {
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--text-primary);
        margin-bottom: 4px;
        margin-left: 2px;
        opacity: 0.9;
        display: block;
        /* Ensure it takes a line */
    }

    /* Layout for Other messages: Avatar | [Name + Bubble] */
    .msg-group.other {
        flex-direction: row;
        align-items: flex-end;
        /* Align avatar to bottom of message block */
        gap: 0;
    }

    /* Nudge Shake Animation */
    .nudge-shake {
        animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
        transform: translate3d(0, 0, 0);
        backface-visibility: hidden;
        perspective: 1000px;
    }

    @keyframes shake {

        10%,
        90% {
            transform: translate3d(-1px, 0, 0);
        }

        20%,
        80% {
            transform: translate3d(2px, 0, 0);
        }

        30%,
        50%,
        70% {
            transform: translate3d(-4px, 0, 0);
        }

        40%,
        60% {
            transform: translate3d(4px, 0, 0);
        }
    }

    .msg-content-column {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        max-width: 100%;
        min-width: 0;
    }

    @keyframes popIn {
        0% {
            opacity: 0;
            transform: scale(0.8);
        }

        100% {
            opacity: 1;
            transform: scale(1);
        }
    }

    /* Chat Area */
    .chat-area {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 0;
        /* Necessary for nested flex scrolling */
        gap: 16px;
        position: relative;
        /* Anchor for absolute button */
    }

    /* Load More Button (Mobile Friendly & Absolute Overlay) */
    .btn-load-more {
        position: absolute;
        top: 15px;
        /* Fixed distance from top of chat area */
        left: 50%;
        transform: translateX(-50%);
        z-index: 100;
        margin: 0;

        width: fit-content;
        min-width: 180px;

        background: rgba(20, 20, 20, 0.85);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);

        border: 1px solid var(--border-glass);
        color: var(--color-primary);
        padding: 10px 24px;
        border-radius: 50px;

        cursor: pointer;
        font-size: 0.9rem;
        font-weight: 500;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }

    .btn-load-more:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
        border-color: var(--color-primary);
        transform: translateY(2px);
        box-shadow: 0 6px 24px rgba(0, 255, 255, 0.2);
    }

    .history-spinner {
        width: 100%;
        display: flex;
        justify-content: center;
        padding: 10px 0;
    }

    .animate-spin {
        animation: spin 1s linear infinite;
    }

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

        to {
            transform: rotate(360deg);
        }
    }

    .media-user-name {
        position: absolute;
        bottom: 0px;
        left: 0;
        width: 100%;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
        color: white;
        font-size: 0.8rem;
        padding: 8px;
        padding-top: 20px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        pointer-events: none;
        text-align: center;
        border-bottom-left-radius: 12px;
        border-bottom-right-radius: 12px;
    }

    /* Drag and Drop Overlay */
    .drag-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 99999;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        color: var(--color-primary);
        font-size: 2rem;
        font-weight: bold;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        border: 4px dashed var(--color-primary);
    }

    .drag-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .drag-icon {
        width: 80px;
        height: 80px;
        margin-bottom: 20px;
        animation: bounce 1s infinite;
    }

    @keyframes bounce {

        0%,
        100% {
            transform: translateY(0);
        }

        50% {
            transform: translateY(-10px);
        }
    }

    /* Photo Overlay */
    .photo-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 10000;
        background: rgba(0, 0, 0, 0.85);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        display: flex;
        justify-content: center;
        align-items: center;
        opacity: 0;
        transition: opacity 0.5s ease;
        pointer-events: auto;
    }

    .photo-overlay.active {
        opacity: 1;
    }

    .orbit-container {
        position: relative;
        width: 250px;
        height: 250px;
        display: flex;
        justify-content: center;
        align-items: center;
        animation: orbit-spin 25s linear infinite;
    }

    /* Responsive Orbit Variables */
    :root {
        --orbit-radius: 200px;
        --orbit-item-size: 90px;
        --center-item-size: 140px;
        --title-size: 1.2rem;
        --title-bottom: -40px;
    }

    @media (max-width: 600px) {
        :root {
            --orbit-radius: 135px;
            /* Tighter radius for mobile */
            --orbit-item-size: 70px;
            --center-item-size: 110px;
            --title-size: 0.9rem;
            /* Smaller title */
            --title-bottom: -30px;
            /* Closer to image */
        }
    }

    /* Fixed Center Photo Animation Logic */
    .center-photo {
        position: absolute;
        width: var(--center-item-size);
        height: var(--center-item-size);
        z-index: 10;
        /* Counteract container spin to keep orientation */
        animation: counter-spin 25s linear infinite;
    }

    .center-photo img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        border-radius: 50%;
        border: 4px solid var(--color-primary);
        box-shadow: 0 0 30px var(--color-primary), 0 0 60px rgba(0, 255, 255, 0.2);
        /* Pulse effect on the image itself */
        animation: pulse-center 3s ease-in-out infinite;
    }

    .overlay-title {
        color: var(--color-primary);
        font-family: 'Amiri', var(--font-main);
        font-size: var(--title-size);
        font-weight: bold;
        text-shadow: 0 0 10px rgba(0, 0, 0, 0.8), 0 0 5px var(--color-primary);
        white-space: nowrap;
        background: rgba(0, 0, 0, 0.6);
        padding: 6px 16px;
        border-radius: 12px;
        border: 1px solid var(--color-primary);
        box-shadow: 0 0 15px rgba(0, 255, 255, 0.2);
        z-index: 20;
        margin-top: 40px;
        /* Force separation on non-flex browsers if any */
    }

    .orbit-item {
        position: absolute;
        top: 50%;
        left: 50%;
        width: var(--orbit-item-size);
        height: var(--orbit-item-size);
        margin-top: calc(var(--orbit-item-size) / -2);
        margin-left: calc(var(--orbit-item-size) / -2);
        border-radius: 50%;
        border: 2px solid var(--color-secondary);
        overflow: hidden;
        box-shadow: 0 0 15px var(--color-secondary);
        z-index: 5;
    }

    .orbit-item img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        /* Keep images upright */
        animation: counter-spin 25s linear infinite;
    }

    /* Positioning Items using Variable Radius */
    .item-1 {
        transform: rotate(0deg) translate(var(--orbit-radius)) rotate(0deg);
    }

    .item-2 {
        transform: rotate(72deg) translate(var(--orbit-radius)) rotate(-72deg);
    }

    .item-3 {
        transform: rotate(144deg) translate(var(--orbit-radius)) rotate(-144deg);
    }

    .item-4 {
        transform: rotate(216deg) translate(var(--orbit-radius)) rotate(-216deg);
    }

    .item-5 {
        transform: rotate(288deg) translate(var(--orbit-radius)) rotate(-288deg);
    }

    /* 
       Wait, simple transform translate rotate logic is static. 
       To animate orbit, we spin the parent.
       BUT, if we spin parent, the initial transforms rotate with it.
       So .item-1 is at 0 degrees relative to container.
       Container spins 0->360. Item-1 moves 0->360 absolute.
       To keep image upright, we need to rotate image itself -25s.
    */

    @keyframes orbit-spin {
        from {
            transform: rotate(0deg);
        }

        to {
            transform: rotate(360deg);
        }
    }

    @keyframes counter-spin {
        from {
            transform: rotate(0deg);
        }

        to {
            transform: rotate(-360deg);
        }
    }

    @keyframes pulse-center {

        0%,
        100% {
            transform: scale(1) rotate(0deg);
            box-shadow: 0 0 30px var(--color-primary);
        }

        50% {
            transform: scale(1.05) rotate(0deg);
            box-shadow: 0 0 50px var(--color-primary);
        }
    }

    /* 
       Correction: Since center-photo is inside orbit-container, 
       and orbit container spins, center-photo also spins.
       But pulse-center overrides transform!
       Conflict: pulse-center uses transform scale. counter-spin uses transform rotate.
       I should wrap center photo in another div or handle it differently.
       Simpler: Move .center-photo OUTSIDE .orbit-container in CSS logic or HTML.
       I'll use JS to adjust HTML? No, I can just absolutely position them in same parent.
       
       Let's adjust CSS to handle existing HTML structure.
       I will use a wrapper for the pulse.
    */

    /* Anger Animation Overlay */
    .anger-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        background: rgba(0, 0, 0, 0.5);
        /* Dim background slightly */
        z-index: 10000;
        pointer-events: none;
        /* Let clicks pass through */
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .anger-overlay.active {
        opacity: 1;
    }

    .anger-emoji {
        font-size: 5rem;
        filter: drop-shadow(0 0 20px red);
        transform: scale(0);
        opacity: 0;
    }

    .anger-emoji.animate {
        animation: growAndFade 2s forwards ease-in-out;
    }

    @keyframes growAndFade {
        0% {
            transform: scale(0.5);
            opacity: 0;
        }

        10% {
            transform: scale(1);
            opacity: 1;
        }

        50% {
            transform: scale(8);
            /* Go big */
            opacity: 1;
        }

        100% {
            transform: scale(12);
            /* Go even bigger */
            opacity: 0;
            /* Fade out */
        }
    }

    .heart-emoji.animate {
        animation: heartbeatZoom 2.5s forwards ease-in-out;
    }

    @keyframes heartbeatZoom {
        0% {
            transform: scale(0);
            opacity: 0;
        }

        10% {
            transform: scale(1);
            opacity: 1;
        }

        20% {
            transform: scale(0.8);
            opacity: 1;
        }

        30% {
            transform: scale(1.2);
            opacity: 1;
        }

        40% {
            transform: scale(1);
            opacity: 1;
        }

        60% {
            transform: scale(8);
            opacity: 1;
        }

        100% {
            transform: scale(15);
            opacity: 0;
        }
    }

    /* Search Sidebar specific styles */
    .search-input-wrapper input:focus {
        outline: none;
        border-color: var(--color-primary);
        box-shadow: 0 0 10px rgba(0, 255, 255, 0.2);
    }

    .search-result-item {
        margin-bottom: 1px;
        padding: 12px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }

    .search-result-item:last-child {
        border-bottom: none;
    }

    .highlight {
        background-color: rgba(255, 255, 0, 0.3);
        color: #ffff00;
        border-radius: 2px;
        padding: 0 2px;
    }
    /* Auth Animation */
    @keyframes shake {
        0%, 100% { transform: translateX(0); }
        10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
        20%, 40%, 60%, 80% { transform: translateX(5px); }
    }

    .shake {
        animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
    }
    
    .auth-form {
        display: flex;
        flex-direction: column;
    }
    
    .auth-form.hidden {
        display: none;
    }
