: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: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.pane-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-header);
    flex-shrink: 0;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
}

.avatar-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #333, #555);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1rem;
}

.actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.action-btn {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.action-btn:hover {
    background: #333;
    color: var(--text-primary);
}

.action-btn.primary-text {
    color: var(--accent);
    background: var(--bg-card);
}

.action-btn.primary-text:hover {
    background: #333;
}

.search-bar {
    padding: 12px;
}

.search-bar input {
    width: 100%;
    background: var(--bg-header);
    border: none;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-primary);
}

#conversations-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    -webkit-overflow-scrolling: touch;
    will-change: transform;
    transform: translateZ(0);
    overscroll-behavior: contain;
}

.chat-item {
    padding: 12px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    border-bottom: 1px solid transparent;
}

.chat-item:hover {
    background: var(--bg-card);
}

.chat-item.active {
    background: var(--bg-card);
}

/* Online indicator dot */
.online-dot {
    width: 10px;
    height: 10px;
    background: #22c55e;
    border-radius: 50%;
    border: 2px solid #18181b;
    flex-shrink: 0;
}

/* Delete button removed - long press / hold used exclusively */

.chat-item-info {
    flex: 1;
    min-width: 0;
}

.chat-item-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-item-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.chat-item-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.chat-item-bottom {
    display: flex;
    justify-content: space-between;
}

.chat-item-preview {
    color: var(--text-secondary);
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-badge {
    background: var(--accent);
    color: black;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: bold;
}

/* --- 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 {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.chat-header {
    background: var(--bg-header);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    overflow: visible;
}

.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 {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 5%;
    display: flex;
    flex-direction: column;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    contain: layout style;
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

#messages-list {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 14px;
}

/* 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 0.5px rgba(11, 20, 26, .13);
    /* 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;
    contain: layout style;
}

.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;
}

/* Typing Indicator Bubble */
.typing-indicator {
    max-width: 140px !important;
    min-width: 120px;
    padding: 6px 7px 8px 9px !important;
    border-radius: 7.5px;
    border-top-left-radius: 0;
    background: #1f2c34;
    transition: max-width 0.32s cubic-bezier(0.16, 1, 0.3, 1), 
                min-width 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                background 0.32s ease,
                border-radius 0.32s ease;
}
.typing-indicator.peek-open {
    max-width: 65% !important;
    min-width: 160px;
    width: fit-content;
    margin-bottom: 6px;
}
.typing-indicator.morphed {
    min-width: 0 !important;
    width: fit-content !important;
    max-width: 65% !important;
}
.typing-indicator .msg-content.typing-bubble-content {
    padding: 0 !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 0;
}
.typing-bubble-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    max-height: 40px;
    opacity: 1;
    margin-bottom: 6px;
    transform: translateY(0);
    transition: max-height 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.24s ease,
                margin-bottom 0.32s ease,
                transform 0.24s ease;
}
.typing-bubble-header.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-bottom: 0 !important;
    transform: translateY(-8px);
    overflow: hidden;
    pointer-events: none;
}
/* Sacred Untouched 3 Bouncing Dots */
.typing-dots {
    display: flex;
    align-items: center;
    gap: 4px;
    height: 20px;
}
.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(-6px); opacity: 1; }
}

