:root {
    /* --- Modern Dark Palette --- */
    --bg-app: #09090b;
    /* Pure Black/Zinc base */
    --bg-sidebar: #121212;
    /* Slightly lighter sidebar */
    --bg-header: #181c20;
    /* Distinct header/input bg */
    --bg-card: #27272a;

    --accent: #22c55e;
    /* Snappy Green */
    --accent-dim: #15803d;

    --text-primary: #f4f4f5;
    --text-secondary: #a1a1aa;

    --border: #27272a;

    --msg-out: #166534;
    /* Green message bubble */
    --msg-in: #27272a;
    /* Grey message bubble */

    --header-height: 52px;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

/* Universal Search Input Reset (Removes browser cancel button / native decorations) */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}

*::-webkit-scrollbar,
html::-webkit-scrollbar,
body::-webkit-scrollbar,
div::-webkit-scrollbar,
#messages-container::-webkit-scrollbar,
#conversations-list::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
    background: transparent !important;
}

html,
body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-app);
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 450;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeSpeed;
}

/* --- App Container --- */
#app {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
}

/* --- Utils --- */
.hidden {
    display: none !important;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

h1,
h2,
h3,
p {
    margin: 0;
}

/* =========================================
   1. The Login Page (V6 Zero-Knowledge Architecture)
   ========================================= */
#auth-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #040814;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

#auth-screen.hidden {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Pure CSS Ambient Background Grid & Static Stars (Zero Canvas / Zero CPU Loop) */
#auth-screen .pure-css-ambient {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

#auth-screen .css-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    pointer-events: none;
}

#auth-screen .orb-1 {
    top: 10%;
    left: 20%;
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.4) 0%, transparent 70%);
}

#auth-screen .orb-2 {
    bottom: 15%;
    right: 15%;
    width: 380px;
    height: 380px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.3) 0%, transparent 70%);
}

#auth-screen .css-star {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #34d399;
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.45);
    opacity: 0.45;
}

#auth-screen .star-1 { top: 18%; left: 8%; opacity: 0.6; }
#auth-screen .star-2 { top: 22%; right: 24%; opacity: 0.35; }
#auth-screen .star-3 { top: 28%; right: 6%; opacity: 0.5; width: 3px; height: 3px; }
#auth-screen .star-4 { top: 55%; left: 12%; opacity: 0.4; }
#auth-screen .star-5 { top: 72%; left: 45%; opacity: 0.3; width: 5px; height: 5px; }
#auth-screen .star-6 { top: 82%; right: 14%; opacity: 0.55; }
#auth-screen .star-7 { top: 94%; left: 36%; opacity: 0.7; }
#auth-screen .star-8 { top: 96%; right: 32%; opacity: 0.5; width: 3px; height: 3px; }

#auth-screen .auth-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 430px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
}

#auth-screen .auth-header {
    margin-bottom: 22px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

#auth-screen .brand-badge {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: rgba(16, 185, 129, 0.09);
    border: 1px solid rgba(16, 185, 129, 0.32);
    color: #34d399;
    font-size: 11px;
    font-weight: 700;
    padding: 5px 13px;
    border-radius: 9999px;
    margin-bottom: 12px;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    box-shadow: 0 0 14px rgba(16, 185, 129, 0.15);
}

#auth-screen .badge-pulse {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

#auth-screen .brand-title {
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #ffffff 20%, #93c5fd 65%, #3b82f6 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 18px rgba(59, 130, 246, 0.25));
}

#auth-screen .tagline {
    font-size: 1.05rem;
    color: #94a3b8;
    line-height: 1.45;
    margin-bottom: 0;
}

#auth-screen .highlight {
    color: #ffffff;
    font-weight: 700;
    position: relative;
    display: inline-block;
    text-decoration: none;
}

#auth-screen .highlight::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 1px;
    width: 100%;
    height: 2.5px;
    background: linear-gradient(90deg, #10b981, #06b6d4);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.45);
}

#auth-screen .auth-card {
    width: 100%;
    background: rgba(13, 22, 41, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    padding: 26px 24px;
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.65), 
                0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    text-align: left;
}

#auth-screen .tab-switcher {
    position: relative;
    display: flex;
    background: rgba(4, 9, 20, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 4px;
    margin-bottom: 20px;
}

#auth-screen .tab-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 1;
}

#auth-screen .tab-btn {
    position: relative;
    z-index: 2;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: none;
    border: none;
    color: #64748b;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 10px 0;
    cursor: pointer;
    transition: color 0.2s ease;
    border-radius: 10px;
}

#auth-screen .tab-btn.active {
    color: #ffffff;
}

#auth-screen .card-title-group {
    text-align: center;
    margin-bottom: 20px;
}

#auth-screen .card-title-group h2 {
    font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
    font-size: 1.55rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

#auth-screen .card-title-group p {
    font-size: 0.88rem;
    color: #94a3b8;
    line-height: 1.35;
}

#auth-screen .auth-error {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 0.84rem;
    margin-bottom: 16px;
    line-height: 1.35;
}

#auth-screen .auth-error.hidden {
    display: none !important;
}

#auth-screen .input-group {
    margin-bottom: 15px;
}

#auth-screen .label-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

#auth-screen .label-row label {
    font-size: 0.86rem;
    font-weight: 600;
    color: #f8fafc;
}

#auth-screen .input-hint {
    font-size: 0.78rem;
    font-weight: 500;
    color: #64748b;
    font-family: monospace;
}

#auth-screen .input-field-wrap {
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(4, 9, 20, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#auth-screen .input-field-wrap:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.16);
}

#auth-screen .field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 13px;
    color: #64748b;
    pointer-events: none;
}

#auth-screen .input-field-wrap input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.94rem;
    padding: 12px 12px 12px 10px;
}

#auth-screen .input-field-wrap input::placeholder {
    color: rgba(148, 163, 184, 0.35);
}

#auth-screen .field-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 12px;
    background: transparent;
    transition: background 0.2s ease;
}

#auth-screen .field-status-dot.valid {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

#auth-screen .field-toggle-btn {
    background: none;
    border: none;
    padding: 0 12px;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

#auth-screen .field-toggle-btn:hover {
    color: #f8fafc;
}

#auth-screen .cyber-btn {
    width: 100%;
    margin-top: 18px;
    margin-bottom: 18px;
    background: #10b981;
    border: none;
    border-radius: 12px;
    padding: 13px 20px;
    color: #04100c;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 0.98rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.45);
    transition: transform 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

#auth-screen .cyber-btn:hover {
    background: #34d399;
    box-shadow: 0 6px 24px rgba(52, 211, 153, 0.55);
}

#auth-screen .cyber-btn:active {
    transform: scale(0.985);
}

#auth-screen .btn-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

#auth-screen .security-pills-row {
    display: flex;
    justify-content: space-between;
    gap: 6px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

#auth-screen .pill-badge {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(4, 9, 20, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 9999px;
    padding: 6px 4px;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
}

#auth-screen .pill-badge svg {
    color: #34d399;
    flex-shrink: 0;
}

#auth-screen .auth-footer {
    margin-top: 22px;
    font-size: 0.78rem;
    color: #64748b;
    line-height: 1.4;
    max-width: 340px;
}

/* =========================================
   2. Main Layout (Sidebar + Chat) 
   ========================================= */
#main-layout {
    display: flex;
    width: 100%;
    height: 100%;
    background: var(--bg-app);
}

/* --- Sidebar --- */
#sidebar {
    width: 320px;
    min-width: 320px;
    background-color: #0b141a;
    background-image:
        linear-gradient(rgba(11, 20, 26, 0.94), rgba(11, 20, 26, 0.94)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23ffffff' fill-opacity='0.02'%3E%3Cpath d='M0 0h40v40H0V0zm40 40h40v40H40V40zm0-40h2l-2 2V0zm0 4l4-4h2l-6 6V4zm0 4l8-8h2L40 10V8zm0 4L52 0h2L40 14v-2zm0 4L56 0h2L40 18v-2zm0 4L60 0h2L40 22v-2zm0 4L64 0h2L40 26v-2zm0 4L68 0h2L40 30v-2zm0 4L72 0h2L40 34v-2zm0 4L76 0h2L40 38v-2zm0 4L80 0v2L42 40h-2zm4 0L80 4v2L46 40h-2zm4 0L80 8v2L50 40h-2zm4 0l28-28v2L54 40h-2zm4 0l24-24v2L58 40h-2zm4 0l20-20v2L62 40h-2zm4 0l16-16v2L66 40h-2zm4 0l12-12v2L70 40h-2zm4 0l8-8v2l-6 6h-2zm4 0l4-4v2l-2 2h-2z'/%3E%3C/g%3E%3C/svg%3E");
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    flex-direction: column;
    position: relative;
}

.pane-header,
#sidebar .pane-header {
    height: 54px !important;
    min-height: 54px !important;
    max-height: 54px !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, rgba(14, 22, 34, 0.72) 100%) !important;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    box-shadow: 
        inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.35),
        inset 0 -1px 1px 0 rgba(255, 255, 255, 0.03),
        0 4px 16px rgba(0, 0, 0, 0.3) !important;
    flex-shrink: 0;
    box-sizing: border-box;
    z-index: 10;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    min-width: 0;
    flex: 1;
}

.avatar-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    box-shadow: 
        inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.45),
        0 2px 8px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 600;
    font-size: 0.95rem;
    position: relative;
    background-size: cover;
    background-position: center;
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease;
}

.avatar-circle.clickable {
    cursor: pointer;
}

.avatar-circle.clickable:hover {
    transform: scale(1.06);
    border-color: rgba(74, 222, 128, 0.65);
    box-shadow: 
        inset 0 1.2px 2px 0 rgba(255, 255, 255, 0.6),
        0 3px 12px rgba(34, 197, 94, 0.3);
}

.avatar-circle.clickable:active {
    transform: scale(0.96);
}

.avatar-circle.clickable:hover::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 14px;
    height: 14px;
    background: #22c55e url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230b141a'%3E%3Cpath d='M9 2L7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2H9zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5z'/%3E%3C/svg%3E") center center / 8px 8px no-repeat;
    border-radius: 50%;
    border: 1.5px solid #0b141a;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    pointer-events: none;
    z-index: 5;
}

.avatar-circle.small {
    width: 36px;
    height: 36px;
    font-size: 0.88rem;
}

#my-username {
    font-size: 0.95rem;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Base Liquid Glass Action Pill */
.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 33px;
    padding: 0 13px;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 500;
    letter-spacing: 0.15px;
    color: rgba(255, 255, 255, 0.85);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 
        inset 0 1px 1.2px 0 rgba(255, 255, 255, 0.35),
        inset 0 -1px 1px 0 rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    box-sizing: border-box;
}

.action-btn svg {
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

/* New Chat: Liquid Emerald Glass */
#new-chat-btn,
.action-btn.primary-text {
    color: #4ade80 !important;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.22) 0%, rgba(20, 83, 45, 0.45) 100%) !important;
    border: 1px solid rgba(74, 222, 128, 0.42) !important;
    box-shadow: 
        inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.45),
        inset 0 -1px 1px 0 rgba(0, 0, 0, 0.2),
        0 3px 12px rgba(34, 197, 94, 0.22) !important;
    font-weight: 600;
}

#new-chat-btn:hover,
.action-btn.primary-text:hover {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.35) 0%, rgba(22, 101, 52, 0.65) 100%) !important;
    border-color: rgba(74, 222, 128, 0.75) !important;
    box-shadow: 
        inset 0 1px 2px 0 rgba(255, 255, 255, 0.65),
        0 4px 16px rgba(34, 197, 94, 0.35) !important;
    color: #86efac !important;
    transform: translateY(-1px);
}

#new-chat-btn:active,
.action-btn.primary-text:active {
    transform: translateY(0) scale(0.96);
    box-shadow: 
        inset 0 1px 1px 0 rgba(0, 0, 0, 0.3),
        0 1px 4px rgba(34, 197, 94, 0.2) !important;
}

/* Logout: Liquid Frosted Glass with Rose Sheen Hover */
#logout-btn {
    color: rgba(255, 255, 255, 0.82) !important;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, rgba(255, 255, 255, 0.02) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 
        inset 0 1px 1.2px 0 rgba(255, 255, 255, 0.32),
        inset 0 -1px 1px 0 rgba(0, 0, 0, 0.15),
        0 2px 8px rgba(0, 0, 0, 0.22) !important;
}

#logout-btn:hover {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.20) 0%, rgba(185, 28, 28, 0.12) 100%) !important;
    border-color: rgba(248, 113, 113, 0.50) !important;
    color: #fca5a5 !important;
    box-shadow: 
        inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.45),
        0 3px 14px rgba(239, 68, 68, 0.25) !important;
    transform: translateY(-1px);
}

#logout-btn:active {
    transform: translateY(0) scale(0.96);
}

/* --- Search Bar: Liquid Glass Capsule --- */
.search-bar {
    padding: 10px 14px 8px 14px;
    position: relative;
    flex-shrink: 0;
}

.search-input-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: rgba(255, 255, 255, 0.45);
    pointer-events: none;
    transition: color 0.2s ease;
    z-index: 2;
}

.search-input-wrapper:focus-within .search-icon {
    color: #4ade80;
}

.search-bar input,
#search-input {
    width: 100%;
    height: 38px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(16, 24, 38, 0.50) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    border-radius: 9999px !important;
    padding: 0 16px 0 38px !important;
    color: var(--text-primary) !important;
    font-size: 0.88rem !important;
    box-shadow: 
        inset 0 1px 1.2px 0 rgba(255, 255, 255, 0.28),
        inset 0 -1px 1px 0 rgba(255, 255, 255, 0.02),
        0 2px 8px rgba(0, 0, 0, 0.25) !important;
    outline: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    box-sizing: border-box !important;
}

.search-bar input:focus,
#search-input:focus {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(18, 28, 44, 0.60) 100%) !important;
    border-color: rgba(74, 222, 128, 0.55) !important;
    box-shadow: 
        inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.4),
        0 0 0 3px rgba(34, 197, 94, 0.14),
        0 4px 14px rgba(0, 0, 0, 0.35) !important;
}

.search-bar input::placeholder,
#search-input::placeholder {
    color: rgba(255, 255, 255, 0.42);
    font-size: 0.85rem;
}

/* --- Conversations List: High-Performance Synthetic Glass (120 FPS) --- */
#conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px 12px 8px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.chat-item {
    padding: 10px 12px;
    margin-bottom: 3px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border: 1px solid transparent;
    background: transparent;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.12s ease;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

.chat-item:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%) !important;
    border-color: rgba(255, 255, 255, 0.12) !important;
    box-shadow: 
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.18),
        0 2px 8px rgba(0, 0, 0, 0.18) !important;
}

.chat-item.active {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(255, 255, 255, 0.04) 100%) !important;
    border-color: rgba(74, 222, 128, 0.35) !important;
    box-shadow: 
        inset 0 1px 1.2px 0 rgba(255, 255, 255, 0.28),
        0 3px 12px rgba(0, 0, 0, 0.25) !important;
}

.chat-item:active {
    transform: scale(0.985);
}

.chat-item .avatar-circle {
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 
        inset 0 1px 1.2px 0 rgba(255, 255, 255, 0.35),
        0 2px 6px rgba(0, 0, 0, 0.3);
}

/* Online indicator dot */
.online-dot {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #0b141a;
    box-shadow: 0 0 6px #22c55e;
    flex-shrink: 0;
}

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3px;
}

.chat-item-name {
    font-weight: 600;
    font-size: 0.94rem;
    color: #f1f5f9;
    letter-spacing: 0.1px;
}

.chat-item-time {
    font-size: 0.74rem;
    color: rgba(255, 255, 255, 0.45);
}

.chat-item-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-item-preview {
    color: rgba(255, 255, 255, 0.55);
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #061209;
    font-size: 0.72rem;
    padding: 1px 6px;
    min-width: 18px;
    height: 18px;
    border-radius: 9999px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.4), 0 2px 6px rgba(34, 197, 94, 0.4);
    border: 1px solid rgba(74, 222, 128, 0.5);
    box-sizing: border-box;
}

/* --- Chat Area (MAJOR OVERHAUL) --- */
#chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    /* WhatsApp-style dark wallpaper background */
    background-color: #0b141a;
    background-image:
        linear-gradient(rgba(11, 20, 26, 0.92), rgba(11, 20, 26, 0.92)),
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M0 0h40v40H0V0zm40 40h40v40H40V40zm0-40h2l-2 2V0zm0 4l4-4h2l-6 6V4zm0 4l8-8h2L40 10V8zm0 4L52 0h2L40 14v-2zm0 4L56 0h2L40 18v-2zm0 4L60 0h2L40 22v-2zm0 4L64 0h2L40 26v-2zm0 4L68 0h2L40 30v-2zm0 4L72 0h2L40 34v-2zm0 4L76 0h2L40 38v-2zm0 4L80 0v2L42 40h-2zm4 0L80 4v2L46 40h-2zm4 0L80 8v2L50 40h-2zm4 0l28-28v2L54 40h-2zm4 0l24-24v2L58 40h-2zm4 0l20-20v2L62 40h-2zm4 0l16-16v2L66 40h-2zm4 0l12-12v2L70 40h-2zm4 0l8-8v2l-6 6h-2zm4 0l4-4v2l-2 2h-2z'/%3E%3C/g%3E%3C/svg%3E");
    overflow: hidden;
}

#no-chat-selected {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
    padding: 40px;
}

#no-chat-selected h2 {
    color: var(--text-primary);
    margin-bottom: 10px;
    font-size: 1.8rem;
}

#no-chat-selected p {
    opacity: 0.7;
}

#active-chat-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.chat-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    margin: 10px 14px 0 14px;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    overflow: visible;
    flex-shrink: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: auto;
}

.chat-header-pill {
    flex: 1;
    min-width: 0;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    padding: 0 14px 0 8px;
    border-radius: 9999px;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(18, 26, 38, 0.45) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow: 
        inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.55),
        inset 0 -1px 1px 0 rgba(255, 255, 255, 0.05),
        0 6px 20px -2px rgba(0, 0, 0, 0.35) !important;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: auto;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.kebab-circle-btn {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
    border-radius: 50% !important;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(18, 26, 38, 0.45) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow: 
        inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.55),
        inset 0 -1px 1px 0 rgba(255, 255, 255, 0.05),
        0 6px 20px -2px rgba(0, 0, 0, 0.35) !important;
    box-sizing: border-box;
    display: flex !important;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 !important;
    margin: 0 !important;
    cursor: pointer;
    color: var(--text-primary);
    transition: background 0.2s ease, transform 0.15s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.kebab-circle-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.16) 0%, rgba(22, 32, 48, 0.55) 100%) !important;
    border-color: rgba(255, 255, 255, 0.35) !important;
    box-shadow: 
        inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.7),
        0 8px 24px -2px rgba(0, 0, 0, 0.45) !important;
}

.kebab-circle-btn:active {
    transform: scale(0.92);
}

.chat-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.header-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.header-text h3 {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.2;
    margin: 0;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-text {
    font-size: 0.78rem;
    line-height: 1.2;
    margin-top: 1px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-text.online {
    color: var(--accent);
}

/* Typing Indicator */
.typing-text {
    font-size: 0.8rem;
    color: var(--accent);
    font-style: italic;
    animation: typingPulse 1.5s ease-in-out infinite;
}

@keyframes typingPulse {

    0%,
    100% {
        opacity: 0.6;
    }

    50% {
        opacity: 1;
    }
}

/* Messages Container */
#messages-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    box-sizing: border-box;
    padding-top: 74px;
    padding-bottom: 78px;
    padding-left: 5%;
    padding-right: 5%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
    background: transparent !important;
    position: relative;
    z-index: 1;
}

#messages-list {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 14px;
}

/* History Pagination & Top Load Banner */
.load-history-banner {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 6px 0 10px 0;
    user-select: none;
    -webkit-user-select: none;
}

.load-history-btn {
    background: rgba(30, 42, 50, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--accent, #00a884);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-size: 12px;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.load-history-btn:active {
    transform: scale(0.96);
    background: rgba(40, 56, 66, 0.95);
}

.history-top-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 8px 0;
    color: var(--accent, #00a884);
}

.history-top-spinner .spinner-svg {
    animation: spin-top 0.8s linear infinite;
}

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

/* Date Separator */
.date-separator {
    align-self: center;
    background: #182229;
    color: #8696a0;
    font-size: 12.5px;
    padding: 5px 12px;
    border-radius: 7.5px;
    margin: 10px 0;
    box-shadow: 0 1px 0.5px rgba(11, 20, 26, .13);
}

/* Message Bubbles - WhatsApp Style (Exact Match) */
.message {
    max-width: 65%;
    padding: 6px 7px 8px 9px;
    border-radius: 7.5px;
    font-size: 14.2px;
    line-height: 19px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 1px rgba(11, 20, 26, .18);
    /* Disable copy/share context menu on long press */
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

.message.sent {
    align-self: flex-end;
    background: #3b4a54;
    color: #e9edef;
    border-top-right-radius: 0;
}

.message.received {
    align-self: flex-start;
    background: #1f2c34;
    color: #e9edef;
    border-top-left-radius: 0;
}
.message.pending {
    opacity: 1;
}

/* Upload spinner on pending images (WhatsApp-style) */
.message.pending .msg-content {
    position: relative;
}
.message.pending .message-image,
.message.pending .message-gif {
    opacity: 0.5;
    filter: brightness(0.6);
}

/* Dedicated Typing & Live Peek Container (Always at bottom of messages, never trapped) */
#typing-container {
    margin-top: 4px;
    padding-bottom: 6px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex-shrink: 0;
    pointer-events: auto;
}

#typing-container.hidden {
    display: none !important;
}

/* =========================================================
   LIVE PEEK 2.0: ULTRA-SLEEK UNIFIED ARCHITECTURE (CONVOO)
   ========================================================= */

/* Base Typing Indicator */
.typing-indicator {
    max-width: 140px;
    min-width: 110px;
    width: fit-content;
    padding: 6px 7px 8px 9px !important;
    border-radius: 7.5px;
    border-top-left-radius: 0;
    background: #1f2c34;
    transition: max-width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                min-width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.25s ease,
                border-radius 0.25s ease,
                box-shadow 0.25s ease;
    will-change: transform, opacity;
}

/* Entrance animation for the typing bubble */
.typing-indicator.bubble-enter {
    animation: peekBubbleEnter 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes peekBubbleEnter {
    from { opacity: 0; transform: translateY(6px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* When Peek Mode is Open */
.typing-indicator.peek-open {
    max-width: 65% !important;
    min-width: 160px;
    width: fit-content;
    margin-bottom: 6px;
}

@media (max-width: 768px) {
    .typing-indicator.peek-open {
        max-width: 82% !important;
    }
}

.typing-indicator .msg-content.typing-bubble-content {
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
}

/* Top Chrome: Bouncing Dots + Eye Button */
.typing-bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-height: 28px;
    opacity: 1;
    margin-bottom: 6px;
    transform: translateY(0);
    transition: max-height 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.18s ease,
                margin-bottom 0.24s ease,
                transform 0.2s ease;
    overflow: hidden;
}

.typing-bubble-header.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-bottom: 0 !important;
    transform: translateY(-6px) scale(0.95);
    pointer-events: none;
}

/* 3 Bouncing Dots */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
    padding-left: 2px;
}
.typing-dots span {
    width: 7px;
    height: 7px;
    background: #8696a0;
    border-radius: 50%;
    animation: typing-bounce 1.4s infinite ease-in-out;
}
.typing-dots span:nth-child(1) { animation-delay: 0s; }
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-5px); opacity: 1; }
}

/* Paused state for dots & caret when sender pauses to think */
.typing-indicator.peer-paused .typing-dots span {
    animation-play-state: paused;
    opacity: 0.35;
    transform: translateY(0);
}
.typing-indicator.peer-paused .peek-live-dot {
    animation-play-state: paused;
    opacity: 0.4;
}
.typing-indicator.peer-paused .peek-caret {
    opacity: 0.35;
}

/* Sleek Eye Peek Button */
.typing-peek-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    outline: none;
    padding: 3px 8px;
    border-radius: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-secondary, #8696a0);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    position: relative;
}
/* Touch target expansion for mobile */
.typing-peek-btn::after {
    content: '';
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: -8px;
    right: -8px;
}
.typing-peek-btn:hover {
    color: var(--text-primary, #e9edef);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
}
.typing-peek-btn.active {
    color: #00a884;
    background: rgba(0, 168, 132, 0.16);
    border-color: rgba(0, 168, 132, 0.35);
    box-shadow: 0 0 10px rgba(0, 168, 132, 0.22);
}
.typing-peek-btn svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: stroke 0.2s ease, transform 0.2s ease;
}
.typing-peek-btn.active svg {
    filter: drop-shadow(0 0 3px #00a884);
}
.peek-btn-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* =========================================================
   Sleek Expandable Peek Drawer (Hardware-Accelerated Grid)
   ========================================================= */
.peek-drawer {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition: grid-template-rows 0.26s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.2s ease;
    width: 100%;
}
.peek-drawer.open {
    grid-template-rows: 1fr;
    opacity: 1;
}

/* When arriving initially via .bubble-enter, don't delay grid-template-rows so height is immediately full on frame 1 */
.typing-indicator.bubble-enter .peek-drawer.open {
    transition: opacity 0.18s ease;
}
.peek-drawer-inner {
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Live Draft Tag */
.peek-header-tag {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-secondary, #8696a0);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    max-height: 18px;
    opacity: 1;
    transform: translateY(0);
    transition: max-height 0.2s ease,
                opacity 0.16s ease,
                margin-bottom 0.2s ease,
                transform 0.18s ease;
    overflow: hidden;
    user-select: none;
}
.peek-header-tag.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-bottom: 0 !important;
    transform: translateY(-4px);
    pointer-events: none;
}
.peek-live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #00a884;
    box-shadow: 0 0 6px #00a884;
    animation: peekLivePulse 1.4s infinite;
}
@keyframes peekLivePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

/* Live Stream Body (Container matches .msg-content exactly) */
.peek-body {
    display: block;
    position: relative;
    width: 100%;
}

