/* Page-specific body override */
body { overflow: hidden; }

/* ============================================
           LAYOUT
           ============================================ */
        .chat-container {
            display: flex;
            flex-direction: column;
            height: 100vh;
            height: 100dvh;
        }

        .topbar {
            height: 50px;
            background: var(--bg-secondary);
            border-bottom: 1px solid var(--border-glow);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 1.5rem;
            gap: 1rem;
            flex-shrink: 0;
        }

        .topbar-left, .topbar-right {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .topbar-btn {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1.2rem;
            transition: all 0.2s;
            padding: 0.25rem 0.5rem;
        }

        .topbar-btn:hover {
            color: var(--neon-cyan);
            text-shadow: 0 0 8px rgba(0, 245, 255, 0.3);
        }

        .topbar-logo {
            font-family: var(--font-display);
            font-size: 0.95rem;
            font-weight: 700;
            background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            text-decoration: none;
            letter-spacing: 2px;
            text-transform: uppercase;
        }

        .topbar-divider {
            color: var(--text-muted);
        }

        /* Desktop page navigation links in topbar */
        .topbar-nav {
            display: flex;
            align-items: center;
            gap: 0.25rem;
        }

        .topbar-nav-link {
            font-family: var(--font-display);
            font-size: 0.65rem;
            font-weight: 600;
            color: var(--text-muted);
            text-decoration: none;
            padding: 0.3rem 0.6rem;
            border-radius: 4px;
            letter-spacing: 1px;
            text-transform: uppercase;
            transition: color 0.2s, background 0.2s;
        }

        .topbar-nav-link:hover {
            color: var(--neon-cyan);
            background: rgba(0, 245, 255, 0.08);
            text-shadow: 0 0 8px rgba(0, 245, 255, 0.3);
        }

        /* Hide topbar-nav on mobile — links are in the hamburger menu */
        @media (max-width: 768px) {
            .topbar-nav { display: none; }
        }

        .topbar-room {
            font-family: var(--font-mono);
            color: var(--neon-green);
            font-size: 0.85rem;
        }

        .topbar-online {
            font-family: var(--font-mono);
            color: var(--text-muted);
            font-size: 0.8rem;
        }

        .topbar-user {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            cursor: pointer;
            padding: 0.35rem 0.8rem;
            border-radius: 4px;
            transition: all 0.2s;
            font-size: 0.8rem;
        }

        .topbar-user:hover {
            background: rgba(0, 245, 255, 0.08);
        }

        .topbar-avatar {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            background: var(--neon-purple);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.65rem;
            font-weight: 700;
            color: #fff;
        }

        /* ============================================
           TOPBAR MOBILE MENU (KEBAB)
           ============================================ */
        .topbar-mobile-menu {
            display: none;
            position: relative;
            font-size: 1.4rem;
            font-weight: 700;
        }

        .topbar-menu-badge {
            position: absolute;
            top: -4px;
            right: -6px;
            background: #ff1744;
            color: white;
            border-radius: 50%;
            width: 16px;
            height: 16px;
            font-size: 0.6rem;
            font-weight: 700;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .topbar-menu-dropdown {
            position: absolute;
            top: 50px;
            right: 0;
            background: var(--bg-secondary);
            border: 1px solid var(--border-glow);
            border-radius: 8px;
            min-width: 220px;
            z-index: 1000;
            display: none;
            flex-direction: column;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
            padding: 0.3rem 0;
        }

        .topbar-menu-dropdown.active {
            display: flex;
        }

        .topbar-menu-item {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            padding: 0.7rem 1rem;
            display: flex;
            align-items: center;
            gap: 0.6rem;
            font-size: 0.85rem;
            font-family: var(--font-body);
            transition: all 0.2s;
            text-align: left;
            width: 100%;
            position: relative;
        }

        .topbar-menu-item:hover {
            background: rgba(0, 245, 255, 0.08);
            color: var(--neon-cyan);
        }

        .topbar-menu-icon {
            display: flex;
            align-items: center;
            font-size: 1rem;
        }

        .topbar-menu-indicator {
            margin-left: auto;
            font-size: 0.7rem;
        }

        .topbar-menu-divider {
            height: 1px;
            background: var(--border-glow);
            margin: 0.4rem 0;
        }

        .topbar-menu-logout:hover {
            color: #ff1744;
        }

        .topbar-menu-radio-slot {
            padding: 0.5rem 0.8rem;
        }

        .topbar-menu-radio-slot:empty {
            display: none;
        }

        .topbar-menu-radio-slot:empty + .topbar-menu-divider {
            display: none !important;
        }

        .main-layout {
            display: flex;
            flex: 1;
            gap: 0;
            overflow: hidden;
        }

        /* ============================================
           ROOMS SIDEBAR
           ============================================ */
        .rooms-sidebar {
            width: 180px;
            background: var(--bg-primary);
            border-right: 1px solid var(--border-glow);
            overflow-y: auto;
            flex-shrink: 0;
            padding: 1rem 0;
        }

        .rooms-sidebar.hidden {
            display: none;
        }

        .rooms-category {
            padding: 0.8rem 1rem;
            font-family: var(--font-mono);
            font-size: 0.65rem;
            text-transform: uppercase;
            color: var(--text-muted);
            letter-spacing: 1px;
            font-weight: 700;
            margin-top: 0.5rem;
        }

        .rooms-category:first-child {
            margin-top: 0;
        }

        .room-item {
            position: relative;
            padding: 0.6rem 1rem;
            cursor: pointer;
            color: var(--text-secondary);
            font-size: 0.85rem;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 0.4rem;
            border-left: 2px solid transparent;
        }

        .room-item::before {
            content: '#';
            color: var(--neon-green);
            font-family: var(--font-mono);
            font-weight: 700;
        }

        .room-item:hover {
            background: rgba(0, 245, 255, 0.08);
            color: var(--text-primary);
        }

        .room-item.active {
            background: rgba(0, 245, 255, 0.12);
            color: var(--neon-cyan);
            border-left-color: var(--neon-cyan);
        }

        .room-unread-badge {
            position: absolute;
            right: 8px;
            top: 50%;
            transform: translateY(-50%);
            min-width: 18px;
            height: 18px;
            background: #ff3b3b;
            color: #fff;
            font-size: 0.65rem;
            font-weight: 700;
            font-family: var(--font-mono);
            border-radius: 9px;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 0 4px;
            box-shadow: 0 0 8px rgba(255, 59, 59, 0.5);
            animation: unreadPulse 2s ease-in-out infinite;
        }

        @keyframes unreadPulse {
            0%, 100% { box-shadow: 0 0 6px rgba(255, 59, 59, 0.4); }
            50% { box-shadow: 0 0 12px rgba(255, 59, 59, 0.7); }
        }

        .room-item.has-unread {
            color: var(--text-primary);
            font-weight: 600;
        }

        /* ============================================
           ANONYMOUS VENT ROOMS
           ============================================ */
        .room-item.vent-room {
            color: var(--neon-purple);
            font-style: italic;
        }
        .room-item.vent-room::before {
            content: none;
        }
        .rooms-category-tag.anon {
            font-size: 0.5rem;
            background: rgba(184, 41, 227, 0.2);
            color: var(--neon-purple);
            padding: 0.05rem 0.35rem;
            border-radius: 6px;
            letter-spacing: 0.5px;
            font-weight: 600;
            margin-left: 0.3rem;
            vertical-align: middle;
        }

        .room-item.vent-room:hover {
            background: rgba(184, 41, 227, 0.1);
            color: var(--neon-purple);
        }

        .room-item.vent-room.active {
            background: rgba(184, 41, 227, 0.15);
            color: var(--neon-purple);
            border-left-color: var(--neon-purple);
        }

        .anon-room-tag {
            font-family: var(--font-mono);
            font-size: 0.55rem;
            background: rgba(184, 41, 227, 0.2);
            color: var(--neon-purple);
            padding: 0.1rem 0.4rem;
            border-radius: 8px;
            margin-left: 0.4rem;
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .anon-msg .msg-text,
        .anon-text {
            color: #c084fc !important;
        }

        .anon-msg .msg-body {
            border-left: 2px solid rgba(184, 41, 227, 0.3);
            padding-left: 0.6rem;
        }

        .anon-author {
            font-style: italic;
        }

        /* ============================================
           GROUP CHATS
           ============================================ */
        .group-item {
            padding: 0.6rem 1rem;
            cursor: pointer;
            color: var(--text-secondary);
            font-size: 0.85rem;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 0.4rem;
            border-left: 2px solid transparent;
        }

        .group-item::before {
            content: '🔒';
            font-size: 0.9rem;
        }

        .group-item:hover {
            background: rgba(0, 245, 255, 0.08);
            color: var(--text-primary);
        }

        .group-item.active {
            background: rgba(0, 245, 255, 0.12);
            color: var(--neon-cyan);
            border-left-color: var(--neon-cyan);
        }

        .new-group-btn {
            padding: 0.6rem 1rem;
            cursor: pointer;
            color: var(--text-secondary);
            font-size: 0.85rem;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            gap: 0.4rem;
            border-left: 2px solid transparent;
            border-bottom: 1px solid rgba(57, 255, 20, 0.2);
        }

        .new-group-btn::before {
            content: '+';
            font-weight: 700;
            color: var(--neon-green);
        }

        .new-group-btn:hover {
            background: rgba(57, 255, 20, 0.08);
            color: var(--neon-green);
            border-left-color: var(--neon-green);
        }

        /* ============================================
           MODALS
           ============================================ */
        .modal-overlay {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.7);
            z-index: 6000;
            align-items: center;
            justify-content: center;
        }

        .modal-overlay.active {
            display: flex;
        }

        .modal {
            background: var(--bg-secondary);
            border: 1px solid var(--border-glow);
            border-radius: 8px;
            padding: 2rem;
            max-width: 500px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: 0 0 30px rgba(0, 245, 255, 0.1);
        }

        .modal-header {
            margin-bottom: 1.5rem;
        }

        .modal-title {
            font-family: var(--font-display);
            font-size: 1.2rem;
            color: var(--neon-cyan);
            margin-bottom: 0.5rem;
        }

        .modal-label {
            display: block;
            margin-top: 1rem;
            font-size: 0.9rem;
            color: var(--text-secondary);
            margin-bottom: 0.4rem;
            font-weight: 500;
        }

        .modal-input {
            width: 100%;
            padding: 0.6rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-glow);
            border-radius: 4px;
            color: var(--text-primary);
            font-family: var(--font-body);
            font-size: 0.9rem;
            transition: all 0.2s;
        }

        .modal-input:focus {
            outline: none;
            border-color: var(--neon-cyan);
            box-shadow: 0 0 8px rgba(0, 245, 255, 0.2), 0 0 0 2px rgba(0, 245, 255, 0.3);
        }

        .modal-members-list {
            margin-top: 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }

        .modal-member-item {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            padding: 0.6rem;
            background: rgba(0, 245, 255, 0.05);
            border-radius: 4px;
            cursor: pointer;
            transition: all 0.2s;
        }

        .modal-member-item:hover {
            background: rgba(0, 245, 255, 0.1);
        }

        .modal-member-item input[type="checkbox"] {
            cursor: pointer;
            width: 18px;
            height: 18px;
        }

        .modal-member-avatar {
            width: 24px;
            height: 24px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.65rem;
            font-weight: 700;
            color: #fff;
        }

        .modal-member-name {
            flex: 1;
            color: var(--text-primary);
        }

        .modal-buttons {
            display: flex;
            gap: 1rem;
            margin-top: 2rem;
        }

        .modal-btn {
            flex: 1;
            padding: 0.8rem;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-family: var(--font-body);
            font-size: 0.9rem;
            transition: all 0.2s;
            font-weight: 600;
        }

        .modal-btn.primary {
            background: var(--neon-green);
            color: #000;
        }

        .modal-btn.primary:hover {
            background: #39ff14;
            box-shadow: 0 0 12px rgba(57, 255, 20, 0.4);
        }

        .modal-btn.secondary {
            background: transparent;
            border: 1px solid var(--border-glow);
            color: var(--text-secondary);
        }

        .modal-btn.secondary:hover {
            background: rgba(0, 245, 255, 0.1);
            border-color: var(--neon-cyan);
            color: var(--neon-cyan);
        }

        .modal-btn.danger {
            background: rgba(255, 50, 100, 0.2);
            color: #ff3264;
            border: 1px solid #ff3264;
        }

        .modal-btn.danger:hover {
            background: rgba(255, 50, 100, 0.3);
            box-shadow: 0 0 12px rgba(255, 50, 100, 0.3);
        }

        /* ============================================
           GROUP ADMIN PANEL
           ============================================ */
        .group-admin-panel {
            position: fixed;
            top: 50px;
            right: 220px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-glow);
            border-radius: 8px;
            padding: 1.5rem;
            width: 280px;
            max-height: 500px;
            overflow-y: auto;
            z-index: 5000;
            box-shadow: 0 0 20px rgba(0, 245, 255, 0.1);
            display: none;
        }

        .group-admin-panel.active {
            display: block;
        }

        .group-admin-title {
            font-family: var(--font-display);
            font-size: 1rem;
            color: var(--neon-cyan);
            margin-bottom: 1rem;
            padding-bottom: 0.8rem;
            border-bottom: 1px solid var(--border-glow);
        }

        .group-admin-section {
            margin-bottom: 1.5rem;
        }

        .group-admin-section-title {
            font-size: 0.75rem;
            text-transform: uppercase;
            color: var(--text-muted);
            letter-spacing: 1px;
            margin-bottom: 0.6rem;
            font-weight: 700;
        }

        .group-admin-input {
            width: 100%;
            padding: 0.5rem;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-glow);
            border-radius: 4px;
            color: var(--text-primary);
            font-family: var(--font-body);
            font-size: 0.85rem;
            margin-bottom: 0.6rem;
        }

        .group-member-row {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            padding: 0.6rem;
            background: rgba(0, 245, 255, 0.05);
            border-radius: 4px;
            margin-bottom: 0.4rem;
            font-size: 0.8rem;
        }

        .group-member-avatar {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.6rem;
            font-weight: 700;
            color: #fff;
            flex-shrink: 0;
        }

        .group-member-name {
            flex: 1;
            color: var(--text-primary);
        }

        .group-member-remove {
            background: transparent;
            border: none;
            color: #ff3264;
            cursor: pointer;
            font-size: 0.8rem;
            padding: 0.2rem 0.4rem;
            transition: all 0.2s;
        }

        .group-member-remove:hover {
            background: rgba(255, 50, 100, 0.1);
        }

        .group-admin-btn {
            width: 100%;
            padding: 0.6rem;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-family: var(--font-body);
            font-size: 0.8rem;
            transition: all 0.2s;
            margin-bottom: 0.4rem;
        }

        .group-admin-btn.primary {
            background: var(--neon-green);
            color: #000;
            font-weight: 600;
        }

        .group-admin-btn.primary:hover {
            background: #39ff14;
            box-shadow: 0 0 8px rgba(57, 255, 20, 0.3);
        }

        .group-admin-btn.danger {
            background: rgba(255, 50, 100, 0.2);
            color: #ff3264;
            border: 1px solid #ff3264;
            font-weight: 600;
        }

        .group-admin-btn.danger:hover {
            background: rgba(255, 50, 100, 0.3);
            box-shadow: 0 0 8px rgba(255, 50, 100, 0.2);
        }

        /* ============================================
           MESSAGES AREA
           ============================================ */
        .messages-container {
            display: flex;
            flex-direction: column;
            flex: 1;
            overflow: hidden;
        }

        .messages {
            flex: 1;
            overflow-y: auto;
            padding: 0.8rem 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.15rem;
        }

        .msg {
            display: flex;
            gap: 0.5rem;
            animation: fadeInUp 0.2s ease;
            padding: 0.2rem 0;
        }

        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(10px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }

        .msg.own {
            flex-direction: row;
            margin-left: 0;
            margin-right: 0;
        }

        .msg-avatar {
            width: 32px;
            height: 32px;
            min-width: 32px;
            border-radius: 50%;
            object-fit: cover;
            flex-shrink: 0;
            align-self: flex-start;
            margin-top: 2px;
        }

        .msg-avatar-fallback {
            width: 32px;
            height: 32px;
            min-width: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
            font-weight: 700;
            color: #fff;
            flex-shrink: 0;
            align-self: flex-start;
            margin-top: 2px;
        }

        .msg-avatar-emoji {
            width: 32px;
            height: 32px;
            min-width: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            background: rgba(255,255,255,0.06);
            flex-shrink: 0;
            align-self: flex-start;
            margin-top: 2px;
        }

        .msg-avatar-spacer {
            width: 32px;
            min-width: 32px;
            flex-shrink: 0;
        }

        .msg-body {
            display: flex;
            flex-direction: column;
            gap: 0.05rem;
            flex: 1;
        }

        .msg-meta {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            font-size: 0.75rem;
        }


        /* ============================================
           USER POPUP (HOVER)
           ============================================ */
        .user-popup {
            position: fixed;
            z-index: 5000;
            width: 260px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-glow);
            border-radius: 12px;
            padding: 1rem;
            box-shadow: 0 8px 32px rgba(0,0,0,0.6), 0 0 15px rgba(0, 245, 255, 0.1);
            pointer-events: none;
            opacity: 0;
            transform: translateY(5px);
            transition: opacity 0.15s ease, transform 0.15s ease;
        }
        .user-popup.visible {
            opacity: 1;
            transform: translateY(0);
            pointer-events: auto;
        }
        .popup-header {
            display: flex;
            align-items: center;
            gap: 0.7rem;
            margin-bottom: 0.6rem;
        }
        .popup-avatar {
            width: 40px; height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            font-weight: 700;
            color: #fff;
            flex-shrink: 0;
            position: relative;
        }
        .popup-online-dot {
            position: absolute;
            bottom: 0; right: 0;
            width: 10px; height: 10px;
            border-radius: 50%;
            border: 2px solid var(--bg-card);
        }
        .popup-online-dot.online { background: #39ff14; }
        .popup-online-dot.offline { background: #555; }
        .popup-info { flex: 1; }
        .popup-name {
            font-family: var(--font-display);
            font-size: 0.9rem;
            color: var(--text-primary);
            font-weight: 700;
        }
        .popup-role {
            font-family: var(--font-mono);
            font-size: 0.6rem;
            padding: 0.1rem 0.4rem;
            border-radius: 3px;
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        .popup-bio {
            font-size: 0.8rem;
            color: var(--text-secondary);
            font-style: italic;
            margin-bottom: 0.7rem;
            line-height: 1.4;
        }
        .popup-vibe-label {
            color: var(--neon-cyan);
            font-style: normal;
            font-family: var(--font-mono);
            font-size: 0.72rem;
        }
        .popup-stats {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 0.3rem;
            margin-bottom: 0.6rem;
            padding: 0.5rem 0;
            border-top: 1px solid rgba(255,255,255,0.05);
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }
        .popup-stat { text-align: center; }
        .popup-stat-val {
            display: block;
            font-family: var(--font-display);
            font-size: 0.85rem;
            color: var(--neon-cyan);
            font-weight: 700;
        }
        .popup-stat-key {
            font-family: var(--font-mono);
            font-size: 0.55rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
        }
        .popup-footer {
            display: flex;
            justify-content: space-between;
        }
        .popup-detail {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            color: var(--text-muted);
        }
        .hoverable-user {
            cursor: pointer;
            transition: filter 0.15s;
        }
        .hoverable-user:hover {
            filter: brightness(1.3);
            text-decoration: underline;
        }
        .msg-author {
            font-weight: 600;
            color: var(--text-primary);
        }

        .msg-badge {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            padding: 0.2rem 0.5rem;
            border-radius: 3px;
            text-transform: uppercase;
            font-weight: 700;
        }

        .msg-badge.admin {
            background: rgba(0, 245, 255, 0.2);
            color: var(--neon-cyan);
        }

        .msg-badge.mod {
            background: rgba(184, 41, 227, 0.2);
            color: var(--neon-purple);
        }

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

        .msg-admin-actions {
            display: none;
            margin-left: auto;
            gap: 4px;
        }
        .msg:hover .msg-admin-actions {
            display: flex;
        }
        .msg-admin-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 0.75rem;
            padding: 2px 6px;
            border-radius: 4px;
            opacity: 0.6;
            transition: opacity 0.2s, background 0.2s;
        }
        .msg-admin-btn:hover {
            opacity: 1;
            background: rgba(255,255,255,0.1);
        }
        .msg-admin-btn.delete:hover { background: rgba(255,50,50,0.2); }
        .msg-admin-btn.ban:hover { background: rgba(255,150,0,0.2); }

        .msg-text {
            color: var(--text-primary);
            font-size: 0.9rem;
            word-wrap: break-word;
            line-height: 1.4;
        }

        .msg.system {
            justify-content: center;
            margin: 0.5rem 0;
        }

        .msg.system .msg-body {
            text-align: center;
            flex: auto;
        }

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

        .msg.system .msg-text::before {
            content: '>> ';
        }

        /* ============================================
           MESSAGE REACTIONS
           ============================================ */
        .msg-reactions {
            display: flex;
            flex-wrap: wrap;
            gap: 0.2rem;
            position: relative;
        }
        .msg-reactions:empty,
        .msg-reactions:not(:has(.reaction-chip)) {
            margin-top: 0;
            gap: 0;
            min-height: 0;
            height: 0;
            overflow: hidden;
        }
        .msg-reactions:has(.reaction-chip) {
            margin-top: 0.1rem;
        }
        .reaction-chip {
            display: inline-flex;
            align-items: center;
            gap: 0.15rem;
            background: rgba(255,255,255,0.04);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 10px;
            padding: 0.05rem 0.4rem;
            font-size: 0.72rem;
            cursor: pointer;
            transition: all 0.15s;
            user-select: none;
            line-height: 1.4;
            position: relative;
        }
        /* Custom tooltip showing who reacted */
        .reaction-chip[data-tooltip]::after {
            content: attr(data-tooltip);
            position: absolute;
            bottom: calc(100% + 6px);
            left: 50%;
            transform: translateX(-50%) scale(0.95);
            background: rgba(10, 10, 30, 0.95);
            border: 1px solid rgba(0, 245, 255, 0.25);
            color: #e0e0e0;
            padding: 0.35rem 0.6rem;
            border-radius: 8px;
            font-size: 0.73rem;
            font-family: var(--font-body);
            white-space: nowrap;
            max-width: 240px;
            overflow: hidden;
            text-overflow: ellipsis;
            pointer-events: none;
            opacity: 0;
            transition: opacity 0.15s, transform 0.15s;
            z-index: 100;
            box-shadow: 0 4px 16px rgba(0,0,0,0.5), 0 0 8px rgba(0, 245, 255, 0.08);
        }
        .reaction-chip[data-tooltip]:hover::after {
            opacity: 1;
            transform: translateX(-50%) scale(1);
        }
        .reaction-chip:hover {
            background: rgba(0,245,255,0.1);
            border-color: rgba(0,245,255,0.25);
        }
        .reaction-chip.active {
            background: rgba(0,245,255,0.12);
            border-color: rgba(0,245,255,0.35);
        }
        .reaction-chip .reaction-count {
            font-size: 0.7rem;
            color: var(--text-muted);
            font-family: var(--font-mono);
        }
        .reaction-chip.active .reaction-count {
            color: var(--neon-cyan);
        }
        .add-reaction-btn {
            display: none;
            align-items: center;
            justify-content: center;
            background: rgba(255,255,255,0.03);
            border: 1px dashed rgba(255,255,255,0.1);
            border-radius: 12px;
            padding: 0.15rem 0.45rem;
            font-size: 0.75rem;
            cursor: pointer;
            transition: all 0.15s;
            color: var(--text-muted);
        }
        .msg:hover .add-reaction-btn {
            display: inline-flex;
        }
        .add-reaction-btn:hover {
            background: rgba(0,245,255,0.08);
            border-color: rgba(0,245,255,0.25);
            color: var(--neon-cyan);
        }
        /* Inline react button at end of message text */
        .inline-react-btn {
            display: none;
            font-size: 0.7rem;
            cursor: pointer;
            margin-left: 0.3rem;
            opacity: 0.5;
            transition: opacity 0.15s;
            vertical-align: middle;
            user-select: none;
        }
        .msg:hover .inline-react-btn {
            display: inline;
        }
        .inline-react-btn:hover {
            opacity: 1;
        }

        /* Global reaction picker (positioned at cursor via JS) */
        .reaction-picker-global {
            display: none;
            position: fixed;
            background: var(--bg-card);
            border: 1px solid var(--border-glow);
            border-radius: 10px;
            padding: 0.5rem;
            z-index: 6000;
            box-shadow: 0 4px 20px rgba(0,0,0,0.5);
            flex-wrap: wrap;
            gap: 0.2rem;
            max-width: 220px;
        }
        .reaction-picker-global.active {
            display: flex;
        }
        .reaction-picker-global button {
            background: none;
            border: none;
            font-size: 1.1rem;
            cursor: pointer;
            padding: 0.25rem;
            border-radius: 6px;
            transition: background 0.15s;
        }
        .reaction-picker-global button:hover {
            background: rgba(0,245,255,0.15);
        }

        @keyframes slideInRight {
            from { opacity: 0; transform: translateX(30px); }
            to { opacity: 1; transform: translateX(0); }
        }

        /* ============================================
           MESSAGE GROUPING
           ============================================ */
        .msg.grouped {
            padding-top: 0;
            margin-top: -0.1rem;
        }
        .msg.grouped .msg-meta {
            display: none;
        }
        .msg-time-inline {
            display: none;
            font-family: var(--font-mono);
            font-size: 0.6rem;
            color: var(--text-muted);
            margin-right: 0.4rem;
            opacity: 0;
            transition: opacity 0.15s;
        }
        .msg.grouped:hover .msg-time-inline {
            display: inline;
            opacity: 1;
        }

        /* ============================================
           SCROLL-TOP FADE GRADIENT
           ============================================ */
        .messages {
            position: relative;
        }
        .messages::before {
            content: '';
            position: sticky;
            top: 0;
            display: block;
            height: 30px;
            margin-bottom: -30px;
            background: linear-gradient(to bottom, var(--bg-primary), transparent);
            z-index: 10;
            pointer-events: none;
        }

        /* (Own-message bubble distinction removed — green name is enough) */

        /* ============================================
           NAME COLOR PICKER
           ============================================ */
        .color-dot {
            display: inline-block;
            width: 14px;
            height: 14px;
            border-radius: 50%;
            border: 2px solid rgba(255,255,255,0.2);
            vertical-align: middle;
        }
        .color-picker-popup {
            position: absolute;
            bottom: 50px;
            left: 40px;
            background: var(--bg-secondary);
            border: 1px solid var(--border-glow);
            border-radius: 8px;
            padding: 0.6rem;
            display: none;
            z-index: 900;
            width: 220px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.5);
        }
        .color-picker-popup.active {
            display: block;
        }
        .color-picker-label {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            margin-bottom: 0.4rem;
        }
        .color-picker-grid {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 4px;
        }
        .color-swatch {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            border: 2px solid transparent;
            cursor: pointer;
            transition: transform 0.15s, border-color 0.15s;
        }
        .color-swatch:hover {
            transform: scale(1.15);
            border-color: rgba(255,255,255,0.4);
        }
        .color-swatch.active {
            border-color: #fff;
            box-shadow: 0 0 8px rgba(255,255,255,0.3);
        }
        .color-picker-custom {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            margin-top: 0.5rem;
            padding-top: 0.5rem;
            border-top: 1px solid var(--border-glow);
        }
        .color-picker-custom input[type="color"] {
            width: 28px;
            height: 28px;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            background: none;
            padding: 0;
        }
        .color-picker-custom input[type="color"]::-webkit-color-swatch-wrapper {
            padding: 0;
        }
        .color-picker-custom input[type="color"]::-webkit-color-swatch {
            border: 2px solid rgba(255,255,255,0.2);
            border-radius: 50%;
        }
        .color-picker-custom-label {
            font-family: var(--font-mono);
            font-size: 0.7rem;
            color: var(--text-secondary);
        }

        /* ============================================
           SKELETON LOADING
           ============================================ */
        .skeleton-loading {
            padding: 1rem;
            display: flex;
            flex-direction: column;
            gap: 1rem;
        }
        .skeleton-msg {
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
        }
        .skeleton-meta {
            display: flex;
            gap: 0.5rem;
        }
        .skeleton-bar {
            height: 12px;
            background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
            background-size: 200% 100%;
            animation: skeletonShimmer 1.5s ease-in-out infinite;
            border-radius: 4px;
        }
        @keyframes skeletonShimmer {
            0% { background-position: 200% 0; }
            100% { background-position: -200% 0; }
        }

        /* ============================================
           CATEGORIZED EMOJI PICKER
           ============================================ */
        .emoji-grid.active {
            display: flex;
            flex-direction: column;
            max-height: 320px;
            width: 320px;
        }
        .emoji-tabs {
            display: flex;
            gap: 2px;
            padding: 0.3rem;
            border-bottom: 1px solid var(--border-glow);
            flex-shrink: 0;
            overflow-x: auto;
        }
        .emoji-tab {
            background: none;
            border: none;
            font-size: 1rem;
            cursor: pointer;
            padding: 0.3rem 0.4rem;
            border-radius: 4px;
            transition: background 0.15s;
            flex-shrink: 0;
        }
        .emoji-tab:hover {
            background: rgba(0,245,255,0.1);
        }
        .emoji-tab.active {
            background: rgba(0,245,255,0.15);
            box-shadow: 0 0 6px rgba(0,245,255,0.2);
        }
        .emoji-category-label {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            color: var(--text-muted);
            text-transform: uppercase;
            letter-spacing: 1px;
            padding: 0.3rem 0.5rem 0.1rem;
            flex-shrink: 0;
        }
        .emoji-btn-grid {
            display: grid;
            grid-template-columns: repeat(8, 1fr);
            gap: 2px;
            padding: 0.3rem;
            overflow-y: auto;
            flex: 1;
        }

        /* ============================================
           HOVER TIMESTAMP TOOLTIP
           ============================================ */
        .msg-time {
            cursor: default;
        }
        .msg-time[title]:hover {
            color: var(--text-secondary);
        }

        /* Scroll-to-bottom button */
        .scroll-bottom-btn {
            position: absolute;
            bottom: 80px;
            right: 1.5rem;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            background: var(--bg-card);
            border: 1px solid var(--border-glow);
            color: var(--neon-cyan);
            cursor: pointer;
            display: none;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            z-index: 50;
            transition: all 0.2s;
            box-shadow: 0 2px 12px rgba(0,0,0,0.4);
        }
        .scroll-bottom-btn:hover {
            background: rgba(0,245,255,0.12);
            box-shadow: var(--shadow-neon);
        }
        .scroll-bottom-btn.visible {
            display: flex;
        }

        /* Character counter */
        .char-counter {
            position: absolute;
            right: 1rem;
            top: -18px;
            font-family: var(--font-mono);
            font-size: 0.6rem;
            color: var(--text-muted);
            display: none;
        }
        .char-counter.visible { display: block; }
        .char-counter.warning { color: var(--neon-yellow); }
        .char-counter.danger { color: #ff3b3b; }

        /* ============================================
           MESSAGE SEARCH
           ============================================ */
        .search-overlay {
            display: none;
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(10,10,15,0.97);
            z-index: 200;
            flex-direction: column;
            padding: 1rem;
            overflow: hidden;
        }
        .search-overlay.active { display: flex; }
        .search-bar-row {
            display: flex;
            gap: 0.5rem;
            margin-bottom: 0.8rem;
            align-items: center;
        }
        .search-input {
            flex: 1;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-glow);
            border-radius: 6px;
            padding: 0.6rem 0.8rem;
            color: var(--text-primary);
            font-family: var(--font-mono);
            font-size: 0.85rem;
            outline: none;
            transition: border-color 0.2s;
        }
        .search-input:focus { border-color: var(--neon-cyan); box-shadow: 0 0 10px rgba(0,245,255,0.15), 0 0 0 2px rgba(0, 245, 255, 0.3); }
        .search-close-btn {
            background: none;
            border: 1px solid var(--border-glow);
            color: var(--text-secondary);
            cursor: pointer;
            width: 36px;
            height: 36px;
            border-radius: 6px;
            font-size: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            flex-shrink: 0;
        }
        .search-close-btn:hover { color: var(--neon-cyan); border-color: var(--neon-cyan); }
        .search-results {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 0.3rem;
        }
        .search-result-item {
            padding: 0.6rem 0.8rem;
            background: rgba(255,255,255,0.03);
            border-radius: 6px;
            cursor: pointer;
            transition: background 0.15s;
            border-left: 2px solid transparent;
        }
        .search-result-item:hover {
            background: rgba(0,245,255,0.08);
            border-left-color: var(--neon-cyan);
        }
        .search-result-meta {
            display: flex;
            gap: 0.5rem;
            align-items: center;
            font-size: 0.7rem;
            margin-bottom: 0.2rem;
        }
        .search-result-author { font-weight: 600; }
        .search-result-room {
            font-family: var(--font-mono);
            color: var(--neon-green);
            font-size: 0.65rem;
        }
        .search-result-time {
            font-family: var(--font-mono);
            color: var(--text-muted);
            font-size: 0.65rem;
        }
        .search-result-text {
            font-size: 0.82rem;
            color: var(--text-secondary);
            line-height: 1.4;
        }
        .search-result-text mark {
            background: rgba(0,245,255,0.25);
            color: var(--neon-cyan);
            border-radius: 2px;
            padding: 0 2px;
        }
        .search-count {
            font-family: var(--font-mono);
            font-size: 0.7rem;
            color: var(--text-muted);
            margin-bottom: 0.5rem;
        }
        .search-empty {
            text-align: center;
            padding: 2rem;
            color: var(--text-muted);
            font-size: 0.85rem;
        }

        /* ============================================
           MESSAGE EDIT/DELETE CONTEXT MENU
           ============================================ */
        .msg-context-menu {
            position: fixed;
            background: var(--bg-card);
            border: 1px solid var(--border-glow);
            border-radius: 8px;
            padding: 0.3rem;
            z-index: 5000;
            box-shadow: 0 4px 20px rgba(0,0,0,0.6);
            display: none;
            min-width: 140px;
        }
        .msg-context-menu.active { display: block; }
        .msg-context-item {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.5rem 0.7rem;
            font-size: 0.8rem;
            color: var(--text-primary);
            cursor: pointer;
            border-radius: 5px;
            transition: background 0.15s;
        }
        .msg-context-item:hover { background: rgba(0,245,255,0.1); }
        .msg-context-item.danger { color: #ff3b3b; }
        .msg-context-item.danger:hover { background: rgba(255,59,59,0.1); }
        .msg-context-icon { font-size: 0.9rem; width: 20px; text-align: center; }

        /* Edit mode for messages */
        .msg-edit-input {
            background: var(--bg-tertiary);
            border: 1px solid var(--neon-cyan);
            border-radius: 4px;
            color: var(--text-primary);
            font-family: var(--font-body);
            font-size: 0.9rem;
            padding: 0.4rem 0.6rem;
            width: 100%;
            outline: none;
            resize: none;
            max-height: 100px;
        }
        .msg-edit-input:focus {
            box-shadow: 0 0 0 2px rgba(0, 245, 255, 0.3);
        }
        .msg-edit-actions {
            display: flex;
            gap: 0.4rem;
            margin-top: 0.3rem;
            font-size: 0.7rem;
        }
        .msg-edit-actions button {
            background: none;
            border: none;
            cursor: pointer;
            font-family: var(--font-mono);
            font-size: 0.7rem;
            padding: 0.2rem 0.5rem;
            border-radius: 3px;
            transition: all 0.15s;
        }
        .msg-edit-save { color: var(--neon-green); }
        .msg-edit-save:hover { background: rgba(57,255,20,0.15); }
        .msg-edit-cancel { color: var(--text-muted); }
        .msg-edit-cancel:hover { background: rgba(255,255,255,0.08); }
        .msg-edited-tag {
            font-family: var(--font-mono);
            font-size: 0.6rem;
            color: var(--text-muted);
            font-style: italic;
        }

        /* ============================================
           REPLY SYSTEM
           ============================================ */
        /* Reply preview bar above input */
        .reply-preview-bar {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            padding: 0.45rem 0.7rem;
            background: rgba(0, 245, 255, 0.05);
            border-left: 3px solid var(--neon-cyan);
            border-radius: 6px 6px 0 0;
            margin-bottom: -2px;
            animation: replySlideIn 0.15s ease-out;
        }
        @keyframes replySlideIn {
            from { opacity: 0; transform: translateY(6px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .reply-preview-accent {
            width: 3px;
            border-radius: 2px;
            align-self: stretch;
            flex-shrink: 0;
            display: none;
        }
        .reply-preview-content {
            flex: 1;
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 0.1rem;
        }
        .reply-preview-author {
            font-family: var(--font-mono);
            font-size: 0.7rem;
            font-weight: 600;
        }
        .reply-preview-text {
            font-size: 0.75rem;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .reply-preview-close {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 1.1rem;
            cursor: pointer;
            padding: 0 0.3rem;
            line-height: 1;
            transition: color 0.15s;
            flex-shrink: 0;
        }
        .reply-preview-close:hover { color: #ff3b3b; }

        /* Reply bubble inside a message */
        .msg-reply-bubble {
            display: flex;
            align-items: stretch;
            gap: 0.4rem;
            padding: 0.35rem 0.6rem;
            margin-bottom: 0.3rem;
            background: rgba(255, 255, 255, 0.04);
            border-radius: 6px;
            cursor: pointer;
            transition: background 0.15s;
            max-width: 100%;
            overflow: hidden;
        }
        .msg-reply-bubble:hover { background: rgba(255, 255, 255, 0.08); }
        .msg-reply-accent {
            width: 3px;
            border-radius: 2px;
            flex-shrink: 0;
        }
        .msg-reply-content {
            min-width: 0;
            display: flex;
            flex-direction: column;
            gap: 0.05rem;
        }
        .msg-reply-author {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            font-weight: 600;
        }
        .msg-reply-text {
            font-size: 0.72rem;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 300px;
        }

        /* Highlight flash when scrolling to a replied message */
        .msg-highlight {
            animation: msgHighlightPulse 1.5s ease-out;
        }
        @keyframes msgHighlightPulse {
            0% { background: rgba(0, 245, 255, 0.2); }
            100% { background: transparent; }
        }

        /* ============================================
           NOTIFICATION SOUND TOGGLE
           ============================================ */
        .sound-toggle {
            position: relative;
        }
        .sound-toggle .sound-indicator {
            font-size: 0.6rem;
            position: absolute;
            bottom: -2px;
            right: -2px;
        }

        /* ============================================
           LINK PREVIEW
           ============================================ */
        .link-preview {
            display: flex;
            gap: 0.6rem;
            background: var(--bg-tertiary);
            border: 1px solid rgba(255,255,255,0.08);
            border-left: 3px solid var(--neon-cyan);
            border-radius: 0 6px 6px 0;
            padding: 0.5rem 0.7rem;
            margin-top: 0.4rem;
            max-width: 400px;
            cursor: pointer;
            transition: all 0.2s;
            text-decoration: none;
            color: inherit;
        }
        .link-preview:hover {
            border-left-color: var(--neon-purple);
            background: rgba(0,245,255,0.05);
        }
        .link-preview-info { flex: 1; min-width: 0; }
        .link-preview-domain {
            font-family: var(--font-mono);
            font-size: 0.6rem;
            color: var(--neon-cyan);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 0.15rem;
        }
        .link-preview-title {
            font-size: 0.8rem;
            color: var(--text-primary);
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .link-preview-url {
            font-size: 0.65rem;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        /* Suggestion Box styles now in suggestions.css (shared across all pages) */

        /* ADMIN — SUGGESTIONS TAB */
        .admin-suggestion-card {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.06);
            border-radius: 8px;
            padding: 0.8rem;
            margin-bottom: 0.6rem;
            transition: border-color 0.2s;
        }
        .admin-suggestion-card:hover { border-color: var(--border-glow); }
        .admin-suggestion-header {
            display: flex;
            justify-content: space-between;
            align-items: flex-start;
            margin-bottom: 0.4rem;
            gap: 0.5rem;
        }
        .admin-suggestion-user {
            font-weight: 600;
            font-size: 0.82rem;
            color: var(--text-primary);
        }
        .admin-suggestion-time {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            color: var(--text-muted);
            flex-shrink: 0;
        }
        .admin-suggestion-category {
            display: inline-block;
            font-family: var(--font-mono);
            font-size: 0.6rem;
            padding: 0.15rem 0.5rem;
            border-radius: 10px;
            background: rgba(0,245,255,0.1);
            color: var(--neon-cyan);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 0.4rem;
        }
        .admin-suggestion-text {
            font-size: 0.82rem;
            color: var(--text-secondary);
            line-height: 1.5;
            margin-bottom: 0.5rem;
        }
        .admin-suggestion-actions {
            display: flex;
            gap: 0.3rem;
        }
        .admin-suggestion-btn {
            background: none;
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 5px;
            padding: 0.3rem 0.6rem;
            font-size: 0.7rem;
            cursor: pointer;
            transition: all 0.15s;
            font-family: var(--font-body);
        }
        .admin-suggestion-btn.mark-done {
            color: var(--neon-green);
            border-color: rgba(57,255,20,0.2);
        }
        .admin-suggestion-btn.mark-done:hover { background: rgba(57,255,20,0.1); }
        .admin-suggestion-btn.archive {
            color: var(--text-muted);
        }
        .admin-suggestion-btn.archive:hover { background: rgba(255,255,255,0.06); }
        .admin-suggestion-btn.delete-sug {
            color: #ff3b3b;
            border-color: rgba(255,59,59,0.2);
        }
        .admin-suggestion-btn.delete-sug:hover { background: rgba(255,59,59,0.1); }

        .admin-suggestion-status {
            display: inline-block;
            font-family: var(--font-mono);
            font-size: 0.55rem;
            padding: 0.1rem 0.4rem;
            border-radius: 3px;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-left: 0.3rem;
        }
        .admin-suggestion-status.new { background: rgba(0,245,255,0.15); color: var(--neon-cyan); }
        .admin-suggestion-status.done { background: rgba(57,255,20,0.15); color: var(--neon-green); }
        .admin-suggestion-status.archived { background: rgba(255,255,255,0.06); color: var(--text-muted); }

        .admin-suggestion-filters {
            display: flex;
            gap: 0.4rem;
            margin-bottom: 0.8rem;
            flex-wrap: wrap;
        }
        .admin-suggestion-filter {
            padding: 0.3rem 0.6rem;
            border-radius: 12px;
            border: 1px solid rgba(255,255,255,0.08);
            background: none;
            color: var(--text-secondary);
            font-size: 0.7rem;
            cursor: pointer;
            transition: all 0.15s;
            font-family: var(--font-mono);
        }
        .admin-suggestion-filter:hover { border-color: var(--neon-cyan); }
        .admin-suggestion-filter.active {
            background: rgba(0,245,255,0.1);
            border-color: var(--neon-cyan);
            color: var(--neon-cyan);
        }
        .admin-suggestion-count {
            font-family: var(--font-mono);
            font-size: 0.7rem;
            color: var(--text-muted);
            margin-bottom: 0.6rem;
        }

        /* Inline suggest button in chat input - hidden on desktop, shown on mobile */
        .suggest-inline-btn {
            display: none;
        }

        @media (max-width: 768px) {
            .suggest-inline-btn {
                display: flex;
                background: rgba(184,41,227,0.1);
                border-color: var(--neon-purple);
                color: var(--neon-purple);
            }
            .suggest-inline-btn:hover {
                background: rgba(184,41,227,0.2);
            }
        }

        /* ============================================
           INPUT BAR
           ============================================ */
        .input-bar {
            display: flex;
            flex-direction: column;
            gap: 0;
            padding: 0;
            background: var(--bg-secondary);
            border-top: 1px solid var(--border-glow);
            flex-shrink: 0;
            position: relative;
        }

        .input-controls {
            display: flex;
            gap: 0.6rem;
            padding: 1rem 1.5rem;
            align-items: flex-end;
        }

        .input-btn {
            background: none;
            border: 1px solid var(--border-glow);
            color: var(--text-secondary);
            cursor: pointer;
            width: 36px;
            height: 36px;
            border-radius: 4px;
            font-size: 1rem;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }

        .input-btn:hover {
            background: rgba(0, 245, 255, 0.08);
            color: var(--neon-cyan);
            border-color: var(--neon-cyan);
        }

        .input-btn.send-btn {
            background: rgba(57, 255, 20, 0.08);
            border-color: var(--neon-green);
            color: var(--neon-green);
        }

        .input-btn.send-btn:hover {
            background: rgba(57, 255, 20, 0.15);
        }

        .msg-input {
            flex: 1;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-glow);
            color: var(--text-primary);
            font-family: var(--font-mono);
            font-size: 0.85rem;
            padding: 0.6rem 0.8rem;
            border-radius: 4px;
            resize: none;
            max-height: 100px;
            transition: all 0.2s;
        }

        .msg-input::placeholder {
            color: var(--text-muted);
        }

        .msg-input:focus {
            outline: none;
            border-color: var(--neon-cyan);
            background: var(--bg-tertiary);
            box-shadow: 0 0 10px rgba(0, 245, 255, 0.2);
        }

        /* ============================================
           UPLOAD PREVIEW (BEFORE SENDING)
           ============================================ */
        .upload-preview {
            display: flex;
            gap: 0.5rem;
            padding: 0.6rem 0.8rem 0;
            flex-wrap: wrap;
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }
        .upload-thumb {
            position: relative;
            border-radius: 8px;
            overflow: hidden;
            border: 1px solid rgba(255,255,255,0.1);
            background: var(--bg-tertiary);
        }
        .upload-thumb img {
            width: 80px;
            height: 80px;
            object-fit: cover;
            display: block;
        }
        .upload-thumb-file {
            width: 80px;
            height: 80px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 0.2rem;
            padding: 0.3rem;
        }
        .upload-thumb-file .file-icon { font-size: 1.5rem; }
        .upload-thumb-file .file-name {
            font-family: var(--font-mono);
            font-size: 0.5rem;
            color: var(--text-muted);
            text-align: center;
            word-break: break-all;
            max-height: 2rem;
            overflow: hidden;
        }
        .upload-thumb-remove {
            position: absolute;
            top: 2px; right: 2px;
            width: 18px; height: 18px;
            background: rgba(0,0,0,0.7);
            border: none;
            color: #fff;
            border-radius: 50%;
            font-size: 0.6rem;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            line-height: 1;
        }

        /* ============================================
           ATTACHED FILES IN MESSAGES (AFTER SENDING)
           ============================================ */
        .msg-attachments {
            display: flex;
            flex-wrap: wrap;
            gap: 0.4rem;
            margin-top: 0.4rem;
        }
        .msg-img {
            max-width: 300px;
            max-height: 250px;
            border-radius: 8px;
            border: 1px solid rgba(255,255,255,0.08);
            cursor: pointer;
            transition: all 0.2s;
            object-fit: contain;
            background: var(--bg-tertiary);
        }
        .msg-img:hover {
            border-color: var(--neon-cyan);
            box-shadow: 0 0 10px rgba(0,245,255,0.15);
        }
        .msg-file {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            background: var(--bg-tertiary);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 8px;
            padding: 0.5rem 0.8rem;
            cursor: pointer;
            transition: all 0.2s;
            text-decoration: none;
            color: var(--text-primary);
        }
        .msg-file:hover {
            border-color: var(--neon-cyan);
            background: rgba(0,245,255,0.05);
        }
        .msg-file-icon { font-size: 1.3rem; }
        .msg-file-info { display: flex; flex-direction: column; }
        .msg-file-name {
            font-size: 0.8rem;
            color: var(--text-primary);
            font-weight: 500;
        }
        .msg-file-size {
            font-family: var(--font-mono);
            font-size: 0.6rem;
            color: var(--text-muted);
        }

        /* ============================================
           IMAGE LIGHTBOX
           ============================================ */
        .lightbox {
            display: none;
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background: rgba(0,0,0,0.9);
            z-index: 8000;
            align-items: center;
            justify-content: center;
            cursor: pointer;
        }
        .lightbox.active { display: flex; }
        .lightbox img {
            max-width: 90%;
            max-height: 90%;
            border-radius: 8px;
            box-shadow: 0 0 30px rgba(0,245,255,0.2);
        }

        /* ============================================
           ONLINE USERS SIDEBAR
           ============================================ */
        .users-sidebar {
            width: 220px;
            background: var(--bg-primary);
            border-left: 1px solid var(--border-glow);
            overflow-y: auto;
            flex-shrink: 0;
            padding: 1rem 0;
        }

        .users-sidebar.hidden {
            display: none;
        }

        .users-header {
            padding: 0.8rem 1rem;
            border-bottom: 1px solid var(--border-glow);
            font-family: var(--font-mono);
            font-size: 0.75rem;
            text-transform: uppercase;
            color: var(--text-muted);
            letter-spacing: 1px;
            margin-bottom: 0.5rem;
        }

        .users-title {
            color: var(--text-secondary);
        }

        .users-list {
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
            padding: 0 0.5rem;
        }

        .user-item {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            padding: 0.5rem 0.8rem;
            cursor: pointer;
            border-radius: 4px;
            transition: all 0.2s;
            color: var(--text-secondary);
            font-size: 0.8rem;
        }

        .user-item:hover {
            background: rgba(0, 245, 255, 0.08);
            color: var(--text-primary);
        }

        .user-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            background: var(--text-muted);
        }

        .user-dot.online {
            background: var(--neon-green);
            box-shadow: 0 0 4px var(--neon-green);
        }

        .user-dot.offline {
            background: #555;
        }

        .user-item.offline {
            opacity: 0.7;
        }

        .friends-section-header {
            padding: 0.8rem 1rem;
            font-family: var(--font-mono);
            font-size: 0.65rem;
            text-transform: uppercase;
            letter-spacing: 1px;
            color: var(--text-muted);
            margin-top: 0.5rem;
        }

        .friends-section-header:first-child {
            margin-top: 0;
        }

        .user-avatar-sm {
            width: 20px;
            height: 20px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.6rem;
            font-weight: 700;
            color: #fff;
            flex-shrink: 0;
        }

        .user-info-sm {
            display: flex;
            flex-direction: column;
            gap: 0.1rem;
            flex: 1;
            min-width: 0;
        }

        .user-name-sm {
            font-weight: 500;
            color: var(--text-primary);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .user-role-sm {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            color: var(--text-muted);
            text-transform: capitalize;
        }

        /* ============================================
           AMBIENT PRESENCE — USER VIBES
           ============================================ */
        .user-vibe-sm {
            font-family: var(--font-mono);
            font-size: 0.6rem;
            color: var(--neon-cyan);
            opacity: 0.8;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 130px;
        }

        /* ============================================
           LOUNGE HEADER (above user list)
           ============================================ */
        .lounge-header {
            padding: 0.8rem 1rem;
            border-bottom: 1px solid var(--border-glow);
            background: linear-gradient(180deg, rgba(0, 245, 255, 0.03) 0%, transparent 100%);
        }

        .lounge-vibe-count {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-family: var(--font-body);
            font-size: 0.85rem;
            font-weight: 600;
            color: var(--text-primary);
            margin-bottom: 0.4rem;
        }

        .lounge-pulse {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background: var(--neon-green);
            box-shadow: 0 0 6px var(--neon-green);
            animation: loungePulse 2s ease-in-out infinite;
        }

        @keyframes loungePulse {
            0%, 100% { opacity: 1; box-shadow: 0 0 6px var(--neon-green); }
            50% { opacity: 0.5; box-shadow: 0 0 12px var(--neon-green); }
        }

        .lounge-vibes-summary {
            display: flex;
            flex-wrap: wrap;
            gap: 0.3rem;
        }

        .lounge-vibe-tag {
            display: inline-flex;
            align-items: center;
            gap: 0.2rem;
            font-family: var(--font-mono);
            font-size: 0.58rem;
            background: rgba(0, 245, 255, 0.06);
            border: 1px solid rgba(0, 245, 255, 0.12);
            color: var(--text-secondary);
            padding: 0.15rem 0.5rem;
            border-radius: 10px;
            white-space: nowrap;
        }

        .lounge-vibe-count-num {
            color: var(--neon-cyan);
            font-weight: 600;
        }

        /* ============================================
           VIBE PICKER (in profile panel)
           ============================================ */
        .profile-vibe-section {
            padding: 0.8rem 1rem;
            border-top: 1px solid var(--border);
        }

        .vibe-picker {
            display: flex;
            flex-wrap: wrap;
            gap: 0.3rem;
            margin-top: 0.4rem;
        }

        .vibe-chip {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            padding: 0.3rem 0.6rem;
            border-radius: 12px;
            border: 1px solid rgba(255, 255, 255, 0.08);
            background: rgba(255, 255, 255, 0.03);
            color: var(--text-secondary);
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .vibe-chip:hover {
            background: rgba(0, 245, 255, 0.08);
            border-color: rgba(0, 245, 255, 0.2);
            color: var(--text-primary);
        }

        .vibe-chip.active {
            background: rgba(0, 245, 255, 0.12);
            border-color: var(--neon-cyan);
            color: var(--neon-cyan);
            box-shadow: 0 0 8px rgba(0, 245, 255, 0.15);
        }

        .vibe-custom-row {
            display: flex;
            gap: 0.4rem;
            margin-top: 0.5rem;
        }

        .vibe-custom-input {
            flex: 1;
            background: var(--bg-tertiary);
            border: 1px solid rgba(255, 255, 255, 0.08);
            color: var(--text-primary);
            padding: 0.35rem 0.6rem;
            border-radius: 8px;
            font-family: var(--font-mono);
            font-size: 0.7rem;
            outline: none;
            transition: border-color 0.2s;
        }

        .vibe-custom-input:focus {
            border-color: rgba(0, 245, 255, 0.3);
        }

        .vibe-custom-input::placeholder {
            color: var(--text-muted);
        }

        .vibe-custom-btn {
            background: rgba(184, 41, 227, 0.15);
            border: 1px solid rgba(184, 41, 227, 0.3);
            color: var(--neon-purple);
            padding: 0.35rem 0.7rem;
            border-radius: 8px;
            font-family: var(--font-mono);
            font-size: 0.65rem;
            cursor: pointer;
            transition: all 0.2s;
        }

        .vibe-custom-btn:hover {
            background: rgba(184, 41, 227, 0.25);
        }

        /* ============================================
           PROFILE PANEL (LEGACY)
           ============================================ */
        .profile-detail-row:last-child {
            border-bottom: none;
        }

        .profile-action-btn.danger:hover {
            background: rgba(255, 46, 151, 0.1);
            border-color: var(--neon-pink);
        }

        /* ============================================
           EMOJI PICKER
           ============================================ */
        .emoji-grid {
            position: absolute;
            bottom: 60px;
            left: 0.6rem;
            background: var(--bg-secondary);
            border: 1px solid var(--border-glow);
            border-radius: 4px;
            padding: 0;
            display: none;
            z-index: 800;
            overflow: hidden;
        }

        /* .emoji-grid.active is defined in the CATEGORIZED EMOJI PICKER section above */

        .emoji-btn {
            width: 32px;
            height: 32px;
            background: none;
            border: 1px solid transparent;
            cursor: pointer;
            font-size: 1.1rem;
            border-radius: 3px;
            transition: all 0.2s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .emoji-btn:hover {
            background: rgba(0, 245, 255, 0.1);
            border-color: var(--border-glow);
            transform: scale(1.15);
        }

        /* ============================================
           AUTH OVERLAY
           ============================================ */
        

        

        

        

        .auth-modal > p {
            color: var(--text-secondary);
            margin-bottom: 1.5rem;
            font-size: 0.9rem;
        }

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        

        /* ============================================
           ADMIN PANEL
           ============================================ */
        .admin-panel {
            position: fixed;
            right: -400px;
            top: 50px;
            width: 400px;
            height: calc(100vh - 50px);
            background: var(--bg-secondary);
            border-left: 1px solid var(--border-glow);
            z-index: 910;
            transition: right 0.3s ease;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .admin-panel.active {
            right: 0;
        }

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

        .admin-header h3 {
            font-family: var(--font-display);
            font-size: 1rem;
            color: var(--neon-cyan);
        }

        .admin-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1.2rem;
            transition: all 0.2s;
        }

        .admin-close:hover {
            color: var(--neon-cyan);
        }

        .admin-tabs {
            display: flex;
            gap: 0.5rem;
            padding: 0.8rem 1rem;
            border-bottom: 1px solid var(--border-glow);
            background: var(--bg-tertiary);
        }

        .admin-tab {
            padding: 0.5rem 1rem;
            background: none;
            border: 1px solid transparent;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 0.75rem;
            text-transform: uppercase;
            font-weight: 600;
            border-radius: 3px;
            transition: all 0.2s;
            font-family: var(--font-mono);
        }

        .admin-tab:hover {
            color: var(--neon-cyan);
        }

        .admin-tab.active {
            background: rgba(0, 245, 255, 0.1);
            border-color: var(--neon-cyan);
            color: var(--neon-cyan);
        }

        /* ============================================
           DM PANEL STYLES
           ============================================ */
        .dm-panel {
            position: fixed;
            right: -380px;
            top: 50px;
            width: 380px;
            height: calc(100vh - 50px);
            background: var(--bg-secondary);
            border-left: 1px solid var(--border-glow);
            z-index: 900;
            transition: right 0.3s ease;
            display: flex;
            flex-direction: column;
            box-shadow: -5px 0 30px rgba(0,0,0,0.5);
        }

        .dm-panel.open { right: 0; }

        .dm-header {
            padding: 0.8rem 1rem;
            border-bottom: 1px solid var(--border-glow);
            display: flex;
            align-items: center;
            gap: 0.8rem;
            background: var(--bg-tertiary);
        }

        .dm-back, .dm-close {
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1.1rem;
            transition: all 0.2s;
            padding: 0.2rem 0.4rem;
        }

        .dm-back:hover, .dm-close:hover { color: var(--neon-cyan); }

        .dm-title {
            font-family: var(--font-display);
            color: var(--text-primary);
            font-size: 0.9rem;
            flex: 1;
            font-weight: 600;
        }

        .dm-unread-badge {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            background: var(--neon-pink);
            color: #fff;
            padding: 0.2rem 0.5rem;
            border-radius: 10px;
            font-weight: 700;
            display: none;
        }

        .dm-body {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
        }

        .dm-inbox {
            display: flex;
            flex-direction: column;
            overflow-y: auto;
        }

        .dm-convo-item {
            display: flex;
            align-items: center;
            gap: 0.8rem;
            padding: 0.8rem;
            border-bottom: 1px solid rgba(255,255,255,0.05);
            cursor: pointer;
            transition: all 0.2s;
        }

        .dm-convo-item:hover {
            background: rgba(0,245,255,0.08);
        }

        .dm-convo-item.unread {
            background: rgba(0,245,255,0.05);
        }

        .dm-convo-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            font-weight: 700;
            font-size: 0.9rem;
            flex-shrink: 0;
        }

        .dm-convo-info {
            flex: 1;
            min-width: 0;
        }

        .dm-convo-name {
            font-weight: 600;
            color: var(--text-primary);
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            gap: 0.3rem;
        }

        .unread-dot {
            width: 6px;
            height: 6px;
            background: var(--neon-cyan);
            border-radius: 50%;
        }

        .dm-convo-preview {
            font-size: 0.75rem;
            color: var(--text-muted);
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .dm-convo-time {
            font-family: var(--font-mono);
            font-size: 0.7rem;
            color: var(--text-muted);
            flex-shrink: 0;
        }

        .dm-empty {
            color: var(--text-muted);
            text-align: center;
            padding: 2rem 1rem;
            font-size: 0.8rem;
        }

        .dm-conversation {
            display: flex;
            flex-direction: column;
            height: 100%;
            overflow: hidden;
        }

        .dm-messages {
            flex: 1;
            overflow-y: auto;
            padding: 1rem;
            display: flex;
            flex-direction: column;
            gap: 0.6rem;
        }

        .dm-msg {
            max-width: 85%;
            padding: 0.6rem 0.8rem;
            border-radius: 8px;
            font-size: 0.85rem;
            word-wrap: break-word;
            line-height: 1.4;
        }

        .dm-msg.received {
            align-self: flex-start;
            background: var(--bg-tertiary);
            color: var(--text-primary);
            border-bottom-left-radius: 4px;
        }
        .dm-msg.sent {
            align-self: flex-end;
            background: rgba(0, 245, 255, 0.12);
            color: var(--text-primary);
            border-bottom-right-radius: 4px;
        }
        .dm-msg-time {
            font-family: var(--font-mono);
            font-size: 0.55rem;
            color: var(--text-muted);
            margin-top: 0.2rem;
        }
        .dm-msg.sent .dm-msg-time { text-align: right; }

        .dm-input-area {
            display: flex;
            flex-direction: column;
            gap: 0.4rem;
            padding: 0.6rem 0.8rem;
            border-top: 1px solid rgba(255,255,255,0.06);
            background: rgba(10,10,15,0.3);
        }

        .dm-upload-preview {
            display: flex;
            gap: 0.3rem;
            padding: 0.4rem 0 0;
            flex-wrap: wrap;
        }

        .dm-input-controls {
            display: flex;
            gap: 0.4rem;
        }

        .dm-upload-btn {
            background: none;
            border: none;
            color: var(--text-muted);
            font-size: 1rem;
            cursor: pointer;
            padding: 0.2rem;
            transition: color 0.2s;
            flex-shrink: 0;
        }
        .dm-upload-btn:hover { color: var(--neon-cyan); }

        .dm-input {
            flex: 1;
            background: var(--bg-tertiary);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 8px;
            padding: 0.5rem 0.7rem;
            color: var(--text-primary);
            font-family: var(--font-body);
            font-size: 0.85rem;
            resize: none;
            outline: none;
            max-height: 60px;
        }
        .dm-input:focus { border-color: var(--neon-cyan); }
        .dm-send {
            background: linear-gradient(135deg, var(--neon-cyan), var(--neon-purple));
            border: none;
            color: #fff;
            width: 34px; height: 34px;
            border-radius: 8px;
            cursor: pointer;
            font-size: 0.9rem;
            flex-shrink: 0;
            transition: box-shadow 0.2s;
        }
        .dm-send:hover { box-shadow: 0 0 10px rgba(0,245,255,0.3); }

        /* Popup DM button */
        .popup-actions {
            padding-top: 0.5rem;
            border-top: 1px solid rgba(255,255,255,0.05);
            margin-top: 0.5rem;
            display: flex;
            gap: 0.5rem;
        }
        .popup-dm-btn {
            flex: 1;
            background: rgba(0,245,255,0.08);
            border: 1px solid rgba(0,245,255,0.2);
            color: var(--neon-cyan);
            font-family: var(--font-display);
            font-size: 0.7rem;
            padding: 0.4rem 0;
            border-radius: 6px;
            cursor: pointer;
            letter-spacing: 1px;
            transition: all 0.2s;
        }
        .popup-dm-btn:hover {
            background: rgba(0,245,255,0.15);
            box-shadow: 0 0 10px rgba(0,245,255,0.2);
        }
        .popup-dm-btn.friend-btn {
            background: rgba(184,41,227,0.08);
            border-color: rgba(184,41,227,0.2);
            color: var(--neon-purple);
        }
        .popup-dm-btn.friend-btn:hover {
            background: rgba(184,41,227,0.15);
            box-shadow: 0 0 10px rgba(184,41,227,0.2);
        }

        /* ============================================
           PROFILE PANEL
           ============================================ */
        .my-profile-panel {
            position: fixed;
            right: -340px;
            top: 50px;
            width: 340px;
            height: calc(100vh - 50px);
            background: var(--bg-secondary);
            border-left: 1px solid var(--border-glow);
            z-index: 950;
            transition: right 0.3s ease;
            display: flex;
            flex-direction: column;
            box-shadow: -5px 0 30px rgba(0,0,0,0.5);
            overflow-y: auto;
        }

        .my-profile-panel.open { right: 0; }

        .profile-close-btn {
            position: absolute;
            top: 0.8rem;
            right: 0.8rem;
            background: none;
            border: none;
            color: var(--text-secondary);
            cursor: pointer;
            font-size: 1.2rem;
            transition: color 0.2s;
            z-index: 10;
        }

        .profile-close-btn:hover { color: var(--neon-cyan); }

        .profile-header-section {
            padding: 1.5rem 1rem 1rem;
            text-align: center;
            border-bottom: 1px solid rgba(255,255,255,0.08);
        }

        .profile-avatar-circle {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: var(--neon-purple);
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            font-weight: 700;
            color: #fff;
            margin: 0 auto 0.8rem;
            cursor: pointer;
            transition: all 0.3s;
            position: relative;
            overflow: hidden;
        }

        .profile-avatar-circle:hover {
            box-shadow: 0 0 20px rgba(0,245,255,0.3);
        }
        .profile-avatar-circle:hover .avatar-edit-hint {
            opacity: 1;
        }
        .avatar-edit-hint {
            position: absolute;
            bottom: 2px;
            font-size: 0.55rem;
            font-family: var(--font-mono);
            color: rgba(255,255,255,0.7);
            text-transform: uppercase;
            letter-spacing: 1px;
            opacity: 0;
            transition: opacity 0.2s;
            pointer-events: none;
        }
        .avatar-letter {
            pointer-events: none;
        }

        .profile-avatar-img {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            object-fit: cover;
            position: absolute;
            top: 0;
            left: 0;
        }

        .remove-avatar-btn {
            background: rgba(255,23,68,0.15);
            border: 1px solid rgba(255,23,68,0.3);
            color: #ff1744;
            font-family: var(--font-mono);
            font-size: 0.7rem;
            padding: 0.3rem 0.8rem;
            border-radius: 12px;
            cursor: pointer;
            margin-top: 0.5rem;
            transition: all 0.3s;
        }

        .remove-avatar-btn:hover {
            background: rgba(255,23,68,0.25);
        }

        .profile-display-name {
            font-size: 1.1rem;
            font-weight: 700;
            color: var(--text-primary);
            cursor: pointer;
            transition: color 0.2s;
        }

        .profile-display-name:hover {
            color: var(--neon-cyan);
        }

        .profile-role-badge {
            display: inline-block;
            margin-top: 0.4rem;
            padding: 0.2rem 0.6rem;
            background: rgba(0,245,255,0.1);
            border: 1px solid rgba(0,245,255,0.2);
            border-radius: 4px;
            font-size: 0.65rem;
            color: var(--neon-cyan);
            text-transform: uppercase;
            letter-spacing: 1px;
            font-weight: 600;
        }

        .profile-stats-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 0.6rem;
            padding: 1rem;
            border-bottom: 1px solid rgba(255,255,255,0.08);
        }

        .profile-stat-item {
            text-align: center;
        }

        .profile-stat-val {
            display: block;
            font-size: 1rem;
            font-weight: 700;
            color: var(--neon-cyan);
            font-family: var(--font-mono);
        }

        .profile-stat-key {
            display: block;
            font-size: 0.65rem;
            color: var(--text-muted);
            text-transform: uppercase;
            margin-top: 0.2rem;
        }

        .profile-bio-section {
            padding: 0.8rem 1rem;
            border-bottom: 1px solid rgba(255,255,255,0.08);
        }

        .profile-section-label {
            font-size: 0.7rem;
            text-transform: uppercase;
            color: var(--text-muted);
            letter-spacing: 1px;
            margin-bottom: 0.4rem;
            font-weight: 600;
        }

        .profile-bio-text {
            font-size: 0.8rem;
            color: var(--text-secondary);
            cursor: pointer;
            transition: color 0.2s;
            line-height: 1.4;
        }

        .profile-bio-text:hover {
            color: var(--neon-cyan);
        }

        .profile-status-section {
            padding: 0.8rem 1rem;
            border-bottom: 1px solid rgba(255,255,255,0.08);
        }

        #statusSelect {
            width: 100%;
            background: var(--bg-tertiary);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 4px;
            padding: 0.5rem;
            color: var(--text-primary);
            font-family: var(--font-body);
            font-size: 0.8rem;
            cursor: pointer;
        }

        #statusSelect:focus {
            outline: none;
            border-color: var(--neon-cyan);
        }

        .friends-section {
            padding: 0.8rem 1rem;
            border-bottom: 1px solid rgba(255,255,255,0.08);
            flex: 1;
            overflow-y: auto;
        }

        .friends-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.6rem;
        }

        .friends-title {
            font-size: 0.7rem;
            text-transform: uppercase;
            color: var(--text-muted);
            letter-spacing: 1px;
            font-weight: 600;
        }

        .friends-count {
            background: rgba(0,245,255,0.1);
            color: var(--neon-cyan);
            padding: 0.2rem 0.5rem;
            border-radius: 10px;
            font-size: 0.65rem;
            font-weight: 700;
        }

        .profile-friend-item {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.5rem;
            background: rgba(255,255,255,0.02);
            border-radius: 4px;
            margin-bottom: 0.4rem;
            transition: all 0.2s;
        }

        .profile-friend-item:hover {
            background: rgba(0,245,255,0.08);
        }

        .profile-friend-left {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            flex: 1;
            min-width: 0;
        }

        .profile-friend-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .profile-friend-dot.online { background: var(--neon-green); }
        .profile-friend-dot.offline { background: var(--text-muted); }

        .profile-friend-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
            font-weight: 700;
            color: #fff;
            flex-shrink: 0;
        }

        .profile-friend-info {
            flex: 1;
            min-width: 0;
        }

        .profile-friend-name {
            font-size: 0.8rem;
            color: var(--text-primary);
            font-weight: 500;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .profile-friend-status {
            font-size: 0.65rem;
            color: var(--text-muted);
        }

        .profile-friend-actions {
            display: flex;
            gap: 0.3rem;
            flex-shrink: 0;
        }

        .profile-friend-btn {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 0.9rem;
            padding: 0.3rem;
            transition: color 0.2s;
            border-radius: 4px;
        }

        .profile-friend-btn:hover {
            color: var(--neon-cyan);
            background: rgba(0,245,255,0.1);
        }

        .profile-friend-btn.remove-btn:hover {
            color: #ff1744;
            background: rgba(255,23,68,0.1);
        }

        .requests-section {
            padding: 0.8rem 1rem;
            border-bottom: 1px solid rgba(255,255,255,0.08);
            flex: 1;
            overflow-y: auto;
        }

        .requests-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 0.6rem;
        }

        .requests-title {
            font-size: 0.7rem;
            text-transform: uppercase;
            color: var(--text-muted);
            letter-spacing: 1px;
            font-weight: 600;
        }

        .profile-notif-badge {
            background: #ff1744;
            color: #fff;
            padding: 0.2rem 0.5rem;
            border-radius: 10px;
            font-size: 0.65rem;
            font-weight: 700;
            display: none;
            align-items: center;
            justify-content: center;
        }

        .profile-request-item {
            display: flex;
            align-items: center;
            gap: 0.6rem;
            padding: 0.5rem;
            background: rgba(255,23,68,0.05);
            border-radius: 4px;
            margin-bottom: 0.4rem;
        }

        .profile-request-avatar {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
            font-weight: 700;
            color: #fff;
            flex-shrink: 0;
        }

        .profile-request-info {
            flex: 1;
        }

        .profile-request-name {
            font-size: 0.8rem;
            color: var(--text-primary);
            font-weight: 500;
        }

        .profile-request-actions {
            display: flex;
            gap: 0.3rem;
            flex-shrink: 0;
        }

        .profile-request-btn {
            background: none;
            border: none;
            cursor: pointer;
            font-size: 0.85rem;
            padding: 0.3rem 0.5rem;
            border-radius: 4px;
            transition: all 0.2s;
            font-weight: 600;
        }

        .profile-request-btn.accept {
            color: var(--neon-green);
            background: rgba(57,255,20,0.1);
        }

        .profile-request-btn.accept:hover {
            background: rgba(57,255,20,0.2);
        }

        .profile-request-btn.decline {
            color: #ff1744;
            background: rgba(255,23,68,0.1);
        }

        .profile-request-btn.decline:hover {
            background: rgba(255,23,68,0.2);
        }

        .profile-bottom-section {
            padding: 1rem;
            border-top: 1px solid rgba(255,255,255,0.08);
            display: flex;
            gap: 0.6rem;
            flex-shrink: 0;
        }

        .profile-signout-btn {
            flex: 1;
            background: rgba(255,23,68,0.1);
            border: 1px solid rgba(255,23,68,0.2);
            color: #ff1744;
            padding: 0.6rem;
            border-radius: 4px;
            cursor: pointer;
            font-family: var(--font-body);
            font-size: 0.8rem;
            font-weight: 600;
            transition: all 0.2s;
            letter-spacing: 1px;
        }

        .profile-signout-btn:hover {
            background: rgba(255,23,68,0.2);
            box-shadow: 0 0 10px rgba(255,23,68,0.2);
        }

        .topbar-avatar-badge {
            position: absolute;
            top: -8px;
            right: -8px;
            background: #ff1744;
            color: #fff;
            width: 20px;
            height: 20px;
            border-radius: 50%;
            align-items: center;
            justify-content: center;
            font-size: 0.65rem;
            font-weight: 700;
            border: 2px solid var(--bg-secondary);
            display: none;
        }

        /* Responsive */
        @media (max-width: 600px) {
            .dm-panel { width: 100%; right: 0; border-radius: 16px 16px 0 0; }
            .my-profile-panel { width: 100%; right: 0; border-radius: 16px 16px 0 0; }
        }

        /* ============================================
           PINNED MESSAGE BAR
           ============================================ */
        .pinned-message-bar {
            display: none;
            align-items: center;
            gap: 0.5rem;
            padding: 0.4rem 0.8rem;
            background: rgba(255, 200, 0, 0.06);
            border-bottom: 1px solid rgba(255, 200, 0, 0.15);
            font-size: 0.8rem;
            cursor: pointer;
            z-index: 5;
        }
        .pinned-icon {
            font-size: 0.85rem;
            flex-shrink: 0;
        }
        .pinned-content {
            flex: 1;
            overflow: hidden;
            display: flex;
            flex-direction: column;
            gap: 0.1rem;
        }
        .pinned-author {
            font-family: var(--font-mono);
            font-size: 0.7rem;
            color: var(--neon-cyan);
            font-weight: 600;
        }
        .pinned-text {
            color: var(--text-secondary);
            font-size: 0.75rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .pinned-close {
            background: none;
            border: none;
            color: var(--text-muted);
            cursor: pointer;
            font-size: 1rem;
            padding: 0 4px;
            flex-shrink: 0;
        }
        .pinned-close:hover {
            color: var(--text-primary);
        }

        /* ============================================
           @MENTIONS
           ============================================ */
        .mention {
            color: var(--neon-cyan);
            background: rgba(0, 245, 255, 0.1);
            border-radius: 3px;
            padding: 0 3px;
            font-weight: 600;
            cursor: pointer;
        }
        .mention:hover {
            background: rgba(0, 245, 255, 0.2);
            text-decoration: underline;
        }

        /* ============================================
           @MENTION AUTOCOMPLETE DROPDOWN
           ============================================ */
        .mention-autocomplete {
            position: absolute;
            bottom: 100%;
            left: 1.5rem;
            right: 1.5rem;
            max-height: 220px;
            overflow-y: auto;
            background: var(--bg-tertiary);
            border: 1px solid var(--border-glow);
            border-radius: 6px;
            box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.5), 0 0 8px rgba(0, 245, 255, 0.1);
            z-index: 900;
            display: none;
            scrollbar-width: thin;
            scrollbar-color: var(--border-glow) transparent;
        }
        .mention-autocomplete.visible {
            display: block;
        }
        .mention-autocomplete-header {
            padding: 6px 12px;
            font-size: 0.7rem;
            color: var(--text-muted);
            font-family: var(--font-mono);
            text-transform: uppercase;
            letter-spacing: 0.05em;
            border-bottom: 1px solid var(--border-glow);
        }
        .mention-autocomplete-item {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 8px 12px;
            cursor: pointer;
            transition: background 0.15s;
        }
        .mention-autocomplete-item:hover,
        .mention-autocomplete-item.active {
            background: rgba(0, 245, 255, 0.08);
        }
        .mention-autocomplete-item .mention-avatar {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            flex-shrink: 0;
            object-fit: cover;
            border: 1px solid var(--border-glow);
        }
        .mention-autocomplete-item .mention-avatar-placeholder {
            width: 28px;
            height: 28px;
            border-radius: 50%;
            flex-shrink: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.75rem;
            font-weight: 700;
            border: 1px solid var(--border-glow);
        }
        .mention-autocomplete-item .mention-name {
            font-size: 0.85rem;
            font-family: var(--font-mono);
            font-weight: 600;
        }
        .mention-autocomplete-item .mention-role {
            font-size: 0.65rem;
            padding: 1px 5px;
            border-radius: 3px;
            font-family: var(--font-mono);
            text-transform: uppercase;
            margin-left: auto;
        }
        .mention-autocomplete-item .mention-role.admin {
            background: rgba(255, 0, 100, 0.15);
            color: #ff0064;
        }
        .mention-autocomplete-item .mention-role.mod {
            background: rgba(0, 245, 255, 0.15);
            color: var(--neon-cyan);
        }
        .mention-autocomplete-item .mention-online-dot {
            width: 8px;
            height: 8px;
            border-radius: 50%;
            flex-shrink: 0;
        }
        .mention-autocomplete-item .mention-online-dot.online {
            background: var(--neon-green);
            box-shadow: 0 0 4px var(--neon-green);
        }
        .mention-autocomplete-item .mention-online-dot.offline {
            background: var(--text-muted);
        }

        /* ============================================
           SIDEBAR TYPING DOTS
           ============================================ */
        .sidebar-typing-dot {
            margin-left: auto;
            font-size: 0.7rem;
            color: var(--neon-cyan);
        }
        .typing-dots span {
            animation: typingBlink 1.4s infinite;
            font-weight: 700;
        }
        .typing-dots span:nth-child(2) { animation-delay: 0.2s; }
        .typing-dots span:nth-child(3) { animation-delay: 0.4s; }
        @keyframes typingBlink {
            0%, 60%, 100% { opacity: 0.2; }
            30% { opacity: 1; }
        }

        /* ============================================
           ROOM TOPIC IN TOPBAR
           ============================================ */
        .topbar-topic {
            font-family: var(--font-mono);
            font-size: 0.65rem;
            color: var(--text-muted);
            margin-left: 0.3rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 250px;
        }

        /* ============================================
           DM READ RECEIPTS
           ============================================ */
        .dm-read-receipt {
            font-family: var(--font-mono);
            font-size: 0.6rem;
            color: var(--neon-cyan);
            text-align: right;
            margin-top: 2px;
            opacity: 0.7;
        }

        /* ============================================
           CUSTOM STATUS IN POPUP
           ============================================ */
        .popup-custom-status {
            font-family: var(--font-mono);
            font-size: 0.72rem;
            color: var(--neon-green);
            margin-bottom: 0.3rem;
            font-style: italic;
        }
        .popup-custom-status::before {
            content: '💭 ';
        }

        /* ============================================
           MOBILE RESPONSIVE (≤768px)
           ============================================ */
        @media (max-width: 768px) {
            /* Hide desktop elements on mobile */
            .topbar-online {
                display: none !important;
            }

            /* Topbar adjustments */
            .topbar {
                height: 56px;
                padding: 0 0.75rem;
                gap: 0.5rem;
            }

            .topbar-logo {
                font-size: 0.85rem;
                letter-spacing: 1px;
            }

            .topbar-divider {
                display: none;
            }

            .topbar-room {
                font-size: 0.8rem;
                max-width: 120px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            /* Hide group settings on mobile */
            #groupSettingsBtn {
                display: none !important;
            }

            /* Show mobile toggle buttons */
            .mobile-toggle {
                display: block !important;
            }

            .mobile-toggle.rooms-toggle {
                margin-right: 0.5rem;
            }

            .mobile-toggle.users-toggle {
                margin-left: 0.5rem;
            }

            /* Hide non-essential top bar elements */
            .x-link {
                display: none !important;
            }

            .topbar-user {
                padding: 0.25rem 0.5rem;
                gap: 0.25rem;
            }

            .topbar-avatar {
                width: 20px;
                height: 20px;
                font-size: 0.6rem;
            }

            .topbar-username {
                display: none;
            }

            /* Main layout: sidebars become off-canvas */
            .main-layout {
                position: relative;
            }

            /* Rooms sidebar off-canvas */
            .rooms-sidebar {
                position: fixed;
                left: -280px;
                top: 56px;
                width: 260px;
                height: calc(100vh - 56px);
                height: calc(100dvh - 56px);
                z-index: 500;
                transition: left 0.3s ease;
                border-right: 1px solid var(--border-glow);
                overflow-y: auto;
            }

            .chat-container.rooms-open .rooms-sidebar {
                left: 0;
            }

            /* Hide desktop-only buttons and show hamburger */
            .topbar-desktop-only {
                display: none !important;
            }

            .topbar-right {
                gap: 0.3rem;
            }

            .topbar-mobile-menu {
                display: flex !important;
                align-items: center;
                justify-content: center;
                width: 40px;
                height: 40px;
                font-size: 1.5rem;
            }

            /* Hide radio widget in topbar on mobile - it moves into the hamburger menu */
            .topbar-right > .radio-widget {
                display: none !important;
            }

            /* Hide user info on mobile - keep it minimal */
            .topbar-user {
                display: none !important;
            }

            /* Dropdown position relative to mobile topbar */
            .topbar-menu-dropdown {
                top: 56px;
                right: -0.75rem;
                min-width: 240px;
                border-radius: 0 0 8px 8px;
                border-top: none;
            }

            .users-sidebar {
                position: fixed;
                right: -100%;
                top: 56px;
                width: 100%;
                max-width: 100%;
                height: calc(100vh - 56px);
                height: calc(100dvh - 56px);
                z-index: 500;
                transition: right 0.3s ease;
                border-left: 1px solid var(--border-glow);
                overflow-y: auto;
            }

            .chat-container.users-open .users-sidebar {
                right: 0;
            }

            /* Messages container takes full width */
            .messages-container {
                flex: 1;
                width: 100%;
            }

            .messages {
                padding: 0.6rem 0.5rem;
            }

            .msg {
                font-size: 0.85rem;
                padding: 0.15rem 0;
            }

            .msg.own {
                margin-left: 0;
                margin-right: 0;
            }

            /* Mobile overlay for sidebars */
            .mobile-overlay {
                display: none;
                position: fixed;
                inset: 0;
                background: rgba(0, 0, 0, 0.5);
                z-index: 400;
                top: 56px;
            }

            .chat-container.rooms-open .mobile-overlay,
            .chat-container.users-open .mobile-overlay {
                display: block;
            }

            /* Input controls for mobile */
            .input-controls {
                padding: 0.75rem 1rem;
                gap: 0.5rem;
            }

            .input-btn {
                width: 40px;
                height: 40px;
                font-size: 0.95rem;
            }

            .msg-input {
                font-size: 0.8rem;
                padding: 0.5rem 0.6rem;
            }

            /* Emoji grid mobile */
            .emoji-grid {
                bottom: 120px;
                max-height: 200px;
                width: 260px;
            }

            .emoji-btn-grid {
                grid-template-columns: repeat(6, 1fr);
            }

            .emoji-btn {
                width: 28px;
                height: 28px;
                font-size: 1rem;
            }

            /* Auth modal mobile */
            .auth-modal {
                padding: 1.5rem;
                max-width: 100%;
                width: 95%;
                border-radius: 12px;
            }

            .auth-modal h2 {
                font-size: 1.3rem;
            }

            /* Modals mobile */
            .modal {
                padding: 1.5rem;
                max-width: 100%;
                width: 95%;
                border-radius: 12px;
            }

            .modal-title {
                font-size: 1.1rem;
            }

            /* Profile panel mobile */
            .my-profile-panel {
                position: fixed;
                right: -100%;
                top: 56px;
                width: 100%;
                height: calc(100vh - 56px);
                height: calc(100dvh - 56px);
                border-radius: 0;
                z-index: 950;
            }

            .my-profile-panel.open {
                right: 0;
            }

            /* Admin panel mobile */
            .admin-panel {
                position: fixed;
                right: -100%;
                top: 56px;
                width: 100%;
                height: calc(100vh - 56px);
                height: calc(100dvh - 56px);
                border-radius: 0;
                z-index: 910;
            }

            .admin-panel.active {
                right: 0;
            }

            /* DM panel mobile */
            .dm-panel {
                position: fixed;
                right: -100%;
                top: 56px;
                width: 100%;
                height: calc(100vh - 56px);
                height: calc(100dvh - 56px);
                border-radius: 0;
                z-index: 900;
            }

            .dm-panel.open {
                right: 0;
            }

            /* User popup mobile - bottom sheet style */
            .user-popup {
                width: 85%;
                max-width: none;
                bottom: 20px;
                left: 50%;
                transform: translateX(-50%) translateY(5px);
                right: auto;
                top: auto;
            }

            .user-popup.visible {
                transform: translateX(-50%) translateY(0);
            }

            /* Group admin panel mobile */
            .group-admin-panel {
                position: fixed;
                right: -100%;
                top: 56px;
                width: 100%;
                height: calc(100vh - 56px);
                height: calc(100dvh - 56px);
                max-height: none;
                border-radius: 0;
                z-index: 5000;
                transition: right 0.3s ease;
            }

            .group-admin-panel.active {
                right: 0;
            }

            /* Lightbox mobile */
            .lightbox img {
                max-width: 95%;
                max-height: 80%;
            }

            /* Message attachments */
            .msg-img {
                max-width: 100%;
                max-height: 200px;
            }

            /* Remove desktop widths from user items */
            .user-item {
                font-size: 0.75rem;
            }

            /* Room items */
            .room-item,
            .group-item {
                font-size: 0.8rem;
                padding: 0.5rem 0.75rem;
            }

            /* Profile panel sections */
            .profile-stats-grid {
                grid-template-columns: repeat(2, 1fr);
                gap: 0.5rem;
                padding: 0.8rem;
            }

            .profile-stat-val {
                font-size: 0.9rem;
            }

            .profile-stat-key {
                font-size: 0.6rem;
            }

            /* Reduce section padding */
            .profile-header-section,
            .profile-bio-section,
            .profile-status-section,
            .friends-section,
            .requests-section {
                padding: 0.6rem 0.75rem;
            }

            .profile-section-label {
                font-size: 0.65rem;
                margin-bottom: 0.3rem;
            }

            .profile-avatar-circle {
                width: 70px;
                height: 70px;
                font-size: 1.8rem;
                margin: 0 auto 0.6rem;
            }

            .profile-display-name {
                font-size: 1rem;
            }

            .profile-role-badge {
                font-size: 0.6rem;
                padding: 0.15rem 0.4rem;
            }

            /* Friend and request items */
            .profile-friend-item,
            .profile-request-item {
                padding: 0.4rem;
                margin-bottom: 0.3rem;
            }

            .profile-friend-avatar,
            .profile-request-avatar {
                width: 28px;
                height: 28px;
                font-size: 0.7rem;
            }

            .profile-friend-name,
            .profile-request-name {
                font-size: 0.75rem;
            }

            .profile-bottom-section {
                padding: 0.75rem;
                gap: 0.4rem;
            }

            .profile-signout-btn {
                padding: 0.5rem;
                font-size: 0.75rem;
            }

            /* DM panel items */
            .dm-convo-item {
                padding: 0.6rem;
            }

            .dm-convo-avatar {
                width: 36px;
                height: 36px;
                font-size: 0.8rem;
            }

            .dm-convo-name {
                font-size: 0.8rem;
            }

            .dm-convo-preview {
                font-size: 0.7rem;
            }

            .dm-msg {
                max-width: 90%;
                font-size: 0.8rem;
                padding: 0.5rem 0.7rem;
            }

            /* Admin panel mobile */
            .admin-header h3 {
                font-size: 0.95rem;
            }

            .admin-tabs {
                padding: 0.6rem 0.75rem;
                gap: 0.3rem;
            }

            .admin-tab {
                padding: 0.4rem 0.75rem;
                font-size: 0.7rem;
            }

            /* Group member rows */
            .group-member-row {
                font-size: 0.75rem;
                padding: 0.5rem;
                margin-bottom: 0.3rem;
            }

            .group-member-avatar {
                width: 18px;
                height: 18px;
                font-size: 0.55rem;
            }

            /* Upload preview */
            .upload-preview {
                padding: 0.4rem 0.6rem 0;
            }

            .upload-thumb img,
            .upload-thumb-file {
                width: 60px;
                height: 60px;
            }

            /* Modal buttons */
            .modal-buttons {
                flex-direction: column;
                gap: 0.6rem;
                margin-top: 1.5rem;
            }

            .modal-btn {
                padding: 0.7rem;
                font-size: 0.85rem;
            }

            /* Input bar adjustments */
            .input-bar {
                position: relative;
            }

            /* Ensure bottom doesn't get hidden by mobile keyboard */
            textarea.msg-input {
                max-height: 80px;
            }
        }

        /* ============================================
           TABLET RESPONSIVE (≤1024px)
           ============================================ */
        @media (max-width: 1024px) and (min-width: 769px) {
            .rooms-sidebar {
                width: 160px;
            }

            .users-sidebar {
                width: 200px;
            }

            .topbar {
                padding: 0 1rem;
            }

            .topbar-room {
                font-size: 0.8rem;
                max-width: 120px;
            }

            .room-item,
            .group-item {
                font-size: 0.8rem;
                padding: 0.5rem 0.8rem;
            }

            .user-item {
                font-size: 0.75rem;
                padding: 0.4rem 0.7rem;
            }

            .messages {
                padding: 1rem;
            }

            .modal {
                max-width: 90%;
            }

            /* Modals slightly smaller on tablet */
            .admin-panel {
                width: 350px;
                right: -350px;
            }

            .dm-panel {
                width: 340px;
                right: -340px;
            }

            .my-profile-panel {
                width: 320px;
                right: -320px;
            }

            .group-admin-panel {
                width: 250px;
                right: -250px;
            }
        }

        /* ============================================
           SMALL PHONES (≤480px)
           ============================================ */
        @media (max-width: 480px) {
            .topbar {
                height: 52px;
                padding: 0 0.5rem;
                gap: 0.3rem;
            }

            .topbar-logo {
                font-size: 0.8rem;
                letter-spacing: 0.5px;
            }

            .topbar-room {
                display: none;
            }

            .topbar-btn {
                font-size: 1rem;
                padding: 0.2rem 0.4rem;
                width: 36px;
                height: 36px;
                border-radius: 3px;
            }

            .input-btn {
                width: 36px;
                height: 36px;
                font-size: 0.9rem;
            }

            .msg-input {
                font-size: 0.75rem;
            }

            .messages {
                padding: 0.75rem 0.5rem;
            }

            .msg {
                gap: 0.6rem;
            }

            .msg-avatar,
            .msg-avatar-fallback,
            .msg-avatar-emoji {
                width: 24px;
                height: 24px;
                min-width: 24px;
                font-size: 0.65rem;
            }

            .msg-avatar-emoji {
                font-size: 0.9rem;
            }

            .msg-avatar-spacer {
                width: 24px;
                min-width: 24px;
            }

            .msg-text {
                font-size: 0.85rem;
            }

            .msg-meta {
                font-size: 0.7rem;
                gap: 0.4rem;
            }

            .profile-avatar-circle {
                width: 60px;
                height: 60px;
                font-size: 1.6rem;
                margin: 0 auto 0.5rem;
            }

            .dm-convo-avatar {
                width: 32px;
                height: 32px;
            }

            .user-popup {
                width: 90%;
            }

            .emoji-grid {
                max-height: 180px;
                width: 240px;
            }
            .emoji-btn-grid {
                grid-template-columns: repeat(5, 1fr);
            }

            /* Remove some padding for smaller screens */
            .input-controls {
                padding: 0.6rem 0.75rem;
                gap: 0.4rem;
            }
        }

        /* ============================================
           LANDSCAPE MODE (height < 500px)
           ============================================ */
        @media (max-height: 500px) {
            .topbar {
                height: 48px;
            }

            .topbar-btn {
                font-size: 0.95rem;
            }

            .messages {
                padding: 0.75rem;
            }

            .input-bar {
                flex-shrink: 0;
            }

            .msg {
                gap: 0.6rem;
                margin-bottom: 0.5rem;
            }

            .msg-text {
                font-size: 0.8rem;
            }

            .emoji-grid {
                max-height: 150px;
            }
        }

        /* ============================================
           FEATURE 2: ACHIEVEMENTS & BADGES
           ============================================ */
        .badge-row {
            display: flex;
            gap: 0.4rem;
            flex-wrap: wrap;
            margin-top: 0.8rem;
            padding-top: 0.8rem;
            border-top: 1px solid var(--border-glow);
        }

        .badge-icon {
            font-size: 1.2rem;
            cursor: help;
            transition: all 0.2s ease;
            opacity: 0.8;
        }

        .badge-icon:hover {
            transform: scale(1.15) rotate(-5deg);
            opacity: 1;
        }

        .badge-locked {
            opacity: 0.3;
            filter: grayscale(100%);
        }

        .badge-toast {
            background: var(--bg-card);
            border: 2px solid var(--neon-green);
            border-radius: 10px;
            padding: 1rem 1.2rem;
            color: var(--neon-green);
            font-family: var(--font-body);
            font-size: 0.85rem;
            backdrop-filter: blur(10px);
            box-shadow: 0 0 20px rgba(57, 255, 20, 0.3);
            animation: slideInRight 0.3s ease;
            pointer-events: auto;
        }

        @keyframes slideInRight {
            from { opacity: 0; transform: translateX(30px); }
            to { opacity: 1; transform: translateX(0); }
        }

        /* ============================================
           FEATURE 3: POLLS SYSTEM
           ============================================ */
        .poll-card {
            background: var(--bg-tertiary);
            border: 1px solid var(--border-glow);
            border-radius: 12px;
            padding: 1rem;
            margin: 0.5rem 0;
            color: var(--text-primary);
        }

        .poll-question {
            font-family: var(--font-display);
            font-size: 0.95rem;
            color: var(--neon-cyan);
            margin-bottom: 0.8rem;
            font-weight: 600;
            letter-spacing: 0.5px;
        }

        .poll-option {
            background: var(--bg-card);
            border: 1px solid rgba(0, 245, 255, 0.2);
            border-radius: 8px;
            padding: 0.6rem 0.8rem;
            margin-bottom: 0.6rem;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 0.6rem;
            position: relative;
            overflow: hidden;
        }

        .poll-option:hover {
            border-color: var(--neon-cyan);
            background: rgba(0, 245, 255, 0.05);
        }

        .poll-option.voted {
            border-color: var(--neon-green);
            background: rgba(57, 255, 20, 0.1);
        }

        .poll-option.my-vote {
            border-color: var(--neon-purple);
            background: rgba(184, 41, 227, 0.1);
            font-weight: 600;
        }

        .poll-bar {
            position: absolute;
            left: 0;
            top: 0;
            bottom: 0;
            background: linear-gradient(90deg, rgba(0, 245, 255, 0.2), rgba(57, 255, 20, 0.2));
            transition: width 0.3s ease;
            z-index: 0;
        }

        .poll-votes {
            display: flex;
            align-items: center;
            gap: 0.4rem;
            position: relative;
            z-index: 1;
            flex: 1;
        }

        .poll-votes-text {
            font-family: var(--font-mono);
            font-size: 0.75rem;
            color: var(--text-secondary);
            margin-left: auto;
        }

        .poll-meta {
            font-family: var(--font-mono);
            font-size: 0.7rem;
            color: var(--text-muted);
            margin-top: 0.8rem;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }


/* ============================================
   MOBILE UX FIXES
   ============================================ */

/* Textarea auto-expand support */
.msg-input {
    max-height: 150px;
    resize: none;
    transition: height 0.1s ease;
}

/* Auth modal scrollable on small screens */
@media (max-height: 600px) {
    .auth-overlay {
        align-items: flex-start;
        padding-top: 1rem;
    }
    .auth-modal {
        max-height: 95vh;
        overflow-y: auto;
    }
}

/* Desktop: Show desktop buttons, hide mobile menu */
@media (min-width: 769px) {
    .topbar-desktop-only {
        display: block !important;
    }

    .topbar-mobile-menu {
        display: none !important;
    }

    .topbar-right > .radio-widget {
        display: flex !important;
    }

    .topbar-user {
        display: flex !important;
    }

    .topbar-menu-radio-slot {
        display: none !important;
    }

    .users-sidebar {
        position: relative !important;
        width: 220px !important;
        right: auto !important;
        top: auto !important;
        height: auto !important;
        border-left: 1px solid var(--border-glow);
    }

    .chat-container.users-open .users-sidebar {
        right: auto !important;
    }
}

/* ============================================
   LURKER BANNER
   ============================================ */
.lurker-banner {
    position: sticky;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, rgba(10,10,18,0.97), rgba(20,15,35,0.97));
    border-top: 1px solid rgba(0, 245, 255, 0.15);
    font-family: var(--font-body, 'Rajdhani', sans-serif);
    font-size: 0.9rem;
    color: #aaa;
    z-index: 100;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}
.lurker-banner button {
    background: linear-gradient(135deg, var(--neon-cyan, #00f5ff), var(--neon-purple, #b829e3));
    border: none;
    color: #fff;
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: 0.78rem;
    font-weight: 700;
    padding: 0.4rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: opacity 0.2s;
}
.lurker-banner button:hover {
    opacity: 0.85;
}