/* Eye button on the right of 3 dots */
.typing-peek-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
    outline: none;
    padding: 2px 7px;
    border-radius: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    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;
}
.typing-peek-btn:hover {
    color: var(--text-primary, #e9edef);
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.12);
}
.typing-peek-btn.active {
    color: var(--accent, #00a884);
    background: rgba(0, 168, 132, 0.15);
    border-color: rgba(0, 168, 132, 0.35);
    box-shadow: 0 0 8px rgba(0, 168, 132, 0.2);
}
.typing-peek-btn svg {
    width: 15px;
    height: 15px;
    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 4px var(--accent, #00a884));
}
.peek-btn-label {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Expandable Peek Box (The Loved Black Box) */
.peek-reveal-box {
    display: none;
    background: rgba(11, 20, 26, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 6px 8px;
    font-size: 14.2px;
    line-height: 19px;
    color: var(--text-primary, #e9edef);
    word-break: break-word;
    position: relative;
    overflow: hidden;
    transition: background 0.35s ease,
                border-color 0.35s ease,
                padding 0.35s ease,
                border-radius 0.35s ease;
}
.peek-reveal-box.open {
    display: block;
    animation: peekExpand 0.36s cubic-bezier(0.16, 1, 0.3, 1);
}
.peek-reveal-box.morphed {
    background: transparent !important;
    border-color: transparent !important;
    padding: 0 !important;
    border-radius: 0 !important;
}
@keyframes peekExpand {
    0% { opacity: 0; transform: translateY(-4px) scale(0.98); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

.peek-header-tag {
    font-size: 0.66rem;
    font-weight: 700;
    color: var(--text-secondary, #8696a0);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 5px;
    max-height: 20px;
    opacity: 1;
    transition: max-height 0.28s ease, opacity 0.2s ease, margin-bottom 0.28s ease;
}
.peek-header-tag.collapsed {
    max-height: 0 !important;
    opacity: 0 !important;
    margin-bottom: 0 !important;
    overflow: hidden;
}
.peek-live-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--accent, #00a884);
    box-shadow: 0 0 6px var(--accent, #00a884);
    animation: peekLivePulse 1.4s infinite;
}
@keyframes peekLivePulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(1.3); }
}

/* Character Stream with Fluid Opacity Animation & Zero Line-Break Shift */
.peek-text-stream {
    display: inline;
    font-size: 14.2px;
    line-height: 19px;
    word-break: break-word;
    color: var(--text-primary, #e9edef);
}
.peek-char {
    display: inline-block;
    transition: opacity 0.22s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.18s cubic-bezier(0.16, 1, 0.3, 1),
                text-shadow 0.22s ease;
    transform-origin: bottom center;
}
.peek-char.head-char {
    font-weight: 600;
    color: #ffffff;
}
.peek-caret {
    display: inline-block;
    width: 2px;
    height: 14px;
    background: var(--accent, #00a884);
    margin-left: 2px;
    vertical-align: -1px;
    box-shadow: 0 0 6px var(--accent, #00a884);
    animation: peekCaretGlow 0.9s infinite ease-in-out;
}
.peek-caret.dissolved {
    display: none !important;
    opacity: 0 !important;
}
@keyframes peekCaretGlow {
    0%, 100% { opacity: 1; transform: scaleY(1); }
    50% { opacity: 0.2; transform: scaleY(0.85); }
}

/* Morph Timestamp: Smoothly reveals when morph completes (Matches .msg-footer inline float 1:1) */
.peek-time-meta {
    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.28s ease;
}
.peek-time-meta.revealed {
    opacity: 1;
}
.peek-time-meta .timestamp {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
}

/* 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 - Clean WhatsApp Style */
.chat-input-area {
    padding: 6px 12px;
    background: var(--bg-header);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    flex-shrink: 0;
    position: relative;
    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,
body.is-native-app .chat-header {
    padding-top: max(28px, env(safe-area-inset-top, 28px)) !important;
    height: calc(54px + max(28px, env(safe-area-inset-top, 28px))) !important;
    min-height: calc(54px + max(28px, env(safe-area-inset-top, 28px))) !important;
    max-height: calc(54px + max(28px, env(safe-area-inset-top, 28px))) !important;
    box-sizing: border-box !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(16px, env(safe-area-inset-bottom, 24px));
}

body.is-native-app.keyboard-open .chat-input-area {
    padding-bottom: 6px !important;
}

#message-form {
    display: flex;
    gap: 6px;
    width: 100%;
    align-items: center;
    margin: 0;
    padding: 0;
}

#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: 44px;
    height: 44px;
    min-width: 44px;
    background: var(--accent);
    color: #111b21;
    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;
}

#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);
}

.chat-input-area {
    position: relative;
}

#send-btn svg,
.send-btn-ig svg {
    width: 22px;
    height: 22px;
    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: translateX(0);
    }

    body.show-chat #sidebar {
        display: none;
    }

    .mobile-only,
    #back-btn,
    .header-back-btn {
        display: flex;
    }

    .pane-header {
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
        padding: 0 12px 0 8px;
        box-sizing: border-box;
    }

    #sidebar .pane-header {
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
        padding: 0 12px;
        box-sizing: border-box;
    }

    .chat-header {
        height: 54px !important;
        min-height: 54px !important;
        max-height: 54px !important;
        padding: 0 8px 0 4px;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    #back-btn,
    .header-back-btn,
    .chat-info,
    .chat-header-actions {
        transform: translateY(-8px);
    }

    /* Native Android APK Mode: Status bar safe-area top padding */
    body.is-native-app .pane-header,
    body.is-native-app #sidebar .pane-header,
    body.is-native-app .chat-header {
        padding-top: max(28px, env(safe-area-inset-top, 28px)) !important;
        height: calc(54px + max(28px, env(safe-area-inset-top, 28px))) !important;
        min-height: calc(54px + max(28px, env(safe-area-inset-top, 28px))) !important;
        max-height: calc(54px + max(28px, env(safe-area-inset-top, 28px))) !important;
        box-sizing: border-box !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;
}

/* GIF Picker Fullscreen */
.gif-picker {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-app);
    display: flex;
    flex-direction: column;
    z-index: 200;
    animation: fadeIn 0.2s ease-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.gif-picker.hidden {
    display: none;
}

.gif-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    color: var(--text-primary);
}

body.is-native-app .gif-picker-header {
    padding-top: max(28px, env(safe-area-inset-top, 28px));
}

.gif-close {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.4rem;
    font-weight: bold;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 4px;
}

.gif-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.gif-picker input {
    margin: 12px 16px;
    padding: 10px 14px;
    background: var(--bg-header);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.gif-picker input:focus {
    outline: none;
    border-color: var(--accent);
}

.gif-picker input::placeholder {
    color: var(--text-secondary);
}

/* GIF Results Grid */
.gif-grid {
    flex: 1;
    overflow-y: auto;
    padding: 8px 12px 12px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.gif-grid img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
    background: var(--bg-header);
}

.gif-grid img:hover {
    transform: scale(1.05);
    opacity: 0.9;
}

.gif-grid .gif-loading,
.gif-grid .gif-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 0.9rem;
}

.gif-grid .gif-loading-more {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-secondary);
    padding: 12px;
    font-size: 0.8rem;
}

/* 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;
}



/* --- Header & Layout --- */
.pane-header {
    height: auto;
    min-height: 60px;
    /* Reduced min-height slightly */
    display: flex;
    align-items: center;
    padding: 8px 16px;
    padding-top: max(24px, env(safe-area-inset-top));
    /* Adjusted for status bar clearance */
    background: var(--bg-header);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.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: transform 0.15s ease-out;
    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;
    background: #1f2c34;
    border-left: 4px solid #00a884;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

.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;
    font-size: 1.2rem;
    pointer-events: none;
    transition: opacity 0.15s, transform 0.15s;
    color: #00a884;
}

.message.swiping-right .swipe-reply-icon {
    opacity: 1;
}/* RTL: Right Swipe Action Dock (Linear / Raycast Luxury Minimal) */
.message-swipe-actions {
    position: absolute;
    right: -88px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    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 {
    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;
    background: #1f2c34;
    border-left: 4px solid #00a884;
    padding: 8px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    touch-action: manipulation;
    user-select: none;
    animation: editingSlideIn 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.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;
    }
}

.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: 4px;
}

.voice-progress {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    cursor: pointer;
}

.voice-progress-bar {
    height: 100%;
    background: white;
    width: 0%;
    transition: width 0.1s linear;
}

.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;
    animation: fadeIn 0.2s ease-out;
}

.wallpaper-modal.hidden {
    display: none;
}

.wallpaper-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: max(28px, 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;
}

.wallpaper-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 20px;
    overflow: auto;
}

/* Wallpaper Preview */
.wallpaper-preview {
    flex: 1;
    min-height: 200px;
    max-height: 300px;
    background: var(--bg-card);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: cover;
    background-position: center;
    border: 2px dashed var(--border);
}

.wallpaper-preview-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.wallpaper-preview.has-image .wallpaper-preview-text {
    display: none;
}

/* Wallpaper Controls */
.wallpaper-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wallpaper-file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.wallpaper-file-label:hover {
    background: var(--bg-sidebar);
    border-color: var(--accent);
}

.wallpaper-file-label input {
    display: none;
}

.opacity-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.opacity-control label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.opacity-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--bg-card);
    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: var(--accent);
    cursor: pointer;
}