/* Stream text styling - 100% identical to standard .msg-text */
.peek-text-stream {
    display: inline;
    font-size: 14.2px;
    line-height: 19px;
    word-break: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    color: var(--text-primary, #e9edef);
}

/* Character stream trail with inline flow (preserves natural word wrapping) */
.peek-char {
    display: inline;
    transition: opacity 0.2s ease, text-shadow 0.2s ease, color 0.2s ease;
}
.peek-char.peek-head-char {
    font-weight: 600;
    color: #ffffff;
}
.typing-indicator.morphed .peek-char {
    opacity: 1 !important;
    color: inherit !important;
    text-shadow: none !important;
}

/* High-tech pulsing neon caret */
.peek-caret {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: #00a884;
    margin-left: 2px;
    vertical-align: -1px;
    box-shadow: 0 0 6px #00a884;
    animation: peekCaretPulse 0.9s infinite ease-in-out;
    transition: opacity 0.15s ease, transform 0.15s ease;
}
.peek-caret.dissolved {
    opacity: 0 !important;
    transform: scaleX(0) !important;
    pointer-events: none;
}
@keyframes peekCaretPulse {
    0%, 100% { opacity: 1; transform: scaleY(1); }
    50% { opacity: 0.25; transform: scaleY(0.85); }
}

/* Peek message footer / timestamp - inline float matching .msg-footer */
.peek-msg-footer {
    float: right;
    margin-left: 7px;
    margin-top: 4px;
    font-size: 11px;
    line-height: 15px;
    color: rgba(255, 255, 255, 0.6);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.22s ease;
}
.peek-msg-footer.revealed {
    opacity: 1;
}

/* Morphing State for Bubble */
.typing-indicator.morphing {
    transition: max-width 0.24s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.22s ease,
                box-shadow 0.22s ease;
}
.typing-indicator.morphed {
    min-width: 0 !important;
    width: fit-content !important;
}

/* Message fade-out when idle for >30s */
.typing-indicator.fading-out {
    opacity: 0;
    transform: translateY(4px) scale(0.97);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Standard Message Footer & Timestamp (WhatsApp Match) */
.msg-footer {
    float: right;
    margin-left: 7px;
    margin-top: 4px;
    font-size: 11px;
    line-height: 15px;
    color: rgba(255, 255, 255, 0.6);
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}
.timestamp {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}

/* Message text wrapper */
.msg-text {
    display: inline;
    font-size: 14.2px;
    line-height: 19px;
    word-break: break-word;
}

/* Clickable links in messages */
.message-link {
    color: #84d9ff;
    text-decoration: underline;
    word-break: break-all;
}

.message-link:hover {
    color: #b4ebff;
}

/* Spinner for pending media upload */
.message.pending .msg-content:has(.message-image)::after,
.message.pending .msg-content:has(.message-gif)::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: img-upload-spin 0.8s linear infinite;
    z-index: 5;
    pointer-events: none;
}
@keyframes img-upload-spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Input Area - Floating Liquid Glass Capsule */
.chat-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 30;
    padding: 0 14px 12px 14px;
    background: transparent !important;
    border-top: none !important;
    box-sizing: border-box;
    pointer-events: none;
    touch-action: manipulation;
}

/* Native Android App Mode (Capacitor APK): 
   1. System status bar (3:36, battery, wifi) draws over top of WebView -> pad header below status bar
   2. System navigation buttons (≡ □ <) draw over bottom of WebView -> pad above navigation bar */
body.is-native-app .pane-header {
    padding-top: max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px)) !important;
    height: calc(54px + max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px))) !important;
    min-height: calc(54px + max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px))) !important;
    max-height: calc(54px + max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px))) !important;
    box-sizing: border-box !important;
}

body.is-native-app .chat-header {
    margin-top: max(8px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px)) !important;
    padding-top: 0 !important;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    box-sizing: border-box !important;
}

body.is-native-app #messages-container {
    padding-top: calc(52px + max(8px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px)) + 12px) !important;
    padding-bottom: calc(52px + max(12px, var(--android-nav-bar, 20px), env(safe-area-inset-bottom, 20px)) + 10px) !important;
}

body.is-native-app #messages-list {
    padding-bottom: 4px !important;
}

body.is-native-app.keyboard-open #messages-container {
    padding-bottom: 66px !important;
}

body.is-native-app.keyboard-open #messages-list {
    padding-bottom: 4px !important;
}

body.is-native-app #back-btn,
body.is-native-app .header-back-btn,
body.is-native-app .chat-info,
body.is-native-app .chat-header-actions {
    transform: none !important;
}

body.is-native-app .chat-input-area {
    padding-bottom: max(12px, var(--android-nav-bar, 20px), env(safe-area-inset-bottom, 20px)) !important;
}

body.is-native-app.keyboard-open .chat-input-area {
    padding-bottom: 6px !important;
}

/* Scroll-to-bottom floating button: elevated above native Android input bar & keyboard */
body.is-native-app .scroll-bottom-btn {
    bottom: calc(54px + max(14px, var(--android-nav-bar, 24px), env(safe-area-inset-bottom, 24px)) + 14px) !important;
}

body.is-native-app.keyboard-open .scroll-bottom-btn,
body.keyboard-open .scroll-bottom-btn {
    bottom: 74px !important;
}

/* Native Android App: Wallpaper Modal Safe-Area Insets (Top Status Bar & Bottom Navigation Bar) */
body.is-native-app .wallpaper-modal-header {
    padding-top: max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px)) !important;
    height: calc(52px + max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px))) !important;
    min-height: calc(52px + max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px))) !important;
    box-sizing: border-box !important;
}

body.is-native-app .wallpaper-modal-footer {
    padding-bottom: max(18px, var(--android-nav-bar, 28px), env(safe-area-inset-bottom, 28px)) !important;
}

#message-input {
    flex: 1;
    width: 100%;
    height: 100%;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--text-primary);
    font-size: 15px;
    padding: 0 !important;
    margin: 0 !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}

#message-input::-webkit-search-decoration,
#message-input::-webkit-search-cancel-button,
#message-input::-webkit-search-results-button,
#message-input::-webkit-search-results-decoration {
    -webkit-appearance: none !important;
    display: none !important;
}

#message-input:focus {
    outline: none !important;
    background: transparent !important;
    box-shadow: none !important;
}

#message-input::placeholder {
    color: #8696a0;
}

#send-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    max-width: 36px !important;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #061209;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: transform 0.15s, background 0.2s;
    flex-shrink: 0;
    touch-action: manipulation;
    padding: 0 !important;
    margin: 0 !important;
}

#send-btn:hover {
    transform: scale(1.08);
    background: #25d366;
}

#send-btn:active {
    transform: scale(0.95);
}

/* Emoji Button */
.icon-btn {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

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

/* Emoji Picker Panel */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.emoji-item {
    font-size: 1.5rem;
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    text-align: center;
    transition: background 0.15s;
}

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

#send-btn svg,
.send-btn-ig svg {
    width: 20px;
    height: 20px;
    margin-left: 2px;
}

/* --- Modals --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

.modal-content {
    background: var(--bg-card);
    padding: 24px;
    width: 90%;
    max-width: 360px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.modal-content input {
    width: 100%;
    padding: 12px;
    background: #000;
    border: 1px solid var(--border);
    color: white;
    border-radius: 8px;
    margin: 16px 0;
}

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

.modal-actions button {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
}

.primary {
    background: var(--accent);
    color: black;
}

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

.danger {
    background: #dc2626;
    color: white;
}

.danger:hover {
    background: #ef4444;
}

.modal-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 10px 0 20px;
    line-height: 1.4;
}

.error-text {
    color: #f87171;
    font-size: 0.85rem;
    margin-bottom: 10px;
}

/* Chat Item Delete Button */
.chat-item-actions {
    display: none;
    margin-left: auto;
}

.chat-item:hover .chat-item-actions,
.chat-item.show-actions .chat-item-actions {
    display: flex;
}

.delete-chat-btn {
    padding: 6px 10px;
    background: rgba(220, 38, 38, 0.2);
    color: #f87171;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
}

.delete-chat-btn:hover {
    background: rgba(220, 38, 38, 0.4);
}

/* --- Mobile Responsive --- */
.mobile-only {
    display: none;
}

#back-btn,
.header-back-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-primary, #f4f4f5);
    cursor: pointer;
    padding: 0;
    margin-right: 4px;
    margin-left: -4px;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

#back-btn:active,
.header-back-btn:active {
    background-color: rgba(255, 255, 255, 0.12);
}

#back-btn svg,
.header-back-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    fill: currentColor;
}

@media (max-width: 768px) {
    #sidebar {
        width: 100%;
        border-right: none;
    }

    #chat-area {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 100;
        transform: translateX(100%);
        transition: transform 0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
        background: var(--bg-app);
        will-change: transform;
        backface-visibility: hidden;
    }

    /* When chat is active */
    body.show-chat #chat-area {
        transform: none !important;
        will-change: auto !important;
        backface-visibility: visible !important;
    }

    body.show-chat #sidebar {
        display: none;
    }

    .mobile-only,
    #back-btn,
    .header-back-btn {
        display: flex;
    }

    .pane-header,
    #sidebar .pane-header {
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
        padding: 0 14px !important;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.09) 0%, rgba(14, 22, 34, 0.72) 100%) !important;
        backdrop-filter: blur(14px) saturate(180%);
        -webkit-backdrop-filter: blur(14px) saturate(180%);
        border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
        box-shadow: 
            inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.35),
            inset 0 -1px 1px 0 rgba(255, 255, 255, 0.03),
            0 4px 16px rgba(0, 0, 0, 0.3) !important;
    }

    .chat-header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 20;
        height: 52px !important;
        min-height: 52px !important;
        max-height: 52px !important;
        margin: 8px 10px 0 10px;
        padding: 0 !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        gap: 8px;
        pointer-events: auto;
    }

    .chat-header-pill {
        flex: 1;
        min-width: 0;
        height: 52px !important;
        min-height: 52px !important;
        max-height: 52px !important;
        padding: 0 10px 0 8px !important;
        border-radius: 9999px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
        backdrop-filter: blur(14px) saturate(180%);
        -webkit-backdrop-filter: blur(14px) saturate(180%);
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(18, 26, 38, 0.45) 100%) !important;
        border: 1px solid rgba(255, 255, 255, 0.22) !important;
        box-shadow: 
            inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.55),
            inset 0 -1px 1px 0 rgba(255, 255, 255, 0.05),
            0 6px 20px -2px rgba(0, 0, 0, 0.35) !important;
        pointer-events: auto;
    }

    .kebab-circle-btn {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        max-width: 52px !important;
        border-radius: 50% !important;
        backdrop-filter: blur(14px) saturate(180%);
        -webkit-backdrop-filter: blur(14px) saturate(180%);
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(18, 26, 38, 0.45) 100%) !important;
        border: 1px solid rgba(255, 255, 255, 0.22) !important;
        box-shadow: 
            inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.55),
            inset 0 -1px 1px 0 rgba(255, 255, 255, 0.05),
            0 6px 20px -2px rgba(0, 0, 0, 0.35) !important;
        box-sizing: border-box;
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        padding: 0 !important;
        margin: 0 !important;
        pointer-events: auto;
    }

    #back-btn,
    .header-back-btn,
    .chat-info,
    .chat-header-actions {
        transform: none !important;
    }

    /* Native Android APK Mode: Status bar safe-area top padding */
    body.is-native-app .pane-header,
    body.is-native-app #sidebar .pane-header {
        padding-top: max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px)) !important;
        height: calc(54px + max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px))) !important;
        min-height: calc(54px + max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px))) !important;
        max-height: calc(54px + max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px))) !important;
        box-sizing: border-box !important;
    }

    body.is-native-app .chat-header {
        margin-top: max(10px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px)) !important;
        padding-top: 0 !important;
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
        box-sizing: border-box !important;
    }

    body.is-native-app .chat-header-pill {
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
    }

    body.is-native-app .kebab-circle-btn {
        width: 54px !important;
        height: 54px !important;
        min-width: 54px !important;
        max-width: 54px !important;
    }

    body.is-native-app #back-btn,
    body.is-native-app .header-back-btn,
    body.is-native-app .chat-info,
    body.is-native-app .chat-header-actions {
        transform: none !important;
    }

    .chat-info {
        gap: 8px;
        align-items: center;
        min-width: 0;
    }

    .header-text {
        display: flex;
        flex-direction: column;
        justify-content: center;
        min-width: 0;
    }

    .header-text h3 {
        font-size: 0.95rem;
        font-weight: 600;
        line-height: 1.15;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .status-text {
        font-size: 0.74rem;
        line-height: 1.15;
        margin-top: 1px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* =========================================
   GIF Feature Styles
   ========================================= */

/* GIF Button */
.gif-button {
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.gif-button:hover {
    background: var(--accent);
    color: #111b21;
}

/* =========================================
   Liquid Glass GIF Selection Modal
   ========================================= */
.gif-picker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #090b10;
    display: flex;
    flex-direction: column;
    z-index: 300;
    pointer-events: auto !important;
    animation: gifPickerGlassFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    will-change: transform, opacity;
    overscroll-behavior: contain;
}

.gif-picker * {
    pointer-events: auto;
}

@keyframes gifPickerGlassFadeIn {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.99);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.gif-picker.hidden {
    display: none !important;
}

.gif-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(18, 24, 38, 0.50) 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.4),
        0 6px 20px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    color: var(--text-primary, #ffffff);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    flex-shrink: 0;
}

body.is-native-app .gif-picker-header {
    padding-top: max(38px, var(--android-status-bar, 38px), env(safe-area-inset-top, 38px));
}

.gif-close {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #f87171;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    transition: background 0.18s ease, transform 0.15s ease, border-color 0.18s ease;
}

.gif-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #ef4444;
    transform: scale(1.06);
}

.gif-close:active {
    transform: scale(0.94);
}

/* Glass Capsule Search Bar */
.gif-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin: 10px 14px 6px;
    height: 44px;
    border-radius: 9999px;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(18, 24, 38, 0.45) 100%);
    border: 1px solid rgba(255, 255, 255, 0.22);
    box-shadow: 
        inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.55),
        inset 0 -1px 1px 0 rgba(255, 255, 255, 0.08),
        0 6px 18px 0 rgba(0, 0, 0, 0.3);
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
    flex-shrink: 0;
}

.gif-search-wrapper:focus-within {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(22, 30, 48, 0.58) 100%);
    border-color: rgba(255, 255, 255, 0.38);
    box-shadow: 
        inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.65),
        0 8px 24px -4px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(34, 197, 94, 0.35);
}

.gif-search-icon {
    margin-left: 14px;
    color: rgba(255, 255, 255, 0.6);
    flex-shrink: 0;
    pointer-events: none;
}

.gif-picker input,
.gif-search-wrapper input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    padding: 0 10px !important;
    margin: 0 !important;
    height: 100% !important;
    color: #ffffff !important;
    font-size: 16px !important; /* Prevents auto-zoom on mobile */
    font-family: inherit;
    box-shadow: none !important;
}

.gif-picker input::placeholder,
.gif-search-wrapper input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.gif-search-clear {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 18px;
    padding: 0 12px;
    cursor: pointer;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.gif-search-clear:hover {
    color: #ffffff;
}

/* Dynamic Aspect-Ratio Flex Masonry Grid */
.gif-grid {
    flex: 1 1 0%;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 14px max(24px, env(safe-area-inset-bottom, 24px));
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior-y: contain;
    will-change: scroll-position;
    display: flex;
    flex-direction: column;
}

.gif-columns-container {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    width: 100%;
}

.gif-column {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gif-card {
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(18, 24, 38, 0.4) 100%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 
        inset 0 1px 1px 0 rgba(255, 255, 255, 0.25),
        0 4px 14px rgba(0, 0, 0, 0.28);
    cursor: pointer;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: transform 0.16s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.gif-card img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    border-radius: 11px;
}

@media (hover: hover) and (pointer: fine) {
    .gif-card:hover {
        transform: translateY(-2px) scale(1.02);
        border-color: rgba(34, 197, 94, 0.45);
        box-shadow: 
            inset 0 1px 1px 0 rgba(255, 255, 255, 0.4),
            0 8px 22px rgba(0, 0, 0, 0.45);
    }
}

.gif-grid .gif-empty-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    gap: 12px;
    width: 100%;
}

.gif-grid .gif-empty-prompt svg {
    color: rgba(255, 255, 255, 0.25);
    width: 48px;
    height: 48px;
}

.gif-grid .gif-empty-prompt span {
    font-size: 0.95rem;
    letter-spacing: -0.01em;
}

.gif-grid .gif-loading,
.gif-grid .gif-empty {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 40px 16px;
    font-size: 0.95rem;
    width: 100%;
}

.gif-loading-more {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 16px 0 24px;
    font-size: 0.85rem;
    width: 100%;
    flex-shrink: 0;
}

.gif-loading-more.hidden {
    display: none !important;
}

/* GIF Messages in Chat */
.message-gif {
    max-width: 250px;
    border-radius: 8px;
    display: block;
}

.message.sent .message-gif,
.message.received .message-gif {
    max-width: 100%;
}

/* =========================================
   Image Sharing Feature
   ========================================= */

/* Image Button */
.img-button {
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.img-button:hover {
    background: var(--accent);
    color: #111b21;
}




.image-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: var(--bg-header);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 30px 40px;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--text-primary);
}

.image-option:hover {
    border-color: var(--accent);
    background: var(--bg-sidebar);
}

.image-option svg {
    fill: var(--accent);
}

.image-option span {
    font-size: 1rem;
    font-weight: 500;
}

/* Image Preview Container */
.image-preview-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    background: var(--bg-app);
    overflow: hidden;
}

.image-preview-container.hidden {
    display: none;
}

#image-preview {
    flex: 1;
    min-height: 0;
    max-height: calc(100vh - 200px);
    object-fit: contain;
    border-radius: 8px;
    background: #000;
}

.image-preview-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    padding: 16px 0;
    flex-shrink: 0;
}

.image-discard {
    background: #374151;
    color: #fff;
    border: none;
    padding: 12px 24px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s;
}

.image-discard:hover {
    background: #4b5563;
}

.image-send {
    background: var(--accent);
    color: #111b21;
    border: none;
    padding: 12px 32px;
    border-radius: 24px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s;
}

.image-send:hover {
    background: #1aa06d;
}

/* Image & GIF Messages in Chat - Touch & Gesture Optimization */
.message-image,
.message-gif {
    max-width: 280px;
    border-radius: 8px;
    display: block;
    cursor: pointer;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
    user-drag: none;
    user-select: none;
    -webkit-user-select: none;
    touch-action: pan-y;
}

.message.sent .message-image,
.message.received .message-image,
.message.sent .message-gif,
.message.received .message-gif {
    max-width: 100%;
}

/* Image Lightbox / Zoom Viewer */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.97);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 300;
}

.lightbox-toolbar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 16px;
    z-index: 301;
    background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
    padding-top: max(12px, env(safe-area-inset-top));
}

.lb-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s;
}
.lb-btn:active { background: rgba(255,255,255,0.3); }

.lb-img-wrap {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    touch-action: none;
}

.lb-img-wrap img {
    max-width: 95%;
    max-height: 90%;
    object-fit: contain;
    transition: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

/* Image Queue Bar */
.image-queue-bar {
    background: #1a2e35;
    border-bottom: 1px solid #2a3942;
    padding: 8px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 50;
}
.image-queue-bar.hidden { display: none; }
.iqb-text {
    font-size: 13px;
    color: #8696a0;
    white-space: nowrap;
    flex-shrink: 0;
}
.iqb-progress {
    flex: 1;
    height: 4px;
    background: #2a3942;
    border-radius: 2px;
    overflow: hidden;
}
.iqb-fill {
    height: 100%;
    background: #00a884;
    border-radius: 2px;
    transition: width 0.3s ease;
}

/* =========================================
   Reply Preview (above input)
   ========================================= */
.reply-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    background: rgba(18, 24, 38, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-left: 4px solid #00a884;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 12px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: auto;
}

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

.reply-content {
    flex: 1;
    overflow: hidden;
}

.reply-name {
    display: block;
    color: #00a884;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 2px;
}

.reply-text {
    display: block;
    color: #8696a0;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-close {
    background: none;
    border: none;
    color: #8696a0;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    margin-left: 8px;
}

.reply-close:hover {
    color: #e9edef;
}

/* Quoted Reply inside message bubble */
.message-quote {
    background: rgba(0, 0, 0, 0.2);
    border-left: 3px solid #00a884;
    padding: 6px 10px;
    margin-bottom: 6px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.message.received .message-quote {
    border-left-color: #7f66ff;
}

.quote-name {
    display: block;
    color: #00a884;
    font-weight: 600;
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.message.received .quote-name {
    color: #7f66ff;
}

.quote-text {
    color: rgba(255, 255, 255, 0.7);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* =========================================
   Two-Way Message Swiping & Action Chips
   ========================================= */
.message {
    touch-action: pan-y;
    position: relative;
}

.message.swiping {
    transition: none !important;
}

.message.snapback {
    transition: transform 0.16s cubic-bezier(0.25, 1, 0.5, 1) !important;
}

/* LTR: Left Swipe Reply Icon */
.message .swipe-reply-icon {
    position: absolute;
    left: -42px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    display: none;
    font-size: 1.2rem;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    color: #00a884;
}

.message.swiping-right .swipe-reply-icon {
    display: block;
    opacity: 1;
}/* RTL: Right Swipe Action Dock (Linear / Raycast Luxury Minimal) */
.message-swipe-actions {
    position: absolute;
    right: -88px;
    top: 50%;
    transform: translateY(-50%);
    display: none;
    align-items: center;
    gap: 3px;
    background: #18181b;
    border: 1px solid #3f3f46;
    border-radius: 12px;
    padding: 3px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 10;
}

.message-swipe-actions.single-action {
    right: -46px;
    gap: 0;
}

.message.swiping-left .message-swipe-actions,
.message.actions-open .message-swipe-actions {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}

.swipe-act-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 9px;
    border: none;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #a1a1aa;
    transition: all 0.15s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    padding: 0;
}

.swipe-act-btn:active {
    transform: scale(0.92);
}

.swipe-act-btn.edit-act:hover,
.swipe-act-btn.edit-act:active {
    background: #27272a;
    color: #38bdf8;
    box-shadow: 0 0 10px rgba(56, 189, 248, 0.25);
}

.swipe-act-btn.delete-act:hover,
.swipe-act-btn.delete-act:active {
    background: #27272a;
    color: #f43f5e;
    box-shadow: 0 0 10px rgba(244, 63, 94, 0.25);
}

/* (Edited) badge in message footer */
.msg-edited-badge {
    font-size: 10.5px;
    opacity: 0.7;
    margin-right: 4px;
    font-style: italic;
    letter-spacing: 0.2px;
}

/* Editing Preview Banner (above input) */
.editing-preview {
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    background: rgba(18, 24, 38, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-left: 4px solid #00a884;
    padding: 8px 12px;
    margin-bottom: 6px;
    border-radius: 12px;
    touch-action: manipulation;
    user-select: none;
    animation: editingSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.editing-preview.hidden {
    display: none;
}

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

.editing-bar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    overflow: hidden;
}

.editing-icon-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(0, 168, 132, 0.2);
    color: #00a884;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.editing-content {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.editing-label {
    font-size: 11.5px;
    font-weight: 600;
    color: #00a884;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.editing-text {
    font-size: 13px;
    color: #8696a0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.editing-close {
    background: none;
    border: none;
    color: #8696a0;
    font-size: 16px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
}

.editing-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   Reaction Picker Popup
   ========================================= */
.reaction-picker {
    position: fixed;
    display: flex;
    gap: 4px;
    background: #1f2c34;
    border-radius: 24px;
    padding: 6px 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    z-index: 200;
    animation: popIn 0.15s ease-out;
}

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

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

.reaction-picker.hidden {
    display: none;
}

.reaction-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    padding: 6px;
    cursor: pointer;
    border-radius: 50%;
    transition: transform 0.15s, background 0.15s;
}

.reaction-btn:hover {
    transform: scale(1.3);
    background: rgba(255, 255, 255, 0.1);
}

/* =========================================
   Message Reactions Display
   ========================================= */
.message-reactions {
    display: flex;
    gap: 2px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.reaction-badge {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 2px;
    cursor: pointer;
}

.reaction-badge:hover {
    background: rgba(0, 0, 0, 0.5);
}

.reaction-emoji {
    font-size: 1rem;
}

.reaction-count {
    font-size: 0.7rem;
    color: #8696a0;
}

/* =========================================
   Desktop Hover Menu (Reply/React buttons)
   ========================================= */
.message-hover-menu {
    position: absolute;
    top: -8px;
    display: none;
    gap: 4px;
    background: #1f2c34;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    z-index: 50;
}

.message.sent .message-hover-menu {
    left: -80px;
}

.message.received .message-hover-menu {
    right: -80px;
}

/* Show on hover (desktop only) */
@media (hover: hover) and (pointer: fine) {
    .message:hover .message-hover-menu {
        display: flex;
    }
}

/* Ensure mobile devices, coarse touch pointers, and narrow screens never display the desktop hover menu */
@media (hover: none), (pointer: coarse), (max-width: 768px) {
    .message-hover-menu {
        display: none !important;
    }
}

.hover-btn {
    background: none;
    border: none;
    color: #8696a0;
    font-size: 1rem;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

.hover-btn:hover {
    background: rgba(0, 168, 132, 0.2);
    color: #00a884;
}

/* =========================================
   Voice Notes Feature
   ========================================= */

/* Voice Button */
.voice-button {
    background: transparent;
    border: 1.5px solid var(--accent);
    color: var(--accent);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.voice-button:hover {
    background: var(--accent);
    color: #111b21;
}

.voice-button.recording {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    animation: pulse 1s ease-in-out infinite;
}

@keyframes pulse {

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

    50% {
        transform: scale(1.1);
    }
}

/* Voice Recording Modal */
.voice-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-header);
    padding: 20px;
    padding-bottom: max(20px, env(safe-area-inset-bottom));
    z-index: 300;
    border-top: 1px solid var(--border);
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.voice-modal.hidden {
    display: none;
}

.voice-modal-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 600px;
    margin: 0 auto;
}

.voice-recording-indicator {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

/* Waveform Animation */
.voice-waveform {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 32px;
}

.voice-waveform span {
    width: 4px;
    background: #ef4444;
    border-radius: 2px;
    animation: waveform 0.5s ease-in-out infinite;
}

.voice-waveform span:nth-child(1) {
    height: 12px;
    animation-delay: 0s;
}

.voice-waveform span:nth-child(2) {
    height: 20px;
    animation-delay: 0.1s;
}

.voice-waveform span:nth-child(3) {
    height: 28px;
    animation-delay: 0.2s;
}

.voice-waveform span:nth-child(4) {
    height: 20px;
    animation-delay: 0.3s;
}

.voice-waveform span:nth-child(5) {
    height: 12px;
    animation-delay: 0.4s;
}

@keyframes waveform {

    0%,
    100% {
        transform: scaleY(0.5);
    }

    50% {
        transform: scaleY(1);
    }
}

.voice-timer {
    font-size: 1.2rem;
    font-weight: 600;
    color: #ef4444;
    min-width: 50px;
}

.voice-actions {
    display: flex;
    gap: 16px;
}

.voice-cancel,
.voice-send {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.voice-cancel {
    background: #374151;
    color: white;
}

.voice-cancel:hover {
    background: #4b5563;
}

.voice-send {
    background: var(--accent);
    color: #111b21;
}

.voice-send:hover {
    background: #16a34a;
}

/* Voice Message in Chat */
.voice-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    min-width: 200px;
    touch-action: pan-y;
    user-select: none;
    -webkit-user-select: none;
}

.voice-play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.voice-play-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.voice-progress-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 6px 0;
    cursor: pointer;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.voice-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.22);
    border-radius: 3px;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}

.voice-progress-bar {
    height: 100%;
    background: white;
    width: 0%;
    border-radius: 3px;
    pointer-events: none;
}

.voice-duration {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.7);
}

.voice-dl-btn {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.2s, background 0.2s;
}
.voice-dl-btn:hover {
    color: white;
    background: rgba(255,255,255,0.15);
}

/* Video Message */
.video-message {
    position: relative;
    min-width: 200px;
    max-width: 100%;
    touch-action: pan-y;
}

.message-video {
    width: 100%;
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    display: block;
    background: #000;
    -webkit-user-drag: none;
    user-select: none;
    touch-action: pan-y;
}

.video-dl-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
}
.video-dl-btn:hover {
    background: rgba(0,0,0,0.8);
}

