        :root {
            --app-height: 100dvh;
            --bg: #080e0c;
            --surface: #0d1613;
            --surface2: #111c18;
            --gold: #D4A017;
            --gold-light: #F5E6B8;
            --gold-dark: #b8860b;
            --text: #e8e8e8;
            --text2: #9aa0a8;
            --danger: #e74c3c;
            --success: #2ecc71;
            --warning: #f39c12;
            --info: #3498db;
            --purple: #9b59b6;
            --border: rgba(212,160,23,0.2);
            --radius: 18px;
            --radius-sm: 12px;
            --shadow: 0 8px 32px rgba(0,0,0,0.4);
            --shadow-lg: 0 16px 48px rgba(0,0,0,0.6);
            --transition: 0.25s ease;
            --safe: env(safe-area-inset-bottom, 0px);
        }
        
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
            -webkit-tap-highlight-color: transparent;
        }
        
        html, body {
            font-family: 'Cairo', sans-serif;
            background: var(--bg);
            height: var(--app-height);
            overflow: hidden;
            position: fixed;
            inset: 0;
            user-select: none;
            -webkit-user-select: none;
            -webkit-font-smoothing: antialiased;
            -moz-osx-font-smoothing: grayscale;
        }
        
        .welcome {
            position: fixed;
            inset: 0;
            background: linear-gradient(160deg, #060e0b 0%, #0a1a12 40%, #0d1f16 100%);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            z-index: 100;
            transition: 0.5s ease;
            gap: 16px;
            padding: 20px;
        }
        
        .welcome.hidden {
            opacity: 0;
            pointer-events: none;
            transform: scale(1.1);
        }
        
        .welcome-logo {
            font-size: clamp(3.5rem, 10vw, 5rem);
            color: var(--gold);
            animation: float 3s infinite;
            filter: drop-shadow(0 0 35px rgba(212,160,23,0.4));
        }
        
        @keyframes float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-15px); }
        }
        
        .welcome h1 {
            font-size: clamp(2rem, 7vw, 2.6rem);
            font-weight: 800;
            background: linear-gradient(135deg, var(--gold-light), var(--gold), var(--gold-dark));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            text-align: center;
        }
        
        .welcome p {
            color: var(--text2);
            text-align: center;
            font-size: 0.9rem;
            line-height: 1.7;
            max-width: 320px;
        }
        
        .welcome-btns {
            display: flex;
            flex-direction: column;
            gap: 10px;
            width: 85%;
            max-width: 340px;
            margin-top: 8px;
        }
        
        .btn {
            padding: 15px 24px;
            border-radius: 50px;
            font-size: 0.95rem;
            font-weight: 600;
            cursor: pointer;
            border: none;
            font-family: 'Cairo', sans-serif;
            transition: var(--transition);
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }
        
        .btn:active { transform: scale(0.96); }
        
        .btn-gold {
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            color: #0a1410;
            font-weight: 700;
        }
        
        .btn-outline {
            background: transparent;
            color: var(--gold);
            border: 2px solid var(--gold);
        }
        
        .btn-white {
            background: #fff;
            color: #333;
        }
        
        .welcome span {
            color: var(--text2);
            font-size: 0.7rem;
            opacity: 0.7;
        }
        
        .auth {
            position: fixed;
            inset: 0;
            background: var(--bg);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 90;
            padding: 20px;
            transition: var(--transition);
            opacity: 0;
            pointer-events: none;
            transform: translateY(20px);
            overflow-y: auto;
        }
        
        .auth.active {
            opacity: 1;
            pointer-events: all;
            transform: translateY(0);
        }
        
        .auth-card {
            width: 100%;
            max-width: 400px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 28px 20px;
            box-shadow: var(--shadow-lg);
            backdrop-filter: blur(20px);
            margin: auto;
        }
        
        .auth-card h2 {
            text-align: center;
            color: var(--text);
            margin-bottom: 4px;
            font-size: 1.4rem;
        }
        
        .auth-card .sub {
            text-align: center;
            color: var(--text2);
            font-size: 0.78rem;
            margin-bottom: 20px;
        }
        
        .auth-tabs {
            display: flex;
            background: var(--surface2);
            border-radius: 30px;
            margin-bottom: 20px;
            padding: 3px;
        }
        
        .auth-tab {
            flex: 1;
            padding: 10px;
            text-align: center;
            border-radius: 27px;
            cursor: pointer;
            color: var(--text2);
            font-size: 0.82rem;
            font-weight: 500;
            transition: var(--transition);
            border: none;
            background: none;
            font-family: 'Cairo', sans-serif;
        }
        
        .auth-tab.on {
            background: var(--gold);
            color: #0a1410;
            font-weight: 700;
        }
        
        .fld {
            margin-bottom: 12px;
            text-align: right;
        }
        
        .fld label {
            display: block;
            color: var(--text2);
            font-size: 0.76rem;
            margin-bottom: 4px;
        }
        
        .fld-wrap {
            position: relative;
        }
        
        .fld-wrap input, .fld-wrap select {
            width: 100%;
            padding: 12px 40px 12px 12px;
            background: var(--surface2);
            border: 1.5px solid var(--border);
            border-radius: var(--radius-sm);
            color: var(--text);
            font-family: 'Cairo', sans-serif;
            font-size: 0.88rem;
            outline: none;
            transition: var(--transition);
            direction: ltr;
            text-align: left;
        }
        
        .fld-wrap select {
            direction: rtl;
            text-align: right;
            padding: 12px;
            appearance: none;
            cursor: pointer;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23D4A017' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: left 12px center;
        }
        
        .fld-wrap input:focus, .fld-wrap select:focus {
            border-color: var(--gold);
            box-shadow: 0 0 15px rgba(212,160,23,0.1);
        }
        
        .fld-wrap i {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            color: var(--gold);
            font-size: 0.9rem;
            pointer-events: none;
        }
        
        .auth-submit {
            width: 100%;
            padding: 13px;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            border: none;
            border-radius: 50px;
            color: #0a1410;
            font-family: 'Cairo', sans-serif;
            font-size: 0.95rem;
            font-weight: 700;
            cursor: pointer;
            transition: var(--transition);
            margin-top: 4px;
        }
        
        .auth-submit:active { transform: scale(0.96); }
        .auth-submit:disabled { opacity: 0.5; }
        
        .auth-msg {
            font-size: 0.76rem;
            text-align: center;
            margin-top: 8px;
            min-height: 18px;
        }
        
        .auth-msg.err { color: var(--danger); }
        .auth-msg.ok { color: var(--success); }
        
        .auth-link {
            display: block;
            text-align: center;
            margin-top: 10px;
            cursor: pointer;
            font-size: 0.78rem;
            background: none;
            border: none;
            font-family: 'Cairo', sans-serif;
            width: 100%;
            color: var(--text2);
        }
        
        .auth-link.forgot {
            color: var(--gold);
            text-decoration: underline;
        }
        
        .app {
            width: 100%;
            height: var(--app-height);
            background: var(--bg);
            display: flex;
            flex-direction: column;
            opacity: 0;
            pointer-events: none;
            transition: var(--transition);
        }
        
        .app.active {
            opacity: 1;
            pointer-events: all;
        }
        
        .app-header {
            background: #090f0d;
            border-bottom: 1px solid rgba(212, 160, 23, 0.15);
            padding: 8px 6px;
            display: flex;
            align-items: center;
            backdrop-filter: blur(30px);
            z-index: 20;
            flex-shrink: 0;
            width: 100%;
            box-sizing: border-box;
        }

        .top-app-bar {
            display: flex;
            align-items: stretch;
            justify-content: space-between;
            gap: 4px;
            width: 100%;
            overflow: hidden;
            box-sizing: border-box;
        }
        .top-app-bar::-webkit-scrollbar {
            display: none;
        }

        .app-bar-item {
            flex: 1 1 0;
            min-width: 0;
            height: clamp(58px, 16vw, 66px);
            background: rgba(255, 255, 255, 0.04);
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: clamp(10px, 3vw, 15px);
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            padding: 4px 2px;
            transition: all 0.2s ease;
            user-select: none;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
            box-sizing: border-box;
            overflow: hidden;
        }

        .app-bar-item:active {
            transform: scale(0.94);
            background: rgba(255, 255, 255, 0.09);
        }

        .app-bar-icon {
            width: clamp(26px, 7.5vw, 32px);
            height: clamp(26px, 7.5vw, 32px);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: clamp(0.8rem, 2.4vw, 0.95rem);
            margin-bottom: 2px;
            overflow: hidden;
            flex-shrink: 0;
        }
        .app-bar-icon img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: 50%;
        }

        .icon-profile {
            background: rgba(212, 160, 23, 0.15);
            border: 1.5px solid var(--gold);
            color: var(--gold);
        }

        .icon-radar {
            background: rgba(46, 204, 113, 0.15);
            border: 1.5px solid #2ecc71;
            color: #2ecc71;
            box-shadow: 0 0 8px rgba(46, 204, 113, 0.25);
        }

        .icon-stories {
            background: rgba(255, 45, 85, 0.15);
            border: 1.5px solid #ff2d55;
            color: #ff2d55;
        }

        .icon-groups {
            background: rgba(149, 165, 166, 0.15);
            border: 1.5px solid #95a5a6;
            color: #ecf0f1;
        }

        .icon-points {
            background: rgba(241, 196, 15, 0.15);
            border: 1.5px solid #f1c40f;
            color: #f1c40f;
        }

        .app-bar-label {
            font-size: clamp(0.58rem, 2.1vw, 0.68rem);
            font-weight: 700;
            color: #e0e0e0;
            text-align: center;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
            line-height: 1.1;
            padding: 0 2px;
            box-sizing: border-box;
            display: block;
        }
        
        .hdr-l {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .hdr-l i { color: var(--gold); font-size: 1.2rem; }
        
        .hdr-l span {
            font-size: 1.1rem;
            font-weight: 700;
            background: linear-gradient(135deg, var(--gold-light), var(--gold));
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
        }
        
        .hdr-r {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .hdr-badge {
            background: rgba(46,204,113,0.12);
            padding: 2px 8px;
            border-radius: 20px;
            font-size: 0.55rem;
            color: var(--success);
            border: 1px solid rgba(46,204,113,0.2);
        }
        
        .hdr-avatar {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            font-weight: 700;
            color: #0a1410;
            font-size: 0.8rem;
            cursor: pointer;
            border: 2px solid transparent;
            transition: var(--transition);
        }
        
        .hdr-avatar:active {
            border-color: var(--gold);
            transform: scale(0.95);
        }
        
        .hdr-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .page {
            flex: 1;
            overflow-y: auto;
            padding: 10px 12px;
            scroll-behavior: smooth;
            -webkit-overflow-scrolling: touch;
        }
        
        .page::-webkit-scrollbar { width: 3px; }
        .page::-webkit-scrollbar-thumb {
            background: rgba(212,160,23,0.2);
            border-radius: 10px;
        }
        
        .nav {
            background: rgba(8,18,14,0.98);
            border-top: 1px solid var(--border);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 6px 3px calc(6px + env(safe-area-inset-bottom, 0px));
            backdrop-filter: blur(30px);
            z-index: 20;
            flex-shrink: 0;
            min-height: 56px;
            width: 100%;
            box-sizing: border-box;
            overflow: hidden;
        }
        
        .nav button {
            flex: 1 1 0;
            min-width: 0;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 2px;
            background: none;
            border: none;
            color: var(--text2);
            font-size: clamp(0.92rem, 3.5vw, 1.15rem);
            cursor: pointer;
            padding: 4px 1px;
            border-radius: 20px;
            transition: var(--transition);
            font-family: 'Cairo', sans-serif;
            position: relative;
            box-sizing: border-box;
        }
        
        .nav button span { 
            font-size: clamp(0.56rem, 2vw, 0.68rem);
            font-weight: 600;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
            max-width: 100%;
            line-height: 1.1;
            display: block;
        }
        
        .nav button.active { color: var(--gold); }
        
        .nav button.active::before {
            content: '';
            position: absolute;
            top: -2px;
            width: 16px;
            height: 3px;
            background: var(--gold);
            border-radius: 3px;
        }
        
        .chat-top {
            display: flex;
            align-items: center;
            gap: 10px;
            padding: 10px;
            background: var(--surface);
            border-radius: var(--radius);
            margin-bottom: 8px;
            border: 1px solid var(--border);
        }
        
        .chat-top button {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            border: none;
            background: rgba(255,255,255,0.05);
            color: var(--text);
            cursor: pointer;
            font-size: 0.9rem;
        }
        
        .chat-av {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            flex-shrink: 0;
            border: 2px solid rgba(212,160,23,0.4);
            font-weight: 700;
            color: #0a1410;
            font-size: 0.9rem;
        }
        
        .chat-av img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .msgs {
            flex: 1;
            overflow-y: auto;
            display: flex;
            flex-direction: column;
            gap: 5px;
            margin-bottom: 8px;
            height: calc(var(--app-height) - 280px);
            max-height: calc(var(--app-height) - 280px);
            padding: 2px;
        }
        
        .msg {
            display: flex;
            max-width: 85%;
            animation: msgIn 0.25s ease;
        }
        
        @keyframes msgIn {
            from { opacity: 0; transform: translateY(8px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        .msg.me { align-self: flex-end; }
        .msg.you { align-self: flex-start; }
        
        .bubble {
            padding: 8px 12px;
            border-radius: 16px;
            font-size: 0.85rem;
            line-height: 1.5;
            word-break: break-word;
        }
        
        .me .bubble {
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            color: #0a1410;
            border-bottom-right-radius: 4px;
        }
        
        .you .bubble {
            background: var(--surface2);
            border: 1px solid var(--border);
            color: var(--text);
            border-bottom-left-radius: 4px;
        }
        
        .bubble img {
            max-width: 220px;
            max-height: 220px;
            border-radius: 12px;
            cursor: zoom-in;
            display: block;
            object-fit: cover;
        }
        
        .bubble audio {
            max-width: 220px;
            height: 32px;
            margin-top: 4px;
        }
        
        .bubble .tm {
            font-size: 0.5rem;
            opacity: 0.6;
            margin-top: 4px;
            text-align: left;
            direction: ltr;
        }
        
        .bubble .sn {
            font-size: 0.6rem;
            color: var(--gold);
            margin-bottom: 2px;
            font-weight: 600;
        }
        
        .date-sep {
            text-align: center;
            color: var(--text2);
            font-size: 0.65rem;
            margin: 8px 0;
            padding: 3px 10px;
            background: rgba(255,255,255,0.03);
            border-radius: 10px;
            display: inline-block;
            align-self: center;
        }
        
        .chat-bar {
            display: flex;
            gap: 5px;
            align-items: center;
            background: var(--surface);
            border-radius: 50px;
            padding: 5px 5px 5px 10px;
            border: 1px solid var(--border);
            min-height: 48px;
            margin-top: 5px;
        }
        
        .chat-bar input {
            flex: 1;
            background: transparent;
            border: none;
            padding: 8px 10px;
            color: var(--text);
            font-family: 'Cairo', sans-serif;
            font-size: 0.85rem;
            outline: none;
            min-width: 0;
        }
        
        .chat-bar input::placeholder {
            color: var(--text2);
            opacity: 0.6;
        }
        
        .chat-actions { display: flex; gap: 4px; }
        
        .chat-btn {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: 0.2s;
            flex-shrink: 0;
            font-size: 1rem;
        }
        
        .chat-btn:active { transform: scale(0.88); }
        
        .btn-img { background: rgba(79,195,247,0.15); color: #4fc3f7; }
        
        .btn-mic { background: rgba(239,83,80,0.15); color: #ef5350; }
        
        .btn-mic.rec {
            color: #ff1744;
            animation: micPulse 0.8s infinite;
            background: rgba(255,23,68,0.25);
        }
        
        @keyframes micPulse {
            0%, 100% { box-shadow: 0 0 0 0 rgba(255,23,68,0.6); }
            50% { box-shadow: 0 0 0 12px rgba(255,23,68,0); }
        }
        
        .btn-send {
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            color: #0a1410;
            box-shadow: 0 4px 12px rgba(212,160,23,0.3);
        }
        
        .rec-indicator {
            display: none;
            align-items: center;
            gap: 5px;
            padding: 6px 12px;
            background: var(--danger);
            border-radius: 20px;
            color: #fff;
            font-size: 0.75rem;
            animation: pulse 1s infinite;
            margin-bottom: 5px;
        }
        
        @keyframes pulse {
            0%, 100% { opacity: 1; }
            50% { opacity: 0.4; }
        }
        
        .rec-indicator.on { display: flex; }
        
        .img-viewer {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.96);
            z-index: 250;
            display: flex;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: 0.2s;
            padding: 10px;
        }
        
        .img-viewer.show { opacity: 1; pointer-events: all; }
        
        .img-viewer img {
            max-width: 95%;
            max-height: 85vh;
            border-radius: 12px;
            object-fit: contain;
            box-shadow: 0 20px 60px rgba(0,0,0,0.9);
            transform: scale(0.85);
            transition: 0.3s ease;
            cursor: zoom-out;
        }
        
        .img-viewer.show img { transform: scale(1); }
        
        .img-viewer .close {
            position: absolute;
            top: 16px;
            right: 16px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(0,0,0,0.7);
            border: 1px solid rgba(255,255,255,0.3);
            color: #fff;
            font-size: 24px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 5;
        }
        
        .sec-title {
            color: var(--gold);
            font-size: 0.95rem;
            margin-bottom: 12px;
            font-weight: 700;
        }
        
        .search-row {
            display: flex;
            gap: 8px;
            margin-bottom: 12px;
        }
        
        .search-row input {
            flex: 1;
            padding: 10px 15px;
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 25px;
            color: var(--text);
            font-family: 'Cairo', sans-serif;
            font-size: 0.85rem;
            outline: none;
        }
        
        .search-row input:focus { border-color: var(--gold); }
        
        .search-row button {
            padding: 10px 15px;
            background: var(--gold);
            border: none;
            border-radius: 25px;
            color: #0a1410;
            font-family: 'Cairo', sans-serif;
            cursor: pointer;
            font-weight: 600;
            font-size: 0.85rem;
        }
        
        .friend {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px;
            background: var(--surface);
            border-radius: var(--radius);
            margin-bottom: 6px;
            transition: var(--transition);
            border: 1px solid transparent;
        }
        
        .friend:active {
            transform: scale(0.98);
            background: var(--surface2);
        }
        
        .friend-info {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1;
            cursor: pointer;
        }
        
        .friend-av {
            width: 42px;
            height: 42px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            flex-shrink: 0;
            border: 2px solid rgba(212,160,23,0.3);
            font-weight: 700;
            color: #0a1410;
            font-size: 0.85rem;
        }
        
        .friend-av img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .friend-name {
            color: var(--text);
            font-weight: 600;
            font-size: 0.85rem;
        }
        
        .friend-status {
            font-size: 0.6rem;
            color: var(--text2);
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .dot {
            width: 7px;
            height: 7px;
            border-radius: 50%;
            display: inline-block;
        }
        
        .dot.on {
            background: var(--success);
            box-shadow: 0 0 8px rgba(46,204,113,0.6);
        }
        
        .dot.off { background: #666; }
        
        .btn-chat {
            padding: 8px 16px;
            border-radius: 20px;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 6px;
            font-size: 0.75rem;
            font-weight: 700;
            font-family: 'Cairo', sans-serif;
            background: var(--gold);
            color: #0a1410;
            transition: var(--transition);
            white-space: nowrap;
            box-shadow: 0 2px 8px rgba(212,160,23,0.3);
        }
        
        .btn-chat:active { transform: scale(0.95); }
        
        .radar-btn {
            width: 100%;
            padding: 14px;
            border-radius: 50px;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            border: none;


          color: #0a1410;
            font-family: 'Cairo', sans-serif;
            font-weight: 700;
            font-size: 0.95rem;
            cursor: pointer;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
        }
        
        .radar-modal {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.95);
            z-index: 200;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            opacity: 0;
            pointer-events: none;
            transition: 0.3s;
            padding: 20px;
        }
        
        .radar-modal.show { opacity: 1; pointer-events: all; }
        
        .radar-container {
            position: relative;
            width: 300px;
            height: 300px;
            margin-bottom: 20px;
        }
        
        .radar-circle {
            position: absolute;
            inset: 0;
            border-radius: 50%;
            border: 3px solid rgba(212,160,23,0.4);
            background: radial-gradient(circle, rgba(20,40,30,0.8) 0%, rgba(5,15,10,0.95) 70%);
            box-shadow: 0 0 60px rgba(212,160,23,0.3), inset 0 0 60px rgba(0,0,0,0.5);
            overflow: hidden;
        }
        
        .radar-sweep {
            position: absolute;
            top: 50%;
            left: 50%;
            width: 2px;
            height: 50%;
            background: linear-gradient(180deg, rgba(212,160,23,0.9), rgba(212,160,23,0.1));
            transform-origin: top center;
            animation: radarSweep 3s linear infinite;
            box-shadow: 0 0 20px rgba(212,160,23,0.5);
        }
        
        @keyframes radarSweep { 100% { transform: rotate(360deg); } }
        
        .radar-center {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 16px;
            height: 16px;
            background: var(--gold);
            border-radius: 50%;
            box-shadow: 0 0 25px rgba(212,160,23,0.9), 0 0 50px rgba(212,160,23,0.5);
            z-index: 3;
        }
        
        .radar-ring {
            position: absolute;
            inset: 20%;
            border-radius: 50%;
            border: 1px solid rgba(212,160,23,0.15);
        }
        
        .radar-ring:nth-child(4) { inset: 40%; }
        .radar-ring:nth-child(5) { inset: 60%; }
        
        .radar-dot {
            position: absolute;
            width: 10px;
            height: 10px;
            background: var(--success);
            border-radius: 50%;
            box-shadow: 0 0 15px rgba(46,204,113,0.9);
            animation: radarBlink 1.5s ease-in-out infinite;
            cursor: pointer;
            transition: 0.3s;
            z-index: 4;
        }
        
        .radar-dot:hover { transform: scale(2.5); z-index: 5; }
        
        @keyframes radarBlink {
            0%, 100% { opacity: 1; box-shadow: 0 0 15px rgba(46,204,113,0.9); }
            50% { opacity: 0.3; box-shadow: 0 0 30px rgba(46,204,113,1); }
        }
        
        .radar-dot-label {
            position: absolute;
            top: -22px;
            left: 50%;
            transform: translateX(-50%);
            color: var(--text);
            font-size: 0.6rem;
            white-space: nowrap;
            background: rgba(0,0,0,0.85);
            padding: 3px 8px;
            border-radius: 10px;
            pointer-events: none;
            opacity: 0;
            transition: 0.3s;
        }
        
        .radar-dot:hover .radar-dot-label { opacity: 1; }
        
        .radar-close {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background: rgba(255,255,255,0.1);
            border: 1px solid rgba(255,255,255,0.2);
            color: #fff;
            font-size: 22px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 5;
            transition: 0.3s;
        }
        
        .radar-close:hover {
            background: rgba(231,76,60,0.3);
            border-color: var(--danger);
        }
        
        .radar-users-list {
            width: 90%;
            max-width: 400px;
            max-height: 300px;
            overflow-y: auto;
        }
        
        .radar-user-card {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px;
            background: var(--surface);
            border-radius: var(--radius);
            margin-bottom: 6px;
            border: 1px solid var(--border);
        }
        
        .radar-user-info {
            display: flex;
            align-items: center;
            gap: 10px;
            flex: 1;
        }
        
        .radar-user-av {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            font-weight: 700;
            color: #0a1410;
            font-size: 0.75rem;
            flex-shrink: 0;
        }
        
        .radar-user-av img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .btn-add-sm {
            background: var(--success);
            border: none;
            padding: 6px 14px;
            border-radius: 20px;
            color: #fff;
            font-family: 'Cairo', sans-serif;
            font-weight: 600;
            cursor: pointer;
            font-size: 0.68rem;
            transition: 0.2s;
        }
        
        .btn-add-sm:active { transform: scale(0.9); }
        .btn-add-sm.added { background: #555; pointer-events: none; }
        
        .story-add-btn {
            width: 100%;
            padding: 14px;
            border-radius: 50px;
            background: linear-gradient(135deg, var(--purple), #8e44ad);
            border: none;
            color: #fff;
            font-family: 'Cairo', sans-serif;
            font-weight: 700;
            cursor: pointer;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-size: 0.95rem;
        }
        
        .story-list { display: flex; flex-direction: column; gap: 8px; }
        
        .story-card {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            background: var(--surface);
            border-radius: var(--radius);
            cursor: pointer;
            transition: 0.2s;
            border: 1px solid transparent;
        }
        
        .story-card:hover {
            border-color: var(--border);
            background: var(--surface2);
        }
        
        .story-ring {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            padding: 3px;
            background: linear-gradient(45deg, #f093fb, #f5576c, #fda085, #f6d365);
            flex-shrink: 0;
        }
        
        .story-ring-inner {
            width: 100%;
            height: 100%;
            border-radius: 50%;
            background: var(--surface2);
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
        }
        
        .story-ring-inner img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .story-viewer {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.97);
            z-index: 220;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            opacity: 0;
            pointer-events: none;
            transition: 0.3s;
            padding: 20px;
        }
        
        .story-viewer.show { opacity: 1; pointer-events: all; }
        
        .story-viewer-close {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(255,255,255,0.1);
            border: 1px solid rgba(255,255,255,0.3);
            color: #fff;
            font-size: 22px;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 5;
        }
        
        .story-viewer img {
            max-width: 90%;
            max-height: 50vh;
            border-radius: 16px;
            margin-bottom: 20px;
            object-fit: contain;
            box-shadow: 0 20px 60px rgba(0,0,0,0.8);
        }
        
        .story-viewer-user {
            font-size: 1rem;
            font-weight: 700;
            color: #FFFFFF;
            margin-bottom: 16px;
        }
        
        .story-viewer-caption {
            color: #FFFFFF;
            font-size: 0.9rem;
            margin-bottom: 16px;
            text-align: center;
            max-width: 80%;
        }
        
        .story-viewer-stats {
            display: flex;
            gap: 24px;
            color: #FFFFFF;
            font-size: 0.8rem;
            margin-bottom: 20px;
        }
        
        .story-viewer-stats i { margin-left: 6px; }
        
        .story-viewer-actions {
            display: flex;
            gap: 12px;
            margin-bottom: 20px;
        }
        
        .story-btn {
            padding: 10px 24px;
            border-radius: 25px;
            border: none;
            cursor: pointer;
            font-family: 'Cairo', sans-serif;
            font-weight: 600;
            font-size: 0.85rem;
            transition: 0.2s;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        
        .story-btn:active { transform: scale(0.94); }
        
        .story-btn-like {
            background: linear-gradient(135deg, var(--danger), #e74c3c);
            color: #fff;
        }
        
        .story-btn-like.liked { background: #555; }
        
        .story-replies {
            width: 90%;
            max-width: 400px;
            max-height: 200px;
            overflow-y: auto;
            margin-top: 16px;
        }
        
        .story-reply {
            background: var(--surface);
            padding: 10px 14px;
            border-radius: 12px;
            margin-bottom: 6px;
            font-size: 0.78rem;
            border: 1px solid var(--border);
        }
        
        .story-reply-user {
            color: #FFFFFF;
            font-weight: 600;
            font-size: 0.7rem;
        }
        
        .story-reply-form {
            display: flex;
            gap: 6px;
            margin-top: 12px;
            width: 90%;
            max-width: 400px;
        }
        
        .story-reply-form input {
            flex: 1;
            padding: 10px 14px;
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 25px;
            color: var(--text);
            font-family: 'Cairo', sans-serif;
            font-size: 0.8rem;
            outline: none;
        }
        
        .story-reply-form input:focus { border-color: var(--gold); }
        
        .story-reply-form button {
            padding: 10px 16px;
            background: var(--gold);
            border: none;
            border-radius: 25px;
            color: #0a1410;
            font-family: 'Cairo', sans-serif;
            font-weight: 600;
            cursor: pointer;
            font-size: 0.8rem;
        }
        
        .toast {
            position: fixed;
            top: 15px;
            left: 50%;
            transform: translateX(-50%);
            background: var(--surface);
            border: 1px solid var(--border);
            padding: 10px 20px;
            border-radius: 25px;
            color: var(--text);
            z-index: 300;
            font-size: 0.8rem;
            box-shadow: var(--shadow-lg);
            animation: toastIn 0.35s ease;
        }
        
        @keyframes toastIn {
            from { opacity: 0; transform: translateX(-50%) translateY(-15px); }
            to { opacity: 1; transform: translateX(-50%) translateY(0); }
        }
        
        .btn-logout {
            width: 100%;
            padding: 14px;
            border-radius: 50px;
            background: linear-gradient(135deg, var(--danger), #c0392b);
            color: #fff;
            border: none;
            font-family: 'Cairo', sans-serif;
            font-weight: 700;
            font-size: 0.95rem;
            cursor: pointer;
            margin-top: 10px;
        }
        
        .loading-overlay {
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.85);
            z-index: 999;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            gap: 20px;
        }
        
        .loading-spinner {
            width: 50px;
            height: 50px;
            border: 4px solid rgba(212,160,23,0.2);
            border-top-color: var(--gold);
            border-radius: 50%;
            animation: spin 0.8s linear infinite;
        }
        
        @keyframes spin { to { transform: rotate(360deg); } }
        
        .loading-text {
            color: var(--gold);
            font-size: 0.9rem;
            font-weight: 600;
        }
        
        .profile-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 20px;
            margin-bottom: 15px;
            text-align: center;
        }
        
        .profile-avatar-large {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            display: flex;
            align-items: center;
            justify-content: center;
            overflow: hidden;
            margin: 0 auto 10px;
            border: 3px solid rgba(212,160,23,0.5);
            font-weight: 700;
            color: #0a1410;
            font-size: 1.8rem;
            cursor: pointer;
            position: relative;
        }
        
        .profile-avatar-large img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .profile-avatar-large:hover::after {
            content: '📷 تغيير';
            position: absolute;
            inset: 0;
            background: rgba(0,0,0,0.8);
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.7rem;
            border-radius: 50%;
        }
        
        .profile-name {
            font-size: 1.2rem;
            font-weight: 700;
            color: var(--text);
            margin-bottom: 4px;
        }
        
        .profile-detail {
            color: var(--text2);
            font-size: 0.8rem;
            margin-bottom: 2px;
        }
        
        .profile-info-section {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            overflow: hidden;
            margin-bottom: 15px;
        }
        
        .profile-info-header {
            padding: 12px 15px;
            border-bottom: 1px solid var(--border);
            color: var(--gold);
            font-weight: 600;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .profile-info-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 15px;
            border-bottom: 1px solid rgba(255,255,255,0.02);
        }
        
        .profile-info-row:last-child { border-bottom: none; }
        
        .profile-label { color: var(--text2); font-size: 0.78rem; }
        
        .profile-value {
            color: var(--text);
            font-weight: 500;
            font-size: 0.82rem;
            direction: ltr;
        }
        
        .settings-section {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            overflow: hidden;
            margin-bottom: 15px;
        }
        
        .settings-header {
            padding: 12px 15px;
            border-bottom: 1px solid var(--border);
            color: var(--gold);
            font-weight: 600;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .settings-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 12px 15px;
            cursor: pointer;
            transition: var(--transition);
            border-bottom: 1px solid rgba(255,255,255,0.02);
        }
        
        .settings-row:last-child { border-bottom: none; }
        .settings-row:active { background: rgba(255,255,255,0.02); }
        
        .settings-row-left {
            display: flex;
            align-items: center;
            gap: 12px;
            color: var(--text);
            font-size: 0.85rem;
        }
        
        .settings-row-left i {
            color: var(--gold);
            width: 20px;
            text-align: center;
        }
        
        .settings-row-right {
            color: var(--text2);
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .toggle-switch {
            width: 46px;
            height: 24px;
            background: #444;
            border-radius: 26px;
            position: relative;
            cursor: pointer;
            transition: var(--transition);
            flex-shrink: 0;
        }
        
        .toggle-switch.on { background: var(--success); }
        
        .toggle-switch::after {
            content: '';
            width: 20px;
            height: 20px;
            background: #fff;
            border-radius: 50%;
            position: absolute;
            top: 2px;
            right: 2px;
            transition: var(--transition);
        }
        
        .toggle-switch.on::after { right: 24px; }
        
        .contacts-loading {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 10px;
            padding: 30px;
            color: var(--text2);
        }
        
        .loading-dots { display: flex; gap: 4px; }
        
        .loading-dots span {
            width: 6px;
            height: 6px;
            background: var(--gold);
            border-radius: 50%;
            animation: dotBounce 1.4s infinite;
        }
        
        .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
        .loading-dots span:nth-child(3) { animation-delay: 0.4s; }
        
        @keyframes dotBounce {
            0%, 80%, 100% { transform: translateY(0); }
            40% { transform: translateY(-10px); }
        }
        
        .btn-remove-friend {
            width: 38px;
            height: 38px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.9rem;
            background: var(--danger);
            color: #fff;
            transition: var(--transition);
            margin-right: 6px;
        }
        
        .btn-remove-friend:active { transform: scale(0.9); }
        
        .friend-actions {
            display: flex;
            gap: 6px;
            align-items: center;
        }

        /* Call UI Styles */
        .call-overlay {
            position: fixed;
            inset: 0;
            background: rgba(8,14,12,0.98);
            z-index: 500;
            display: none;
            flex-direction: column;
            align-items: center;
            justify-content: space-between;
            padding: 40px 20px;
            color: #fff;
            font-family: 'Cairo', sans-serif;
        }
        .call-overlay.active {
            display: flex;
        }
        #remoteVideo {
            position: absolute;
            inset: 0;
            width: 100%;
            height: 100%;
            object-fit: cover;
            z-index: 1;
            background: #080e0c;
        }
        #localVideo {
            position: absolute;
            top: 20px;
            right: 20px;
            width: 100px;
            height: 150px;
            object-fit: cover;
            z-index: 2;
            border-radius: 12px;
            border: 2px solid var(--gold);
            background: #111c18;
            box-shadow: var(--shadow);
            transition: all 0.3s ease;
        }
        .call-info {
            position: relative;
            z-index: 2;
            display: flex;
            flex-direction: column;
            align-items: center;
            margin-top: 60px;
            text-shadow: 0 2px 10px rgba(0,0,0,0.8);
        }
        .call-avatar {
            width: 100px;
            height: 100px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            font-weight: 700;
            color: #0a1410;
            border: 4px solid rgba(212,160,23,0.5);
            margin-bottom: 15px;
            overflow: hidden;
            box-shadow: var(--shadow-lg);
        }
        .call-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .call-timer {
            font-size: 1.2rem;
            font-weight: 600;
            color: var(--gold);
            margin-top: 5px;
            background: rgba(0,0,0,0.6);
            padding: 2px 12px;
            border-radius: 20px;
            display: none;
        }
        .call-controls {
            position: relative;
            z-index: 2;
            display: flex;
            gap: 20px;
            margin-bottom: 30px;
        }
        .btn-call-control {
            width: 56px;
            height: 56px;
            border-radius: 50%;
            border: none;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.4rem;
            background: rgba(255,255,255,0.1);
            color: #fff;
            border: 1px solid rgba(255,255,255,0.2);
            transition: all 0.25s ease;
            backdrop-filter: blur(10px);
        }
        .btn-call-control:active {
            transform: scale(0.9);
        }
        .btn-call-control.off {
            background: rgba(231,76,60,0.2);
            color: var(--danger);
            border-color: var(--danger);
        }
        .btn-call-control.btn-hangup {
            background: var(--danger);
            color: #fff;
            border: none;
            box-shadow: 0 4px 15px rgba(231,76,60,0.4);
        }
        
        /* Incoming call UI */
        .incoming-call-overlay {
            position: fixed;
            inset: 0;
            background: rgba(8,14,12,0.9);
            z-index: 499;
            display: none;
            align-items: center;
            justify-content: center;
            padding: 20px;
            backdrop-filter: blur(15px);
        }
        .incoming-call-overlay.active {
            display: flex;
        }
        .incoming-call-card {
            width: 100%;
            max-width: 320px;
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 30px 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            box-shadow: var(--shadow-lg);
            text-align: center;
            animation: msgIn 0.3s ease;
        }
        .incoming-avatar {
            width: 80px;
            height: 80px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2rem;
            font-weight: 700;
            color: #0a1410;
            border: 3px solid rgba(212,160,23,0.4);
            margin-bottom: 15px;
            overflow: hidden;
        }
        .incoming-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        .incoming-actions {
            display: flex;
            gap: 15px;
            width: 100%;
            margin-top: 25px;
        }
        .incoming-btn {
            flex: 1;
            padding: 12px;
            border-radius: 25px;
            border: none;
            font-family: 'Cairo', sans-serif;
            font-weight: 700;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            font-size: 0.9rem;
            transition: all 0.2s ease;
        }
        .incoming-btn:active {
            transform: scale(0.96);
        }
        .incoming-btn.accept {
            background: var(--success);
            color: #fff;
            box-shadow: 0 4px 12px rgba(46,204,113,0.3);
        }
        .incoming-btn.decline {
            background: var(--danger);
            color: #fff;
            box-shadow: 0 4px 12px rgba(231,76,60,0.3);
        }
        
        .btn-add-chat {
            background: var(--gold);
            color: #000 !important;
            border: none;
            padding: 4px 8px;
            border-radius: 8px;
            font-family: 'Cairo', sans-serif;
            font-size: 0.65rem;
            font-weight: bold;
            cursor: pointer;
            margin-right: 8px;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }
        .btn-add-chat:active { transform: scale(0.95); }

        .chat-btn-call {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            border: none;
            background: rgba(255,255,255,0.05);
            color: var(--gold);
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: var(--transition);
        }
        .chat-btn-call:active {
            transform: scale(0.9);
            background: rgba(255,255,255,0.1);
        }


        .read-status {
            font-size: 0.7rem;
            color: var(--text2);
            margin-right: 4px;
            vertical-align: middle;
            opacity: 0.6;
        }
        .read-status.read {
            color: var(--gold) !important;
            opacity: 1;
        }


        /* Groups UI Styles */
        .group-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 15px;
            margin-bottom: 12px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: var(--transition);
        }
        .group-card:active {
            transform: scale(0.99);
        }
        .group-info {
            display: flex;
            gap: 12px;
            align-items: center;
            flex: 1;
            cursor: pointer;
        }
        .group-av {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            background: linear-gradient(135deg, var(--gold), var(--gold-dark));
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
            font-size: 1.2rem;
            color: #0a1410;
        }
        .group-details {
            display: flex;
            flex-direction: column;
            gap: 2px;
        }
        .group-name {
            font-weight: 700;
            color: var(--text);
            font-size: 0.9rem;
        }
        .group-desc {
            font-size: 0.7rem;
            color: var(--text2);
        }
        .group-badge {
            font-size: 0.6rem;
            padding: 2px 6px;
            border-radius: 10px;
            font-weight: bold;
            display: inline-block;
            margin-top: 3px;
            width: fit-content;
        }
        .group-badge.public { background: rgba(46,204,113,0.15); color: var(--success); }
        .group-badge.private { background: rgba(231,76,60,0.15); color: var(--danger); }
        .group-badge.channel { background: rgba(155,89,182,0.15); color: #9b59b6; }
        
        .groups-tabs {
            display: flex;
            gap: 8px;
            margin-bottom: 15px;
        }
        .groups-tabs button {
            flex: 1;
            padding: 8px;
            border-radius: 20px;
            border: 1px solid var(--border);
            background: var(--surface);
            color: var(--text2);
            font-family: 'Cairo', sans-serif;
            font-weight: 600;
            font-size: 0.75rem;
            cursor: pointer;
            transition: var(--transition);
        }
        .groups-tabs button.active {
            background: var(--gold);
            color: #000;
            border-color: var(--gold);
        }
        
        /* Create group form style */
        .group-form {
            display: flex;
            flex-direction: column;
            gap: 15px;
            background: var(--surface);
            padding: 20px;
            border-radius: var(--radius);
            border: 1px solid var(--border);
            margin-bottom: 20px;
        }
        .group-form input, .group-form textarea, .group-form select {
            background: var(--surface2);
            border: 1px solid var(--border);
            color: var(--text);
            padding: 10px;
            border-radius: 8px;
            font-family: 'Cairo', sans-serif;
            font-size: 0.85rem;
        }
        .group-form select {
            cursor: pointer;
        }
        
        .group-chat-top {
            display: flex;
            align-items: center;
            gap: 10px;
            border-bottom: 1px solid var(--border);
            padding: 12px 16px;
            background: var(--surface);
        }
        .group-chat-top button {
            background: transparent;
            border: none;
            color: var(--text);
            font-size: 1.1rem;
            cursor: pointer;
        }
        
        /* Management UI styles */
        .member-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            background: var(--surface2);
            padding: 10px 14px;
            border-radius: 10px;
            margin-bottom: 8px;
            font-size: 0.8rem;
            color: var(--text);
            border: 1px solid var(--border);
        }
        .member-row span {
            color: var(--text);
        }
        .member-row button {
            background: var(--danger);
            color: #fff;
            border: none;
            border-radius: 6px;
            padding: 4px 10px;
            cursor: pointer;
            font-family: 'Cairo', sans-serif;
            font-size: 0.7rem;
            font-weight: 600;
            transition: var(--transition);
        }
        .member-row button:active {
            transform: scale(0.95);
        }
        .btn-msg-del {
            background: transparent;
            border: none;
            color: var(--danger);
            cursor: pointer;
            font-size: 0.65rem;
            margin-right: 8px;
            opacity: 0.6;
            transition: opacity 0.2s;
        }
        .btn-msg-del:hover {
            opacity: 1;
        }


        .radar-locked-card {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 30px 20px;
            text-align: center;
            max-width: 320px;
            margin: 40px auto;
            box-shadow: var(--shadow-lg);
            animation: msgIn 0.3s ease;
            font-family: 'Cairo', sans-serif;
        }

        .offline-banner {
            background: var(--danger);
            color: #fff;
            text-align: center;
            padding: 6px 12px;
            font-size: 0.75rem;
            font-weight: bold;
            position: sticky;
            top: 0;
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
            animation: slideDown 0.3s ease;
            font-family: 'Cairo', sans-serif;
        }
        @keyframes slideDown {
            from { transform: translateY(-100%); }
            to { transform: translateY(0); }
        }

        /* Skeleton Loaders */
        .skeleton-list {
            padding: 10px 0;
        }
        .skeleton-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            background: var(--surface2);
            border-radius: var(--radius);
            margin-bottom: 8px;
            position: relative;
            overflow: hidden;
        }
        .skeleton-avatar {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: rgba(255,255,255,0.05);
        }
        .skeleton-text-wrap {
            display: flex;
            flex-direction: column;
            gap: 8px;
            flex: 1;
        }
        .skeleton-line {
            height: 10px;
            border-radius: 4px;
            background: rgba(255,255,255,0.05);
        }
        .skeleton-line.short { width: 35%; }
        .skeleton-line.long { width: 75%; }
        .skeleton-item::after {
            content: "";
            position: absolute;
            top: 0; right: 0; bottom: 0; left: 0;
            transform: translateX(-100%);
            background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
            animation: shimmer 1.6s infinite;
        }
        @keyframes shimmer {
            100% { transform: translateX(100%); }
        }

        /* Audio Waveforms */
        .voice-player {
            display: flex;
            align-items: center;
            gap: 12px;
            background: rgba(255,255,255,0.06);
            padding: 8px 16px;
            border-radius: 24px;
            min-width: 210px;
            cursor: pointer;
            user-select: none;
            transition: background 0.2s;
            margin: 4px 0;
        }
        .voice-player:hover {
            background: rgba(255,255,255,0.1);
        }
        .voice-player .play-btn {
            background: var(--gold);
            border: none;
            width: 30px;
            height: 30px;
            border-radius: 50%;
            color: #fff;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.8rem;
            cursor: pointer;
            transition: transform 0.1s;
        }
        .voice-player .play-btn:active {
            transform: scale(0.9);
        }
        .voice-player .waveform-bars {
            display: flex;
            align-items: center;
            gap: 3px;
            height: 24px;
            flex: 1;
        }
        .voice-player .waveform-bars span {
            display: block;
            width: 3px;
            background: rgba(255,255,255,0.22);
            border-radius: 1.5px;
            transition: background 0.15s, height 0.15s;
        }
        .voice-player .waveform-bars span:nth-child(odd) { height: 10px; }
        .voice-player .waveform-bars span:nth-child(even) { height: 16px; }
        .voice-player .waveform-bars span:nth-child(3n) { height: 8px; }
        .voice-player .waveform-bars span:nth-child(4n) { height: 22px; }

        .voice-player.playing .waveform-bars span {
            background: var(--gold);
            animation: bounce 0.6s ease infinite alternate;
        }
        .voice-player.playing .waveform-bars span:nth-child(2) { animation-delay: 0.1s; }
        .voice-player.playing .waveform-bars span:nth-child(3) { animation-delay: 0.2s; }
        .voice-player.playing .waveform-bars span:nth-child(4) { animation-delay: 0.3s; }
        .voice-player.playing .waveform-bars span:nth-child(5) { animation-delay: 0.4s; }
        .voice-player.playing .waveform-bars span:nth-child(6) { animation-delay: 0.15s; }
        .voice-player.playing .waveform-bars span:nth-child(7) { animation-delay: 0.25s; }
        .voice-player.playing .waveform-bars span:nth-child(8) { animation-delay: 0.35s; }

        @keyframes bounce {
            from { transform: scaleY(0.4); }
            to { transform: scaleY(1.3); }
        }
        .voice-player .audio-duration {
            font-size: 0.7rem;
            color: var(--text2);
            font-family: monospace;
        }

        /* Admin Dashboard styles */
        .admin-card {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: var(--radius);
            padding: 16px;
            margin-bottom: 12px;
            box-shadow: var(--shadow);
            font-family: 'Cairo', sans-serif;
            animation: msgIn 0.3s ease;
        }
        .admin-card-header {
            font-size: 0.75rem;
            color: var(--text2);
            margin-bottom: 8px;
            border-bottom: 1px solid var(--border);
            padding-bottom: 6px;
        }
        .admin-card-content {
            background: rgba(0,0,0,0.2);
            padding: 10px;
            border-radius: 8px;
            font-size: 0.8rem;
            margin-bottom: 10px;
            word-break: break-all;
        }
        .admin-card-actions {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        .btn-admin-sm {
            font-family: 'Cairo', sans-serif;
            font-size: 0.7rem;
            padding: 6px 10px;
            border-radius: 8px;
            border: none;
            font-weight: bold;
            cursor: pointer;
            display: inline-flex;
            align-items: center;
            gap: 4px;
        }
        .btn-admin-sm.del { background: var(--danger); color: #fff; }
        .btn-admin-sm.ban { background: var(--warning); color: #333; }
        .btn-admin-sm.ok { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

        /* ============ GAMES STYLES ============ */
        
        /* Game Select Grid */
        .game-select-grid {
            display: grid;
            grid-template-columns: 1fr;
            gap: 12px;
        }
        .game-select-card {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 16px;
            text-align: center;
            cursor: pointer;
            transition: var(--transition);
            display: flex;
            align-items: center;
            gap: 14px;
        }
        .game-select-card:active {
            transform: scale(0.97);
            border-color: var(--gold);
        }
        .game-select-icon {
            font-size: 2rem;
            min-width: 50px;
        }
        .game-select-name {
            color: var(--gold);
            font-weight: 700;
            font-size: 1rem;
        }
        .game-select-desc {
            color: var(--text2);
            font-size: 0.7rem;
            margin-top: 2px;
        }
        
        /* Game Container */
        .game-container {
            width: 100%;
            max-width: 400px;
            margin: 0 auto;
            padding: 10px;
            box-sizing: border-box;
        }
        
        /* Game Header */
        .game-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 12px;
            padding: 8px 0;
        }
        .game-close-btn {
            background: rgba(255,59,48,0.2);
            color: var(--danger);
            border: none;
            border-radius: 50%;
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 1rem;
        }
        .game-title {
            color: var(--gold);
            font-weight: 700;
            font-size: 1.1rem;
        }
        .game-turn-indicator {
            font-size: 0.75rem;
            font-weight: 600;
            padding: 4px 10px;
            border-radius: 12px;
        }
        .game-turn-indicator.my-turn {
            background: rgba(52,199,89,0.2);
            color: var(--success);
        }
        .game-turn-indicator.op-turn {
            background: rgba(255,59,48,0.15);
            color: var(--danger);
        }
        
        /* Game Players */
        .game-players {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 10px 14px;
            margin-bottom: 16px;
        }
        .game-player {
            text-align: center;
            opacity: 0.6;
            transition: var(--transition);
        }
        .game-player.active {
            opacity: 1;
        }
        .game-player-name {
            display: block;
            color: var(--text);
            font-size: 0.75rem;
            font-weight: 600;
        }
        .game-player-score {
            display: block;
            color: var(--gold);
            font-size: 1.2rem;
            font-weight: 800;
        }
        .game-vs {
            color: var(--text2);
            font-weight: 800;
            font-size: 0.85rem;
        }
        
        /* XO Board */
        .xo-board {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 8px;
            max-width: 280px;
            margin: 20px auto;
        }
        .xo-cell {
            aspect-ratio: 1;
            background: var(--surface2);
            border: 2px solid var(--border);
            border-radius: 14px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 2.5rem;
            transition: all 0.2s ease;
            user-select: none;
        }
        .xo-cell.clickable {
            cursor: pointer;
            border-color: rgba(212,160,23,0.3);
        }
        .xo-cell.clickable:active {
            background: rgba(212,160,23,0.15);
            transform: scale(0.95);
        }
        .xo-cell.filled {
            animation: xoPop 0.3s ease;
        }
        @keyframes xoPop {
            0% { transform: scale(0.5); opacity: 0; }
            70% { transform: scale(1.1); }
            100% { transform: scale(1); opacity: 1; }
        }
        
        /* Domino Styles */
        .domino-info {
            display: flex;
            justify-content: space-around;
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 8px;
            margin-bottom: 12px;
            font-size: 0.7rem;
            color: var(--text2);
        }
        .domino-board-area {
            background: rgba(0,80,40,0.3);
            border: 2px solid rgba(0,100,50,0.4);
            border-radius: 14px;
            padding: 16px;
            min-height: 80px;
            margin-bottom: 14px;
            overflow-x: auto;
        }
        .domino-board {
            display: flex;
            align-items: center;
            gap: 4px;
            flex-wrap: wrap;
            justify-content: center;
        }
        .domino-empty {
            text-align: center;
            color: var(--text2);
            font-size: 0.8rem;
            padding: 20px;
        }
        .domino-tile {
            background: var(--surface);
            border: 2px solid var(--border);
            border-radius: 8px;
            padding: 8px 6px;
            display: inline-flex;
            align-items: center;
            gap: 4px;
            font-size: 1rem;
            font-weight: 700;
            color: var(--text);
            min-width: 48px;
            justify-content: center;
            user-select: none;
        }
        .domino-tile.on-board {
            background: #f5f0e1;
            color: #1a1a1a;
            border-color: #c9b87c;
            font-size: 0.85rem;
        }
        .domino-tile.in-hand.playable {
            cursor: pointer;
            border-color: var(--gold);
            box-shadow: 0 0 8px rgba(212,160,23,0.3);
        }
        .domino-tile.in-hand.playable:active {
            transform: scale(0.95);
            background: rgba(212,160,23,0.15);
        }
        .domino-tile.disabled {
            opacity: 0.4;
        }
        .domino-div {
            width: 2px;
            height: 20px;
            background: var(--border);
            margin: 0 2px;
        }
        .domino-tile.on-board .domino-div {
            background: #999;
        }
        .domino-hand-label, .cards-floor-label, .cards-hand-label {
            color: var(--text2);
            font-size: 0.7rem;
            margin-bottom: 6px;
            font-weight: 600;
        }
        .domino-hand {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            justify-content: center;
            margin-bottom: 12px;
        }
        .domino-draw-btn {
            display: block;
            width: 90%;
            margin: 8px auto;
            background: var(--surface2) !important;
            color: var(--text) !important;
            border: 1px solid var(--border) !important;
        }
        .domino-side-picker {
            position: fixed;
            bottom: 60px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 10px;
            background: var(--surface);
            padding: 12px 20px;
            border-radius: 14px;
            border: 1px solid var(--gold);
            box-shadow: 0 4px 20px rgba(0,0,0,0.5);
            z-index: 600;
        }
        
        /* Cards (Basra) Styles */
        .cards-info {
            display: flex;
            justify-content: space-around;
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 10px;
            padding: 8px;
            margin-bottom: 12px;
            font-size: 0.65rem;
            color: var(--text2);
            flex-wrap: wrap;
            gap: 4px;
        }
        .cards-floor {
            background: rgba(0,80,40,0.25);
            border: 2px solid rgba(0,100,50,0.3);
            border-radius: 14px;
            padding: 14px;
            min-height: 70px;
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            justify-content: center;
            align-items: center;
            margin-bottom: 14px;
        }
        .cards-empty-floor {
            color: var(--text2);
            font-size: 0.75rem;
        }
        .cards-hand {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: center;
            margin-bottom: 12px;
        }
        .playing-card {
            background: #fff;
            border: 2px solid #ddd;
            border-radius: 10px;
            padding: 10px 8px;
            min-width: 50px;
            min-height: 65px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
            font-weight: 700;
            box-shadow: 0 2px 6px rgba(0,0,0,0.2);
            user-select: none;
            transition: var(--transition);
        }
        .playing-card.hand-card.playable {
            cursor: pointer;
            border-color: var(--gold);
        }
        .playing-card.hand-card.playable:active {
            transform: translateY(-8px) scale(1.05);
            box-shadow: 0 6px 16px rgba(212,160,23,0.4);
        }
        .playing-card.floor-card {
            transform: rotate(-2deg);
        }
        .card-red { color: #d32f2f; }
        .card-black { color: #1a1a1a; }
        
        /* Game Invite in Chat */
        .game-invite-card {
            background: linear-gradient(135deg, rgba(212,160,23,0.15), rgba(212,160,23,0.05));
            border: 1px solid rgba(212,160,23,0.3);
            border-radius: 14px;
            padding: 14px;
            text-align: center;
            min-width: 180px;
        }
        .game-invite-icon {
            font-size: 2rem;
            margin-bottom: 6px;
        }
        .game-invite-text {
            color: var(--gold);
            font-weight: 700;
            font-size: 0.9rem;
        }
        .game-invite-sub {
            color: var(--text2);
            font-size: 0.7rem;
            margin: 4px 0 10px;
        }
        .game-invite-accept, .game-invite-join {
            background: var(--gold) !important;
            color: #000 !important;
            font-weight: 700 !important;
            padding: 6px 16px !important;
            border-radius: 10px !important;
            font-size: 0.75rem !important;
            border: none !important;
            cursor: pointer;
        }
        
        /* Game Result */
        .game-result {
            text-align: center;
            padding: 30px 20px;
        }
        .game-result-icon {
            font-size: 4rem;
            margin-bottom: 10px;
            animation: xoPop 0.5s ease;
        }
        .game-result-text {
            color: var(--gold);
            font-size: 1.3rem;
            font-weight: 800;
            margin-bottom: 6px;
        }
        .game-result-sub {
            color: var(--text2);
            font-size: 0.75rem;
            margin-bottom: 10px;
        }
        .game-result-score {
            color: var(--text);
            font-size: 2rem;
            font-weight: 800;
            margin: 16px 0;
            letter-spacing: 4px;
        }
        .game-result-actions {
            display: flex;
            gap: 10px;
            justify-content: center;
            margin-top: 16px;
        }

        /* Game Waiting Screen */
        .game-waiting-screen {
            text-align: center;
            padding: 50px 20px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            gap: 16px;
        }
        .game-waiting-icon {
            font-size: 4rem;
            animation: rotateHourglass 2s infinite ease-in-out;
        }
        .game-waiting-title {
            color: var(--gold);
            font-size: 1.2rem;
            font-weight: 700;
        }
        .game-waiting-sub {
            color: var(--text2);
            font-size: 0.85rem;
        }
        @keyframes rotateHourglass {
            0% { transform: rotate(0deg); }
            50% { transform: rotate(180deg); }
            100% { transform: rotate(360deg); }
        }

        /* ============ CHAT REACTIONS, REPLIES, CONTEXT MENU ============ */
        
        /* Context Menu Popover */
        .msg-context-menu {
            position: absolute;
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 16px;
            padding: 8px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.5);
            z-index: 1000;
            display: flex;
            flex-direction: column;
            gap: 6px;
            animation: contextMenuPop 0.15s ease-out;
            min-width: 140px;
        }
        @keyframes contextMenuPop {
            0% { transform: scale(0.85); opacity: 0; }
            100% { transform: scale(1); opacity: 1; }
        }
        .msg-context-emojis {
            display: flex;
            gap: 6px;
            padding: 4px 6px;
            border-bottom: 1px solid var(--border);
            justify-content: space-around;
        }
        .msg-context-emojis span {
            font-size: 1.3rem;
            cursor: pointer;
            transition: var(--transition);
        }
        .msg-context-emojis span:active {
            transform: scale(1.3);
        }
        .msg-context-items {
            display: flex;
            flex-direction: column;
        }
        .msg-context-items div {
            padding: 8px 12px;
            color: var(--text);
            font-size: 0.8rem;
            cursor: pointer;
            border-radius: 8px;
            display: flex;
            align-items: center;
            gap: 8px;
            font-family: 'Cairo', sans-serif;
        }
        .msg-context-items div:active {
            background: var(--surface);
            color: var(--gold);
        }
        
        /* Message Reactions Display */
        .msg-reactions {
            display: flex;
            gap: 3px;
            position: absolute;
            bottom: -10px;
            right: 12px;
            z-index: 50;
        }
        .me .msg-reactions {
            right: auto;
            left: 12px;
        }
        .msg-reaction-badge {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 20px;
            padding: 2px 6px;
            font-size: 0.7rem;
            box-shadow: 0 2px 5px rgba(0,0,0,0.2);
            user-select: none;
            display: inline-flex;
            align-items: center;
            color: var(--text);
        }
        
        /* Message Reply Quoting */
        .msg-reply-quoted {
            background: rgba(255,255,255,0.06);
            border-right: 3px solid var(--gold);
            padding: 6px 10px;
            border-radius: 6px;
            margin-bottom: 8px;
            font-size: 0.7rem;
            cursor: pointer;
            max-width: 100%;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }
        .me .msg-reply-quoted {
            background: rgba(0,0,0,0.15);
            border-right-color: var(--gold);
        }
        .msg-reply-quoted-name {
            color: var(--gold);
            font-weight: bold;
            font-size: 0.65rem;
            margin-bottom: 2px;
        }
        .msg-reply-quoted-text {
            color: var(--text2);
            font-style: italic;
        }
        
        /* Reply Input Bar Above Chat Bar */
        .chat-reply-bar {
            display: flex;
            align-items: center;
            justify-content: space-between;
            background: var(--surface2);
            border-top: 1px solid var(--border);
            padding: 8px 16px;
            border-radius: 16px 16px 0 0;
            animation: slideDownReply 0.2s ease-out;
            border-bottom: 1px solid rgba(255,255,255,0.05);
        }
        @keyframes slideDownReply {
            0% { transform: translateY(10px); opacity: 0; }
            100% { transform: translateY(0); opacity: 1; }
        }
        
        /* Quoted message blink highlight */
        .flash-message {
            animation: flashMessageBg 1.5s ease-in-out;
        }
        @keyframes flashMessageBg {
            0%, 100% { background: transparent; }
            50% { background: rgba(212,160,23,0.15); }
        }

        /* App Bar Points Badge */
        .hdr-points-badge {
            background: linear-gradient(135deg, rgba(212, 175, 55, 0.25), rgba(212, 175, 55, 0.1)) !important;
            color: var(--gold) !important;
            border: 1px solid rgba(212, 175, 55, 0.5) !important;
            padding: 5px 12px !important;
            border-radius: 20px !important;
            font-weight: 700 !important;
            font-size: 0.8rem !important;
            cursor: pointer;
            display: inline-flex !important;
            align-items: center;
            gap: 5px;
            box-shadow: 0 0 10px rgba(212, 175, 55, 0.15);
            transition: all 0.2s ease-in-out;
            font-family: 'Cairo', sans-serif;
            margin-left: 5px;
        }
        .hdr-points-badge:hover {
            transform: scale(1.06);
            background: linear-gradient(135deg, rgba(212, 175, 55, 0.4), rgba(212, 175, 55, 0.2)) !important;
            box-shadow: 0 0 14px rgba(212, 175, 55, 0.4);
        }

        /* Points Packages Cards */
        .points-pkg-card {
            background: var(--surface2);
            border: 1.5px solid var(--border);
            border-radius: 14px;
            padding: 14px 10px;
            text-align: center;
            position: relative;
            cursor: pointer;
            transition: all 0.25s ease;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-family: 'Cairo', sans-serif;
        }
        .points-pkg-card:hover {
            border-color: var(--gold);
            transform: translateY(-3px);
            box-shadow: 0 6px 18px rgba(212, 175, 55, 0.2);
            background: rgba(212, 175, 55, 0.08);
        }
        .points-pkg-card.featured {
            border-color: var(--gold);
            background: linear-gradient(135deg, rgba(212,175,55,0.15), rgba(0,0,0,0.2));
            box-shadow: 0 0 12px rgba(212, 175, 55, 0.25);
        }
        .pkg-badge {
            position: absolute;
            top: -10px;
            right: 8px;
            background: var(--surface);
            color: var(--text2);
            border: 1px solid var(--border);
            font-size: 0.6rem;
            padding: 2px 7px;
            border-radius: 10px;
            font-weight: bold;
        }
        .pkg-badge.gold {
            background: var(--gold);
            color: #000;
            border: none;
        }
        .pkg-badge.vip {
            background: linear-gradient(135deg, #a855f7, #ec4899);
            color: #fff;
            border: none;
        }
        .pkg-icon {
            font-size: 1.8rem;
            margin-bottom: 4px;
        }
        .pkg-amount {
            color: var(--text);
            font-weight: 800;
            font-size: 0.9rem;
        }
        .pkg-price {
            color: var(--gold);
            font-weight: 700;
            font-size: 0.8rem;
            margin-top: 2px;
        }

        /* Floating Mini Game Widget for Multitasking */
        .floating-game-widget {
            position: fixed;
            bottom: 75px;
            left: 15px;
            z-index: 490;
            display: flex;
            align-items: center;
            gap: 10px;
            background: rgba(18, 26, 22, 0.92);
            border: 1.5px solid var(--gold);
            backdrop-filter: blur(12px);
            padding: 8px 14px;
            border-radius: 30px;
            box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 15px rgba(212, 175, 55, 0.25);
            cursor: pointer;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            font-family: 'Cairo', sans-serif;
            max-width: 280px;
        }
        .floating-game-widget.hidden {
            display: none !important;
        }
        .floating-game-widget.my-turn-glow {
            animation: fgwPulse 1.5s infinite alternate;
            border-color: var(--success);
        }
        @keyframes fgwPulse {
            0% { box-shadow: 0 0 10px rgba(52, 199, 89, 0.4); transform: scale(1); }
            100% { box-shadow: 0 0 20px rgba(52, 199, 89, 0.8); transform: scale(1.03); }
        }
        .fgw-icon {
            font-size: 1.4rem;
            line-height: 1;
        }
        .fgw-info {
            display: flex;
            flex-direction: column;
            overflow: hidden;
            flex: 1;
        }
        .fgw-title {
            color: var(--gold);
            font-weight: 700;
            font-size: 0.8rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .fgw-status {
            color: var(--text2);
            font-size: 0.7rem;
            white-space: nowrap;
        }
        .fgw-actions {
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .fgw-btn {
            border: none;
            border-radius: 14px;
            padding: 4px 10px;
            font-size: 0.7rem;
            font-weight: bold;
            cursor: pointer;
            display: flex;
            align-items: center;
            gap: 4px;
            font-family: 'Cairo', sans-serif;
        }
        .fgw-btn.expand {
            background: var(--gold);
            color: #000;
        }
        .fgw-btn.forfeit {
            background: rgba(255,59,48,0.2);
            color: var(--danger);
            padding: 4px 8px;
        }
        .game-min-btn {
            background: rgba(255,255,255,0.1);
            color: var(--text);
            border: none;
            border-radius: 50%;
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            font-size: 0.9rem;
            transition: var(--transition);
        }
        .game-min-btn:hover {
            background: rgba(212,175,55,0.2);
            color: var(--gold);
        }

        /* LUDO GAME STYLES */
        .ludo-container {
            display: flex;
            flex-direction: column;
            align-items: center;
            width: 100%;
        }
        .ludo-board {
            width: 320px;
            height: 320px;
            background: #1e2925;
            border: 3px solid var(--gold);
            border-radius: 16px;
            display: grid;
            grid-template-columns: repeat(15, 1fr);
            grid-template-rows: repeat(15, 1fr);
            gap: 1px;
            padding: 4px;
            box-shadow: 0 10px 30px rgba(0,0,0,0.6);
            box-sizing: border-border-box;
            position: relative;
        }
        .ludo-cell {
            background: rgba(255,255,255,0.05);
            border-radius: 2px;
            display: flex;
            align-items: center;
            justify-content: center;
            position: relative;
            font-size: 0.65rem;
        }
        .ludo-cell.red-base { background: rgba(235, 64, 52, 0.25); border: 1px solid #eb4034; }
        .ludo-cell.blue-base { background: rgba(52, 140, 235, 0.25); border: 1px solid #348ceb; }
        .ludo-cell.green-home { background: rgba(52, 199, 89, 0.25); }
        .ludo-cell.red-path { background: rgba(235, 64, 52, 0.6); }
        .ludo-cell.blue-path { background: rgba(52, 140, 235, 0.6); }
        .ludo-cell.star { background: rgba(212, 175, 55, 0.3); }
        .ludo-cell.center-goal { background: radial-gradient(circle, var(--gold) 0%, #111 80%); color: #000; font-weight: bold; }
        
        .ludo-token {
            width: 18px;
            height: 18px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.65rem;
            font-weight: bold;
            box-shadow: 0 2px 6px rgba(0,0,0,0.7);
            cursor: pointer;
            transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            z-index: 5;
        }
        .ludo-token.red { background: linear-gradient(135deg, #ff6b6b, #c0392b); color: #fff; border: 1.5px solid #fff; }
        .ludo-token.blue { background: linear-gradient(135deg, #4facfe, #00f2fe); color: #000; border: 1.5px solid #fff; }
        .ludo-token.movable {
            animation: tokenBounce 0.6s infinite alternate;
            box-shadow: 0 0 10px #fff, 0 0 15px var(--gold);
        }
        @keyframes tokenBounce {
            0% { transform: scale(1); }
            100% { transform: scale(1.3); }
        }

        .ludo-controls {
            display: flex;
            align-items: center;
            justify-content: space-around;
            width: 100%;
            margin-top: 15px;
            background: var(--surface2);
            padding: 10px;
            border-radius: 14px;
            border: 1px solid var(--border);
        }
        .ludo-dice-box {
            display: flex;
            align-items: center;
            gap: 12px;
        }
        .ludo-dice {
            width: 50px;
            height: 50px;
            background: #fff;
            color: #111;
            border-radius: 12px;
            font-size: 1.8rem;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: 0 4px 12px rgba(0,0,0,0.4);
            border: 2px solid var(--gold);
        }
        .ludo-dice.rolling {
            animation: diceSpin 0.4s ease-in-out infinite;
        }
        @keyframes diceSpin {
            0% { transform: rotate(0deg) scale(1); }
            50% { transform: rotate(180deg) scale(1.15); }
            100% { transform: rotate(360deg) scale(1); }
        }

        /* ===== NEW LUDO UI STYLES ===== */
        .ludo-wrap {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 6px 2px;
            font-family: 'Cairo', sans-serif;
            width: 100%;
        }
        .ludo-score-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 6px;
        }
        .ludo-score-card {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 8px 10px;
            display: flex;
            align-items: center;
            gap: 8px;
            flex: 1;
            font-family: 'Cairo', sans-serif;
        }
        .ludo-score-card.p1 { border-color: rgba(235,64,52,0.4); }
        .ludo-score-card.p2 { border-color: rgba(52,140,235,0.4); }
        .ludo-dice-center {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 4px;
        }
        .ludo-dice-big {
            font-size: 2.2rem;
            line-height: 1;
            filter: drop-shadow(0 2px 6px rgba(0,0,0,0.5));
        }
        .lt-roll-btn {
            background: linear-gradient(135deg, var(--gold), #b8860b);
            color: #000;
            border: none;
            font-weight: bold;
            padding: 6px 14px;
            border-radius: 20px;
            cursor: pointer;
            font-family: 'Cairo', sans-serif;
            font-size: 0.78rem;
            white-space: nowrap;
            transition: transform 0.15s;
        }
        .lt-roll-btn:hover { transform: scale(1.05); }
        .lt-dice-val {
            background: var(--gold);
            color: #000;
            border-radius: 8px;
            padding: 2px 10px;
            font-weight: bold;
            font-size: 0.85rem;
        }

        /* Board visual */
        .ludo-board-visual {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px;
            overflow: hidden;
        }
        .ludo-base-area {
            padding: 10px 12px;
        }
        .ludo-base-area.p1-base { background: rgba(235,64,52,0.08); border-bottom: 1px solid rgba(235,64,52,0.2); }
        .ludo-base-area.p2-base { background: rgba(52,140,235,0.08); border-top: 1px solid rgba(52,140,235,0.2); }
        .ludo-base-label {
            font-size: 0.7rem;
            font-weight: bold;
            color: var(--text2);
            margin-bottom: 8px;
        }
        .ludo-base-tokens {
            display: flex;
            gap: 8px;
            flex-wrap: wrap;
        }
        /* Token in base */
        .lt {
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 900;
            font-size: 0.85rem;
            border: 2.5px solid transparent;
            transition: all 0.2s;
            position: relative;
        }
        .lt.p1 { background: linear-gradient(135deg,#ff6b6b,#c0392b); color:#fff; border-color: #ff6b6b; }
        .lt.p2 { background: linear-gradient(135deg,#4facfe,#00a8ff); color:#fff; border-color: #4facfe; }
        .lt.lt-out { opacity: 0.22; cursor: default; }
        .lt.lt-movable {
            animation: tokenBounce 0.55s infinite alternate;
            box-shadow: 0 0 12px var(--gold), 0 0 20px rgba(212,175,55,0.5);
            cursor: pointer;
            border-color: var(--gold) !important;
        }
        @keyframes tokenBounce {
            0% { transform: scale(1); }
            100% { transform: scale(1.2); }
        }

        /* Track area */
        .ludo-track-area {
            padding: 10px 12px;
            border-top: 1px solid var(--border);
            border-bottom: 1px solid var(--border);
            background: var(--surface2);
        }
        .ludo-track-row {
            display: flex;
            gap: 10px;
            align-items: flex-start;
        }
        .ludo-track-info { flex: 1; }
        .ludo-track-label {
            font-size: 0.68rem;
            color: var(--text2);
            margin-bottom: 6px;
        }
        .ludo-on-track {
            min-height: 48px;
            display: flex;
            align-items: center;
        }
        /* Token on board */
        .lt-board-token {
            width: 34px;
            height: 34px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 900;
            font-size: 0.78rem;
            border: 2px solid transparent;
            transition: all 0.18s;
            cursor: default;
            position: relative;
        }
        .lt-board-token.p1 { background: linear-gradient(135deg,#ff6b6b,#c0392b); color:#fff; border-color:#ff6b6b; }
        .lt-board-token.p2 { background: linear-gradient(135deg,#4facfe,#00a8ff); color:#fff; border-color:#4facfe; }
        .lt-board-token.lt-movable {
            animation: tokenBounce 0.55s infinite alternate;
            box-shadow: 0 0 10px var(--gold);
            border-color: var(--gold) !important;
            cursor: pointer;
        }
        .lt-board-token.lt-home-col { border-style: dashed; opacity: 0.85; }

        /* Home column */
        .ludo-home-col {
            width: 70px;
            background: rgba(212,175,55,0.06);
            border: 1px solid rgba(212,175,55,0.2);
            border-radius: 10px;
            padding: 6px;
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 3px;
        }
        .lt-hc-step {
            width: 28px;
            height: 20px;
            border-radius: 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 0.65rem;
            font-weight: bold;
        }
        .lt-hc-step.p1 { background: rgba(235,64,52,0.35); color:#ff6b6b; }
        .lt-hc-step.p2 { background: rgba(52,140,235,0.35); color:#4facfe; }
        .lt-hc-step.lt-hc-done { background: var(--gold) !important; color: #000 !important; }
        .ludo-goal-center {
            font-size: 1.2rem;
            margin-top: 4px;
        }

        .ludo-status-msg {
            text-align: center;
            font-size: 0.78rem;
            font-weight: bold;
            color: var(--gold);
            padding: 6px 10px;
            background: rgba(212,175,55,0.08);
            border-radius: 8px;
            border: 1px solid rgba(212,175,55,0.15);
        }
        .ludo-rules-hint {
            font-size: 0.65rem;
            color: var(--text2);
            text-align: center;
            padding: 4px 8px;
            line-height: 1.5;
        }

        /* CONNECT 4 STYLES */
        .c4-board {
            display: flex;
            flex-direction: column;
            align-items: center;
            background: #003366;
            padding: 12px;
            border-radius: 16px;
            border: 3px solid var(--gold);
            box-shadow: 0 10px 30px rgba(0,0,0,0.5);
        }
        .c4-grid {
            display: grid;
            grid-template-columns: repeat(7, 1fr);
            gap: 8px;
        }
        .c4-col-btn {
            background: rgba(255,255,255,0.1);
            border: none;
            color: #fff;
            padding: 6px;
            border-radius: 8px;
            cursor: pointer;
            margin-bottom: 8px;
            font-weight: bold;
            font-size: 0.8rem;
            transition: var(--transition);
        }
        .c4-col-btn:hover {
            background: var(--gold);
            color: #000;
        }
        .c4-cell {
            width: 38px;
            height: 38px;
            background: #0a192f;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            box-shadow: inset 0 2px 5px rgba(0,0,0,0.8);
        }
        .c4-disc {
            width: 32px;
            height: 32px;
            border-radius: 50%;
            box-shadow: 0 3px 6px rgba(0,0,0,0.4);
            animation: dropDisc 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
        }
        .c4-disc.p1 { background: linear-gradient(135deg, #ff416c, #ff4b2b); }
        .c4-disc.p2 { background: linear-gradient(135deg, #f7b731, #fa8231); }
        @keyframes dropDisc {
            0% { transform: translateY(-40px); opacity: 0.5; }
            100% { transform: translateY(0); opacity: 1; }
        }

        /* MEMORY GAME STYLES */
        .memory-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 10px;
            width: 300px;
            margin: 15px auto;
        }
        .memory-card {
            height: 65px;
            background: var(--surface2);
            border: 2px solid var(--border);
            border-radius: 12px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.8rem;
            cursor: pointer;
            perspective: 1000px;
            transition: all 0.3s ease;
            user-select: none;
        }
        .memory-card.flipped {
            background: #2a3b34;
            border-color: var(--gold);
            transform: rotateY(180deg);
        }
        .memory-card.matched {
            background: rgba(52, 199, 89, 0.2);
            border-color: var(--success);
            opacity: 0.7;
            cursor: default;
        }

        /* ============ KOBI & KOMI CARD GAME STYLES ============ */
        .kobi-board {
            padding: 8px 4px;
            display: flex;
            flex-direction: column;
            gap: 6px;
            font-family: 'Cairo', sans-serif;
        }
        .kobi-info-row {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 4px;
            font-size: 0.7rem;
            color: var(--text2);
            background: var(--surface2);
            border-radius: 8px;
            padding: 6px 10px;
        }
        .kobi-section-label {
            font-size: 0.72rem;
            font-weight: bold;
            color: var(--text2);
            margin-top: 4px;
        }
        .kobi-hand, .kobi-table {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            justify-content: center;
            min-height: 60px;
            align-items: center;
        }
        .kobi-card {
            background: #fff;
            border: 2px solid #ccc;
            border-radius: 8px;
            width: 44px;
            height: 60px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            font-size: 1.1rem;
            font-weight: 900;
            cursor: pointer;
            transition: all 0.18s ease;
            position: relative;
            user-select: none;
            box-shadow: 0 2px 6px rgba(0,0,0,0.18);
        }
        .kobi-card:hover {
            transform: translateY(-5px) scale(1.08);
            box-shadow: 0 6px 16px rgba(0,0,0,0.25);
        }
        .kobi-hand-card {
            cursor: pointer;
        }
        .kobi-back {
            background: linear-gradient(135deg, #1a1a2e, #16213e);
            color: var(--gold) !important;
            border-color: rgba(212,175,55,0.4);
            font-size: 1.5rem;
            cursor: default;
        }
        .kobi-sel-hand {
            border-color: var(--gold) !important;
            box-shadow: 0 0 14px rgba(212,175,55,0.6) !important;
            transform: translateY(-8px) scale(1.1) !important;
            background: #fffde7;
        }
        .kobi-sel-table {
            border-color: #00bcd4 !important;
            box-shadow: 0 0 14px rgba(0,188,212,0.6) !important;
            transform: translateY(-8px) scale(1.08) !important;
            background: #e0f7fa;
        }
        .kc-val {
            font-size: 0.9rem;
            line-height: 1;
        }
        .kc-suit {
            font-size: 1.1rem;
            line-height: 1;
        }

        /* ============ AI CHAT STYLES ============ */
        .ai-chat-wrapper {
            display: flex;
            flex-direction: column;
            height: 100%;
            background: var(--bg);
            font-family: 'Cairo', sans-serif;
        }

        /* AI Nav Dot - pulse indicator */
        .ai-nav-dot {
            position: absolute;
            top: 6px;
            right: 8px;
            width: 7px;
            height: 7px;
            background: var(--gold);
            border-radius: 50%;
            animation: ai-pulse 2s infinite;
        }
        @keyframes ai-pulse {
            0%, 100% { opacity: 1; transform: scale(1); }
            50% { opacity: 0.5; transform: scale(0.7); }
        }

        /* AI Header */
        .ai-chat-header {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px 16px;
            background: var(--surface);
            border-bottom: 1px solid var(--border);
            flex-shrink: 0;
        }
        .ai-avatar-header {
            width: 44px;
            height: 44px;
            background: linear-gradient(135deg, #1a1a2e, #16213e);
            border: 2px solid var(--gold);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.5rem;
            position: relative;
            flex-shrink: 0;
        }
        .ai-avatar-pulse {
            position: absolute;
            inset: -3px;
            border-radius: 50%;
            border: 2px solid var(--gold);
            animation: ai-ring-pulse 2.5s infinite;
            opacity: 0.5;
        }
        @keyframes ai-ring-pulse {
            0% { transform: scale(1); opacity: 0.5; }
            50% { transform: scale(1.12); opacity: 0; }
            100% { transform: scale(1); opacity: 0.5; }
        }
        .ai-header-info { flex: 1; }
        .ai-header-name {
            font-weight: 700;
            font-size: 0.95rem;
            color: var(--text);
            display: flex;
            align-items: center;
            gap: 6px;
        }
        .ai-badge {
            background: linear-gradient(135deg, #4285f4, #34a853);
            color: #fff;
            font-size: 0.6rem;
            padding: 2px 7px;
            border-radius: 8px;
            font-weight: 700;
        }
        .ai-header-status {
            font-size: 0.72rem;
            color: var(--text2);
            margin-top: 2px;
        }
        .ai-settings-btn {
            background: var(--surface2);
            border: 1px solid var(--border);
            color: var(--gold);
            width: 36px;
            height: 36px;
            border-radius: 50%;
            cursor: pointer;
            font-size: 0.85rem;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
        }
        .ai-settings-btn:hover { background: rgba(212,175,55,0.15); }

        /* Messages Area */
        .ai-messages-area {
            flex: 1;
            overflow-y: auto;
            padding: 12px;
            display: flex;
            flex-direction: column;
            gap: 10px;
            scroll-behavior: smooth;
        }

        /* Bubbles */
        .ai-bubble {
            display: flex;
            gap: 8px;
            max-width: 85%;
            animation: ai-bubble-in 0.3s ease;
        }
        @keyframes ai-bubble-in {
            from { opacity: 0; transform: translateY(10px); }
            to { opacity: 1; transform: translateY(0); }
        }
        .ai-bubble-bot { align-self: flex-start; }
        .ai-bubble-user { align-self: flex-end; flex-direction: row-reverse; }
        .ai-bubble-error { align-self: flex-start; }

        .ai-avatar-sm {
            width: 32px;
            height: 32px;
            background: linear-gradient(135deg, #1a1a2e, #16213e);
            border: 1.5px solid var(--gold);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
            flex-shrink: 0;
            align-self: flex-end;
        }

        .ai-bubble-content {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 16px 16px 16px 4px;
            padding: 10px 14px;
            max-width: 100%;
        }
        .ai-bubble-content-user {
            background: linear-gradient(135deg, rgba(212,175,55,0.25), rgba(212,175,55,0.15));
            border-color: rgba(212,175,55,0.4);
            border-radius: 16px 16px 4px 16px;
        }
        .ai-bubble-error .ai-bubble-content {
            background: rgba(255,59,48,0.1);
            border-color: rgba(255,59,48,0.3);
        }
        .ai-welcome-bubble .ai-bubble-content {
            background: linear-gradient(135deg, rgba(66,133,244,0.1), rgba(52,168,83,0.08));
            border-color: rgba(66,133,244,0.3);
        }
        .ai-bubble-text {
            font-size: 0.85rem;
            color: var(--text);
            line-height: 1.6;
            word-break: break-word;
        }
        .ai-bubble-time {
            font-size: 0.65rem;
            color: var(--text2);
            margin-top: 4px;
        }

        /* Typing Indicator */
        .ai-typing-indicator {
            display: flex;
            align-items: center;
            gap: 8px;
            padding: 6px 12px;
            flex-shrink: 0;
        }
        .ai-typing-indicator.hidden { display: none; }
        .ai-typing-avatar {
            width: 32px;
            height: 32px;
            background: linear-gradient(135deg, #1a1a2e, #16213e);
            border: 1.5px solid var(--gold);
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1rem;
        }
        .ai-typing-dots {
            background: var(--surface);
            border: 1px solid var(--border);
            border-radius: 12px 12px 12px 4px;
            padding: 10px 16px;
            display: flex;
            gap: 5px;
            align-items: center;
        }
        .ai-typing-dots span {
            width: 7px;
            height: 7px;
            background: var(--gold);
            border-radius: 50%;
            animation: ai-dot-bounce 1.2s infinite;
            opacity: 0.4;
        }
        .ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
        .ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
        @keyframes ai-dot-bounce {
            0%, 100% { transform: translateY(0); opacity: 0.4; }
            40% { transform: translateY(-6px); opacity: 1; }
        }

        /* Quick Actions */
        .ai-quick-actions {
            display: flex;
            gap: 6px;
            padding: 6px 12px 2px;
            overflow-x: auto;
            flex-shrink: 0;
            scrollbar-width: none;
        }
        .ai-quick-actions::-webkit-scrollbar { display: none; }
        .ai-quick-btn {
            background: var(--surface2);
            border: 1px solid var(--border);
            color: var(--text);
            padding: 5px 10px;
            border-radius: 12px;
            font-size: 0.72rem;
            white-space: nowrap;
            cursor: pointer;
            font-family: 'Cairo', sans-serif;
            transition: all 0.2s;
            flex-shrink: 0;
        }
        .ai-quick-btn:hover {
            border-color: var(--gold);
            color: var(--gold);
        }

        /* Input Row */
        .ai-input-area {
            border-top: 1px solid var(--border);
            background: var(--surface);
            flex-shrink: 0;
            padding-bottom: env(safe-area-inset-bottom, 0px);
        }
        .ai-input-row {
            display: flex;
            align-items: flex-end;
            gap: 8px;
            padding: 8px 12px;
        }
        #aiMessageInput {
            flex: 1;
            background: var(--surface2);
            border: 1px solid var(--border);
            color: var(--text);
            padding: 9px 12px;
            border-radius: 20px;
            font-family: 'Cairo', sans-serif;
            font-size: 0.85rem;
            resize: none;
            overflow: hidden;
            max-height: 120px;
            line-height: 1.4;
            outline: none;
            transition: border-color 0.2s;
        }
        #aiMessageInput:focus { border-color: var(--gold); }
        .ai-send-btn {
            width: 40px;
            height: 40px;
            background: var(--gold);
            color: #000;
            border: none;
            border-radius: 50%;
            cursor: pointer;
            font-size: 1rem;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: all 0.2s;
        }
        .ai-send-btn:hover { transform: scale(1.1); }
        .ai-send-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
        .ai-clear-btn {
            width: 36px;
            height: 36px;
            background: transparent;
            border: 1px solid var(--border);
            color: var(--text2);
            border-radius: 50%;
            cursor: pointer;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
            transition: all 0.2s;
        }
        .ai-clear-btn:hover { color: var(--danger); border-color: var(--danger); }

        .ai-welcome-msg { display: flex; }

        /* ===== STICKER PANEL ===== */
        .sticker-panel {
            background: var(--surface);
            border-top: 1px solid var(--border);
            border-bottom: none;
            padding: 0;
            animation: slideUpFade 0.2s ease;
        }
        @keyframes slideUpFade {
            from { opacity:0; transform:translateY(10px); }
            to { opacity:1; transform:translateY(0); }
        }
        .sticker-cat-tabs {
            display: flex;
            gap: 4px;
            padding: 8px 10px 6px;
            border-bottom: 1px solid var(--border);
            overflow-x: auto;
        }
        .sticker-tab {
            background: var(--surface2);
            border: 1px solid var(--border);
            color: var(--text2);
            padding: 4px 10px;
            border-radius: 20px;
            font-size: 0.75rem;
            cursor: pointer;
            white-space: nowrap;
            transition: all 0.15s;
            font-family: 'Cairo';
        }
        .sticker-tab.active {
            background: var(--gold);
            color: #000;
            border-color: var(--gold);
            font-weight: bold;
        }
        .sticker-grid {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 4px;
            padding: 8px 10px;
            max-height: 160px;
            overflow-y: auto;
        }
        .sticker-btn {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 8px;
            font-size: 1.5rem;
            width: 100%;
            aspect-ratio: 1;
            cursor: pointer;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.15s, background 0.15s;
        }
        .sticker-btn:hover {
            background: rgba(212,175,55,0.2);
            transform: scale(1.2);
        }
        /* Sticker message */
        .msg-sticker {
            font-size: 2.8rem;
            line-height: 1;
            padding: 4px;
            background: transparent !important;
            border: none !important;
        }
        .me .bubble:has(.msg-sticker),
        .you .bubble:has(.msg-sticker) {
            background: transparent !important;
            box-shadow: none !important;
            border: none !important;
        }

        /* ===== MESSAGE SEARCH HIGHLIGHTS ===== */
        .msg-search-hl {
            outline: 2px solid rgba(212,175,55,0.5);
            border-radius: 12px;
        }
        .msg-search-hl-active {
            outline: 2.5px solid var(--gold);
            box-shadow: 0 0 12px rgba(212,175,55,0.4);
        }

        /* ===== LEADERBOARD PAGE ===== */
        .leaderboard-card {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 12px 14px;
            display: flex;
            align-items: center;
            gap: 12px;
            margin-bottom: 8px;
            transition: all 0.2s;
        }
        .leaderboard-card:hover { border-color: var(--gold); }
        .leaderboard-rank {
            font-size: 1.3rem;
            font-weight: 900;
            width: 32px;
            text-align: center;
            flex-shrink: 0;
        }
        .leaderboard-av {
            width: 40px;
            height: 40px;
            border-radius: 50%;
            background: linear-gradient(135deg, var(--gold), #b8860b);
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: bold;
            font-size: 1rem;
            color: #000;
            flex-shrink: 0;
        }
        .leaderboard-av img { width:100%;height:100%;border-radius:50%;object-fit:cover; }
        .leaderboard-info { flex: 1; }
        .leaderboard-name { font-weight: bold; font-size: 0.88rem; color: var(--text); }
        .leaderboard-pts { font-size: 0.7rem; color: var(--text2); }
        .leaderboard-score {
            font-size: 1rem;
            font-weight: 900;
            color: var(--gold);
        }
        .lb-me .leaderboard-card {
            border-color: var(--gold);
            background: rgba(212,175,55,0.06);
        }

        /* ===== GAME STATS ===== */
        .stat-card {
            background: var(--surface2);
            border: 1px solid var(--border);
            border-radius: 14px;
            padding: 14px;
            text-align: center;
            flex: 1;
            min-width: 80px;
        }
        .stat-card-value {
            font-size: 1.6rem;
            font-weight: 900;
            color: var(--gold);
        }
        .stat-card-label {
            font-size: 0.68rem;
            color: var(--text2);
            margin-top: 4px;
            font-family: 'Cairo';
        }
        .game-stat-row {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 10px 0;
            border-bottom: 1px solid var(--border);
            font-size: 0.82rem;
        }
        .game-stat-row:last-child { border-bottom: none; }

        /* ===== POSTS FEED STYLES ===== */
        .post-card:hover {
            border-color: rgba(212, 160, 23, 0.4);
        }
        .btn-like-post.liked {
            color: var(--danger) !important;
            animation: heartPulse 0.3s ease;
        }
        @keyframes heartPulse {
            0% { transform: scale(1); }
            50% { transform: scale(1.25); }
            100% { transform: scale(1); }
        }
        .btn-like-post:hover, .btn-toggle-comments:hover, .btn-share-post:hover {
            background: rgba(255, 255, 255, 0.05) !important;
        }
        #postInputText:focus {
            border-color: var(--gold) !important;
            background: var(--surface) !important;
        }

        /* ===== PHASE 1: REACTIONS BOX STYLES ===== */
        .reaction-selector-box {
            display: none;
            position: absolute;
            bottom: 45px;
            right: 15px;
            background: rgba(18, 28, 24, 0.95);
            border: 1px solid var(--gold);
            border-radius: 30px;
            padding: 6px 12px;
            gap: 8px;
            backdrop-filter: blur(10px);
            box-shadow: 0 10px 25px rgba(0,0,0,0.5);
            z-index: 50;
            animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.27);
        }
        @keyframes popIn {
            from { opacity: 0; transform: translateY(10px) scale(0.8); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }
        .reaction-emoji-btn {
            background: transparent;
            border: none;
            font-size: 1.4rem;
            cursor: pointer;
            transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.27);
            padding: 2px 4px;
        }
        .reaction-emoji-btn:hover {
            transform: scale(1.4) translateY(-4px);
        }
        .hashtag-link:hover {
            text-decoration: underline;
            color: var(--gold-light) !important;
        }

        /* ===== PHASE 2: VOICE PLAYER ENHANCEMENTS ===== */
        .voice-speed-btn {
            background: rgba(212,160,23,0.15);
            color: var(--gold);
            border: 1px solid var(--border);
            border-radius: 12px;
            padding: 2px 8px;
            font-size: 0.72rem;
            font-weight: bold;
            cursor: pointer;
            font-family: 'Cairo', sans-serif;
            transition: var(--transition);
        }
        .voice-speed-btn:hover {
            background: var(--gold);
            color: #000;
        }
        .waveform-bars span {
            cursor: pointer;
            transition: background 0.15s ease, opacity 0.15s ease;
        }
        .waveform-bars span:hover {
            background: var(--gold-light) !important;
            transform: scaleY(1.3);
        }

        /* ===== TIKTOK LIVE FLOATING EMOJIS & VIP ENTRANCE ===== */
        @keyframes floatReactionUp {
            0% { opacity: 1; transform: translateY(0) scale(0.6) rotate(0deg); }
            50% { opacity: 0.9; transform: translateY(-180px) scale(1.3) rotate(-15deg); }
            100% { opacity: 0; transform: translateY(-380px) scale(1.6) rotate(15deg); }
        }
        @keyframes vipSlideIn {
            0% { opacity: 0; transform: translate(-50%, -60px) scale(0.8); }
            15% { opacity: 1; transform: translate(-50%, 0) scale(1.1); }
            80% { opacity: 1; transform: translate(-50%, 0) scale(1); }
            100% { opacity: 0; transform: translate(-50%, -60px) scale(0.9); }
        }

/* ==========================================================================
   ICON POLISH & FIXES
   ========================================================================== */
i.fas, i.far, i.fab, i.fa-solid, i.fa-brands, i.fa-regular, .fas, .far, .fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    transition: transform 0.2s ease, color 0.2s ease, filter 0.2s ease;
}

button i.fas, button i.far, button i.fab,
.btn i.fas, .btn i.far, .btn i.fab {
    margin-left: 6px;
}

.nav button i {
    font-size: 1.25rem;
    margin-bottom: 3px;
    margin-left: 0;
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.27), filter 0.25s ease;
}

.nav button.active i {
    transform: translateY(-2px) scale(1.15);
    filter: drop-shadow(0 0 6px rgba(212,160,23,0.6));
}

.hdr-badge i {
    margin-left: 5px;
    font-size: 0.85rem;
}

/* ==========================================================================
   MARKETPLACE (FACEBOOK STYLE) UI & MODALS
   ========================================================================== */
.marketplace-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow-y: auto;
    padding: 12px;
    padding-bottom: 80px;
    gap: 14px;
    background: var(--bg);
}

.market-topbar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.market-search-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.market-search-icon {
    position: absolute;
    right: 14px;
    color: var(--gold);
    font-size: 0.95rem;
    pointer-events: none;
}

.market-search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 25px;
    padding: 10px 38px 10px 32px;
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 0.85rem;
    outline: none;
    transition: var(--transition);
}

.market-search-input:focus {
    border-color: var(--gold);
    box-shadow: 0 0 12px rgba(212, 160, 23, 0.25);
}

.market-search-clear {
    position: absolute;
    left: 10px;
    background: transparent;
    border: none;
    color: var(--text2);
    cursor: pointer;
    font-size: 0.9rem;
}

.market-add-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #000;
    font-weight: 700;
    font-family: 'Cairo', sans-serif;
    font-size: 0.82rem;
    padding: 10px 16px;
    border-radius: 22px;
    border: none;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(212, 160, 23, 0.3);
    transition: var(--transition);
}

.market-add-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(212, 160, 23, 0.45);
}

.market-categories {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
}
.market-categories::-webkit-scrollbar {
    display: none;
}

.market-cat-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text2);
    padding: 7px 14px;
    border-radius: 20px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.market-cat-pill:hover,
.market-cat-pill.active {
    background: rgba(212, 160, 23, 0.15);
    border-color: var(--gold);
    color: var(--gold);
}

.market-stats-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--text2);
    padding: 0 4px;
}

.market-filter-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--gold);
    padding: 4px 12px;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.75rem;
    cursor: pointer;
}

/* Listings Grid */
.market-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}

@media (min-width: 600px) {
    .market-grid {
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
        gap: 16px;
    }
}

.market-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.market-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.market-card-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    overflow: hidden;
    background: #000;
}

.market-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.35s ease;
}

.market-card:hover .market-card-img {
    transform: scale(1.06);
}

.market-card-condition {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(8, 14, 12, 0.85);
    border: 1px solid var(--border);
    color: var(--gold-light);
    font-size: 0.68rem;
    padding: 3px 8px;
    border-radius: 10px;
    backdrop-filter: blur(5px);
    font-weight: 600;
}

.market-card-cat {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 0.65rem;
    padding: 2px 7px;
    border-radius: 8px;
}

.market-card-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.market-card-price {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--gold);
}

.market-card-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.market-card-meta {
    display: flex;
    flex-direction: column;
    gap: 3px;
    font-size: 0.72rem;
    color: var(--text2);
    margin-top: auto;
}

.market-card-seller {
    display: flex;
    align-items: center;
    gap: 6px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 6px;
    margin-top: 4px;
    font-size: 0.75rem;
    color: var(--text2);
}

.market-empty, .market-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 50px 20px;
    color: var(--text2);
}
.market-empty i {
    font-size: 3rem;
    color: var(--gold);
    margin-bottom: 12px;
}

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

.market-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.market-modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.market-modal-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,0,0,0.6);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.market-details-scroll {
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.market-details-img-wrap {
    position: relative;
    width: 100%;
    border-radius: var(--radius-sm);
    overflow: hidden;
    max-height: 280px;
    background: #000;
}

.market-details-img {
    width: 100%;
    height: 100%;
    max-height: 280px;
    object-fit: cover;
}

.price-tag {
    font-size: 0.95rem;
    padding: 6px 14px;
    background: var(--gold);
    color: #000;
    font-weight: 800;
}

.market-details-header h2 {
    font-size: 1.15rem;
    color: var(--text);
    margin-bottom: 8px;
}

.market-details-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge-tag {
    background: var(--surface2);
    border: 1px solid var(--border);
    color: var(--gold-light);
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 12px;
}

.market-details-desc h3 {
    font-size: 0.9rem;
    color: var(--gold);
    margin-bottom: 6px;
}

.market-details-desc p {
    font-size: 0.85rem;
    color: var(--text2);
    line-height: 1.6;
}

.market-seller-box {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
}

.seller-info-l {
    display: flex;
    align-items: center;
    gap: 12px;
}

.seller-photo-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg);
    border: 1px solid var(--gold);
    display: flex;
    align-items: center;
    justify-content: center;
}

.seller-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.seller-avatar-large {
    font-size: 1.5rem;
}

.seller-info-l h4 {
    font-size: 0.9rem;
    color: var(--text);
}

.seller-status {
    font-size: 0.75rem;
    color: var(--text2);
}

.market-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    gap: 10px;
}

.market-btn-chat {
    flex: 1;
    font-size: 0.88rem;
    padding: 12px;
    border-radius: 14px;
    font-weight: 700;
}

.market-btn-fav {
    padding: 12px 16px;
    border-radius: 14px;
}

/* Create Listing Form */
.create-modal {
    padding: 20px;
    overflow-y: auto;
}

.create-listing-header h2 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 4px;
}
.create-listing-header p {
    font-size: 0.8rem;
    color: var(--text2);
    margin-bottom: 16px;
}

.create-listing-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fld-row {
    display: flex;
    gap: 10px;
}
.fld-row .fld {
    flex: 1;
}

.create-listing-form label {
    font-size: 0.8rem;
    color: var(--gold-light);
    margin-bottom: 4px;
    display: block;
}

.create-listing-form input,
.create-listing-form select,
.create-listing-form textarea {
    width: 100%;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--text);
    font-family: 'Cairo', sans-serif;
    font-size: 0.85rem;
    outline: none;
}

.create-listing-form input:focus,
.create-listing-form select:focus,
.create-listing-form textarea:focus {
    border-color: var(--gold);
}

.market-form-btns {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* Responsive Full Width Video Elements for General Posts, Stories, and Reels */
.post-video, 
.post-card video, 
.story-video, 
.reel-video, 
.msg video,
.posts-feed video {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 480px !important;
    object-fit: cover !important;
    border-radius: 14px !important;
    display: block !important;
    margin: 8px 0 !important;
    background: #000 !important;
    border: 1px solid var(--border) !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
}

/* ==========================================================================
   MOBILE & SMALL SCREEN BUTTON & LAYOUT RESPONSIVENESS (< 480px & < 360px)
   ========================================================================== */
@media (max-width: 480px) {
    /* Global Container Padding */
    .page {
        padding: 8px 8px 16px 8px;
    }
    
    /* Top App Bar */
    .app-header {
        padding: 6px 4px;
    }
    .top-app-bar {
        gap: 3px;
    }
    .app-bar-item {
        height: 60px;
        border-radius: 12px;
        padding: 3px 1px;
    }
    .app-bar-icon {
        width: 26px;
        height: 26px;
        font-size: 0.85rem;
        margin-bottom: 2px;
    }
    .app-bar-label {
        font-size: 0.6rem;
    }
    
    /* Posts Feed & Create Post Card */
    .posts-container {
        padding: 8px 4px 80px 4px !important;
    }
    .create-post-card {
        padding: 10px 10px !important;
        border-radius: 14px !important;
    }
    .post-form-actions {
        gap: 6px !important;
    }
    .post-form-actions button {
        font-size: 0.75rem !important;
    }
    #submitPostBtn {
        padding: 6px 14px !important;
        font-size: 0.78rem !important;
    }
    
    /* Chat Input Bar */
    .chat-bar {
        padding: 4px 4px 4px 8px;
        min-height: 44px;
        gap: 3px;
    }
    .chat-bar input {
        padding: 6px 8px;
        font-size: 0.82rem;
    }
    .chat-actions {
        gap: 3px;
    }
    .chat-btn {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }
    
    /* Marketplace Top Bar */
    .market-topbar {
        gap: 6px;
    }
    .market-search-input {
        padding: 8px 32px 8px 26px;
        font-size: 0.8rem;
    }
    .market-add-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
        border-radius: 18px;
    }
    
    /* Bottom Navigation */
    .nav {
        padding: 4px 2px calc(4px + env(safe-area-inset-bottom, 0px));
        min-height: 52px;
    }
    .nav button {
        padding: 3px 0;
        font-size: 0.95rem;
    }
    .nav button span {
        font-size: 0.58rem;
    }
    
    /* Reaction Box */
    .reaction-selector-box {
        padding: 4px 8px;
        gap: 4px;
    }
    .reaction-emoji-btn {
        font-size: 1.15rem;
        padding: 1px 2px;
    }
    
    /* General Modals & Cards */
    .modal-content, .radar-locked-card, .auth-card {
        padding: 16px 12px;
        border-radius: 16px;
    }
}

@media (max-width: 360px) {
    .app-bar-label {
        font-size: 0.52rem;
    }
    .app-bar-icon {
        width: 24px;
        height: 24px;
        font-size: 0.78rem;
    }
    .nav button span {
        font-size: 0.52rem;
    }
    .nav button {
        font-size: 0.88rem;
    }
    .post-form-actions {
        flex-direction: column;
        align-items: stretch !important;
    }
    .post-form-actions .post-attach-group {
        justify-content: space-between;
        width: 100%;
    }
    #submitPostBtn {
        width: 100% !important;
        justify-content: center !important;
        margin-top: 4px;
    }
}

/* ===== IMMERSIVE FULL-SCREEN REELS STYLES ===== */
.full-reels-overlay {
    animation: fadeIn 0.25s ease-out;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

#btnTakbeesDirect:active, #btnReelLike:active {
    transform: scale(0.9) !important;
}