/* Wallpaper Actions */
.wallpaper-actions {
    display: flex;
    gap: 12px;
    padding-bottom: max(12px, env(safe-area-inset-bottom));
}

.wallpaper-btn-clear,
.wallpaper-btn-apply {
    flex: 1;
    padding: 14px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.wallpaper-btn-clear {
    background: #374151;
    color: white;
}

.wallpaper-btn-clear:hover {
    background: #4b5563;
}

.wallpaper-btn-apply {
    background: var(--accent);
    color: #111b21;
}

.wallpaper-btn-apply:hover {
    background: #16a34a;
}

/* Wallpaper Preview Dummy Messages */
.wallpaper-dummy-messages {
    display: none;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 12px;
}

.wallpaper-preview.has-image .wallpaper-dummy-messages {
    display: flex;
}

.dummy-msg {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
}

.dummy-msg.sent {
    background: #005c4b;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.dummy-msg.received {
    background: #202c33;
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

/* Chat Wallpaper Background - GPU accelerated */
#messages-container.has-wallpaper {
    position: relative;
    will-change: scroll-position;
    transform: translateZ(0);
    contain: layout style;
}

#messages-container.has-wallpaper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    pointer-events: none;
    z-index: 0;
    will-change: transform;
    transform: translateZ(0);
}