/* =========================================
   Shared Wallpaper Feature
   ========================================= */

/* Wallpaper Button in Header */
.wallpaper-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s;
    margin-left: auto;
}

.wallpaper-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent);
}

/* Wallpaper Modal */
.wallpaper-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-app);
    z-index: 300;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100dvh;
    overflow: hidden;
    animation: fadeIn 0.2s ease-out;
}

.wallpaper-modal.hidden {
    display: none;
}

.wallpaper-modal-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    padding-top: max(14px, env(safe-area-inset-top));
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-primary);
}

.wallpaper-close {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
}

/* =========================================
   Luxury Dynamic & Gyroscope Wallpaper Engine
   ========================================= */

/* Wallpaper Layer (Zero-Lag GPU Compositor Architecture) */
.chat-wallpaper-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    will-change: transform;
    transform: translate3d(var(--tilt-x, 0px), var(--tilt-y, 0px), 0) scale(1.08);
    transition: none;
}

.chat-wallpaper-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(14px);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.chat-wallpaper-layer.has-dynamic .chat-wallpaper-canvas {
    opacity: 1;
}

.chat-wallpaper-layer.has-pattern .chat-wallpaper-canvas {
    opacity: 1;
    filter: none !important;
}

.chat-wallpaper-image {
    position: absolute;
    inset: -20px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.chat-wallpaper-layer.has-image .chat-wallpaper-image {
    opacity: 1;
}

.chat-wallpaper-dimmer {
    position: absolute;
    inset: 0;
    background: #09090b;
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Unburdened 120 FPS Message Scroll Layer */
#messages-container {
    position: relative;
    z-index: 1;
    background: transparent !important;
}

/* =========================================
   Wallpaper Modal Luxury UI
   ========================================= */
.wallpaper-modal-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 10px 14px 12px;
    gap: 8px;
    overflow: hidden;
}

/* Mode Switcher Tabs */
.wp-mode-tabs {
    flex-shrink: 0;
    display: flex;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 3px;
    gap: 3px;
}

.wp-tab-btn {
    flex: 1;
    padding: 7px 10px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    text-align: center;
}

.wp-tab-btn:hover {
    color: #fff;
}

.wp-tab-btn.active {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Wallpaper Live Preview Box (Pinned at top) */
.wallpaper-preview {
    flex-shrink: 0;
    position: relative;
    height: 120px;
    border-radius: 12px;
    overflow: hidden;
    background: #09090b;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(0, 0, 0, 0.25);
}

/* Scrollable Presets Grid Area (Only this area scrolls) */
.wp-scroll-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    padding-right: 2px;
}

/* Pinned Footer Controls */
.wallpaper-modal-footer {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: var(--bg-app);
}

.wallpaper-preview-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.wallpaper-preview.has-dynamic .wallpaper-preview-canvas {
    opacity: 1;
}

.wallpaper-preview.has-pattern .wallpaper-preview-canvas {
    opacity: 1;
    filter: none !important;
}

.wallpaper-preview-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.wallpaper-preview.has-image .wallpaper-preview-image {
    opacity: 1;
}