/* =========================================
   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
   ========================================= */
.msg-text.magic-love {
    background: linear-gradient(90deg, #ff6b6b, #ee5a9f, #ff6b6b);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    animation: magicGradient 2s ease infinite;
}

.msg-text.magic-fire {
    background: linear-gradient(90deg, #ff512f, #f09819, #ff512f);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    animation: magicGradient 1.5s ease infinite;
}

.msg-text.magic-birthday {
    background: linear-gradient(90deg, #a855f7, #ec4899, #f97316, #a855f7);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    animation: magicGradient 3s ease infinite;
}

.msg-text.magic-congrats {
    background: linear-gradient(90deg, #fbbf24, #f97316, #fbbf24);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
    animation: magicGradient 2s ease infinite;
}

@keyframes magicGradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* 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 {
    position: absolute;
    font-size: 2rem;
    will-change: transform, opacity;
}

/* Animation Variants */
.magic-particle.move-rise {
    animation: particlesRise 4s ease-out forwards;
}

.magic-particle.move-float {
    animation: particlesFloat 5s ease-in-out forwards;
}

.magic-particle.move-confetti {
    animation: particlesConfetti 4s linear forwards;
}

.magic-particle.move-explode {
    animation: particlesExplode 1s ease-out forwards;
}

.magic-particle.move-twinkle {
    animation: particlesTwinkle 3s ease-in-out forwards;
}

/* Keyframes */
@keyframes particlesRise {
    0% {
        transform: translateY(0) scale(0.5) rotate(0deg);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    100% {
        transform: translateY(-120vh) scale(1) rotate(360deg);
        opacity: 0;
    }
}

@keyframes particlesFloat {
    0% {
        transform: translateY(0) translateX(0) scale(0.5);
        opacity: 0;
    }

    10% {
        opacity: 1;
    }

    50% {
        transform: translateY(-50vh) translateX(20px) scale(1);
    }

    100% {
        transform: translateY(-120vh) translateX(-20px) scale(0.8);
        opacity: 0;
    }
}

@keyframes particlesConfetti {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(120vh) rotate(720deg);
        opacity: 0;
    }
}

@keyframes particlesExplode {
    0% {
        transform: scale(0.5);
        opacity: 1;
    }

    50% {
        transform: scale(1.5);
        opacity: 1;
    }

    100% {
        transform: scale(2);
        opacity: 0;
    }
}

@keyframes particlesTwinkle {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2) rotate(180deg);
        opacity: 1;
    }

    100% {
        transform: scale(0.5) rotate(360deg);
        opacity: 0;
    }
}


/* =========================================
   Android / Mobile Input Bar Fixes
   ========================================= */
@media (max-width: 768px) {
    .chat-input-area {
        padding: 6px 12px;
    }

    .input-bar-instagram {
        gap: 6px;
        width: 100%;
        max-width: 100%;
    }

    .input-icon-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        padding: 0;
        z-index: 10;
    }

    .input-wrapper-ig {
        height: 38px;
        padding: 0 12px;
        flex: 1;
        min-width: 0;
    }

    .input-wrapper-ig input {
        font-size: 15px;
        padding: 0;
        height: 100%;
    }

    .send-btn-ig {
        width: 42px;
        height: 42px;
        min-width: 42px;
        z-index: 10;
    }
}

/* Fix for Android WebKit Gradients */
.msg-text.magic-love,
.msg-text.effect-love,
.msg-text.magic-fire,
.msg-text.effect-fire,
.msg-text.magic-birthday,
.msg-text.effect-rainbow,
.msg-text.effect-gift,
.msg-text.effect-confetti {
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
    /* Fallback */
    display: inline;
    /* Required for chrome/android sometimes */
}

/* 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);
}

/* =========================================
   Instagram-Style Input Bar
   ========================================= */
.input-bar-instagram {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 0;
    margin: 0;
}

.input-icon-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
    flex-shrink: 0;
    touch-action: manipulation;
    padding: 0;
}

.input-icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.input-icon-btn.gif-text {
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 0.5px;
    color: var(--accent);
}

.input-icon-btn.gif-text:hover {
    background: rgba(34, 197, 94, 0.1);
}

.input-wrapper-ig {
    flex: 1;
    min-width: 0;
    height: 38px;
    background: #2a3942;
    border-radius: 20px;
    padding: 0 12px;
    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: #8696a0;
}

.right-icons {
    display: flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.right-icons.hidden {
    display: none;
}

.send-btn-ig {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    background: var(--accent);
    color: #111b21;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s, background 0.2s;
    touch-action: manipulation;
}

.send-btn-ig:hover {
    transform: scale(1.08);
    background: #25d366;
}

.send-btn-ig:active {
    transform: scale(0.95);
}

.send-btn-ig.hidden {
    display: none;
}

/* Hide legacy send button styling conflicts */
#send-btn:not(.send-btn-ig) {
    display: none;
}

/* =========================================
   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: 1000;
    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;
    transform: scale3d(1, 1, 1) translate3d(0, 0, 0);
    visibility: visible;
    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: rgba(18, 20, 26, 0.92);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.65), 
                0 4px 12px rgba(0, 0, 0, 0.35), 
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    padding: 6px;
    width: 205px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transform: translateZ(0);
}

.attach-menu-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    outline: none;
    transition: background 0.15s ease, transform 0.15s 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);
}

.attach-menu-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.attach-menu-row:active {
    transform: scale3d(0.96, 0.96, 1);
    background: rgba(255, 255, 255, 0.12);
}

/* 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: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.18s ease, background 0.18s ease;
    transform: translateZ(0);
}

#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: 14px;
    font-weight: 500;
    color: #e2e8f0;
    letter-spacing: -0.1px;
    flex: 1;
}

.attach-row-arrow {
    font-size: 16px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.25);
    transition: transform 0.15s, color 0.15s;
}

.attach-menu-row:hover .attach-row-arrow {
    color: rgba(255, 255, 255, 0.65);
    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: rgba(8, 10, 14, 0.94);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    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
   ========================================= */
.magic-word {
    display: inline-block;
    position: relative;
    z-index: 1;
}