.wallpaper-preview-dimmer {
    position: absolute;
    inset: 0;
    background: #09090b;
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

.wallpaper-dummy-messages {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    height: 100%;
    padding: 10px 12px;
    gap: 6px;
    pointer-events: none;
}

.dummy-msg {
    max-width: 82%;
    padding: 5px 10px;
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.3;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.dummy-msg.sent {
    background: #005c4b;
    color: #e9edef;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
}

.dummy-msg.received {
    background: #202c33;
    color: #e9edef;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
}

/* Preset Cards Grid */
.wp-tab-panel {
    display: none;
}

.wp-tab-panel.active {
    display: block;
}

.wp-presets-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.wp-preset-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    contain: content;
    transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.wp-preset-card:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
}

.wp-preset-card.active {
    background: rgba(0, 168, 132, 0.12);
    border-color: #00a884;
    box-shadow: 0 0 12px rgba(0, 168, 132, 0.25);
}

.preset-thumb {
    position: relative;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    background: #09090b;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.preset-thumb .thumb-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(6px);
}

.preset-thumb .thumb-orb.o1 {
    width: 24px;
    height: 24px;
    top: -4px;
    left: -4px;
}

.preset-thumb .thumb-orb.o2 {
    width: 26px;
    height: 26px;
    bottom: -4px;
    right: -4px;
}

.preset-thumb.theme-aurora .thumb-orb.o1 { background: #059669; }
.preset-thumb.theme-aurora .thumb-orb.o2 { background: #4338ca; }

.preset-thumb.theme-cyberpunk .thumb-orb.o1 { background: #ec4899; }
.preset-thumb.theme-cyberpunk .thumb-orb.o2 { background: #06b6d4; }

.preset-thumb.theme-obsidian .thumb-orb.o1 { background: #3f3f46; }
.preset-thumb.theme-obsidian .thumb-orb.o2 { background: #18181b; }

.preset-thumb.theme-sunset .thumb-orb.o1 { background: #e11d48; }
.preset-thumb.theme-sunset .thumb-orb.o2 { background: #f59e0b; }

.preset-thumb.theme-nebula .thumb-orb.o1 { background: #a855f7; }
.preset-thumb.theme-nebula .thumb-orb.o2 { background: #3b82f6; }

.preset-thumb.theme-ocean .thumb-orb.o1 { background: #06b6d4; }
.preset-thumb.theme-ocean .thumb-orb.o2 { background: #2563eb; }

.preset-thumb.theme-solar .thumb-orb.o1 { background: #f59e0b; }
.preset-thumb.theme-solar .thumb-orb.o2 { background: #c2410c; }

.preset-thumb.theme-matrix .thumb-orb.o1 { background: #84cc16; }
.preset-thumb.theme-matrix .thumb-orb.o2 { background: #10b981; }

.preset-thumb.theme-crimson .thumb-orb.o1 { background: #f43f5e; }
.preset-thumb.theme-crimson .thumb-orb.o2 { background: #be123c; }

.preset-thumb.theme-glacier .thumb-orb.o1 { background: #38bdf8; }
.preset-thumb.theme-glacier .thumb-orb.o2 { background: #2dd4bf; }

.preset-thumb.theme-amethyst .thumb-orb.o1 { background: #9333ea; }
.preset-thumb.theme-amethyst .thumb-orb.o2 { background: #e879f9; }

.preset-thumb.theme-solarflare .thumb-orb.o1 { background: #f97316; }
.preset-thumb.theme-solarflare .thumb-orb.o2 { background: #ef4444; }

/* Luxury Pattern Thumbnails */
.preset-thumb.pattern-thumb {
    background-size: 28px 28px;
    background-position: center;
    background-repeat: repeat;
    border: 1px solid rgba(255, 255, 255, 0.16);
}

.preset-thumb.pattern-thumb.theme-doodle {
    background-color: #0b141a;
    background-image: radial-gradient(circle at 4px 4px, rgba(255,255,255,0.2) 1.5px, transparent 0), radial-gradient(circle at 14px 14px, rgba(255,255,255,0.15) 2px, transparent 0);
    background-size: 18px 18px;
}
.preset-thumb.pattern-thumb.theme-topography {
    background-color: #09090b;
    background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 4px, rgba(255,255,255,0.14) 5px, transparent 6px);
}
.preset-thumb.pattern-thumb.theme-hexgrid {
    background-color: #050912;
    background-image: linear-gradient(30deg, rgba(34,211,238,0.25) 12%, transparent 12.5%, transparent 87%, rgba(34,211,238,0.25) 87.5%, rgba(34,211,238,0.25)), linear-gradient(150deg, rgba(34,211,238,0.25) 12%, transparent 12.5%, transparent 87%, rgba(34,211,238,0.25) 87.5%, rgba(34,211,238,0.25)), linear-gradient(30deg, rgba(34,211,238,0.25) 12%, transparent 12.5%, transparent 87%, rgba(34,211,238,0.25) 87.5%, rgba(34,211,238,0.25)), linear-gradient(150deg, rgba(34,211,238,0.25) 12%, transparent 12.5%, transparent 87%, rgba(34,211,238,0.25) 87.5%, rgba(34,211,238,0.25)), linear-gradient(60deg, rgba(34,211,238,0.25) 25%, transparent 25.5%, transparent 75%, rgba(34,211,238,0.25) 75%, rgba(34,211,238,0.25)), linear-gradient(60deg, rgba(34,211,238,0.25) 25%, transparent 25.5%, transparent 75%, rgba(34,211,238,0.25) 75%, rgba(34,211,238,0.25));
    background-size: 14px 24px;
    background-position: 0 0, 0 0, 7px 12px, 7px 12px, 0 0, 7px 12px;
}
.preset-thumb.pattern-thumb.theme-constellations {
    background-color: #030712;
    background-image: radial-gradient(1.5px 1.5px at 6px 6px, #fff, rgba(0,0,0,0)), radial-gradient(1.2px 1.2px at 18px 12px, rgba(147,197,253,0.95), rgba(0,0,0,0)), radial-gradient(1px 1px at 10px 22px, #fff, rgba(0,0,0,0));
    background-size: 26px 26px;
}
.preset-thumb.pattern-thumb.theme-seigaiha {
    background-color: #070a14;
    background-image: radial-gradient(circle at 100% 150%, rgba(129,140,248,0.3) 24%, transparent 25%), radial-gradient(circle at 0% 150%, rgba(129,140,248,0.3) 24%, transparent 25%), radial-gradient(circle at 50% 100%, rgba(129,140,248,0.3) 10%, transparent 11%), radial-gradient(circle at 100% 50%, rgba(129,140,248,0.3) 24%, transparent 25%), radial-gradient(circle at 0% 50%, rgba(129,140,248,0.3) 24%, transparent 25%), radial-gradient(circle at 50% 0%, rgba(129,140,248,0.3) 10%, transparent 11%);
    background-size: 16px 16px;
}
.preset-thumb.pattern-thumb.theme-carbon {
    background-color: #0a0a0a;
    background-image: linear-gradient(45deg, #27272a 25%, transparent 25%), linear-gradient(-45deg, #27272a 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #27272a 75%), linear-gradient(-45deg, transparent 75%, #27272a 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0px;
}
.preset-thumb.pattern-thumb.theme-circuit {
    background-color: #020d09;
    background-image: radial-gradient(rgba(16,185,129,0.45) 2px, transparent 2px), linear-gradient(to right, rgba(16,185,129,0.2) 1px, transparent 1px), linear-gradient(to bottom, rgba(16,185,129,0.2) 1px, transparent 1px);
    background-size: 14px 14px;
}
.preset-thumb.pattern-thumb.theme-geometric {
    background-color: #0d0b14;
    background-image: repeating-linear-gradient(45deg, rgba(244,114,182,0.22) 0, rgba(244,114,182,0.22) 1px, transparent 0, transparent 8px);
}
.preset-thumb.pattern-thumb.theme-dna {
    background-color: #040d1a;
    background-image: radial-gradient(circle at 35% 35%, rgba(56,189,248,0.4) 2.5px, transparent 3px), radial-gradient(circle at 65% 65%, rgba(192,132,252,0.4) 2.5px, transparent 3px);
}
.preset-thumb.pattern-thumb.theme-moire {
    background-color: #0b0614;
    background-image: repeating-radial-gradient(circle at 35% 35%, transparent 0, transparent 3px, rgba(192,132,252,0.3) 4px, transparent 5px), repeating-radial-gradient(circle at 65% 65%, transparent 0, transparent 3px, rgba(147,51,234,0.3) 4px, transparent 5px);
}
.preset-thumb.pattern-thumb.theme-isometric {
    background-color: #0a0a10;
    background-image: linear-gradient(30deg, rgba(250,204,21,0.25) 12%, transparent 12.5%, transparent 87%, rgba(250,204,21,0.25) 87.5%), linear-gradient(150deg, rgba(250,204,21,0.25) 12%, transparent 12.5%, transparent 87%, rgba(250,204,21,0.25) 87.5%);
    background-size: 14px 24px;
}
.preset-thumb.pattern-thumb.theme-mandala {
    background-color: #120309;
    background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 2.5px, rgba(244,63,94,0.35) 3.5px, transparent 4.5px);
}
.preset-thumb.pattern-thumb.theme-ripples {
    background-color: #020b14;
    background-image: repeating-radial-gradient(circle at 35% 40%, transparent 0, transparent 3px, rgba(34,211,238,0.35) 4px, transparent 5px), repeating-radial-gradient(circle at 70% 70%, transparent 0, transparent 3px, rgba(56,189,248,0.3) 4px, transparent 5px);
}
.preset-thumb.pattern-thumb.theme-glitch {
    background-color: #030f09;
    background-image: repeating-linear-gradient(0deg, rgba(74,222,128,0.35) 0, rgba(74,222,128,0.35) 2px, transparent 2px, transparent 5px);
}
.preset-thumb.pattern-thumb.theme-tessellation {
    background-color: #120a02;
    background-image: repeating-conic-gradient(from 0deg at 50% 50%, rgba(245,158,11,0.3) 0deg 45deg, transparent 45deg 90deg);
    background-size: 18px 18px;
}
.preset-thumb.pattern-thumb.theme-sonar {
    background-color: #020e06;
    background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 5px, rgba(34,197,94,0.4) 6px, transparent 7px);
}
.preset-thumb.pattern-thumb.theme-matrix {
    background-color: #020d06;
    background-image: repeating-linear-gradient(0deg, rgba(74,222,128,0.3) 0, rgba(74,222,128,0.3) 1.5px, transparent 1.5px, transparent 6px);
}
.preset-thumb.pattern-thumb.theme-plasma {
    background-color: #090314;
    background-image: radial-gradient(circle at 30% 40%, rgba(236,72,153,0.35) 0, transparent 50%), radial-gradient(circle at 70% 60%, rgba(6,182,212,0.35) 0, transparent 50%);
}
.preset-thumb.pattern-thumb.theme-synthwave {
    background-color: #0d0218;
    background-image: linear-gradient(0deg, rgba(6,182,212,0.4) 1px, transparent 1px), linear-gradient(90deg, rgba(236,72,153,0.3) 1px, transparent 1px);
    background-size: 16px 16px;
}
.preset-thumb.pattern-thumb.theme-quantum {
    background-color: #040914;
    background-image: radial-gradient(circle at 50% 50%, rgba(56,189,248,0.4) 3px, transparent 4px), repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 6px, rgba(129,140,248,0.3) 7px, transparent 8px);
}
.preset-thumb.pattern-thumb.theme-nebula {
    background-color: #05020c;
    background-image: radial-gradient(circle at 40% 40%, rgba(168,85,247,0.35) 0, transparent 60%), radial-gradient(circle at 70% 60%, rgba(59,130,246,0.3) 0, transparent 60%);
}
.preset-thumb.pattern-thumb.theme-voronoi {
    background-color: #020d0e;
    background-image: radial-gradient(circle at 4px 4px, rgba(45,212,191,0.35) 2px, transparent 0), radial-gradient(circle at 14px 14px, rgba(45,212,191,0.25) 2px, transparent 0);
    background-size: 20px 20px;
}
.preset-thumb.pattern-thumb.theme-origami {
    background-color: #090712;
    background-image: linear-gradient(45deg, rgba(168,85,247,0.2) 25%, transparent 25%), linear-gradient(-45deg, rgba(147,51,234,0.2) 25%, transparent 25%);
    background-size: 14px 14px;
}
.preset-thumb.pattern-thumb.theme-soundwave {
    background-color: #030c10;
    background-image: repeating-linear-gradient(90deg, rgba(45,212,191,0.4) 0, rgba(45,212,191,0.4) 2px, transparent 2px, transparent 8px);
}
.preset-thumb.pattern-thumb.theme-hypercube {
    background-color: #060714;
    background-image: linear-gradient(rgba(99,102,241,0.25) 1px, transparent 1px), linear-gradient(90deg, rgba(99,102,241,0.25) 1px, transparent 1px);
    background-size: 16px 16px;
}
.preset-thumb.pattern-thumb.theme-fibonacci {
    background-color: #120902;
    background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 3px, rgba(245,158,11,0.35) 4px, transparent 5px);
}
.preset-thumb.pattern-thumb.theme-synapse {
    background-color: #030c14;
    background-image: radial-gradient(circle at 6px 6px, rgba(56,189,248,0.4) 2px, transparent 0), radial-gradient(circle at 16px 16px, rgba(96,165,250,0.35) 2.5px, transparent 0);
    background-size: 24px 24px;
}
.preset-thumb.pattern-thumb.theme-prism {
    background-color: #0c0410;
    background-image: linear-gradient(135deg, rgba(244,63,94,0.3) 0%, rgba(245,158,11,0.3) 25%, rgba(34,197,94,0.3) 50%, rgba(6,182,212,0.3) 75%, rgba(168,85,247,0.3) 100%);
}
.preset-thumb.pattern-thumb.theme-dunes {
    background-color: #140a04;
    background-image: repeating-linear-gradient(25deg, rgba(217,119,6,0.3) 0, rgba(217,119,6,0.3) 2px, transparent 2px, transparent 10px);
}
.preset-thumb.pattern-thumb.theme-megacity {
    background-color: #050810;
    background-image: linear-gradient(rgba(6,182,212,0.35) 1.5px, transparent 1.5px), linear-gradient(90deg, rgba(236,72,153,0.35) 1.5px, transparent 1.5px);
    background-size: 22px 22px;
}
.preset-thumb.pattern-thumb.theme-vortex {
    background-color: #04020a;
    background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 4px, rgba(168,85,247,0.35) 5px, transparent 6px);
}
.preset-thumb.pattern-thumb.theme-aurora_ribbon {
    background-color: #020e0c;
    background-image: linear-gradient(90deg, rgba(16,185,129,0.3) 0%, rgba(6,182,212,0.3) 50%, rgba(168,85,247,0.3) 100%);
}
.preset-thumb.pattern-thumb.theme-blackhole {
    background-color: #020005;
    background-image: radial-gradient(circle at 50% 50%, #000 6px, rgba(245,158,11,0.5) 8px, transparent 14px);
}
.preset-thumb.pattern-thumb.theme-circuit_gold {
    background-color: #090703;
    background-image: radial-gradient(#fbbf24 2px, transparent 2px), linear-gradient(rgba(251,191,36,0.3) 1px, transparent 1px);
    background-size: 14px 14px;
}
.preset-thumb.pattern-thumb.theme-liquid_mercury {
    background-color: #050508;
    background-image: radial-gradient(circle at 35% 35%, rgba(255,255,255,0.7) 2px, rgba(148,163,184,0.3) 6px, transparent 8px);
}
.preset-thumb.pattern-thumb.theme-crystal_lattice {
    background-color: #010c08;
    background-image: linear-gradient(60deg, rgba(52,211,153,0.3) 1px, transparent 1px), linear-gradient(-60deg, rgba(52,211,153,0.3) 1px, transparent 1px);
    background-size: 14px 24px;
}
.preset-thumb.pattern-thumb.theme-hologram_globe {
    background-color: #020914;
    background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 4px, rgba(6,182,212,0.35) 5px, transparent 6px);
}
.preset-thumb.pattern-thumb.theme-neon_poly {
    background-color: #080214;
    background-image: linear-gradient(45deg, rgba(168,85,247,0.3) 25%, transparent 25%), linear-gradient(-45deg, rgba(236,72,153,0.3) 25%, transparent 25%);
    background-size: 16px 16px;
}
.preset-thumb.pattern-thumb.theme-sakura {
    background-color: #08050e;
    background-image: radial-gradient(circle at 6px 6px, rgba(244,114,182,0.6) 2.5px, transparent 3px), radial-gradient(circle at 18px 18px, rgba(251,113,133,0.5) 2px, transparent 2.5px);
    background-size: 24px 24px;
}
.preset-thumb.pattern-thumb.theme-fractal_tree {
    background-color: #030c10;
    background-image: linear-gradient(to top, rgba(45,212,191,0.4) 2px, transparent 2px);
    background-size: 16px 16px;
}
.preset-thumb.pattern-thumb.theme-superconductor {
    background-color: #030718;
    background-image: repeating-linear-gradient(0deg, rgba(56,189,248,0.35) 0, rgba(56,189,248,0.35) 1.5px, transparent 0, transparent 10px);
}
.preset-thumb.pattern-thumb.theme-astrolabe {
    background-color: #0d0802;
    background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 3px, rgba(217,119,6,0.4) 4px, transparent 5px);
}
.preset-thumb.pattern-thumb.theme-deep_abyss {
    background-color: #010512;
    background-image: radial-gradient(circle at 50% 40%, rgba(34,211,238,0.5) 3px, transparent 5px), linear-gradient(to bottom, transparent 8px, rgba(192,132,252,0.3) 16px);
    background-size: 20px 24px;
}
.preset-thumb.pattern-thumb.theme-particle_vortex {
    background-color: #060210;
    background-image: radial-gradient(circle at 50% 50%, #fff 2px, rgba(217,70,239,0.4) 4px, transparent 8px);
}
.preset-thumb.pattern-thumb.theme-quantum_cube {
    background-color: #080c14;
    background-image: linear-gradient(30deg, rgba(0,240,255,0.35) 12%, transparent 12.5%), linear-gradient(150deg, rgba(255,0,127,0.35) 12%, transparent 12.5%);
    background-size: 18px 26px;
}
.preset-thumb.pattern-thumb.theme-art_deco {
    background-color: #08080a;
    background-image: repeating-radial-gradient(circle at 50% 100%, transparent 0, transparent 3px, rgba(250,204,21,0.4) 4px, transparent 5px);
}
.preset-thumb.pattern-thumb.theme-chrono_halo {
    background-color: #02040c;
    background-image: linear-gradient(90deg, rgba(239,68,68,0.35), rgba(234,179,8,0.35), rgba(16,185,129,0.35), rgba(6,182,212,0.35), rgba(139,92,246,0.35));
}
.preset-thumb.pattern-thumb.theme-solar_corona {
    background-color: #0f0302;
    background-image: repeating-radial-gradient(circle at 50% 100%, transparent 0, transparent 4px, rgba(249,115,22,0.45) 5px, transparent 6px);
}
.preset-thumb.pattern-thumb.theme-zen_garden {
    background-color: #070a0e;
    background-image: repeating-linear-gradient(0deg, rgba(148,163,184,0.2) 0, rgba(148,163,184,0.2) 1.5px, transparent 1.5px, transparent 8px), radial-gradient(circle at 40% 50%, #1e293b 5px, rgba(16,185,129,0.5) 6px, transparent 12px);
}
.preset-thumb.pattern-thumb.theme-koi_pond {
    background-color: #020b12;
    background-image: radial-gradient(circle at 30% 30%, rgba(52,211,153,0.4) 4px, transparent 6px), radial-gradient(circle at 70% 60%, rgba(244,114,182,0.5) 3px, rgba(56,189,248,0.4) 6px, transparent 8px);
}
.preset-thumb.pattern-thumb.theme-fireflies {
    background-color: #040a08;
    background-image: radial-gradient(circle at 35% 45%, #fde047 2px, rgba(250,204,21,0.5) 4px, transparent 7px), radial-gradient(circle at 75% 65%, #86efac 2px, rgba(74,222,128,0.5) 4px, transparent 7px);
}
.preset-thumb.pattern-thumb.theme-rain_window {
    background-color: #06080e;
    background-image: repeating-linear-gradient(90deg, transparent 0, transparent 12px, rgba(148,163,184,0.25) 13px, transparent 14px);
}
.preset-thumb.pattern-thumb.theme-mandala_breathe {
    background-color: #080703;
    background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 3px, rgba(251,191,36,0.4) 4px, transparent 5px);
}
.preset-thumb.pattern-thumb.theme-silk_flow {
    background-color: #06020c;
    background-image: linear-gradient(120deg, rgba(168,85,247,0.4) 0%, rgba(236,72,153,0.3) 50%, rgba(6,182,212,0.4) 100%);
}
.preset-thumb.pattern-thumb.theme-celestial_clock {
    background-color: #02040b;
    background-image: repeating-radial-gradient(circle at 50% 50%, transparent 0, transparent 4px, rgba(56,189,248,0.35) 5px, transparent 6px);
}
.preset-thumb.pattern-thumb.theme-ferrofluid {
    background-color: #050608;
    background-image: radial-gradient(circle at 50% 50%, #fff 2px, #475569 6px, transparent 12px);
}
.preset-thumb.pattern-thumb.theme-ocean_caustics {
    background-color: #010d14;
    background-image: linear-gradient(45deg, rgba(6,182,212,0.35) 25%, transparent 25%), linear-gradient(-45deg, rgba(56,189,248,0.35) 25%, transparent 25%);
    background-size: 14px 14px;
}
.preset-thumb.pattern-thumb.theme-sand_dune_drift {
    background-color: #0b0602;
    background-image: repeating-linear-gradient(15deg, rgba(217,119,6,0.35) 0, rgba(217,119,6,0.35) 2px, transparent 2px, transparent 9px);
}
.preset-thumb.pattern-thumb.theme-harmonic_pendulum {
    background-color: #030208;
    background-image: linear-gradient(90deg, #f43f5e, #fb923c, #facc15, #4ade80, #38bdf8, #a855f7);
}
.preset-thumb.pattern-thumb.theme-biolum_waves {
    background-color: #010810;
    background-image: repeating-linear-gradient(0deg, rgba(6,182,212,0.4) 0, rgba(34,211,238,0.6) 2px, transparent 2px, transparent 12px);
}
.preset-thumb.pattern-thumb.theme-autumn_amber {
    background-color: #0c0603;
    background-image: radial-gradient(circle at 40% 40%, rgba(249,115,22,0.6) 3px, transparent 5px), radial-gradient(circle at 70% 70%, rgba(234,179,8,0.6) 3px, transparent 5px);
}
.preset-thumb.pattern-thumb.theme-nebula_cloud {
    background-color: #020108;
    background-image: radial-gradient(circle at 35% 35%, rgba(217,70,239,0.45) 0%, transparent 60%), radial-gradient(circle at 65% 65%, rgba(6,182,212,0.45) 0%, transparent 60%);
}
.preset-thumb.pattern-thumb.theme-kinetic_chime {
    background-color: #07070a;
    background-image: linear-gradient(rgba(250,204,21,0.5) 1.5px, transparent 1.5px), linear-gradient(90deg, rgba(250,204,21,0.5) 1.5px, transparent 1.5px);
    background-size: 16px 16px;
}
.preset-thumb.pattern-thumb.theme-prism_caustic {
    background-color: #040406;
    background-image: linear-gradient(135deg, rgba(239,68,68,0.4) 0%, rgba(234,179,8,0.4) 20%, rgba(34,197,94,0.4) 40%, rgba(6,182,212,0.4) 60%, rgba(59,130,246,0.4) 80%, rgba(168,85,247,0.4) 100%);
}
.preset-thumb.pattern-thumb.theme-stained_glass {
    background-color: #06060c;
    background-image: linear-gradient(45deg, #b91c1c 25%, #1d4ed8 25%, #1d4ed8 50%, #047857 50%, #047857 75%, #b45309 75%);
    background-size: 16px 16px;
}
.preset-thumb.pattern-thumb.theme-circuit_board {
    background-color: #040907;
    background-image: linear-gradient(rgba(234,179,8,0.4) 1px, transparent 1px), linear-gradient(90deg, rgba(6,182,212,0.4) 1px, transparent 1px);
    background-size: 12px 12px;
}
.preset-thumb.pattern-thumb.theme-topographic_canyon {
    background-color: #120703;
    background-image: repeating-linear-gradient(170deg, #c2410c 0, #c2410c 3px, #ea580c 3px, #ea580c 7px, #d97706 7px, #d97706 11px, #78350f 11px, #78350f 16px);
}
.preset-thumb.pattern-thumb.theme-sumi_mountains {
    background-color: #080a0f;
    background-image: linear-gradient(180deg, #1e293b 0%, #0f172a 40%, #334155 70%, #020617 100%);
}
.preset-thumb.pattern-thumb.theme-shoji_bamboo {
    background-color: #16120d;
    background-image: linear-gradient(rgba(217,119,6,0.4) 1.5px, transparent 1.5px), linear-gradient(90deg, rgba(217,119,6,0.4) 1.5px, transparent 1.5px);
    background-size: 18px 18px;
}
.preset-thumb.pattern-thumb.theme-synthwave_grid {
    background-color: #090314;
    background-image: linear-gradient(180deg, #2b0938 0%, #090314 45%, #ec4899 46%, #090314 48%), repeating-linear-gradient(90deg, rgba(6,182,212,0.5) 0, rgba(6,182,212,0.5) 1px, transparent 1px, transparent 10px);
}
.preset-thumb.pattern-thumb.theme-bauhaus_canvas {
    background-color: #101014;
    background-image: linear-gradient(to right, #dc2626 40%, #2563eb 40%, #2563eb 80%, #eab308 80%);
}
.preset-thumb.pattern-thumb.theme-audio_spectrogram {
    background-color: #030206;
    background-image: repeating-linear-gradient(0deg, #4f46e5 0, #7c3aed 3px, #db2777 6px, #ea580c 9px, #facc15 12px);
}
.preset-thumb.pattern-thumb.theme-weaving_loom {
    background-color: #0a0d0a;
    background-image: repeating-linear-gradient(45deg, #166534 0, #166534 5px, #1e3a8a 5px, #1e3a8a 10px, #991b1b 10px, #991b1b 15px);
}
.preset-thumb.pattern-thumb.theme-venetian_blinds {
    background-color: #0d0d12;
    background-image: repeating-linear-gradient(180deg, rgba(0,0,0,0.85) 0, rgba(0,0,0,0.85) 6px, transparent 6px, transparent 14px);
}
.preset-thumb.pattern-thumb.theme-kinetic_facade {
    background-color: #0a0d10;
    background-image: repeating-linear-gradient(90deg, #94a3b8 0, #e2e8f0 4px, #334155 8px, #1e293b 12px);
}
.preset-thumb.pattern-thumb.theme-basalt_waterfall {
    background-color: #060a0f;
    background-image: repeating-linear-gradient(90deg, #0f172a 0, #0f172a 6px, #38bdf8 6px, #38bdf8 8px, #1e293b 8px, #1e293b 14px);
}
.preset-thumb.pattern-thumb.theme-retro_terminal {
    background-color: #010f08;
    background-image: repeating-linear-gradient(0deg, rgba(34,197,94,0.4) 0, rgba(34,197,94,0.4) 1px, transparent 1px, transparent 4px);
}
.preset-thumb.pattern-thumb.theme-origami_facets {
    background-color: #0b0912;
    background-image: linear-gradient(60deg, #6366f1 25%, #34d399 25%, #34d399 50%, #f472b6 50%, #f472b6 75%, #fbbf24 75%);
    background-size: 14px 14px;
}
.preset-thumb.pattern-thumb.theme-vhs_drift {
    background-color: #08080c;
    background-image: repeating-linear-gradient(0deg, rgba(239,68,68,0.5) 0, rgba(59,130,246,0.5) 2px, rgba(255,255,255,0.7) 4px, transparent 5px, transparent 9px);
}
.preset-thumb.pattern-thumb.theme-penrose_isometric {
    background-color: #0a0a0e;
    background-image: linear-gradient(30deg, #f1f5f9 12%, transparent 12.5%, transparent 87%, #f1f5f9 87.5%), linear-gradient(150deg, #64748b 12%, transparent 12.5%, transparent 87%, #64748b 87.5%), linear-gradient(60deg, #1e293b 25%, transparent 25.5%, transparent 75%, #1e293b 75%);
    background-size: 16px 28px;
}
.preset-thumb.pattern-thumb.theme-fluted_glass {
    background-color: #080c10;
    background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.4) 0, rgba(56,189,248,0.3) 2px, transparent 3px, rgba(0,0,0,0.5) 6px);
}
.preset-thumb.pattern-thumb.theme-wood_marquetry {
    background-color: #140c08;
    background-image: linear-gradient(45deg, #78350f 25%, #a16207 25%, #a16207 50%, #92400e 50%, #92400e 75%, #451a03 75%);
    background-size: 14px 14px;
}
.preset-thumb.pattern-thumb.theme-seismic_drum {
    background-color: #070a0e;
    background-image: repeating-linear-gradient(0deg, rgba(148,163,184,0.2) 0, rgba(148,163,184,0.2) 1px, transparent 1px, transparent 8px), linear-gradient(90deg, #ef4444 20%, #10b981 40%, #06b6d4 70%, #f59e0b 90%);
}
.preset-thumb.pattern-thumb.theme-isometric_city {
    background-color: #06060c;
    background-image: linear-gradient(150deg, #0e7490 30%, #ec4899 30%, #ec4899 60%, #eab308 60%);
}
.preset-thumb.pattern-thumb.theme-papercraft_layers {
    background-color: #0a0d0d;
    background-image: repeating-linear-gradient(180deg, #0f172a 0, #1e293b 4px, #334155 8px, #475569 12px, #64748b 16px);
}
.preset-thumb.pattern-thumb.theme-hex_cipher {
    background-color: #020d06;
    background-image: repeating-linear-gradient(0deg, rgba(34,197,94,0.6) 0, rgba(34,197,94,0.6) 2px, transparent 2px, transparent 6px), repeating-linear-gradient(90deg, rgba(34,197,94,0.2) 0, rgba(34,197,94,0.2) 1px, transparent 1px, transparent 8px);
}
.preset-thumb.pattern-thumb.theme-laser_grating {
    background-color: #060208;
    background-image: repeating-linear-gradient(35deg, rgba(239,68,68,0.5) 0, rgba(239,68,68,0.5) 1px, transparent 1px, transparent 6px), repeating-linear-gradient(-35deg, rgba(59,130,246,0.5) 0, rgba(59,130,246,0.5) 1px, transparent 1px, transparent 6px);
}
.preset-thumb.pattern-thumb.theme-silk_drapery {
    background-color: #0a0a0f;
    background-image: repeating-linear-gradient(90deg, rgba(244,244,245,0.4) 0, rgba(212,212,216,0.2) 3px, rgba(0,0,0,0.4) 6px);
}
.preset-thumb.pattern-thumb.theme-rose_gold_marble {
    background-color: #14090e;
    background-image: linear-gradient(135deg, #fb7185 0%, #fda4af 25%, #fce7f3 50%, #fef08a 75%, #f472b6 100%);
}
.preset-thumb.pattern-thumb.theme-sakura_river {
    background-color: #11070e;
    background-image: repeating-linear-gradient(180deg, rgba(244,114,182,0.6) 0, rgba(253,164,175,0.8) 3px, transparent 4px, transparent 12px);
}
.preset-thumb.pattern-thumb.theme-wisteria_breeze {
    background-color: #0c0714;
    background-image: repeating-linear-gradient(90deg, #a855f7 0, #c084fc 3px, #e9d5ff 6px, transparent 7px, transparent 14px);
}
.preset-thumb.pattern-thumb.theme-crystal_prism_room {
    background-color: #120810;
    background-image: linear-gradient(45deg, rgba(244,114,182,0.6) 0%, rgba(251,146,60,0.6) 20%, rgba(250,204,21,0.6) 40%, rgba(52,211,153,0.6) 60%, rgba(56,189,248,0.6) 80%, rgba(192,132,252,0.6) 100%);
}
.preset-thumb.pattern-thumb.theme-opal_aurora {
    background-color: #050b10;
    background-image: linear-gradient(135deg, #2dd4bf 0%, #fb923c 30%, #f472b6 60%, #38bdf8 100%);
}
.preset-thumb.pattern-thumb.theme-glasswing_butterfly {
    background-color: #0e0614;
    background-image: radial-gradient(circle at 40% 40%, rgba(244,114,182,0.5) 0%, transparent 60%), radial-gradient(circle at 70% 70%, rgba(192,132,252,0.5) 0%, transparent 60%);
}
.preset-thumb.pattern-thumb.theme-velvet_peony {
    background-color: #16080d;
    background-image: radial-gradient(circle at 50% 50%, #fff1f2 0%, #fbcfe8 30%, #fb7185 60%, #881337 100%);
}
.preset-thumb.pattern-thumb.theme-cotton_candy_sunset {
    background-color: #090714;
    background-image: linear-gradient(180deg, #100c1e 0%, #c084fc 35%, #f472b6 65%, #fef08a 100%);
}
.preset-thumb.pattern-thumb.theme-enchanted_jellyfish {
    background-color: #02040a;
    background-image: radial-gradient(circle at 50% 40%, rgba(34,211,238,0.75) 0%, rgba(192,132,252,0.4) 45%, #02040a 80%);
}
.preset-thumb.pattern-thumb.theme-golden_hour_meadow {
    background-color: #160802;
    background-image: linear-gradient(180deg, #3b1405 0%, #b45309 50%, #f59e0b 80%, #78350f 100%);
}
.preset-thumb.pattern-thumb.theme-rain_on_car_window {
    background-color: #05070f;
    background-image: radial-gradient(circle at 35% 35%, rgba(251,191,36,0.6) 0%, transparent 40%), radial-gradient(circle at 75% 65%, rgba(244,114,182,0.5) 0%, transparent 45%);
}
.preset-thumb.pattern-thumb.theme-floating_lantern_festival {
    background-color: #040612;
    background-image: radial-gradient(circle at 50% 40%, #fef08a 0%, #fbbf24 35%, #ea580c 60%, #040612 85%);
}
.preset-thumb.pattern-thumb.theme-northern_lights_fjord {
    background-color: #01040a;
    background-image: linear-gradient(180deg, #01040a 0%, #10b981 35%, #a855f7 65%, #02050c 100%);
}
.preset-thumb.pattern-thumb.theme-sakura_tea_steam {
    background-color: #07050d;
    background-image: radial-gradient(circle at 50% 85%, #fb7185 0%, rgba(216,180,254,0.45) 45%, #07050d 80%);
}
.preset-thumb.pattern-thumb.theme-amethyst_geode_growth {
    background-color: #060209;
    background-image: radial-gradient(circle at 50% 50%, #fdf4ff 0%, #c084fc 35%, #7e22ce 65%, #1e1124 100%);
}
.preset-thumb.pattern-thumb.theme-feather_quill_whisper {
    background-color: #02050f;
    background-image: radial-gradient(circle at 45% 45%, rgba(45,212,191,0.55) 0%, rgba(192,132,252,0.4) 45%, #02050f 80%);
}
.preset-thumb.pattern-thumb.theme-celestial_silk_nebula {
    background-color: #030209;
    background-image: radial-gradient(circle at 40% 35%, rgba(244,114,182,0.6) 0%, rgba(56,189,248,0.4) 45%, rgba(147,51,234,0.3) 75%, #030209 100%);
}
.preset-thumb.pattern-thumb.theme-living_dendrite_frost {
    background-color: #02050e;
    background-image: radial-gradient(circle at 50% 50%, #f8fafc 0%, #a5f3fc 35%, #6366f1 70%, #02050e 100%);
}
.preset-thumb.pattern-thumb.theme-bioluminescent_coral_abyss {
    background-color: #010811;
    background-image: radial-gradient(circle at 50% 30%, #34d399 0%, #047857 40%, #e11d48 70%, #010811 100%);
}
.preset-thumb.pattern-thumb.theme-origami_kaleidoscope_shatter {
    background-color: #060410;
    background-image: radial-gradient(circle at 50% 50%, #fde68a 0%, #c084fc 35%, #0ea5e9 70%, #060410 100%);
}
.preset-thumb.pattern-thumb.theme-mystic_koi_shadows {
    background-color: #021312;
    background-image: radial-gradient(circle at 50% 45%, #f8fafc 0%, #dc2626 35%, #059669 70%, #021312 100%);
}
.preset-thumb.pattern-thumb.theme-hyperborean_chronometer {
    background-color: #080604;
    background-image: radial-gradient(circle at 50% 50%, #fef08a 0%, #f59e0b 40%, #b45309 70%, #080604 100%);
}
.preset-thumb.pattern-thumb.theme-enchanted_bonsai_spirit {
    background-color: #030a07;
    background-image: radial-gradient(circle at 50% 40%, #fef3c7 0%, #10b981 40%, #064e3b 70%, #030a07 100%);
}
.preset-thumb.pattern-thumb.theme-alchemical_liquid_quicksilver {
    background-color: #07080d;
    background-image: radial-gradient(circle at 45% 40%, #ffffff 0%, #94a3b8 35%, #334155 65%, #2dd4bf 85%, #07080d 100%);
}

.preset-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.preset-name {
    font-size: 0.84rem;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-desc {
    font-size: 0.72rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Custom File Upload */
.wallpaper-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: #e4e4e7;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.wallpaper-file-label:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: #00a884;
}

.wallpaper-file-label input {
    display: none;
}

/* Gyroscope Motion Toggle Row */
.wp-gyro-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 12px 14px;
}

.wp-gyro-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.wp-gyro-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #fff;
}

.wp-gyro-desc {
    font-size: 0.74rem;
    color: var(--text-secondary);
}

/* iOS-Style Toggle Switch */
.wp-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.wp-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.wp-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #3f3f46;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 24px;
}

.wp-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
}

.wp-switch input:checked + .wp-slider {
    background: #00a884;
}

.wp-switch input:checked + .wp-slider:before {
    transform: translateX(20px);
}

/* Opacity / Dimmer Slider */
.opacity-control {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.opacity-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.1);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.opacity-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00a884;
    cursor: pointer;
    box-shadow: 0 0 8px rgba(0, 168, 132, 0.5);
}

/* Actions */
.wallpaper-actions {
    display: flex;
    gap: 10px;
    padding-top: 2px;
}

.wallpaper-btn-clear,
.wallpaper-btn-apply {
    flex: 1;
    padding: 10px 12px;
    border-radius: 9px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.wallpaper-btn-clear {
    background: rgba(255, 255, 255, 0.08);
    color: #e4e4e7;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.wallpaper-btn-clear:hover {
    background: rgba(255, 255, 255, 0.14);
}

.wallpaper-btn-apply {
    background: #00a884;
    color: #0b141a;
}

.wallpaper-btn-apply:hover {
    background: #00c298;
    box-shadow: 0 2px 12px rgba(0, 168, 132, 0.4);
}



/* =========================================
   Profile Picture Feature
   ========================================= */

/* Clickable Avatar */
.avatar-circle.clickable {
    cursor: pointer;
    position: relative;
}

.avatar-circle.clickable:hover {
    opacity: 0.8;
}

.avatar-edit-icon {
    display: none;
    position: absolute;
    bottom: -2px;
    right: -2px;
    background: var(--accent);
    border-radius: 50%;
    padding: 2px 4px;
    font-size: 10px;
}

.avatar-circle.clickable:hover .avatar-edit-icon {
    display: block;
}

/* Profile Picture Modal */
.profile-pic-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-app);
    z-index: 200;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease-out;
}

.profile-pic-modal.hidden {
    display: none;
}

.profile-pic-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-primary);
}

.profile-pic-close {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
}

.profile-pic-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px;
    gap: 20px;
    overflow-y: auto;
}

.profile-pic-preview {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: var(--bg-card);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 3px solid var(--border);
    background-size: cover;
    background-position: center;
}

.profile-pic-placeholder {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    padding: 20px;
}

.profile-pic-preview.has-image .profile-pic-placeholder {
    display: none;
}

.profile-pic-controls {
    display: flex;
    gap: 12px;
}

.profile-pic-file-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--accent);
    color: #111b21;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-pic-file-label:hover {
    background: #16a34a;
}

.profile-pic-file-label input {
    display: none;
}

.profile-pic-actions {
    display: flex;
    gap: 12px;
    margin-top: 10px;
}

.profile-pic-btn-remove,
.profile-pic-btn-apply {
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.profile-pic-btn-remove {
    background: #374151;
    color: white;
}

.profile-pic-btn-remove:hover {
    background: #4b5563;
}

.profile-pic-btn-apply {
    background: var(--accent);
    color: #111b21;
}

.profile-pic-btn-apply:hover {
    background: #16a34a;
}

/* Avatar with profile picture */
.avatar-circle.has-pic {
    background-size: cover;
    background-position: center;
}

.avatar-circle.has-pic::after {
    content: none;
}

/* =========================================
   Sidebar Footer with Notification Toggle
   ========================================= */
.sidebar-footer {
    padding: 12px 16px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
    background: var(--bg-header);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.notification-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-icon {
    font-size: 18px;
}

.toggle-label {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #374151;
    transition: 0.3s;
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
    background-color: var(--accent);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* =========================================
   Reaction Picker Styles
   ========================================= */
.reaction-picker {
    position: fixed;
    z-index: 9999;
    background: #1e1e1e;
    border-radius: 24px;
    padding: 8px 12px;
    display: flex;
    gap: 4px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    animation: popIn 0.15s ease-out;
}

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

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

.reaction-btn {
    width: 40px;
    height: 40px;
    font-size: 24px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.reaction-btn:hover {
    transform: scale(1.2);
    background: rgba(255, 255, 255, 0.1);
}

.reaction-btn.reaction-more {
    font-size: 20px;
    color: #8896a4;
    font-weight: bold;
}

/* =========================================
   Full Emoji Picker Modal
   ========================================= */
.emoji-picker-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: #1e1e1e;
    border-radius: 20px 20px 0 0;
    max-height: 50vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.emoji-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    font-weight: 600;
}

.emoji-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #333;
    color: white;
    font-size: 16px;
    cursor: pointer;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 4px;
    padding: 12px;
    overflow-y: auto;
    max-height: 300px;
}

.emoji-btn {
    width: 100%;
    aspect-ratio: 1;
    font-size: 24px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

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

/* =========================================
   Reply Media Thumbnail
   ========================================= */
.reply-preview {
    position: relative;
}

.reply-media {
    width: 40px;
    height: 40px;
    border-radius: 6px;
    overflow: hidden;
    margin-left: 10px;
    flex-shrink: 0;
}

.reply-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Magic Words Animations Removed for Convoo */


/* =========================================
   Android / Mobile Input Bar Fixes
   ========================================= */
@media (max-width: 768px) {
    .chat-input-area {
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 30;
        padding: 0 10px 8px 10px !important;
        background: transparent !important;
        border-top: none !important;
        pointer-events: none;
    }

    #messages-container {
        padding-top: 68px !important;
        padding-bottom: 74px !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    .chat-input-row {
        gap: 8px;
        width: 100%;
        display: flex;
        align-items: center;
    }

    .input-bar-instagram {
        gap: 6px;
        flex: 1;
        min-width: 0;
        width: auto;
        max-width: 100%;
        height: 52px !important;
        min-height: 52px !important;
        max-height: 52px !important;
        box-sizing: border-box !important;
        padding: 0 8px 0 10px !important;
    }

    .mic-send-action-btn {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        max-width: 52px !important;
    }

    .input-icon-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        padding: 0 !important;
        margin: 0 !important;
        z-index: 10;
    }

    .input-wrapper-ig {
        height: 36px;
        padding: 0 4px;
        flex: 1;
        min-width: 0;
        background: transparent !important;
    }

    .input-wrapper-ig input {
        font-size: 15px;
        padding: 0;
        height: 100%;
    }

    .send-btn-ig {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        max-width: 36px !important;
        z-index: 10;
        padding: 0 !important;
        margin: 0 !important;
    }
}



/* Message Reactions Display */
.message-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 4px;
}

.reaction-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.3);
    padding: 2px 6px;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
}

.reaction-badge:hover {
    background: rgba(0, 0, 0, 0.5);
}

.reaction-count {
    font-size: 11px;
    color: var(--text-secondary);
}

/* =========================================
   Message Quote (Reply) Styles
   ========================================= */
.message-quote {
    background: rgba(0, 0, 0, 0.22);
    border-left: 3.5px solid var(--accent);
    border-radius: 6px;
    padding: 5px 8px;
    margin-bottom: 6px;
    display: flex;
    cursor: pointer;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
    max-width: 100%;
}

.quote-content-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-width: 0;
}

.quote-text-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
    overflow: hidden;
}

.quote-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quote-text {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.quote-media {
    width: 48px;
    height: 48px;
    border-radius: 5px;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* =========================================
   Decoupled Chat Input Row & Morphing Action Button
   ========================================= */
.chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    position: relative;
    pointer-events: none;
    box-sizing: border-box;
}

.chat-input-row > * {
    pointer-events: auto;
}

.input-bar-instagram,
#message-form.input-bar-instagram {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
    height: 52px !important;
    min-height: 52px !important;
    max-height: 52px !important;
    box-sizing: border-box !important;
    padding: 0 8px 0 10px !important;
    margin: 0;
    border-radius: 9999px;
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.10) 0%, rgba(18, 24, 38, 0.45) 100%) !important;
    border: 1px solid rgba(255, 255, 255, 0.22) !important;
    box-shadow: 
        inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.55),
        inset 0 -1px 1px 0 rgba(255, 255, 255, 0.08),
        0 8px 24px 0 rgba(0, 0, 0, 0.35) !important;
    position: relative;
    pointer-events: auto;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.input-bar-instagram:focus-within,
#message-form.input-bar-instagram:focus-within {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.15) 0%, rgba(22, 30, 48, 0.58) 100%) !important;
    border-color: rgba(255, 255, 255, 0.38) !important;
    box-shadow: 
        inset 0 1.2px 1.5px 0 rgba(255, 255, 255, 0.65),
        0 10px 28px -4px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(34, 197, 94, 0.35) !important;
}

/* Dynamic Scroll Blur: Bypasses live GPU blur readbacks during active flings ONLY on Firefox */
@supports (-moz-appearance: none) {
    body.is-scrolling-chat .chat-header,
    body.is-scrolling-chat .chat-header-pill,
    body.is-scrolling-chat .kebab-circle-btn,
    body.is-scrolling-chat .input-bar-instagram,
    body.is-scrolling-chat #message-form.input-bar-instagram,
    body.is-scrolling-chat .reply-preview,
    body.is-scrolling-chat .editing-preview {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0%, rgba(18, 24, 38, 0.68) 100%) !important;
    }
}

.input-icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s, background 0.15s, transform 0.15s;
    flex-shrink: 0;
    touch-action: manipulation;
    padding: 0;
}

.input-icon-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.input-icon-btn:active {
    transform: scale(0.92);
}

.input-icon-btn.gif-text {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--accent);
}

.input-icon-btn.gif-text:hover {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

/* GIF Button with Smooth Dynamic Collapse */
#gif-btn {
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                padding 0.25s ease,
                margin 0.25s ease;
    overflow: hidden;
    flex-shrink: 0;
}

#gif-btn.collapsed {
    opacity: 0 !important;
    transform: scale(0.3) !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none !important;
}

.input-wrapper-ig {
    flex: 1;
    min-width: 0;
    height: 36px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    border-radius: 0;
    padding: 0 4px;
    display: flex;
    align-items: center;
}

.input-wrapper-ig input {
    width: 100%;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    color: var(--text-primary);
    font-size: 15px;
    padding: 0 !important;
    margin: 0 !important;
    height: 100%;
}

.input-wrapper-ig input:focus {
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
}

.input-wrapper-ig input::placeholder {
    color: rgba(244, 244, 245, 0.45);
}

/* =========================================
   Flat Deep Green Action Button with Outer Glass Edge
   ========================================= */
.mic-send-action-btn {
    width: 52px !important;
    height: 52px !important;
    min-width: 52px !important;
    max-width: 52px !important;
    border-radius: 50% !important;
    /* Eye-Soothing Deep WhatsApp Green */
    background: #20bf5f !important;
    color: #111b21 !important;
    fill: #111b21 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* Clean Translucent Outer Glass Edge Highlight (Flat surface, subtle glass rim) */
    border: 1.5px solid rgba(255, 255, 255, 0.32) !important;
    outline: none !important;
    cursor: pointer;
    flex-shrink: 0;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.12),
        0 4px 14px rgba(0, 0, 0, 0.35) !important;
    position: relative;
    overflow: visible !important;
    touch-action: manipulation;
    transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.mic-send-action-btn:hover {
    transform: scale(1.05);
    background: #1cb557 !important;
    border-color: rgba(255, 255, 255, 0.42) !important;
    box-shadow: 
        0 0 0 1px rgba(255, 255, 255, 0.2),
        0 6px 18px rgba(0, 0, 0, 0.4) !important;
}

.mic-send-action-btn:active {
    transform: scale(0.93);
    background: #1a9e4e !important;
}

.mic-send-action-btn.recording {
    background: #dc2626 !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    box-shadow: 0 0 0 4px rgba(220, 38, 38, 0.3), 0 4px 14px rgba(0, 0, 0, 0.3) !important;
    animation: mic-pulse 1s infinite alternate;
}

@keyframes mic-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.08); }
}

.mic-send-svg {
    width: 52px;
    height: 52px;
    overflow: visible;
    pointer-events: none;
    position: relative;
    shape-rendering: geometricPrecision;
    text-rendering: geometricPrecision;
}

/* Mic Vector Elements (Exact WhatsApp Mic Proportions from User Pic 1 - 100x100 Grid) */
.mic-group {
    transform-origin: 50px 50px;
    will-change: transform, opacity;
}

.mic-capsule {
    fill: #111b21 !important;
    transform-origin: 50px 42px;
    will-change: transform, opacity;
}

.mic-cradle {
    stroke: #111b21 !important;
    stroke-width: 5.2 !important;
    stroke-linecap: round !important;
    transform-origin: 50px 50px;
    will-change: transform, opacity;
}

.mic-stem {
    stroke: #111b21 !important;
    stroke-width: 5.2 !important;
    stroke-linecap: round !important;
    transform-origin: 50px 62.5px;
    will-change: transform, opacity;
}

.u-swing-ribbon {
    stroke: #111b21 !important;
    stroke-width: 5.2 !important;
    stroke-linecap: round !important;
    stroke-dasharray: 70 70;
    stroke-dashoffset: 70;
    fill: none;
    opacity: 0;
    pointer-events: none;
}

/* Plane Vector Elements (Exact Send Plane Chevron from User Pic 2 - 100x100 Grid) */
.plane-group {
    transform-origin: 50px 50px;
    will-change: transform, opacity;
}

.plane-body {
    transform-origin: 50px 50px;
    will-change: transform, opacity;
}

.plane-chevron,
.plane-wing-top,
.plane-wing-bottom {
    fill: #111b21 !important;
}

.plane-speed-lines {
    transform-origin: 24px 50px;
    opacity: 0;
}

.speed-line {
    stroke: #111b21 !important;
    stroke-width: 4.5 !important;
    stroke-linecap: round !important;
}

/* ========================================================
   RESTING STATES: LOCKED 1:1 TO USER REFERENCE PICTURES
   ======================================================== */

/* Resting Mic State (Exact WhatsApp Mic from Pic 1) */
.mic-send-action-btn.state-mic .mic-group {
    opacity: 1;
    display: block;
}
.mic-send-action-btn.state-mic .mic-capsule,
.mic-send-action-btn.state-mic .mic-cradle,
.mic-send-action-btn.state-mic .mic-stem {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
}
.mic-send-action-btn.state-mic .u-swing-ribbon {
    opacity: 0;
    display: none;
}
.mic-send-action-btn.state-mic .plane-group {
    opacity: 0;
    display: none;
}

/* Resting Plane State (Exact Send Plane Chevron from Pic 2) */
.mic-send-action-btn.state-plane .mic-group,
.mic-send-action-btn.state-plane .u-swing-ribbon {
    opacity: 0;
    display: none;
}
.mic-send-action-btn.state-plane .plane-group {
    opacity: 1;
    display: block;
}
.mic-send-action-btn.state-plane .plane-body {
    transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
    opacity: 1;
}
.mic-send-action-btn.state-plane .plane-speed-lines {
    opacity: 0;
    display: none;
}

/* ========================================================
   120Hz BUTTERY SMOOTH CONTINUOUS TRAJECTORIES
   Zero intermediate decelerations — single continuous splines
   ======================================================== */

/* Animation 1: Mic -> Plane (0.40s) */
.mic-send-action-btn.anim-to-plane .mic-group {
    opacity: 1;
    display: block;
}
.mic-send-action-btn.anim-to-plane .u-swing-ribbon {
    opacity: 0;
    display: none;
}
.mic-send-action-btn.anim-to-plane .plane-group {
    opacity: 1;
    display: block;
}
.mic-send-action-btn.anim-to-plane .plane-speed-lines {
    opacity: 0;
    display: none;
}

/* Plane swoops in from North-West in one continuous 120Hz fluid curve */
.mic-send-action-btn.anim-to-plane .plane-body {
    animation: planeSwoopNWContinuous 0.40s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Capsule kicks off to North-East upon plane strike */
.mic-send-action-btn.anim-to-plane .mic-capsule {
    animation: micCapsuleKickedContinuous 0.40s cubic-bezier(0.2, 0.8, 0.35, 1) forwards;
}

/* Stem (tiny vertical line under U): falls right when top part of mic goes in North-East */
.mic-send-action-btn.anim-to-plane .mic-stem {
    animation: micStemFallOnCrash 0.40s cubic-bezier(0.2, 0.8, 0.35, 1) forwards;
}

/* U-Cradle: bends left 45 degrees and falls downward smoothly without collision */
.mic-send-action-btn.anim-to-plane .mic-cradle {
    animation: micCradleBend45AndFallSmooth 0.40s cubic-bezier(0.2, 0.8, 0.35, 1) forwards;
}

/* 120Hz Continuous Spline: North-West entry directly into East landing */
@keyframes planeSwoopNWContinuous {
    0% {
        transform: translate3d(-64px, -52px, 0) rotate(38deg) scale(0.42);
        opacity: 0;
    }
    18% {
        opacity: 1;
    }
    100% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
}

@keyframes micCapsuleKickedContinuous {
    0%, 28% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate3d(52px, -46px, 0) rotate(54deg) scale(0.15);
        opacity: 0;
    }
}

/* Tiny vertical stem falls right when top part of mic goes in North-East (constant size, no scaling) */
@keyframes micStemFallOnCrash {
    0%, 28% {
        transform: translate3d(0, 0, 0);
        opacity: 1;
    }
    100% {
        transform: translate3d(0, 26px, 0);
        opacity: 0;
    }
}

/* U-Cradle bends left 45 degrees and falls downward in one buttery-smooth continuous 120Hz spline */
@keyframes micCradleBend45AndFallSmooth {
    0%, 28% {
        transform: translate3d(0, 0, 0) rotate(0deg);
        transform-origin: 50px 62.5px;
        opacity: 1;
    }
    100% {
        transform: translate3d(-18px, 36px, 0) rotate(-45deg) scale(0.85);
        transform-origin: 50px 62.5px;
        opacity: 0;
    }
}

/* ========================================================
   Animation 2: Plane -> Mic (0.42s)
   Continuous launch into NE sky, U forms from left to right edge
   ======================================================== */
.mic-send-action-btn.anim-to-mic .mic-group {
    opacity: 1;
    display: block;
}
.mic-send-action-btn.anim-to-mic .plane-group {
    opacity: 1;
    display: block;
}

/* Plane blasts East into North-East sky in one continuous 120Hz trajectory */
.mic-send-action-btn.anim-to-mic .plane-body {
    animation: planeLaunchContinuous 0.42s cubic-bezier(0.25, 0.1, 0.25, 1) forwards;
}

/* 3 tail speed lines: 120Hz continuous cascading sequence from right to left */
.mic-send-action-btn.anim-to-mic .plane-speed-lines {
    opacity: 1;
    display: block;
}
.mic-send-action-btn.anim-to-mic .speed-line {
    opacity: 0;
    will-change: transform, opacity;
}
.mic-send-action-btn.anim-to-mic .speed-line.sl-1 {
    animation: speedLineOneByOneTop 0.25s cubic-bezier(0.2, 0.8, 0.25, 1) 0s both;
}
.mic-send-action-btn.anim-to-mic .speed-line.sl-2 {
    animation: speedLineOneByOneMid 0.27s cubic-bezier(0.2, 0.8, 0.25, 1) 0.055s both;
}
.mic-send-action-btn.anim-to-mic .speed-line.sl-3 {
    animation: speedLineOneByOneBtm 0.25s cubic-bezier(0.2, 0.8, 0.25, 1) 0.11s both;
}

/* Bottom of mic (U-cradle): forms smoothly from left edge to right edge as plane leaves */
.mic-send-action-btn.anim-to-mic .mic-cradle {
    animation: micCradleDrawLeftToRight 0.42s cubic-bezier(0.2, 0.9, 0.3, 1) forwards;
}

/* Capsule drops straight down into cradle from above */
.mic-send-action-btn.anim-to-mic .mic-capsule {
    animation: capsuleDropContinuous 0.44s cubic-bezier(0.18, 0.9, 0.3, 1.15) forwards;
}

/* Stem sprouts downward from cradle bottom */
.mic-send-action-btn.anim-to-mic .mic-stem {
    animation: stemSproutContinuous 0.44s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes planeLaunchContinuous {
    0% {
        transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate3d(74px, -58px, 0) rotate(-40deg) scale(0.18);
        opacity: 0;
    }
}

/* 120Hz Pure Continuous Splines: Zero intermediate transform stops */
@keyframes speedLineOneByOneTop {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0);
    }
    18% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate3d(-34px, 0, 0);
    }
}

@keyframes speedLineOneByOneMid {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0);
    }
    18% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate3d(-42px, 0, 0);
    }
}

@keyframes speedLineOneByOneBtm {
    0% {
        opacity: 0;
        transform: translate3d(0, 0, 0);
    }
    18% {
        opacity: 1;
    }
    100% {
        opacity: 0;
        transform: translate3d(-34px, 0, 0);
    }
}

/* U-Cradle forms smoothly from left edge to right edge */
@keyframes micCradleDrawLeftToRight {
    0%, 18% {
        opacity: 0;
        stroke-dasharray: 45 45;
        stroke-dashoffset: 45;
    }
    22% {
        /* Left edge begins forming */
        opacity: 1;
        stroke-dasharray: 45 45;
        stroke-dashoffset: 45;
    }
    72% {
        /* Smoothly draws across the bottom to right edge */
        opacity: 1;
        stroke-dasharray: 45 45;
        stroke-dashoffset: 0;
    }
    100% {
        /* Fully formed and seated */
        opacity: 1;
        stroke-dasharray: none;
        stroke-dashoffset: 0;
    }
}

@keyframes capsuleDropContinuous {
    0%, 46% {
        opacity: 0;
        transform: translate3d(0, -36px, 0) scale(0.4);
    }
    78% {
        opacity: 1;
        transform: translate3d(0, 2px, 0) scale(1.04);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1);
    }
}

/* Tiny vertical stem appears under U cradle at constant 100% natural size (zero scaling or size change) */
@keyframes stemSproutContinuous {
    0%, 70% {
        opacity: 0;
        transform: translate3d(0, 0, 0);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* =========================================
   Text Effects Modal
   ========================================= */
.effects-modal {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    background: #1e1e1e;
    border-radius: 20px 20px 0 0;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s ease-out;
}

.effects-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #333;
    font-weight: 600;
    font-size: 16px;
}

.effects-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #333;
    color: white;
    font-size: 16px;
    cursor: pointer;
    border: none;
}

.effects-preview {
    padding: 24px 20px;
    text-align: center;
    background: #111;
    margin: 16px;
    border-radius: 12px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-text {
    font-size: 20px;
    font-weight: 500;
    transition: all 0.3s;
}

.effects-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 12px 16px;
    overflow-y: auto;
    max-height: 200px;
}

.effect-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: 12px;
    background: #2a2a2a;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.effect-btn:hover {
    background: #333;
}

.effect-btn.selected {
    border-color: var(--accent);
    background: rgba(34, 197, 94, 0.1);
}

.effect-icon {
    font-size: 24px;
}

.effect-name {
    font-size: 11px;
    color: var(--text-secondary);
}

.effects-actions {
    padding: 16px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.effects-send-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #111;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.effects-send-btn:hover {
    background: #25d366;
}

/* Effect Preview Styles */
.preview-text.effect-rainbow,
.msg-text.effect-rainbow {
    background: linear-gradient(90deg, #ff0000, #ff8000, #ffff00, #00ff00, #00ffff, #0080ff, #8000ff, #ff0000);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowFlow 3s linear infinite;
}

@keyframes rainbowFlow {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 400% 50%;
    }
}

.preview-text.effect-fire,
.msg-text.effect-fire {
    background: linear-gradient(90deg, #ff512f, #f09819, #ff512f);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: magicGradient 1.5s ease infinite;
    font-weight: 700;
}

.preview-text.effect-love,
.msg-text.effect-love {
    background: linear-gradient(90deg, #ff6b6b, #ee5a9f, #ff6b6b);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: magicGradient 2s ease infinite;
    font-weight: 600;
}

.preview-text.effect-glow,
.msg-text.effect-glow {
    color: #00ffff;
    text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff;
    animation: glowPulse 1.5s ease-in-out infinite;
}

@keyframes glowPulse {

    0%,
    100% {
        text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff;
    }

    50% {
        text-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff, 0 0 60px #00ffff;
    }
}

.preview-text.effect-shake,
.msg-text.effect-shake {
    color: #ff4444;
    font-weight: 700;
    animation: shake 0.5s ease-in-out infinite;
}

@keyframes shake {

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

    25% {
        transform: translateX(-3px);
    }

    75% {
        transform: translateX(3px);
    }
}

.preview-text.effect-gift,
.msg-text.effect-gift {
    background: linear-gradient(90deg, #ffd700, #ff69b4, #ffd700);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: magicGradient 2s ease infinite;
    font-weight: 600;
}

.preview-text.effect-confetti,
.msg-text.effect-confetti {
    background: linear-gradient(90deg, #ff6b6b, #feca57, #48dbfb, #ff9ff3, #ff6b6b);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: rainbowFlow 2s linear infinite;
    font-weight: 600;
}

/* Effect demo icons in the grid */
.effect-demo-rainbow {
    background: linear-gradient(90deg, #ff0000, #00ff00, #0000ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.effect-demo-glow {
    text-shadow: 0 0 8px #00ffff;
}

/* =========================================
   Premium Text Effects Polish
   ========================================= */

/* Refined Glow Effect - Cleaner & Premium */
.preview-text.effect-glow,
.msg-text.effect-glow {
    color: #e0f2fe !important;
    text-shadow: 0 0 5px rgba(14, 165, 233, 0.5),
        0 0 10px rgba(14, 165, 233, 0.3),
        0 0 15px rgba(14, 165, 233, 0.2) !important;
    animation: glowPulsePremium 2s ease-in-out infinite alternate !important;
}

@keyframes glowPulsePremium {
    from {
        text-shadow: 0 0 5px rgba(14, 165, 233, 0.5),
            0 0 10px rgba(14, 165, 233, 0.3);
    }

    to {
        text-shadow: 0 0 10px #0ea5e9,
            0 0 20px #0ea5e9,
            0 0 30px rgba(14, 165, 233, 0.5);
    }
}

/* Smoother Rainbow Flow */
.preview-text.effect-rainbow,
.msg-text.effect-rainbow {
    background: linear-gradient(120deg, #ff0080, #ff8c00, #40e0d0, #ff0080) !important;
    background-size: 200% auto !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    animation: rainbowFlowPremium 4s linear infinite !important;
    display: inline-block;
}

@keyframes rainbowFlowPremium {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 200% 50%;
    }
}

/* =========================================
   Ultra-Sleek Apple macOS Attachment Menu Popover
   ========================================= */
.attach-menu-popover {
    position: absolute;
    bottom: calc(100% + 12px);
    left: 8px;
    z-index: 99999 !important;
    pointer-events: auto !important;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: bottom left;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.attach-menu-popover.hidden {
    opacity: 0 !important;
    transform: scale3d(0.8, 0.8, 1) translate3d(0, 10px, 0) !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.attach-menu-popover:not(.hidden) {
    opacity: 1 !important;
    transform: scale3d(1, 1, 1) translate3d(0, 0, 0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
    animation: attachMenuSpring 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes attachMenuSpring {
    0% {
        opacity: 0;
        transform: scale3d(0.8, 0.8, 1) translate3d(0, 12px, 0);
    }
    100% {
        opacity: 1;
        transform: scale3d(1, 1, 1) translate3d(0, 0, 0);
    }
}

.attach-menu-card {
    background: #151a23 !important;
    background: linear-gradient(165deg, rgba(24, 30, 42, 0.98) 0%, rgba(15, 20, 28, 0.99) 100%) !important;
    backdrop-filter: blur(32px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(32px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    box-shadow: 
        inset 0 1px 1.2px 0 rgba(255, 255, 255, 0.25),
        0 24px 56px 0 rgba(0, 0, 0, 0.85),
        0 4px 16px 0 rgba(0, 0, 0, 0.6) !important;
    border-radius: 20px;
    padding: 7px;
    width: 220px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transform: translateZ(0);
    pointer-events: auto !important;
}

.attach-menu-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer !important;
    outline: none;
    transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    transform: translateZ(0);
    pointer-events: auto !important;
}

.attach-menu-row * {
    pointer-events: none !important;
}

.attach-menu-row:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 1.2px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

.attach-menu-row:active {
    transform: scale3d(0.97, 0.97, 1);
    background: rgba(255, 255, 255, 0.08);
}

/* 120 FPS GPU Row Cascade Animation */
.attach-menu-popover:not(.hidden) .attach-menu-row:nth-child(1) {
    animation: attachRowCascade 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.02s backwards;
}
.attach-menu-popover:not(.hidden) .attach-menu-row:nth-child(2) {
    animation: attachRowCascade 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.06s backwards;
}
.attach-menu-popover:not(.hidden) .attach-menu-row:nth-child(3) {
    animation: attachRowCascade 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.10s backwards;
}
.attach-menu-popover:not(.hidden) .attach-menu-row:nth-child(4) {
    animation: attachRowCascade 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.14s backwards;
}

@keyframes attachRowCascade {
    0% {
        opacity: 0;
        transform: translate3d(0, 8px, 0);
    }
    100% {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

.attach-row-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    transform: translateZ(0);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
}

#camera-btn .attach-row-icon {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: #38bdf8;
}
#camera-btn:hover .attach-row-icon {
    background: rgba(56, 189, 248, 0.22);
    border-color: rgba(56, 189, 248, 0.45);
    color: #7dd3fc;
}

#gallery-btn .attach-row-icon {
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.28);
    color: #34d399;
}
#gallery-btn:hover .attach-row-icon {
    background: rgba(52, 211, 153, 0.22);
    border-color: rgba(52, 211, 153, 0.45);
    color: #6ee7b7;
}

#video-file-btn .attach-row-icon {
    background: rgba(192, 132, 252, 0.12);
    border: 1px solid rgba(192, 132, 252, 0.28);
    color: #c084fc;
}
#video-file-btn:hover .attach-row-icon {
    background: rgba(192, 132, 252, 0.22);
    border-color: rgba(192, 132, 252, 0.45);
    color: #d8b4fe;
}

#audio-file-btn .attach-row-icon {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.28);
    color: #fbbf24;
}
#audio-file-btn:hover .attach-row-icon {
    background: rgba(251, 191, 36, 0.22);
    border-color: rgba(251, 191, 36, 0.45);
    color: #fde68a;
}

.attach-menu-popover:not(.hidden) .attach-row-icon {
    animation: iconTileSpring 0.35s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

@keyframes iconTileSpring {
    0% {
        transform: scale3d(0.7, 0.7, 1);
        opacity: 0;
    }
    100% {
        transform: scale3d(1, 1, 1);
        opacity: 1;
    }
}

/* 120 FPS Pen-drawn real-time SVG stroke animation (fast launch, smooth slow finish) */
.attach-menu-popover:not(.hidden) .attach-row-icon svg path,
.attach-menu-popover:not(.hidden) .attach-row-icon svg circle,
.attach-menu-popover:not(.hidden) .attach-row-icon svg rect,
.attach-menu-popover:not(.hidden) .attach-row-icon svg polygon,
.attach-menu-popover:not(.hidden) .attach-row-icon svg polyline {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: penLineDraw 0.75s cubic-bezier(0.08, 0.82, 0.17, 1) forwards;
}

.attach-menu-popover:not(.hidden) .attach-menu-row:nth-child(1) .attach-row-icon svg * {
    animation-delay: 0.02s;
}
.attach-menu-popover:not(.hidden) .attach-menu-row:nth-child(2) .attach-row-icon svg * {
    animation-delay: 0.07s;
}
.attach-menu-popover:not(.hidden) .attach-menu-row:nth-child(3) .attach-row-icon svg * {
    animation-delay: 0.12s;
}
.attach-menu-popover:not(.hidden) .attach-menu-row:nth-child(4) .attach-row-icon svg * {
    animation-delay: 0.17s;
}

@keyframes penLineDraw {
    0% {
        stroke-dashoffset: 100;
        opacity: 0.2;
    }
    20% {
        opacity: 1;
    }
    100% {
        stroke-dashoffset: 0;
        opacity: 1;
    }
}

.attach-row-label {
    font-size: 14.5px;
    font-weight: 600;
    color: #f8fafc;
    letter-spacing: -0.1px;
    flex: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.attach-row-arrow {
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.15s, color 0.15s;
}

.attach-menu-row:hover .attach-row-arrow {
    color: rgba(255, 255, 255, 0.85);
    transform: translateX(2px);
}

/* =========================================
   Dedicated WhatsApp-Grade Cinematic Multi-Media Send Preview Modal
   ========================================= */
.media-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px 12px;
    box-sizing: border-box;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s;
    touch-action: none;
}

.media-preview-modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
    visibility: visible;
}

.media-preview-backdrop {
    position: absolute;
    inset: 0;
    background: #090b10;
    z-index: -1;
}

.media-preview-header {
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: max(6px, env(safe-area-inset-top));
    flex-shrink: 0;
    min-height: 44px;
}

.media-preview-header-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    border-radius: 12px;
    padding: 7px 14px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: background 0.18s, transform 0.12s;
    user-select: none;
    -webkit-user-select: none;
}

.media-preview-header-btn:hover {
    background: rgba(255, 255, 255, 0.14);
}

.media-preview-header-btn:active {
    transform: scale(0.95);
}

.media-preview-delete-btn {
    padding: 7px 10px;
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(239, 68, 68, 0.1);
}
.media-preview-delete-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.media-preview-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.2px;
}

.media-preview-stage {
    flex: 1 1 0%;
    min-height: 0;
    width: 100%;
    max-width: 900px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 6px 0;
    box-sizing: border-box;
}

.media-preview-hero-img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: mediaHeroZoom 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.media-preview-hero-video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.media-preview-hero-audio {
    width: 92%;
    max-width: 440px;
}

@keyframes mediaHeroZoom {
    0% {
        opacity: 0;
        transform: scale(0.94);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.media-preview-footer {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    box-sizing: border-box;
}

/* WhatsApp Multi-Media Thumbnail Strip */
.media-preview-tray {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4px 2px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    box-sizing: border-box;
}
.media-preview-tray::-webkit-scrollbar {
    display: none;
}
.media-preview-tray.hidden {
    display: none !important;
}

.media-tray-items {
    display: flex;
    align-items: center;
    gap: 8px;
}

.media-tray-item {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid transparent;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}

.media-tray-item.active {
    border-color: #00a884;
    box-shadow: 0 0 12px rgba(0, 168, 132, 0.6);
    transform: scale(1.08);
}

.media-tray-item img,
.media-tray-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.media-tray-badge {
    position: absolute;
    bottom: 2px;
    left: 2px;
    font-size: 8px;
    color: #ffffff;
    background: rgba(0, 0, 0, 0.65);
    border-radius: 4px;
    padding: 1px 3px;
    line-height: 1;
    pointer-events: none;
}

.media-tray-audio-badge {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(251, 191, 36, 0.18);
    color: #fbbf24;
}

.media-tray-item-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    cursor: pointer;
    z-index: 2;
    padding: 0;
}

.media-tray-add-btn {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed rgba(255, 255, 255, 0.25);
    color: #cbd5e1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, border-color 0.15s, transform 0.12s;
}
.media-tray-add-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00a884;
    color: #ffffff;
}
.media-tray-add-btn:active {
    transform: scale(0.94);
}

.media-caption-bar {
    background: rgba(26, 29, 36, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 30px;
    padding: 5px 6px 5px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
    width: 100%;
    box-sizing: border-box;
}

.media-caption-bar input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-size: 15px;
    font-family: inherit;
}

.media-caption-bar input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.media-preview-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00a884 0%, #008f6f 100%);
    color: #ffffff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 168, 132, 0.45);
    transition: transform 0.15s, box-shadow 0.15s;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
}

.media-preview-send-btn:hover {
    transform: scale(1.06);
    box-shadow: 0 6px 20px rgba(0, 168, 132, 0.6);
}

.media-preview-send-btn:active {
    transform: scale(0.92);
}

/* =========================================
   Partial Highlighting & Magic Words Removed for Convoo
   ========================================= */
.magic-word {
    font-weight: inherit !important;
    color: inherit !important;
    background: none !important;
    animation: none !important;
    text-shadow: none !important;
    letter-spacing: normal !important;
    display: inline !important;
}

/* =========================================
   Gift Box Effect
   ========================================= */
.gift-container {
    position: relative;
    display: inline-block;
    min-width: 140px;
    min-height: 60px;
    cursor: pointer;
    margin: 4px 0;
    transition: transform 0.2s;
}

.gift-container:active {
    transform: scale(0.98);
}

/* The Lid / Cover */
.gift-lid {
    position: absolute;
    top: -5px;
    bottom: -5px;
    left: -10px;
    right: -10px;
    background: linear-gradient(135deg, #ec4899, #be185d);
    border-radius: 16px;
    z-index: 10;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

/* Text on the lid */
.gift-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
    color: white;
    font-weight: bold;
    font-size: 14px;
    pointer-events: none;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    transition: opacity 0.3s;
}

/* The hidden content */
.gift-content {
    opacity: 0;
    transform: scale(0.9);
    transition: all 0.4s ease-out;
    filter: blur(10px);
}

/* Open State */
.gift-container.open .gift-lid {
    transform: translateY(-80px) rotate(10deg) scale(0.8);
    opacity: 0;
    pointer-events: none;
}

.gift-container.open .gift-box {
    opacity: 0;
}

.gift-container.open .gift-content {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
}

/* =========================================
   Message Metadata (Time & Ticks)
   ========================================= */
.msg-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 2px;
    line-height: 1;
    position: relative;
    float: right;
    margin-left: 8px;
    margin-bottom: -4px;
}

.timestamp {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: normal;
}

.message.received .timestamp {
    color: var(--text-secondary);
}

.message.sent .timestamp {
    color: rgba(233, 237, 239, 0.8);
}

.ticks {
    font-size: 14px;
    /* Slightly larger for visibility */
    color: rgba(255, 255, 255, 0.6);
    display: inline-flex;
}

.ticks.read {
    color: #53bdeb;
    /* Bright Blue for Read */
}

/* Ensure ticks in footer are aligned */
.msg-footer .ticks {
    margin-left: 2px;
}

/* Animated Sending Clock Icon */
.msg-tick.pending {
    opacity: 0.75;
}
.msg-tick.pending .clock-hour-hand {
    transform-origin: 8px 8px;
    transform-box: view-box;
    animation: clockRotate 4.8s linear infinite;
}
.msg-tick.pending .clock-minute-hand {
    transform-origin: 8px 8px;
    transform-box: view-box;
    animation: clockRotate 0.8s linear infinite;
}
@keyframes clockRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Snappy Sent Tick Pop In */
.msg-tick.sent {
    animation: tickPopIn 0.18s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes tickPopIn {
    0% { transform: scale(0.6); opacity: 0.5; }
    100% { transform: scale(1); opacity: 1; }
}

/* =========================================
   Keyboard Open Adjustments
   ========================================= */
body.keyboard-open .chat-input-area {
    padding: 0 10px 6px 10px !important;
}

/* =========================================
   Magic Animation Fullscreen Container
   ========================================= */
.magic-animation-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

/* Magic Particle Base */
.magic-particle {
    position: absolute;
    pointer-events: none;
    will-change: transform, opacity;
}

/* Movement Animations */
.move-rise {
    animation: magicRise linear forwards;
}

.move-float {
    animation: magicFloat ease-in-out forwards;
}

.move-confetti {
    animation: magicConfetti ease-out forwards;
}

.move-explode {
    animation: magicExplode ease-out forwards;
}

.move-twinkle {
    animation: magicTwinkle ease-in-out forwards;
}

@keyframes magicRise {
    0% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    100% {
        transform: translateY(-110vh) scale(0.5);
        opacity: 0;
    }
}

@keyframes magicFloat {
    0% {
        transform: translateY(0) translateX(0) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: translateY(-50vh) translateX(30px) rotate(180deg);
        opacity: 0.8;
    }

    100% {
        transform: translateY(-100vh) translateX(-20px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes magicConfetti {
    0% {
        transform: translateY(0) rotateZ(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(110vh) rotateZ(720deg);
        opacity: 0;
    }
}

@keyframes magicExplode {
    0% {
        transform: scale(0) rotate(0deg);
        opacity: 1;
    }

    50% {
        transform: scale(1.5) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: scale(0.5) translateY(-50px) rotate(360deg);
        opacity: 0;
    }
}

@keyframes magicTwinkle {

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

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

    50% {
        opacity: 0.5;
        transform: scale(1);
    }

    75% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* =========================================
   Kiss Animation Special
   ========================================= */
.kiss-big {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    font-size: 8rem;
    animation: kissBigPop 1.5s ease-out forwards;
    z-index: 10;
}

@keyframes kissBigPop {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-20deg);
        opacity: 0;
    }

    30% {
        transform: translate(-50%, -50%) scale(1.5) rotate(10deg);
        opacity: 1;
    }

    60% {
        transform: translate(-50%, -50%) scale(1.2) rotate(-5deg);
        opacity: 1;
    }

    100% {
        transform: translate(-50%, -50%) scale(0.3) rotate(0deg);
        opacity: 0;
    }
}

/* =========================================
   Unique Bubble Styles Per Effect (Premium)
   ========================================= */
/* Base style override - remove borders, add glow */
.msg-content[class*="effect-"] {
    border: none !important;
    border-radius: 18px;
}

/* Kiss - Pink/Rose gradient */
.msg-content.effect-kiss {
    background: linear-gradient(135deg, #ec4899, #f472b6) !important;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.5);
}

/* Sparkle - Purple shimmer */
.msg-content.effect-sparkle {
    background: linear-gradient(135deg, #8b5cf6, #a78bfa) !important;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.5);
}

/* Thunder - Electric blue */
.msg-content.effect-thunder {
    background: linear-gradient(135deg, #1e40af, #3b82f6) !important;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.6);
}

/* Ice - Icy blue */
.msg-content.effect-ice {
    background: linear-gradient(135deg, #0ea5e9, #67e8f9) !important;
    box-shadow: 0 4px 20px rgba(14, 165, 233, 0.5);
}

/* Galaxy - Deep purple */
.msg-content.effect-galaxy {
    background: linear-gradient(135deg, #1e1b4b, #4c1d95, #7c3aed) !important;
    box-shadow: 0 4px 25px rgba(76, 29, 149, 0.6);
}

/* Music - Vibrant pink/orange */
.msg-content.effect-music {
    background: linear-gradient(135deg, #f43f5e, #fb923c) !important;
    box-shadow: 0 4px 20px rgba(244, 63, 94, 0.5);
}

/* Celebrate - Gold festive */
.msg-content.effect-celebrate {
    background: linear-gradient(135deg, #eab308, #fde047) !important;
    box-shadow: 0 4px 20px rgba(234, 179, 8, 0.5);
    color: #1f2937 !important;
}

/* Sad - Grey melancholy */
.msg-content.effect-sad {
    background: linear-gradient(135deg, #475569, #64748b) !important;
    box-shadow: 0 4px 15px rgba(71, 85, 105, 0.5);
}

/* Scary - Dark spooky */
.msg-content.effect-scary {
    background: linear-gradient(135deg, #1f1f1f, #4a1d6b) !important;
    box-shadow: 0 4px 25px rgba(74, 29, 107, 0.6);
}

/* Angel - Heavenly white/gold */
.msg-content.effect-angel {
    background: linear-gradient(135deg, #fef9c3, #fef3c7) !important;
    box-shadow: 0 4px 20px rgba(254, 243, 199, 0.6);
    color: #78350f !important;
}

/* Devil - Dark red */
.msg-content.effect-devil {
    background: linear-gradient(135deg, #7f1d1d, #dc2626) !important;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.5);
}

/* Crown - Royal gold */
.msg-content.effect-crown {
    background: linear-gradient(135deg, #854d0e, #ca8a04, #eab308) !important;
    box-shadow: 0 4px 25px rgba(202, 138, 4, 0.6);
}

/* Money - Green */
.msg-content.effect-money {
    background: linear-gradient(135deg, #14532d, #22c55e) !important;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.5);
}

/* Nature - Floral green */
.msg-content.effect-nature {
    background: linear-gradient(135deg, #166534, #4ade80) !important;
    box-shadow: 0 4px 20px rgba(74, 222, 128, 0.4);
}

/* Zen - Calm lavender/teal */
.msg-content.effect-zen {
    background: linear-gradient(135deg, #5eead4, #a5b4fc) !important;
    box-shadow: 0 4px 20px rgba(94, 234, 212, 0.4);
    color: #1f2937 !important;
}

/* Magic - Mystical purple */
.msg-content.effect-magic {
    background: linear-gradient(135deg, #6366f1, #a855f7, #ec4899) !important;
    box-shadow: 0 4px 25px rgba(168, 85, 247, 0.5);
}

/* Rainbow effect */
.msg-content.effect-rainbow {
    background: linear-gradient(90deg, #ef4444, #f97316, #eab308, #22c55e, #3b82f6, #8b5cf6) !important;
    box-shadow: 0 4px 25px rgba(139, 92, 246, 0.5);
}

/* Fire effect */
.msg-content.effect-fire {
    background: linear-gradient(135deg, #dc2626, #f97316, #fbbf24) !important;
    box-shadow: 0 4px 20px rgba(220, 38, 38, 0.5);
}

/* Love effect */
.msg-content.effect-love {
    background: linear-gradient(135deg, #be185d, #ec4899) !important;
    box-shadow: 0 4px 20px rgba(236, 72, 153, 0.5);
}

/* Glow effect */
.msg-content.effect-glow {
    background: linear-gradient(135deg, #0284c7, #38bdf8) !important;
    box-shadow: 0 4px 30px rgba(56, 189, 248, 0.6);
}

/* Confetti/Party effect */
.msg-content.effect-confetti {
    background: linear-gradient(135deg, #7c3aed, #c026d3) !important;
    box-shadow: 0 4px 20px rgba(192, 38, 211, 0.5);
}

/* Shake effect */
.msg-content.effect-shake {
    background: linear-gradient(135deg, #b91c1c, #991b1b) !important;
    box-shadow: 0 4px 20px rgba(185, 28, 28, 0.5);
    animation: bubbleShake 0.5s ease-in-out;
}

@keyframes bubbleShake {

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

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

/* Effects Grid Scrollable */
.effects-grid {
    max-height: 300px;
    overflow-y: auto;
}

.chat-messages-wrapper {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    background: transparent !important;
    overflow: hidden;
}

/* =========================================
   Scroll-to-Bottom Button (WhatsApp style)
   ========================================= */
.scroll-bottom-btn {
    position: absolute;
    bottom: 74px;
    right: 18px;
    z-index: 35;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(22, 28, 42, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: #f4f4f5;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: inset 0 1px 1px 0 rgba(255, 255, 255, 0.35), 0 4px 16px rgba(0,0,0,0.35);
    transition: transform 0.15s, background 0.15s;
}
.scroll-bottom-btn:active {
    transform: scale(0.92);
}
.scroll-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent);
    color: #000;
    font-size: 11px;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* =========================================
   Reply Highlight Flash (WhatsApp-Style Full-Width Row & Ambient Theme Glow)
   ========================================= */
.message-quote {
    cursor: pointer;
}

@keyframes whatsappHighlightRow {
    0% {
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    65% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

@keyframes whatsappBubblePulse {
    0% {
        transform: scale(1);
    }
    15% {
        transform: scale(1.025);
    }
    35% {
        transform: scale(1);
    }
    100% {
        transform: scale(1);
    }
}

.message.highlight-flash {
    position: relative !important;
    animation: whatsappBubblePulse 1.8s cubic-bezier(0.25, 1, 0.5, 1) !important;
    z-index: 5;
}

/* The WhatsApp Full-Width Horizontal Screen Strip */
.message.highlight-flash::before {
    content: '';
    position: absolute;
    top: -4px;
    bottom: -4px;
    left: -2000px;
    right: -2000px;
    background: var(--theme-highlight-bg, rgba(0, 168, 132, 0.32));
    pointer-events: none;
    z-index: -1;
    animation: whatsappHighlightRow 1.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Subtle Ambient Bubble Glow */
.message.highlight-flash::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--theme-highlight-bg, rgba(0, 168, 132, 0.25));
    pointer-events: none;
    z-index: 2;
    animation: whatsappHighlightRow 1.8s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* Theme-Adaptive Reply Highlight Palette (32 Themes) */
:root, [data-theme="default"] { --theme-highlight-bg: rgba(0, 168, 132, 0.32); }
[data-theme="instagram"]    { --theme-highlight-bg: rgba(253, 29, 29, 0.32); }
[data-theme="cyberpunk"]    { --theme-highlight-bg: rgba(0, 223, 216, 0.32); }
[data-theme="sunset"]       { --theme-highlight-bg: rgba(235, 51, 73, 0.32); }
[data-theme="ocean"]        { --theme-highlight-bg: rgba(0, 114, 255, 0.32); }
[data-theme="aurora"]       { --theme-highlight-bg: rgba(103, 232, 249, 0.35); }
[data-theme="sakura"]       { --theme-highlight-bg: rgba(254, 205, 211, 0.38); }
[data-theme="midnight"]     { --theme-highlight-bg: rgba(255, 255, 255, 0.22); }
[data-theme="lofi"]         { --theme-highlight-bg: rgba(118, 75, 162, 0.32); }
[data-theme="emerald"]      { --theme-highlight-bg: rgba(56, 239, 125, 0.32); }
[data-theme="cosmic"]       { --theme-highlight-bg: rgba(142, 45, 226, 0.32); }
[data-theme="crimson"]      { --theme-highlight-bg: rgba(239, 71, 58, 0.32); }
[data-theme="amber"]        { --theme-highlight-bg: rgba(245, 158, 11, 0.32); }
[data-theme="bubblegum"]    { --theme-highlight-bg: rgba(244, 114, 182, 0.35); }
[data-theme="matrix"]       { --theme-highlight-bg: rgba(0, 255, 135, 0.32); }
[data-theme="slate"]        { --theme-highlight-bg: rgba(156, 163, 175, 0.25); }
[data-theme="desert"]       { --theme-highlight-bg: rgba(245, 175, 25, 0.32); }
[data-theme="flamingo"]     { --theme-highlight-bg: rgba(255, 65, 108, 0.32); }
[data-theme="synthwave"]    { --theme-highlight-bg: rgba(247, 37, 133, 0.32); }
[data-theme="neon_purple"]  { --theme-highlight-bg: rgba(181, 23, 158, 0.32); }
[data-theme="hyperdrive"]   { --theme-highlight-bg: rgba(42, 82, 152, 0.35); }
[data-theme="deep_blue"]    { --theme-highlight-bg: rgba(19, 84, 122, 0.38); }
[data-theme="skyline"]      { --theme-highlight-bg: rgba(79, 172, 254, 0.32); }
[data-theme="iceberg"]      { --theme-highlight-bg: rgba(33, 147, 176, 0.32); }
[data-theme="matcha"]       { --theme-highlight-bg: rgba(86, 171, 47, 0.32); }
[data-theme="eucalyptus"]   { --theme-highlight-bg: rgba(113, 178, 128, 0.32); }
[data-theme="peach"]        { --theme-highlight-bg: rgba(252, 182, 159, 0.35); }
[data-theme="lavender"]     { --theme-highlight-bg: rgba(224, 195, 252, 0.35); }
[data-theme="lemon"]        { --theme-highlight-bg: rgba(246, 211, 101, 0.35); }
[data-theme="champagne"]    { --theme-highlight-bg: rgba(197, 160, 89, 0.35); }
[data-theme="velvet"]       { --theme-highlight-bg: rgba(215, 109, 119, 0.35); }
[data-theme="carbon"]       { --theme-highlight-bg: rgba(50, 80, 115, 0.38); }
/* =========================================
   WhatsApp-Style Header Actions & Kebab Menu
   ========================================= */
.chat-header-actions { display: flex; align-items: center; gap: 12px; }
.standard-header-actions { display: flex; flex-direction: row; flex-wrap: nowrap; align-items: center; gap: 12px; height: 100%; }
.header-action-btn { background: none; border: none; color: var(--text-color); padding: 6px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s; }
.header-action-btn:hover { background-color: rgba(255,255,255,0.1); }
.kebab-menu-container { position: relative; display: inline-block; }
.kebab-dropdown { position: fixed; right: 12px; top: 56px; background: #151a23 !important; background: linear-gradient(165deg, rgba(24, 30, 42, 0.98) 0%, rgba(15, 20, 28, 0.99) 100%) !important; backdrop-filter: blur(32px) saturate(200%) !important; -webkit-backdrop-filter: blur(32px) saturate(200%) !important; border: 1px solid rgba(255, 255, 255, 0.16) !important; border-radius: 18px; box-shadow: inset 0 1px 1.5px 0 rgba(255, 255, 255, 0.25), 0 24px 56px rgba(0, 0, 0, 0.85), 0 4px 16px rgba(0, 0, 0, 0.6) !important; min-width: 170px; z-index: 99999; display: flex; flex-direction: column; padding: 6px; transform-origin: top right; animation: scaleIn 0.2s ease-out forwards; overflow: hidden; }
.kebab-dropdown.hidden { display: none; }
.kebab-item { padding: 10px 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--text-primary); border-radius: 12px; transition: background-color 0.15s, color 0.15s; font-size: 14px; font-weight: 450; }
.kebab-item:hover { background-color: rgba(255, 255, 255, 0.1); color: #fff; }

/* =========================================
   Call Overlays
   ========================================= */
.call-screen { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: 9999; color: white; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; background-color: #000; }
.call-screen.hidden { display: none !important; }
.call-screen-bg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: #121212; background-image: radial-gradient(circle at center, #1e1e1e 0%, #000 100%); z-index: -2; }
.call-video-full { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; z-index: -1; background: #000; }
.call-video-pip { position: absolute; bottom: 120px; right: 20px; width: 100px; height: 140px; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,0.2); box-shadow: 0 4px 12px rgba(0,0,0,0.5); z-index: 10; transition: transform 0.3s; }
.call-info { text-align: center; padding: 60px 20px 20px; z-index: 5; background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%); }
.call-info h2 { font-size: 28px; font-weight: 500; margin: 16px 0 8px; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.call-info p { font-size: 16px; color: rgba(255,255,255,0.7); }
.active-call-top { display: flex; align-items: center; gap: 16px; padding: 20px; text-align: left; background: linear-gradient(180deg, rgba(0,0,0,0.8) 0%, transparent 100%); }
.active-call-top h2 { font-size: 20px; margin: 0; }
.active-call-top p { font-size: 14px; margin: 0; }
.active-call-top .avatar-circle { width: 40px; height: 40px; }
.call-actions { display: flex; justify-content: space-evenly; align-items: center; padding: 40px 20px 60px; z-index: 5; background: linear-gradient(0deg, rgba(0,0,0,0.7) 0%, transparent 100%); }
.call-btn { width: 60px; height: 60px; border-radius: 50%; border: none; display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,0.3); transition: transform 0.2s, background-color 0.2s; color: white; }
.call-btn:active { transform: scale(0.9); }
.btn-accept { background-color: #25D366; width: 72px; height: 72px; }
.btn-decline { background-color: #EF4444; width: 72px; height: 72px; }
.btn-secondary { background-color: rgba(255,255,255,0.2); backdrop-filter: blur(10px); }
.btn-secondary.muted { background-color: white; color: #121212; }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.ringing .avatar-circle { animation: pulse-ring 2s infinite; }
@keyframes pulse-ring { 0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4); } 70% { box-shadow: 0 0 0 20px rgba(37, 211, 102, 0); } 100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); } }

/* Update / Download Section */
.profile-update-section {
    width: 100%;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.profile-update-divider {
    width: 100%;
    height: 1px;
    background: var(--border);
    margin-bottom: 20px;
}

.profile-update-card {
    width: 100%;
    max-width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.profile-update-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-update-desc {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.4;
}

.profile-update-btn {
    width: 100%;
    padding: 10px 16px;
    border-radius: 8px;
    border: none;
    background: var(--primary);
    color: var(--primary-text);
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

.profile-update-btn:hover {
    background: var(--primary-hover);
}

.profile-update-btn:active {
    transform: scale(0.98);
}

.profile-update-progress-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.profile-update-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.profile-update-progress-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.1s linear;
}

.profile-update-progress-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
}



/* =========================================
   Media Download Card & Progress Metrics
   ========================================= */
.media-download-card, .upload-progress-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    min-width: 210px;
    max-width: 280px;
    backdrop-filter: blur(8px);
    margin: 4px 0;
}
.media-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
}
.media-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: rgba(0, 168, 132, 0.2);
    color: #00a884;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}
.media-card-details {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.media-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #f0f2f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-card-size {
    font-size: 11px;
    color: #aebac1;
    margin-top: 1px;
}
.media-card-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 10px;
    background: #00a884;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.1s ease;
    margin-top: 2px;
}
.media-card-btn:active {
    transform: scale(0.97);
    background: #008f70;
}
.media-card-progress {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    margin-top: 4px;
}
.media-progress-bar-bg {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}
.media-progress-bar-fill, .upload-progress-fill {
    height: 100%;
    width: 0%;
    background: #00a884;
    transition: width 0.15s linear;
}
.media-progress-metrics, .upload-metrics-text {
    font-size: 11px;
    color: #aebac1;
    white-space: nowrap;
}

/* ==========================================================================
   Instagram-Style Chat Themes System (32 Curated Themes, 120fps GPU Scroll)
   ========================================================================== */

/* Sent Message Gradients (32 Themes) */
[data-theme="default"] .message.sent {
    background: #005c4b !important;
    color: #ffffff !important;
}
[data-theme="instagram"] .message.sent {
    background: linear-gradient(135deg, #833ab4, #fd1d1d, #fcb045) !important;
    color: #ffffff !important;
}
[data-theme="cyberpunk"] .message.sent {
    background: linear-gradient(135deg, #7928ca, #0070f3, #00dfd8) !important;
    color: #ffffff !important;
}
[data-theme="sunset"] .message.sent {
    background: linear-gradient(135deg, #eb3349, #f45c43) !important;
    color: #ffffff !important;
}
[data-theme="ocean"] .message.sent {
    background: linear-gradient(135deg, #00c6ff, #0072ff) !important;
    color: #ffffff !important;
}
[data-theme="aurora"] .message.sent {
    background: linear-gradient(135deg, #a7f3d0, #67e8f9) !important;
    color: #042f2e !important;
    font-weight: 500;
}
[data-theme="sakura"] .message.sent {
    background: linear-gradient(135deg, #fed7aa, #fecdd3) !important;
    color: #1c0a14 !important;
    font-weight: 500;
}
[data-theme="midnight"] .message.sent {
    background: #27272a !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}
[data-theme="lofi"] .message.sent {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: #ffffff !important;
}
[data-theme="emerald"] .message.sent {
    background: linear-gradient(135deg, #11998e, #38ef7d) !important;
    color: #ffffff !important;
}
[data-theme="cosmic"] .message.sent {
    background: linear-gradient(135deg, #8e2de2, #4a00e0) !important;
    color: #ffffff !important;
}
[data-theme="crimson"] .message.sent {
    background: linear-gradient(135deg, #cb2d3e, #ef473a) !important;
    color: #ffffff !important;
}
[data-theme="amber"] .message.sent {
    background: linear-gradient(135deg, #f59e0b, #fbbf24) !important;
    color: #111827 !important;
    font-weight: 500;
}
[data-theme="bubblegum"] .message.sent {
    background: linear-gradient(135deg, #fbcfe8, #f472b6) !important;
    color: #18181b !important;
    font-weight: 500;
}
[data-theme="matrix"] .message.sent {
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364) !important;
    border: 1px solid #00ff87 !important;
    color: #e0fbf1 !important;
}
[data-theme="slate"] .message.sent {
    background: #374151 !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

/* New 16 Themes */
[data-theme="desert"] .message.sent {
    background: linear-gradient(135deg, #f12711, #f5af19) !important;
    color: #ffffff !important;
}
[data-theme="flamingo"] .message.sent {
    background: linear-gradient(135deg, #ff416c, #ff4b2b) !important;
    color: #ffffff !important;
}
[data-theme="synthwave"] .message.sent {
    background: linear-gradient(135deg, #f72585, #7209b7, #3a0ca3) !important;
    color: #ffffff !important;
}
[data-theme="neon_purple"] .message.sent {
    background: linear-gradient(135deg, #b5179e, #7209b7) !important;
    color: #ffffff !important;
}
[data-theme="hyperdrive"] .message.sent {
    background: linear-gradient(135deg, #2e0854, #1e3c72, #2a5298) !important;
    color: #ffffff !important;
}
[data-theme="deep_blue"] .message.sent {
    background: linear-gradient(135deg, #13547a, #80d0c7) !important;
    color: #ffffff !important;
}
[data-theme="skyline"] .message.sent {
    background: linear-gradient(135deg, #4facfe, #00f2fe) !important;
    color: #ffffff !important;
}
[data-theme="iceberg"] .message.sent {
    background: linear-gradient(135deg, #2193b0, #6dd5ed) !important;
    color: #ffffff !important;
}
[data-theme="matcha"] .message.sent {
    background: linear-gradient(135deg, #56ab2f, #a8e063) !important;
    color: #052e16 !important;
    font-weight: 500;
}
[data-theme="eucalyptus"] .message.sent {
    background: linear-gradient(135deg, #134e5e, #71b280) !important;
    color: #ffffff !important;
}
[data-theme="peach"] .message.sent {
    background: linear-gradient(135deg, #ffecd2, #fcb69f) !important;
    color: #2c1205 !important;
    font-weight: 500;
}
[data-theme="lavender"] .message.sent {
    background: linear-gradient(135deg, #e0c3fc, #8ec5fc) !important;
    color: #1e1b4b !important;
    font-weight: 500;
}
[data-theme="lemon"] .message.sent {
    background: linear-gradient(135deg, #f6d365, #fda085) !important;
    color: #2a1503 !important;
    font-weight: 500;
}
[data-theme="champagne"] .message.sent {
    background: linear-gradient(135deg, #8a733e, #c5a059) !important;
    color: #ffffff !important;
}
[data-theme="velvet"] .message.sent {
    background: linear-gradient(135deg, #3a1c71, #d76d77, #ffaf7b) !important;
    color: #ffffff !important;
}
[data-theme="carbon"] .message.sent {
    background: linear-gradient(135deg, #141e30, #243b55) !important;
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
    color: #ffffff !important;
}

/* Received Message Bubbles — Instagram-Style Matching Ambient Tints (32 Themes) */
[data-theme="default"] .message.received { background: #1f2c34 !important; color: #e9edef !important; }
[data-theme="instagram"] .message.received { background: #2b1827 !important; color: #f7e8f3 !important; }
[data-theme="cyberpunk"] .message.received { background: #181a2e !important; color: #e8eaff !important; }
[data-theme="sunset"] .message.received { background: #2b1a1a !important; color: #ffeded !important; }
[data-theme="ocean"] .message.received { background: #13222e !important; color: #e4f3fd !important; }
[data-theme="aurora"] .message.received { background: #132920 !important; color: #e6f9f0 !important; }
[data-theme="sakura"] .message.received { background: #2b1a22 !important; color: #ffeef4 !important; }
[data-theme="midnight"] .message.received { background: #18181b !important; border: 1px solid rgba(255, 255, 255, 0.1) !important; color: #f4f4f5 !important; }
[data-theme="lofi"] .message.received { background: #201a2e !important; color: #f2efff !important; }
[data-theme="emerald"] .message.received { background: #11261b !important; color: #e8f8ef !important; }
[data-theme="cosmic"] .message.received { background: #22162e !important; color: #f5eaff !important; }
[data-theme="crimson"] .message.received { background: #2b1416 !important; color: #ffebee !important; }
[data-theme="amber"] .message.received { background: #2b1f13 !important; color: #fff8eb !important; }
[data-theme="bubblegum"] .message.received { background: #2b1721 !important; color: #ffebf5 !important; }
[data-theme="matrix"] .message.received { background: #0f221a !important; border: 1px solid rgba(0, 255, 135, 0.3) !important; color: #e0fbf1 !important; }
[data-theme="slate"] .message.received { background: #1f2937 !important; border: 1px solid rgba(255, 255, 255, 0.08) !important; color: #f3f4f6 !important; }

[data-theme="desert"] .message.received { background: #2b1c14 !important; color: #ffefe6 !important; }
[data-theme="flamingo"] .message.received { background: #2c1619 !important; color: #ffebee !important; }
[data-theme="synthwave"] .message.received { background: #231229 !important; color: #fae8ff !important; }
[data-theme="neon_purple"] .message.received { background: #24142e !important; color: #f5e8ff !important; }
[data-theme="hyperdrive"] .message.received { background: #14172e !important; color: #e8eaff !important; }
[data-theme="deep_blue"] .message.received { background: #122228 !important; color: #e3f8fa !important; }
[data-theme="skyline"] .message.received { background: #11242e !important; color: #e0f4ff !important; }
[data-theme="iceberg"] .message.received { background: #122329 !important; color: #e0f7fa !important; }
[data-theme="matcha"] .message.received { background: #172615 !important; color: #ecfae8 !important; }
[data-theme="eucalyptus"] .message.received { background: #13241e !important; color: #e6f9f0 !important; }
[data-theme="peach"] .message.received { background: #2c1e18 !important; color: #fff3ec !important; }
[data-theme="lavender"] .message.received { background: #211c2e !important; color: #f3eeff !important; }
[data-theme="lemon"] .message.received { background: #2b2212 !important; color: #fffbeb !important; }
[data-theme="champagne"] .message.received { background: #252016 !important; color: #fefce8 !important; }
[data-theme="velvet"] .message.received { background: #241525 !important; color: #fae8ff !important; }
[data-theme="carbon"] .message.received { background: #151d27 !important; border: 1px solid rgba(255, 255, 255, 0.08) !important; color: #f1f5f9 !important; }

/* Base Message Footer & Timestamp Shadows */
.message.sent .timestamp {
    color: rgba(255, 255, 255, 0.9) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    font-weight: 500;
}
.message.sent .ticks {
    color: rgba(255, 255, 255, 0.8) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Light Theme Details (Dark font details on Sent bubbles) */
[data-theme="amber"] .message.sent .timestamp, [data-theme="amber"] .message.sent .ticks,
[data-theme="bubblegum"] .message.sent .timestamp, [data-theme="bubblegum"] .message.sent .ticks,
[data-theme="sakura"] .message.sent .timestamp, [data-theme="sakura"] .message.sent .ticks,
[data-theme="aurora"] .message.sent .timestamp, [data-theme="aurora"] .message.sent .ticks,
[data-theme="matcha"] .message.sent .timestamp, [data-theme="matcha"] .message.sent .ticks,
[data-theme="peach"] .message.sent .timestamp, [data-theme="peach"] .message.sent .ticks,
[data-theme="lavender"] .message.sent .timestamp, [data-theme="lavender"] .message.sent .ticks,
[data-theme="lemon"] .message.sent .timestamp, [data-theme="lemon"] .message.sent .ticks {
    color: rgba(0, 0, 0, 0.65) !important;
    text-shadow: none !important;
}

/* Double Checkmark (✓✓) Contrast Overrides (32 Themes) */
[data-theme="default"] .message.sent .ticks.read { color: #53bdeb !important; }
[data-theme="instagram"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="cyberpunk"] .message.sent .ticks.read { color: #00ffff !important; text-shadow: 0 0 6px rgba(0,255,255,0.7); }
[data-theme="sunset"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="ocean"] .message.sent .ticks.read { color: #ffd700 !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="aurora"] .message.sent .ticks.read { color: #0369a1 !important; font-weight: bold; }
[data-theme="sakura"] .message.sent .ticks.read { color: #9f1239 !important; font-weight: bold; }
[data-theme="midnight"] .message.sent .ticks.read { color: #38bdf8 !important; }
[data-theme="lofi"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="emerald"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="cosmic"] .message.sent .ticks.read { color: #00ffff !important; text-shadow: 0 0 5px rgba(0,255,255,0.6); }
[data-theme="crimson"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="amber"] .message.sent .ticks.read { color: #0284c7 !important; font-weight: bold; }
[data-theme="bubblegum"] .message.sent .ticks.read { color: #4f46e5 !important; font-weight: bold; }
[data-theme="matrix"] .message.sent .ticks.read { color: #00ff87 !important; text-shadow: 0 0 6px rgba(0,255,135,0.7); }
[data-theme="slate"] .message.sent .ticks.read { color: #38bdf8 !important; }

[data-theme="desert"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="flamingo"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="synthwave"] .message.sent .ticks.read { color: #00ffff !important; text-shadow: 0 0 5px rgba(0,255,255,0.6); }
[data-theme="neon_purple"] .message.sent .ticks.read { color: #38bdf8 !important; text-shadow: 0 0 5px rgba(56,189,248,0.6); }
[data-theme="hyperdrive"] .message.sent .ticks.read { color: #00ffff !important; text-shadow: 0 0 5px rgba(0,255,255,0.6); }
[data-theme="deep_blue"] .message.sent .ticks.read { color: #ffd700 !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="skyline"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="iceberg"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="matcha"] .message.sent .ticks.read { color: #14532d !important; font-weight: bold; }
[data-theme="eucalyptus"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="peach"] .message.sent .ticks.read { color: #7c2d12 !important; font-weight: bold; }
[data-theme="lavender"] .message.sent .ticks.read { color: #3730a3 !important; font-weight: bold; }
[data-theme="lemon"] .message.sent .ticks.read { color: #c2410c !important; font-weight: bold; }
[data-theme="champagne"] .message.sent .ticks.read { color: #ffd700 !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="velvet"] .message.sent .ticks.read { color: #ffffff !important; text-shadow: 0 0 4px rgba(0,0,0,0.6); }
[data-theme="carbon"] .message.sent .ticks.read { color: #38bdf8 !important; }

/* Theme Picker Modal & Interactive Live Preview */
#theme-modal .modal-content {
    max-width: 480px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    padding: 18px 20px;
    border-radius: 18px;
}
.theme-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.theme-modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

/* Interactive Theme Preview Box */
.theme-preview-box {
    background: #111b21;
    border-radius: 14px;
    padding: 12px 16px;
    margin-bottom: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.4);
    transition: background 0.2s ease;
}
.preview-box-label {
    font-size: 10.5px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #8696a0;
    margin-bottom: 8px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}
.preview-messages {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.preview-msg {
    max-width: 82% !important;
    padding: 6px 10px 6px 12px !important;
    border-radius: 12px !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25) !important;
}
.preview-msg.received {
    align-self: flex-start !important;
    border-top-left-radius: 2px !important;
}
.preview-msg.sent {
    align-self: flex-end !important;
    border-top-right-radius: 2px !important;
}
.preview-msg .msg-content {
    display: flex;
    flex-direction: column;
}
.preview-msg .preview-text {
    font-size: 13.5px;
    line-height: 1.35;
}
.preview-msg .msg-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 2px;
    line-height: 1;
}

.theme-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 9px;
    overflow-y: auto;
    max-height: 40vh;
    padding: 4px 2px;
    -webkit-overflow-scrolling: touch;
}
.theme-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    text-align: left;
    position: relative;
    user-select: none;
}
.theme-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}
.theme-card:active {
    transform: scale(0.98);
}
.theme-card.active {
    background: rgba(255, 255, 255, 0.12);
    border-color: #22c55e;
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.25);
}
.theme-swatch {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    border: 2px solid rgba(255, 255, 255, 0.2);
}
.theme-info {
    flex: 1;
    min-width: 0;
}
.theme-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: #f4f4f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.theme-desc {
    font-size: 0.68rem;
    color: #a1a1aa;
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.theme-check {
    display: none;
    font-size: 0.95rem;
    color: #22c55e;
    font-weight: bold;
}
.theme-card.active .theme-check {
    display: block;
}





/* WhatsApp SVG Ticks & Clocks Alignment */
.ticks {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    line-height: 1;
}

.ticks svg {
    display: inline-block;
    vertical-align: middle;
    width: auto;
    max-height: 15px;
}

.msg-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
}







/* =========================================
   Auth Screen Security Teaser (Pristine Link)
   ========================================= */
.auth-security-teaser,
a.auth-security-teaser,
a.auth-security-teaser:visited,
a.auth-security-teaser:hover,
a.auth-security-teaser:active,
a.auth-security-teaser:focus {
    margin-top: 14px;
    background: #0d121f;
    border: 1px solid rgba(0, 240, 255, 0.3);
    border-radius: 12px;
    padding: 10px 14px;
    cursor: pointer;
    text-align: left;
    width: 100%;
    display: block;
    text-decoration: none !important;
    color: #fff !important;
    box-sizing: border-box;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
    transition: all 0.2s ease;
    outline: none !important;
}

.auth-security-teaser:hover {
    transform: translateY(-2px);
    border-color: rgba(0, 240, 255, 0.6);
    box-shadow: 0 6px 20px rgba(0, 240, 255, 0.2);
}

.auth-security-teaser * {
    text-decoration: none !important;
}

.security-teaser-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #00f0ff;
    font-size: 11.5px;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    text-decoration: none !important;
}

.security-teaser-badge svg {
    color: #00ff88;
    flex-shrink: 0;
}

.security-typewriter-box {
    font-size: 12.5px;
    color: #e2e8f0;
    font-weight: 500;
    min-height: 18px;
    display: flex;
    align-items: center;
    font-family: 'Inter', -apple-system, sans-serif;
    text-decoration: none !important;
}

.typewriter-text {
    text-decoration: none !important;
    color: #cbd5e1;
}

.typewriter-cursor {
    display: inline-block;
    color: #00ff88;
    font-weight: 700;
    margin-left: 2px;
    animation: blinkCursor 0.75s infinite;
}

@keyframes blinkCursor {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

@media (max-height: 750px), (max-width: 480px) {
    .auth-wrapper {
        padding: 12px 14px;
    }
    .auth-header h1 {
        font-size: 2.2rem;
        margin-bottom: 2px;
    }
    .tagline {
        font-size: 0.95rem;
        margin-bottom: 14px;
    }
    .auth-card {
        padding: 22px 18px;
        border-radius: 18px;
    }
    .auth-card h2 {
        font-size: 1.25rem;
        margin-bottom: 12px;
    }
    .input-group {
        margin-bottom: 12px;
    }
    .input-group input {
        padding: 11px;
    }
    .glow-btn {
        padding: 13px;
    }
    .divider {
        margin: 12px 0;
    }
    .auth-footer {
        margin-top: 14px;
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   YouTube Floating Watch Party 120 FPS GPU-Accelerated UI Styles
   ========================================================================== */

.message.has-yt-btn {
    position: relative;
    overflow: visible !important;
}

.yt-watch-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(18, 22, 32, 0.88);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: #ff3b30;
    border: 1px solid rgba(255, 255, 255, 0.14);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 8px rgba(255, 59, 48, 0.25);
    z-index: 5;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Sent message: button on the LEFT side */
.message.sent .yt-watch-btn {
    left: -38px;
    right: auto;
}

/* Received message: button on the RIGHT side */
.message.received .yt-watch-btn {
    right: -38px;
    left: auto;
}

.yt-watch-btn svg {
    margin-left: 2px;
    fill: #ff3b30;
    transition: transform 0.15s ease;
}

.yt-watch-btn:hover {
    transform: translateY(-50%) scale(1.12);
    background: rgba(28, 34, 48, 0.95);
    border-color: rgba(255, 59, 48, 0.5);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.55), 0 0 14px rgba(255, 59, 48, 0.45);
}

.yt-watch-btn:hover svg {
    transform: scale(1.1);
}

.yt-watch-btn:active {
    transform: translateY(-50%) scale(0.92);
}

.fwp-container {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99990;
    pointer-events: auto;
    will-change: transform;
    transform: translate3d(16px, 70px, 0);
    transition: none;
}

.fwp-container.fwp-snapping {
    transition: transform 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.0) !important;
}

/* Modern Compact Ultra-Premium Video Card */
.fwp-card {
    position: relative;
    width: min(340px, 90vw);
    background: linear-gradient(180deg, #131724 0%, #090c14 100%);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 20px rgba(255, 59, 48, 0.12);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    transition: box-shadow 0.2s ease, opacity 0.2s ease;
}

.fwp-card.is-dragging {
    box-shadow: 0 30px 75px rgba(0, 0, 0, 0.95), 0 0 24px rgba(255, 59, 48, 0.4);
    opacity: 0.96;
}

/* Sleek Top Header ABOVE the video */
.fwp-header {
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    background: rgba(18, 22, 34, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    cursor: grab;
}

.fwp-header:active {
    cursor: grabbing;
}

.fwp-info {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.fwp-icon-wrapper {
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 4px rgba(255, 59, 48, 0.4));
}

.fwp-title {
    font-size: 12px;
    font-weight: 600;
    color: #f8fafc;
    letter-spacing: -0.1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fwp-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    white-space: nowrap;
}

.fwp-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #22c55e;
    display: inline-block;
}

.fwp-badge-dot.fwp-pulse {
    box-shadow: 0 0 6px #22c55e;
    animation: fwpDotPulse 1.8s infinite ease-out;
}

@keyframes fwpDotPulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(34, 197, 94, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.fwp-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.fwp-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.07);
    background: rgba(255, 255, 255, 0.06);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.fwp-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.fwp-btn:active {
    transform: scale(0.92);
}

.fwp-btn.fwp-close:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: #ffffff;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.5);
}

/* Seamless 16:9 Video Box with zero black margins */
.fwp-video-box {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000000;
    overflow: hidden;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

#fwp-yt-player-slot {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

#fwp-yt-player-slot iframe,
.fwp-video-box iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    border: none;
    display: block;
    outline: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Tap-to-Play Overlay (Android Autoplay Policy Unblocker) */
.fwp-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 30;
    cursor: pointer;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.fwp-play-overlay.hidden {
    display: none !important;
}

.fwp-play-overlay-circle {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 0 24px rgba(56, 189, 248, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
    animation: fwpPulse 1.8s infinite ease-in-out;
}

.fwp-play-overlay-circle svg {
    margin-left: 3px;
}

.fwp-play-overlay-label {
    font-size: 13px;
    font-weight: 600;
    color: #f1f5f9;
    letter-spacing: 0.3px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

@keyframes fwpPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(56, 189, 248, 0.5); }
    50% { transform: scale(1.08); box-shadow: 0 0 32px rgba(56, 189, 248, 0.85); }
}

/* Shield active ONLY during drag/resize */
.fwp-drag-shield {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 20;
    background: transparent;
    cursor: grabbing;
}

/* Visible, High-Affordance Bottom-Right Corner Resize Handle */
.fwp-resize-handle {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 36px;
    height: 36px;
    z-index: 25;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 4px 4px 0;
    color: #ffffff;
    cursor: nwse-resize;
    touch-action: none;
    background: radial-gradient(circle at bottom right, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 75%);
    border-bottom-right-radius: 16px;
}

.fwp-resize-handle svg {
    width: 20px;
    height: 20px;
    filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.9));
    color: #ffffff;
    opacity: 0.85;
    transition: transform 0.15s ease, opacity 0.15s ease, color 0.15s ease;
}

.fwp-resize-handle:hover svg {
    opacity: 1;
    transform: scale(1.15);
    color: #38bdf8;
}

.fwp-resize-handle:active svg {
    opacity: 1;
    transform: scale(0.92);
    color: #38bdf8;
}

/* Dedicated Thumb-Friendly Bottom Control Bar */
.fwp-controls-bar {
    height: 40px;
    background: linear-gradient(180deg, #121624 0%, #090c14 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    padding: 0 10px;
    gap: 7px;
    user-select: none;
    -webkit-user-select: none;
}

.fwp-ctrl-btn {
    width: 28px;
    height: 28px;
    border-radius: 7px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.06);
    color: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
}

.fwp-ctrl-btn:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.fwp-ctrl-btn:active {
    transform: scale(0.92);
}

/* Crimson Jewel Play/Pause Button */
.fwp-ctrl-btn.fwp-play-pause-btn {
    background: linear-gradient(135deg, #ff3b30 0%, #e11d48 100%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.45);
}

.fwp-ctrl-btn.fwp-play-pause-btn:hover {
    background: linear-gradient(135deg, #ff453a 0%, #f43f5e 100%);
    box-shadow: 0 3px 12px rgba(255, 59, 48, 0.6);
    transform: scale(1.08);
}

.fwp-ctrl-btn.fwp-play-pause-btn:active {
    transform: scale(0.92);
}

.fwp-seek-container {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0 3px;
}

.fwp-seek-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: linear-gradient(to right, #ff3b30 0%, #ff3b30 var(--progress, 0%), rgba(255, 255, 255, 0.18) var(--progress, 0%), rgba(255, 255, 255, 0.18) 100%);
    outline: none;
    cursor: pointer;
    margin: 0;
    transition: height 0.15s ease;
}

.fwp-seek-slider:hover {
    height: 6px;
}

.fwp-seek-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2.5px solid #ff3b30;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6), 0 0 6px rgba(255, 59, 48, 0.6);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fwp-seek-slider::-webkit-slider-thumb:hover {
    transform: scale(1.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8), 0 0 10px rgba(255, 59, 48, 0.8);
}

.fwp-seek-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #ffffff;
    border: 2.5px solid #ff3b30;
    cursor: pointer;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.6), 0 0 6px rgba(255, 59, 48, 0.6);
}

.fwp-time-text {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    white-space: nowrap;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.2px;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Fullscreen Mode */
.fwp-card.fwp-fullscreen {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    border-radius: 0 !important;
    z-index: 99999 !important;
}

.fwp-card.fwp-fullscreen .fwp-video-box {
    flex: 1;
    aspect-ratio: auto;
}

/* 56px Minimized Audio Floating Bubble */
.fwp-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #181a2e, #090a12);
    border: 2px solid #ff3b30;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8), 0 0 14px rgba(255, 59, 48, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    user-select: none;
    touch-action: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.fwp-bubble:hover {
    transform: scale(1.06);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.9), 0 0 18px rgba(255, 59, 48, 0.7);
}

.fwp-bubble:active {
    transform: scale(0.94);
}

.fwp-bubble-icon {
    font-size: 24px;
}

.fwp-bubble-ring {
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 50%;
    border: 2px solid rgba(255, 59, 48, 0.6);
    animation: fwpRingPulse 2s infinite ease-out;
}

@keyframes fwpRingPulse {
    0% { transform: scale(0.95); opacity: 1; }
    100% { transform: scale(1.3); opacity: 0; }
}

/* ==========================================================================
   Real-Time Gaming Arena Presence Styles
   ========================================================================== */

/* Pulsing Red/Cyan Gaming Dot on 3-Dot Kebab Menu */
.kebab-gaming-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #ff3b30;
    box-shadow: 0 0 8px #ff3b30;
    border: 1.5px solid #111b21;
    animation: kebabDotPulse 1.4s infinite ease-in-out;
    pointer-events: none;
    z-index: 10;
}

.kebab-gaming-dot.hidden {
    display: none !important;
}

@keyframes kebabDotPulse {
    0% { transform: scale(0.9); box-shadow: 0 0 4px #ff3b30; }
    50% { transform: scale(1.35); box-shadow: 0 0 12px #ff3b30; background: #ff4d4d; }
    100% { transform: scale(0.9); box-shadow: 0 0 4px #ff3b30; }
}

/* In-Chat Top Presence Banner */
.gaming-arena-banner {
    background: linear-gradient(135deg, rgba(16, 24, 40, 0.95) 0%, rgba(9, 13, 22, 0.98) 100%);
    border-bottom: 1px solid rgba(0, 242, 254, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5), 0 0 12px rgba(0, 242, 254, 0.15);
    padding: 8px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    z-index: 40;
    position: sticky;
    top: 0;
    animation: bannerSlideDown 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.0);
}

.gaming-arena-banner.hidden {
    display: none !important;
}

@keyframes bannerSlideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.gaming-arena-banner .banner-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.gaming-arena-banner .gaming-icon {
    font-size: 16px;
    filter: drop-shadow(0 0 4px #00f2fe);
}

.gaming-arena-banner .banner-text {
    font-size: 12px;
    font-weight: 600;
    color: #f1f5f9;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gaming-arena-banner .banner-join-btn {
    height: 28px;
    padding: 0 12px;
    border-radius: 7px;
    border: none;
    background: linear-gradient(135deg, #ff3b30 0%, #e11d48 100%);
    color: #ffffff;
    font-size: 11.5px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 8px rgba(255, 59, 48, 0.4);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    flex-shrink: 0;
}

.gaming-arena-banner .banner-join-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 3px 12px rgba(255, 59, 48, 0.6);
}

.gaming-arena-banner .banner-close-btn {
    background: none;
    border: none;
    color: #64748b;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.gaming-arena-banner .banner-close-btn:hover {
    color: #cbd5e1;
}



/* =========================================
   Ultra-Premium Unified Modal Close Button
   ========================================= */
.modal-close-btn,
.gif-close,
.wallpaper-close,
.profile-pic-close,
.emoji-close,
.effects-close,
.nsfw-close,
.theme-modal-close {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    color: #f4f4f5 !important;
    cursor: pointer !important;
    padding: 0 !important;
    margin: 0 !important;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1) !important;
    -webkit-tap-highlight-color: transparent !important;
    user-select: none !important;
    outline: none !important;
    flex-shrink: 0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

.modal-close-btn svg,
.gif-close svg,
.wallpaper-close svg,
.profile-pic-close svg,
.emoji-close svg,
.effects-close svg,
.nsfw-close svg,
.theme-modal-close svg {
    width: 18px !important;
    height: 18px !important;
    stroke: #f4f4f5 !important;
    stroke-width: 2.4 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
    transition: transform 0.2s ease, stroke 0.2s ease !important;
    display: block !important;
}

.modal-close-btn:hover,
.gif-close:hover,
.wallpaper-close:hover,
.profile-pic-close:hover,
.emoji-close:hover,
.effects-close:hover,
.nsfw-close:hover,
.theme-modal-close:hover {
    background: rgba(239, 68, 68, 0.2) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
    color: #ef4444 !important;
    transform: scale(1.08) !important;
}

.modal-close-btn:hover svg,
.gif-close:hover svg,
.wallpaper-close:hover svg,
.profile-pic-close:hover svg,
.emoji-close:hover svg,
.effects-close:hover svg,
.nsfw-close:hover svg,
.theme-modal-close:hover svg {
    stroke: #ef4444 !important;
    transform: rotate(90deg) !important;
}

.modal-close-btn:active,
.gif-close:active,
.wallpaper-close:active,
.profile-pic-close:active,
.emoji-close:active,
.effects-close:active,
.nsfw-close:active,
.theme-modal-close:active {
    transform: scale(0.92) !important;
    background: rgba(239, 68, 68, 0.35) !important;
}

/* =========================================
   Ultra-Sleek Apple macOS Floating Kebab Menu
   ========================================= */
.kebab-menu-popover {
    position: fixed;
    z-index: 99999;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transform-origin: top right;
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

.kebab-menu-popover.hidden {
    opacity: 0 !important;
    transform: scale3d(0.85, 0.85, 1) translate3d(0, -8px, 0) !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

.kebab-menu-popover:not(.hidden) {
    opacity: 1 !important;
    transform: scale3d(1, 1, 1) translate3d(0, 0, 0) !important;
    visibility: visible !important;
    pointer-events: auto !important;
    animation: kebabMenuSpring 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes kebabMenuSpring {
    0% {
        opacity: 0;
        transform: scale3d(0.85, 0.85, 1) translate3d(0, -10px, 0);
    }
    100% {
        opacity: 1;
        transform: scale3d(1, 1, 1) translate3d(0, 0, 0);
    }
}

.kebab-menu-card {
    background: #151a23 !important;
    background: linear-gradient(165deg, rgba(24, 30, 42, 0.98) 0%, rgba(15, 20, 28, 0.99) 100%) !important;
    backdrop-filter: blur(32px) saturate(200%) !important;
    -webkit-backdrop-filter: blur(32px) saturate(200%) !important;
    border: 1px solid rgba(255, 255, 255, 0.16) !important;
    box-shadow: 
        inset 0 1px 1.2px 0 rgba(255, 255, 255, 0.25),
        0 24px 56px 0 rgba(0, 0, 0, 0.85),
        0 4px 16px 0 rgba(0, 0, 0, 0.6) !important;
    border-radius: 20px;
    padding: 7px;
    width: 220px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 4px;
    transform: translateZ(0);
    pointer-events: auto !important;
}

.kebab-menu-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    border-radius: 13px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer !important;
    outline: none;
    transition: background 0.18s ease, transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    text-align: left;
    width: 100%;
    box-sizing: border-box;
    transform: translateZ(0);
    pointer-events: auto !important;
}

.kebab-menu-row * {
    pointer-events: none !important;
}

.kebab-menu-row:hover {
    background: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: inset 0 1px 1.2px rgba(255, 255, 255, 0.2), 0 4px 12px rgba(0, 0, 0, 0.35);
    transform: translateY(-1px);
}

.kebab-menu-row:active {
    transform: scale3d(0.97, 0.97, 1);
    background: rgba(255, 255, 255, 0.08);
}

/* 120 FPS GPU Row Cascade Animation */
.kebab-menu-popover:not(.hidden) .kebab-menu-row:nth-child(1) {
    animation: attachRowCascade 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.02s backwards;
}
.kebab-menu-popover:not(.hidden) .kebab-menu-row:nth-child(2) {
    animation: attachRowCascade 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.05s backwards;
}
.kebab-menu-popover:not(.hidden) .kebab-menu-row:nth-child(3) {
    animation: attachRowCascade 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.08s backwards;
}
.kebab-menu-popover:not(.hidden) .kebab-menu-row:nth-child(4) {
    animation: attachRowCascade 0.28s cubic-bezier(0.16, 1, 0.3, 1) 0.11s backwards;
}

.kebab-row-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
    transform: translateZ(0);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.25);
}

/* Nudge Icon Tile */
.icon-nudge {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.28);
    color: #fbbf24;
}
.kebab-menu-row:hover .icon-nudge {
    background: rgba(251, 191, 36, 0.22);
    border-color: rgba(251, 191, 36, 0.45);
    color: #fde68a;
}

/* Wallpaper Icon Tile */
.icon-wallpaper {
    background: rgba(52, 211, 153, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.28);
    color: #34d399;
}
.kebab-menu-row:hover .icon-wallpaper {
    background: rgba(52, 211, 153, 0.22);
    border-color: rgba(52, 211, 153, 0.45);
    color: #6ee7b7;
}

/* Theme Icon Tile */
.icon-theme {
    background: rgba(192, 132, 252, 0.12);
    border: 1px solid rgba(192, 132, 252, 0.28);
    color: #c084fc;
}
.kebab-menu-row:hover .icon-theme {
    background: rgba(192, 132, 252, 0.22);
    border-color: rgba(192, 132, 252, 0.45);
    color: #d8b4fe;
}



/* Cinema Sync Icon Tile */
.icon-cinema {
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.28);
    color: #38bdf8;
}
.kebab-menu-row:hover .icon-cinema {
    background: rgba(56, 189, 248, 0.22);
    border-color: rgba(56, 189, 248, 0.45);
    color: #7dd3fc;
}

/* Clear Chat Icon Tile */
.icon-clearchat {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.28);
    color: #ef4444;
}
.kebab-menu-row:hover .icon-clearchat {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.45);
    color: #fca5a5;
}

.kebab-menu-popover:not(.hidden) .kebab-row-icon {
    animation: iconTileSpring 0.35s cubic-bezier(0.16, 1, 0.3, 1) backwards;
}

/* Pen-drawn SVG stroke animation for kebab menu */
.kebab-menu-popover:not(.hidden) .kebab-row-icon svg path,
.kebab-menu-popover:not(.hidden) .kebab-row-icon svg circle,
.kebab-menu-popover:not(.hidden) .kebab-row-icon svg rect,
.kebab-menu-popover:not(.hidden) .kebab-row-icon svg polygon,
.kebab-menu-popover:not(.hidden) .kebab-row-icon svg polyline,
.kebab-menu-popover:not(.hidden) .kebab-row-icon svg line {
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: penLineDraw 0.75s cubic-bezier(0.08, 0.82, 0.17, 1) forwards;
}

.kebab-menu-popover:not(.hidden) .kebab-menu-row:nth-child(1) .kebab-row-icon svg * {
    animation-delay: 0.02s;
}
.kebab-menu-popover:not(.hidden) .kebab-menu-row:nth-child(2) .kebab-row-icon svg * {
    animation-delay: 0.05s;
}
.kebab-menu-popover:not(.hidden) .kebab-menu-row:nth-child(3) .kebab-row-icon svg * {
    animation-delay: 0.08s;
}
.kebab-menu-popover:not(.hidden) .kebab-menu-row:nth-child(4) .kebab-row-icon svg * {
    animation-delay: 0.11s;
}
.kebab-menu-popover:not(.hidden) .kebab-menu-row:nth-child(5) .kebab-row-icon svg * {
    animation-delay: 0.14s;
}

.kebab-row-label {
    font-size: 14.5px;
    font-weight: 600;
    color: #f8fafc;
    letter-spacing: -0.1px;
    flex: 1;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

.kebab-menu-row.row-danger .kebab-row-label {
    color: #fca5a5;
    text-shadow: 0 1px 2px rgba(239, 68, 68, 0.3);
}

.kebab-row-arrow {
    font-size: 16px;
    font-weight: 400;
    color: rgba(255, 255, 255, 0.4);
    transition: transform 0.15s, color 0.15s;
}

.kebab-menu-row:hover .kebab-row-arrow {
    color: rgba(255, 255, 255, 0.85);
    transform: translateX(2px);
}

/* ==========================================================================
   RICH OPENGRAPH LINK PREVIEWS (CONVOO)
   ========================================================================== */

.link-preview-card {
    margin-top: 8px;
    margin-bottom: 2px;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(255, 255, 255, 0.09);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 380px;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    box-sizing: border-box;
    user-select: none;
    -webkit-user-select: none;
}

.link-preview-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(0, 0, 0, 0.36);
}

.lp-media-wrapper {
    position: relative;
    width: 100%;
    max-height: 380px;
    background: #000000;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lp-image {
    width: 100%;
    height: auto;
    max-height: 380px;
    object-fit: contain;
    display: block;
    transition: transform 0.25s ease;
}

.lp-media-wrapper:hover .lp-image {
    transform: scale3d(1.02, 1.02, 1);
}

.lp-yt-badge,
.lp-ig-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 3px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.lp-ig-badge {
    background: linear-gradient(45deg, rgba(240, 148, 51, 0.85), rgba(230, 77, 89, 0.85), rgba(217, 49, 117, 0.85), rgba(188, 42, 141, 0.85));
}

.lp-body {
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
}

.lp-header-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
    cursor: pointer;
}

.lp-favicon {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}

.lp-domain {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.lp-badge-tag {
    margin-left: auto;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(214, 36, 159, 0.2);
    color: #f472b6;
    border: 1px solid rgba(214, 36, 159, 0.3);
}

.lp-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.35;
    color: #f1f5f9;
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    cursor: pointer;
    transition: color 0.12s;
}

.lp-title:hover {
    color: #38bdf8;
    text-decoration: underline;
}

.lp-desc {
    font-size: 12px;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.55);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
    cursor: pointer;
}

.lp-author {
    font-size: 11.5px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.45);
    cursor: pointer;
}

.lp-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.lp-watch-together-btn {
    background: linear-gradient(135deg, #ef4444, #b91c1c);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

.lp-watch-together-btn:hover {
    filter: brightness(1.15);
    transform: scale3d(1.02, 1.02, 1);
}

.lp-watch-together-btn:active {
    transform: scale3d(0.96, 0.96, 1);
}

.lp-open-btn {
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    transition: background 0.15s, color 0.15s;
}

.lp-open-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.lp-ig-open-btn {
    background: linear-gradient(135deg, rgba(214, 36, 159, 0.18), rgba(253, 89, 73, 0.18));
    border: 1px solid rgba(214, 36, 159, 0.35);
    color: #fda4af;
}

.lp-ig-open-btn:hover {
    background: linear-gradient(135deg, rgba(214, 36, 159, 0.3), rgba(253, 89, 73, 0.3));
    color: #ffffff;
}

.link-preview-shimmer {
    margin-top: 8px;
    border-radius: 12px;
    height: 72px;
    width: 100%;
    max-width: 380px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: lpShimmer 1.4s infinite;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

@keyframes lpShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* History Pagination Spinner */
.history-top-spinner {
    display: none;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px 0;
    color: rgba(255, 255, 255, 0.45);
    user-select: none;
    pointer-events: none;
}

.history-top-spinner .spinner-svg {
    animation: historySpin 0.75s linear infinite;
}

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

/* =========================================
   WebSocket Latency Ping-Pong Indicator
   ========================================= */
.chat-title-row {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
}

.chat-title-row h3 {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.status-and-ping-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 1px;
    min-width: 0;
}

.ws-latency-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 6.5px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 10px;
    line-height: 14px;
    font-family: 'JetBrains Mono', Consolas, monospace;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: default;
    transition: all 0.2s ease;
}

.ws-latency-badge:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.ws-latency-badge .ping-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #00a884;
    box-shadow: 0 0 6px #00a884;
    flex-shrink: 0;
}

.ws-latency-badge.latency-good .ping-dot {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.7);
}

.ws-latency-badge.latency-fair .ping-dot {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.7);
}

.ws-latency-badge.latency-poor .ping-dot {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.7);
}

.ws-latency-badge.latency-offline .ping-dot {
    background: #6b7280;
    box-shadow: none;
}

/* =========================================
   Rich Markdown & Code Syntax Highlighting
   ========================================= */
.code-block-wrapper {
    margin: 8px 0;
    border-radius: 10px;
    overflow: hidden;
    background: #121318;
    border: 1px solid rgba(255, 255, 255, 0.09);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
    text-align: left;
}

.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.code-lang-tag {
    font-size: 11px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.code-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.code-copy-btn.copied {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    color: #10b981;
}

.code-content-pre {
    margin: 0;
    padding: 10px 14px;
    font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
    font-size: 12.5px;
    line-height: 1.5;
    color: #e2e8f0;
    overflow-x: auto;
    white-space: pre;
    tab-size: 2;
    -webkit-overflow-scrolling: touch;
}

/* Syntax Token Colors (Atom Dark / One Dark inspired) */
.syn-kwd { color: #c678dd; font-weight: 600; } /* keywords */
.syn-str { color: #98c379; } /* strings */
.syn-num { color: #d19a66; } /* numbers */
.syn-fn  { color: #61afef; } /* function calls */
.syn-com { color: #64748b; font-style: italic; } /* comments */
.syn-op  { color: #56b6c2; } /* operators */
.syn-bool{ color: #e5c07b; font-weight: 600; } /* booleans */

/* Inline Code formatting */
.inline-code {
    display: inline-block;
    padding: 1.5px 5.5px;
    margin: 0 1.5px;
    background: rgba(255, 255, 255, 0.09);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 5px;
    font-family: 'JetBrains Mono', Consolas, Monaco, monospace;
    font-size: 0.88em;
    color: #f43f5e;
    word-break: break-word;
}





/* ==========================================================================
   Cinema Sync (Offline Movie Watch Together Engine) Styles
   ========================================================================== */

/* Fullscreen Setup Modal */
.cinema-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    touch-action: none;
}

.cinema-modal.hidden {
    display: none !important;
}

.cinema-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.cinema-modal-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    background: linear-gradient(180deg, #151a24 0%, #0b0f17 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(255, 255, 255, 0.05), 0 0 24px rgba(56, 189, 248, 0.18);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: cinemaFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes cinemaFadeIn {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.cinema-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.cinema-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cinema-header-icon {
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 8px rgba(56, 189, 248, 0.4));
}

.cinema-title {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: #f8fafc;
    letter-spacing: -0.2px;
}

.cinema-subtitle {
    margin: 2px 0 0;
    font-size: 11.5px;
    color: #94a3b8;
}

.cinema-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cinema-close-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.cinema-modal-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.cinema-hidden-input {
    display: none !important;
}

.cinema-dropzone {
    border: 2px dashed rgba(56, 189, 248, 0.35);
    border-radius: 16px;
    padding: 30px 16px;
    text-align: center;
    cursor: pointer;
    background: rgba(56, 189, 248, 0.03);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinema-dropzone:hover, .cinema-dropzone:active {
    border-color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
    transform: translateY(-1px);
}

.cinema-film-reel {
    color: #38bdf8;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 0 10px rgba(56, 189, 248, 0.35));
}

.cinema-dropzone-prompt {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #f1f5f9;
}

.cinema-dropzone-sub {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    color: #64748b;
}

.cinema-file-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.cinema-file-card.hidden {
    display: none !important;
}

.cinema-file-main {
    display: flex;
    align-items: center;
    gap: 12px;
}

.cinema-file-icon {
    font-size: 26px;
    filter: drop-shadow(0 0 6px rgba(56, 189, 248, 0.4));
}

.cinema-file-details {
    flex: 1;
    min-width: 0;
}

.cinema-file-name {
    font-size: 13.5px;
    font-weight: 600;
    color: #f8fafc;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cinema-file-name-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.cinema-file-name-label {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cinema-input-ext-box {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 3px 6px 3px 10px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.cinema-input-ext-box:focus-within {
    border-color: #38bdf8;
    box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.cinema-file-name-input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    padding: 4px 0;
}

.cinema-file-name-input.highlight-rename {
    color: #fde047;
}

.cinema-file-ext-badge {
    font-size: 10px;
    font-weight: 700;
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
    border-radius: 5px;
    padding: 2px 6px;
    letter-spacing: 0.5px;
    user-select: none;
    flex-shrink: 0;
}

.cinema-file-rename-hint {
    display: none;
    font-size: 11px;
    line-height: 1.35;
    color: #facc15;
    background: rgba(234, 179, 8, 0.1);
    border: 1px solid rgba(234, 179, 8, 0.25);
    border-radius: 6px;
    padding: 5px 8px;
    margin-top: 6px;
}

.cinema-file-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 5px;
}

.cinema-spec-pill {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 10.5px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    color: #93c5fd;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.cinema-file-remove {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: #f87171;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cinema-file-remove:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fff;
}

.cinema-verification-status {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: #94a3b8;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.18);
    border-radius: 8px;
    padding: 7px 10px;
}

.cinema-dot-verified {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.cinema-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

.cinema-btn {
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
}

.cinema-cancel-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
}

.cinema-cancel-btn:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
}

.cinema-send-btn {
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}

.cinema-send-btn:hover:not(:disabled) {
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
    transform: translateY(-1px);
}

.cinema-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ==========================================================================
   Cinema Sync Chat Stream Card (Clean, Unclipped & Responsive)
   ========================================================================== */
.message.cinema-message {
    background: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
    border: none !important;
    box-shadow: none !important;
    max-width: min(340px, 86vw) !important;
    width: fit-content !important;
    overflow: visible !important;
}

.message.cinema-message .msg-content {
    background: transparent !important;
    padding: 0 !important;
    border: none !important;
    box-shadow: none !important;
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
}

.message.cinema-message .msg-text {
    padding: 0 !important;
    margin: 0 !important;
    background: transparent !important;
    width: 100%;
}

.message.cinema-message .msg-footer {
    float: none !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 4px !important;
    margin: 3px 4px 0 0 !important;
    padding: 0 !important;
    font-size: 11px !important;
    color: rgba(255, 255, 255, 0.6) !important;
}

.message-cinema-card {
    background: linear-gradient(135deg, rgba(21, 27, 39, 0.96) 0%, rgba(13, 17, 24, 0.98) 100%);
    border: 1px solid rgba(56, 189, 248, 0.28);
    border-radius: 16px;
    padding: 13px 15px;
    margin: 2px 0 0 0;
    width: 100%;
    min-width: 260px;
    max-width: min(340px, 86vw);
    box-sizing: border-box;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 14px rgba(56, 189, 248, 0.1);
    display: flex;
    flex-direction: column;
    gap: 10px;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
}

.cinema-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    padding-bottom: 7px;
}

.cinema-card-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

.cinema-card-host {
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
    max-width: 150px;
}

.cinema-card-body {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.cinema-card-film-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.22);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cinema-card-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.cinema-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #f8fafc;
    line-height: 1.35;
    word-break: break-all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
    transition: color 0.15s ease;
}

.cinema-card-title.is-revealed {
    white-space: normal !important;
    word-break: break-word !important;
    overflow: visible !important;
    text-overflow: clip !important;
    line-height: 1.4;
    padding: 2px 0;
}

.cinema-card-specs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px;
}

.cinema-card-pill {
    padding: 1.5px 6px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.08);
    color: #93c5fd;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cinema-reveal-name-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1.5px 7px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.12);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    cursor: pointer;
    transition: all 0.15s ease;
}

.cinema-reveal-name-btn:hover,
.cinema-reveal-name-btn:active {
    background: rgba(56, 189, 248, 0.25);
    color: #fff;
}

.cinema-card-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: #cbd5e1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    padding: 6px 9px;
    line-height: 1.35;
}

.cinema-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.cinema-status-dot.amber {
    background: #fbbf24;
    box-shadow: 0 0 6px #fbbf24;
    animation: cinemaPulse 1.8s infinite;
}

.cinema-status-dot.green {
    background: #22c55e;
    box-shadow: 0 0 6px #22c55e;
}

.cinema-status-dot.blue {
    background: #38bdf8;
    box-shadow: 0 0 6px #38bdf8;
}

.cinema-status-dot.red {
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
}

@keyframes cinemaPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.85); }
}

.cinema-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 2px;
}

.cinema-action-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cinema-action-btn svg,
.cinema-card-tag svg {
    flex-shrink: 0;
}

.cinema-waiting-btn {
    background: rgba(251, 191, 36, 0.09);
    color: #fbbf24;
    border: 1px solid rgba(251, 191, 36, 0.28);
    cursor: default;
    opacity: 0.88;
}

.cinema-match-btn {
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.35);
}

.cinema-match-btn:hover {
    background: rgba(56, 189, 248, 0.25);
    color: #fff;
}

.cinema-launch-btn {
    background: linear-gradient(135deg, #0284c7 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 3px 12px rgba(37, 99, 235, 0.4);
}

.cinema-launch-btn:hover {
    box-shadow: 0 5px 16px rgba(37, 99, 235, 0.55);
    transform: translateY(-1px);
}

.cinema-card-status.matched-status {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 8px 10px;
    background: rgba(34, 197, 94, 0.07);
    border: 1px solid rgba(34, 197, 94, 0.28);
    border-radius: 9px;
}

.cinema-match-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
}

.cinema-match-text {
    font-size: 11px;
    color: #f1f5f9;
}

.cinema-size-row {
    display: flex;
    align-items: center;
    width: 100%;
}

/* Cinema Mismatch Comparison Box */
.cinema-mismatch-box {
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.09);
    border: 1px solid rgba(239, 68, 68, 0.35);
    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

.cinema-mismatch-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #f87171;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cinema-mismatch-desc {
    font-size: 11px;
    line-height: 1.45;
    color: #fca5a5;
    background: rgba(0, 0, 0, 0.25);
    padding: 7px 9px;
    border-radius: 7px;
    border-left: 3px solid #ef4444;
}

.cinema-mismatch-desc strong {
    color: #fef2f2;
}

.cinema-mismatch-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(0, 0, 0, 0.25);
    padding: 7px 8px;
    border-radius: 7px;
}

.cinema-mismatch-subhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 10px;
    font-weight: 700;
    color: #94a3b8;
}

.cinema-diff-pill {
    padding: 2px 7px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1.35;
}

.cinema-diff-pill.pill-match {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.cinema-diff-pill.pill-amber {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.45);
    word-break: break-word;
}

.cinema-diff-pill.pill-mismatch {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.35);
}

.cinema-mismatch-grid {
    display: flex;
    gap: 12px;
    font-size: 11px;
}

.cinema-mismatch-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.cinema-mismatch-label {
    font-size: 10px;
    color: #64748b;
    font-weight: 600;
}

.cinema-mismatch-val {
    font-size: 11px;
    font-weight: 600;
    color: #cbd5e1;
}

.cinema-mismatch-val.text-red {
    color: #ef4444;
    font-weight: 700;
}

.cinema-mismatch-val.text-green {
    color: #22c55e;
    font-weight: 700;
}

.cinema-mismatch-diff-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 2px;
}

.cinema-diff-tokens {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
    line-height: 1.4;
}

.cinema-diff-missing {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.5);
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 700;
}

.cinema-diff-extra {
    background: rgba(245, 158, 11, 0.2);
    color: #fde68a;
    border: 1px solid rgba(245, 158, 11, 0.4);
    padding: 1px 5px;
    border-radius: 4px;
    font-weight: 600;
}

.cinema-diff-matched {
    color: #cbd5e1;
    padding: 1px 2px;
}

.cinema-mismatch-size-row {
    font-size: 10px;
    color: #94a3b8;
    padding: 0 4px;
}

.cinema-mismatch-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    color: #38bdf8;
    background: rgba(56, 189, 248, 0.08);
    padding: 6px 9px;
    border-radius: 6px;
    line-height: 1.35;
}

.cinema-retry-btn {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #fca5a5 !important;
    border: 1px solid rgba(239, 68, 68, 0.35) !important;
}

.cinema-retry-btn:hover {
    background: rgba(239, 68, 68, 0.28) !important;
    color: #fff !important;
}

/* Floating Player Title Banner & Controls */
.fwp-title-reveal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    border: none;
    cursor: pointer;
    margin-left: 2px;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.fwp-title-reveal-btn:hover {
    background: rgba(56, 189, 248, 0.2);
    color: #38bdf8;
}

.fwp-title-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 11px;
    color: #f8fafc;
    animation: fwpBannerSlideDown 0.2s ease-out;
}

.fwp-title-banner.hidden {
    display: none !important;
}

@keyframes fwpBannerSlideDown {
    from { transform: translateY(-8px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.fwp-title-banner-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.fwp-title-banner-label {
    font-size: 9px;
    font-weight: 700;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fwp-title-banner-text {
    font-size: 11px;
    font-weight: 600;
    color: #e2e8f0;
    word-break: break-word;
    line-height: 1.35;
    user-select: text;
    -webkit-user-select: text;
}

.fwp-title-banner-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.fwp-copy-title-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 10px;
    font-weight: 600;
    background: rgba(56, 189, 248, 0.15);
    color: #38bdf8;
    border: 1px solid rgba(56, 189, 248, 0.3);
    cursor: pointer;
    transition: all 0.15s ease;
}

.fwp-copy-title-btn:hover {
    background: rgba(56, 189, 248, 0.28);
    color: #fff;
}

.fwp-close-banner-btn {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    border: none;
    cursor: pointer;
    font-size: 12px;
}

.fwp-close-banner-btn:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
}

.fwp-local-video {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    transform: translateZ(0);
    z-index: 5;
    background: transparent !important;
}

.fwp-codec-warning {
    position: absolute;
    top: 8px;
    left: 8px;
    right: 8px;
    z-index: 30;
    background: rgba(17, 24, 39, 0.94);
    border: 1px solid rgba(245, 158, 11, 0.45);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    animation: fwpBannerSlideDown 0.25s ease-out;
}

.fwp-codec-warning.hidden {
    display: none !important;
}

.fwp-codec-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.fwp-codec-text {
    flex: 1;
    font-size: 10px;
    color: #f1f5f9;
    line-height: 1.35;
}

.fwp-codec-text strong {
    display: block;
    color: #fbbf24;
    font-size: 10.5px;
    margin-bottom: 2px;
}

.fwp-codec-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.fwp-codec-dismiss:hover {
    color: #fff;
}

/* Cinema Join Overlay Modal */
.cinema-join-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.78);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 16px;
    animation: cinemaFadeIn 0.2s ease-out;
}

.cinema-join-dialog {
    background: linear-gradient(145deg, #18181b, #09090b);
    border: 1px solid rgba(59, 130, 246, 0.4);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.85), 0 0 24px rgba(59, 130, 246, 0.2);
    border-radius: 18px;
    padding: 22px 20px;
    width: 100%;
    max-width: 360px;
    text-align: center;
    animation: cinemaScaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.cinema-join-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.35);
    color: #60a5fa;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 5px 13px;
    border-radius: 20px;
    margin-bottom: 12px;
}

.cinema-join-title {
    font-size: 15px;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 8px;
    word-break: break-word;
    line-height: 1.35;
}

.cinema-join-desc {
    font-size: 12.5px;
    color: #94a3b8;
    line-height: 1.45;
    margin-bottom: 20px;
}

.cinema-join-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.cinema-join-pick-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(37, 99, 235, 0.4);
    transition: transform 0.15s ease, filter 0.15s ease;
}

.cinema-join-pick-btn:active {
    transform: scale(0.97);
}

.cinema-join-dismiss-btn {
    background: transparent;
    border: none;
    color: #64748b;
    font-size: 12.5px;
    cursor: pointer;
    padding: 6px 12px;
}

.cinema-join-dismiss-btn:hover {
    color: #cbd5e1;
}

@keyframes cinemaFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes cinemaScaleUp {
    from { opacity: 0; transform: scale(0.92); }
    to { opacity: 1; transform: scale(1); }
}

/* ==========================================================================
   CONVOO: GROUPS & RANDOM CHAT
   Simple, direct, 100% SVG icons, dark glass aesthetic, high performance
   ========================================================================== */

/* --- Sidebar Segmented Tabs --- */
.convoo-nav-tabs {
    display: flex;
    gap: 4px;
    padding: 8px 12px 6px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    user-select: none;
}

.convoo-nav-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.convoo-nav-tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
}

.convoo-nav-tab.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
    font-weight: 600;
}

.convoo-nav-tab svg {
    flex-shrink: 0;
}

/* --- Random Chat Action Bar (Directly Under Video & Call Options) --- */
.random-action-bar {
    position: absolute;
    top: calc(var(--header-height, 54px) + 8px + var(--sat, 0px));
    left: 14px;
    right: 14px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: rgba(18, 22, 28, 0.96) !important;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.65);
    pointer-events: auto;
    box-sizing: border-box;
}

#active-chat-container.has-random-bar #messages-container,
#active-chat-container:has(#random-action-bar:not(.hidden)) #messages-container {
    padding-top: calc(var(--header-height, 54px) + 68px + var(--sat, 0px)) !important;
}

#chat-header.is-group #video-call-btn,
#chat-header.is-group #audio-call-btn,
#chat-header.is-random #video-call-btn,
#chat-header.is-random #audio-call-btn {
    display: none !important;
}

.empty-chat-list-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 48px 16px;
    text-align: center;
    color: var(--text-secondary);
}

.empty-chat-list-notice .empty-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.empty-chat-list-notice span {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
}

.empty-chat-list-notice small {
    font-size: 12px;
    color: var(--text-secondary);
}

.random-bar-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    user-select: none;
}

.random-pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.random-bar-btns {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 52;
    pointer-events: auto;
}

.random-bar-btn {
    position: relative;
    z-index: 53;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    pointer-events: auto;
    user-select: none;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

.random-bar-btn svg,
.random-bar-btn span {
    pointer-events: none;
}

.random-bar-btn.btn-end {
    background: rgba(239, 68, 68, 0.14);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.28);
}

.random-bar-btn.btn-end:hover {
    background: rgba(239, 68, 68, 0.25);
}

.random-bar-btn.btn-skip {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.random-bar-btn.btn-skip:hover {
    background: rgba(255, 255, 255, 0.16);
}

.random-bar-btn.btn-add-friend {
    background: rgba(34, 197, 94, 0.14);
    color: var(--accent);
    border: 1px solid rgba(34, 197, 94, 0.28);
}

.random-bar-btn.btn-add-friend:hover:not(:disabled) {
    background: var(--accent);
    color: #000000;
}

.random-bar-btn.btn-add-friend.pending,
.random-bar-btn.btn-add-friend:disabled {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border-color: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    opacity: 0.75;
}

.random-bar-btn.btn-add-friend.active {
    background: var(--accent);
    color: #000000;
    border-color: var(--accent);
}

/* --- Center Finding/Matching Menu (Inside Chat Screen When Looking) --- */
.random-center-menu {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 400px;
    width: min(90%, 380px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0;
    text-align: center;
    padding: 28px 22px 24px;
    background: rgba(20, 24, 28, 0.96);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 16px 40px -8px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(255, 255, 255, 0.05);
    z-index: 30;
    pointer-events: auto;
}

.random-center-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin: 0 auto 16px;
}

.random-center-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px;
}

.random-timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #4ade80;
    padding: 4px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    margin: 6px auto 12px;
}

.random-timer-pulse {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 8px #22c55e;
    animation: randomPulse 1.5s infinite ease-in-out;
}

.random-timer-val {
    letter-spacing: 1px;
}

@keyframes randomPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.35); opacity: 0.45; }
}

.random-center-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin: 0 0 20px;
}

.random-keywords-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 7px;
    margin-bottom: 22px;
}

.random-keyword-chip {
    padding: 6px 13px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.random-keyword-chip:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #ffffff;
}

.random-keyword-chip.active {
    background: rgba(34, 197, 94, 0.16);
    border-color: var(--accent);
    color: var(--accent);
    font-weight: 600;
}

.btn-random-search-now {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 18px;
    background: var(--accent);
    color: #000000;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.btn-random-search-now:hover {
    opacity: 0.92;
}

.random-search-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(0, 0, 0, 0.25);
    border-top-color: #000000;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* --- Inline In-Chat Friend Request Bubble (Text, Not Popup) --- */
.inline-friend-req-box {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 3px 0;
}

.inline-friend-req-text {
    font-size: 13.5px;
    line-height: 1.45;
    word-break: break-word;
}

.inline-friend-req-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.btn-inline-freq-accept {
    padding: 6px 14px;
    background: #22c55e;
    color: #000000;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.15s ease, transform 0.1s ease;
}

.btn-inline-freq-accept:hover {
    filter: brightness(1.1);
}

.btn-inline-freq-accept:active {
    transform: scale(0.96);
}

.btn-inline-freq-decline {
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-inline-freq-decline:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

.btn-inline-freq-decline:active {
    transform: scale(0.96);
}

.inline-friend-req-box.accepted .inline-friend-req-text {
    color: #22c55e;
    font-weight: 500;
}

.inline-friend-req-box.declined .inline-friend-req-text {
    opacity: 0.7;
}

/* --- In-Chat Friend Request Card (Fallback) --- */
.friend-request-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 320px;
    margin: 12px auto;
    padding: 14px 16px;
    background: rgba(30, 34, 40, 0.95);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 14px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
    text-align: center;
}

.friend-req-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 13px;
    color: #ffffff;
}

.friend-req-content svg {
    color: var(--accent);
    flex-shrink: 0;
}

.friend-req-actions {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-friend-decline {
    flex: 1;
    padding: 7px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}

.btn-friend-decline:hover {
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
}

.btn-friend-accept {
    flex: 1;
    padding: 7px 12px;
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 8px;
    color: #000000;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-friend-accept:hover {
    opacity: 0.92;
}

.friend-request-header {
    display: flex;
    align-items: center;
    gap: 10px;
    text-align: left;
    margin-bottom: 4px;
}

.friend-req-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #000000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.friend-req-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.friend-req-info strong {
    font-size: 13px;
    color: #ffffff;
}

.friend-req-info span {
    font-size: 11px;
    color: var(--text-secondary);
}

.friend-req-status-text {
    font-size: 13px;
    font-weight: 500;
    padding: 6px 0;
}

.friend-req-status-text.success {
    color: var(--accent);
}

.friend-req-status-text.declined {
    color: var(--text-secondary);
}

.random-chat-notice {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 6px 14px;
    margin: 8px auto;
    width: fit-content;
    max-width: 85%;
}

/* --- Group Details Drawer & Styling --- */
.space-drawer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 4000;
    display: flex;
    justify-content: flex-end;
}

.space-drawer-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.space-drawer-panel {
    position: relative;
    width: 100%;
    max-width: 380px;
    height: 100%;
    background: var(--bg-sidebar);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.5);
    z-index: 2;
}

.space-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: calc(16px + var(--sat, 0px)) 20px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.space-drawer-title {
    font-size: 15px;
    font-weight: 600;
    color: #ffffff;
}

.space-drawer-body {
    padding: 24px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.space-hero-avatar {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin: 0 auto 14px;
}

.space-drawer-name {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 6px;
    text-align: center;
}

.space-drawer-topic {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 20px;
    text-align: center;
    line-height: 1.4;
}

.space-stats-row {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.space-stat-pill {
    flex: 1;
    padding: 12px 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.space-stat-pill .stat-num {
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
}

.space-stat-pill .stat-lbl {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.space-action-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.space-quick-action {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s ease;
}

.space-quick-action:hover {
    background: rgba(255, 255, 255, 0.12);
}

.space-members-section {
    flex: 1;
    margin-bottom: 20px;
}

.space-section-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.space-members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.space-member-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

.space-member-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.space-member-name {
    font-size: 13px;
    font-weight: 500;
    color: #ffffff;
}

.space-member-role-tag {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
}

.role-founder {
    background: rgba(234, 179, 8, 0.15);
    color: #eab308;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.role-moderator {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.role-member {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-remove-member {
    padding: 4px;
    border-radius: 6px;
    color: #ef4444;
    cursor: pointer;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-member:hover {
    background: rgba(239, 68, 68, 0.15);
}

.space-danger-zone {
    margin-top: auto;
    padding-top: 16px;
}

.btn-space-leave {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: 10px;
    color: #ef4444;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.btn-space-leave:hover {
    background: rgba(239, 68, 68, 0.18);
}

.group-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 1px 6px;
    border-radius: 4px;
    background: rgba(34, 197, 94, 0.12);
    color: var(--accent);
    border: 1px solid rgba(34, 197, 94, 0.25);
    margin-left: 6px;
}

.group-member-count {
    font-size: 11px;
    color: var(--text-secondary);
    margin-left: 4px;
}

.space-sender-tag {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 2px;
}