/* Sumit - Sapphire Electric Shimmer */
.magic-word.magic-user-s,
.magic-word.magic-sumit {
    background: linear-gradient(90deg, #00c6ff, #0072ff, #7928ca, #00c6ff);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    animation: magicGradient 3s linear infinite;
    text-shadow: 0 0 12px rgba(0, 198, 255, 0.4);
    letter-spacing: 0.5px;
}

/* Zalu - Romantic Rose & Diamond Sparkle */
.magic-word.magic-user-z,
.magic-word.magic-zalu {
    background: linear-gradient(90deg, #ff758c, #ff7eb3, #ff4e50, #ff758c);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    animation: magicGradient 3s linear infinite, bounce 1.8s ease-in-out infinite;
    text-shadow: 0 0 12px rgba(255, 117, 140, 0.45);
    letter-spacing: 0.5px;
}

/* Zalu & Sumit Combined — Cosmic Infinity Love */
.magic-word.magic-couple,
.magic-word.magic-zalu-sumit {
    background: linear-gradient(90deg, #ff0844, #ffb199, #f77062, #fe5196, #ff0844);
    background-size: 400% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 900;
    animation: magicGradient 2.5s linear infinite, couplePulse 1.2s ease-in-out infinite;
    text-shadow: 0 0 16px rgba(255, 8, 68, 0.6), 0 0 30px rgba(254, 81, 150, 0.4);
    display: inline-block;
    letter-spacing: 0.5px;
}

@keyframes couplePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}

/* Zalu + Sumit Center Special Fullscreen Animation */
.zalu-sumit-banner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 100;
    animation: zaluSumitPop 3.2s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    pointer-events: none;
    text-align: center;
}

.zalu-sumit-heart-icon {
    font-size: 5rem;
    filter: drop-shadow(0 0 25px rgba(255, 105, 180, 0.8)) drop-shadow(0 0 50px rgba(255, 20, 147, 0.6));
    animation: heartBeat 0.8s ease-in-out infinite alternate;
}

.zalu-sumit-title {
    font-size: 2.2rem;
    font-weight: 900;
    font-family: inherit;
    background: linear-gradient(135deg, #ff758c, #ff7eb3, #ff4e50, #ffd700);
    background-size: 300% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
    letter-spacing: 1px;
    white-space: nowrap;
    animation: magicGradient 2s linear infinite;
}

.zalu-sumit-subtitle {
    font-size: 0.95rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 5px 18px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

@keyframes zaluSumitPop {
    0% {
        transform: translate(-50%, -50%) scale(0) rotate(-15deg);
        opacity: 0;
    }
    18% {
        transform: translate(-50%, -50%) scale(1.15) rotate(4deg);
        opacity: 1;
    }
    28% {
        transform: translate(-50%, -50%) scale(1) rotate(0deg);
        opacity: 1;
    }
    80% {
        transform: translate(-50%, -50%) scale(1.05) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(0.2) translateY(-80px);
        opacity: 0;
    }
}

@keyframes heartBeat {
    from { transform: scale(1); }
    to { transform: scale(1.18); }
}

/* Love - Pink Gradient & Bounce */
.magic-word.magic-love {
    background: linear-gradient(90deg, #ff6b6b, #ee5a9f, #ff6b6b);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800;
    animation: magicGradient 2s ease infinite, bounce 1.5s ease-in-out infinite;
    text-shadow: 0 0 10px rgba(236, 72, 153, 0.3);
}

/* Angry - Red, Shaky, Hot */
.magic-word.magic-angry {
    color: #ef4444;
    font-weight: 900;
    text-transform: uppercase;
    animation: shake 0.4s cubic-bezier(.36, .07, .19, .97) both infinite;
    text-shadow: 2px 2px 0px #000, 0 0 15px rgba(255, 0, 0, 0.6);
    letter-spacing: 1px;
}

/* Keyframes */
@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 1px, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, -1px, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-3px, 2px, 0);
    }

    40%,
    60% {
        transform: translate3d(3px, -2px, 0);
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-4px);
    }
}

/* =========================================
   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: 6px 12px !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: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* =========================================
   Scroll-to-Bottom Button (WhatsApp style)
   ========================================= */
.scroll-bottom-btn {
    position: absolute;
    bottom: 15px;
    right: 15px;
    z-index: 50;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2a3942;
    color: #8696a0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    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; }
.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: 8px; top: 56px; background-color: #233138; border: 1px solid rgba(255,255,255,0.1); border-radius: 8px; box-shadow: 0 8px 16px rgba(0,0,0,0.5); min-width: 160px; z-index: 9999; display: flex; flex-direction: column; transform-origin: top right; animation: scaleIn 0.2s ease-out forwards; }
.kebab-dropdown.hidden { display: none; }
.kebab-item { padding: 12px 16px; display: flex; align-items: center; gap: 12px; cursor: pointer; color: var(--text-color); transition: background-color 0.2s; }
.kebab-item:hover { background-color: var(--hover-color); }

/* =========================================
   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);
}

/* --- RedGifs NSFW Feature --- */
.nsfw-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 12px;
}

.nsfw-toggle-label {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-secondary);
    transition: color 0.3s ease;
}

.nsfw-toggle-container input:checked ~ .nsfw-toggle-label,
.nsfw-toggle-container:has(input:checked) .nsfw-toggle-label {
    color: #ef4444; /* Bright Red */
}

/* Switch styling */
.nsfw-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.nsfw-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.nsfw-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #3f3f46;
    transition: .3s;
}

.nsfw-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
}

.nsfw-switch input:checked + .nsfw-slider {
    background-color: #ef4444; /* Turn red when turned on */
}

.nsfw-switch input:checked + .nsfw-slider:before {
    transform: translateX(16px);
}

.nsfw-slider.nsfw-round {
    border-radius: 20px;
}

.nsfw-slider.nsfw-round:before {
    border-radius: 50%;
}

/* NSFW Preview Modal styling */
.nsfw-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999999; /* Higher than keyboard and picker */
    padding: 16px;
    backdrop-filter: blur(8px);
}

.nsfw-preview-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 450px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}

.nsfw-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
}

.nsfw-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 18px;
    cursor: pointer;
}

.nsfw-preview-video-container {
    position: relative;
    width: 100%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    max-height: 400px;
}

.nsfw-preview-video-container video {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
}

.nsfw-preview-loader {
    position: absolute;
    color: var(--text-secondary);
    font-size: 14px;
}

.nsfw-preview-actions {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-top: 1px solid var(--border);
}

.nsfw-btn-cancel {
    flex: 1;
    padding: 12px;
    background: #27272a;
    color: var(--text-primary);
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.nsfw-btn-cancel:hover {
    background: #3f3f46;
}

.nsfw-btn-send {
    flex: 1;
    padding: 12px;
    background: #ef4444; /* NSFW style Send button */
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.2s;
}

.nsfw-btn-send:hover {
    background: #dc2626;
}

/* =========================================
   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;
}

/* 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;
    transform: scale3d(1, 1, 1) translate3d(0, 0, 0);
    visibility: visible;
    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: rgba(18, 20, 26, 0.94);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.7), 
                0 4px 14px rgba(0, 0, 0, 0.4), 
                inset 0 1px 0 rgba(255, 255, 255, 0.15);
    border-radius: 18px;
    padding: 6px;
    width: 215px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 3px;
    transform: translateZ(0);
}

.kebab-menu-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-radius: 12px;
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    outline: none;
    transition: background 0.15s ease, transform 0.15s 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);
}

.kebab-menu-row:hover {
    background: rgba(255, 255, 255, 0.08);
}

.kebab-menu-row:active {
    transform: scale3d(0.96, 0.96, 1);
    background: rgba(255, 255, 255, 0.12);
}

/* 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: 32px;
    height: 32px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: transform 0.18s ease, background 0.18s ease;
    transform: translateZ(0);
}

/* 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;
}



/* 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-row-label {
    font-size: 14px;
    font-weight: 500;
    color: #e2e8f0;
    letter-spacing: -0.1px;
    flex: 1;
}

.kebab-menu-row.row-danger .kebab-row-label {
    color: #fca5a5;
}

.kebab-row-arrow {
    font-size: 16px;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.25);
    transition: transform 0.15s, color 0.15s;
}

.kebab-menu-row:hover .kebab-row-arrow {
    color: rgba(255, 255, 255, 0.65);
    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%;
    height: 160px;
    background: #0f172a;
    overflow: hidden;
    cursor: pointer;
}

.lp-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.25s ease;
}

.lp-media-wrapper:hover .lp-image {
    transform: scale3d(1.03, 1.03, 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; }
}

